Asterisk - The Open Source Telephony Project
18.5.0
|
Go to the source code of this file.
Functions | |
struct odbc_obj * | ast_odbc_retrieve_transaction_obj (struct ast_channel *chan, const char *objname) |
Retrieve an ODBC transaction connection with the given ODBC class name. More... | |
struct odbc_obj* ast_odbc_retrieve_transaction_obj | ( | struct ast_channel * | chan, |
const char * | objname | ||
) |
Retrieve an ODBC transaction connection with the given ODBC class name.
XXX This function is majorly flawed because it ignores properties of transactions and simply finds one that corresponds to the given DSN. The problem here is that transactions have names and they maintain which transaction is "active" for operations like transaction creation, commit, and rollback. However, when it comes to intermediary operations to be made on the transactions, all that is ignored. It means that if a channel has created multiple transactions for the same DSN, it's a crapshoot which of those transactions the operation will be performed on. This can potentially lead to baffling errors under the right circumstances.
XXX The semantics of this function make for writing some awkward code. If you use func_odbc as an example, it has to first try to retrieve a transactional connection, then failing that, create a non-transactional connection. The result is that it has to remember which type of connection it's using and know whether to release the connection when completed or not. It would be much better if callers did not have to jump through such hoops.
chan | Channel on which the ODBC transaction was created |
objname | The name of the ODBC class configured in res_odbc.conf |
NULL | Transaction connection could not be found. |
non-NULL | A transactional connection |
Definition at line 466 of file res_odbc_transaction.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, AST_LIST_HEAD, AST_LIST_LOCK, AST_LIST_TRAVERSE, AST_LIST_UNLOCK, ast_odbc_class_get_name(), ast_datastore::data, odbc_txn_frame::list, NULL, odbc_txn_frame::obj, and odbc_obj::parent.
Referenced by acf_odbc_write().