[svn-commits] mjordan: branch 13 r431618 - in /branches/13: ./ res/res_odbc.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sun Feb 8 20:34:53 CST 2015


Author: mjordan
Date: Sun Feb  8 20:34:51 2015
New Revision: 431618

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=431618
Log:
res/res_odbc: Remove unneeded queries when determining if a table exists

This patch modifies the ast_odbc_find_table function such that it only performs
a lookup of the requested table if the table is not already known. Prior to
this patch, a queries would be executed against the database even if the table
was already known and cached.

Review: https://reviewboard.asterisk.org/r/4405/

ASTERISK-24742 #close
Reported by: ibercom
patches:
  patch.diff uploaded by ibercom (License 6599)
........

Merged revisions 431617 from http://svn.asterisk.org/svn/asterisk/branches/11

Modified:
    branches/13/   (props changed)
    branches/13/res/res_odbc.c

Propchange: branches/13/
------------------------------------------------------------------------------
--- branch-11-merged (original)
+++ branch-11-merged Sun Feb  8 20:34:51 2015
@@ -1,1 +1,1 @@
-/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487,430506,430564,430589,430795,430798,430920,430993,430996-430997,431049,431135,431187,431218,431384,431423
+/branches/11:1-429517,429539,429632,429783,429804,429825,429867,429893,429982,430009,430126,430415,430487,430506,430564,430589,430795,430798,430920,430993,430996-430997,431049,431135,431187,431218,431384,431423,431617

Modified: branches/13/res/res_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/13/res/res_odbc.c?view=diff&rev=431618&r1=431617&r2=431618
==============================================================================
--- branches/13/res/res_odbc.c (original)
+++ branches/13/res/res_odbc.c Sun Feb  8 20:34:51 2015
@@ -461,7 +461,7 @@
 	SQLLEN sqlptr;
 	SQLHSTMT stmt = NULL;
 	int res = 0, error = 0, try = 0;
-	struct odbc_obj *obj = ast_odbc_request_obj(database, 0);
+	struct odbc_obj *obj;
 
 	AST_RWLIST_RDLOCK(&odbc_tables);
 	AST_RWLIST_TRAVERSE(&odbc_tables, tableptr, list) {
@@ -472,13 +472,10 @@
 	if (tableptr) {
 		AST_RWLIST_RDLOCK(&tableptr->columns);
 		AST_RWLIST_UNLOCK(&odbc_tables);
-		if (obj) {
-			ast_odbc_release_obj(obj);
-		}
 		return tableptr;
 	}
 
-	if (!obj) {
+	if (!(obj = ast_odbc_request_obj(database, 0))) {
 		ast_log(LOG_WARNING, "Unable to retrieve database handle for table description '%s@%s'\n", tablename, database);
 		AST_RWLIST_UNLOCK(&odbc_tables);
 		return NULL;
@@ -564,9 +561,7 @@
 		destroy_table_cache(tableptr);
 		tableptr = NULL;
 	}
-	if (obj) {
-		ast_odbc_release_obj(obj);
-	}
+	ast_odbc_release_obj(obj);
 	return tableptr;
 }
 




More information about the svn-commits mailing list