Fossil SCM

Update SQLite to the latest 3.7.17 preview from upstream, for the purpose of testing SQLite.

drh 2013-05-08 18:34 trunk
Commit 21a6a8bc0031b565bd65956143c89c12448ec091
3 files changed +11 -13 +97 -38 +1 -1
+11 -13
--- src/shell.c
+++ src/shell.c
@@ -2276,12 +2276,11 @@
22762276
" (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
22772277
" FROM sqlite_master UNION ALL"
22782278
" SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
22792279
"WHERE lower(tbl_name) LIKE shellstatic()"
22802280
" AND type!='meta' AND sql NOTNULL "
2281
- "ORDER BY substr(type,2,1), "
2282
- " CASE type WHEN 'view' THEN rowid ELSE name END",
2281
+ "ORDER BY rowid",
22832282
callback, &data, &zErrMsg);
22842283
zShellStatic = 0;
22852284
}
22862285
}else{
22872286
rc = sqlite3_exec(p->db,
@@ -2288,12 +2287,11 @@
22882287
"SELECT sql FROM "
22892288
" (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
22902289
" FROM sqlite_master UNION ALL"
22912290
" SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
22922291
"WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
2293
- "ORDER BY substr(type,2,1),"
2294
- " CASE type WHEN 'view' THEN rowid ELSE name END",
2292
+ "ORDER BY rowid",
22952293
callback, &data, &zErrMsg
22962294
);
22972295
}
22982296
if( zErrMsg ){
22992297
fprintf(stderr,"Error: %s\n", zErrMsg);
@@ -2411,13 +2409,13 @@
24112409
if( nPrintCol<1 ) nPrintCol = 1;
24122410
nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
24132411
for(i=0; i<nPrintRow; i++){
24142412
for(j=i; j<nRow; j+=nPrintRow){
24152413
char *zSp = j<nPrintRow ? "" : " ";
2416
- printf("%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
2414
+ fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
24172415
}
2418
- printf("\n");
2416
+ fprintf(p->out, "\n");
24192417
}
24202418
}
24212419
for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
24222420
sqlite3_free(azResult);
24232421
}else
@@ -2470,11 +2468,11 @@
24702468
case SQLITE_TESTCTRL_OPTIMIZATIONS:
24712469
case SQLITE_TESTCTRL_RESERVE:
24722470
if( nArg==3 ){
24732471
int opt = (int)strtol(azArg[2], 0, 0);
24742472
rc = sqlite3_test_control(testctrl, p->db, opt);
2475
- printf("%d (0x%08x)\n", rc, rc);
2473
+ fprintf(p->out, "%d (0x%08x)\n", rc, rc);
24762474
} else {
24772475
fprintf(stderr,"Error: testctrl %s takes a single int option\n",
24782476
azArg[1]);
24792477
}
24802478
break;
@@ -2483,11 +2481,11 @@
24832481
case SQLITE_TESTCTRL_PRNG_SAVE:
24842482
case SQLITE_TESTCTRL_PRNG_RESTORE:
24852483
case SQLITE_TESTCTRL_PRNG_RESET:
24862484
if( nArg==2 ){
24872485
rc = sqlite3_test_control(testctrl);
2488
- printf("%d (0x%08x)\n", rc, rc);
2486
+ fprintf(p->out, "%d (0x%08x)\n", rc, rc);
24892487
} else {
24902488
fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
24912489
}
24922490
break;
24932491
@@ -2494,11 +2492,11 @@
24942492
/* sqlite3_test_control(int, uint) */
24952493
case SQLITE_TESTCTRL_PENDING_BYTE:
24962494
if( nArg==3 ){
24972495
unsigned int opt = (unsigned int)integerValue(azArg[2]);
24982496
rc = sqlite3_test_control(testctrl, opt);
2499
- printf("%d (0x%08x)\n", rc, rc);
2497
+ fprintf(p->out, "%d (0x%08x)\n", rc, rc);
25002498
} else {
25012499
fprintf(stderr,"Error: testctrl %s takes a single unsigned"
25022500
" int option\n", azArg[1]);
25032501
}
25042502
break;
@@ -2507,11 +2505,11 @@
25072505
case SQLITE_TESTCTRL_ASSERT:
25082506
case SQLITE_TESTCTRL_ALWAYS:
25092507
if( nArg==3 ){
25102508
int opt = atoi(azArg[2]);
25112509
rc = sqlite3_test_control(testctrl, opt);
2512
- printf("%d (0x%08x)\n", rc, rc);
2510
+ fprintf(p->out, "%d (0x%08x)\n", rc, rc);
25132511
} else {
25142512
fprintf(stderr,"Error: testctrl %s takes a single int option\n",
25152513
azArg[1]);
25162514
}
25172515
break;
@@ -2520,11 +2518,11 @@
25202518
#ifdef SQLITE_N_KEYWORD
25212519
case SQLITE_TESTCTRL_ISKEYWORD:
25222520
if( nArg==3 ){
25232521
const char *opt = azArg[2];
25242522
rc = sqlite3_test_control(testctrl, opt);
2525
- printf("%d (0x%08x)\n", rc, rc);
2523
+ fprintf(p->out, "%d (0x%08x)\n", rc, rc);
25262524
} else {
25272525
fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
25282526
azArg[1]);
25292527
}
25302528
break;
@@ -2565,21 +2563,21 @@
25652563
}
25662564
#endif
25672565
}else
25682566
25692567
if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
2570
- printf("SQLite %s %s\n" /*extra-version-info*/,
2568
+ fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
25712569
sqlite3_libversion(), sqlite3_sourceid());
25722570
}else
25732571
25742572
if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
25752573
const char *zDbName = nArg==2 ? azArg[1] : "main";
25762574
char *zVfsName = 0;
25772575
if( p->db ){
25782576
sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
25792577
if( zVfsName ){
2580
- printf("%s\n", zVfsName);
2578
+ fprintf(p->out, "%s\n", zVfsName);
25812579
sqlite3_free(zVfsName);
25822580
}
25832581
}
25842582
}else
25852583
25862584
--- src/shell.c
+++ src/shell.c
@@ -2276,12 +2276,11 @@
2276 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2277 " FROM sqlite_master UNION ALL"
2278 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2279 "WHERE lower(tbl_name) LIKE shellstatic()"
2280 " AND type!='meta' AND sql NOTNULL "
2281 "ORDER BY substr(type,2,1), "
2282 " CASE type WHEN 'view' THEN rowid ELSE name END",
2283 callback, &data, &zErrMsg);
2284 zShellStatic = 0;
2285 }
2286 }else{
2287 rc = sqlite3_exec(p->db,
@@ -2288,12 +2287,11 @@
2288 "SELECT sql FROM "
2289 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2290 " FROM sqlite_master UNION ALL"
2291 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2292 "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
2293 "ORDER BY substr(type,2,1),"
2294 " CASE type WHEN 'view' THEN rowid ELSE name END",
2295 callback, &data, &zErrMsg
2296 );
2297 }
2298 if( zErrMsg ){
2299 fprintf(stderr,"Error: %s\n", zErrMsg);
@@ -2411,13 +2409,13 @@
2411 if( nPrintCol<1 ) nPrintCol = 1;
2412 nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
2413 for(i=0; i<nPrintRow; i++){
2414 for(j=i; j<nRow; j+=nPrintRow){
2415 char *zSp = j<nPrintRow ? "" : " ";
2416 printf("%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
2417 }
2418 printf("\n");
2419 }
2420 }
2421 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
2422 sqlite3_free(azResult);
2423 }else
@@ -2470,11 +2468,11 @@
2470 case SQLITE_TESTCTRL_OPTIMIZATIONS:
2471 case SQLITE_TESTCTRL_RESERVE:
2472 if( nArg==3 ){
2473 int opt = (int)strtol(azArg[2], 0, 0);
2474 rc = sqlite3_test_control(testctrl, p->db, opt);
2475 printf("%d (0x%08x)\n", rc, rc);
2476 } else {
2477 fprintf(stderr,"Error: testctrl %s takes a single int option\n",
2478 azArg[1]);
2479 }
2480 break;
@@ -2483,11 +2481,11 @@
2483 case SQLITE_TESTCTRL_PRNG_SAVE:
2484 case SQLITE_TESTCTRL_PRNG_RESTORE:
2485 case SQLITE_TESTCTRL_PRNG_RESET:
2486 if( nArg==2 ){
2487 rc = sqlite3_test_control(testctrl);
2488 printf("%d (0x%08x)\n", rc, rc);
2489 } else {
2490 fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
2491 }
2492 break;
2493
@@ -2494,11 +2492,11 @@
2494 /* sqlite3_test_control(int, uint) */
2495 case SQLITE_TESTCTRL_PENDING_BYTE:
2496 if( nArg==3 ){
2497 unsigned int opt = (unsigned int)integerValue(azArg[2]);
2498 rc = sqlite3_test_control(testctrl, opt);
2499 printf("%d (0x%08x)\n", rc, rc);
2500 } else {
2501 fprintf(stderr,"Error: testctrl %s takes a single unsigned"
2502 " int option\n", azArg[1]);
2503 }
2504 break;
@@ -2507,11 +2505,11 @@
2507 case SQLITE_TESTCTRL_ASSERT:
2508 case SQLITE_TESTCTRL_ALWAYS:
2509 if( nArg==3 ){
2510 int opt = atoi(azArg[2]);
2511 rc = sqlite3_test_control(testctrl, opt);
2512 printf("%d (0x%08x)\n", rc, rc);
2513 } else {
2514 fprintf(stderr,"Error: testctrl %s takes a single int option\n",
2515 azArg[1]);
2516 }
2517 break;
@@ -2520,11 +2518,11 @@
2520 #ifdef SQLITE_N_KEYWORD
2521 case SQLITE_TESTCTRL_ISKEYWORD:
2522 if( nArg==3 ){
2523 const char *opt = azArg[2];
2524 rc = sqlite3_test_control(testctrl, opt);
2525 printf("%d (0x%08x)\n", rc, rc);
2526 } else {
2527 fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
2528 azArg[1]);
2529 }
2530 break;
@@ -2565,21 +2563,21 @@
2565 }
2566 #endif
2567 }else
2568
2569 if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
2570 printf("SQLite %s %s\n" /*extra-version-info*/,
2571 sqlite3_libversion(), sqlite3_sourceid());
2572 }else
2573
2574 if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
2575 const char *zDbName = nArg==2 ? azArg[1] : "main";
2576 char *zVfsName = 0;
2577 if( p->db ){
2578 sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
2579 if( zVfsName ){
2580 printf("%s\n", zVfsName);
2581 sqlite3_free(zVfsName);
2582 }
2583 }
2584 }else
2585
2586
--- src/shell.c
+++ src/shell.c
@@ -2276,12 +2276,11 @@
2276 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2277 " FROM sqlite_master UNION ALL"
2278 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2279 "WHERE lower(tbl_name) LIKE shellstatic()"
2280 " AND type!='meta' AND sql NOTNULL "
2281 "ORDER BY rowid",
 
