- odbc_cleanup_and_disconnect(+Connection) is det
- Rollback the current transaction, retract and free prepared statements, then disconnect.
To avoid leaks, all exiting threads with database connections should call this. See odbc_connection_call/2 (thread_at_exit/1)
Note that any exception inside odbc_cleanup_and_disconnect/1 will result in it not going on to the next step.
We log exceptions to the event log because exceptions at this level are associated with the server process crashing
and the SE log is unlikely to capture anything useful.
- odbc_execute_with_statement_cache(+Connection, +FileName, +LineNumber, +Sql, +OdbcParameters, +OdbcParameterDataTypes, -Row)
- save_database_event(+AccessToken, +EventType, +Schema, +TableName, +PrimaryKeyColumnName, +PrimaryKey)
- Need this because its called from the caller's module and we want the fact asserted
in this module
- resolve_deadlock(:Goal)
- Call Goal as in catch/3. If a deadlock ('40001') error occurs then Goal is called again immediately if another transaction has completed in the
time since Goal was called, since that transaction may well have been the reason for the deadlock.
If no other transaction has completed Goal is called again after a random delay of 0.0 to 2.0 seconds. The maximum number of retries
is specified by maximum_deadlock_retries/1. It is important to note that the deadlock mechanism actually retries Goal, i.e. it calls it
again.
Use this only when you are sure Goal has no non-database side effects (assert/retract, file operations etc)
Originally developed for use inside cql_transaction/3, resolve_deadlock/1 can also be used to ensure non-transactional
operations can resolve deadlocks.
- register_database_connection_details(+Schema:atom, +ConnectionDetails) is det
- This should be called once to register the database connection details.
- Arguments:
-
ConnectionDetails | - driver_string(DriverString) or dsn(Dsn, Username, Password) |
- application_value_to_odbc_value(+ApplicationValue, +OdbcDataType, +Schema, +TableName, +ColumnName, +Qualifiers, -OdbcValue)
- odbc_value_to_application_value(+Schema, +TableSpec, +ColumnName, +OdbcValue, ?ApplicationValue)
- current_transaction_id(-TransactionId)
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
- database_connection_details(Arg1, Arg2)
- transaction_active
- get_transaction_context(Arg1, Arg2, Arg3, Arg4, Arg5)
- cql_transaction(Arg1, Arg2, Arg3)
- database_transaction_query_info(Arg1, Arg2, Arg3)
- odbc_connection_call(Arg1, Arg2, Arg3)
- update_history(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14)