PHP  
 PHP_5_5
downloads | QA | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | my php.net 
 

Test Failure Report for ext/pdo_odbc/tests/pdo_029.phpt ('ODBC PDO Common: extending PDO (3)')

Script

1: <?php
2:
if (getenv('REDIR_TEST_DIR') === falseputenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 
3: require_once 
getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
4:
5:
$data = array(
6:     array(
'10''Abc''zxy'),
7:     array(
'20''Def''wvu'),
8:     array(
'30''Ghi''tsr'),
9: );
10:
11: class 
PDOStatementX extends PDOStatement
12:
{
13:     public 
$dbh;
14:     
15:     protected function 
__construct($dbh)
16:     {
17:         
$this->dbh $dbh;
18:         echo 
__METHOD__ "()\n";
19:     }
20:     
21:     function 
__destruct()
22:     {
23:         echo 
__METHOD__ "()\n";
24:     }
25:     
26:     function 
execute($params = array())
27:     {
28:         echo 
__METHOD__ "()\n";
29:         
parent::execute();        
30:     }
31: }
32:
33: class 
PDODatabase extends PDO
34:
{
35:     function 
__destruct()
36:     {
37:         echo 
__METHOD__ "()\n";
38:     }
39:     
40:     function 
query($sql)
41:     {
42:         echo 
__METHOD__ "()\n";
43:         
$stmt $this->prepare($sql, array(PDO::ATTR_STATEMENT_CLASS=>array('PDOStatementx', array($this))));
44:         
$stmt->setFetchMode(PDO::FETCH_ASSOC);
45:         
$stmt->execute();
46:         return 
$stmt;
47:     }
48: }
49:
50:
$db PDOTest::factory('PDODatabase');
51:
var_dump(get_class($db));
52:
53:
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
54:
55:
$stmt $db->prepare("INSERT INTO test VALUES(?, ?, ?)");
56:
var_dump(get_class($stmt));
57: foreach (
$data as $row) {
58:     
$stmt->execute($row);
59: }
60:
61: unset(
$stmt);
62:
63: echo 
"===QUERY===\n";
64:
65:
$stmt $db->query('SELECT * FROM test');
66:
var_dump(get_class($stmt));
67:
var_dump(get_class($stmt->dbh));
68:
69: echo 
"===FOREACH===\n";
70:
71: foreach(
$stmt as $obj) {
72:     
var_dump($obj);
73: }
74:
75: echo 
"===DONE===\n";
76: exit(
0);
77:
?>
78:

Expected

string(11) "PDODatabase"
string(12) "PDOStatement"
===QUERY===
PDODatabase::query()
PDOStatementX::__construct()
PDOStatementX::execute()
string(13) "PDOStatementX"
string(11) "PDODatabase"
===FOREACH===
array(3) {
  ["id"]=>
  string(2) "10"
  ["val"]=>
  string(3) "Abc"
  ["val2"]=>
  string(3) "zxy"
}
array(3) {
  ["id"]=>
  string(2) "20"
  ["val"]=>
  string(3) "Def"
  ["val2"]=>
  string(3) "wvu"
}
array(3) {
  ["id"]=>
  string(2) "30"
  ["val"]=>
  string(3) "Ghi"
  ["val2"]=>
  string(3) "tsr"
}
===DONE===
PDOStatementX::__destruct()
PDODatabase::__destruct()

Output

string(11) "PDODatabase"
string(12) "PDOStatement"

Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58

Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58

Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58
===QUERY===
PDODatabase::query()
PDOStatementX::__construct()
PDOStatementX::execute()
string(13) "PDOStatementX"
string(11) "PDODatabase"
===FOREACH===
===DONE===
PDOStatementX::__destruct()
PDODatabase::__destruct()

Diff

# original source file: ext/pdo/tests/pdo_029.phpt
003+ 
004+ Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58
005+ 
006+ Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58
007+ 
008+ Warning: PDOStatement::execute(): SQLSTATE[42000]: Syntax error or access violation: 1064 [MySQL][ODBC 5.1 Driver][mysqld-5.1.73]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 ' , )' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_5_5/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_5/ext/pdo_odbc/tests/pdo_029.php on line 58
010- array(3) {
011-   ["id"]=>
012-   string(2) "10"
016+ ===DONE===
017+ PDOStatementX::__destruct()
018+ PDODatabase::__destruct()
013-   ["val"]=>
014-   string(3) "Abc"
015-   ["val2"]=>
016-   string(3) "zxy"
017- }
018- array(3) {
019-   ["id"]=>
020-   string(2) "20"
021-   ["val"]=>
022-   string(3) "Def"
023-   ["val2"]=>
024-   string(3) "wvu"
025- }
026- array(3) {
027-   ["id"]=>
028-   string(2) "30"
029-   ["val"]=>
030-   string(3) "Ghi"
031-   ["val2"]=>
032-   string(3) "tsr"
033- }
034- ===DONE===
035- PDOStatementX::__destruct()
036- PDODatabase::__destruct()

 

Generated at Sat, 12 Apr 2014 09:02:23 +0000 (6 days ago)

Copyright © 2005-2014 The PHP Group
All rights reserved.