From 9376320c82ed7077b317f64d7e7c2a08ccb8e814 Mon Sep 17 00:00:00 2001 From: Richard Mudgett Date: Thu, 5 Jan 2012 23:44:27 +0000 Subject: [PATCH] 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 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@349819 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- cel/cel_sqlite3_custom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cel/cel_sqlite3_custom.c b/cel/cel_sqlite3_custom.c index 4596e770e7..e0b0225193 100644 --- a/cel/cel_sqlite3_custom.c +++ b/cel/cel_sqlite3_custom.c @@ -321,7 +321,7 @@ static int load_module(void) } /* 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) {