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