php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #55226 Support creating collations in SQLite
Submitted: 2011-07-18 06:14 UTC Modified: 2012-01-29 05:46 UTC
Votes:4
Avg. Score:3.2 ± 1.5
Reproduced:2 of 3 (66.7%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: damien at commerceguys dot com Assigned: rasmus (profile)
Status: Closed Package: SQLite related
PHP Version: 5.4SVN-2011-07-18 (SVN) OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: damien at commerceguys dot com
New email:
PHP Version: OS:

 

 [2011-07-18 06:14 UTC] 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');



Patches

pdo-sqlite-create-collation.patch (last revision 2011-07-18 10:14 UTC by damien at commerceguys dot com)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-01-24 19:18 UTC] macdewar at gmail dot com
Request #60871 is related.  It adds the same functionality to the SQLite3 class (not PDO).
 [2012-01-29 03:57 UTC] 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-29 04:22 UTC] 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 05:46 UTC] rasmus@php.net
Patch applied, thanks.
 [2012-01-29 05:46 UTC] rasmus@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: rasmus
 [2012-01-31 07:14 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=322961
Log: - fix #55226, fix build
 [2012-01-31 07:17 UTC] pajoye@php.net
Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revision&revision=322962
Log: - fix #55226, WS
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=88b00ff6dfbe1b08b39f0ae3ce9d6405c7d3d78c
Log: - fix #55226, WS
 [2012-04-18 09:46 UTC] laruence@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=601f05f1b8e4b3595bf05a5c1ce81996a08afad0
Log: - fix #55226, fix build
 [2012-07-24 23:37 UTC] rasmus@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=88b00ff6dfbe1b08b39f0ae3ce9d6405c7d3d78c
Log: - fix #55226, WS
 [2012-07-24 23:37 UTC] rasmus@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=601f05f1b8e4b3595bf05a5c1ce81996a08afad0
Log: - fix #55226, fix build
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=88b00ff6dfbe1b08b39f0ae3ce9d6405c7d3d78c
Log: - fix #55226, WS
 [2013-11-17 09:34 UTC] laruence@php.net
Automatic comment on behalf of pajoye
Revision: http://git.php.net/?p=php-src.git;a=commit;h=601f05f1b8e4b3595bf05a5c1ce81996a08afad0
Log: - fix #55226, fix build
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Apr 29 18:01:28 2025 UTC