You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by ni...@apache.org on 2005/11/28 19:01:35 UTC

svn commit: r349448 - /apr/apr-util/trunk/dbd/apr_dbd_pgsql.c

Author: niq
Date: Mon Nov 28 10:01:29 2005
New Revision: 349448

URL: http://svn.apache.org/viewcvs?rev=349448&view=rev
Log:
Fix args counting in apr_dbd_prepare in case of double-%
(thanks to Chris Darroch for pointing it out)

Modified:
    apr/apr-util/trunk/dbd/apr_dbd_pgsql.c

Modified: apr/apr-util/trunk/dbd/apr_dbd_pgsql.c
URL: http://svn.apache.org/viewcvs/apr/apr-util/trunk/dbd/apr_dbd_pgsql.c?rev=349448&r1=349447&r2=349448&view=diff
==============================================================================
--- apr/apr-util/trunk/dbd/apr_dbd_pgsql.c (original)
+++ apr/apr-util/trunk/dbd/apr_dbd_pgsql.c Mon Nov 28 10:01:29 2005
@@ -247,8 +247,13 @@
     }
     /* Translate from apr_dbd to native query format */
     for (sqlptr = (char*)query; *sqlptr; ++sqlptr) {
-        if ((sqlptr[0] == '%') && isalpha(sqlptr[1])) {
-            ++nargs;
+        if (sqlptr[0] == '%') {
+            if (isalpha(sqlptr[1])) {
+                ++nargs;
+            }
+            else if (sqlptr[1] == '%') {
+                ++sqlptr;
+            }
         }
     }
     length = strlen(query) + 1;