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