1--TEST-- 2PDO_sqlite: Testing sqliteCreateCollation() 3--EXTENSIONS-- 4pdo_sqlite 5--FILE-- 6<?php 7 8// This test was copied from the pdo_sqlite test for sqliteCreateCollation 9$db = new Pdo\Sqlite('sqlite::memory:'); 10$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 11 12$db->query('CREATE TABLE test_pdo_sqlite_createcollation (id INT AUTO INCREMENT, name TEXT)'); 13 14$db->query('INSERT INTO test_pdo_sqlite_createcollation VALUES (NULL, "1"), (NULL, "2"), (NULL, "10")'); 15 16$db->createCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); }); 17 18$result = $db->query('SELECT name FROM test_pdo_sqlite_createcollation ORDER BY name COLLATE MYCOLLATE'); 19foreach ($result as $row) { 20 echo $row['name'] . "\n"; 21} 22 23$result = $db->query('SELECT name FROM test_pdo_sqlite_createcollation ORDER BY name'); 24foreach ($result as $row) { 25 echo $row['name'] . "\n"; 26} 27 28?> 29--EXPECT-- 301 312 3210 331 3410 352 36