system.db.commitTransaction
This function is used in Python Scripting.
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
If you are done with the transaction, you must close it after you commit it.
Client Permission Restrictionsβ
This scripting function has Client Permission restrictions.
Syntaxβ
system.db.commitTransaction(tx)
Parametersβ
| Type | Parameter | Description |
|---|---|---|
| String | tx | The transaction ID. |
Returns Nothing
Scopeβ
Gateway, Vision Client, Perspective Session
Code Examplesβ
Running a Query Using Query Transactions
# This example starts a transaction with a 5 second timeout against the project's default database, using the default isolation level. Then it executes a series of update calls,
# and commits and closes the transaction.
txId = system.db.beginTransaction(timeout=5000)
status=2
for machineId in range(8):
system.db.runPrepUpdate("UPDATE MachineStatus SET status=? WHERE ID=?",
args=[status, machineId], tx=txId)
system.db.commitTransaction(txId)
system.db.closeTransaction(txId)