]> granicus.if.org Git - php/commitdiff
- Make test conform to the error reporting that always returns
authorDavid Coallier <davidc@php.net>
Mon, 10 Nov 2008 18:44:04 +0000 (18:44 +0000)
committerDavid Coallier <davidc@php.net>
Mon, 10 Nov 2008 18:44:04 +0000 (18:44 +0000)
  three elements. Adjusted all bugs and tests that were using
  errorInfo() and errorCode() (dbh & stmt)

ext/pdo_mysql/tests/bug41125.phpt
ext/pdo_mysql/tests/bug_41997.phpt
ext/pdo_mysql/tests/pdo_mysql_begintransaction.phpt
ext/pdo_mysql/tests/pdo_mysql_errorinfo.phpt
ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_anonymous.phpt
ext/pdo_mysql/tests/pdo_mysql_prepare_emulated_placeholder_everywhere.phpt
ext/pdo_mysql/tests/pdo_mysql_prepare_native_dup_named_placeholder.phpt
ext/pdo_mysql/tests/pdo_mysql_prepare_native_named_placeholder.phpt
ext/pdo_mysql/tests/pdo_mysql_stmt_errorinfo.phpt
ext/pdo_mysql/tests/pdo_mysql_stmt_multiquery.phpt
ext/pdo_mysql/tests/pecl_bug_5780.phpt

index 5889a4d291012472ee118d0e789e0293f18f5c48..cd913bbf3aeb41d5b793807bd00368ac1ee04c61 100644 (file)
@@ -85,78 +85,78 @@ foreach ($queries as $k => $query) {
 ?>
 --EXPECT--
 1
-00000
+00000 -  - 
 -------------------------------------------------------
 [1] Query: [[SELECT 1 FROM DUAL WHERE 1 = '?\'\'']]
 
-00000
+00000 -  - 
 --------
 [2] Query: [[SELECT 'a\'0' FROM DUAL WHERE 1 = ?]]
 a'0
-00000
+00000 -  - 
 --------
 [3] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND ?]]
 a - b'
