Edit report at https://bugs.php.net/bug.php?id=55226&edit=1

 ID:                 55226
 Updated by:         ras...@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] ras...@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] ras...@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

Reply via email to