PHP  
 PHP_5_4
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_030.phpt ('ODBC PDO Common: extending PDO (4)')

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:         
$this->setFetchMode(PDO::FETCH_ASSOC);
19:         echo 
__METHOD__ "()\n";
20:     }
21:     
22:     function 
__destruct()
23:     {
24:         echo 
__METHOD__ "()\n";
25:     }
26:     
27:     function 
execute($params = array())
28:     {
29:         echo 
__METHOD__ "()\n";
30:         
parent::execute();        
31:     }
32: }
33:
34: class 
PDODatabase extends PDO
35:
{
36:     function 
__destruct()
37:     {
38:         echo 
__METHOD__ "()\n";
39:     }
40:     
41:     function 
query($sql)
42:     {
43:         echo 
__METHOD__ "()\n";
44:         return 
parent::query($sql);
45:     }
46: }
47:
48:
$db PDOTest::factory('PDODatabase');
49:
var_dump(get_class($db));
50:
51:
$db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10), val2 VARCHAR(16))');
52:
53:
$stmt $db->prepare("INSERT INTO test VALUES(?, ?, ?)");
54:
var_dump(get_class($stmt));
55: foreach (
$data as $row) {
56:     
$stmt->execute($row);
57: }
58:
59: unset(
$stmt);
60:
61: echo 
"===QUERY===\n";
62:
63:
var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
64:
$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatementx', array($db)));
65:
var_dump($db->getAttribute(PDO::ATTR_STATEMENT_CLASS));
66:
$stmt $db->query('SELECT * FROM test');
67:
var_dump(get_class($stmt));
68:
var_dump(get_class($stmt->dbh));
69:
70: echo 
"===FOREACH===\n";
71:
72: foreach(
$stmt as $obj) {
73:     
var_dump($obj);
74: }
75:
76: echo 
"===DONE===\n";
77: exit(
0);
78:
?>
79:

Expected

string(11) "PDODatabase"
string(12) "PDOStatement"
===QUERY===
array(1) {
  [0]=>
  string(12) "PDOStatement"
}
array(2) {
  [0]=>
  string(13) "PDOStatementX"
  [1]=>
  array(1) {
    [0]=>
    object(PDODatabase)#%d (0) {
    }
  }
}
PDODatabase::query()
PDOStatementX::__construct()
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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56

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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56

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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56
===QUERY===
array(1) {
  [0]=>
  string(12) "PDOStatement"
}
array(2) {
  [0]=>
  string(13) "PDOStatementX"
  [1]=>
  array(1) {
    [0]=>
    object(PDODatabase)#1 (0) {
    }
  }
}
PDODatabase::query()
PDOStatementX::__construct()
string(13) "PDOStatementX"
string(11) "PDODatabase"
===FOREACH===
===DONE===
PDOStatementX::__destruct()
PDODatabase::__destruct()

Diff

# original source file: ext/pdo/tests/pdo_030.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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56
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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56
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_4/ext/pdo_odbc/odbc_stmt.c:254) in /var/php_gcov/PHP_5_4/ext/pdo_odbc/tests/pdo_030.php on line 56
023- array(3) {
024-   ["id"]=>
025-   string(2) "10"
029+ ===DONE===
030+ PDOStatementX::__destruct()
031+ PDODatabase::__destruct()
026-   ["val"]=>
027-   string(3) "Abc"
028-   ["val2"]=>
029-   string(3) "zxy"
030- }
031- array(3) {
032-   ["id"]=>
033-   string(2) "20"
034-   ["val"]=>
035-   string(3) "Def"
036-   ["val2"]=>
037-   string(3) "wvu"
038- }
039- array(3) {
040-   ["id"]=>
041-   string(2) "30"
042-   ["val"]=>
043-   string(3) "Ghi"
044-   ["val2"]=>
045-   string(3) "tsr"
046- }
047- ===DONE===
048- PDOStatementX::__destruct()
049- PDODatabase::__destruct()

 

Generated at Mon, 15 Dec 2014 17:02:57 +0000 (3 days ago)

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