felipe          Wed Nov  5 23:40:38 2008 UTC

  Modified files:              (Branch: PHP_5_3)
    /php-src/ext/pdo    pdo_stmt.c 
    /php-src/ext/pdo_sqlite/tests       debugdumpparams_001.phpt 
  Log:
  MFH:
  - Fixed wrong check
  - Improved test
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo/pdo_stmt.c?r1=1.118.2.38.2.24.2.33&r2=1.118.2.38.2.24.2.34&diff_format=u
Index: php-src/ext/pdo/pdo_stmt.c
diff -u php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.33 
php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.34
--- php-src/ext/pdo/pdo_stmt.c:1.118.2.38.2.24.2.33     Mon Nov  3 23:44:38 2008
+++ php-src/ext/pdo/pdo_stmt.c  Wed Nov  5 23:40:37 2008
@@ -18,7 +18,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.33 2008/11/03 23:44:38 felipe Exp $ */
+/* $Id: pdo_stmt.c,v 1.118.2.38.2.24.2.34 2008/11/05 23:40:37 felipe Exp $ */
 
 /* The PDO Statement Handle Class */
 
@@ -2197,14 +2197,14 @@
                        uint len;
                        ulong num;
 
-                       if (zend_hash_get_current_key_ex(stmt->bound_params, 
&str, &len, &num, 0, &pos) == HASH_KEY_IS_STRING) {
-                               php_stream_printf(out TSRMLS_CC, "Key: Position 
#%d:\n", num);
+                       if (zend_hash_get_current_key_ex(stmt->bound_params, 
&str, &len, &num, 0, &pos) == HASH_KEY_IS_LONG) {
+                               php_stream_printf(out TSRMLS_CC, "Key: Position 
#%ld:\n", num);
                        } else {
                                php_stream_printf(out TSRMLS_CC, "Key: Name: 
[%d] %.*s\n", len, len, str);
                        }
 
-                       php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] 
%.*s\nis_param=%d\nparam_type=%d\n",
-                               param->paramno, param->namelen, param->namelen, 
param->name,
+                       php_stream_printf(out TSRMLS_CC, "paramno=%d\nname=[%d] 
\"%.*s\"\nis_param=%d\nparam_type=%d\n",
+                               param->paramno, param->namelen, param->namelen, 
param->name ? param->name : "",
                                param->is_param,
                                param->param_type);
                        
http://cvs.php.net/viewvc.cgi/php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt
diff -u php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt:1.1.2.2 
php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt:1.1.2.3
--- php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt:1.1.2.2       Mon Nov 
 3 20:48:51 2008
+++ php-src/ext/pdo_sqlite/tests/debugdumpparams_001.phpt       Wed Nov  5 
23:40:38 2008
@@ -9,23 +9,29 @@
 
 $db = new pdo('sqlite:memory');
 
-$x= $db->prepare('select :a, :b');
+$x= $db->prepare('select :a, :b, ?');
 $x->bindValue(':a', 1, PDO::PARAM_INT);
 $x->bindValue(':b', 'foo');
+$x->bindValue(3, 1313);
 var_dump($x->debugDumpParams());
 
 ?>
 --EXPECT--
-SQL: [13] select :a, :b
-Params:  2
-Key: Position #0:
+SQL: [16] select :a, :b, ?
+Params:  3
+Key: Name: [2] :a
 paramno=-1
-name=[2] :a
+name=[2] ":a"
 is_param=1
 param_type=1
-Key: Position #0:
+Key: Name: [2] :b
 paramno=-1
-name=[2] :b
+name=[2] ":b"
+is_param=1
+param_type=2
+Key: Position #2:
+paramno=2
+name=[0] ""
 is_param=1
 param_type=2
 NULL



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

Reply via email to