1--TEST--
2SQLite3 - rename column while SQLite3Result is open
3--EXTENSIONS--
4sqlite3
5--SKIPIF--
6<?php
7if (SQLite3::version()['versionNumber'] < 3025000) {
8    die("skip: sqlite3 library version < 3.25: no support for rename column");
9}
10?>
11--FILE--
12<?php
13
14$db = new SQLite3(':memory:');
15
16$db->exec('CREATE TABLE tbl (orig text)');
17$db->exec('insert into tbl values ("one"), ("two")');
18
19$res1 = $db->prepare('select * from tbl')->execute();
20$res2 = $db->prepare('select * from tbl')->execute();
21
22var_dump(array_key_first($res1->fetchArray(SQLITE3_ASSOC)));
23var_dump(array_key_first($res2->fetchArray(SQLITE3_ASSOC)));
24
25$db->exec('alter table tbl rename column orig to changed');
26
27$res1->reset();
28var_dump(array_key_first($res1->fetchArray(SQLITE3_ASSOC)));
29var_dump(array_key_first($res2->fetchArray(SQLITE3_ASSOC)));
30
31?>
32--EXPECT--
33string(4) "orig"
34string(4) "orig"
35string(7) "changed"
36string(4) "orig"
37