1--TEST--
2PDO_sqlite: Testing createFunction() 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// This test was copied from the pdo_sqlite test for sqliteCreateCollation
12$db = new Pdo\Sqlite('sqlite::memory:');
13$db->query('CREATE TABLE test_pdo_sqlite_createfunction_with_flags (id INT AUTO INCREMENT, name TEXT)');
14$db->query('INSERT INTO test_pdo_sqlite_createfunction_with_flags VALUES (NULL, "PHP"), (NULL, "PHP6")');
15
16$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC);
17
18foreach ($db->query('SELECT testing(name) FROM test_pdo_sqlite_createfunction_with_flags') as $row) {
19    var_dump($row);
20}
21
22?>
23--EXPECT--
24array(2) {
25  ["testing(name)"]=>
26  string(3) "php"
27  [0]=>
28  string(3) "php"
29}
30array(2) {
31  ["testing(name)"]=>
32  string(4) "php6"
33  [0]=>
34  string(4) "php6"
35}
36