[asterisk-commits] rmudgett: branch 1.8 r349819 - /branches/1.8/cel/cel_sqlite3_custom.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 5 17:44:30 CST 2012


Author: rmudgett
Date: Thu Jan  5 17:44:27 2012
New Revision: 349819

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=349819
Log:
Make not assume that the cel_sqlite3_custom SQL table primary key is AcctId.

If a table is created by some other application and the primary key is not
named "AcctId", cel/cel_sqlite3_custom.c will always try to create the
table and fail because it already exists.

* Change the SQL table query to not require AcctId as the primary key.

(closes issue ASTERISK-18963)
Reported by: socketpair
Patches:
      fix.patch (license #6337) patch uploaded by socketpair

Modified:
    branches/1.8/cel/cel_sqlite3_custom.c

Modified: branches/1.8/cel/cel_sqlite3_custom.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/cel/cel_sqlite3_custom.c?view=diff&rev=349819&r1=349818&r2=349819
==============================================================================
--- branches/1.8/cel/cel_sqlite3_custom.c (original)
+++ branches/1.8/cel/cel_sqlite3_custom.c Thu Jan  5 17:44:27 2012
@@ -321,7 +321,7 @@
 	}
 
 	/* is the table there? */
-	sql = sqlite3_mprintf("SELECT COUNT(AcctId) FROM %q;", table);
+	sql = sqlite3_mprintf("SELECT COUNT(*) FROM %q;", table);
 	res = sqlite3_exec(db, sql, NULL, NULL, NULL);
 	sqlite3_free(sql);
 	if (res != SQLITE_OK) {




More information about the asterisk-commits mailing list