2005-07-14 02:21:03 +00:00
|
|
|
--TEST--
|
2007-05-07 18:03:01 +00:00
|
|
|
PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries)
|
2005-07-14 02:21:03 +00:00
|
|
|
--SKIPIF--
|
2005-08-11 23:45:22 +00:00
|
|
|
<?php
|
|
|
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
|
2005-10-18 00:06:20 +00:00
|
|
|
require dirname(__FILE__) . '/config.inc';
|
|
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
2005-08-11 23:45:22 +00:00
|
|
|
PDOTest::skip();
|
2005-07-14 02:21:03 +00:00
|
|
|
?>
|
|
|
|
--FILE--
|
|
|
|
<?php
|
2006-07-31 20:14:40 +00:00
|
|
|
require dirname(__FILE__) . '/config.inc';
|
2005-10-18 00:06:20 +00:00
|
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
|
|
|
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
2005-07-14 02:21:03 +00:00
|
|
|
|
|
|
|
$db->exec('CREATE TABLE test (bar INT NOT NULL)');
|
|
|
|
$db->exec('INSERT INTO test VALUES(1)');
|
|
|
|
|
|
|
|
var_dump($db->query('SELECT * from test'));
|
|
|
|
foreach ($db->query('SELECT * from test') as $row) {
|
|
|
|
print_r($row);
|
|
|
|
}
|
|
|
|
|
|
|
|
$stmt = $db->prepare('SELECT * from test');
|
|
|
|
print_r($stmt->getColumnMeta(0));
|
|
|
|
$stmt->execute();
|
2008-07-21 13:09:28 +00:00
|
|
|
$tmp = $stmt->getColumnMeta(0);
|
|
|
|
|
|
|
|
// libmysql and mysqlnd will show the pdo_type entry at a different position in the hash
|
|
|
|
if (!isset($tmp['pdo_type']) || (isset($tmp['pdo_type']) && $tmp['pdo_type'] != 2))
|
|
|
|
printf("Expecting pdo_type = 2 got %s\n", $tmp['pdo_type']);
|
|
|
|
else
|
|
|
|
unset($tmp['pdo_type']);
|
|
|
|
|
|
|
|
print_r($tmp);
|
2007-05-18 11:47:58 +00:00
|
|
|
?>
|
2005-07-14 02:21:03 +00:00
|
|
|
--EXPECTF--
|
|
|
|
object(PDOStatement)#%d (1) {
|
|
|
|
["queryString"]=>
|
|
|
|
string(18) "SELECT * from test"
|
|
|
|
}
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[bar] => 1
|
|
|
|
[0] => 1
|
|
|
|
)
|
|
|
|
Array
|
|
|
|
(
|
|
|
|
[native_type] => LONG
|
|
|
|
[flags] => Array
|
|
|
|
(
|
|
|
|
[0] => not_null
|
|
|
|
)
|
|
|
|
|
2007-05-18 11:47:58 +00:00
|
|
|
[table] => test
|
2005-07-14 02:21:03 +00:00
|
|
|
[name] => bar
|
|
|
|
[len] => 11
|
|
|
|
[precision] => 0
|
|
|
|
)
|