1
0
mirror of https://github.com/php/php-src.git synced 2026-04-24 00:18:23 +02:00
Files
archived-php-src/ext/pdo_sqlite/tests/bug79664.phpt
T
Christoph M. Becker 63bd8f38f4 Fix #79664: PDOStatement::getColumnMeta fails on empty result set
As its name suggests, `sqlite3_data_count` returns the number of
columns in the current row of the result set; we are interested in the
number of columns regardless of the current row, so we have to use
`sqlite3_column_count` instead.
2020-06-02 10:45:47 +02:00

33 lines
590 B
PHP

--TEST--
Bug #79664 (PDOStatement::getColumnMeta fails on empty result set)
--SKIPIF--
<?php
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
?>
--FILE--
<?php
$pdo = new PDO('sqlite::memory:', null, null, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
]);
$stmt = $pdo->query('select 1 where 0');
if ($stmt->columnCount()) {
var_dump($stmt->getColumnMeta(0));
}
?>
--EXPECT--
array(6) {
["native_type"]=>
string(4) "null"
["flags"]=>
array(0) {
}
["name"]=>
string(1) "1"
["len"]=>
int(4294967295)
["precision"]=>
int(0)
["pdo_type"]=>
int(2)
}