[asterisk-commits] seanbright: trunk r126312 - /trunk/cdr/cdr_tds.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jun 29 08:11:56 CDT 2008


Author: seanbright
Date: Sun Jun 29 08:11:55 2008
New Revision: 126312

URL: http://svn.digium.com/view/asterisk?view=rev&rev=126312
Log:
While we're at it, escape all the columns in our TDS queries as well.  Double
quotes seems to be more standard than square brackets (Sybase and SQL Server
both support them).

Modified:
    trunk/cdr/cdr_tds.c

Modified: trunk/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_tds.c?view=diff&rev=126312&r1=126311&r2=126312
==============================================================================
--- trunk/cdr/cdr_tds.c (original)
+++ trunk/cdr/cdr_tds.c Sun Jun 29 08:11:55 2008
@@ -136,25 +136,25 @@
 	}
 
 	erc = dbfcmd(settings->dbproc,
-		"INSERT INTO %s "
+		"INSERT INTO \"%s\" "
 		"("
-			"accountcode, "
-			"src, "
-			"dst, "
-			"dcontext, "
-			"clid, "
-			"channel, "
-			"dstchannel, "
-			"lastapp, "
-			"lastdata, "
-			"start, "
-			"answer, "
-			"[end], "
-			"duration, "
-			"billsec, "
-			"disposition, "
-			"amaflags, "
-			"uniqueid"
+			"\"accountcode\", "
+			"\"src\", "
+			"\"dst\", "
+			"\"dcontext\", "
+			"\"clid\", "
+			"\"channel\", "
+			"\"dstchannel\", "
+			"\"lastapp\", "
+			"\"lastdata\", "
+			"\"start\", "
+			"\"answer\", "
+			"\"end\", "
+			"\"duration\", "
+			"\"billsec\", "
+			"\"disposition\", "
+			"\"amaflags\", "
+			"\"uniqueid\""
 		") "
 		"VALUES "
 		"("
@@ -317,7 +317,7 @@
 		goto failed;
 	}
 
-	if (dbfcmd(settings->dbproc, "SELECT 1 FROM [%s]", settings->table) == FAIL) {
+	if (dbfcmd(settings->dbproc, "SELECT 1 FROM \"%s\"", settings->table) == FAIL) {
 		ast_log(LOG_ERROR, "Unable to build query while verifying the existence of table '%s'\n", settings->table);
 		goto failed;
 	}




More information about the asterisk-commits mailing list