Req #55226 [Opn->Csd]: Support creating collations in SQLite
| From: | rasmus@php.net | Date: | Sun, 29 Jan 2012 05:46:55 +0000 |
| Subject: | Req #55226 [Opn->Csd]: Support creating collations in SQLite | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-166915@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=55226&edit=1
ID: 55226
Updated by: rasmus@php.net
Reported by: damien at commerceguys dot com
Summary: Support creating collations in SQLite
-Status: Open
+Status: Closed
Type: Feature/Change Request
Package: SQLite related
PHP Version: 5.4SVN-2011-07-18 (SVN)
-Assigned To:
+Assigned To: rasmus
Block user comment: N
Private report: N
New Comment:
Patch applied, thanks.
Previous Comments:
------------------------------------------------------------------------
[2012-01-29 04:22:21] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=322916
Log: createCollation() for pdo_sqlite as well
Closes bug #55226
------------------------------------------------------------------------
[2012-01-29 03:57:28] rasmus@php.net
Automatic comment from SVN on behalf of rasmus
Revision: http://svn.php.net/viewvc/?view=revision&revision=322913
Log: Good patch from Brad Dewar that adds missing createCollation()
method. Fixes bug #60871 and is related to bug #55226
------------------------------------------------------------------------
[2012-01-24 19:18:04] macdewar at gmail dot com
Request #60871 is related. It adds the same functionality to the SQLite3 class (not PDO).
------------------------------------------------------------------------
[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