[asterisk-commits] seanbright: branch 1.4 r269006 - /branches/1.4/cdr/cdr_tds.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jun 8 10:28:53 CDT 2010


Author: seanbright
Date: Tue Jun  8 10:28:49 2010
New Revision: 269006

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=269006
Log:
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

Modified:
    branches/1.4/cdr/cdr_tds.c

Modified: branches/1.4/cdr/cdr_tds.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/cdr/cdr_tds.c?view=diff&rev=269006&r1=269005&r2=269006
==============================================================================
--- branches/1.4/cdr/cdr_tds.c (original)
+++ branches/1.4/cdr/cdr_tds.c Tue Jun  8 10:28:49 2010
@@ -477,7 +477,7 @@
 		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




More information about the asterisk-commits mailing list