====== Stored Procedures in der VoltDB ======
===== Mit Java =====
* erzeuge Java-File:
import org.voltdb.*;
public class extends VoltProcedure {
public final SQLStmt = new SQLStmt(
" SELECT *"
+ " FROM foo WHERE bar=?"
+ " ORDER BY whatever ASC;" );
public VoltTable[] run(int bar_value)
throws VoltAbortException {
voltQueueSQL( , bar_value );
return voltExecuteSQL();
}
}
* kompilieren
javac -cp "$CLASSPATH:/opt/voltdb/voltdb/*" .java
* packen
jar cvf .jar *.class
* Klassen in die VoltDB laden (''%%sqlcmb%%'' in ''%%/opt/voltdb/bin%%'')
sqlcmd --user=admin --password=
1> load classes .jar;
* stored procedure erstellen (bei ''%%create procedure%%'' ist mehr möglich https://docs.voltdb.com/UsingVoltDB/ddlref_createprocjava.php)
sqlcmd --user=admin --password=
1> CREATE PROCEDURE FROM CLASS ;