2282 callback, &data, &zErrMsg);
2283 zShellStatic = 0;
2284 }
2285 }else{
2286 rc = sqlite3_exec(p->db,
@@ -2288,12 +2287,11 @@
2287 "SELECT sql FROM "
2288 " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x"
2289 " FROM sqlite_master UNION ALL"
2290 " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) "
2291 "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
2292 "ORDER BY rowid",
 
2293 callback, &data, &zErrMsg
2294 );
2295 }
2296 if( zErrMsg ){
2297 fprintf(stderr,"Error: %s\n", zErrMsg);
@@ -2411,13 +2409,13 @@
2409 if( nPrintCol<1 ) nPrintCol = 1;
2410 nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
2411 for(i=0; i<nPrintRow; i++){
2412 for(j=i; j<nRow; j+=nPrintRow){
2413 char *zSp = j<nPrintRow ? "" : " ";
2414 fprintf(p->out, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
2415 }
2416 fprintf(p->out, "\n");
2417 }
2418 }
2419 for(ii=0; ii<nRow; ii++) sqlite3_free(azResult[ii]);
2420 sqlite3_free(azResult);
2421 }else
@@ -2470,11 +2468,11 @@
2468 case SQLITE_TESTCTRL_OPTIMIZATIONS:
2469 case SQLITE_TESTCTRL_RESERVE:
2470 if( nArg==3 ){
2471 int opt = (int)strtol(azArg[2], 0, 0);
2472 rc = sqlite3_test_control(testctrl, p->db, opt);
2473 fprintf(p->out, "%d (0x%08x)\n", rc, rc);
2474 } else {
2475 fprintf(stderr,"Error: testctrl %s takes a single int option\n",
2476 azArg[1]);
2477 }
2478 break;
@@ -2483,11 +2481,11 @@
2481 case SQLITE_TESTCTRL_PRNG_SAVE:
2482 case SQLITE_TESTCTRL_PRNG_RESTORE:
2483 case SQLITE_TESTCTRL_PRNG_RESET:
2484 if( nArg==2 ){
2485 rc = sqlite3_test_control(testctrl);
2486 fprintf(p->out, "%d (0x%08x)\n", rc, rc);
2487 } else {
2488 fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
2489 }
2490 break;
2491
@@ -2494,11 +2492,11 @@
2492 /* sqlite3_test_control(int, uint) */
2493 case SQLITE_TESTCTRL_PENDING_BYTE:
2494 if( nArg==3 ){
2495 unsigned int opt = (unsigned int)integerValue(azArg[2]);
2496 rc = sqlite3_test_control(testctrl, opt);
2497 fprintf(p->out, "%d (0x%08x)\n", rc, rc);
2498 } else {
2499 fprintf(stderr,"Error: testctrl %s takes a single unsigned"
2500 " int option\n", azArg[1]);
2501 }
2502 break;
@@ -2507,11 +2505,11 @@
2505 case SQLITE_TESTCTRL_ASSERT:
2506 case SQLITE_TESTCTRL_ALWAYS:
2507 if( nArg==3 ){
2508 int opt = atoi(azArg[2]);
2509 rc = sqlite3_test_control(testctrl, opt);
2510 fprintf(p->out, "%d (0x%08x)\n", rc, rc);
2511 } else {
2512 fprintf(stderr,"Error: testctrl %s takes a single int option\n",
2513 azArg[1]);
2514 }
2515 break;
@@ -2520,11 +2518,11 @@
2518 #ifdef SQLITE_N_KEYWORD
2519 case SQLITE_TESTCTRL_ISKEYWORD:
2520 if( nArg==3 ){
2521 const char *opt = azArg[2];
2522 rc = sqlite3_test_control(testctrl, opt);
2523 fprintf(p->out, "%d (0x%08x)\n", rc, rc);
2524 } else {
2525 fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
2526 azArg[1]);
2527 }
2528 break;
@@ -2565,21 +2563,21 @@
2563 }
2564 #endif
2565 }else
2566
2567 if( c=='v' && strncmp(azArg[0], "version", n)==0 ){
2568 fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/,
2569 sqlite3_libversion(), sqlite3_sourceid());
2570 }else
2571
2572 if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){
2573 const char *zDbName = nArg==2 ? azArg[1] : "main";
2574 char *zVfsName = 0;
2575 if( p->db ){
2576 sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName);
2577 if( zVfsName ){
2578 fprintf(p->out, "%s\n", zVfsName);
2579 sqlite3_free(zVfsName);
2580 }
2581 }
2582 }else
2583
2584
+97 -38
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -678,11 +678,11 @@
678678
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
679679
** [sqlite_version()] and [sqlite_source_id()].
680680
*/
681681
#define SQLITE_VERSION "3.7.17"
682682
#define SQLITE_VERSION_NUMBER 3007017
683
-#define SQLITE_SOURCE_ID "2013-05-03 15:23:24 b2efe4f225adc5f4c2e3080bf459cc52fff82e18"
683
+#define SQLITE_SOURCE_ID "2013-05-08 17:06:28 1fa8c457394c94864f7584e4c893ec09e685fba4"
684684
685685
/*
686686
** CAPI3REF: Run-Time Library Version Numbers
687687
** KEYWORDS: sqlite3_version, sqlite3_sourceid
688688
**
@@ -99219,10 +99219,73 @@
9921999219
}
9922099220
pFrom->pIndex = pIdx;
9922199221
}
9922299222
return SQLITE_OK;
9922399223
}
99224
+/*
99225
+** Detect compound SELECT statements that use an ORDER BY clause with
99226
+** an alternative collating sequence.
99227
+**
99228
+** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
99229
+**
99230
+** These are rewritten as a subquery:
99231
+**
99232
+** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2)
99233
+** ORDER BY ... COLLATE ...
99234
+**
99235
+** This transformation is necessary because the multiSelectOrderBy() routine
99236
+** above that generates the code for a compound SELECT with an ORDER BY clause
99237
+** uses a merge algorithm that requires the same collating sequence on the
99238
+** result columns as on the ORDER BY clause. See ticket
99239
+** http://www.sqlite.org/src/info/6709574d2a
99240
+**
99241
+** This transformation is only needed for EXCEPT, INTERSECT, and UNION.
99242
+** The UNION ALL operator works fine with multiSelectOrderBy() even when
99243
+** there are COLLATE terms in the ORDER BY.
99244
+*/
99245
+static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){
99246
+ int i;
99247
+ Select *pNew;
99248
+ Select *pX;
99249
+ sqlite3 *db;
99250
+ struct ExprList_item *a;
99251
+ SrcList *pNewSrc;
99252
+ Parse *pParse;
99253
+ Token dummy;
99254
+
99255
+ if( p->pPrior==0 ) return WRC_Continue;
99256
+ if( p->pOrderBy==0 ) return WRC_Continue;
99257
+ for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}
99258
+ if( pX==0 ) return WRC_Continue;
99259
+ a = p->pOrderBy->a;
99260
+ for(i=p->pOrderBy->nExpr-1; i>=0; i--){
99261
+ if( a[i].pExpr->flags & EP_Collate ) break;
99262
+ }
99263
+ if( i<0 ) return WRC_Continue;
99264
+
99265
+ /* If we reach this point, that means the transformation is required. */
99266
+
99267
+ pParse = pWalker->pParse;
99268
+ db = pParse->db;
99269
+ pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
99270
+ if( pNew==0 ) return WRC_Abort;
99271
+ memset(&dummy, 0, sizeof(dummy));
99272
+ pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0);
99273
+ if( pNewSrc==0 ) return WRC_Abort;
99274
+ *pNew = *p;
99275
+ p->pSrc = pNewSrc;
99276
+ p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ALL, 0));
99277
+ p->op = TK_SELECT;
99278
+ p->pWhere = 0;
99279
+ pNew->pGroupBy = 0;
99280
+ pNew->pHaving = 0;
99281
+ pNew->pOrderBy = 0;
99282
+ p->pPrior = 0;
99283
+ pNew->pLimit = 0;
99284
+ pNew->pOffset = 0;
99285
+ return WRC_Continue;
99286
+}
9922499287
9922599288
/*
9922699289
** This routine is a Walker callback for "expanding" a SELECT statement.
9922799290
** "Expanding" means to do the following:
9922899291
**
@@ -99536,13 +99599,15 @@
9953699599
** and/or pParse->db->mallocFailed.
9953799600
*/
9953899601
static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
9953999602
Walker w;
9954099603
memset(&w, 0, sizeof(w));
99541
- w.xSelectCallback = selectExpander;
99604
+ w.xSelectCallback = convertCompoundSelectToSubquery;
9954299605
w.xExprCallback = exprWalkNoop;
9954399606
w.pParse = pParse;
99607
+ sqlite3WalkSelect(&w, pSelect);
99608
+ w.xSelectCallback = selectExpander;
9954499609
sqlite3WalkSelect(&w, pSelect);
9954599610
}
9954699611
9954799612
9954899613
#ifndef SQLITE_OMIT_SUBQUERY
@@ -102275,10 +102340,11 @@
102275102340
break;
102276102341
}
102277102342
}
102278102343
if( j>=pTab->nCol ){
102279102344
if( sqlite3IsRowid(pChanges->a[i].zName) ){
102345
+ j = -1;
102280102346
chngRowid = 1;
102281102347
pRowidExpr = pChanges->a[i].pExpr;
102282102348
}else{
102283102349
sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
102284102350
pParse->checkSchema = 1;
@@ -102287,11 +102353,12 @@
102287102353
}
102288102354
#ifndef SQLITE_OMIT_AUTHORIZATION
102289102355
{
102290102356
int rc;
102291102357
rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
102292
- pTab->aCol[j].zName, db->aDb[iDb].zName);
102358
+ j<0 ? "ROWID" : pTab->aCol[j].zName,
102359
+ db->aDb[iDb].zName);
102293102360
if( rc==SQLITE_DENY ){
102294102361
goto update_cleanup;
102295102362
}else if( rc==SQLITE_IGNORE ){
102296102363
aXRef[j] = -1;
102297102364
}
@@ -119270,11 +119337,11 @@
119270119337
SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
119271119338
SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
119272119339
SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
119273119340
119274119341
/* fts3_tokenize_vtab.c */
119275
-SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*);
119342
+SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
119276119343
119277119344
/* fts3_unicode2.c (functions generated by parsing unicode text files) */
119278119345
#ifdef SQLITE_ENABLE_FTS4_UNICODE61
119279119346
SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
119280119347
SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -122584,13 +122651,10 @@
122584122651
#endif
122585122652
122586122653
rc = sqlite3Fts3InitAux(db);
122587122654
if( rc!=SQLITE_OK ) return rc;
122588122655
122589
- rc = sqlite3Fts3InitTok(db);
122590
- if( rc!=SQLITE_OK ) return rc;
122591
-
122592122656
sqlite3Fts3SimpleTokenizerModule(&pSimple);
122593122657
sqlite3Fts3PorterTokenizerModule(&pPorter);
122594122658
122595122659
/* Allocate and initialize the hash-table used to store tokenizers. */
122596122660
pHash = sqlite3_malloc(sizeof(Fts3Hash));
@@ -122640,12 +122704,16 @@
122640122704
if( rc==SQLITE_OK ){
122641122705
rc = sqlite3_create_module_v2(
122642122706
db, "fts4", &fts3Module, (void *)pHash, 0
122643122707
);
122644122708
}
122709
+ if( rc==SQLITE_OK ){
122710
+ rc = sqlite3Fts3InitTok(db, (void *)pHash);
122711
+ }
122645122712
return rc;
122646122713
}
122714
+
122647122715
122648122716
/* An error has occurred. Delete the hash table and return the error code. */
122649122717
assert( rc!=SQLITE_OK );
122650122718
if( pHash ){
122651122719
sqlite3Fts3HashClear(pHash);
@@ -125710,10 +125778,11 @@
125710125778
if( apLeaf[i] ){
125711125779
if( p==0 ){
125712125780
p = apLeaf[i];
125713125781
p->pParent = 0;
125714125782
}else{
125783
+ assert( pFree!=0 );
125715125784
pFree->pRight = p;
125716125785
pFree->pLeft = apLeaf[i];
125717125786
pFree->pLeft->pParent = pFree;
125718125787
pFree->pRight->pParent = pFree;
125719125788
@@ -127945,32 +128014,26 @@
127945128014
127946128015
/*
127947128016
** Query FTS for the tokenizer implementation named zName.
127948128017
*/
127949128018
static int fts3tokQueryTokenizer(
127950
- sqlite3 *db,
128019
+ Fts3Hash *pHash,
127951128020
const char *zName,
127952
- const sqlite3_tokenizer_module **pp
127953
-){
127954
- int rc;
127955
- sqlite3_stmt *pStmt;
127956
- const char *zSql = "SELECT fts3_tokenizer(?)";
127957
-
127958
- *pp = 0;
127959
- rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
127960
- if( rc!=SQLITE_OK ){
127961
- return rc;
127962
- }
127963
-
127964
- sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
127965
- if( SQLITE_ROW==sqlite3_step(pStmt) ){
127966
- if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
127967
- memcpy((void*)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
127968
- }
127969
- }
127970
-
127971
- return sqlite3_finalize(pStmt);
128021
+ const sqlite3_tokenizer_module **pp,
128022
+ char **pzErr
128023
+){
128024
+ sqlite3_tokenizer_module *p;
128025
+ int nName = (int)strlen(zName);
128026
+
128027
+ p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);
128028
+ if( !p ){
128029
+ *pzErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
128030
+ return SQLITE_ERROR;
128031
+ }
128032
+
128033
+ *pp = p;
128034
+ return SQLITE_OK;
127972128035
}
127973128036
127974128037
/*
127975128038
** The second argument, argv[], is an array of pointers to nul-terminated
127976128039
** strings. This function makes a copy of the array and strings into a
@@ -128033,11 +128096,11 @@
128033128096
** argv[2]: table name
128034128097
** argv[3]: first argument (tokenizer name)
128035128098
*/
128036128099
static int fts3tokConnectMethod(
128037128100
sqlite3 *db, /* Database connection */
128038
- void *pUnused, /* Unused */
128101
+ void *pHash, /* Hash table of tokenizers */
128039128102
int argc, /* Number of elements in argv array */
128040128103
const char * const *argv, /* xCreate/xConnect argument array */
128041128104
sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */
128042128105
char **pzErr /* OUT: sqlite3_malloc'd error message */
128043128106
){
@@ -128045,11 +128108,10 @@
128045128108
const sqlite3_tokenizer_module *pMod = 0;
128046128109
sqlite3_tokenizer *pTok = 0;
128047128110
int rc;
128048128111
char **azDequote = 0;
128049128112
int nDequote;
128050
- UNUSED_PARAMETER(pUnused);
128051128113
128052128114
rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA);
128053128115
if( rc!=SQLITE_OK ) return rc;
128054128116
128055128117
nDequote = argc-3;
@@ -128060,18 +128122,15 @@
128060128122
if( nDequote<1 ){
128061128123
zModule = "simple";
128062128124
}else{
128063128125
zModule = azDequote[0];
128064128126
}
128065
- rc = fts3tokQueryTokenizer(db, zModule, &pMod);
128127
+ rc = fts3tokQueryTokenizer((Fts3Hash*)pHash, zModule, &pMod, pzErr);
128066128128
}
128067128129
128068
- if( rc!=SQLITE_OK ){
128069
- *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
128070
- }else if( pMod==0 ){
128071
- rc = SQLITE_ERROR;
128072
- }else{
128130
+ assert( (rc==SQLITE_OK)==(pMod!=0) );
128131
+ if( rc==SQLITE_OK ){
128073128132
const char * const *azArg = (const char * const *)&azDequote[1];
128074128133
rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);
128075128134
}
128076128135
128077128136
if( rc==SQLITE_OK ){
@@ -128299,11 +128358,11 @@
128299128358
128300128359
/*
128301128360
** Register the fts3tok module with database connection db. Return SQLITE_OK
128302128361
** if successful or an error code if sqlite3_create_module() fails.
128303128362
*/
128304
-SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db){
128363
+SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
128305128364
static const sqlite3_module fts3tok_module = {
128306128365
0, /* iVersion */
128307128366
fts3tokConnectMethod, /* xCreate */
128308128367
fts3tokConnectMethod, /* xConnect */
128309128368
fts3tokBestIndexMethod, /* xBestIndex */
@@ -128327,11 +128386,11 @@
128327128386
0, /* xRelease */
128328128387
0 /* xRollbackTo */
128329128388
};
128330128389
int rc; /* Return code */
128331128390
128332
- rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, 0);
128391
+ rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash);
128333128392
return rc;
128334128393
}
128335128394
128336128395
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
128337128396
128338128397
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -678,11 +678,11 @@
678 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
679 ** [sqlite_version()] and [sqlite_source_id()].
680 */
681 #define SQLITE_VERSION "3.7.17"
682 #define SQLITE_VERSION_NUMBER 3007017
683 #define SQLITE_SOURCE_ID "2013-05-03 15:23:24 b2efe4f225adc5f4c2e3080bf459cc52fff82e18"
684
685 /*
686 ** CAPI3REF: Run-Time Library Version Numbers
687 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
688 **
@@ -99219,10 +99219,73 @@
99219 }
99220 pFrom->pIndex = pIdx;
99221 }
99222 return SQLITE_OK;
99223 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99224
99225 /*
99226 ** This routine is a Walker callback for "expanding" a SELECT statement.
99227 ** "Expanding" means to do the following:
99228 **
@@ -99536,13 +99599,15 @@
99536 ** and/or pParse->db->mallocFailed.
99537 */
99538 static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
99539 Walker w;
99540 memset(&w, 0, sizeof(w));
99541 w.xSelectCallback = selectExpander;
99542 w.xExprCallback = exprWalkNoop;
99543 w.pParse = pParse;
 
 
99544 sqlite3WalkSelect(&w, pSelect);
99545 }
99546
99547
99548 #ifndef SQLITE_OMIT_SUBQUERY
@@ -102275,10 +102340,11 @@
102275 break;
102276 }
102277 }
102278 if( j>=pTab->nCol ){
102279 if( sqlite3IsRowid(pChanges->a[i].zName) ){
 
102280 chngRowid = 1;
102281 pRowidExpr = pChanges->a[i].pExpr;
102282 }else{
102283 sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
102284 pParse->checkSchema = 1;
@@ -102287,11 +102353,12 @@
102287 }
102288 #ifndef SQLITE_OMIT_AUTHORIZATION
102289 {
102290 int rc;
102291 rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
102292 pTab->aCol[j].zName, db->aDb[iDb].zName);
 
102293 if( rc==SQLITE_DENY ){
102294 goto update_cleanup;
102295 }else if( rc==SQLITE_IGNORE ){
102296 aXRef[j] = -1;
102297 }
@@ -119270,11 +119337,11 @@
119270 SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
119271 SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
119272 SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
119273
119274 /* fts3_tokenize_vtab.c */
119275 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*);
119276
119277 /* fts3_unicode2.c (functions generated by parsing unicode text files) */
119278 #ifdef SQLITE_ENABLE_FTS4_UNICODE61
119279 SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
119280 SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -122584,13 +122651,10 @@
122584 #endif
122585
122586 rc = sqlite3Fts3InitAux(db);
122587 if( rc!=SQLITE_OK ) return rc;
122588
122589 rc = sqlite3Fts3InitTok(db);
122590 if( rc!=SQLITE_OK ) return rc;
122591
122592 sqlite3Fts3SimpleTokenizerModule(&pSimple);
122593 sqlite3Fts3PorterTokenizerModule(&pPorter);
122594
122595 /* Allocate and initialize the hash-table used to store tokenizers. */
122596 pHash = sqlite3_malloc(sizeof(Fts3Hash));
@@ -122640,12 +122704,16 @@
122640 if( rc==SQLITE_OK ){
122641 rc = sqlite3_create_module_v2(
122642 db, "fts4", &fts3Module, (void *)pHash, 0
122643 );
122644 }
 
 
 
