diff options
author | drh <drh@noemail.net> | 2009-08-20 02:34:15 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2009-08-20 02:34:15 +0000 |
commit | 9aeda79cf6ebb912d6979e0f9190fec2c9b6c998 (patch) | |
tree | 2547751240c143538f74a05f4cce8f03ec5d76e9 /src/callback.c | |
parent | 3995c26d1608460ddd472d0121c415c57303d168 (diff) | |
download | sqlite-9aeda79cf6ebb912d6979e0f9190fec2c9b6c998.tar.gz sqlite-9aeda79cf6ebb912d6979e0f9190fec2c9b6c998.zip |
All the sqlite3GetCollSeq() function to specify an arbitrary text encoding.
FossilOrigin-Name: 4ee44322ca3c92ed8d6f5d4a3f89d219bf379595
Diffstat (limited to 'src/callback.c')
-rw-r--r-- | src/callback.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/callback.c b/src/callback.c index fd4749826..0d4f9dd15 100644 --- a/src/callback.c +++ b/src/callback.c @@ -20,15 +20,14 @@ /* ** Invoke the 'collation needed' callback to request a collation sequence -** in the database text encoding of name zName, length nName. -** If the collation sequence +** in the encoding enc of name zName, length nName. */ -static void callCollNeeded(sqlite3 *db, const char *zName){ +static void callCollNeeded(sqlite3 *db, int enc, const char *zName){ assert( !db->xCollNeeded || !db->xCollNeeded16 ); if( db->xCollNeeded ){ char *zExternal = sqlite3DbStrDup(db, zName); if( !zExternal ) return; - db->xCollNeeded(db->pCollNeededArg, db, (int)ENC(db), zExternal); + db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal); sqlite3DbFree(db, zExternal); } #ifndef SQLITE_OMIT_UTF16 @@ -71,8 +70,7 @@ static int synthCollSeq(sqlite3 *db, CollSeq *pColl){ /* ** This function is responsible for invoking the collation factory callback ** or substituting a collation sequence of a different encoding when the -** requested collation sequence is not available in the database native -** encoding. +** requested collation sequence is not available in the desired encoding. ** ** If it is not NULL, then pColl must point to the database native encoding ** collation sequence with name zName, length nName. @@ -85,6 +83,7 @@ static int synthCollSeq(sqlite3 *db, CollSeq *pColl){ */ CollSeq *sqlite3GetCollSeq( sqlite3* db, /* The database connection */ + int enc, /* The desired encoding for the collating sequence */ CollSeq *pColl, /* Collating sequence with native encoding, or NULL */ const char *zName /* Collating sequence name */ ){ @@ -92,14 +91,14 @@ CollSeq *sqlite3GetCollSeq( p = pColl; if( !p ){ - p = sqlite3FindCollSeq(db, ENC(db), zName, 0); + p = sqlite3FindCollSeq(db, enc, zName, 0); } if( !p || !p->xCmp ){ /* No collation sequence of this type for this encoding is registered. ** Call the collation factory to see if it can supply us with one. */ - callCollNeeded(db, zName); - p = sqlite3FindCollSeq(db, ENC(db), zName, 0); + callCollNeeded(db, enc, zName); + p = sqlite3FindCollSeq(db, enc, zName, 0); } if( p && !p->xCmp && synthCollSeq(db, p) ){ p = 0; @@ -122,7 +121,8 @@ CollSeq *sqlite3GetCollSeq( int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){ if( pColl ){ const char *zName = pColl->zName; - CollSeq *p = sqlite3GetCollSeq(pParse->db, pColl, zName); + sqlite3 *db = pParse->db; + CollSeq *p = sqlite3GetCollSeq(db, ENC(db), pColl, zName); if( !p ){ sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); pParse->nErr++; |