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