2004-06-11 00:12:35 +00:00
|
|
|
/*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Asterisk -- An open source telephony toolkit.
|
2004-06-11 00:12:35 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Copyright (C) 1999 - 2005, Digium, Inc.
|
|
|
|
* Copyright (C) 2004 - 2005, Anthony Minessale II
|
2006-04-18 18:16:32 +00:00
|
|
|
* Copyright (C) 2006, Tilghman Lesher
|
2004-06-11 00:12:35 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* Mark Spencer <markster@digium.com>
|
|
|
|
* Anthony Minessale <anthmct@yahoo.com>
|
2006-04-18 18:16:32 +00:00
|
|
|
* Tilghman Lesher <res_odbc_200603@the-tilghman.com>
|
2004-06-11 00:12:35 +00:00
|
|
|
*
|
2005-08-30 18:32:10 +00:00
|
|
|
* See http://www.asterisk.org for more information about
|
|
|
|
* the Asterisk project. Please do not directly contact
|
|
|
|
* any of the maintainers of this project for assistance;
|
|
|
|
* the project provides a web site, mailing lists and IRC
|
|
|
|
* channels for your use.
|
|
|
|
*
|
|
|
|
* This program is free software, distributed under the terms of
|
|
|
|
* the GNU General Public License Version 2. See the LICENSE file
|
|
|
|
* at the top of the source tree.
|
|
|
|
*/
|
|
|
|
|
2005-10-24 20:12:06 +00:00
|
|
|
/*! \file
|
|
|
|
* \brief ODBC resource manager
|
2004-06-11 00:12:35 +00:00
|
|
|
*/
|
|
|
|
|
2005-08-30 18:32:10 +00:00
|
|
|
#ifndef _ASTERISK_RES_ODBC_H
|
|
|
|
#define _ASTERISK_RES_ODBC_H
|
2004-06-11 00:12:35 +00:00
|
|
|
|
|
|
|
#include <sql.h>
|
|
|
|
#include <sqlext.h>
|
|
|
|
#include <sqltypes.h>
|
2008-06-05 19:07:27 +00:00
|
|
|
#include "asterisk/linkedlists.h"
|
2009-01-19 21:42:46 +00:00
|
|
|
#include "asterisk/strings.h"
|
2004-06-11 00:12:35 +00:00
|
|
|
|
2006-04-18 18:16:32 +00:00
|
|
|
typedef enum { ODBC_SUCCESS=0, ODBC_FAIL=-1} odbc_status;
|
2004-06-11 00:12:35 +00:00
|
|
|
|
2009-04-01 20:13:28 +00:00
|
|
|
/*! \brief Flags for use with \see ast_odbc_request_obj2 */
|
2009-02-19 00:26:01 +00:00
|
|
|
enum {
|
|
|
|
RES_ODBC_SANITY_CHECK = (1 << 0),
|
|
|
|
RES_ODBC_INDEPENDENT_CONNECTION = (1 << 1),
|
2010-07-23 16:19:21 +00:00
|
|
|
RES_ODBC_CONNECTED = (1 << 2),
|
2009-02-19 00:26:01 +00:00
|
|
|
};
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*! \brief ODBC container */
|
2004-06-11 00:12:35 +00:00
|
|
|
struct odbc_obj {
|
2009-02-19 00:26:01 +00:00
|
|
|
SQLHDBC con; /*!< ODBC Connection Handle */
|
|
|
|
struct odbc_class *parent; /*!< Information about the connection is protected */
|
2008-07-11 19:53:38 +00:00
|
|
|
#ifdef DEBUG_THREADS
|
|
|
|
char file[80];
|
|
|
|
char function[80];
|
|
|
|
int lineno;
|
|
|
|
#endif
|
2006-04-18 18:16:32 +00:00
|
|
|
AST_LIST_ENTRY(odbc_obj) list;
|
2004-06-11 00:12:35 +00:00
|
|
|
};
|
|
|
|
|
2010-07-23 16:19:21 +00:00
|
|
|
/*!\brief These structures are used for adaptive capabilities */
|
2008-06-05 19:07:27 +00:00
|
|
|
struct odbc_cache_columns {
|
|
|
|
char *name;
|
|
|
|
SQLSMALLINT type;
|
|
|
|
SQLINTEGER size;
|
|
|
|
SQLSMALLINT decimals;
|
|
|
|
SQLSMALLINT radix;
|
|
|
|
SQLSMALLINT nullable;
|
|
|
|
SQLINTEGER octetlen;
|
|
|
|
AST_RWLIST_ENTRY(odbc_cache_columns) list;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct odbc_cache_tables {
|
|
|
|
char *connection;
|
|
|
|
char *table;
|
|
|
|
AST_RWLIST_HEAD(_columns, odbc_cache_columns) columns;
|
|
|
|
AST_RWLIST_ENTRY(odbc_cache_tables) list;
|
|
|
|
};
|
|
|
|
|
2004-06-11 00:12:35 +00:00
|
|
|
/* functions */
|
2006-04-18 18:16:32 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Executes a prepared statement handle
|
2006-04-18 18:16:32 +00:00
|
|
|
* \param obj The non-NULL result of odbc_request_obj()
|
|
|
|
* \param stmt The prepared statement handle
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval 0 on success
|
|
|
|
* \retval -1 on failure
|
2006-04-18 18:16:32 +00:00
|
|
|
*
|
|
|
|
* This function was originally designed simply to execute a prepared
|
|
|
|
* statement handle and to retry if the initial execution failed.
|
|
|
|
* Unfortunately, it did this by disconnecting and reconnecting the database
|
|
|
|
* handle which on most databases causes the statement handle to become
|
|
|
|
* invalid. Therefore, this method has been deprecated in favor of
|
|
|
|
* odbc_prepare_and_execute() which allows the statement to be prepared
|
|
|
|
* multiple times, if necessary, in case of a loss of connection.
|
|
|
|
*
|
|
|
|
* This function really only ever worked with MySQL, where the statement handle is
|
|
|
|
* not prepared on the server. If you are not using MySQL, you should avoid it.
|
|
|
|
*/
|
2008-11-29 17:57:39 +00:00
|
|
|
int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((deprecated));
|
2006-04-18 18:16:32 +00:00
|
|
|
|
2010-07-23 16:19:21 +00:00
|
|
|
/*!
|
2007-07-16 02:51:56 +00:00
|
|
|
* \brief Retrieves a connected ODBC object
|
2012-09-21 17:14:59 +00:00
|
|
|
*
|
res_odbc: Remove connection management
Asterisk by default will create a single database connection and share
it among all threads that attempt to access the database. In previous
versions of Asterisk, this was tolerable, because the most used channel
driver, chan_sip, mostly accessed the database from a single thread.
With PJSIP, however, many threads may be attempting to perform database
operations, and there is the potential for many more database accesses,
meaning the concurrency is a horrible bottleneck if only one connection
is shared.
Asterisk has a connection pooling facility built into it, but the
implementation has flaws. For one, there is a strict limit on the number
of simultaneous connections that could be made to the database. Anything
beyond the maximum would result in a failed operation. Attempting to
predict what the maximum should be is nearly impossible even for someone
intimately familiar with Asterisk's threading model. In addition, use of
transactions in the dialplan can cause some severe bugs if connection
pooling is enabled.
This commit seeks to fix the concurrency problem by removing all
connection management code from Asterisk and leaving that to the
underlying unixODBC code instead. Now, Asterisk does not share a single
connection, nor does it try to maintain a connection pool. Instead, all
Asterisk ever does is request a connection from unixODBC and allow
unixODBC to either allocate those connections or retrieve them from a
pool.
Doing this has a bit of a ripple effect. For one, since connections are
not long-lived objects, several of the safeguards that previously
existed have been removed. We don't have to worry about trying to use a
connection that has gone stale. In every case, when we request a
connection, it has just been made and we don't need to perform any
sanity checks to be sure it's still active.
Another major player affected by this change is transactions.
Transactions and their respective connections were so tightly coupled
that it was almost pornographic. This code change moves
transaction-related code to its own file separate from the core ODBC
functionality. This way, the core of ODBC does not even have to know
that transactions exist.
In making this large change, I had to look at a lot of code and
understand it. When making this change, I discovered several places
where the behavior is definitely not ideal, but it seemed outside the
scope of this change to be fixing it. Instead, any place where I saw
some sort of room for improvement has had a XXX comment added explaining
what could be altered to improve it.
Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2015-12-23 15:07:05 -06:00
|
|
|
* \deprecated
|
2006-04-18 18:16:32 +00:00
|
|
|
*
|
res_odbc: Remove connection management
Asterisk by default will create a single database connection and share
it among all threads that attempt to access the database. In previous
versions of Asterisk, this was tolerable, because the most used channel
driver, chan_sip, mostly accessed the database from a single thread.
With PJSIP, however, many threads may be attempting to perform database
operations, and there is the potential for many more database accesses,
meaning the concurrency is a horrible bottleneck if only one connection
is shared.
Asterisk has a connection pooling facility built into it, but the
implementation has flaws. For one, there is a strict limit on the number
of simultaneous connections that could be made to the database. Anything
beyond the maximum would result in a failed operation. Attempting to
predict what the maximum should be is nearly impossible even for someone
intimately familiar with Asterisk's threading model. In addition, use of
transactions in the dialplan can cause some severe bugs if connection
pooling is enabled.
This commit seeks to fix the concurrency problem by removing all
connection management code from Asterisk and leaving that to the
underlying unixODBC code instead. Now, Asterisk does not share a single
connection, nor does it try to maintain a connection pool. Instead, all
Asterisk ever does is request a connection from unixODBC and allow
unixODBC to either allocate those connections or retrieve them from a
pool.
Doing this has a bit of a ripple effect. For one, since connections are
not long-lived objects, several of the safeguards that previously
existed have been removed. We don't have to worry about trying to use a
connection that has gone stale. In every case, when we request a
connection, it has just been made and we don't need to perform any
sanity checks to be sure it's still active.
Another major player affected by this change is transactions.
Transactions and their respective connections were so tightly coupled
that it was almost pornographic. This code change moves
transaction-related code to its own file separate from the core ODBC
functionality. This way, the core of ODBC does not even have to know
that transactions exist.
In making this large change, I had to look at a lot of code and
understand it. When making this change, I discovered several places
where the behavior is definitely not ideal, but it seemed outside the
scope of this change to be fixing it. Instead, any place where I saw
some sort of room for improvement has had a XXX comment added explaining
what could be altered to improve it.
Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2015-12-23 15:07:05 -06:00
|
|
|
* This is only around for backwards-compatibility with older versions of Asterisk.
|
2006-04-18 18:16:32 +00:00
|
|
|
*/
|
2009-02-19 00:26:01 +00:00
|
|
|
struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags, const char *file, const char *function, int lineno);
|
res_odbc: Remove connection management
Asterisk by default will create a single database connection and share
it among all threads that attempt to access the database. In previous
versions of Asterisk, this was tolerable, because the most used channel
driver, chan_sip, mostly accessed the database from a single thread.
With PJSIP, however, many threads may be attempting to perform database
operations, and there is the potential for many more database accesses,
meaning the concurrency is a horrible bottleneck if only one connection
is shared.
Asterisk has a connection pooling facility built into it, but the
implementation has flaws. For one, there is a strict limit on the number
of simultaneous connections that could be made to the database. Anything
beyond the maximum would result in a failed operation. Attempting to
predict what the maximum should be is nearly impossible even for someone
intimately familiar with Asterisk's threading model. In addition, use of
transactions in the dialplan can cause some severe bugs if connection
pooling is enabled.
This commit seeks to fix the concurrency problem by removing all
connection management code from Asterisk and leaving that to the
underlying unixODBC code instead. Now, Asterisk does not share a single
connection, nor does it try to maintain a connection pool. Instead, all
Asterisk ever does is request a connection from unixODBC and allow
unixODBC to either allocate those connections or retrieve them from a
pool.
Doing this has a bit of a ripple effect. For one, since connections are
not long-lived objects, several of the safeguards that previously
existed have been removed. We don't have to worry about trying to use a
connection that has gone stale. In every case, when we request a
connection, it has just been made and we don't need to perform any
sanity checks to be sure it's still active.
Another major player affected by this change is transactions.
Transactions and their respective connections were so tightly coupled
that it was almost pornographic. This code change moves
transaction-related code to its own file separate from the core ODBC
functionality. This way, the core of ODBC does not even have to know
that transactions exist.
In making this large change, I had to look at a lot of code and
understand it. When making this change, I discovered several places
where the behavior is definitely not ideal, but it seemed outside the
scope of this change to be fixing it. Instead, any place where I saw
some sort of room for improvement has had a XXX comment added explaining
what could be altered to improve it.
Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2015-12-23 15:07:05 -06:00
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get a ODBC connection object
|
|
|
|
*
|
|
|
|
* The "check" parameter is leftover from an earlier implementation where database connections
|
|
|
|
* were cached by res_odbc. Since connections are managed by unixODBC now, this parameter is
|
|
|
|
* only kept around for API compatibility.
|
|
|
|
*
|
|
|
|
* \param name The name of the res_odbc.conf section describing the database to connect to
|
|
|
|
* \param check unused
|
|
|
|
* \return A connection to the database. Call ast_odbc_release_obj() when finished.
|
|
|
|
*/
|
2008-07-11 19:53:38 +00:00
|
|
|
struct odbc_obj *_ast_odbc_request_obj(const char *name, int check, const char *file, const char *function, int lineno);
|
2010-04-22 19:08:01 +00:00
|
|
|
|
|
|
|
#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
2008-07-11 19:53:38 +00:00
|
|
|
#define ast_odbc_request_obj(a, b) _ast_odbc_request_obj(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
|
2006-04-18 18:16:32 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
2010-07-23 16:19:21 +00:00
|
|
|
* \brief Releases an ODBC object previously allocated by ast_odbc_request_obj()
|
2006-04-18 18:16:32 +00:00
|
|
|
* \param obj The ODBC object
|
|
|
|
*/
|
2006-09-20 04:57:20 +00:00
|
|
|
void ast_odbc_release_obj(struct odbc_obj *obj);
|
2006-04-18 18:16:32 +00:00
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Checks an ODBC object to ensure it is still connected
|
2006-04-18 18:16:32 +00:00
|
|
|
* \param obj The ODBC object
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval 0 if connected
|
|
|
|
* \retval -1 otherwise.
|
2006-04-18 18:16:32 +00:00
|
|
|
*/
|
2006-09-20 04:57:20 +00:00
|
|
|
int ast_odbc_sanity_check(struct odbc_obj *obj);
|
2006-04-18 18:16:32 +00:00
|
|
|
|
2007-11-25 17:50:07 +00:00
|
|
|
/*! \brief Checks if the database natively supports backslash as an escape character.
|
|
|
|
* \param obj The ODBC object
|
2008-05-05 19:57:28 +00:00
|
|
|
* \return Returns 1 if backslash is a native escape character, 0 if an ESCAPE clause is needed to support '\'
|
2007-11-25 17:50:07 +00:00
|
|
|
*/
|
|
|
|
int ast_odbc_backslash_is_escape(struct odbc_obj *obj);
|
|
|
|
|
2007-09-14 17:29:23 +00:00
|
|
|
/*! \brief Executes an non prepared statement and returns the resulting
|
|
|
|
* statement handle.
|
|
|
|
* \param obj The ODBC object
|
|
|
|
* \param exec_cb A function callback, which, when called, should return a statement handle with result columns bound.
|
|
|
|
* \param data A parameter to be passed to the exec_cb parameter function, indicating which statement handle is to be prepared.
|
|
|
|
* \retval a statement handle
|
|
|
|
* \retval NULL on error
|
|
|
|
*/
|
|
|
|
SQLHSTMT ast_odbc_direct_execute(struct odbc_obj *obj, SQLHSTMT (*exec_cb)(struct odbc_obj *obj, void *data), void *data);
|
|
|
|
|
2007-07-16 02:51:56 +00:00
|
|
|
/*!
|
|
|
|
* \brief Prepares, executes, and returns the resulting statement handle.
|
2006-04-18 18:16:32 +00:00
|
|
|
* \param obj The ODBC object
|
|
|
|
* \param prepare_cb A function callback, which, when called, should return a statement handle prepared, with any necessary parameters or result columns bound.
|
|
|
|
* \param data A parameter to be passed to the prepare_cb parameter function, indicating which statement handle is to be prepared.
|
2007-07-16 02:51:56 +00:00
|
|
|
* \retval a statement handle
|
|
|
|
* \retval NULL on error
|
2006-04-18 18:16:32 +00:00
|
|
|
*/
|
2006-09-20 04:57:20 +00:00
|
|
|
SQLHSTMT ast_odbc_prepare_and_execute(struct odbc_obj *obj, SQLHSTMT (*prepare_cb)(struct odbc_obj *obj, void *data), void *data);
|
2005-08-30 18:32:10 +00:00
|
|
|
|
2008-06-10 21:14:58 +00:00
|
|
|
/*!
|
|
|
|
* \brief Find or create an entry describing the table specified.
|
|
|
|
* \param database Name of an ODBC class on which to query the table
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param tablename Tablename to describe
|
2008-06-10 21:14:58 +00:00
|
|
|
* \retval A structure describing the table layout, or NULL, if the table is not found or another error occurs.
|
|
|
|
* When a structure is returned, the contained columns list will be
|
2010-07-23 16:19:21 +00:00
|
|
|
* rdlock'ed, to ensure that it will be retained in memory. The information
|
|
|
|
* will be cached until a reload event or when ast_odbc_clear_cache() is called
|
|
|
|
* with the relevant parameters.
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 21:14:58 +00:00
|
|
|
*/
|
|
|
|
struct odbc_cache_tables *ast_odbc_find_table(const char *database, const char *tablename);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Find a column entry within a cached table structure
|
|
|
|
* \param table Cached table structure, as returned from ast_odbc_find_table()
|
|
|
|
* \param colname The column name requested
|
|
|
|
* \retval A structure describing the column type, or NULL, if the column is not found.
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 21:14:58 +00:00
|
|
|
*/
|
|
|
|
struct odbc_cache_columns *ast_odbc_find_column(struct odbc_cache_tables *table, const char *colname);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Remove a cache entry from memory
|
2010-07-23 16:19:21 +00:00
|
|
|
* This function may be called to clear entries created and cached by the
|
|
|
|
* ast_odbc_find_table() API call.
|
2008-06-10 21:14:58 +00:00
|
|
|
* \param database Name of an ODBC class (used to ensure like-named tables in different databases are not confused)
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param tablename Tablename for which a cached record should be removed
|
2008-06-10 21:14:58 +00:00
|
|
|
* \retval 0 if the cache entry was removed, or -1 if no matching entry was found.
|
2009-03-09 20:58:17 +00:00
|
|
|
* \since 1.6.1
|
2008-06-10 21:14:58 +00:00
|
|
|
*/
|
|
|
|
int ast_odbc_clear_cache(const char *database, const char *tablename);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Release a table returned from ast_odbc_find_table
|
|
|
|
*/
|
|
|
|
#define ast_odbc_release_table(ptr) if (ptr) { AST_RWLIST_UNLOCK(&(ptr)->columns); }
|
|
|
|
|
2009-01-19 21:42:46 +00:00
|
|
|
/*!\brief Wrapper for SQLGetData to use with dynamic strings
|
|
|
|
* \param buf Address of the pointer to the ast_str structure.
|
2009-04-01 20:13:28 +00:00
|
|
|
* \param pmaxlen The maximum size of the resulting string, or 0 for no limit.
|
2009-01-19 21:42:46 +00:00
|
|
|
* \param StatementHandle The statement handle from which to retrieve data.
|
|
|
|
* \param ColumnNumber Column number (1-based offset) for which to retrieve data.
|
|
|
|
* \param TargetType The SQL constant indicating what kind of data is to be retrieved (usually SQL_CHAR)
|
|
|
|
* \param StrLen_or_Ind A pointer to a length indicator, specifying the total length of data.
|
|
|
|
*/
|
|
|
|
SQLRETURN ast_odbc_ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind);
|
|
|
|
|
res_odbc: Remove connection management
Asterisk by default will create a single database connection and share
it among all threads that attempt to access the database. In previous
versions of Asterisk, this was tolerable, because the most used channel
driver, chan_sip, mostly accessed the database from a single thread.
With PJSIP, however, many threads may be attempting to perform database
operations, and there is the potential for many more database accesses,
meaning the concurrency is a horrible bottleneck if only one connection
is shared.
Asterisk has a connection pooling facility built into it, but the
implementation has flaws. For one, there is a strict limit on the number
of simultaneous connections that could be made to the database. Anything
beyond the maximum would result in a failed operation. Attempting to
predict what the maximum should be is nearly impossible even for someone
intimately familiar with Asterisk's threading model. In addition, use of
transactions in the dialplan can cause some severe bugs if connection
pooling is enabled.
This commit seeks to fix the concurrency problem by removing all
connection management code from Asterisk and leaving that to the
underlying unixODBC code instead. Now, Asterisk does not share a single
connection, nor does it try to maintain a connection pool. Instead, all
Asterisk ever does is request a connection from unixODBC and allow
unixODBC to either allocate those connections or retrieve them from a
pool.
Doing this has a bit of a ripple effect. For one, since connections are
not long-lived objects, several of the safeguards that previously
existed have been removed. We don't have to worry about trying to use a
connection that has gone stale. In every case, when we request a
connection, it has just been made and we don't need to perform any
sanity checks to be sure it's still active.
Another major player affected by this change is transactions.
Transactions and their respective connections were so tightly coupled
that it was almost pornographic. This code change moves
transaction-related code to its own file separate from the core ODBC
functionality. This way, the core of ODBC does not even have to know
that transactions exist.
In making this large change, I had to look at a lot of code and
understand it. When making this change, I discovered several places
where the behavior is definitely not ideal, but it seemed outside the
scope of this change to be fixing it. Instead, any place where I saw
some sort of room for improvement has had a XXX comment added explaining
what could be altered to improve it.
Change-Id: I37a84def5ea4ddf93868ce8105f39de078297fbf
2015-12-23 15:07:05 -06:00
|
|
|
/*!
|
|
|
|
* \brief Shortcut for printing errors to logs after a failed SQL operation.
|
|
|
|
*
|
|
|
|
* \param handle_type The type of SQL handle on which to gather diagnostics
|
|
|
|
* \param handle The SQL handle to gather diagnostics from
|
|
|
|
* \param operation The name of the failed operation.
|
|
|
|
* \return The error string that was printed to the logs
|
|
|
|
*/
|
|
|
|
struct ast_str *ast_odbc_print_errors(SQLSMALLINT handle_type, SQLHANDLE handle, const char *operation);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get the transaction isolation setting for an ODBC class
|
|
|
|
*/
|
|
|
|
unsigned int ast_odbc_class_get_isolation(struct odbc_class *class);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get the transaction forcecommit setting for an ODBC class
|
|
|
|
*/
|
|
|
|
unsigned int ast_odbc_class_get_forcecommit(struct odbc_class *class);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Get the name of an ODBC class.
|
|
|
|
*/
|
|
|
|
const char *ast_odbc_class_get_name(struct odbc_class *class);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Convert from textual transaction isolation values to their numeric constants
|
|
|
|
*/
|
|
|
|
int ast_odbc_text2isolation(const char *txt);
|
|
|
|
|
|
|
|
/*!
|
|
|
|
* \brief Convert from numeric transaction isolation values to their textual counterparts
|
|
|
|
*/
|
|
|
|
const char *ast_odbc_isolation2text(int iso);
|
|
|
|
|
2016-07-10 21:08:28 -03:00
|
|
|
/*!
|
|
|
|
* \brief Return the current configured maximum number of connections for a class
|
|
|
|
*/
|
|
|
|
unsigned int ast_odbc_get_max_connections(const char *name);
|
|
|
|
|
2005-08-30 18:32:10 +00:00
|
|
|
#endif /* _ASTERISK_RES_ODBC_H */
|