]> granicus.if.org Git - php/commitdiff
- Synced pieces of codes
authorFelipe Pena <felipe@php.net>
Tue, 24 Mar 2009 19:32:06 +0000 (19:32 +0000)
committerFelipe Pena <felipe@php.net>
Tue, 24 Mar 2009 19:32:06 +0000 (19:32 +0000)
- Fixed tests

ext/pdo/pdo_stmt.c
ext/pdo_mysql/tests/bug44327.phpt
ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt

index 66bd8b1413b68bcd65194649d77131eb343407c9..1d559977651b8622ff993173dfa1e7dbb3c4b68a 100755 (executable)
@@ -2650,6 +2650,7 @@ static zval *row_prop_or_dim_read(zval *object, zval *member, int type TSRMLS_DC
                        }
                }
                if (strcmp(Z_STRVAL_P(member), "queryString") == 0) {
+                       zval_ptr_dtor(&return_value);
                        return std_object_handlers.read_property(object, member, IS_STRING TSRMLS_CC);
                }
        }
@@ -2694,28 +2695,18 @@ static void row_prop_or_dim_delete(zval *object, zval *offset TSRMLS_DC)
 
 static HashTable *row_get_properties(zval *object TSRMLS_DC)
 {
-       zval *tmp;
        pdo_stmt_t * stmt = (pdo_stmt_t *) zend_object_store_get_object(object TSRMLS_CC);
        int i;
-       HashTable *ht;
-
-       MAKE_STD_ZVAL(tmp);
-       array_init(tmp);
 
        for (i = 0; i < stmt->column_count; i++) {
                zval *val;
                MAKE_STD_ZVAL(val);
                fetch_value(stmt, val, i, NULL TSRMLS_CC);
 
-               add_assoc_zval(tmp, stmt->columns[i].name, val);
+               zend_hash_update(stmt->properties, stmt->columns[i].name, stmt->columns[i].namelen + 1, (void *)&val, sizeof(zval *), NULL);
        }
 
-       ht = Z_ARRVAL_P(tmp);
-
-       ZVAL_NULL(tmp);
-       FREE_ZVAL(tmp);
-
-       return ht;
+       return stmt->properties;
 }
 
 static union _zend_function *row_method_get(
index 1952cce050d8b30ae75419919092693e20b452cb..1d853a7f8590ad8561f37fccffc4f868baa2dda9 100644 (file)
@@ -42,22 +42,22 @@ $db = MySQLPDOTest::factory();
 ?>
 --EXPECTF--
 object(PDORow)#%d (2) {
-  ["queryString"]=>
-  string(17) "SELECT 1 AS "one""
-  ["one"]=>
+  [u"queryString"]=>
+  unicode(17) "SELECT 1 AS "one""
+  [u"one"]=>
   string(1) "1"
 }
-string(1) "1"
-string(1) "1"
-string(17) "SELECT 1 AS "one""
+unicode(1) "1"
+unicode(1) "1"
+unicode(17) "SELECT 1 AS "one""
 ----------------------------------
 object(PDORow)#%d (2) {
-  ["queryString"]=>
-  string(19) "SELECT id FROM test"
-  ["id"]=>
-  string(1) "1"
+  [u"queryString"]=>
+  unicode(19) "SELECT id FROM test"
+  [u"id"]=>
+  unicode(1) "1"
 }
-string(19) "SELECT id FROM test"
+unicode(19) "SELECT id FROM test"
 ----------------------------------
 
 Notice: Trying to get property of non-object in %s on line %d
index c29ffff15784e79f61cb37de3a879d6c3b5f8f09..a23952106ea38635d7844f0d47a6663ff3320f72 100644 (file)
@@ -61,9 +61,13 @@ $db = MySQLPDOTest::factory();
 ?>
 --EXPECTF--
 Testing emulated PS...
-array(1) {
+array(3) {
   [0]=>
   string(0) ""
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 
 Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d
@@ -86,17 +90,25 @@ array(3) {
   [2]=>
   string(%d) "Table '%s.test' doesn't exist"
 }
-array(1) {
+array(3) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 Testing native PS...
 
 Warning: PDO::prepare(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.ihopeitdoesnotexist' doesn't exist in %s on line %d
 bool(false)
-array(1) {
+array(3) {
   [0]=>
   string(0) ""
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 
 Warning: PDOStatement::execute(): SQLSTATE[42S02]: Base table or view not found: 1146 Table '%s.test' doesn't exist in %s on line %d
index dbf60d527a3319d1ed5a9921e3fe09b817ff9248..f560023bba3bf1f4d98207c3d475f1deb0f0d2fc 100644 (file)
@@ -54,9 +54,13 @@ MySQLPDOTest::skip();
 ?>
 --EXPECTF--
 Emulated Prepared Statements...
-array(1) {
+array(3) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 array(1) {
   [0]=>
@@ -65,9 +69,13 @@ array(1) {
     string(1) "a"
   }
 }
-array(1) {
+array(3) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 array(1) {
   [0]=>
@@ -85,6 +93,6 @@ array(1) {
 }
 Native Prepared Statements...
 
-Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT label FROM test ORDER BY id ASC LIMIT 1' at line %d in %s on line %d
+Warning: PDO::query(): SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '%SSELECT label FROM test ORDER BY id ASC LIMIT 1' at line %d in %s on line %d
 
 Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d
\ No newline at end of file