bug_33689.phpt 1.5 KB

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