[mapserver-commits] r13071 - branches/branch-5-6/mapserver

svn at osgeo.org svn at osgeo.org
Mon Feb 6 16:01:36 EST 2012


Author: aboudreault
Date: 2012-02-06 13:01:36 -0800 (Mon, 06 Feb 2012)
New Revision: 13071

Modified:
   branches/branch-5-6/mapserver/HISTORY.TXT
   branches/branch-5-6/mapserver/mapogcfilter.c
   branches/branch-5-6/mapserver/mappostgis.c
Log:
backport 5.6: WFS quote escape issue (#4087)

Modified: branches/branch-5-6/mapserver/HISTORY.TXT
===================================================================
--- branches/branch-5-6/mapserver/HISTORY.TXT	2012-02-06 20:37:41 UTC (rev 13070)
+++ branches/branch-5-6/mapserver/HISTORY.TXT	2012-02-06 21:01:36 UTC (rev 13071)
@@ -13,6 +13,9 @@
 
 Version 5.6.8 (SVN branch-5-6):
 ---------------------------
+
+- WFS Quote Escape issue (#4087)
+
 - fix segfault on join with postgresql tables (#4074)
 
 - define Z_BEST_COMPRESSION for newer libpng versions (#4033)

Modified: branches/branch-5-6/mapserver/mapogcfilter.c
===================================================================
--- branches/branch-5-6/mapserver/mapogcfilter.c	2012-02-06 20:37:41 UTC (rev 13070)
+++ branches/branch-5-6/mapserver/mapogcfilter.c	2012-02-06 21:01:36 UTC (rev 13071)
@@ -3398,7 +3398,10 @@
         psFilterNode->psRightNode->pOther && 
         (*(int *)psFilterNode->psRightNode->pOther) == 1)
     {
-        snprintf(szTmp, sizeof(szTmp), "lower('%s') ",  psFilterNode->psRightNode->pszValue);
+        char* pszEscapedStr;
+        pszEscapedStr = msLayerEscapeSQLParam(lp, psFilterNode->psRightNode->pszValue);
+        snprintf(szTmp, sizeof(szTmp), "lower('%s') ", pszEscapedStr);
+        msFree(pszEscapedStr);
         strlcat(szBuffer, szTmp, bufferSize);
     }
     else

Modified: branches/branch-5-6/mapserver/mappostgis.c
===================================================================
--- branches/branch-5-6/mapserver/mappostgis.c	2012-02-06 20:37:41 UTC (rev 13070)
+++ branches/branch-5-6/mapserver/mappostgis.c	2012-02-06 21:01:36 UTC (rev 13071)
@@ -1782,7 +1782,10 @@
 
     /* Something went wrong. */
     if (!pgresult || PQresultStatus(pgresult) != PGRES_TUPLES_OK) {
-        msSetError(MS_QUERYERR, "Error (%s) executing query: %s", "msPostGISLayerWhichShapes()", PQerrorMessage(layerinfo->pgconn), strSQL);
+        if ( layer->debug ) {
+	    msDebug("Error (%s) executing query: %s", "msPostGISLayerWhichShapes()\n", PQerrorMessage(layerinfo->pgconn), strSQL);
+	}
+        msSetError(MS_QUERYERR, "Error executing query: %s ", "msPostGISLayerWhichShapes()", PQerrorMessage(layerinfo->pgconn));
         free(strSQL);
         if (pgresult) {
             PQclear(pgresult);
@@ -1983,7 +1986,10 @@
 
     /* Something went wrong. */
     if ( (!pgresult) || (PQresultStatus(pgresult) != PGRES_TUPLES_OK) ) {
-        msSetError(MS_QUERYERR, "Error (%s) executing SQL: %s", "msPostGISLayerGetShape()", PQerrorMessage(layerinfo->pgconn), strSQL );
+        if ( layer->debug ) {
+	    msDebug("Error (%s) executing SQL: %s", "msPostGISLayerGetShape()\n", PQerrorMessage(layerinfo->pgconn), strSQL );
+        }            
+        msSetError(MS_QUERYERR, "Error executing SQL: %s", "msPostGISLayerGetShape()", PQerrorMessage(layerinfo->pgconn));
 
         if (pgresult) {
             PQclear(pgresult);
@@ -2076,7 +2082,10 @@
     pgresult = PQexecParams(layerinfo->pgconn, sql,0, NULL, NULL, NULL, NULL, 0);
     
     if ( (!pgresult) || (PQresultStatus(pgresult) != PGRES_TUPLES_OK) ) {
-        msSetError(MS_QUERYERR, "Error (%s) executing SQL: %s", "msPostGISLayerGetItems()", PQerrorMessage(layerinfo->pgconn), sql);
+        if ( layer->debug ) {
+	  msDebug("Error (%s) executing SQL: %s", "msPostGISLayerGetItems()\n", PQerrorMessage(layerinfo->pgconn), sql);
+	}
+        msSetError(MS_QUERYERR, "Error executing SQL: %s", "msPostGISLayerGetItems()", PQerrorMessage(layerinfo->pgconn));
         if (pgresult) {
             PQclear(pgresult);
         }



More information about the mapserver-commits mailing list