Edit report at https://bugs.php.net/bug.php?id=55226&edit=1
ID: 55226 Comment by: macdewar at gmail dot com Reported by: damien at commerceguys dot com Summary: Support creating collations in SQLite Status: Open Type: Feature/Change Request Package: SQLite related PHP Version: 5.4SVN-2011-07-18 (SVN) Block user comment: N Private report: N New Comment: Request #60871 is related. It adds the same functionality to the SQLite3 class (not PDO). Previous Comments: ------------------------------------------------------------------------ [2011-07-18 06:14:22] damien at commerceguys dot com Description: ------------ As with many other things, SQLite have very limited support for collations and relies on the host application to implement anything non trivial [1]. For example, an Unicode collations (like accent insensitive collations, for example) will have to be implemented in the application. I would like to add a PDO_sqlite::sqliteCreateCollation() using the same technique as PDO_sqlite::sqliteCreateFunction() and PDO_sqlite::sqliteCreateAggregate(): allow the application to register a PHP callback as a new collation. [1] http://www.sqlite.org/faq.html#q18 Test script: --------------- $db = new pdo('sqlite::memory:'); $db->sqliteCreateCollation('MYCOLLATE', function($a, $b) { return strnatcmp($a, $b); }); // This will return results in the natural order ("P1", "P2", "P10"). $result = $db->query('SELECT name FROM foobar ORDER BY name COLLATE MYCOLLATE'); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=55226&edit=1
