1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Always register BINARY collating sequences for UTF-16BE and UTF-16LE both.

Formerly we were only registering the native byte order by default.
Ticket #1654.  Note:  There may still be problems with collating sequence
synthesis. (CVS 3053)

FossilOrigin-Name: 3861377bd93453161dfe78a8c1d7a9f919108c8f
This commit is contained in:
drh
2006-02-01 13:50:41 +00:00
parent 570b935c2a
commit 0e819f9032
3 changed files with 15 additions and 10 deletions

View File

@@ -14,7 +14,7 @@
** other files are for internal use by SQLite and should not be
** accessed by users of the library.
**
** $Id: main.c,v 1.332 2006/01/31 19:31:44 drh Exp $
** $Id: main.c,v 1.333 2006/02/01 13:50:42 drh Exp $
*/
#include "sqliteInt.h"
#include "os.h"
@@ -731,6 +731,10 @@ int sqlite3_errcode(sqlite3 *db){
return db->errCode;
}
/*
** Create a new collating function for database "db". The name is zName
** and the encoding is enc.
*/
static int createCollation(
sqlite3* db,
const char *zName,
@@ -816,8 +820,9 @@ static int openDatabase(
** and UTF-16, so add a version for each to avoid any unnecessary
** conversions. The only error that can occur here is a malloc() failure.
*/
if( createCollation(db, "BINARY", SQLITE_UTF8, 0,binCollFunc) ||
createCollation(db, "BINARY", SQLITE_UTF16, 0,binCollFunc) ||
if( createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc) ||
createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc) ||
createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc) ||
(db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 6, 0))==0
){
assert( sqlite3MallocFailed() );