Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: third_party/sqlite/src/ext/fts1/fts1.c

Issue 6823057: Cleanup SQLite 3.6.18 import. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* fts1 has a design flaw which can lead to database corruption (see 1 /* fts1 has a design flaw which can lead to database corruption (see
2 ** below). It is recommended not to use it any longer, instead use 2 ** below). It is recommended not to use it any longer, instead use
3 ** fts3 (or higher). If you believe that your use of fts1 is safe, 3 ** fts3 (or higher). If you believe that your use of fts1 is safe,
4 ** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS. 4 ** add -DSQLITE_ENABLE_BROKEN_FTS1=1 to your CFLAGS.
5 */ 5 */
6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)) \ 6 #if (!defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1)) \
7 && !defined(SQLITE_ENABLE_BROKEN_FTS1) 7 && !defined(SQLITE_ENABLE_BROKEN_FTS1)
8 #error fts1 has a design flaw and has been deprecated. 8 #error fts1 has a design flaw and has been deprecated.
9 #endif 9 #endif
10 /* The flaw is that fts1 uses the content table's unaliased rowid as 10 /* The flaw is that fts1 uses the content table's unaliased rowid as
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 */ 201 */
202 /* TODO(shess) The snippet-generation code should be using the 202 /* TODO(shess) The snippet-generation code should be using the
203 ** tokenizer-generated tokens rather than doing its own local 203 ** tokenizer-generated tokens rather than doing its own local
204 ** tokenization. 204 ** tokenization.
205 */ 205 */
206 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */ 206 /* TODO(shess) Is __isascii() a portable version of (c&0x80)==0? */
207 static int safe_isspace(char c){ 207 static int safe_isspace(char c){
208 return (c&0x80)==0 ? isspace(c) : 0; 208 return (c&0x80)==0 ? isspace(c) : 0;
209 } 209 }
210 static int safe_tolower(char c){ 210 static int safe_tolower(char c){
211 return (c>='A' && c<='Z') ? (c-'A'+'a') : c; 211 return (c&0x80)==0 ? tolower(c) : c;
212 } 212 }
213 static int safe_isalnum(char c){ 213 static int safe_isalnum(char c){
214 return (c&0x80)==0 ? isalnum(c) : 0; 214 return (c&0x80)==0 ? isalnum(c) : 0;
215 } 215 }
216 216
217 typedef enum DocListType { 217 typedef enum DocListType {
218 DL_DOCIDS, /* docids only */ 218 DL_DOCIDS, /* docids only */
219 DL_POSITIONS, /* docids + positions */ 219 DL_POSITIONS, /* docids + positions */
220 DL_POSITIONS_OFFSETS /* docids + positions + offsets */ 220 DL_POSITIONS_OFFSETS /* docids + positions + offsets */
221 } DocListType; 221 } DocListType;
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1218 * statement is going to delete the fulltext_vtab structure. If 1218 * statement is going to delete the fulltext_vtab structure. If
1219 * the statement just executed is in the pFulltextStatements[] 1219 * the statement just executed is in the pFulltextStatements[]
1220 * array, it will be finalized twice. So remove it before 1220 * array, it will be finalized twice. So remove it before
1221 * calling sqlite3_finalize(). 1221 * calling sqlite3_finalize().
1222 */ 1222 */
1223 v->pFulltextStatements[iStmt] = NULL; 1223 v->pFulltextStatements[iStmt] = NULL;
1224 rc = sqlite3_finalize(s); 1224 rc = sqlite3_finalize(s);
1225 break; 1225 break;
1226 } 1226 }
1227 return rc; 1227 return rc;
1228
1229 err:
1230 sqlite3_finalize(s);
1231 return rc;
1228 } 1232 }
1229 1233
1230 /* Like sql_step_statement(), but convert SQLITE_DONE to SQLITE_OK. 1234 /* Like sql_step_statement(), but convert SQLITE_DONE to SQLITE_OK.
1231 ** Useful for statements like UPDATE, where we expect no results. 1235 ** Useful for statements like UPDATE, where we expect no results.
1232 */ 1236 */
1233 static int sql_single_step_statement(fulltext_vtab *v, 1237 static int sql_single_step_statement(fulltext_vtab *v,
1234 fulltext_statement iStmt, 1238 fulltext_statement iStmt,
1235 sqlite3_stmt **ppStmt){ 1239 sqlite3_stmt **ppStmt){
1236 int rc = sql_step_statement(v, iStmt, ppStmt); 1240 int rc = sql_step_statement(v, iStmt, ppStmt);
1237 return (rc==SQLITE_DONE) ? SQLITE_OK : rc; 1241 return (rc==SQLITE_DONE) ? SQLITE_OK : rc;
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after
3332 3336
3333 #if !SQLITE_CORE 3337 #if !SQLITE_CORE
3334 int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg, 3338 int sqlite3_extension_init(sqlite3 *db, char **pzErrMsg,
3335 const sqlite3_api_routines *pApi){ 3339 const sqlite3_api_routines *pApi){
3336 SQLITE_EXTENSION_INIT2(pApi) 3340 SQLITE_EXTENSION_INIT2(pApi)
3337 return sqlite3Fts1Init(db); 3341 return sqlite3Fts1Init(db);
3338 } 3342 }
3339 #endif 3343 #endif
3340 3344
3341 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */ 3345 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS1) */
OLDNEW
« no previous file with comments | « third_party/sqlite/src/doc/report1.txt ('k') | third_party/sqlite/src/ext/fts1/fts1_tokenizer1.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698