From: Sean Bright Date: Tue, 8 Jun 2010 15:28:49 +0000 (+0000) Subject: Reduce startup time for cdr_tds with large CDR tables. X-Git-Tag: 1.4.34-rc1~2^2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9cd853fe603a413997a5b338fd8a0259c9c09eac;p=thirdparty%2Fasterisk.git Reduce startup time for cdr_tds with large CDR tables. Since we are just checking for table existence, add a WHERE clause that will return no rows but will raise an error if the table doesn't exist. (closes issue #17380) Reported by: kkwong Patches: issue17380-01.patch uploaded by seanbright (license 71) Tested by: kkwong git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@269006 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/cdr/cdr_tds.c b/cdr/cdr_tds.c index 4e44e4ee1c..6e2c4412b0 100644 --- a/cdr/cdr_tds.c +++ b/cdr/cdr_tds.c @@ -477,7 +477,7 @@ static int mssql_connect(void) goto connect_fail; } - snprintf(query, sizeof(query), "SELECT 1 FROM %s", table); + snprintf(query, sizeof(query), "SELECT 1 FROM %s WHERE 1 = 0", table); #ifdef FREETDS_PRE_0_62 if ((tds_submit_query(tds, query) != TDS_SUCCEED) || (tds_process_simple_query(tds, &result_type) != TDS_SUCCEED || result_type != TDS_CMD_SUCCEED)) #else