Did you know ... Search Documentation:
cql_database.pl
PublicShow source
Source 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.

Source odbc_execute_with_statement_cache(+Connection, +FileName, +LineNumber, +Sql, +OdbcParameters, +OdbcParameterDataTypes, -Row)
Source 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
Source 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.

Source 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)
Source application_value_to_odbc_value(+ApplicationValue, +OdbcDataType, +Schema, +TableName, +ColumnName, +Qualifiers, -OdbcValue)
Source odbc_value_to_application_value(+Schema, +TableSpec, +ColumnName, +OdbcValue, ?ApplicationValue)
Source current_transaction_id(-TransactionId)

Undocumented predicates

The following predicates are exported, but not or incorrectly documented.

Source odbc_connection_call(Arg1, Arg2, Arg3)
Source transaction_active
Source database_transaction_query_info(Arg1, Arg2, Arg3)
Source database_connection_details(Arg1, Arg2)
Source update_history(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14)
Source cql_transaction(Arg1, Arg2, Arg3)
Source get_transaction_context(Arg1, Arg2, Arg3, Arg4, Arg5)