1--TEST--
2PDO_sqlite: Testing sqliteCreateFunction()
3--SKIPIF--
4<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
5--FILE--
6<?php
7
8$db = new pdo('sqlite::memory:');
9
10$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)');
11
12$db->query('INSERT INTO foobar VALUES (NULL, "PHP")');
13$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")');
14
15
16$db->sqliteCreateFunction('testing', function($v) { return strtolower($v); });
17
18
19foreach ($db->query('SELECT testing(name) FROM foobar') as $row) {
20	var_dump($row);
21}
22
23$db->query('DROP TABLE foobar');
24
25?>
26--EXPECTF--
27array(2) {
28  ["testing(name)"]=>
29  %string|unicode%(3) "php"
30  [0]=>
31  %string|unicode%(3) "php"
32}
33array(2) {
34  ["testing(name)"]=>
35  %string|unicode%(4) "php6"
36  [0]=>
37  %string|unicode%(4) "php6"
38}
39