-
Notifications
You must be signed in to change notification settings - Fork 8k
Expand file tree
/
Copy pathpdosqlite_002.phpt
More file actions
38 lines (33 loc) · 866 Bytes
/
pdosqlite_002.phpt
File metadata and controls
38 lines (33 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--TEST--
Pdo\Sqlite create through PDO::connect and function define.
--EXTENSIONS--
pdo_sqlite
--FILE--
<?php
$db = Pdo::connect('sqlite::memory:');
if (!$db instanceof Pdo\Sqlite) {
echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n";
}
$db->query('CREATE TABLE pdosqlite_002 (id INT AUTO INCREMENT, name TEXT)');
$db->query("INSERT INTO pdosqlite_002 VALUES (NULL, 'PHP')");
$db->query("INSERT INTO pdosqlite_002 VALUES (NULL, 'PHP6')");
$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC);
foreach ($db->query('SELECT testing(name) FROM pdosqlite_002') as $row) {
var_dump($row);
}
echo "Fin.";
?>
--EXPECT--
array(2) {
["testing(name)"]=>
string(3) "php"
[0]=>
string(3) "php"
}
array(2) {
["testing(name)"]=>
string(4) "php6"
[0]=>
string(4) "php6"
}
Fin.