122645 return rc;
122646 }
 
122647
122648 /* An error has occurred. Delete the hash table and return the error code. */
122649 assert( rc!=SQLITE_OK );
122650 if( pHash ){
122651 sqlite3Fts3HashClear(pHash);
@@ -125710,10 +125778,11 @@
125710 if( apLeaf[i] ){
125711 if( p==0 ){
125712 p = apLeaf[i];
125713 p->pParent = 0;
125714 }else{
 
125715 pFree->pRight = p;
125716 pFree->pLeft = apLeaf[i];
125717 pFree->pLeft->pParent = pFree;
125718 pFree->pRight->pParent = pFree;
125719
@@ -127945,32 +128014,26 @@
127945
127946 /*
127947 ** Query FTS for the tokenizer implementation named zName.
127948 */
127949 static int fts3tokQueryTokenizer(
127950 sqlite3 *db,
127951 const char *zName,
127952 const sqlite3_tokenizer_module **pp
127953 ){
127954 int rc;
127955 sqlite3_stmt *pStmt;
127956 const char *zSql = "SELECT fts3_tokenizer(?)";
127957
127958 *pp = 0;
127959 rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
127960 if( rc!=SQLITE_OK ){
127961 return rc;
127962 }
127963
127964 sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC);
127965 if( SQLITE_ROW==sqlite3_step(pStmt) ){
127966 if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){
127967 memcpy((void*)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp));
127968 }
127969 }
127970
127971 return sqlite3_finalize(pStmt);
127972 }
127973
127974 /*
127975 ** The second argument, argv[], is an array of pointers to nul-terminated
127976 ** strings. This function makes a copy of the array and strings into a
@@ -128033,11 +128096,11 @@
128033 ** argv[2]: table name
128034 ** argv[3]: first argument (tokenizer name)
128035 */
128036 static int fts3tokConnectMethod(
128037 sqlite3 *db, /* Database connection */
128038 void *pUnused, /* Unused */
128039 int argc, /* Number of elements in argv array */
128040 const char * const *argv, /* xCreate/xConnect argument array */
128041 sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */
128042 char **pzErr /* OUT: sqlite3_malloc'd error message */
128043 ){
@@ -128045,11 +128108,10 @@
128045 const sqlite3_tokenizer_module *pMod = 0;
128046 sqlite3_tokenizer *pTok = 0;
128047 int rc;
128048 char **azDequote = 0;
128049 int nDequote;
128050 UNUSED_PARAMETER(pUnused);
128051
128052 rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA);
128053 if( rc!=SQLITE_OK ) return rc;
128054
128055 nDequote = argc-3;
@@ -128060,18 +128122,15 @@
128060 if( nDequote<1 ){
128061 zModule = "simple";
128062 }else{
128063 zModule = azDequote[0];
128064 }
128065 rc = fts3tokQueryTokenizer(db, zModule, &pMod);
128066 }
128067
128068 if( rc!=SQLITE_OK ){
128069 *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
128070 }else if( pMod==0 ){
128071 rc = SQLITE_ERROR;
128072 }else{
128073 const char * const *azArg = (const char * const *)&azDequote[1];
128074 rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);
128075 }
128076
128077 if( rc==SQLITE_OK ){
@@ -128299,11 +128358,11 @@
128299
128300 /*
128301 ** Register the fts3tok module with database connection db. Return SQLITE_OK
128302 ** if successful or an error code if sqlite3_create_module() fails.
128303 */
128304 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db){
128305 static const sqlite3_module fts3tok_module = {
128306 0, /* iVersion */
128307 fts3tokConnectMethod, /* xCreate */
128308 fts3tokConnectMethod, /* xConnect */
128309 fts3tokBestIndexMethod, /* xBestIndex */
@@ -128327,11 +128386,11 @@
128327 0, /* xRelease */
128328 0 /* xRollbackTo */
128329 };
128330 int rc; /* Return code */
128331
128332 rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, 0);
128333 return rc;
128334 }
128335
128336 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
128337
128338
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -678,11 +678,11 @@
678 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
679 ** [sqlite_version()] and [sqlite_source_id()].
680 */
681 #define SQLITE_VERSION "3.7.17"
682 #define SQLITE_VERSION_NUMBER 3007017
683 #define SQLITE_SOURCE_ID "2013-05-08 17:06:28 1fa8c457394c94864f7584e4c893ec09e685fba4"
684
685 /*
686 ** CAPI3REF: Run-Time Library Version Numbers
687 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
688 **
@@ -99219,10 +99219,73 @@
99219 }
99220 pFrom->pIndex = pIdx;
99221 }
99222 return SQLITE_OK;
99223 }
99224 /*
99225 ** Detect compound SELECT statements that use an ORDER BY clause with
99226 ** an alternative collating sequence.
99227 **
99228 ** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ...
99229 **
99230 ** These are rewritten as a subquery:
99231 **
99232 ** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2)
99233 ** ORDER BY ... COLLATE ...
99234 **
99235 ** This transformation is necessary because the multiSelectOrderBy() routine
99236 ** above that generates the code for a compound SELECT with an ORDER BY clause
99237 ** uses a merge algorithm that requires the same collating sequence on the
99238 ** result columns as on the ORDER BY clause. See ticket
99239 ** http://www.sqlite.org/src/info/6709574d2a
99240 **
99241 ** This transformation is only needed for EXCEPT, INTERSECT, and UNION.
99242 ** The UNION ALL operator works fine with multiSelectOrderBy() even when
99243 ** there are COLLATE terms in the ORDER BY.
99244 */
99245 static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){
99246 int i;
99247 Select *pNew;
99248 Select *pX;
99249 sqlite3 *db;
99250 struct ExprList_item *a;
99251 SrcList *pNewSrc;
99252 Parse *pParse;
99253 Token dummy;
99254
99255 if( p->pPrior==0 ) return WRC_Continue;
99256 if( p->pOrderBy==0 ) return WRC_Continue;
99257 for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){}
99258 if( pX==0 ) return WRC_Continue;
99259 a = p->pOrderBy->a;
99260 for(i=p->pOrderBy->nExpr-1; i>=0; i--){
99261 if( a[i].pExpr->flags & EP_Collate ) break;
99262 }
99263 if( i<0 ) return WRC_Continue;
99264
99265 /* If we reach this point, that means the transformation is required. */
99266
99267 pParse = pWalker->pParse;
99268 db = pParse->db;
99269 pNew = sqlite3DbMallocZero(db, sizeof(*pNew) );
99270 if( pNew==0 ) return WRC_Abort;
99271 memset(&dummy, 0, sizeof(dummy));
99272 pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0);
99273 if( pNewSrc==0 ) return WRC_Abort;
99274 *pNew = *p;
99275 p->pSrc = pNewSrc;
99276 p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ALL, 0));
99277 p->op = TK_SELECT;
99278 p->pWhere = 0;
99279 pNew->pGroupBy = 0;
99280 pNew->pHaving = 0;
99281 pNew->pOrderBy = 0;
99282 p->pPrior = 0;
99283 pNew->pLimit = 0;
99284 pNew->pOffset = 0;
99285 return WRC_Continue;
99286 }
99287
99288 /*
99289 ** This routine is a Walker callback for "expanding" a SELECT statement.
99290 ** "Expanding" means to do the following:
99291 **
@@ -99536,13 +99599,15 @@
99599 ** and/or pParse->db->mallocFailed.
99600 */
99601 static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
99602 Walker w;
99603 memset(&w, 0, sizeof(w));
99604 w.xSelectCallback = convertCompoundSelectToSubquery;
99605 w.xExprCallback = exprWalkNoop;
99606 w.pParse = pParse;
99607 sqlite3WalkSelect(&w, pSelect);
99608 w.xSelectCallback = selectExpander;
99609 sqlite3WalkSelect(&w, pSelect);
99610 }
99611
99612
99613 #ifndef SQLITE_OMIT_SUBQUERY
@@ -102275,10 +102340,11 @@
102340 break;
102341 }
102342 }
102343 if( j>=pTab->nCol ){
102344 if( sqlite3IsRowid(pChanges->a[i].zName) ){
102345 j = -1;
102346 chngRowid = 1;
102347 pRowidExpr = pChanges->a[i].pExpr;
102348 }else{
102349 sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName);
102350 pParse->checkSchema = 1;
@@ -102287,11 +102353,12 @@
102353 }
102354 #ifndef SQLITE_OMIT_AUTHORIZATION
102355 {
102356 int rc;
102357 rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName,
102358 j<0 ? "ROWID" : pTab->aCol[j].zName,
102359 db->aDb[iDb].zName);
102360 if( rc==SQLITE_DENY ){
102361 goto update_cleanup;
102362 }else if( rc==SQLITE_IGNORE ){
102363 aXRef[j] = -1;
102364 }
@@ -119270,11 +119337,11 @@
119337 SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **);
119338 SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *);
119339 SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr);
119340
119341 /* fts3_tokenize_vtab.c */
119342 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *);
119343
119344 /* fts3_unicode2.c (functions generated by parsing unicode text files) */
119345 #ifdef SQLITE_ENABLE_FTS4_UNICODE61
119346 SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int);
119347 SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int);
@@ -122584,13 +122651,10 @@
122651 #endif
122652
122653 rc = sqlite3Fts3InitAux(db);
122654 if( rc!=SQLITE_OK ) return rc;
122655
 
 
 
