134 if (iso == SQL_TXN_READ_COMMITTED) {
135 return "read_committed";
136 }
else if (iso == SQL_TXN_READ_UNCOMMITTED) {
137 return "read_uncommitted";
138 }
else if (iso == SQL_TXN_SERIALIZABLE) {
139 return "serializable";
140 }
else if (iso == SQL_TXN_REPEATABLE_READ) {
141 return "repeatable_read";
149 if (strncasecmp(txt,
"read_", 5) == 0) {
150 if (strncasecmp(txt + 5,
"c", 1) == 0) {
151 return SQL_TXN_READ_COMMITTED;
152 }
else if (strncasecmp(txt + 5,
"u", 1) == 0) {
153 return SQL_TXN_READ_UNCOMMITTED;
157 }
else if (strncasecmp(txt,
"ser", 3) == 0) {
158 return SQL_TXN_SERIALIZABLE;
159 }
else if (strncasecmp(txt,
"rep", 3) == 0) {
160 return SQL_TXN_REPEATABLE_READ;
174 if (class->username) {
177 if (class->password) {
180 if (class->sanitysql) {
188 SQLFreeHandle(SQL_HANDLE_ENV, class->env);
247 SQLHSTMT stmt =
NULL;
248 int res = 0,
error = 0;
253 if (strcmp(tableptr->
connection, database) == 0 && strcmp(tableptr->
table, tablename) == 0) {
264 ast_log(
LOG_WARNING,
"Unable to retrieve database handle for table description '%s@%s'\n", tablename, database);
271 res = SQLAllocHandle(SQL_HANDLE_STMT, obj->
con, &stmt);
272 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
277 res = SQLColumns(stmt,
NULL, 0,
NULL, 0, (
unsigned char *)tablename, SQL_NTS, (
unsigned char *)
"%", SQL_NTS);
278 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
279 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
280 ast_log(
LOG_ERROR,
"Unable to query database columns on connection '%s'.\n", database);
284 if (!(tableptr =
ast_calloc(
sizeof(
char),
sizeof(*tableptr) + strlen(database) + 1 + strlen(tablename) + 1))) {
285 ast_log(
LOG_ERROR,
"Out of memory creating entry for table '%s' on connection '%s'\n", tablename, database);
289 tableptr->
connection = (
char *)tableptr +
sizeof(*tableptr);
290 tableptr->
table = (
char *)tableptr +
sizeof(*tableptr) + strlen(database) + 1;
292 strcpy(tableptr->
table, tablename);
295 while ((res = SQLFetch(stmt)) != SQL_NO_DATA && res != SQL_ERROR) {
296 SQLGetData(stmt, 4, SQL_C_CHAR, columnname,
sizeof(columnname), &sqlptr);
298 if (!(entry =
ast_calloc(
sizeof(
char),
sizeof(*entry) + strlen(columnname) + 1))) {
299 ast_log(
LOG_ERROR,
"Out of memory creating entry for column '%s' in table '%s' on connection '%s'\n", columnname, tablename, database);
303 entry->
name = (
char *)entry +
sizeof(*entry);
304 strcpy(entry->
name, columnname);
306 SQLGetData(stmt, 5, SQL_C_SHORT, &entry->
type,
sizeof(entry->
type),
NULL);
307 SQLGetData(stmt, 7, SQL_C_LONG, &entry->
size,
sizeof(entry->
size),
NULL);
309 SQLGetData(stmt, 10, SQL_C_SHORT, &entry->
radix,
sizeof(entry->
radix),
NULL);
320 ast_debug(3,
"Found %s column with type %hd with len %ld, octetlen %ld, and numlen (%hd,%hd)\n", entry->
name, entry->
type, (
long) entry->
size, (
long) entry->
octetlen, entry->
decimals, entry->
radix);
324 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
345 if (strcasecmp(col->
name, colname) == 0) {
358 if (strcmp(tableptr->
connection, database) == 0 && strcmp(tableptr->
table, tablename) == 0) {
366 return tableptr ? 0 : -1;
371 struct timeval start;
378 stmt = exec_cb(obj, data);
384 ast_log(
LOG_WARNING,
"SQL query '%s' took %ld milliseconds to execute on class '%s', this may indicate a database problem\n",
409 struct timeval start;
422 stmt = prepare_cb(obj, data);
427 res = SQLExecute(stmt);
428 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
429 if (res == SQL_ERROR) {
434 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
440 ast_log(
LOG_WARNING,
"SQL query '%s' took %ld milliseconds to execute on class '%s', this may indicate a database problem\n",
475 return SQLPrepare(stmt, (
unsigned char *)sql, SQL_NTS);
486 return SQLExecDirect(stmt, (
unsigned char *)sql, SQL_NTS);
493 res = SQLExecute(stmt);
494 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO) && (res != SQL_NO_DATA)) {
495 if (res == SQL_ERROR) {
512 if (SQLGetData(StatementHandle, ColumnNumber, TargetType,
ast_str_buffer(*buf), 0, StrLen_or_Ind) == SQL_SUCCESS_WITH_INFO) {
515 }
else if (pmaxlen > 0) {
527 SQLINTEGER nativeerror = 0;
528 SQLSMALLINT diagbytes = 0;
530 unsigned char state[10];
531 unsigned char diagnostic[256];
535 while (SQLGetDiagRec(handle_type, handle, ++i, state, &nativeerror,
536 diagnostic,
sizeof(diagnostic), &diagbytes) == SQL_SUCCESS) {
541 ast_log(
LOG_WARNING,
"There are more than 10 diagnostic records! Ignore the rest.\n");
551 return class->isolation;
556 return class->forcecommit;
566 static char *cfg =
"res_odbc.conf";
572 struct timeval ncache = { 0, 0 };
573 int preconnect = 0, res = 0;
584 if (!strcasecmp(cat,
"ENV")) {
591 dsn = username = password = sanitysql =
NULL;
597 isolation = SQL_TXN_READ_COMMITTED;
600 slowquerylimit = 5000;
602 if (!strcasecmp(v->
name,
"pooling") ||
603 !strncasecmp(v->
name,
"share", 5) ||
604 !strcasecmp(v->
name,
"limit") ||
605 !strcasecmp(v->
name,
"idlecheck")) {
606 ast_log(
LOG_WARNING,
"The 'pooling', 'shared_connections', 'limit', and 'idlecheck' options were replaced by 'max_connections'. See res_odbc.conf.sample.\n");
607 }
else if (!strcasecmp(v->
name,
"enabled")) {
609 }
else if (!strcasecmp(v->
name,
"pre-connect")) {
611 }
else if (!strcasecmp(v->
name,
"dsn")) {
613 }
else if (!strcasecmp(v->
name,
"username")) {
615 }
else if (!strcasecmp(v->
name,
"password")) {
617 }
else if (!strcasecmp(v->
name,
"sanitysql")) {
618 sanitysql = v->
value;
619 }
else if (!strcasecmp(v->
name,
"backslash_is_escape")) {
621 }
else if (!strcasecmp(v->
name,
"connect_timeout")) {
622 if (sscanf(v->
value,
"%d", &conntimeout) != 1 || conntimeout < 1) {
626 }
else if (!strcasecmp(v->
name,
"negative_connection_cache")) {
628 if (sscanf(v->
value,
"%lf", &dncache) != 1 || dncache < 0) {
634 ncache.tv_sec = (int)dncache;
635 ncache.tv_usec = (dncache - ncache.tv_sec) * 1000000;
637 }
else if (!strcasecmp(v->
name,
"forcecommit")) {
639 }
else if (!strcasecmp(v->
name,
"isolation")) {
642 isolation = SQL_TXN_READ_COMMITTED;
644 }
else if (!strcasecmp(v->
name,
"max_connections")) {
645 if (sscanf(v->
value,
"%30d", &maxconnections) != 1 || maxconnections < 1) {
649 }
else if (!strcasecmp(v->
name,
"logging")) {
651 }
else if (!strcasecmp(v->
name,
"slow_query_limit")) {
652 if (sscanf(v->
value,
"%30d", &slowquerylimit) != 1) {
654 slowquerylimit = 5000;
667 SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &new->env);
668 res = SQLSetEnvAttr(new->env, SQL_ATTR_ODBC_VERSION, (
void *) SQL_OV_ODBC3, 0);
670 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
676 new->backslash_is_escape = bse ? 1 : 0;
677 new->forcecommit = forcecommit ? 1 : 0;
680 new->negative_connection_cache = ncache;
689 if (username && !(new->username =
ast_strdup(username))) {
693 if (password && !(new->password =
ast_strdup(password))) {
697 if (sanitysql && !(new->sanitysql =
ast_strdup(sanitysql))) {
728 "Usage: odbc show [class]\n" 729 " List settings of a particular ODBC class or,\n" 730 " if not specified, all classes.\n";
735 length = strlen(a->
word);
738 if (!strncasecmp(a->
word, class->name, length) && ++which > a->
n) {
747 if (!ret && !strncasecmp(a->
word,
"all", length) && ++which > a->
n) {
757 if ((a->
argc == 2) || (a->
argc == 3 && !strcmp(a->
argv[2],
"all")) || (!strcmp(a->
argv[2], class->name))) {
761 ast_cli(a->
fd,
" Name: %s\n DSN: %s\n", class->name, class->dsn);
763 if (class->last_negative_connect.tv_sec > 0) {
765 ast_strftime(timestr,
sizeof(timestr),
"%Y-%m-%d %T", &tm);
766 ast_cli(a->
fd,
" Last fail connection attempt: %s\n", timestr);
769 ast_cli(a->
fd,
" Number of active connections: %zd (out of %d)\n", class->connection_cnt, class->maxconnections);
770 ast_cli(a->
fd,
" Logging: %s\n", class->logging ?
"Enabled" :
"Disabled");
771 if (class->logging) {
772 ast_cli(a->
fd,
" Number of prepares executed: %d\n", class->prepares_executed);
773 ast_cli(a->
fd,
" Number of queries executed: %d\n", class->queries_executed);
775 if (class->sql_text) {
776 ast_cli(a->
fd,
" Longest running SQL query: %s (%ld milliseconds)\n", class->sql_text, class->longest_query_execution_time);
817 ast_debug(2,
"Releasing ODBC handle %p into pool\n", obj);
851 if (!strcmp(class->name, name) && !class->delme) {
860 unsigned int max_connections;
862 class =
ao2_callback(class_container, 0, aoro2_class_cb, (char *) name);
867 max_connections =
class->maxconnections;
870 return max_connections;
883 char *test_sql =
"select 1";
888 res = SQLGetConnectAttr(connection->
con, SQL_ATTR_CONNECTION_DEAD, &dead, 0, 0);
889 if (SQL_SUCCEEDED(res)) {
890 return dead == SQL_CD_TRUE ? 1 : 0;
896 res = SQLAllocHandle(SQL_HANDLE_STMT, connection->
con, &stmt);
897 if (!SQL_SUCCEEDED(res)) {
902 test_sql =
class->sanitysql;
905 res = SQLPrepare(stmt, (
unsigned char *)test_sql, SQL_NTS);
906 if (!SQL_SUCCEEDED(res)) {
907 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
911 res = SQLExecute(stmt);
912 SQLFreeHandle(SQL_HANDLE_STMT, stmt);
914 return SQL_SUCCEEDED(res) ? 0 : 1;
923 ast_debug(1,
"Class '%s' not found!\n", name);
933 if (class->connection_cnt < class->maxconnections) {
951 class->connection_cnt++;
952 ast_debug(2,
"Created ODBC handle %p on class '%s', new count is %zd\n", obj,
953 name, class->connection_cnt);
967 class->connection_cnt--;
968 ast_debug(2,
"ODBC handle %p dead - removing from class '%s', new count is %zd\n",
969 obj, name, class->connection_cnt);
974 ast_debug(2,
"Reusing ODBC handle %p from class '%s'\n", obj, name);
1000 unsigned char msg[200],
state[10];
1010 res = SQLDisconnect(con);
1012 if ((res = SQLFreeHandle(SQL_HANDLE_DBC, con)) == SQL_SUCCESS) {
1013 ast_debug(3,
"Database handle %p (connection %p) deallocated\n", obj, con);
1015 SQLGetDiagRec(SQL_HANDLE_DBC, con, 1, state, &err, msg, 100, &mlen);
1016 ast_log(
LOG_WARNING,
"Unable to deallocate database handle %p? %d errno=%d %s\n", con, res, (
int)err, msg);
1027 unsigned char msg[200],
state[10];
1029 SQLINTEGER enable = 1;
1030 char *tracefile =
"/tmp/odbc.trace";
1033 long int negative_cache_expiration;
1040 if (time(
NULL) < negative_cache_expiration) {
1045 res = SQLAllocHandle(SQL_HANDLE_DBC, obj->
parent->
env, &con);
1047 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
1052 SQLSetConnectAttr(con, SQL_LOGIN_TIMEOUT, (SQLPOINTER *)(
long) obj->
parent->
conntimeout, 0);
1053 SQLSetConnectAttr(con, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER *)(
long) obj->
parent->
conntimeout, 0);
1055 SQLSetConnectAttr(con, SQL_ATTR_TRACE, &enable, SQL_IS_INTEGER);
1056 SQLSetConnectAttr(con, SQL_ATTR_TRACEFILE, tracefile, strlen(tracefile));
1059 res = SQLConnect(con,
1064 if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) {
1065 SQLGetDiagRec(SQL_HANDLE_DBC, con, 1, state, &err, msg, 100, &mlen);
1067 ast_log(
LOG_WARNING,
"res_odbc: Error SQLConnect=%d errno=%d %s\n", res, (
int)err, msg);
1068 if ((res = SQLFreeHandle(SQL_HANDLE_DBC, con)) != SQL_SUCCESS) {
1069 SQLGetDiagRec(SQL_HANDLE_DBC, con, 1, state, &err, msg, 100, &mlen);
1070 ast_log(
LOG_WARNING,
"Unable to deallocate database handle %p? %d errno=%d %s\n", con, res, (
int)err, msg);
1126 if (!class_container) {
1146 .requires =
"res_odbc_transaction",
struct ast_variable * next
#define AST_THREADSTORAGE(name)
Define a thread storage variable.
const char * ast_odbc_isolation2text(int iso)
Convert from numeric transaction isolation values to their textual counterparts.
Main Channel structure associated with a channel.
#define AST_CLI_DEFINE(fn, txt,...)
#define AST_RWLIST_HEAD_DESTROY(head)
Destroys an rwlist head structure.
static void odbc_class_destructor(void *data)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
struct odbc_cache_tables * ast_odbc_find_table(const char *database, const char *tablename)
Find or create an entry describing the table specified.
int ast_odbc_backslash_is_escape(struct odbc_obj *obj)
Checks if the database natively supports backslash as an escape character.
unsigned int maxconnections
static int load_odbc_config(void)
SQLRETURN ast_odbc_execute_sql(struct odbc_obj *obj, SQLHSTMT *stmt, const char *sql)
Execute a nonprepared SQL query.
unsigned int active
Is this record the current active transaction within the channel? Note that the active flag is really...
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized...
String manipulation functions.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
size_t ast_str_size(const struct ast_str *buf)
Returns the current maximum length (without reallocation) of the current buffer.
Time-related functions and macros.
struct odbc_class::@469 connections
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.
#define AST_RWLIST_WRLOCK(head)
Write locks a list.
descriptor for a cli entry.
#define ast_str_make_space(buf, new_len)
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
#define CONFIG_STATUS_FILEINVALID
unsigned int slowquerylimit
#define AST_RWLIST_UNLOCK(head)
Attempts to unlock a read/write based list.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
#define ao2_container_alloc_list(ao2_options, container_options, sort_fn, cmp_fn)
static int aoro2_class_cb(void *obj, void *arg, int flags)
Structure for variables, used for configurations and for channel variables.
static struct ast_threadstorage errors_buf
#define ast_cond_wait(cond, mutex)
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cond_init(cond, attr)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_mutex_lock(a)
int64_t ast_tvdiff_ms(struct timeval end, struct timeval start)
Computes the difference (in milliseconds) between two struct timeval instances.
#define ast_strdup(str)
A wrapper for strdup()
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define AST_RWLIST_HEAD_INIT(head)
Initializes an rwlist head structure.
struct ast_channel * owner
Definitions to aid in the use of thread local storage.
void ast_cli(int fd, const char *fmt,...)
static char * handle_cli_odbc_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void destroy_table_cache(struct odbc_cache_tables *table)
These structures are used for adaptive capabilities.
#define ast_cond_signal(cond)
struct timeval negative_connection_cache
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return the previous value of *p.
SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT(*exec_cb)(struct odbc_obj *obj, void *data), void *data)
Executes an non prepared statement and returns the resulting statement handle.
pthread_cond_t ast_cond_t
#define ast_strlen_zero(foo)
unsigned int ast_odbc_class_get_isolation(struct odbc_class *class)
Get the transaction isolation setting for an ODBC class.
SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT(*prepare_cb)(struct odbc_obj *obj, void *data), void *data)
Prepares, executes, and returns the resulting statement handle.
static void odbc_obj_destructor(void *data)
Configuration File Parser.
static struct ast_cli_entry cli_odbc[]
#define AST_RWLIST_RDLOCK(head)
Read locks a list.
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_config_load(filename, flags)
Load a config file.
struct odbc_obj * _ast_odbc_request_obj2(const char *name, struct ast_flags flags, const char *file, const char *function, int lineno)
Retrieves a connected ODBC object.
General Asterisk PBX channel definitions.
unsigned int ast_odbc_get_max_connections(const char *name)
Return the current configured maximum number of connections for a class.
static int connection_dead(struct odbc_obj *connection, struct odbc_class *class)
#define AST_RWLIST_TRAVERSE
int ast_odbc_clear_cache(const char *database, const char *tablename)
Remove a cache entry from memory This function may be called to clear entries created and cached by t...
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define ao2_ref(o, delta)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
void ast_odbc_release_obj(struct odbc_obj *obj)
Releases an ODBC object previously allocated by ast_odbc_request_obj()
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
struct odbc_class * parent
Core PBX routines and definitions.
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
static odbc_status odbc_obj_connect(struct odbc_obj *obj)
int ast_odbc_text2isolation(const char *txt)
Convert from textual transaction isolation values to their numeric constants.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
unsigned int backslash_is_escape
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
#define ao2_unlink(container, obj)
#define ast_module_shutdown_ref(mod)
Prevent unload of the module before shutdown.
struct odbc_class::@468 list
static odbc_status odbc_obj_disconnect(struct odbc_obj *obj)
#define ao2_iterator_next(iter)
#define ast_cond_destroy(cond)
#define ao2_alloc(data_size, destructor_fn)
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
int ao2_match_by_addr(void *obj, void *arg, int flags)
A common ao2_callback is one that matches by address.
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_odbc_request_obj(a, b)
int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt)
Executes a prepared statement handle.
#define AST_RWLIST_REMOVE_HEAD
Module has failed to load, may be in an inconsistent state.
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
SQLRETURN ast_odbc_ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind)
Wrapper for SQLGetData to use with dynamic strings.
Structure used to handle boolean flags.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
#define CONFIG_STATUS_FILEMISSING
struct odbc_cache_columns * ast_odbc_find_column(struct odbc_cache_tables *table, const char *colname)
Find a column entry within a cached table structure.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
static void odbc_register_class(struct odbc_class *class, int connect)
size_t ast_str_strlen(const struct ast_str *buf)
Returns the current length of the string stored within buf.
#define AST_RWLIST_INSERT_TAIL
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
void ast_str_update(struct ast_str *buf)
Update the length of the buffer, after using ast_str merely as a buffer.
static int unload_module(void)
static int load_module(void)
int error(const char *format,...)
int setenv(const char *name, const char *value, int overwrite)
#define ast_mutex_init(pmutex)
struct ast_str * ast_str_thread_get(struct ast_threadstorage *ts, size_t init_len)
Retrieve a thread locally stored dynamic string.
#define ast_mutex_destroy(a)
struct timeval last_negative_connect
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
const char * ast_odbc_class_get_name(struct odbc_class *class)
Get the name of an ODBC class.
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
static struct ao2_container * class_container
#define AST_RWLIST_TRAVERSE_SAFE_END
Structure for mutex and tracking information.
long longest_query_execution_time
int ast_odbc_prepare(struct odbc_obj *obj, SQLHSTMT *stmt, const char *sql)
Prepares a SQL query on a statement.
unsigned int ast_odbc_class_get_forcecommit(struct odbc_class *class)
Get the transaction forcecommit setting for an ODBC class.
#define ast_mutex_unlock(a)
struct odbc_obj * _ast_odbc_request_obj(const char *name, int check, const char *file, const char *function, int lineno)
Get a ODBC connection object.
#define ao2_link(container, obj)
struct odbc_cache_tables::_columns columns