xref: /PHP-8.3/ext/pdo_sqlite/tests/bug79664.phpt (revision 74859783)
1--TEST--
2Bug #79664 (PDOStatement::getColumnMeta fails on empty result set)
3--EXTENSIONS--
4pdo_sqlite
5--FILE--
6<?php
7$pdo = new PDO('sqlite::memory:', null, null, [
8	PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
9]);
10$stmt = $pdo->query('select 1 where 0');
11if ($stmt->columnCount()) {
12    var_dump($stmt->getColumnMeta(0));
13}
14?>
15--EXPECT--
16array(6) {
17  ["native_type"]=>
18  string(4) "null"
19  ["pdo_type"]=>
20  int(0)
21  ["flags"]=>
22  array(0) {
23  }
24  ["name"]=>
25  string(1) "1"
26  ["len"]=>
27  int(-1)
28  ["precision"]=>
29  int(0)
30}
31