[svn-commits] twilson: branch twilson/res_config_sqlite3 r334426 - /team/twilson/res_config...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Sat Sep 3 12:02:59 CDT 2011


Author: twilson
Date: Sat Sep  3 12:02:48 2011
New Revision: 334426

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=334426
Log:
Column and field names double-quoted, strings single quoted.

%Q adds single quotes around escaped value. %q does not. Use appropriate quotes

Modified:
    team/twilson/res_config_sqlite3/res/res_config_sqlite3.c

Modified: team/twilson/res_config_sqlite3/res/res_config_sqlite3.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/res_config_sqlite3/res/res_config_sqlite3.c?view=diff&rev=334426&r1=334425&r2=334426
==============================================================================
--- team/twilson/res_config_sqlite3/res/res_config_sqlite3.c (original)
+++ team/twilson/res_config_sqlite3/res/res_config_sqlite3.c Sat Sep  3 12:02:48 2011
@@ -466,7 +466,7 @@
 }
 
 /*! \note It is important that the COL_* enum matches the order of the columns selected in static_sql */
-static const char *static_sql = "SELECT category, var_name, var_val FROM %Q WHERE filename = %Q AND commented = 0 ORDER BY cat_metric ASC, var_metric ASC";
+static const char *static_sql = "SELECT category, var_name, var_val FROM \"%q\" WHERE filename = %Q AND commented = 0 ORDER BY cat_metric ASC, var_metric ASC";
 enum {
 	COL_CATEGORY,
 	COL_VAR_NAME,
@@ -864,7 +864,7 @@
 		sqltype = "TEXT";
 	}
 
-	if (!(sql = sqlite3_mprintf("ALTER TABLE %q ADD COLUMN %Q %s", table, column, sqltype))) {
+	if (!(sql = sqlite3_mprintf("ALTER TABLE \"%q\" ADD COLUMN \"%q\" %s", table, column, sqltype))) {
 		return -1;
 	}
 
@@ -940,7 +940,7 @@
 	   return -1;
 	}
 
-	if (!(sql = sqlite3_mprintf("PRAGMA table_info(%q)", table))) {
+	if (!(sql = sqlite3_mprintf("PRAGMA table_info(\"%q\")", table))) {
 		unref_db(&db);
 		ao2_ref(columns, -1);
 		return -1;




More information about the svn-commits mailing list