Add some debug code and add a missing release

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@130232 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-07-11 19:53:38 +00:00
parent 9cd11917c5
commit bead8cd6f0
2 changed files with 35 additions and 0 deletions

View File

@@ -40,6 +40,11 @@ struct odbc_obj {
SQLHDBC con; /* ODBC Connection Handle */
struct odbc_class *parent; /* Information about the connection is protected */
struct timeval last_used;
#ifdef DEBUG_THREADS
char file[80];
char function[80];
int lineno;
#endif
unsigned int used:1;
unsigned int up:1;
AST_LIST_ENTRY(odbc_obj) list;
@@ -100,7 +105,12 @@ int ast_odbc_smart_execute(struct odbc_obj *obj, SQLHSTMT stmt) __attribute__ ((
* thread which requests it. Note that all connections should be released
* when the thread is done by calling odbc_release_obj(), below.
*/
#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 Releases an ODBC object previously allocated by odbc_request_obj()