ODBCBeginTrans
(Engine-Level Function)
Description: | Indicates to a specified ODBC-compliant database that a transaction is to be started. |
Returns: | Nothing (return values in parameters) |
Usage: | Script Only. |
Function Groups: | Database and Data Source, ODBC |
Related to: | ODBCCommit | ODBCRollback | TODBCBeginTrans | TODBCCommit | TODBCRollback |
Format: | ODBCBeginTrans(DB [, ErrorMsg, SQLState, ErrorCode]) |
Parameters: |
DB |
Required. An ODBC-compliant database as returned by ODBCConnect. |
ErrorMsg |
A descriptive error or status message, returned by the function. If valid, both ErrorMsg and SQLState will be valid. |
SQLState |
A 5-character SQL State code. SQL State codes are defined by Microsoft and by the vendor of each ODBC driver. |
ErrorCode |
An unsuccessful operation always returns a non-zero value, which is a numeric error code specific to the DBMS vendor's ODBC driver or Microsoft's ODBC Driver Manager. A successful operation will always return a 0. ErrorMsg and SQLState may or may not be set valid in the event of a successful connection. If set valid, they should be examined for relevant status information. |
Comments: | A transaction is a unit of work that is done as a single operation. The operation succeeds or fails as a whole. ODBCBeginTrans indicates that a transaction is to be started on the specified ODBC database. Note that each ODBC database driver may have different levels of transaction support (or none at all), and the documentation for that driver should be consulted to determine the level of transaction support. The transaction should be terminated either with an ODBCCommit or an ODBCRollback. If any error (no matter how minor) occurs as a result of the statement, and the TODBCConnect or ODBCConnect that connected to the database had its Disconnect parameter set to true, the value of DB will become invalid (i.e. the connection to the database will be dropped). |
Example:
[ ODBCBeginTrans(DB); ODBC(DB, "DELETE * FROM TEST"); ODBC(DB, "INSERT INTO TEST VALUES('KeyString', 'Value')"); ODBCCommit(DB); ]