-00000
+00000 -  - 
 --------
 [4] Query: [[SELECT 'foo?bar', '', '''' FROM DUAL WHERE ?]]
 foo?bar -  - '
-00000
+00000 -  - 
 --------
 Query: [[SELECT upper(:id) FROM DUAL WHERE '1']]
 O'\0
-00000
+00000 -  - 
 -------------------------------------------------------
 [1] Query: [[SELECT 1, 'foo' FROM DUAL WHERE 1 = :id AND '\0' IS NULL AND  2 <> :id]]
 
-00000
+00000 -  - 
 --------
 [2] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '' AND  2 <> :id]]
 
-00000
+00000 -  - 
 --------
 [3] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'\'' = '''' AND  2 <> :id]]
 
-00000
+00000 -  - 
 --------
 [4] Query: [[SELECT 1 FROM DUAL WHERE 1 = :id AND '\'' = '''' AND  2 <> :id]]
 1
-00000
+00000 -  - 
 --------
 [5] Query: [[SELECT 'a', 'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]]
 a - b'
-00000
+00000 -  - 
 --------
 [6] Query: [[SELECT 'a''', '\'b\'' FROM DUAL WHERE '''' LIKE '\'' AND 1]]
 a' - 'b'
-00000
+00000 -  - 
 --------
 [7] Query: [[SELECT UPPER(:id) FROM DUAL WHERE '1']]
 1
-00000
+00000 -  - 
 --------
 [8] Query: [[SELECT 1 FROM DUAL WHERE '\'']]
 
-00000
+00000 -  - 
 --------
 [9] Query: [[SELECT 1 FROM DUAL WHERE :id AND '\0' OR :id]]
 1
-00000
+00000 -  - 
 --------
 [10] Query: [[SELECT 1 FROM DUAL WHERE 'a\f\n\0' AND 1 >= :id]]
 
-00000
+00000 -  - 
 --------
 [11] Query: [[SELECT 1 FROM DUAL WHERE '\'' = '''']]
 1
-00000
+00000 -  - 
 --------
 [12] Query: [[SELECT '\n' '1 FROM DUAL WHERE '''' and :id']]
 
 1 FROM DUAL WHERE '' and :id
-00000
+00000 -  - 
 --------
 [13] Query: [[SELECT 1 'FROM DUAL WHERE :id AND '''' = '''' OR 1 = 1 AND ':id]]
 1
-00000
+00000 -  - 
 --------
index 60bdfee2ba4964b06af1dedb8d5be8add96761da..c48a641f9776d3c236fa83bacdbb6767678fc574 100644 (file)
@@ -46,9 +46,13 @@ array(1) {
     string(1) "1"
   }
 }
-array(1) {
+array(3) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
 array(1) {
   [0]=>
@@ -57,8 +61,12 @@ array(1) {
     string(1) "2"
   }
 }
-array(1) {
+array(3) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
+  [2]=>
+  NULL
 }
-done!
\ No newline at end of file
+done!
index 209bf3d89d80edfeae8d0ab313a7a1793fb7dddc..30aecf4b547e2f0992359ca04b5d3698a1dcee0b 100644 (file)
@@ -195,7 +195,7 @@ array(2) {
   ["label"]=>
   string(1) "z"
 }
-[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000
+[026] Autocommit mode of the MySQL Server should be off, got '1', [0] 00000  
 [028] I'm confused, how can autocommit be on? Didn't I say I want to manually control transactions?
 string(5) "00000"
-done!
\ No newline at end of file
+done!
index 8829dc448abc55ea2332a6e220951f823ad46097..99b2b846b54cd6f7313665ceb9406af69c2dd1e7 100644 (file)
@@ -14,13 +14,9 @@ $db = MySQLPDOTest::factory();
        MySQLPDOTest::createTestTable($db);
 
        function check_error($offset, &$obj, $expected = '00000') {
-
                $info = $obj->errorInfo();
-               if (count($info) != 3)
-                       printf("[%03d] Info should have three fields, got %s\n",
-                               $offset, var_export($info, true));
-
                $code = $info[0];
+
                if (($code != $expected) && (($expected != '00000') && ($code != ''))) {
                        printf("[%03d] Expecting error code '%s' got code '%s'\n",
                                $offset, $expected, $code);
@@ -33,6 +29,8 @@ $db = MySQLPDOTest::factory();
                                printf("[%03d] Driver-specific error message.not set\n", $offset);
                }
 
+               
+
        }
 
        function pdo_mysql_errorinfo($db, $offset) {
@@ -100,74 +98,12 @@ $db = MySQLPDOTest::factory();
 
        $db->exec('DROP TABLE IF EXISTS test');
        print "done!";
+?>
 --EXPECTF--
 Emulated Prepared Statements...
-[002] Info should have three fields, got array (
-  0 => '00000',
-)
-[003] Info should have three fields, got array (
-  0 => '00000',
-)
-[004] Info should have three fields, got array (
-  0 => '00000',
-)
-[005] Info should have three fields, got array (
-  0 => '00000',
-)
-[009] Info should have three fields, got array (
-  0 => '00000',
-)
-[010] Info should have three fields, got array (
-  0 => '00000',
-)
-[013] Info should have three fields, got array (
-  0 => '00000',
-)
-[014] Info should have three fields, got array (
-  0 => '00000',
-)
-[015] Info should have three fields, got array (
-  0 => 'IM001',
-)
 [015] Driver-specific error code not set
 [015] Driver-specific error message.not set
-[016] Info should have three fields, got array (
-  0 => 'IM001',
-)
 [016] Driver-specific error code not set
 [016] Driver-specific error message.not set
-[017] Info should have three fields, got array (
-  0 => '00000',
-)
-[018] Info should have three fields, got array (
-  0 => '00000',
-)
 Native Prepared Statements...
-[022] Info should have three fields, got array (
-  0 => '00000',
-)
-[023] Info should have three fields, got array (
-  0 => '00000',
-)
-[024] Info should have three fields, got array (
-  0 => '00000',
-)
-[025] Info should have three fields, got array (
-  0 => '00000',
-)
-[030] Info should have three fields, got array (
-  0 => '00000',
-)
-[033] Info should have three fields, got array (
-  0 => '00000',
-)
-[034] Info should have three fields, got array (
-  0 => '00000',
-)
-[037] Info should have three fields, got array (
-  0 => '00000',
-)
-[038] Info should have three fields, got array (
-  0 => '00000',
-)
-done!
\ No newline at end of file
+done!
index 1f333b9a9932e5ca846e1148aed98301f7e6e0b3..30edcbe4b418be0031a1eb5477806d80081f758c 100644 (file)
@@ -72,7 +72,9 @@ array(1) {
 now the same with native PS
 [005] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
-done!
\ No newline at end of file
+done!
index be83446c853c0195c739f9f25fba8ce7cc51c8f2..a8faa8d13b9ed165619cb5bdae232d3ffa22e126 100644 (file)
@@ -59,6 +59,8 @@ MySQLPDOTest::skip();
 Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
 [003] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
@@ -69,7 +71,9 @@ Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: num
 Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line 33
 [005] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
-done!
\ No newline at end of file
+done!
index a84c8d56d268c69f0d91cad24cf7beb836817f38..4f901964ec08c5dbe163c5135226b7fbdca7a450 100644 (file)
@@ -101,6 +101,8 @@ Native...
 Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
 [003] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
@@ -130,7 +132,9 @@ Native...
 Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number in %s on line %d
 [008] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
-done!
\ No newline at end of file
+done!
index 6f673c78b218320091e01dac40ace4188360a6d2..4ead73d7fd92cb80879af6d45cc1368d8ae921c2 100644 (file)
@@ -70,6 +70,8 @@ $db = MySQLPDOTest::factory();
 --EXPECTF--
 [003] Execute has failed, 'HY093' array (
   0 => 'HY093',
+  1 => NULL,
+  2 => NULL,
 )
 array(0) {
 }
@@ -82,4 +84,4 @@ array(1) {
     string(12) ":placeholder"
   }
 }
-done!
\ No newline at end of file
+done!
index c29ffff15784e79f61cb37de3a879d6c3b5f8f09..da372534fd082da6d3896145e073a506e6d0c6e6 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
@@ -116,4 +128,4 @@ array(3) {
   [2]=>
   string(%d) "Table '%s.ihopeitdoesnotexist' doesn't exist"
 }
-done!
\ No newline at end of file
+done!
index dbf60d527a3319d1ed5a9921e3fe09b817ff9248..f88a1a385eb839ff661b85d06ca69d2fba5508ed 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]=>
@@ -87,4 +95,4 @@ 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
 
-Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d
\ No newline at end of file
+Fatal error: Call to a member function errorInfo() on a non-object in %s on line %d
index c2e0a7937104b8084b885f8d10de29cbf5f1f77d..5cc34978952bb9d0e3fc3e4b4f6e661f391d3ce1 100644 (file)
@@ -25,6 +25,7 @@ var_dump($authstmt->fetch(PDO::FETCH_NUM));
 $info = $logstmt->errorInfo();
 unset($info[2]);
 var_dump($info);
+?>
 --EXPECT--
 array(2) {
   [0]=>
@@ -33,7 +34,9 @@ array(2) {
   string(7) "testing"
 }
 bool(true)
-array(1) {
+array(2) {
   [0]=>
   string(5) "00000"
+  [1]=>
+  NULL
 }