summaryrefslogtreecommitdiff
path: root/include/asterisk/res_odbc.h
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2009-02-19 00:26:01 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2009-02-19 00:26:01 +0000
commita1f583177e3da754f9b9bdfb09219133f110de86 (patch)
tree5da85f585b6be426b1abc5404491d76541f48716 /include/asterisk/res_odbc.h
parenta150908f3f337e5021cb85db090a33473c3144b4 (diff)
ODBC transaction support
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@177320 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/res_odbc.h')
-rw-r--r--include/asterisk/res_odbc.h38
1 files changed, 31 insertions, 7 deletions
diff --git a/include/asterisk/res_odbc.h b/include/asterisk/res_odbc.h
index 005cf29cb..ecd2fbb96 100644
--- a/include/asterisk/res_odbc.h
+++ b/include/asterisk/res_odbc.h
@@ -35,25 +35,30 @@
typedef enum { ODBC_SUCCESS=0, ODBC_FAIL=-1} odbc_status;
+/*! \brief Flags for use with ast_odbc_request_obj2 */
+enum {
+ RES_ODBC_SANITY_CHECK = (1 << 0),
+ RES_ODBC_INDEPENDENT_CONNECTION = (1 << 1),
+};
+
/*! \brief ODBC container */
struct odbc_obj {
ast_mutex_t lock;
- SQLHDBC con; /* ODBC Connection Handle */
- struct odbc_class *parent; /* Information about the connection is protected */
- struct timeval last_used;
+ SQLHDBC con; /*!< ODBC Connection Handle */
+ struct odbc_class *parent; /*!< Information about the connection is protected */
+ struct timeval last_used; /*!< Used by idlecheck to determine if the connection should be renegotiated */
#ifdef DEBUG_THREADS
char file[80];
char function[80];
int lineno;
#endif
- unsigned int used:1;
+ unsigned int used:1; /*!< Is this connection currently in use? */
unsigned int up:1;
+ unsigned int tx:1; /*!< Should this connection be unshared, regardless of the class setting? */
+ struct odbc_txn_frame *txf; /*!< Reference back to the transaction frame, if applicable */
AST_LIST_ENTRY(odbc_obj) list;
};
-/*!\brief These aren't used in any API calls, but they are kept in a common
- * location, simply for convenience and to avoid duplication.
- */
struct odbc_cache_columns {
char *name;
SQLSMALLINT type;
@@ -107,12 +112,31 @@ int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__((d
* when the thread is done by calling odbc_release_obj(), below.
*/
#ifdef DEBUG_THREADS
+struct odbc_obj *_ast_odbc_request_obj2(const char *name, struct ast_flags flags, const char *file, const char *function, int lineno);
+#define ast_odbc_request_obj2(a, b) _ast_odbc_request_obj2(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#else
+struct odbc_obj *ast_odbc_request_obj2(const char *name, struct ast_flags flags);
+#endif
+
+#ifdef DEBUG_THREADS
struct odbc_obj *_ast_odbc_request_obj(const char *name, int check, const char *file, const char *function, int lineno);
#define ast_odbc_request_obj(a, b) _ast_odbc_request_obj(a, b, __FILE__, __PRETTY_FUNCTION__, __LINE__)
#else
struct odbc_obj *ast_odbc_request_obj(const char *name, int check);
#endif
+/*!
+ * \brief Retrieve a stored ODBC object, if a transaction has been started.
+ * \param chan Channel associated with the transaction.
+ * \param objname Name of the database handle. This name corresponds to the name passed
+ * to ast_odbc_request_obj2 (or formerly, to ast_odbc_request_obj). Note that the
+ * existence of this parameter name explicitly allows for multiple transactions to be open
+ * at once, albeit to different databases.
+ * \retval A stored ODBC object, if a transaction was already started.
+ * \retval NULL, if no transaction yet exists.
+ */
+struct odbc_obj *ast_odbc_retrieve_transaction_obj(struct ast_channel *chan, const char *objname);
+
/*!
* \brief Releases an ODBC object previously allocated by odbc_request_obj()
* \param obj The ODBC object