mirror of
https://github.com/php/php-src.git
synced 2024-10-20 16:02:44 +00:00
be0793d2e7
pecl#12794, pecl#12401 # Running the tests: # (Note: Doesn't work currnetly on HEAD, see: # http://news.php.net/php.qa/64378) # # PDO_MYSQL_TEST_DSN - DSN # For example: mysql:dbname=test;host=localhost;port=3306 # # PDO_MYSQL_TEST_HOST - database host # PDO_MYSQL_TEST_DB - database (schema) name # PDO_MYSQL_TEST_SOCKET - database server socket # PDO_MYSQL_TEST_ENGINE - storage engine to use # PDO_MYSQL_TEST_USER - database user # PDO_MYSQL_TEST_PASS - database user password # PDO_MYSQL_TEST_CHARSET - database charset # # NOTE: if any of PDO_MYSQL_TEST_[HOST|DB|SOCKET|ENGINE|CHARSET] is # part of PDO_MYSQL_TEST_DSN, the values must match. That is, for example, # for PDO_MYSQL_TEST_DSN = mysql:dbname=test you MUST set PDO_MYSQL_TEST_DB=test.
60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
--TEST--
|
|
PDO MySQL Bug #33689 (query() execute() and fetch() return false on valid select queries)
|
|
--SKIPIF--
|
|
<?php
|
|
if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
|
|
require dirname(__FILE__) . '/config.inc';
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
|
PDOTest::skip();
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
require dirname(__FILE__) . '/config.inc';
|
|
require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
|
|
$db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
|
|
|
|
$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();
|
|
$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);
|
|
?>
|
|
--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
|
|
)
|
|
|
|
[table] => test
|
|
[name] => bar
|
|
[len] => 11
|
|
[precision] => 0
|
|
)
|