117 ast_debug(2,
"odbc_txn_free(%p) called\n", vdata);
129 .
type =
"ODBC_Transaction",
146 oldlist = txn_store->
data;
149 ast_log(
LOG_ERROR,
"Unable to allocate a new datastore. Cannot create a new transaction.\n");
154 if (!(oldlist =
ast_calloc(1,
sizeof(*oldlist)))) {
155 ast_log(
LOG_ERROR,
"Unable to allocate datastore list head. Cannot create a new transaction.\n");
161 txn_store->
data = oldlist;
182 if (SQLSetConnectAttr(txn->
obj->
con, SQL_ATTR_AUTOCOMMIT, (
void *)SQL_AUTOCOMMIT_OFF, 0) == SQL_ERROR) {
190 if (SQLSetConnectAttr(txn->
obj->
con, SQL_ATTR_TXN_ISOLATION, (
void *)(
long)txn->
isolation, 0) == SQL_ERROR) {
227 oldlist = txn_store->
data;
235 }
else if (!strcasecmp(txn->
name,
name)) {
250 ast_debug(2,
"release_transaction(%p) called (tx->obj = %p\n", tx, tx->
obj);
252 ast_debug(1,
"called on a transactional handle with %s\n", tx->
forcecommit ?
"COMMIT" :
"ROLLBACK");
253 if (SQLEndTran(SQL_HANDLE_DBC, tx->
obj->
con, tx->
forcecommit ? SQL_COMMIT : SQL_ROLLBACK) == SQL_ERROR) {
263 if (SQLSetConnectAttr(tx->
obj->
con, SQL_ATTR_AUTOCOMMIT, (
void *)SQL_AUTOCOMMIT_ON, 0) == SQL_ERROR) {
286 if (SQLEndTran(SQL_HANDLE_DBC, tx->
obj->
con, SQL_COMMIT) == SQL_ERROR) {
308 if (SQLEndTran(SQL_HANDLE_DBC, tx->
obj->
con, SQL_ROLLBACK) == SQL_ERROR) {
325 if (strcasecmp(
args.property,
"transaction") == 0) {
330 }
else if (strcasecmp(
args.property,
"isolation") == 0) {
340 }
else if (strcasecmp(
args.property,
"forcecommit") == 0) {
375 oldlist = txn_store->
data;
399 if (strcasecmp(
args.property,
"transaction") == 0) {
409 }
else if (strcasecmp(
args.property,
"forcecommit") == 0) {
432 }
else if (strcasecmp(
args.property,
"isolation") == 0) {
452 }
else if (SQLSetConnectAttr(tx->
obj->
con, SQL_ATTR_TXN_ISOLATION, (
void *)(
long)
isolation, 0) == SQL_ERROR) {
472 if (!chan || !objname) {
479 oldlist = txn_store->
data;
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
General Asterisk PBX channel definitions.
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_channel_lock(chan)
#define ast_channel_unlock(chan)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
#define ast_debug(level,...)
Log a DEBUG message.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_HEAD_DESTROY(head)
Destroys a list head structure.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_HEAD_INIT(head)
Initializes a list head structure.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_REALTIME_DEPEND
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
#define ast_register_application_xml(app, execute)
Register an application using XML documentation.
Core PBX routines and definitions.
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define ast_custom_function_register(acf)
Register a custom function.
unsigned int ast_odbc_class_get_isolation(struct odbc_class *class)
Get the transaction isolation setting for an ODBC class.
void ast_odbc_release_obj(struct odbc_obj *obj)
Releases an ODBC object previously allocated by ast_odbc_request_obj()
struct ast_str * ast_odbc_print_errors(SQLSMALLINT handle_type, SQLHANDLE handle, const char *operation)
Shortcut for printing errors to logs after a failed SQL operation.
const char * ast_odbc_isolation2text(int iso)
Convert from numeric transaction isolation values to their textual counterparts.
const char * ast_odbc_class_get_name(struct odbc_class *class)
Get the name of an ODBC class.
unsigned int ast_odbc_class_get_forcecommit(struct odbc_class *class)
Get the transaction forcecommit setting for an ODBC class.
int ast_odbc_text2isolation(const char *txt)
Convert from textual transaction isolation values to their numeric constants.
#define ast_odbc_request_obj(name, check)
Get a ODBC connection object.
static struct odbc_txn_frame * find_transaction(struct ast_channel *chan, const char *name, int active)
static struct ast_custom_function odbc_function
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.
static struct odbc_txn_frame * create_transaction(struct ast_channel *chan, const char *name, const char *dsn)
static int mark_transaction_active(struct ast_channel *chan, struct odbc_txn_frame *tx)
static int commit_exec(struct ast_channel *chan, const char *data)
static const char *const app_rollback
static int acf_transaction_write(struct ast_channel *chan, const char *cmd, char *s, const char *value)
static void odbc_txn_free(void *vdata)
static const char *const app_commit
static struct odbc_txn_frame * release_transaction(struct odbc_txn_frame *tx)
static const struct ast_datastore_info txn_info
static int acf_transaction_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int rollback_exec(struct ast_channel *chan, const char *data)
static int load_module(void)
static int unload_module(void)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define S_OR(a, b)
returns the equivalent of logic or for strings: first one if not empty, otherwise second one.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
int attribute_pure ast_false(const char *val)
Make sure something is false. Determine if a string containing a boolean value is "false"....
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Main Channel structure associated with a channel.
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
Support for dynamic strings.
struct odbc_class * parent
struct odbc_txn_frame::@444 list
unsigned int active
Is this record the current active transaction within the channel? Note that the active flag is really...
struct odbc_txn_frame::@443 list