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 test_pdo_sqlite_createfunction_with_flags (id INT AUTO INCREMENT, name TEXT)');
15
16$db->query('INSERT INTO test_pdo_sqlite_createfunction_with_flags VALUES (NULL, "PHP"), (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 test_pdo_sqlite_createfunction_with_flags') as $row) {
23    var_dump($row);
24}
25
26?>
27--EXPECT--
28array(2) {
29  ["testing(name)"]=>
30  string(3) "php"
31  [0]=>
32  string(3) "php"
33}
34array(2) {
35  ["testing(name)"]=>
36  string(4) "php6"
37  [0]=>
38  string(4) "php6"
39}
40