mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
- Add test
This commit is contained in:
parent
6045a3a5e1
commit
96e8cca9bc
1 changed files with 35 additions and 0 deletions
35
ext/pdo_sqlite/tests/pdo_sqlite_008.phpt
Executable file
35
ext/pdo_sqlite/tests/pdo_sqlite_008.phpt
Executable file
|
@ -0,0 +1,35 @@
|
|||
--TEST--
|
||||
PDO-SQLite: PDO_FETCH_UNIQUE conflict
|
||||
--SKIPIF--
|
||||
<?php # vim:ft=php
|
||||
if (!extension_loaded("pdo_sqlite")) print "skip"; ?>
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$db =new pdo('sqlite::memory:');
|
||||
|
||||
$db->exec('CREATE TABLE test(id CHAR(1) PRIMARY KEY, val VARCHAR(10))');
|
||||
$db->exec('INSERT INTO test VALUES("A", "A")');
|
||||
$db->exec('INSERT INTO test VALUES("B", "A")');
|
||||
$db->exec('INSERT INTO test VALUES("C", "C")');
|
||||
|
||||
var_dump($db->query('SELECT val, id FROM test')->fetchAll(PDO_FETCH_NUM|PDO_FETCH_UNIQUE));
|
||||
// check that repeated first columns overwrite existing array elements
|
||||
|
||||
?>
|
||||
===DONE===
|
||||
<?php exit(0); ?>
|
||||
--EXPECTF--
|
||||
array(2) {
|
||||
["A"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "B"
|
||||
}
|
||||
["C"]=>
|
||||
array(1) {
|
||||
[0]=>
|
||||
string(1) "C"
|
||||
}
|
||||
}
|
||||
===DONE===
|
Loading…
Add table
Add a link
Reference in a new issue