/ Check-in [ab89b047]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Removed the unused "type" field from the CollSeq (collating sequence) object.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ab89b047e82efdf59ed91a38b5195341a3743cbf
User & Date: drh 2011-11-29 14:46:56
Context
2011-11-29
15:04
Remove unused boolean fields from the UnpackedRecord object. check-in: b10d091e user: drh tags: trunk
14:46
Removed the unused "type" field from the CollSeq (collating sequence) object. check-in: ab89b047 user: drh tags: trunk
2011-11-25
21:51
Update the version number to 3.7.10. check-in: ed0151ba user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

  1651   1651   ** Create a new collating function for database "db".  The name is zName
  1652   1652   ** and the encoding is enc.
  1653   1653   */
  1654   1654   static int createCollation(
  1655   1655     sqlite3* db,
  1656   1656     const char *zName, 
  1657   1657     u8 enc,
  1658         -  u8 collType,
  1659   1658     void* pCtx,
  1660   1659     int(*xCompare)(void*,int,const void*,int,const void*),
  1661   1660     void(*xDel)(void*)
  1662   1661   ){
  1663   1662     CollSeq *pColl;
  1664   1663     int enc2;
  1665   1664     int nName = sqlite3Strlen30(zName);
................................................................................
  1716   1715   
  1717   1716     pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1);
  1718   1717     if( pColl==0 ) return SQLITE_NOMEM;
  1719   1718     pColl->xCmp = xCompare;
  1720   1719     pColl->pUser = pCtx;
  1721   1720     pColl->xDel = xDel;
  1722   1721     pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED));
  1723         -  pColl->type = collType;
  1724   1722     sqlite3Error(db, SQLITE_OK, 0);
  1725   1723     return SQLITE_OK;
  1726   1724   }
  1727   1725   
  1728   1726   
  1729   1727   /*
  1730   1728   ** This array defines hard upper bounds on limit values.  The
................................................................................
  2177   2175     sqlite3HashInit(&db->aModule);
  2178   2176   #endif
  2179   2177   
  2180   2178     /* Add the default collation sequence BINARY. BINARY works for both UTF-8
  2181   2179     ** and UTF-16, so add a version for each to avoid any unnecessary
  2182   2180     ** conversions. The only error that can occur here is a malloc() failure.
  2183   2181     */
  2184         -  createCollation(db, "BINARY", SQLITE_UTF8, SQLITE_COLL_BINARY, 0,
  2185         -                  binCollFunc, 0);
  2186         -  createCollation(db, "BINARY", SQLITE_UTF16BE, SQLITE_COLL_BINARY, 0,
  2187         -                  binCollFunc, 0);
  2188         -  createCollation(db, "BINARY", SQLITE_UTF16LE, SQLITE_COLL_BINARY, 0,
  2189         -                  binCollFunc, 0);
  2190         -  createCollation(db, "RTRIM", SQLITE_UTF8, SQLITE_COLL_USER, (void*)1,
  2191         -                  binCollFunc, 0);
         2182  +  createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0);
         2183  +  createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0);
         2184  +  createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0);
         2185  +  createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0);
  2192   2186     if( db->mallocFailed ){
  2193   2187       goto opendb_out;
  2194   2188     }
  2195   2189     db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0);
  2196   2190     assert( db->pDfltColl!=0 );
  2197   2191   
  2198   2192     /* Also add a UTF-8 case-insensitive collation sequence. */
  2199         -  createCollation(db, "NOCASE", SQLITE_UTF8, SQLITE_COLL_NOCASE, 0,
  2200         -                  nocaseCollatingFunc, 0);
         2193  +  createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0);
  2201   2194   
  2202   2195     /* Parse the filename/URI argument. */
  2203   2196     db->openFlags = flags;
  2204   2197     rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
  2205   2198     if( rc!=SQLITE_OK ){
  2206   2199       if( rc==SQLITE_NOMEM ) db->mallocFailed = 1;
  2207   2200       sqlite3Error(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
................................................................................
  2386   2379     int enc, 
  2387   2380     void* pCtx,
  2388   2381     int(*xCompare)(void*,int,const void*,int,const void*)
  2389   2382   ){
  2390   2383     int rc;
  2391   2384     sqlite3_mutex_enter(db->mutex);
  2392   2385     assert( !db->mallocFailed );
  2393         -  rc = createCollation(db, zName, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
         2386  +  rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, 0);
  2394   2387     rc = sqlite3ApiExit(db, rc);
  2395   2388     sqlite3_mutex_leave(db->mutex);
  2396   2389     return rc;
  2397   2390   }
  2398   2391   
  2399   2392   /*
  2400   2393   ** Register a new collation sequence with the database handle db.
................................................................................
  2406   2399     void* pCtx,
  2407   2400     int(*xCompare)(void*,int,const void*,int,const void*),
  2408   2401     void(*xDel)(void*)
  2409   2402   ){
  2410   2403     int rc;
  2411   2404     sqlite3_mutex_enter(db->mutex);
  2412   2405     assert( !db->mallocFailed );
  2413         -  rc = createCollation(db, zName, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, xDel);
         2406  +  rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel);
  2414   2407     rc = sqlite3ApiExit(db, rc);
  2415   2408     sqlite3_mutex_leave(db->mutex);
  2416   2409     return rc;
  2417   2410   }
  2418   2411   
  2419   2412   #ifndef SQLITE_OMIT_UTF16
  2420   2413   /*
................................................................................
  2429   2422   ){
  2430   2423     int rc = SQLITE_OK;
  2431   2424     char *zName8;
  2432   2425     sqlite3_mutex_enter(db->mutex);
  2433   2426     assert( !db->mallocFailed );
  2434   2427     zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE);
  2435   2428     if( zName8 ){
  2436         -    rc = createCollation(db, zName8, (u8)enc, SQLITE_COLL_USER, pCtx, xCompare, 0);
         2429  +    rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0);
  2437   2430       sqlite3DbFree(db, zName8);
  2438   2431     }
  2439   2432     rc = sqlite3ApiExit(db, rc);
  2440   2433     sqlite3_mutex_leave(db->mutex);
  2441   2434     return rc;
  2442   2435   }
  2443   2436   #endif /* SQLITE_OMIT_UTF16 */

Changes to src/sqliteInt.h.

  1140   1140   ** If both CollSeq.xCmp and CollSeq.xCmp16 are NULL, it means that the
  1141   1141   ** collating sequence is undefined.  Indices built on an undefined
  1142   1142   ** collating sequence may not be read or written.
  1143   1143   */
  1144   1144   struct CollSeq {
  1145   1145     char *zName;          /* Name of the collating sequence, UTF-8 encoded */
  1146   1146     u8 enc;               /* Text encoding handled by xCmp() */
  1147         -  u8 type;              /* One of the SQLITE_COLL_... values below */
  1148   1147     void *pUser;          /* First argument to xCmp() */
  1149   1148     int (*xCmp)(void*,int, const void*, int, const void*);
  1150   1149     void (*xDel)(void*);  /* Destructor for pUser */
  1151   1150   };
  1152   1151   
  1153         -/*
  1154         -** Allowed values of CollSeq.type:
  1155         -*/
  1156         -#define SQLITE_COLL_BINARY  1  /* The default memcmp() collating sequence */
  1157         -#define SQLITE_COLL_NOCASE  2  /* The built-in NOCASE collating sequence */
  1158         -#define SQLITE_COLL_REVERSE 3  /* The built-in REVERSE collating sequence */
  1159         -#define SQLITE_COLL_USER    0  /* Any other user-defined collating sequence */
  1160         -
  1161   1152   /*
  1162   1153   ** A sort order can be either ASC or DESC.
  1163   1154   */
  1164   1155   #define SQLITE_SO_ASC       0  /* Sort in ascending order */
  1165   1156   #define SQLITE_SO_DESC      1  /* Sort in ascending order */
  1166   1157   
  1167   1158   /*