Download 2 Overview - Inductive Automation

Transcript
Appendix C. Scripting Functions
469
system.db.closeTransaction( tx)
Parameters
String tx - The transaction ID.
Returns
nothing
Scope
All
9.4.3
system.db.commitTransaction
Description
Performs a commit for the given transaction. This will make all statements executed against the
transaction since its beginning or since the last commit or rollback take effect in the database. Until
you commit a transaction, any changes that the transaction makes will not be visible to other
connections. Note that if you are done with the transaction, you must close it afterward you commit
it.
Syntax
system.db.commitTransaction( tx)
Parameters
String tx - The transaction ID.
Returns
nothing
Scope
All
9.4.4
system.db.createSProcCall
Description
Creates an SProcCall object, which is a stored procedure call context. This is an object that is used
to configure a call to a stored procedure. Once configured, you'd use system.db.execSProcCall to
call the stored procedure. The call context object then holds any results from the stored procedure.
The SProcCall object has the following functions used for registering parameters:
SPRocCall.registerInParam(index OR name, typeCode, value)
SPRocCall.registerOutParam(index OR name, typeCode)
SPRocCall.registerReturnParam(typeCode)
These functions are used to register any in/out parameters for the stored procedure. Parameters can
be referenced by index (starting at 1, not 0), or by name. To register an in/out parameter, you simply
register it twice - once as an input parameter with the value you'd like to pass to the stored
procedure, and once as an output parameter. N.B. not all JDBC drivers support named procedure
parameters.
If your function returns a value, you must use registerReturnParam to specify the datatype of
the returned value. Note that this is different from stored procedures that return a result set, which
doesn't require any setup on the SProcCall object. Some database systems call stored procedures
© 2011 Inductive Automation