wez             Fri Jul  8 13:00:34 2005 EDT

  Modified files:              
    /php-src/ext/pdo    pdo_sql_parser.re pdo_stmt.c 
  Log:
  For named-parameter-to-named-parameter rewrites, we need to map the original
  names to the new names.
  
  
  
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_sql_parser.re?r1=1.23&r2=1.24&ty=u
Index: php-src/ext/pdo/pdo_sql_parser.re
diff -u php-src/ext/pdo/pdo_sql_parser.re:1.23 
php-src/ext/pdo/pdo_sql_parser.re:1.24
--- php-src/ext/pdo/pdo_sql_parser.re:1.23      Fri Jul  8 11:24:21 2005
+++ php-src/ext/pdo/pdo_sql_parser.re   Fri Jul  8 13:00:28 2005
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_sql_parser.re,v 1.23 2005/07/08 15:24:21 wez Exp $ */
+/* $Id: pdo_sql_parser.re,v 1.24 2005/07/08 17:00:28 wez Exp $ */
 
 #include "php.h"
 #include "php_pdo_driver.h"
@@ -285,6 +285,19 @@
                        plc->qlen = strlen(plc->quoted);
                        plc->freeq = 1;
                        newbuffer_len += plc->qlen;
+
+                       if (stmt->named_rewrite_template) {
+                               /* create a mapping */
+                               char *name = estrndup(plc->pos, plc->len);
+                               
+                               if (stmt->bound_param_map == NULL) {
+                                       ALLOC_HASHTABLE(stmt->bound_param_map);
+                                       zend_hash_init(stmt->bound_param_map, 
13, NULL, NULL, 0);
+                               }
+
+                               zend_hash_update(stmt->bound_param_map, name, 
plc->len + 1, idxbuf, plc->qlen + 1, NULL);
+                               efree(name);
+                       }
                }
                                
                goto rewrite;
http://cvs.php.net/diff.php/php-src/ext/pdo/pdo_stmt.c?r1=1.106&r2=1.107&ty=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.106 php-src/ext/pdo/pdo_stmt.c:1.107
--- php-src/ext/pdo/pdo_stmt.c:1.106    Fri Jul  8 11:25:15 2005
+++ php-src/ext/pdo/pdo_stmt.c  Fri Jul  8 13:00:28 2005
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.106 2005/07/08 15:25:15 wez Exp $ */
+/* $Id: pdo_stmt.c,v 1.107 2005/07/08 17:00:28 wez Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -86,6 +86,12 @@
                 * driver */
                char *name;
                int position = 0;
+
+               if (stmt->named_rewrite_template) {
+                       /* this is not an error here */
+                       return 1;
+               }
+
                zend_hash_internal_pointer_reset(stmt->bound_param_map);
                while (SUCCESS == 
zend_hash_get_current_data(stmt->bound_param_map, (void**)&name)) {
                        if (strcmp(name, param->name)) {

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to