1--TEST-- 2Pdo\Sqlite create through PDO::connect and function define. 3--EXTENSIONS-- 4pdo_sqlite 5--FILE-- 6<?php 7 8$db = Pdo::connect('sqlite::memory:'); 9if (!$db instanceof Pdo\Sqlite) { 10 echo "Wrong class type. Should be Pdo\Sqlite but is " . get_class($db) . "\n"; 11} 12 13$db->query('CREATE TABLE pdosqlite_002 (id INT AUTO INCREMENT, name TEXT)'); 14$db->query('INSERT INTO pdosqlite_002 VALUES (NULL, "PHP")'); 15$db->query('INSERT INTO pdosqlite_002 VALUES (NULL, "PHP6")'); 16 17$db->createFunction('testing', function($v) { return strtolower($v); }, 1, Pdo\Sqlite::DETERMINISTIC); 18 19foreach ($db->query('SELECT testing(name) FROM pdosqlite_002') as $row) { 20 var_dump($row); 21} 22 23echo "Fin."; 24?> 25--EXPECT-- 26array(2) { 27 ["testing(name)"]=> 28 string(3) "php" 29 [0]=> 30 string(3) "php" 31} 32array(2) { 33 ["testing(name)"]=> 34 string(4) "php6" 35 [0]=> 36 string(4) "php6" 37} 38Fin. 39