PHP  
 PHP_7_2
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/bug_65946.phpt ('ODBC PDO Common: Bug #65946 (pdo_sql_parser.c permanently converts values bound to strings)')

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:
$db PDOTest::factory();
5:
$db->setAttribute(PDO::ATTR_EMULATE_PREPAREStrue);
6:
$db->exec('CREATE TABLE test(id int)');
7:
$db->exec('INSERT INTO test VALUES(1)');
8: switch (
$db->getAttribute(PDO::ATTR_DRIVER_NAME)) {
9:     case 
'dblib':
10:         
$sql 'SELECT TOP :limit * FROM test';
11:         break;
12:     case 
'firebird':
13:         
$sql 'SELECT FIRST :limit * FROM test';
14:         break;
15:     case 
'oci':
16:         
//$sql = 'SELECT * FROM test FETCH FIRST :limit ROWS ONLY';  // Oracle 12c syntax
17:         
$sql "select id from (select a.*, rownum rnum from (SELECT * FROM test) a where rownum <= :limit)";
18:         break;
19:     default:
20:         
$sql 'SELECT * FROM test LIMIT :limit';
21:         break;
22: }
23:
$stmt $db->prepare($sql);
24:
$stmt->bindValue('limit'1PDO::PARAM_INT);
25: if(!(
$res $stmt->execute())) var_dump($stmt->errorInfo());
26: if(!(
$res $stmt->execute())) var_dump($stmt->errorInfo());
27:
var_dump($stmt->fetchAll(PDO::FETCH_ASSOC));
28:
?>
29:

Expected

array(1) {
  [0]=>
  array(1) {
    ["id"]=>
    string(1) "1"
  }
}

Output

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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260) in /var/php_gcov/PHP_7_2/ext/pdo_odbc/tests/bug_65946.php on line 25
array(4) {
  [0]=>
  string(5) "42000"
  [1]=>
  int(1064)
  [2]=>
  string(261) "[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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260)"
  [3]=>
  string(5) "42000"
}

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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260) in /var/php_gcov/PHP_7_2/ext/pdo_odbc/tests/bug_65946.php on line 26
array(4) {
  [0]=>
  string(5) "42000"
  [1]=>
  int(1064)
  [2]=>
  string(261) "[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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260)"
  [3]=>
  string(5) "42000"
}
array(0) {
}

Diff

# original source file: ext/pdo/tests/bug_65946.phpt
001+ 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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260) in /var/php_gcov/PHP_7_2/ext/pdo_odbc/tests/bug_65946.php on line 25
002+ array(4) {
001- array(1) {
003-   array(1) {
004-     ["id"]=>
005-     string(1) "1"
006-   }
004+   string(5) "42000"
005+   [1]=>
006+   int(1064)
007+   [2]=>
008+   string(261) "[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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260)"
009+   [3]=>
010+   string(5) "42000"
012+ 
013+ 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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260) in /var/php_gcov/PHP_7_2/ext/pdo_odbc/tests/bug_65946.php on line 26
014+ array(4) {
015+   [0]=>
016+   string(5) "42000"
017+   [1]=>
018+   int(1064)
019+   [2]=>
020+   string(261) "[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 ''1'' at line 1 (SQLExecute[1064] at /var/php_gcov/PHP_7_2/ext/pdo_odbc/odbc_stmt.c:260)"
021+   [3]=>
022+   string(5) "42000"
023+ }
024+ array(0) {
025+ }

 

Generated at Sat, 16 Sep 2017 05:04:10 +0000 (5 days ago)

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