[asterisk-commits] tilghman: branch tilghman/odbc_tx_support r115736 - in /team/tilghman/odbc_tx...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon May 12 12:54:32 CDT 2008
Author: tilghman
Date: Mon May 12 12:54:08 2008
New Revision: 115736
URL: http://svn.digium.com/view/asterisk?view=rev&rev=115736
Log:
Initialized merge tracking via "svnmerge" with revisions "1-115733" from
https://origsvn.digium.com/svn/asterisk/trunk
Modified:
team/tilghman/odbc_tx_support/ (props changed)
team/tilghman/odbc_tx_support/include/asterisk/res_odbc.h
team/tilghman/odbc_tx_support/res/res_odbc.c
Propchange: team/tilghman/odbc_tx_support/
------------------------------------------------------------------------------
automerge = *
Propchange: team/tilghman/odbc_tx_support/
------------------------------------------------------------------------------
automerge-email = tilghman at mail.jeffandtilghman.com
Propchange: team/tilghman/odbc_tx_support/
------------------------------------------------------------------------------
svnmerge-integrated = /trunk:1-115733
Modified: team/tilghman/odbc_tx_support/include/asterisk/res_odbc.h
URL: http://svn.digium.com/view/asterisk/team/tilghman/odbc_tx_support/include/asterisk/res_odbc.h?view=diff&rev=115736&r1=115735&r2=115736
==============================================================================
--- team/tilghman/odbc_tx_support/include/asterisk/res_odbc.h (original)
+++ team/tilghman/odbc_tx_support/include/asterisk/res_odbc.h Mon May 12 12:54:08 2008
@@ -32,6 +32,11 @@
#include <sqltypes.h>
typedef enum { ODBC_SUCCESS=0, ODBC_FAIL=-1} odbc_status;
+
+enum {
+ RES_ODBC_SANITY_CHECK = (1 << 0),
+ RES_ODBC_INDEPENDENT_CONNECTION = (1 << 1),
+};
/*! \brief ODBC container */
struct odbc_obj {
@@ -79,6 +84,7 @@
* when the thread is done by calling odbc_release_obj(), below.
*/
struct odbc_obj *ast_odbc_request_obj(const char *name, int check);
+struct odbc_obj *ast_odbc_request_obj2(const char *name, struct ast_flags flags);
/*!
* \brief Releases an ODBC object previously allocated by odbc_request_obj()
Modified: team/tilghman/odbc_tx_support/res/res_odbc.c
URL: http://svn.digium.com/view/asterisk/team/tilghman/odbc_tx_support/res/res_odbc.c?view=diff&rev=115736&r1=115735&r2=115736
==============================================================================
--- team/tilghman/odbc_tx_support/res/res_odbc.c (original)
+++ team/tilghman/odbc_tx_support/res/res_odbc.c Mon May 12 12:54:08 2008
@@ -476,7 +476,7 @@
return obj->parent->backslash_is_escape;
}
-struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
+struct odbc_obj *ast_odbc_request_obj2(const char *name, struct ast_flags flags)
{
struct odbc_obj *obj = NULL;
struct odbc_class *class;
@@ -523,6 +523,9 @@
ao2_link(class->obj_container, obj);
}
}
+ } else if (ast_test_flag(&flags, RES_ODBC_INDEPENDENT_CONNECTION)) {
+ /* Non-pooled connections do not support independent connections */
+ return NULL;
} else {
/* Non-pooled connection: multiple modules can use the same connection. */
aoi = ao2_iterator_init(class->obj_container, 0);
@@ -552,12 +555,18 @@
}
}
- if (obj && check) {
+ if (obj && ast_test_flag(&flags, RES_ODBC_SANITY_CHECK)) {
ast_odbc_sanity_check(obj);
} else if (obj && obj->parent->idlecheck > 0 && ast_tvdiff_sec(ast_tvnow(), obj->last_used) > obj->parent->idlecheck)
odbc_obj_connect(obj);
return obj;
+}
+
+struct odbc_obj *ast_odbc_request_obj(const char *name, int check)
+{
+ struct ast_flags flags = { check ? RES_ODBC_SANITY_CHECK : 0 };
+ return ast_odbc_request_obj2(name, flags);
}
static odbc_status odbc_obj_disconnect(struct odbc_obj *obj)
More information about the asterisk-commits
mailing list