diff options
author | drh <drh@noemail.net> | 2005-08-28 17:00:23 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2005-08-28 17:00:23 +0000 |
commit | d64fe2f374f7a278bff67df9968f939b60faa222 (patch) | |
tree | 33eb0e4d64571066d5f3b49b5955b714c5292f3e /src/main.c | |
parent | bfd6b03554bcc82881c433c0572c4ebe9a81798a (diff) | |
download | sqlite-d64fe2f374f7a278bff67df9968f939b60faa222.tar.gz sqlite-d64fe2f374f7a278bff67df9968f939b60faa222.zip |
The LIKE optimization does the right thing when collating sequences are
present. LIKE expressions where the left-hand side has COLLATE NOCASE
are optimized in the default case. (CVS 2637)
FossilOrigin-Name: ef84ff795c85e9d28f1cac84ff42d8d4ef84cfc4
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c index a84f94f49..41d1045fc 100644 --- a/src/main.c +++ b/src/main.c @@ -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.298 2005/08/14 01:20:39 drh Exp $ +** $Id: main.c,v 1.299 2005/08/28 17:00:23 drh Exp $ */ #include "sqliteInt.h" #include "os.h" @@ -694,6 +694,7 @@ static int openDatabase( ){ sqlite3 *db; int rc, i; + CollSeq *pColl; /* Allocate the sqlite data structure */ db = sqliteMalloc( sizeof(sqlite3) ); @@ -730,6 +731,13 @@ static int openDatabase( /* Also add a UTF-8 case-insensitive collation sequence. */ sqlite3_create_collation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc); + /* Set flags on the built-in collating sequences */ + db->pDfltColl->type = SQLITE_COLL_BINARY; + pColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "NOCASE", 6, 0); + if( pColl ){ + pColl->type = SQLITE_COLL_NOCASE; + } + /* Open the backend database driver */ rc = sqlite3BtreeFactory(db, zFilename, 0, MAX_PAGES, &db->aDb[0].pBt); if( rc!=SQLITE_OK ){ @@ -901,7 +909,7 @@ int sqlite3_create_collation( pColl = sqlite3FindCollSeq(db, (u8)enc, zName, strlen(zName), 1); if( 0==pColl ){ - rc = SQLITE_NOMEM; + rc = SQLITE_NOMEM; }else{ pColl->xCmp = xCompare; pColl->pUser = pCtx; |