bug_33689.phpt 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. --TEST--
  2. PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries)
  3. --EXTENSIONS--
  4. pdo
  5. pdo_mysql
  6. --SKIPIF--
  7. <?php
  8. require __DIR__ . '/config.inc';
  9. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  10. PDOTest::skip();
  11. ?>
  12. --FILE--
  13. <?php
  14. require __DIR__ . '/config.inc';
  15. require __DIR__ . '/../../../ext/pdo/tests/pdo_test.inc';
  16. $db = PDOTest::test_factory(__DIR__ . '/common.phpt');
  17. $db->exec('CREATE TABLE test (bar INT NOT NULL)');
  18. $db->exec('INSERT INTO test VALUES(1)');
  19. var_dump($db->query('SELECT * from test'));
  20. foreach ($db->query('SELECT * from test') as $row) {
  21. print_r($row);
  22. }
  23. $stmt = $db->prepare('SELECT * from test');
  24. print_r($stmt->getColumnMeta(0));
  25. $stmt->execute();
  26. $tmp = $stmt->getColumnMeta(0);
  27. // libmysql and mysqlnd will show the pdo_type entry at a different position in the hash
  28. // and will report a different type, as mysqlnd returns native types.
  29. if (!isset($tmp['pdo_type']) || ($tmp['pdo_type'] != 1 && $tmp['pdo_type'] != 2))
  30. printf("Expecting pdo_type = 1 got %s\n", $tmp['pdo_type']);
  31. else
  32. unset($tmp['pdo_type']);
  33. print_r($tmp);
  34. ?>
  35. --CLEAN--
  36. <?php
  37. require __DIR__ . '/mysql_pdo_test.inc';
  38. MySQLPDOTest::dropTestTable();
  39. ?>
  40. --EXPECTF--
  41. object(PDOStatement)#%d (1) {
  42. ["queryString"]=>
  43. string(18) "SELECT * from test"
  44. }
  45. Array
  46. (
  47. [bar] => 1
  48. [0] => 1
  49. )
  50. Array
  51. (
  52. [native_type] => LONG
  53. [flags] => Array
  54. (
  55. [0] => not_null
  56. )
  57. [table] => test
  58. [name] => bar
  59. [len] => 11
  60. [precision] => 0
  61. )