122656 sqlite3Fts3SimpleTokenizerModule(&pSimple);
122657 sqlite3Fts3PorterTokenizerModule(&pPorter);
122658
122659 /* Allocate and initialize the hash-table used to store tokenizers. */
122660 pHash = sqlite3_malloc(sizeof(Fts3Hash));
@@ -122640,12 +122704,16 @@
122704 if( rc==SQLITE_OK ){
122705 rc = sqlite3_create_module_v2(
122706 db, "fts4", &fts3Module, (void *)pHash, 0
122707 );
122708 }
122709 if( rc==SQLITE_OK ){
122710 rc = sqlite3Fts3InitTok(db, (void *)pHash);
122711 }
122712 return rc;
122713 }
122714
122715
122716 /* An error has occurred. Delete the hash table and return the error code. */
122717 assert( rc!=SQLITE_OK );
122718 if( pHash ){
122719 sqlite3Fts3HashClear(pHash);
@@ -125710,10 +125778,11 @@
125778 if( apLeaf[i] ){
125779 if( p==0 ){
125780 p = apLeaf[i];
125781 p->pParent = 0;
125782 }else{
125783 assert( pFree!=0 );
125784 pFree->pRight = p;
125785 pFree->pLeft = apLeaf[i];
125786 pFree->pLeft->pParent = pFree;
125787 pFree->pRight->pParent = pFree;
125788
@@ -127945,32 +128014,26 @@
128014
128015 /*
128016 ** Query FTS for the tokenizer implementation named zName.
128017 */
128018 static int fts3tokQueryTokenizer(
128019 Fts3Hash *pHash,
128020 const char *zName,
128021 const sqlite3_tokenizer_module **pp,
128022 char **pzErr
128023 ){
128024 sqlite3_tokenizer_module *p;
128025 int nName = (int)strlen(zName);
128026
128027 p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1);
128028 if( !p ){
128029 *pzErr = sqlite3_mprintf("unknown tokenizer: %s", zName);
128030 return SQLITE_ERROR;
128031 }
128032
128033 *pp = p;
128034 return SQLITE_OK;
 
 
 
 
 
 
128035 }
128036
128037 /*
128038 ** The second argument, argv[], is an array of pointers to nul-terminated
128039 ** strings. This function makes a copy of the array and strings into a
@@ -128033,11 +128096,11 @@
128096 ** argv[2]: table name
128097 ** argv[3]: first argument (tokenizer name)
128098 */
128099 static int fts3tokConnectMethod(
128100 sqlite3 *db, /* Database connection */
128101 void *pHash, /* Hash table of tokenizers */
128102 int argc, /* Number of elements in argv array */
128103 const char * const *argv, /* xCreate/xConnect argument array */
128104 sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */
128105 char **pzErr /* OUT: sqlite3_malloc'd error message */
128106 ){
@@ -128045,11 +128108,10 @@
128108 const sqlite3_tokenizer_module *pMod = 0;
128109 sqlite3_tokenizer *pTok = 0;
128110 int rc;
128111 char **azDequote = 0;
128112 int nDequote;
 
128113
128114 rc = sqlite3_declare_vtab(db, FTS3_TOK_SCHEMA);
128115 if( rc!=SQLITE_OK ) return rc;
128116
128117 nDequote = argc-3;
@@ -128060,18 +128122,15 @@
128122 if( nDequote<1 ){
128123 zModule = "simple";
128124 }else{
128125 zModule = azDequote[0];
128126 }
128127 rc = fts3tokQueryTokenizer((Fts3Hash*)pHash, zModule, &pMod, pzErr);
128128 }
128129
128130 assert( (rc==SQLITE_OK)==(pMod!=0) );
128131 if( rc==SQLITE_OK ){
 
 
 
128132 const char * const *azArg = (const char * const *)&azDequote[1];
128133 rc = pMod->xCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok);
128134 }
128135
128136 if( rc==SQLITE_OK ){
@@ -128299,11 +128358,11 @@
128358
128359 /*
128360 ** Register the fts3tok module with database connection db. Return SQLITE_OK
128361 ** if successful or an error code if sqlite3_create_module() fails.
128362 */
128363 SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){
128364 static const sqlite3_module fts3tok_module = {
128365 0, /* iVersion */
128366 fts3tokConnectMethod, /* xCreate */
128367 fts3tokConnectMethod, /* xConnect */
128368 fts3tokBestIndexMethod, /* xBestIndex */
@@ -128327,11 +128386,11 @@
128386 0, /* xRelease */
128387 0 /* xRollbackTo */
128388 };
128389 int rc; /* Return code */
128390
128391 rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash);
128392 return rc;
128393 }
128394
128395 #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */
128396
128397
+1 -1
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.17"
111111
#define SQLITE_VERSION_NUMBER 3007017
112
-#define SQLITE_SOURCE_ID "2013-05-03 15:23:24 b2efe4f225adc5f4c2e3080bf459cc52fff82e18"
112
+#define SQLITE_SOURCE_ID "2013-05-08 17:06:28 1fa8c457394c94864f7584e4c893ec09e685fba4"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
118118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.17"
111 #define SQLITE_VERSION_NUMBER 3007017
112 #define SQLITE_SOURCE_ID "2013-05-03 15:23:24 b2efe4f225adc5f4c2e3080bf459cc52fff82e18"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118
--- src/sqlite3.h
+++ src/sqlite3.h
@@ -107,11 +107,11 @@
107 ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108 ** [sqlite_version()] and [sqlite_source_id()].
109 */
110 #define SQLITE_VERSION "3.7.17"
111 #define SQLITE_VERSION_NUMBER 3007017
112 #define SQLITE_SOURCE_ID "2013-05-08 17:06:28 1fa8c457394c94864f7584e4c893ec09e685fba4"
113
114 /*
115 ** CAPI3REF: Run-Time Library Version Numbers
116 ** KEYWORDS: sqlite3_version, sqlite3_sourceid
117 **
118

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button