Fossil SCM
Update the built-in SQLite to the 3.7.9 release candidate.
Commit
326979358d6db31cc1f9f92329b25b1da19f6582
Parent
49a015ef79c6210…
2 files changed
+98
-64
+1
-1
+98
-64
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -314,17 +314,10 @@ | ||
| 314 | 314 | #endif |
| 315 | 315 | #ifdef HAVE_INTTYPES_H |
| 316 | 316 | #include <inttypes.h> |
| 317 | 317 | #endif |
| 318 | 318 | |
| 319 | -/* | |
| 320 | -** The number of samples of an index that SQLite takes in order to | |
| 321 | -** construct a histogram of the table content when running ANALYZE | |
| 322 | -** and with SQLITE_ENABLE_STAT2 | |
| 323 | -*/ | |
| 324 | -#define SQLITE_INDEX_SAMPLES 10 | |
| 325 | - | |
| 326 | 319 | /* |
| 327 | 320 | ** The following macros are used to cast pointers to integers and |
| 328 | 321 | ** integers to pointers. The way you do this varies from one compiler |
| 329 | 322 | ** to the next, so we have developed the following set of #if statements |
| 330 | 323 | ** to generate appropriate macros for a wide range of compilers. |
| @@ -656,11 +649,11 @@ | ||
| 656 | 649 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | 650 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | 651 | */ |
| 659 | 652 | #define SQLITE_VERSION "3.7.9" |
| 660 | 653 | #define SQLITE_VERSION_NUMBER 3007009 |
| 661 | -#define SQLITE_SOURCE_ID "2011-10-20 00:55:54 4344483f7d7f64dffadde0053e6c745948db9486" | |
| 654 | +#define SQLITE_SOURCE_ID "2011-10-29 19:25:08 5b82ec6fbbd2f4195ad06dd911de3817373ad5bf" | |
| 662 | 655 | |
| 663 | 656 | /* |
| 664 | 657 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | 658 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | 659 | ** |
| @@ -8792,10 +8785,11 @@ | ||
| 8792 | 8785 | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); |
| 8793 | 8786 | SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); |
| 8794 | 8787 | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); |
| 8795 | 8788 | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); |
| 8796 | 8789 | SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); |
| 8790 | +SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); | |
| 8797 | 8791 | |
| 8798 | 8792 | /* Functions used to truncate the database file. */ |
| 8799 | 8793 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); |
| 8800 | 8794 | |
| 8801 | 8795 | #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) |
| @@ -10189,12 +10183,13 @@ | ||
| 10189 | 10183 | IndexSample *aSample; /* Samples of the left-most key */ |
| 10190 | 10184 | #endif |
| 10191 | 10185 | }; |
| 10192 | 10186 | |
| 10193 | 10187 | /* |
| 10194 | -** Each sample stored in the sqlite_stat2 table is represented in memory | |
| 10195 | -** using a structure of this type. | |
| 10188 | +** Each sample stored in the sqlite_stat3 table is represented in memory | |
| 10189 | +** using a structure of this type. See documentation at the top of the | |
| 10190 | +** analyze.c source file for additional information. | |
| 10196 | 10191 | */ |
| 10197 | 10192 | struct IndexSample { |
| 10198 | 10193 | union { |
| 10199 | 10194 | char *z; /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */ |
| 10200 | 10195 | double r; /* Value if eType is SQLITE_FLOAT */ |
| @@ -12293,13 +12288,10 @@ | ||
| 12293 | 12288 | "ENABLE_OVERSIZE_CELL_CHECK", |
| 12294 | 12289 | #endif |
| 12295 | 12290 | #ifdef SQLITE_ENABLE_RTREE |
| 12296 | 12291 | "ENABLE_RTREE", |
| 12297 | 12292 | #endif |
| 12298 | -#ifdef SQLITE_ENABLE_STAT2 | |
| 12299 | - "ENABLE_STAT2", | |
| 12300 | -#endif | |
| 12301 | 12293 | #ifdef SQLITE_ENABLE_STAT3 |
| 12302 | 12294 | "ENABLE_STAT3", |
| 12303 | 12295 | #endif |
| 12304 | 12296 | #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY |
| 12305 | 12297 | "ENABLE_UNLOCK_NOTIFY", |
| @@ -12996,10 +12988,11 @@ | ||
| 12996 | 12988 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 12997 | 12989 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 12998 | 12990 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 12999 | 12991 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 13000 | 12992 | SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); |
| 12993 | +SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); | |
| 13001 | 12994 | |
| 13002 | 12995 | #ifdef SQLITE_OMIT_MERGE_SORT |
| 13003 | 12996 | # define sqlite3VdbeSorterInit(Y,Z) SQLITE_OK |
| 13004 | 12997 | # define sqlite3VdbeSorterWrite(X,Y,Z) SQLITE_OK |
| 13005 | 12998 | # define sqlite3VdbeSorterClose(Y,Z) |
| @@ -29483,17 +29476,17 @@ | ||
| 29483 | 29476 | ** "<path to db>-journal" |
| 29484 | 29477 | ** "<path to db>-wal" |
| 29485 | 29478 | ** "<path to db>-journalNN" |
| 29486 | 29479 | ** "<path to db>-walNN" |
| 29487 | 29480 | ** |
| 29488 | - ** where NN is a 4 digit decimal number. The NN naming schemes are | |
| 29481 | + ** where NN is a decimal number. The NN naming schemes are | |
| 29489 | 29482 | ** used by the test_multiplex.c module. |
| 29490 | 29483 | */ |
| 29491 | 29484 | nDb = sqlite3Strlen30(zPath) - 1; |
| 29492 | 29485 | #ifdef SQLITE_ENABLE_8_3_NAMES |
| 29493 | - while( nDb>0 && zPath[nDb]!='-' && zPath[nDb]!='/' ) nDb--; | |
| 29494 | - if( nDb==0 || zPath[nDb]=='/' ) return SQLITE_OK; | |
| 29486 | + while( nDb>0 && !sqlite3Isalnum(zPath[nDb]) ) nDb--; | |
| 29487 | + if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK; | |
| 29495 | 29488 | #else |
| 29496 | 29489 | while( zPath[nDb]!='-' ){ |
| 29497 | 29490 | assert( nDb>0 ); |
| 29498 | 29491 | assert( zPath[nDb]!='\n' ); |
| 29499 | 29492 | nDb--; |
| @@ -44163,10 +44156,17 @@ | ||
| 44163 | 44156 | pPager->pWal = 0; |
| 44164 | 44157 | } |
| 44165 | 44158 | } |
| 44166 | 44159 | return rc; |
| 44167 | 44160 | } |
| 44161 | + | |
| 44162 | +/* | |
| 44163 | +** Unless this is an in-memory or temporary database, clear the pager cache. | |
| 44164 | +*/ | |
| 44165 | +SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ | |
| 44166 | + if( !MEMDB && pPager->tempFile==0 ) pager_reset(pPager); | |
| 44167 | +} | |
| 44168 | 44168 | |
| 44169 | 44169 | #ifdef SQLITE_HAS_CODEC |
| 44170 | 44170 | /* |
| 44171 | 44171 | ** This function is called by the wal module when writing page content |
| 44172 | 44172 | ** into the log file. |
| @@ -57006,10 +57006,12 @@ | ||
| 57006 | 57006 | sqlite3_backup_step(&b, 0x7FFFFFFF); |
| 57007 | 57007 | assert( b.rc!=SQLITE_OK ); |
| 57008 | 57008 | rc = sqlite3_backup_finish(&b); |
| 57009 | 57009 | if( rc==SQLITE_OK ){ |
| 57010 | 57010 | pTo->pBt->pageSizeFixed = 0; |
| 57011 | + }else{ | |
| 57012 | + sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); | |
| 57011 | 57013 | } |
| 57012 | 57014 | |
| 57013 | 57015 | assert( sqlite3BtreeIsInTrans(pTo)==0 ); |
| 57014 | 57016 | sqlite3BtreeLeave(pFrom); |
| 57015 | 57017 | sqlite3BtreeLeave(pTo); |
| @@ -60480,10 +60482,34 @@ | ||
| 60480 | 60482 | ** in p->rc. This routine sets that result back to SQLITE_OK. |
| 60481 | 60483 | */ |
| 60482 | 60484 | SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){ |
| 60483 | 60485 | p->rc = SQLITE_OK; |
| 60484 | 60486 | } |
| 60487 | + | |
| 60488 | +/* | |
| 60489 | +** Copy the error code and error message belonging to the VDBE passed | |
| 60490 | +** as the first argument to its database handle (so that they will be | |
| 60491 | +** returned by calls to sqlite3_errcode() and sqlite3_errmsg()). | |
| 60492 | +** | |
| 60493 | +** This function does not clear the VDBE error code or message, just | |
| 60494 | +** copies them to the database handle. | |
| 60495 | +*/ | |
| 60496 | +SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ | |
| 60497 | + sqlite3 *db = p->db; | |
| 60498 | + int rc = p->rc; | |
| 60499 | + if( p->zErrMsg ){ | |
| 60500 | + u8 mallocFailed = db->mallocFailed; | |
| 60501 | + sqlite3BeginBenignMalloc(); | |
| 60502 | + sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); | |
| 60503 | + sqlite3EndBenignMalloc(); | |
| 60504 | + db->mallocFailed = mallocFailed; | |
| 60505 | + db->errCode = rc; | |
| 60506 | + }else{ | |
| 60507 | + sqlite3Error(db, rc, 0); | |
| 60508 | + } | |
| 60509 | + return rc; | |
| 60510 | +} | |
| 60485 | 60511 | |
| 60486 | 60512 | /* |
| 60487 | 60513 | ** Clean up a VDBE after execution but do not delete the VDBE just yet. |
| 60488 | 60514 | ** Write any error messages into *pzErrMsg. Return the result code. |
| 60489 | 60515 | ** |
| @@ -60508,22 +60534,13 @@ | ||
| 60508 | 60534 | ** and error message from the VDBE into the main database structure. But |
| 60509 | 60535 | ** if the VDBE has just been set to run but has not actually executed any |
| 60510 | 60536 | ** instructions yet, leave the main database error information unchanged. |
| 60511 | 60537 | */ |
| 60512 | 60538 | if( p->pc>=0 ){ |
| 60513 | - if( p->zErrMsg ){ | |
| 60514 | - sqlite3BeginBenignMalloc(); | |
| 60515 | - sqlite3ValueSetStr(db->pErr,-1,p->zErrMsg,SQLITE_UTF8,SQLITE_TRANSIENT); | |
| 60516 | - sqlite3EndBenignMalloc(); | |
| 60517 | - db->errCode = p->rc; | |
| 60518 | - sqlite3DbFree(db, p->zErrMsg); | |
| 60519 | - p->zErrMsg = 0; | |
| 60520 | - }else if( p->rc ){ | |
| 60521 | - sqlite3Error(db, p->rc, 0); | |
| 60522 | - }else{ | |
| 60523 | - sqlite3Error(db, SQLITE_OK, 0); | |
| 60524 | - } | |
| 60539 | + sqlite3VdbeTransferError(p); | |
| 60540 | + sqlite3DbFree(db, p->zErrMsg); | |
| 60541 | + p->zErrMsg = 0; | |
| 60525 | 60542 | if( p->runOnlyOnce ) p->expired = 1; |
| 60526 | 60543 | }else if( p->rc && p->expired ){ |
| 60527 | 60544 | /* The expired flag was set on the VDBE before the first call |
| 60528 | 60545 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 60529 | 60546 | ** called), set the database error in this case as well. |
| @@ -61865,11 +61882,11 @@ | ||
| 61865 | 61882 | if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ |
| 61866 | 61883 | /* If this statement was prepared using sqlite3_prepare_v2(), and an |
| 61867 | 61884 | ** error has occured, then return the error code in p->rc to the |
| 61868 | 61885 | ** caller. Set the error code in the database handle to the same value. |
| 61869 | 61886 | */ |
| 61870 | - rc = db->errCode = p->rc; | |
| 61887 | + rc = sqlite3VdbeTransferError(p); | |
| 61871 | 61888 | } |
| 61872 | 61889 | return (rc&db->errMask); |
| 61873 | 61890 | } |
| 61874 | 61891 | |
| 61875 | 61892 | /* |
| @@ -67765,13 +67782,12 @@ | ||
| 67765 | 67782 | |
| 67766 | 67783 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 67767 | 67784 | u.bn.pC = p->apCsr[pOp->p1]; |
| 67768 | 67785 | assert( u.bn.pC!=0 ); |
| 67769 | 67786 | u.bn.pCrsr = u.bn.pC->pCursor; |
| 67770 | - if( NEVER(u.bn.pCrsr==0) ){ | |
| 67771 | - u.bn.res = 1; | |
| 67772 | - }else{ | |
| 67787 | + u.bn.res = 0; | |
| 67788 | + if( ALWAYS(u.bn.pCrsr!=0) ){ | |
| 67773 | 67789 | rc = sqlite3BtreeLast(u.bn.pCrsr, &u.bn.res); |
| 67774 | 67790 | } |
| 67775 | 67791 | u.bn.pC->nullRow = (u8)u.bn.res; |
| 67776 | 67792 | u.bn.pC->deferredMoveto = 0; |
| 67777 | 67793 | u.bn.pC->rowidIsValid = 0; |
| @@ -77610,20 +77626,20 @@ | ||
| 77610 | 77626 | #ifndef SQLITE_OMIT_ANALYZE |
| 77611 | 77627 | |
| 77612 | 77628 | /* |
| 77613 | 77629 | ** This routine generates code that opens the sqlite_stat1 table for |
| 77614 | 77630 | ** writing with cursor iStatCur. If the library was built with the |
| 77615 | -** SQLITE_ENABLE_STAT2 macro defined, then the sqlite_stat2 table is | |
| 77631 | +** SQLITE_ENABLE_STAT3 macro defined, then the sqlite_stat3 table is | |
| 77616 | 77632 | ** opened for writing using cursor (iStatCur+1) |
| 77617 | 77633 | ** |
| 77618 | 77634 | ** If the sqlite_stat1 tables does not previously exist, it is created. |
| 77619 | -** Similarly, if the sqlite_stat2 table does not exist and the library | |
| 77620 | -** is compiled with SQLITE_ENABLE_STAT2 defined, it is created. | |
| 77635 | +** Similarly, if the sqlite_stat3 table does not exist and the library | |
| 77636 | +** is compiled with SQLITE_ENABLE_STAT3 defined, it is created. | |
| 77621 | 77637 | ** |
| 77622 | 77638 | ** Argument zWhere may be a pointer to a buffer containing a table name, |
| 77623 | 77639 | ** or it may be a NULL pointer. If it is not NULL, then all entries in |
| 77624 | -** the sqlite_stat1 and (if applicable) sqlite_stat2 tables associated | |
| 77640 | +** the sqlite_stat1 and (if applicable) sqlite_stat3 tables associated | |
| 77625 | 77641 | ** with the named table are deleted. If zWhere==0, then code is generated |
| 77626 | 77642 | ** to delete all stat table entries. |
| 77627 | 77643 | */ |
| 77628 | 77644 | static void openStatTable( |
| 77629 | 77645 | Parse *pParse, /* Parsing context */ |
| @@ -81404,31 +81420,28 @@ | ||
| 81404 | 81420 | } |
| 81405 | 81421 | #endif |
| 81406 | 81422 | } |
| 81407 | 81423 | |
| 81408 | 81424 | /* |
| 81409 | -** Remove entries from the sqlite_stat1 and sqlite_stat2 tables | |
| 81425 | +** Remove entries from the sqlite_statN tables (for N in (1,2,3)) | |
| 81410 | 81426 | ** after a DROP INDEX or DROP TABLE command. |
| 81411 | 81427 | */ |
| 81412 | 81428 | static void sqlite3ClearStatTables( |
| 81413 | 81429 | Parse *pParse, /* The parsing context */ |
| 81414 | 81430 | int iDb, /* The database number */ |
| 81415 | 81431 | const char *zType, /* "idx" or "tbl" */ |
| 81416 | 81432 | const char *zName /* Name of index or table */ |
| 81417 | 81433 | ){ |
| 81418 | - static const char *azStatTab[] = { | |
| 81419 | - "sqlite_stat1", | |
| 81420 | - "sqlite_stat2", | |
| 81421 | - "sqlite_stat3", | |
| 81422 | - }; | |
| 81423 | 81434 | int i; |
| 81424 | 81435 | const char *zDbName = pParse->db->aDb[iDb].zName; |
| 81425 | - for(i=0; i<ArraySize(azStatTab); i++){ | |
| 81426 | - if( sqlite3FindTable(pParse->db, azStatTab[i], zDbName) ){ | |
| 81436 | + for(i=1; i<=3; i++){ | |
| 81437 | + char zTab[24]; | |
| 81438 | + sqlite3_snprintf(sizeof(zTab),zTab,"sqlite_stat%d",i); | |
| 81439 | + if( sqlite3FindTable(pParse->db, zTab, zDbName) ){ | |
| 81427 | 81440 | sqlite3NestedParse(pParse, |
| 81428 | 81441 | "DELETE FROM %Q.%s WHERE %s=%Q", |
| 81429 | - zDbName, azStatTab[i], zType, zName | |
| 81442 | + zDbName, zTab, zType, zName | |
| 81430 | 81443 | ); |
| 81431 | 81444 | } |
| 81432 | 81445 | } |
| 81433 | 81446 | } |
| 81434 | 81447 | |
| @@ -89250,12 +89263,14 @@ | ||
| 89250 | 89263 | int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); |
| 89251 | 89264 | int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); |
| 89252 | 89265 | int (*busy_timeout)(sqlite3*,int ms); |
| 89253 | 89266 | int (*changes)(sqlite3*); |
| 89254 | 89267 | int (*close)(sqlite3*); |
| 89255 | - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*)); | |
| 89256 | - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*)); | |
| 89268 | + int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, | |
| 89269 | + int eTextRep,const char*)); | |
| 89270 | + int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, | |
| 89271 | + int eTextRep,const void*)); | |
| 89257 | 89272 | const void * (*column_blob)(sqlite3_stmt*,int iCol); |
| 89258 | 89273 | int (*column_bytes)(sqlite3_stmt*,int iCol); |
| 89259 | 89274 | int (*column_bytes16)(sqlite3_stmt*,int iCol); |
| 89260 | 89275 | int (*column_count)(sqlite3_stmt*pStmt); |
| 89261 | 89276 | const char * (*column_database_name)(sqlite3_stmt*,int); |
| @@ -89276,14 +89291,22 @@ | ||
| 89276 | 89291 | int (*column_type)(sqlite3_stmt*,int iCol); |
| 89277 | 89292 | sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); |
| 89278 | 89293 | void * (*commit_hook)(sqlite3*,int(*)(void*),void*); |
| 89279 | 89294 | int (*complete)(const char*sql); |
| 89280 | 89295 | int (*complete16)(const void*sql); |
| 89281 | - int (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*)); | |
| 89282 | - int (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*)); | |
| 89283 | - int (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*)); | |
| 89284 | - int (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*)); | |
| 89296 | + int (*create_collation)(sqlite3*,const char*,int,void*, | |
| 89297 | + int(*)(void*,int,const void*,int,const void*)); | |
| 89298 | + int (*create_collation16)(sqlite3*,const void*,int,void*, | |
| 89299 | + int(*)(void*,int,const void*,int,const void*)); | |
| 89300 | + int (*create_function)(sqlite3*,const char*,int,int,void*, | |
| 89301 | + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), | |
| 89302 | + void (*xStep)(sqlite3_context*,int,sqlite3_value**), | |
| 89303 | + void (*xFinal)(sqlite3_context*)); | |
| 89304 | + int (*create_function16)(sqlite3*,const void*,int,int,void*, | |
| 89305 | + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), | |
| 89306 | + void (*xStep)(sqlite3_context*,int,sqlite3_value**), | |
| 89307 | + void (*xFinal)(sqlite3_context*)); | |
| 89285 | 89308 | int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); |
| 89286 | 89309 | int (*data_count)(sqlite3_stmt*pStmt); |
| 89287 | 89310 | sqlite3 * (*db_handle)(sqlite3_stmt*); |
| 89288 | 89311 | int (*declare_vtab)(sqlite3*,const char*); |
| 89289 | 89312 | int (*enable_shared_cache)(int); |
| @@ -89324,20 +89347,23 @@ | ||
| 89324 | 89347 | void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89325 | 89348 | void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89326 | 89349 | void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89327 | 89350 | void (*result_value)(sqlite3_context*,sqlite3_value*); |
| 89328 | 89351 | void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); |
| 89329 | - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*); | |
| 89352 | + int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, | |
| 89353 | + const char*,const char*),void*); | |
| 89330 | 89354 | void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); |
| 89331 | 89355 | char * (*snprintf)(int,char*,const char*,...); |
| 89332 | 89356 | int (*step)(sqlite3_stmt*); |
| 89333 | - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*); | |
| 89357 | + int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, | |
| 89358 | + char const**,char const**,int*,int*,int*); | |
| 89334 | 89359 | void (*thread_cleanup)(void); |
| 89335 | 89360 | int (*total_changes)(sqlite3*); |
| 89336 | 89361 | void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); |
| 89337 | 89362 | int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); |
| 89338 | - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*); | |
| 89363 | + void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, | |
| 89364 | + sqlite_int64),void*); | |
| 89339 | 89365 | void * (*user_data)(sqlite3_context*); |
| 89340 | 89366 | const void * (*value_blob)(sqlite3_value*); |
| 89341 | 89367 | int (*value_bytes)(sqlite3_value*); |
| 89342 | 89368 | int (*value_bytes16)(sqlite3_value*); |
| 89343 | 89369 | double (*value_double)(sqlite3_value*); |
| @@ -89355,19 +89381,23 @@ | ||
| 89355 | 89381 | /* Added by 3.3.13 */ |
| 89356 | 89382 | int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); |
| 89357 | 89383 | int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); |
| 89358 | 89384 | int (*clear_bindings)(sqlite3_stmt*); |
| 89359 | 89385 | /* Added by 3.4.1 */ |
| 89360 | - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *)); | |
| 89386 | + int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, | |
| 89387 | + void (*xDestroy)(void *)); | |
| 89361 | 89388 | /* Added by 3.5.0 */ |
| 89362 | 89389 | int (*bind_zeroblob)(sqlite3_stmt*,int,int); |
| 89363 | 89390 | int (*blob_bytes)(sqlite3_blob*); |
| 89364 | 89391 | int (*blob_close)(sqlite3_blob*); |
| 89365 | - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**); | |
| 89392 | + int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, | |
| 89393 | + int,sqlite3_blob**); | |
| 89366 | 89394 | int (*blob_read)(sqlite3_blob*,void*,int,int); |
| 89367 | 89395 | int (*blob_write)(sqlite3_blob*,const void*,int,int); |
| 89368 | - int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*)); | |
| 89396 | + int (*create_collation_v2)(sqlite3*,const char*,int,void*, | |
| 89397 | + int(*)(void*,int,const void*,int,const void*), | |
| 89398 | + void(*)(void*)); | |
| 89369 | 89399 | int (*file_control)(sqlite3*,const char*,int,void*); |
| 89370 | 89400 | sqlite3_int64 (*memory_highwater)(int); |
| 89371 | 89401 | sqlite3_int64 (*memory_used)(void); |
| 89372 | 89402 | sqlite3_mutex *(*mutex_alloc)(int); |
| 89373 | 89403 | void (*mutex_enter)(sqlite3_mutex*); |
| @@ -89399,11 +89429,15 @@ | ||
| 89399 | 89429 | int (*backup_pagecount)(sqlite3_backup*); |
| 89400 | 89430 | int (*backup_remaining)(sqlite3_backup*); |
| 89401 | 89431 | int (*backup_step)(sqlite3_backup*,int); |
| 89402 | 89432 | const char *(*compileoption_get)(int); |
| 89403 | 89433 | int (*compileoption_used)(const char*); |
| 89404 | - int (*create_function_v2)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*),void(*xDestroy)(void*)); | |
| 89434 | + int (*create_function_v2)(sqlite3*,const char*,int,int,void*, | |
| 89435 | + void (*xFunc)(sqlite3_context*,int,sqlite3_value**), | |
| 89436 | + void (*xStep)(sqlite3_context*,int,sqlite3_value**), | |
| 89437 | + void (*xFinal)(sqlite3_context*), | |
| 89438 | + void(*xDestroy)(void*)); | |
| 89405 | 89439 | int (*db_config)(sqlite3*,int,...); |
| 89406 | 89440 | sqlite3_mutex *(*db_mutex)(sqlite3*); |
| 89407 | 89441 | int (*db_status)(sqlite3*,int,int*,int*,int); |
| 89408 | 89442 | int (*extended_errcode)(sqlite3*); |
| 89409 | 89443 | void (*log)(int,const char*,...); |
| @@ -100485,11 +100519,11 @@ | ||
| 100485 | 100519 | if( db->aVTrans ){ |
| 100486 | 100520 | int i; |
| 100487 | 100521 | for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){ |
| 100488 | 100522 | VTable *pVTab = db->aVTrans[i]; |
| 100489 | 100523 | const sqlite3_module *pMod = pVTab->pMod->pModule; |
| 100490 | - if( pMod->iVersion>=2 ){ | |
| 100524 | + if( pVTab->pVtab && pMod->iVersion>=2 ){ | |
| 100491 | 100525 | int (*xMethod)(sqlite3_vtab *, int); |
| 100492 | 100526 | switch( op ){ |
| 100493 | 100527 | case SAVEPOINT_BEGIN: |
| 100494 | 100528 | xMethod = pMod->xSavepoint; |
| 100495 | 100529 | pVTab->iSavepoint = iSavepoint+1; |
| @@ -100500,11 +100534,11 @@ | ||
| 100500 | 100534 | default: |
| 100501 | 100535 | xMethod = pMod->xRelease; |
| 100502 | 100536 | break; |
| 100503 | 100537 | } |
| 100504 | 100538 | if( xMethod && pVTab->iSavepoint>iSavepoint ){ |
| 100505 | - rc = xMethod(db->aVTrans[i]->pVtab, iSavepoint); | |
| 100539 | + rc = xMethod(pVTab->pVtab, iSavepoint); | |
| 100506 | 100540 | } |
| 100507 | 100541 | } |
| 100508 | 100542 | } |
| 100509 | 100543 | } |
| 100510 | 100544 | return rc; |
| @@ -101367,11 +101401,11 @@ | ||
| 101367 | 101401 | int iCol = pRight->iColumn; |
| 101368 | 101402 | pVal = sqlite3VdbeGetValue(pReprepare, iCol, SQLITE_AFF_NONE); |
| 101369 | 101403 | if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ |
| 101370 | 101404 | z = (char *)sqlite3_value_text(pVal); |
| 101371 | 101405 | } |
| 101372 | - sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); /* IMP: R-31526-56213 */ | |
| 101406 | + sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); | |
| 101373 | 101407 | assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); |
| 101374 | 101408 | }else if( op==TK_STRING ){ |
| 101375 | 101409 | z = pRight->u.zToken; |
| 101376 | 101410 | } |
| 101377 | 101411 | if( z ){ |
| @@ -101385,11 +101419,11 @@ | ||
| 101385 | 101419 | pPrefix = sqlite3Expr(db, TK_STRING, z); |
| 101386 | 101420 | if( pPrefix ) pPrefix->u.zToken[cnt] = 0; |
| 101387 | 101421 | *ppPrefix = pPrefix; |
| 101388 | 101422 | if( op==TK_VARIABLE ){ |
| 101389 | 101423 | Vdbe *v = pParse->pVdbe; |
| 101390 | - sqlite3VdbeSetVarmask(v, pRight->iColumn); /* IMP: R-31526-56213 */ | |
| 101424 | + sqlite3VdbeSetVarmask(v, pRight->iColumn); | |
| 101391 | 101425 | if( *pisComplete && pRight->u.zToken[1] ){ |
| 101392 | 101426 | /* If the rhs of the LIKE expression is a variable, and the current |
| 101393 | 101427 | ** value of the variable means there is no need to invoke the LIKE |
| 101394 | 101428 | ** function, then no OP_Variable will be added to the program. |
| 101395 | 101429 | ** This causes problems for the sqlite3_bind_parameter_name() |
| @@ -103299,11 +103333,11 @@ | ||
| 103299 | 103333 | ){ |
| 103300 | 103334 | if( pExpr->op==TK_VARIABLE |
| 103301 | 103335 | || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) |
| 103302 | 103336 | ){ |
| 103303 | 103337 | int iVar = pExpr->iColumn; |
| 103304 | - sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); /* IMP: R-31526-56213 */ | |
| 103338 | + sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); | |
| 103305 | 103339 | *pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff); |
| 103306 | 103340 | return SQLITE_OK; |
| 103307 | 103341 | } |
| 103308 | 103342 | return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp); |
| 103309 | 103343 | } |
| @@ -103829,11 +103863,11 @@ | ||
| 103829 | 103863 | ** a table or index. The actual times can vary, with the size of |
| 103830 | 103864 | ** records being an important factor. Both moves and searches are |
| 103831 | 103865 | ** slower with larger records, presumably because fewer records fit |
| 103832 | 103866 | ** on one page and hence more pages have to be fetched. |
| 103833 | 103867 | ** |
| 103834 | - ** The ANALYZE command and the sqlite_stat1 and sqlite_stat2 tables do | |
| 103868 | + ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do | |
| 103835 | 103869 | ** not give us data on the relative sizes of table and index records. |
| 103836 | 103870 | ** So this computation assumes table records are about twice as big |
| 103837 | 103871 | ** as index records |
| 103838 | 103872 | */ |
| 103839 | 103873 | if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ |
| 103840 | 103874 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -314,17 +314,10 @@ | |
| 314 | #endif |
| 315 | #ifdef HAVE_INTTYPES_H |
| 316 | #include <inttypes.h> |
| 317 | #endif |
| 318 | |
| 319 | /* |
| 320 | ** The number of samples of an index that SQLite takes in order to |
| 321 | ** construct a histogram of the table content when running ANALYZE |
| 322 | ** and with SQLITE_ENABLE_STAT2 |
| 323 | */ |
| 324 | #define SQLITE_INDEX_SAMPLES 10 |
| 325 | |
| 326 | /* |
| 327 | ** The following macros are used to cast pointers to integers and |
| 328 | ** integers to pointers. The way you do this varies from one compiler |
| 329 | ** to the next, so we have developed the following set of #if statements |
| 330 | ** to generate appropriate macros for a wide range of compilers. |
| @@ -656,11 +649,11 @@ | |
| 656 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 657 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 658 | */ |
| 659 | #define SQLITE_VERSION "3.7.9" |
| 660 | #define SQLITE_VERSION_NUMBER 3007009 |
| 661 | #define SQLITE_SOURCE_ID "2011-10-20 00:55:54 4344483f7d7f64dffadde0053e6c745948db9486" |
| 662 | |
| 663 | /* |
| 664 | ** CAPI3REF: Run-Time Library Version Numbers |
| 665 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 666 | ** |
| @@ -8792,10 +8785,11 @@ | |
| 8792 | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); |
| 8793 | SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); |
| 8794 | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); |
| 8795 | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); |
| 8796 | SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); |
| 8797 | |
| 8798 | /* Functions used to truncate the database file. */ |
| 8799 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); |
| 8800 | |
| 8801 | #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) |
| @@ -10189,12 +10183,13 @@ | |
| 10189 | IndexSample *aSample; /* Samples of the left-most key */ |
| 10190 | #endif |
| 10191 | }; |
| 10192 | |
| 10193 | /* |
| 10194 | ** Each sample stored in the sqlite_stat2 table is represented in memory |
| 10195 | ** using a structure of this type. |
| 10196 | */ |
| 10197 | struct IndexSample { |
| 10198 | union { |
| 10199 | char *z; /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */ |
| 10200 | double r; /* Value if eType is SQLITE_FLOAT */ |
| @@ -12293,13 +12288,10 @@ | |
| 12293 | "ENABLE_OVERSIZE_CELL_CHECK", |
| 12294 | #endif |
| 12295 | #ifdef SQLITE_ENABLE_RTREE |
| 12296 | "ENABLE_RTREE", |
| 12297 | #endif |
| 12298 | #ifdef SQLITE_ENABLE_STAT2 |
| 12299 | "ENABLE_STAT2", |
| 12300 | #endif |
| 12301 | #ifdef SQLITE_ENABLE_STAT3 |
| 12302 | "ENABLE_STAT3", |
| 12303 | #endif |
| 12304 | #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY |
| 12305 | "ENABLE_UNLOCK_NOTIFY", |
| @@ -12996,10 +12988,11 @@ | |
| 12996 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 12997 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 12998 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 12999 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 13000 | SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); |
| 13001 | |
| 13002 | #ifdef SQLITE_OMIT_MERGE_SORT |
| 13003 | # define sqlite3VdbeSorterInit(Y,Z) SQLITE_OK |
| 13004 | # define sqlite3VdbeSorterWrite(X,Y,Z) SQLITE_OK |
| 13005 | # define sqlite3VdbeSorterClose(Y,Z) |
| @@ -29483,17 +29476,17 @@ | |
| 29483 | ** "<path to db>-journal" |
| 29484 | ** "<path to db>-wal" |
| 29485 | ** "<path to db>-journalNN" |
| 29486 | ** "<path to db>-walNN" |
| 29487 | ** |
| 29488 | ** where NN is a 4 digit decimal number. The NN naming schemes are |
| 29489 | ** used by the test_multiplex.c module. |
| 29490 | */ |
| 29491 | nDb = sqlite3Strlen30(zPath) - 1; |
| 29492 | #ifdef SQLITE_ENABLE_8_3_NAMES |
| 29493 | while( nDb>0 && zPath[nDb]!='-' && zPath[nDb]!='/' ) nDb--; |
| 29494 | if( nDb==0 || zPath[nDb]=='/' ) return SQLITE_OK; |
| 29495 | #else |
| 29496 | while( zPath[nDb]!='-' ){ |
| 29497 | assert( nDb>0 ); |
| 29498 | assert( zPath[nDb]!='\n' ); |
| 29499 | nDb--; |
| @@ -44163,10 +44156,17 @@ | |
| 44163 | pPager->pWal = 0; |
| 44164 | } |
| 44165 | } |
| 44166 | return rc; |
| 44167 | } |
| 44168 | |
| 44169 | #ifdef SQLITE_HAS_CODEC |
| 44170 | /* |
| 44171 | ** This function is called by the wal module when writing page content |
| 44172 | ** into the log file. |
| @@ -57006,10 +57006,12 @@ | |
| 57006 | sqlite3_backup_step(&b, 0x7FFFFFFF); |
| 57007 | assert( b.rc!=SQLITE_OK ); |
| 57008 | rc = sqlite3_backup_finish(&b); |
| 57009 | if( rc==SQLITE_OK ){ |
| 57010 | pTo->pBt->pageSizeFixed = 0; |
| 57011 | } |
| 57012 | |
| 57013 | assert( sqlite3BtreeIsInTrans(pTo)==0 ); |
| 57014 | sqlite3BtreeLeave(pFrom); |
| 57015 | sqlite3BtreeLeave(pTo); |
| @@ -60480,10 +60482,34 @@ | |
| 60480 | ** in p->rc. This routine sets that result back to SQLITE_OK. |
| 60481 | */ |
| 60482 | SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){ |
| 60483 | p->rc = SQLITE_OK; |
| 60484 | } |
| 60485 | |
| 60486 | /* |
| 60487 | ** Clean up a VDBE after execution but do not delete the VDBE just yet. |
| 60488 | ** Write any error messages into *pzErrMsg. Return the result code. |
| 60489 | ** |
| @@ -60508,22 +60534,13 @@ | |
| 60508 | ** and error message from the VDBE into the main database structure. But |
| 60509 | ** if the VDBE has just been set to run but has not actually executed any |
| 60510 | ** instructions yet, leave the main database error information unchanged. |
| 60511 | */ |
| 60512 | if( p->pc>=0 ){ |
| 60513 | if( p->zErrMsg ){ |
| 60514 | sqlite3BeginBenignMalloc(); |
| 60515 | sqlite3ValueSetStr(db->pErr,-1,p->zErrMsg,SQLITE_UTF8,SQLITE_TRANSIENT); |
| 60516 | sqlite3EndBenignMalloc(); |
| 60517 | db->errCode = p->rc; |
| 60518 | sqlite3DbFree(db, p->zErrMsg); |
| 60519 | p->zErrMsg = 0; |
| 60520 | }else if( p->rc ){ |
| 60521 | sqlite3Error(db, p->rc, 0); |
| 60522 | }else{ |
| 60523 | sqlite3Error(db, SQLITE_OK, 0); |
| 60524 | } |
| 60525 | if( p->runOnlyOnce ) p->expired = 1; |
| 60526 | }else if( p->rc && p->expired ){ |
| 60527 | /* The expired flag was set on the VDBE before the first call |
| 60528 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 60529 | ** called), set the database error in this case as well. |
| @@ -61865,11 +61882,11 @@ | |
| 61865 | if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ |
| 61866 | /* If this statement was prepared using sqlite3_prepare_v2(), and an |
| 61867 | ** error has occured, then return the error code in p->rc to the |
| 61868 | ** caller. Set the error code in the database handle to the same value. |
| 61869 | */ |
| 61870 | rc = db->errCode = p->rc; |
| 61871 | } |
| 61872 | return (rc&db->errMask); |
| 61873 | } |
| 61874 | |
| 61875 | /* |
| @@ -67765,13 +67782,12 @@ | |
| 67765 | |
| 67766 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 67767 | u.bn.pC = p->apCsr[pOp->p1]; |
| 67768 | assert( u.bn.pC!=0 ); |
| 67769 | u.bn.pCrsr = u.bn.pC->pCursor; |
| 67770 | if( NEVER(u.bn.pCrsr==0) ){ |
| 67771 | u.bn.res = 1; |
| 67772 | }else{ |
| 67773 | rc = sqlite3BtreeLast(u.bn.pCrsr, &u.bn.res); |
| 67774 | } |
| 67775 | u.bn.pC->nullRow = (u8)u.bn.res; |
| 67776 | u.bn.pC->deferredMoveto = 0; |
| 67777 | u.bn.pC->rowidIsValid = 0; |
| @@ -77610,20 +77626,20 @@ | |
| 77610 | #ifndef SQLITE_OMIT_ANALYZE |
| 77611 | |
| 77612 | /* |
| 77613 | ** This routine generates code that opens the sqlite_stat1 table for |
| 77614 | ** writing with cursor iStatCur. If the library was built with the |
| 77615 | ** SQLITE_ENABLE_STAT2 macro defined, then the sqlite_stat2 table is |
| 77616 | ** opened for writing using cursor (iStatCur+1) |
| 77617 | ** |
| 77618 | ** If the sqlite_stat1 tables does not previously exist, it is created. |
| 77619 | ** Similarly, if the sqlite_stat2 table does not exist and the library |
| 77620 | ** is compiled with SQLITE_ENABLE_STAT2 defined, it is created. |
| 77621 | ** |
| 77622 | ** Argument zWhere may be a pointer to a buffer containing a table name, |
| 77623 | ** or it may be a NULL pointer. If it is not NULL, then all entries in |
| 77624 | ** the sqlite_stat1 and (if applicable) sqlite_stat2 tables associated |
| 77625 | ** with the named table are deleted. If zWhere==0, then code is generated |
| 77626 | ** to delete all stat table entries. |
| 77627 | */ |
| 77628 | static void openStatTable( |
| 77629 | Parse *pParse, /* Parsing context */ |
| @@ -81404,31 +81420,28 @@ | |
| 81404 | } |
| 81405 | #endif |
| 81406 | } |
| 81407 | |
| 81408 | /* |
| 81409 | ** Remove entries from the sqlite_stat1 and sqlite_stat2 tables |
| 81410 | ** after a DROP INDEX or DROP TABLE command. |
| 81411 | */ |
| 81412 | static void sqlite3ClearStatTables( |
| 81413 | Parse *pParse, /* The parsing context */ |
| 81414 | int iDb, /* The database number */ |
| 81415 | const char *zType, /* "idx" or "tbl" */ |
| 81416 | const char *zName /* Name of index or table */ |
| 81417 | ){ |
| 81418 | static const char *azStatTab[] = { |
| 81419 | "sqlite_stat1", |
| 81420 | "sqlite_stat2", |
| 81421 | "sqlite_stat3", |
| 81422 | }; |
| 81423 | int i; |
| 81424 | const char *zDbName = pParse->db->aDb[iDb].zName; |
| 81425 | for(i=0; i<ArraySize(azStatTab); i++){ |
| 81426 | if( sqlite3FindTable(pParse->db, azStatTab[i], zDbName) ){ |
| 81427 | sqlite3NestedParse(pParse, |
| 81428 | "DELETE FROM %Q.%s WHERE %s=%Q", |
| 81429 | zDbName, azStatTab[i], zType, zName |
| 81430 | ); |
| 81431 | } |
| 81432 | } |
| 81433 | } |
| 81434 | |
| @@ -89250,12 +89263,14 @@ | |
| 89250 | int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); |
| 89251 | int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); |
| 89252 | int (*busy_timeout)(sqlite3*,int ms); |
| 89253 | int (*changes)(sqlite3*); |
| 89254 | int (*close)(sqlite3*); |
| 89255 | int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const char*)); |
| 89256 | int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*,int eTextRep,const void*)); |
| 89257 | const void * (*column_blob)(sqlite3_stmt*,int iCol); |
| 89258 | int (*column_bytes)(sqlite3_stmt*,int iCol); |
| 89259 | int (*column_bytes16)(sqlite3_stmt*,int iCol); |
| 89260 | int (*column_count)(sqlite3_stmt*pStmt); |
| 89261 | const char * (*column_database_name)(sqlite3_stmt*,int); |
| @@ -89276,14 +89291,22 @@ | |
| 89276 | int (*column_type)(sqlite3_stmt*,int iCol); |
| 89277 | sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); |
| 89278 | void * (*commit_hook)(sqlite3*,int(*)(void*),void*); |
| 89279 | int (*complete)(const char*sql); |
| 89280 | int (*complete16)(const void*sql); |
| 89281 | int (*create_collation)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*)); |
| 89282 | int (*create_collation16)(sqlite3*,const void*,int,void*,int(*)(void*,int,const void*,int,const void*)); |
| 89283 | int (*create_function)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*)); |
| 89284 | int (*create_function16)(sqlite3*,const void*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*)); |
| 89285 | int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); |
| 89286 | int (*data_count)(sqlite3_stmt*pStmt); |
| 89287 | sqlite3 * (*db_handle)(sqlite3_stmt*); |
| 89288 | int (*declare_vtab)(sqlite3*,const char*); |
| 89289 | int (*enable_shared_cache)(int); |
| @@ -89324,20 +89347,23 @@ | |
| 89324 | void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89325 | void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89326 | void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89327 | void (*result_value)(sqlite3_context*,sqlite3_value*); |
| 89328 | void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); |
| 89329 | int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,const char*,const char*),void*); |
| 89330 | void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); |
| 89331 | char * (*snprintf)(int,char*,const char*,...); |
| 89332 | int (*step)(sqlite3_stmt*); |
| 89333 | int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,char const**,char const**,int*,int*,int*); |
| 89334 | void (*thread_cleanup)(void); |
| 89335 | int (*total_changes)(sqlite3*); |
| 89336 | void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); |
| 89337 | int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); |
| 89338 | void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*,sqlite_int64),void*); |
| 89339 | void * (*user_data)(sqlite3_context*); |
| 89340 | const void * (*value_blob)(sqlite3_value*); |
| 89341 | int (*value_bytes)(sqlite3_value*); |
| 89342 | int (*value_bytes16)(sqlite3_value*); |
| 89343 | double (*value_double)(sqlite3_value*); |
| @@ -89355,19 +89381,23 @@ | |
| 89355 | /* Added by 3.3.13 */ |
| 89356 | int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); |
| 89357 | int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); |
| 89358 | int (*clear_bindings)(sqlite3_stmt*); |
| 89359 | /* Added by 3.4.1 */ |
| 89360 | int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*,void (*xDestroy)(void *)); |
| 89361 | /* Added by 3.5.0 */ |
| 89362 | int (*bind_zeroblob)(sqlite3_stmt*,int,int); |
| 89363 | int (*blob_bytes)(sqlite3_blob*); |
| 89364 | int (*blob_close)(sqlite3_blob*); |
| 89365 | int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64,int,sqlite3_blob**); |
| 89366 | int (*blob_read)(sqlite3_blob*,void*,int,int); |
| 89367 | int (*blob_write)(sqlite3_blob*,const void*,int,int); |
| 89368 | int (*create_collation_v2)(sqlite3*,const char*,int,void*,int(*)(void*,int,const void*,int,const void*),void(*)(void*)); |
| 89369 | int (*file_control)(sqlite3*,const char*,int,void*); |
| 89370 | sqlite3_int64 (*memory_highwater)(int); |
| 89371 | sqlite3_int64 (*memory_used)(void); |
| 89372 | sqlite3_mutex *(*mutex_alloc)(int); |
| 89373 | void (*mutex_enter)(sqlite3_mutex*); |
| @@ -89399,11 +89429,15 @@ | |
| 89399 | int (*backup_pagecount)(sqlite3_backup*); |
| 89400 | int (*backup_remaining)(sqlite3_backup*); |
| 89401 | int (*backup_step)(sqlite3_backup*,int); |
| 89402 | const char *(*compileoption_get)(int); |
| 89403 | int (*compileoption_used)(const char*); |
| 89404 | int (*create_function_v2)(sqlite3*,const char*,int,int,void*,void (*xFunc)(sqlite3_context*,int,sqlite3_value**),void (*xStep)(sqlite3_context*,int,sqlite3_value**),void (*xFinal)(sqlite3_context*),void(*xDestroy)(void*)); |
| 89405 | int (*db_config)(sqlite3*,int,...); |
| 89406 | sqlite3_mutex *(*db_mutex)(sqlite3*); |
| 89407 | int (*db_status)(sqlite3*,int,int*,int*,int); |
| 89408 | int (*extended_errcode)(sqlite3*); |
| 89409 | void (*log)(int,const char*,...); |
| @@ -100485,11 +100519,11 @@ | |
| 100485 | if( db->aVTrans ){ |
| 100486 | int i; |
| 100487 | for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){ |
| 100488 | VTable *pVTab = db->aVTrans[i]; |
| 100489 | const sqlite3_module *pMod = pVTab->pMod->pModule; |
| 100490 | if( pMod->iVersion>=2 ){ |
| 100491 | int (*xMethod)(sqlite3_vtab *, int); |
| 100492 | switch( op ){ |
| 100493 | case SAVEPOINT_BEGIN: |
| 100494 | xMethod = pMod->xSavepoint; |
| 100495 | pVTab->iSavepoint = iSavepoint+1; |
| @@ -100500,11 +100534,11 @@ | |
| 100500 | default: |
| 100501 | xMethod = pMod->xRelease; |
| 100502 | break; |
| 100503 | } |
| 100504 | if( xMethod && pVTab->iSavepoint>iSavepoint ){ |
| 100505 | rc = xMethod(db->aVTrans[i]->pVtab, iSavepoint); |
| 100506 | } |
| 100507 | } |
| 100508 | } |
| 100509 | } |
| 100510 | return rc; |
| @@ -101367,11 +101401,11 @@ | |
| 101367 | int iCol = pRight->iColumn; |
| 101368 | pVal = sqlite3VdbeGetValue(pReprepare, iCol, SQLITE_AFF_NONE); |
| 101369 | if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ |
| 101370 | z = (char *)sqlite3_value_text(pVal); |
| 101371 | } |
| 101372 | sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); /* IMP: R-31526-56213 */ |
| 101373 | assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); |
| 101374 | }else if( op==TK_STRING ){ |
| 101375 | z = pRight->u.zToken; |
| 101376 | } |
| 101377 | if( z ){ |
| @@ -101385,11 +101419,11 @@ | |
| 101385 | pPrefix = sqlite3Expr(db, TK_STRING, z); |
| 101386 | if( pPrefix ) pPrefix->u.zToken[cnt] = 0; |
| 101387 | *ppPrefix = pPrefix; |
| 101388 | if( op==TK_VARIABLE ){ |
| 101389 | Vdbe *v = pParse->pVdbe; |
| 101390 | sqlite3VdbeSetVarmask(v, pRight->iColumn); /* IMP: R-31526-56213 */ |
| 101391 | if( *pisComplete && pRight->u.zToken[1] ){ |
| 101392 | /* If the rhs of the LIKE expression is a variable, and the current |
| 101393 | ** value of the variable means there is no need to invoke the LIKE |
| 101394 | ** function, then no OP_Variable will be added to the program. |
| 101395 | ** This causes problems for the sqlite3_bind_parameter_name() |
| @@ -103299,11 +103333,11 @@ | |
| 103299 | ){ |
| 103300 | if( pExpr->op==TK_VARIABLE |
| 103301 | || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) |
| 103302 | ){ |
| 103303 | int iVar = pExpr->iColumn; |
| 103304 | sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); /* IMP: R-31526-56213 */ |
| 103305 | *pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff); |
| 103306 | return SQLITE_OK; |
| 103307 | } |
| 103308 | return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp); |
| 103309 | } |
| @@ -103829,11 +103863,11 @@ | |
| 103829 | ** a table or index. The actual times can vary, with the size of |
| 103830 | ** records being an important factor. Both moves and searches are |
| 103831 | ** slower with larger records, presumably because fewer records fit |
| 103832 | ** on one page and hence more pages have to be fetched. |
| 103833 | ** |
| 103834 | ** The ANALYZE command and the sqlite_stat1 and sqlite_stat2 tables do |
| 103835 | ** not give us data on the relative sizes of table and index records. |
| 103836 | ** So this computation assumes table records are about twice as big |
| 103837 | ** as index records |
| 103838 | */ |
| 103839 | if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ |
| 103840 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -314,17 +314,10 @@ | |
| 314 | #endif |
| 315 | #ifdef HAVE_INTTYPES_H |
| 316 | #include <inttypes.h> |
| 317 | #endif |
| 318 | |
| 319 | /* |
| 320 | ** The following macros are used to cast pointers to integers and |
| 321 | ** integers to pointers. The way you do this varies from one compiler |
| 322 | ** to the next, so we have developed the following set of #if statements |
| 323 | ** to generate appropriate macros for a wide range of compilers. |
| @@ -656,11 +649,11 @@ | |
| 649 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 650 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 651 | */ |
| 652 | #define SQLITE_VERSION "3.7.9" |
| 653 | #define SQLITE_VERSION_NUMBER 3007009 |
| 654 | #define SQLITE_SOURCE_ID "2011-10-29 19:25:08 5b82ec6fbbd2f4195ad06dd911de3817373ad5bf" |
| 655 | |
| 656 | /* |
| 657 | ** CAPI3REF: Run-Time Library Version Numbers |
| 658 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 659 | ** |
| @@ -8792,10 +8785,11 @@ | |
| 8785 | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); |
| 8786 | SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); |
| 8787 | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); |
| 8788 | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); |
| 8789 | SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); |
| 8790 | SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); |
| 8791 | |
| 8792 | /* Functions used to truncate the database file. */ |
| 8793 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); |
| 8794 | |
| 8795 | #if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) |
| @@ -10189,12 +10183,13 @@ | |
| 10183 | IndexSample *aSample; /* Samples of the left-most key */ |
| 10184 | #endif |
| 10185 | }; |
| 10186 | |
| 10187 | /* |
| 10188 | ** Each sample stored in the sqlite_stat3 table is represented in memory |
| 10189 | ** using a structure of this type. See documentation at the top of the |
| 10190 | ** analyze.c source file for additional information. |
| 10191 | */ |
| 10192 | struct IndexSample { |
| 10193 | union { |
| 10194 | char *z; /* Value if eType is SQLITE_TEXT or SQLITE_BLOB */ |
| 10195 | double r; /* Value if eType is SQLITE_FLOAT */ |
| @@ -12293,13 +12288,10 @@ | |
| 12288 | "ENABLE_OVERSIZE_CELL_CHECK", |
| 12289 | #endif |
| 12290 | #ifdef SQLITE_ENABLE_RTREE |
| 12291 | "ENABLE_RTREE", |
| 12292 | #endif |
| 12293 | #ifdef SQLITE_ENABLE_STAT3 |
| 12294 | "ENABLE_STAT3", |
| 12295 | #endif |
| 12296 | #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY |
| 12297 | "ENABLE_UNLOCK_NOTIFY", |
| @@ -12996,10 +12988,11 @@ | |
| 12988 | SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); |
| 12989 | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); |
| 12990 | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); |
| 12991 | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); |
| 12992 | SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); |
| 12993 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); |
| 12994 | |
| 12995 | #ifdef SQLITE_OMIT_MERGE_SORT |
| 12996 | # define sqlite3VdbeSorterInit(Y,Z) SQLITE_OK |
| 12997 | # define sqlite3VdbeSorterWrite(X,Y,Z) SQLITE_OK |
| 12998 | # define sqlite3VdbeSorterClose(Y,Z) |
| @@ -29483,17 +29476,17 @@ | |
| 29476 | ** "<path to db>-journal" |
| 29477 | ** "<path to db>-wal" |
| 29478 | ** "<path to db>-journalNN" |
| 29479 | ** "<path to db>-walNN" |
| 29480 | ** |
| 29481 | ** where NN is a decimal number. The NN naming schemes are |
| 29482 | ** used by the test_multiplex.c module. |
| 29483 | */ |
| 29484 | nDb = sqlite3Strlen30(zPath) - 1; |
| 29485 | #ifdef SQLITE_ENABLE_8_3_NAMES |
| 29486 | while( nDb>0 && !sqlite3Isalnum(zPath[nDb]) ) nDb--; |
| 29487 | if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK; |
| 29488 | #else |
| 29489 | while( zPath[nDb]!='-' ){ |
| 29490 | assert( nDb>0 ); |
| 29491 | assert( zPath[nDb]!='\n' ); |
| 29492 | nDb--; |
| @@ -44163,10 +44156,17 @@ | |
| 44156 | pPager->pWal = 0; |
| 44157 | } |
| 44158 | } |
| 44159 | return rc; |
| 44160 | } |
| 44161 | |
| 44162 | /* |
| 44163 | ** Unless this is an in-memory or temporary database, clear the pager cache. |
| 44164 | */ |
| 44165 | SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ |
| 44166 | if( !MEMDB && pPager->tempFile==0 ) pager_reset(pPager); |
| 44167 | } |
| 44168 | |
| 44169 | #ifdef SQLITE_HAS_CODEC |
| 44170 | /* |
| 44171 | ** This function is called by the wal module when writing page content |
| 44172 | ** into the log file. |
| @@ -57006,10 +57006,12 @@ | |
| 57006 | sqlite3_backup_step(&b, 0x7FFFFFFF); |
| 57007 | assert( b.rc!=SQLITE_OK ); |
| 57008 | rc = sqlite3_backup_finish(&b); |
| 57009 | if( rc==SQLITE_OK ){ |
| 57010 | pTo->pBt->pageSizeFixed = 0; |
| 57011 | }else{ |
| 57012 | sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); |
| 57013 | } |
| 57014 | |
| 57015 | assert( sqlite3BtreeIsInTrans(pTo)==0 ); |
| 57016 | sqlite3BtreeLeave(pFrom); |
| 57017 | sqlite3BtreeLeave(pTo); |
| @@ -60480,10 +60482,34 @@ | |
| 60482 | ** in p->rc. This routine sets that result back to SQLITE_OK. |
| 60483 | */ |
| 60484 | SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){ |
| 60485 | p->rc = SQLITE_OK; |
| 60486 | } |
| 60487 | |
| 60488 | /* |
| 60489 | ** Copy the error code and error message belonging to the VDBE passed |
| 60490 | ** as the first argument to its database handle (so that they will be |
| 60491 | ** returned by calls to sqlite3_errcode() and sqlite3_errmsg()). |
| 60492 | ** |
| 60493 | ** This function does not clear the VDBE error code or message, just |
| 60494 | ** copies them to the database handle. |
| 60495 | */ |
| 60496 | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ |
| 60497 | sqlite3 *db = p->db; |
| 60498 | int rc = p->rc; |
| 60499 | if( p->zErrMsg ){ |
| 60500 | u8 mallocFailed = db->mallocFailed; |
| 60501 | sqlite3BeginBenignMalloc(); |
| 60502 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 60503 | sqlite3EndBenignMalloc(); |
| 60504 | db->mallocFailed = mallocFailed; |
| 60505 | db->errCode = rc; |
| 60506 | }else{ |
| 60507 | sqlite3Error(db, rc, 0); |
| 60508 | } |
| 60509 | return rc; |
| 60510 | } |
| 60511 | |
| 60512 | /* |
| 60513 | ** Clean up a VDBE after execution but do not delete the VDBE just yet. |
| 60514 | ** Write any error messages into *pzErrMsg. Return the result code. |
| 60515 | ** |
| @@ -60508,22 +60534,13 @@ | |
| 60534 | ** and error message from the VDBE into the main database structure. But |
| 60535 | ** if the VDBE has just been set to run but has not actually executed any |
| 60536 | ** instructions yet, leave the main database error information unchanged. |
| 60537 | */ |
| 60538 | if( p->pc>=0 ){ |
| 60539 | sqlite3VdbeTransferError(p); |
| 60540 | sqlite3DbFree(db, p->zErrMsg); |
| 60541 | p->zErrMsg = 0; |
| 60542 | if( p->runOnlyOnce ) p->expired = 1; |
| 60543 | }else if( p->rc && p->expired ){ |
| 60544 | /* The expired flag was set on the VDBE before the first call |
| 60545 | ** to sqlite3_step(). For consistency (since sqlite3_step() was |
| 60546 | ** called), set the database error in this case as well. |
| @@ -61865,11 +61882,11 @@ | |
| 61882 | if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ |
| 61883 | /* If this statement was prepared using sqlite3_prepare_v2(), and an |
| 61884 | ** error has occured, then return the error code in p->rc to the |
| 61885 | ** caller. Set the error code in the database handle to the same value. |
| 61886 | */ |
| 61887 | rc = sqlite3VdbeTransferError(p); |
| 61888 | } |
| 61889 | return (rc&db->errMask); |
| 61890 | } |
| 61891 | |
| 61892 | /* |
| @@ -67765,13 +67782,12 @@ | |
| 67782 | |
| 67783 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 67784 | u.bn.pC = p->apCsr[pOp->p1]; |
| 67785 | assert( u.bn.pC!=0 ); |
| 67786 | u.bn.pCrsr = u.bn.pC->pCursor; |
| 67787 | u.bn.res = 0; |
| 67788 | if( ALWAYS(u.bn.pCrsr!=0) ){ |
| 67789 | rc = sqlite3BtreeLast(u.bn.pCrsr, &u.bn.res); |
| 67790 | } |
| 67791 | u.bn.pC->nullRow = (u8)u.bn.res; |
| 67792 | u.bn.pC->deferredMoveto = 0; |
| 67793 | u.bn.pC->rowidIsValid = 0; |
| @@ -77610,20 +77626,20 @@ | |
| 77626 | #ifndef SQLITE_OMIT_ANALYZE |
| 77627 | |
| 77628 | /* |
| 77629 | ** This routine generates code that opens the sqlite_stat1 table for |
| 77630 | ** writing with cursor iStatCur. If the library was built with the |
| 77631 | ** SQLITE_ENABLE_STAT3 macro defined, then the sqlite_stat3 table is |
| 77632 | ** opened for writing using cursor (iStatCur+1) |
| 77633 | ** |
| 77634 | ** If the sqlite_stat1 tables does not previously exist, it is created. |
| 77635 | ** Similarly, if the sqlite_stat3 table does not exist and the library |
| 77636 | ** is compiled with SQLITE_ENABLE_STAT3 defined, it is created. |
| 77637 | ** |
| 77638 | ** Argument zWhere may be a pointer to a buffer containing a table name, |
| 77639 | ** or it may be a NULL pointer. If it is not NULL, then all entries in |
| 77640 | ** the sqlite_stat1 and (if applicable) sqlite_stat3 tables associated |
| 77641 | ** with the named table are deleted. If zWhere==0, then code is generated |
| 77642 | ** to delete all stat table entries. |
| 77643 | */ |
| 77644 | static void openStatTable( |
| 77645 | Parse *pParse, /* Parsing context */ |
| @@ -81404,31 +81420,28 @@ | |
| 81420 | } |
| 81421 | #endif |
| 81422 | } |
| 81423 | |
| 81424 | /* |
| 81425 | ** Remove entries from the sqlite_statN tables (for N in (1,2,3)) |
| 81426 | ** after a DROP INDEX or DROP TABLE command. |
| 81427 | */ |
| 81428 | static void sqlite3ClearStatTables( |
| 81429 | Parse *pParse, /* The parsing context */ |
| 81430 | int iDb, /* The database number */ |
| 81431 | const char *zType, /* "idx" or "tbl" */ |
| 81432 | const char *zName /* Name of index or table */ |
| 81433 | ){ |
| 81434 | int i; |
| 81435 | const char *zDbName = pParse->db->aDb[iDb].zName; |
| 81436 | for(i=1; i<=3; i++){ |
| 81437 | char zTab[24]; |
| 81438 | sqlite3_snprintf(sizeof(zTab),zTab,"sqlite_stat%d",i); |
| 81439 | if( sqlite3FindTable(pParse->db, zTab, zDbName) ){ |
| 81440 | sqlite3NestedParse(pParse, |
| 81441 | "DELETE FROM %Q.%s WHERE %s=%Q", |
| 81442 | zDbName, zTab, zType, zName |
| 81443 | ); |
| 81444 | } |
| 81445 | } |
| 81446 | } |
| 81447 | |
| @@ -89250,12 +89263,14 @@ | |
| 89263 | int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); |
| 89264 | int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); |
| 89265 | int (*busy_timeout)(sqlite3*,int ms); |
| 89266 | int (*changes)(sqlite3*); |
| 89267 | int (*close)(sqlite3*); |
| 89268 | int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, |
| 89269 | int eTextRep,const char*)); |
| 89270 | int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, |
| 89271 | int eTextRep,const void*)); |
| 89272 | const void * (*column_blob)(sqlite3_stmt*,int iCol); |
| 89273 | int (*column_bytes)(sqlite3_stmt*,int iCol); |
| 89274 | int (*column_bytes16)(sqlite3_stmt*,int iCol); |
| 89275 | int (*column_count)(sqlite3_stmt*pStmt); |
| 89276 | const char * (*column_database_name)(sqlite3_stmt*,int); |
| @@ -89276,14 +89291,22 @@ | |
| 89291 | int (*column_type)(sqlite3_stmt*,int iCol); |
| 89292 | sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); |
| 89293 | void * (*commit_hook)(sqlite3*,int(*)(void*),void*); |
| 89294 | int (*complete)(const char*sql); |
| 89295 | int (*complete16)(const void*sql); |
| 89296 | int (*create_collation)(sqlite3*,const char*,int,void*, |
| 89297 | int(*)(void*,int,const void*,int,const void*)); |
| 89298 | int (*create_collation16)(sqlite3*,const void*,int,void*, |
| 89299 | int(*)(void*,int,const void*,int,const void*)); |
| 89300 | int (*create_function)(sqlite3*,const char*,int,int,void*, |
| 89301 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 89302 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 89303 | void (*xFinal)(sqlite3_context*)); |
| 89304 | int (*create_function16)(sqlite3*,const void*,int,int,void*, |
| 89305 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 89306 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 89307 | void (*xFinal)(sqlite3_context*)); |
| 89308 | int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); |
| 89309 | int (*data_count)(sqlite3_stmt*pStmt); |
| 89310 | sqlite3 * (*db_handle)(sqlite3_stmt*); |
| 89311 | int (*declare_vtab)(sqlite3*,const char*); |
| 89312 | int (*enable_shared_cache)(int); |
| @@ -89324,20 +89347,23 @@ | |
| 89347 | void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89348 | void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89349 | void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); |
| 89350 | void (*result_value)(sqlite3_context*,sqlite3_value*); |
| 89351 | void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); |
| 89352 | int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, |
| 89353 | const char*,const char*),void*); |
| 89354 | void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); |
| 89355 | char * (*snprintf)(int,char*,const char*,...); |
| 89356 | int (*step)(sqlite3_stmt*); |
| 89357 | int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, |
| 89358 | char const**,char const**,int*,int*,int*); |
| 89359 | void (*thread_cleanup)(void); |
| 89360 | int (*total_changes)(sqlite3*); |
| 89361 | void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); |
| 89362 | int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); |
| 89363 | void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, |
| 89364 | sqlite_int64),void*); |
| 89365 | void * (*user_data)(sqlite3_context*); |
| 89366 | const void * (*value_blob)(sqlite3_value*); |
| 89367 | int (*value_bytes)(sqlite3_value*); |
| 89368 | int (*value_bytes16)(sqlite3_value*); |
| 89369 | double (*value_double)(sqlite3_value*); |
| @@ -89355,19 +89381,23 @@ | |
| 89381 | /* Added by 3.3.13 */ |
| 89382 | int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); |
| 89383 | int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); |
| 89384 | int (*clear_bindings)(sqlite3_stmt*); |
| 89385 | /* Added by 3.4.1 */ |
| 89386 | int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, |
| 89387 | void (*xDestroy)(void *)); |
| 89388 | /* Added by 3.5.0 */ |
| 89389 | int (*bind_zeroblob)(sqlite3_stmt*,int,int); |
| 89390 | int (*blob_bytes)(sqlite3_blob*); |
| 89391 | int (*blob_close)(sqlite3_blob*); |
| 89392 | int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, |
| 89393 | int,sqlite3_blob**); |
| 89394 | int (*blob_read)(sqlite3_blob*,void*,int,int); |
| 89395 | int (*blob_write)(sqlite3_blob*,const void*,int,int); |
| 89396 | int (*create_collation_v2)(sqlite3*,const char*,int,void*, |
| 89397 | int(*)(void*,int,const void*,int,const void*), |
| 89398 | void(*)(void*)); |
| 89399 | int (*file_control)(sqlite3*,const char*,int,void*); |
| 89400 | sqlite3_int64 (*memory_highwater)(int); |
| 89401 | sqlite3_int64 (*memory_used)(void); |
| 89402 | sqlite3_mutex *(*mutex_alloc)(int); |
| 89403 | void (*mutex_enter)(sqlite3_mutex*); |
| @@ -89399,11 +89429,15 @@ | |
| 89429 | int (*backup_pagecount)(sqlite3_backup*); |
| 89430 | int (*backup_remaining)(sqlite3_backup*); |
| 89431 | int (*backup_step)(sqlite3_backup*,int); |
| 89432 | const char *(*compileoption_get)(int); |
| 89433 | int (*compileoption_used)(const char*); |
| 89434 | int (*create_function_v2)(sqlite3*,const char*,int,int,void*, |
| 89435 | void (*xFunc)(sqlite3_context*,int,sqlite3_value**), |
| 89436 | void (*xStep)(sqlite3_context*,int,sqlite3_value**), |
| 89437 | void (*xFinal)(sqlite3_context*), |
| 89438 | void(*xDestroy)(void*)); |
| 89439 | int (*db_config)(sqlite3*,int,...); |
| 89440 | sqlite3_mutex *(*db_mutex)(sqlite3*); |
| 89441 | int (*db_status)(sqlite3*,int,int*,int*,int); |
| 89442 | int (*extended_errcode)(sqlite3*); |
| 89443 | void (*log)(int,const char*,...); |
| @@ -100485,11 +100519,11 @@ | |
| 100519 | if( db->aVTrans ){ |
| 100520 | int i; |
| 100521 | for(i=0; rc==SQLITE_OK && i<db->nVTrans; i++){ |
| 100522 | VTable *pVTab = db->aVTrans[i]; |
| 100523 | const sqlite3_module *pMod = pVTab->pMod->pModule; |
| 100524 | if( pVTab->pVtab && pMod->iVersion>=2 ){ |
| 100525 | int (*xMethod)(sqlite3_vtab *, int); |
| 100526 | switch( op ){ |
| 100527 | case SAVEPOINT_BEGIN: |
| 100528 | xMethod = pMod->xSavepoint; |
| 100529 | pVTab->iSavepoint = iSavepoint+1; |
| @@ -100500,11 +100534,11 @@ | |
| 100534 | default: |
| 100535 | xMethod = pMod->xRelease; |
| 100536 | break; |
| 100537 | } |
| 100538 | if( xMethod && pVTab->iSavepoint>iSavepoint ){ |
| 100539 | rc = xMethod(pVTab->pVtab, iSavepoint); |
| 100540 | } |
| 100541 | } |
| 100542 | } |
| 100543 | } |
| 100544 | return rc; |
| @@ -101367,11 +101401,11 @@ | |
| 101401 | int iCol = pRight->iColumn; |
| 101402 | pVal = sqlite3VdbeGetValue(pReprepare, iCol, SQLITE_AFF_NONE); |
| 101403 | if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ |
| 101404 | z = (char *)sqlite3_value_text(pVal); |
| 101405 | } |
| 101406 | sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); |
| 101407 | assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); |
| 101408 | }else if( op==TK_STRING ){ |
| 101409 | z = pRight->u.zToken; |
| 101410 | } |
| 101411 | if( z ){ |
| @@ -101385,11 +101419,11 @@ | |
| 101419 | pPrefix = sqlite3Expr(db, TK_STRING, z); |
| 101420 | if( pPrefix ) pPrefix->u.zToken[cnt] = 0; |
| 101421 | *ppPrefix = pPrefix; |
| 101422 | if( op==TK_VARIABLE ){ |
| 101423 | Vdbe *v = pParse->pVdbe; |
| 101424 | sqlite3VdbeSetVarmask(v, pRight->iColumn); |
| 101425 | if( *pisComplete && pRight->u.zToken[1] ){ |
| 101426 | /* If the rhs of the LIKE expression is a variable, and the current |
| 101427 | ** value of the variable means there is no need to invoke the LIKE |
| 101428 | ** function, then no OP_Variable will be added to the program. |
| 101429 | ** This causes problems for the sqlite3_bind_parameter_name() |
| @@ -103299,11 +103333,11 @@ | |
| 103333 | ){ |
| 103334 | if( pExpr->op==TK_VARIABLE |
| 103335 | || (pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) |
| 103336 | ){ |
| 103337 | int iVar = pExpr->iColumn; |
| 103338 | sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); |
| 103339 | *pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff); |
| 103340 | return SQLITE_OK; |
| 103341 | } |
| 103342 | return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp); |
| 103343 | } |
| @@ -103829,11 +103863,11 @@ | |
| 103863 | ** a table or index. The actual times can vary, with the size of |
| 103864 | ** records being an important factor. Both moves and searches are |
| 103865 | ** slower with larger records, presumably because fewer records fit |
| 103866 | ** on one page and hence more pages have to be fetched. |
| 103867 | ** |
| 103868 | ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do |
| 103869 | ** not give us data on the relative sizes of table and index records. |
| 103870 | ** So this computation assumes table records are about twice as big |
| 103871 | ** as index records |
| 103872 | */ |
| 103873 | if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ |
| 103874 |
+1
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.7.9" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3007009 |
| 112 | -#define SQLITE_SOURCE_ID "2011-10-20 00:55:54 4344483f7d7f64dffadde0053e6c745948db9486" | |
| 112 | +#define SQLITE_SOURCE_ID "2011-10-29 19:25:08 5b82ec6fbbd2f4195ad06dd911de3817373ad5bf" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| 118 | 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.9" |
| 111 | #define SQLITE_VERSION_NUMBER 3007009 |
| 112 | #define SQLITE_SOURCE_ID "2011-10-20 00:55:54 4344483f7d7f64dffadde0053e6c745948db9486" |
| 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.9" |
| 111 | #define SQLITE_VERSION_NUMBER 3007009 |
| 112 | #define SQLITE_SOURCE_ID "2011-10-29 19:25:08 5b82ec6fbbd2f4195ad06dd911de3817373ad5bf" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| 118 |