Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the built-in SQLite to the first 3.29.0 beta. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
bf409a4f2ccd5ab5636dacd536ad1b16 |
User & Date: | drh 2019-07-08 20:51:42.175 |
Context
2019-09-28
| ||
19:29 | Update the built-in SQLite to the first 3.30.0 beta. check-in: 0b85555747 user: drh tags: trunk | |
2019-07-08
| ||
20:51 | Update the built-in SQLite to the first 3.29.0 beta. check-in: bf409a4f2c user: drh tags: trunk | |
2019-04-15
| ||
14:24 | Update the built-in SQLite to the 3.28.0 beta. check-in: 865a75877d user: drh tags: trunk | |
Changes
Changes to src/sqlite3.c.
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite |
︙ | |||
35 36 37 38 39 40 41 | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | - + | ** ************************************************************************* ** ** This file implements routines used to report what compile-time options ** SQLite was built with. */ |
︙ | |||
884 885 886 887 888 889 890 891 892 893 894 895 896 897 | 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 | + + + + + | #pragma warning(disable : 4244) #pragma warning(disable : 4305) #pragma warning(disable : 4306) #pragma warning(disable : 4702) #pragma warning(disable : 4706) #endif /* defined(_MSC_VER) */ #if defined(_MSC_VER) && !defined(_WIN64) #undef SQLITE_4_BYTE_ALIGNED_MALLOC #define SQLITE_4_BYTE_ALIGNED_MALLOC #endif /* defined(_MSC_VER) && !defined(_WIN64) */ #endif /* SQLITE_MSVC_H */ /************** End of msvc.h ************************************************/ /************** Continuing where we left off in sqliteInt.h ******************/ /* ** Special setup for VxWorks |
︙ | |||
1158 1159 1160 1161 1162 1163 1164 | 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 | - - - + + + | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ |
︙ | |||
2331 2332 2333 2334 2335 2336 2337 | 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 | - - + + + + + + + + | ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** ** [[sqlite3_vfs.xAccess]] ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] |
︙ | |||
3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 | 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the ** "defensive" flag for a database connection. When the defensive ** flag is enabled, language features that allow ordinary SQL to ** deliberately corrupt the database file are disabled. The disabled ** features include but are not limited to the following: ** <ul> ** <li> The [PRAGMA writable_schema=ON] statement. ** <li> The [PRAGMA journal_mode=OFF] statement. ** <li> Writes to the [sqlite_dbpage] virtual table. ** <li> Direct writes to [shadow tables]. ** </ul> ** </dd> ** ** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> ** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the ** "writable_schema" flag. This has the same effect and is logically equivalent ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. ** The first argument to this setting is an integer which is 0 to disable ** the writable_schema, positive to enable writable_schema, or negative to ** leave the setting unchanged. The second parameter is a pointer to an ** integer into which is written 0 or 1 to indicate whether the writable_schema ** is enabled or disabled following this call. ** </dd> ** ** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]] ** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> ** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates ** the legacy behavior of the [ALTER TABLE RENAME] command such it ** behaves as it did prior to [version 3.24.0] (2018-06-04). See the ** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for ** additional information. This feature can also be turned on and off ** using the [PRAGMA legacy_alter_table] statement. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DML]] ** <dt>SQLITE_DBCONFIG_DQS_DML</td> ** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DML statement ** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DDL]] ** <dt>SQLITE_DBCONFIG_DQS_DDL</td> ** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DDL statements, ** such as CREATE TABLE and CREATE INDEX. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** </dl> */ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
︙ | |||
8354 8355 8356 8357 8358 8359 8360 | 8397 8398 8399 8400 8401 8402 8403 8404 8405 8406 8407 8408 8409 8410 8411 8412 | + - + | #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 #define SQLITE_TESTCTRL_BYTEORDER 22 #define SQLITE_TESTCTRL_ISINIT 23 #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 |
︙ | |||
13948 13949 13950 13951 13952 13953 13954 | 13992 13993 13994 13995 13996 13997 13998 13999 14000 14001 14002 14003 14004 14005 14006 14007 14008 14009 14010 14011 14012 | - - - - + + + + - + + | ** ** For best performance, an attempt is made to guess at the byte-order ** using C-preprocessor macros. If that is unsuccessful, or if ** -DSQLITE_BYTEORDER=0 is set, then byte-order is determined ** at run-time. */ #ifndef SQLITE_BYTEORDER |
︙ | |||
16466 16467 16468 16469 16470 16471 16472 16473 16474 16475 16476 16477 16478 16479 | 16511 16512 16513 16514 16515 16516 16517 16518 16519 16520 16521 16522 16523 16524 16525 16526 | + + | #define SQLITE_Fts3Tokenizer 0x00400000 /* Enable fts3_tokenizer(2) */ #define SQLITE_EnableQPSG 0x00800000 /* Query Planner Stability Guarantee*/ #define SQLITE_TriggerEQP 0x01000000 /* Show trigger EXPLAIN QUERY PLAN */ #define SQLITE_ResetDatabase 0x02000000 /* Reset the database */ #define SQLITE_LegacyAlter 0x04000000 /* Legacy ALTER TABLE behaviour */ #define SQLITE_NoSchemaError 0x08000000 /* Do not report schema parse errors*/ #define SQLITE_Defensive 0x10000000 /* Input SQL is likely hostile */ #define SQLITE_DqsDDL 0x20000000 /* dbl-quoted strings allowed in DDL*/ #define SQLITE_DqsDML 0x40000000 /* dbl-quoted strings allowed in DML*/ /* Flags used only if debugging */ #define HI(X) ((u64)(X)<<32) #ifdef SQLITE_DEBUG #define SQLITE_SqlTrace HI(0x0001) /* Debug print SQL as it executes */ #define SQLITE_VdbeListing HI(0x0002) /* Debug listings of VDBE progs */ #define SQLITE_VdbeTrace HI(0x0004) /* True to trace VDBE execution */ |
︙ | |||
17172 17173 17174 17175 17176 17177 17178 17179 17180 17181 17182 17183 17184 17185 | 17219 17220 17221 17222 17223 17224 17225 17226 17227 17228 17229 17230 17231 17232 17233 | + | unsigned bUnordered:1; /* Use this index for == or IN queries only */ unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */ unsigned isResized:1; /* True if resizeIndexObject() has been called */ unsigned isCovering:1; /* True if this is a covering index */ unsigned noSkipScan:1; /* Do not try to use skip-scan if true */ unsigned hasStat1:1; /* aiRowLogEst values come from sqlite_stat1 */ unsigned bNoQuery:1; /* Do not use this index to optimize queries */ unsigned bAscKeyBug:1; /* True if the bba7b69f9849b5bf bug applies */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 int nSample; /* Number of elements in aSample[] */ int nSampleCol; /* Size of IndexSample.anEq[] and so on */ tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */ IndexSample *aSample; /* Samples of the left-most key */ tRowcnt *aiRowEst; /* Non-logarithmic stat1 data for this index */ tRowcnt nRowEst0; /* Non-logarithmic number of rows in the index */ |
︙ | |||
17399 17400 17401 17402 17403 17404 17405 | 17447 17448 17449 17450 17451 17452 17453 17454 17455 17456 17457 17458 17459 17460 17461 | - + | ** EP_Unlikely: 134217728 times likelihood ** TK_SELECT: 1st register of result vector */ ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. ** TK_VARIABLE: variable number (always >= 1). ** TK_SELECT_COLUMN: column of the result vector */ i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ |
︙ | |||
17433 17434 17435 17436 17437 17438 17439 | 17481 17482 17483 17484 17485 17486 17487 17488 17489 17490 17491 17492 17493 17494 17495 17496 17497 17498 17499 17500 17501 17502 17503 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 17524 17525 17526 17527 17528 17529 | - + + + + + | #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ #define EP_Generic 0x000200 /* Ignore COLLATE or affinity on this tree */ #define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ #define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ |
︙ | |||
17680 17681 17682 17683 17684 17685 17686 | 17732 17733 17734 17735 17736 17737 17738 17739 17740 17741 17742 17743 17744 17745 17746 | - + | ExprList *pEList; /* Optional list of result-set columns */ AggInfo *pAggInfo; /* Information about aggregates at this level */ Upsert *pUpsert; /* ON CONFLICT clause information from an upsert */ } uNC; NameContext *pNext; /* Next outer name context. NULL for outermost */ int nRef; /* Number of names resolved by this context */ int nErr; /* Number of errors encountered while resolving names */ |
︙ | |||
17707 17708 17709 17710 17711 17712 17713 17714 17715 17716 17717 17718 17719 17720 | 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 | + | #define NC_UEList 0x0080 /* True if uNC.pEList is used */ #define NC_UAggInfo 0x0100 /* True if uNC.pAggInfo is used */ #define NC_UUpsert 0x0200 /* True if uNC.pUpsert is used */ #define NC_MinMaxAgg 0x1000 /* min/max aggregates seen. See note above */ #define NC_Complex 0x2000 /* True if a function or subquery seen */ #define NC_AllowWin 0x4000 /* Window functions are allowed here */ #define NC_HasWin 0x8000 /* One or more window functions seen */ #define NC_IsDDL 0x10000 /* Resolving names in a CREATE statement */ /* ** An instance of the following object describes a single ON CONFLICT ** clause in an upsert. ** ** The pUpsertTarget field is only set if the ON CONFLICT clause includes ** conflict-target clause. (In "ON CONFLICT(a,b)" the "(a,b)" is the |
︙ | |||
18713 18714 18715 18716 18717 18718 18719 18720 18721 18722 18723 18724 18725 18726 18727 18728 | 18766 18767 18768 18769 18770 18771 18772 18773 18774 18775 18776 18777 18778 18779 18780 18781 18782 18783 18784 18785 | + + + + | #if defined(SQLITE_ENABLE_MULTITHREADED_CHECKS) && !defined(SQLITE_MUTEX_OMIT) SQLITE_PRIVATE void sqlite3MutexWarnOnContention(sqlite3_mutex*); #else # define sqlite3MutexWarnOnContention(x) #endif #ifndef SQLITE_OMIT_FLOATING_POINT # define EXP754 (((u64)0x7ff)<<52) # define MAN754 ((((u64)1)<<52)-1) # define IsNaN(X) (((X)&EXP754)==EXP754 && ((X)&MAN754)!=0) SQLITE_PRIVATE int sqlite3IsNaN(double); #else # define IsNaN(X) 0 # define sqlite3IsNaN(X) 0 #endif /* ** An instance of the following structure holds information about SQL ** functions arguments that are the parameters to the printf() function. */ |
︙ | |||
18773 18774 18775 18776 18777 18778 18779 | 18830 18831 18832 18833 18834 18835 18836 18837 18838 18839 18840 18841 18842 18843 18844 18845 18846 18847 18848 18849 | - + + + | SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse*,int,int); #endif SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); |
︙ | |||
19085 19086 19087 19088 19089 19090 19091 19092 19093 19094 19095 19096 19097 19098 | 19144 19145 19146 19147 19148 19149 19150 19151 19152 19153 19154 19155 19156 19157 19158 | + | SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*); SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*); SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*); SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*); SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*); SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); SQLITE_PRIVATE int sqlite3RealSameAsInt(double,sqlite3_int64); SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); SQLITE_PRIVATE int sqlite3Atoi(const char*); #ifndef SQLITE_OMIT_UTF16 SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); #endif SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); |
︙ | |||
19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 19197 19198 19199 | 19246 19247 19248 19249 19250 19251 19252 19253 19254 19255 19256 19257 19258 19259 19260 19261 19262 | + + + | SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, void(*)(void*)); SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*); SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); #ifndef SQLITE_UNTESTABLE SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context*); #endif SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); #ifndef SQLITE_OMIT_UTF16 SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); #endif SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); #ifndef SQLITE_AMALGAMATION |
︙ | |||
19748 19749 19750 19751 19752 19753 19754 | 19811 19812 19813 19814 19815 19816 19817 19818 19819 19820 19821 19822 19823 19824 19825 19826 19827 19828 19829 19830 19831 19832 19833 | - + + + + + + + + | # endif #endif /* EVIDENCE-OF: R-38720-18127 The default setting is determined by the ** SQLITE_ALLOW_COVERING_INDEX_SCAN compile-time option, or is "on" if ** that compile-time option is omitted. */ |
︙ | |||
20176 20177 20178 20179 20180 20181 20182 | 20246 20247 20248 20249 20250 20251 20252 20253 20254 20255 20256 20257 20258 20259 20260 20261 20262 20263 20264 20265 | + - - + + - - + | ** flags may coexist with the MEM_Str flag. */ #define MEM_Null 0x0001 /* Value is NULL (or a pointer) */ #define MEM_Str 0x0002 /* Value is a string */ #define MEM_Int 0x0004 /* Value is an integer */ #define MEM_Real 0x0008 /* Value is a real number */ #define MEM_Blob 0x0010 /* Value is a BLOB */ #define MEM_IntReal 0x0020 /* MEM_Int that stringifies like MEM_Real */ |
︙ | |||
21301 21302 21303 21304 21305 21306 21307 | 21371 21372 21373 21374 21375 21376 21377 21378 21379 21380 21381 21382 21383 21384 21385 | - + | double r; if( parseYyyyMmDd(zDate,p)==0 ){ return 0; }else if( parseHhMmSs(zDate, p)==0 ){ return 0; }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){ return setDateTimeToCurrent(context, p); |
︙ | |||
21635 21636 21637 21638 21639 21640 21641 | 21705 21706 21707 21708 21709 21710 21711 21712 21713 21714 21715 21716 21717 21718 21719 | - + | ** weekday N ** ** Move the date to the same time on the next occurrence of ** weekday N where 0==Sunday, 1==Monday, and so forth. If the ** date is already on the appropriate weekday, this is a no-op. */ if( sqlite3_strnicmp(z, "weekday ", 8)==0 |
︙ | |||
21694 21695 21696 21697 21698 21699 21700 | 21764 21765 21766 21767 21768 21769 21770 21771 21772 21773 21774 21775 21776 21777 21778 | - + | case '6': case '7': case '8': case '9': { double rRounder; int i; for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){} |
︙ | |||
27327 27328 27329 27330 27331 27332 27333 27334 27335 27336 27337 27338 27339 27340 | 27397 27398 27399 27400 27401 27402 27403 27404 27405 27406 27407 27408 27409 27410 27411 27412 27413 27414 27415 27416 | + + + + + + | /* All the rest are undocumented and are for internal use only */ { 'T', 0, 0, etTOKEN, 0, 0 }, { 'S', 0, 0, etSRCLIST, 0, 0 }, { 'r', 10, 1, etORDINAL, 0, 0 }, }; /* Floating point constants used for rounding */ static const double arRound[] = { 5.0e-01, 5.0e-02, 5.0e-03, 5.0e-04, 5.0e-05, 5.0e-06, 5.0e-07, 5.0e-08, 5.0e-09, 5.0e-10, }; /* ** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point ** conversions will work. */ #ifndef SQLITE_OMIT_FLOATING_POINT /* ** "*val" is a double such that 0.1 <= *val < 10.0 |
︙ | |||
27745 27746 27747 27748 27749 27750 27751 | 27821 27822 27823 27824 27825 27826 27827 27828 27829 27830 27831 27832 27833 27834 27835 27836 27837 27838 27839 27840 27841 27842 27843 27844 27845 27846 | - - + + + + + + + + + + + + | realvalue = -realvalue; prefix = '-'; }else{ prefix = flag_prefix; } if( xtype==etGENERIC && precision>0 ) precision--; testcase( precision>0xfff ); |
︙ | |||
29026 29027 29028 29029 29030 29031 29032 | 29112 29113 29114 29115 29116 29117 29118 29119 29120 29121 29122 29123 29124 29125 29126 | - + | case TK_TRUTH: { int x; const char *azOp[] = { "IS-FALSE", "IS-TRUE", "IS-NOT-FALSE", "IS-NOT-TRUE" }; assert( pExpr->op2==TK_IS || pExpr->op2==TK_ISNOT ); assert( pExpr->pRight ); |
︙ | |||
30208 30209 30210 30211 30212 30213 30214 | 30294 30295 30296 30297 30298 30299 30300 30301 30302 30303 30304 30305 30306 30307 30308 | - - + - | ** ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** */ /* #include "sqliteInt.h" */ /* #include <stdarg.h> */ |
︙ | |||
30251 30252 30253 30254 30255 30256 30257 | 30335 30336 30337 30338 30339 30340 30341 30342 30343 30344 30345 30346 30347 30348 30349 30350 30351 30352 30353 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - + | return xCallback ? xCallback(iTest) : SQLITE_OK; } #endif #ifndef SQLITE_OMIT_FLOATING_POINT /* ** Return true if the floating point value is Not a Number (NaN). |
︙ | |||
30513 30514 30515 30516 30517 30518 30519 | 30561 30562 30563 30564 30565 30566 30567 30568 30569 30570 30571 30572 30573 30574 30575 30576 30577 30578 30579 30580 30581 30582 30583 30584 30585 30586 | - + + + + + + - - + + + | }else if( zRight==0 ){ return 1; } return sqlite3StrICmp(zLeft, zRight); } SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){ unsigned char *a, *b; |
︙ | |||
30546 30547 30548 30549 30550 30551 30552 | 30600 30601 30602 30603 30604 30605 30606 30607 30608 30609 30610 30611 30612 30613 30614 30615 30616 30617 30618 30619 30620 30621 30622 | - - - - - - - - - + + + + + + + + + | ** E==2 results in 100. E==50 results in 1.0e50. ** ** This routine only works for values of E between 1 and 341. */ static LONGDOUBLE_TYPE sqlite3Pow10(int E){ #if defined(_MSC_VER) static const LONGDOUBLE_TYPE x[] = { |
︙ | |||
30584 30585 30586 30587 30588 30589 30590 | 30638 30639 30640 30641 30642 30643 30644 30645 30646 30647 30648 30649 30650 30651 30652 30653 30654 30655 30656 30657 30658 30659 30660 | - - + + + + + + + + + | ** The string z[] is an text representation of a real number. ** Convert this string to a double and write it into *pResult. ** ** The string z[] is length bytes in length (bytes, not characters) and ** uses the encoding enc. The string is not necessarily zero-terminated. ** ** Return TRUE if the result is a valid real number (or integer) and FALSE |
︙ | |||
30610 30611 30612 30613 30614 30615 30616 | 30671 30672 30673 30674 30675 30676 30677 30678 30679 30680 30681 30682 30683 30684 30685 30686 30687 30688 30689 30690 30691 30692 30693 30694 30695 30696 30697 30698 30699 30700 30701 30702 30703 30704 30705 30706 30707 30708 30709 30710 30711 30712 30713 30714 30715 30716 30717 30718 30719 30720 30721 30722 30723 30724 30725 30726 30727 30728 30729 30730 30731 30732 30733 30734 30735 30736 30737 30738 30739 30740 30741 30742 30743 30744 30745 30746 30747 30748 30749 30750 | - - + + + + - + - + - + - - - - - + + + + + + + + - + + | int sign = 1; /* sign of significand */ i64 s = 0; /* significand */ int d = 0; /* adjust exponent for shifting decimal point */ int esign = 1; /* sign of exponent */ int e = 0; /* exponent */ int eValid = 1; /* True exponent is either not used or is well-formed */ double result; |
︙ | |||
30768 30769 30770 30771 30772 30773 30774 | 30835 30836 30837 30838 30839 30840 30841 30842 30843 30844 30845 30846 30847 30848 30849 30850 30851 30852 30853 30854 30855 | - + + + + + + + | } } /* store the result */ *pResult = result; /* return true if number and no extra non-whitespace chracters after */ |
︙ | |||
30811 30812 30813 30814 30815 30816 30817 30818 30819 30820 30821 30822 30823 30824 | 30884 30885 30886 30887 30888 30889 30890 30891 30892 30893 30894 30895 30896 30897 30898 | + | /* ** Convert zNum to a 64-bit signed integer. zNum must be decimal. This ** routine does *not* accept hexadecimal notation. ** ** Returns: ** ** -1 Not even a prefix of the input text looks like an integer ** 0 Successful transformation. Fits in a 64-bit signed integer. ** 1 Excess non-space text after the integer value ** 2 Integer too large for a 64-bit signed integer or is malformed ** 3 Special case of 9223372036854775808 ** ** length is the number of bytes in the string (bytes, not characters). ** The string is not necessarily zero-terminated. The encoding is |
︙ | |||
30870 30871 30872 30873 30874 30875 30876 | 30944 30945 30946 30947 30948 30949 30950 30951 30952 30953 30954 30955 30956 30957 30958 30959 30960 | - - + + + - | *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64; }else if( neg ){ *pNum = -(i64)u; }else{ *pNum = (i64)u; } rc = 0; |
︙ | |||
31103 31104 31105 31106 31107 31108 31109 | 31177 31178 31179 31180 31181 31182 31183 31184 31185 31186 31187 31188 31189 31190 31191 31192 31193 31194 31195 31196 31197 31198 31199 31200 31201 31202 31203 31204 31205 31206 | + - + - - - - - + - - - - - - - - - + - - + + + | /* ** Read a 64-bit variable-length integer from memory starting at p[0]. ** Return the number of bytes read. The value is stored in *v. */ SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ u32 a,b,s; if( ((signed char*)p)[0]>=0 ){ |
︙ | |||
47998 47999 48000 48001 48002 48003 48004 | 48062 48063 48064 48065 48066 48067 48068 48069 48070 48071 48072 48073 48074 48075 48076 48077 48078 48079 | - - - + + + + | */ static int numberOfCachePages(PCache *p){ if( p->szCache>=0 ){ /* IMPLEMENTATION-OF: R-42059-47211 If the argument N is positive then the ** suggested cache size is set to N. */ return p->szCache; }else{ |
︙ | |||
49416 49417 49418 49419 49420 49421 49422 49423 49424 49425 49426 49427 49428 49429 49430 49431 | 49481 49482 49483 49484 49485 49486 49487 49488 49489 49490 49491 49492 49493 49494 49495 49496 49497 49498 49499 49500 49501 49502 49503 49504 | + - | if( pCache ){ if( pcache1.separateCache ){ pGroup = (PGroup*)&pCache[1]; pGroup->mxPinned = 10; }else{ pGroup = &pcache1.grp; } pcache1EnterMutex(pGroup); if( pGroup->lru.isAnchor==0 ){ pGroup->lru.isAnchor = 1; pGroup->lru.pLruPrev = pGroup->lru.pLruNext = &pGroup->lru; } pCache->pGroup = pGroup; pCache->szPage = szPage; pCache->szExtra = szExtra; pCache->szAlloc = szPage + szExtra + ROUND8(sizeof(PgHdr1)); pCache->bPurgeable = (bPurgeable ? 1 : 0); |
︙ | |||
61218 61219 61220 61221 61222 61223 61224 | 61283 61284 61285 61286 61287 61288 61289 61290 61291 61292 61293 61294 61295 61296 61297 61298 61299 | - - + + + - | rc = walHashGet(pWal, iHash, &sLoc); if( rc!=SQLITE_OK ){ return rc; } nCollide = HASHTABLE_NSLOT; for(iKey=walHash(pgno); sLoc.aHash[iKey]; iKey=walNextHash(iKey)){ |
︙ | |||
64812 64813 64814 64815 64816 64817 64818 | 64877 64878 64879 64880 64881 64882 64883 64884 64885 64886 64887 64888 64889 64890 64891 | - + | assert( gap<=65536 ); /* EVIDENCE-OF: R-29356-02391 If the database uses a 65536-byte page size ** and the reserved space is zero (the usual value for reserved space) ** then the cell content offset of an empty page wants to be 65536. ** However, that integer is too large to be stored in a 2-byte unsigned ** integer, so a value of 0 is used in its place. */ top = get2byte(&data[hdr+5]); |
︙ | |||
65109 65110 65111 65112 65113 65114 65115 | 65174 65175 65176 65177 65178 65179 65180 65181 65182 65183 65184 65185 65186 65187 65188 | - + | /* At this point, nFree contains the sum of the offset to the start ** of the cell-content area plus the number of free bytes within ** the cell-content area. If this is greater than the usable-size ** of the page, then the page must be corrupted. This check also ** serves to verify that the offset to the start of the cell-content ** area, according to the page header, lies within the page. */ |
︙ | |||
67336 67337 67338 67339 67340 67341 67342 67343 67344 67345 67346 67347 67348 67349 | 67401 67402 67403 67404 67405 67406 67407 67408 67409 67410 67411 67412 67413 67414 67415 67416 67417 67418 67419 67420 67421 67422 67423 67424 67425 67426 | + + + + + + + + + + + + | } btreeReleaseAllCursorPages(p); } sqlite3BtreeLeave(pBtree); } return rc; } /* ** Set the pBt->nPage field correctly, according to the current ** state of the database. Assume pBt->pPage1 is valid. */ static void btreeSetNPage(BtShared *pBt, MemPage *pPage1){ int nPage = get4byte(&pPage1->aData[28]); testcase( nPage==0 ); if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); testcase( pBt->nPage!=nPage ); pBt->nPage = nPage; } /* ** Rollback the transaction in progress. ** ** If tripCode is not SQLITE_OK then cursors will be invalidated (tripped). ** Only write cursors are tripped if writeOnly is true but all cursors are ** tripped if writeOnly is false. Any attempt to use |
︙ | |||
67382 67383 67384 67385 67386 67387 67388 | 67459 67460 67461 67462 67463 67464 67465 67466 67467 67468 67469 67470 67471 67472 67473 | - - - - - + | rc = rc2; } /* The rollback may have destroyed the pPage1->aData value. So ** call btreeGetPage() on page 1 again to make ** sure pPage1->aData is set correctly. */ if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){ |
︙ | |||
67466 67467 67468 67469 67470 67471 67472 | 67539 67540 67541 67542 67543 67544 67545 67546 67547 67548 67549 67550 67551 67552 67553 67554 67555 67556 67557 | - + - - + + - - + | rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint); } if( rc==SQLITE_OK ){ if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){ pBt->nPage = 0; } rc = newDatabase(pBt); |
︙ | |||
68479 68480 68481 68482 68483 68484 68485 68486 68487 68488 68489 68490 68491 68492 | 68551 68552 68553 68554 68555 68556 68557 68558 68559 68560 68561 68562 68563 68564 68565 | + | int ii; for(ii=0; ii<pCur->iPage; ii++){ assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell ); } assert( pCur->ix==pCur->pPage->nCell-1 ); assert( pCur->pPage->leaf ); #endif *pRes = 0; return SQLITE_OK; } rc = moveToRoot(pCur); if( rc==SQLITE_OK ){ assert( pCur->eState==CURSOR_VALID ); *pRes = 0; |
︙ | |||
68700 68701 68702 68703 68704 68705 68706 68707 68708 68709 68710 68711 68712 68713 68714 68715 68716 | 68773 68774 68775 68776 68777 68778 68779 68780 68781 68782 68783 68784 68785 68786 68787 68788 68789 68790 68791 68792 68793 68794 68795 68796 68797 68798 68799 68800 68801 68802 68803 68804 68805 | + - + + | ** ** If the record is corrupt, the xRecordCompare routine may read ** up to two varints past the end of the buffer. An extra 18 ** bytes of padding is allocated at the end of the buffer in ** case this happens. */ void *pCellKey; u8 * const pCellBody = pCell - pPage->childPtrSize; const int nOverrun = 18; /* Size of the overrun padding */ pPage->xParseCell(pPage, pCellBody, &pCur->info); nCell = (int)pCur->info.nKey; testcase( nCell<0 ); /* True if key size is 2^32 or more */ testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */ testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */ testcase( nCell==2 ); /* Minimum legal index key size */ if( nCell<2 || nCell/pCur->pBt->usableSize>pCur->pBt->nPage ){ rc = SQLITE_CORRUPT_PAGE(pPage); goto moveto_finish; } |
︙ | |||
70821 70822 70823 70824 70825 70826 70827 70828 70829 70830 70831 70832 70833 70834 | 70896 70897 70898 70899 70900 70901 70902 70903 70904 70905 70906 70907 70908 70909 70910 | + | for(i=0; i<nOld; i++){ MemPage *pOld = apOld[i]; int limit = pOld->nCell; u8 *aData = pOld->aData; u16 maskPage = pOld->maskPage; u8 *piCell = aData + pOld->cellOffset; u8 *piEnd; VVA_ONLY( int nCellAtStart = b.nCell; ) /* Verify that all sibling pages are of the same "type" (table-leaf, ** table-interior, index-leaf, or index-interior). */ if( pOld->aData[0]!=apOld[0]->aData[0] ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; |
︙ | |||
70849 70850 70851 70852 70853 70854 70855 70856 70857 70858 70859 70860 70861 70862 70863 70864 70865 70866 70867 70868 70869 70870 70871 70872 70873 70874 70875 70876 70877 70878 70879 70880 70881 | 70925 70926 70927 70928 70929 70930 70931 70932 70933 70934 70935 70936 70937 70938 70939 70940 70941 70942 70943 70944 70945 70946 70947 70948 70949 70950 70951 70952 70953 70954 70955 70956 70957 70958 70959 70960 70961 70962 | + + + + + | ** This must be done in advance. Once the balance starts, the cell ** offset section of the btree page will be overwritten and we will no ** long be able to find the cells if a pointer to each cell is not saved ** first. */ memset(&b.szCell[b.nCell], 0, sizeof(b.szCell[0])*(limit+pOld->nOverflow)); if( pOld->nOverflow>0 ){ if( limit<pOld->aiOvfl[0] ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; } limit = pOld->aiOvfl[0]; for(j=0; j<limit; j++){ b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell)); piCell += 2; b.nCell++; } for(k=0; k<pOld->nOverflow; k++){ assert( k==0 || pOld->aiOvfl[k-1]+1==pOld->aiOvfl[k] );/* NOTE 1 */ b.apCell[b.nCell] = pOld->apOvfl[k]; b.nCell++; } } piEnd = aData + pOld->cellOffset + 2*pOld->nCell; while( piCell<piEnd ){ assert( b.nCell<nMaxCells ); b.apCell[b.nCell] = aData + (maskPage & get2byteAligned(piCell)); piCell += 2; b.nCell++; } assert( (b.nCell-nCellAtStart)==(pOld->nCell+pOld->nOverflow) ); cntOld[i] = b.nCell; if( i<nOld-1 && !leafData){ u16 sz = (u16)szNew[i]; u8 *pTemp; assert( b.nCell<nMaxCells ); b.szCell[b.nCell] = sz; |
︙ | |||
71168 71169 71170 71171 71172 71173 71174 71175 71176 71177 71178 71179 71180 71181 | 71249 71250 71251 71252 71253 71254 71255 71256 71257 71258 71259 71260 71261 71262 71263 | + | int iOld = 0; for(i=0; i<b.nCell; i++){ u8 *pCell = b.apCell[i]; while( i==cntOldNext ){ iOld++; assert( iOld<nNew || iOld<nOld ); assert( iOld>=0 && iOld<NB ); pOld = iOld<nNew ? apNew[iOld] : apOld[iOld]; cntOldNext += pOld->nCell + pOld->nOverflow + !leafData; } if( i==cntNew[iNew] ){ pNew = apNew[++iNew]; if( !leafData ) continue; } |
︙ | |||
73888 73889 73890 73891 73892 73893 73894 | 73970 73971 73972 73973 73974 73975 73976 73977 73978 73979 73980 73981 73982 73983 73984 | - + | ** between source and destination. If there is a difference, try to ** fix the destination to agree with the source. If that is not possible, ** then the backup cannot proceed. */ if( nSrcReserve!=nDestReserve ){ u32 newPgsz = nSrcPgsz; rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve); |
︙ | |||
74435 74436 74437 74438 74439 74440 74441 74442 74443 74444 74445 74446 74447 74448 74449 74450 74451 74452 74453 74454 74455 74456 74457 74458 74459 74460 | 74517 74518 74519 74520 74521 74522 74523 74524 74525 74526 74527 74528 74529 74530 74531 74532 74533 74534 74535 74536 74537 74538 74539 74540 74541 74542 74543 74544 74545 74546 74547 74548 74549 74550 74551 74552 74553 74554 74555 74556 | + + + + + - - + + | ** stores a single value in the VDBE. Mem is an opaque structure visible ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value */ /* #include "sqliteInt.h" */ /* #include "vdbeInt.h" */ /* True if X is a power of two. 0 is considered a power of two here. ** In other words, return true if X has at most one bit set. */ #define ISPOWEROF2(X) (((X)&((X)-1))==0) #ifdef SQLITE_DEBUG /* ** Check invariants on a Mem object. ** ** This routine is intended for use inside of assert() statements, like ** this: assert( sqlite3VdbeCheckMemInvariants(pMem) ); */ SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){ /* If MEM_Dyn is set then Mem.xDel!=0. ** Mem.xDel might not be initialized if MEM_Dyn is clear. */ assert( (p->flags & MEM_Dyn)==0 || p->xDel!=0 ); /* MEM_Dyn may only be set if Mem.szMalloc==0. In this way we ** ensure that if Mem.szMalloc>0 then it is safe to do ** Mem.z = Mem.zMalloc without having to check Mem.flags&MEM_Dyn. ** That saves a few cycles in inner loops. */ assert( (p->flags & MEM_Dyn)==0 || p->szMalloc==0 ); |
︙ | |||
74508 74509 74510 74511 74512 74513 74514 74515 74516 74517 | 74595 74596 74597 74598 74599 74600 74601 74602 74603 74604 74605 74606 74607 74608 74609 74610 74611 74612 74613 74614 74615 74616 74617 74618 74619 74620 74621 74622 74623 74624 74625 74626 74627 74628 74629 74630 74631 74632 74633 74634 74635 74636 74637 74638 74639 74640 74641 74642 74643 74644 74645 74646 74647 74648 74649 74650 74651 74652 74653 74654 74655 74656 74657 74658 74659 74660 74661 74662 74663 74664 74665 74666 74667 74668 74669 | + + + + + + + + + + + + + + + + + + + + + - + + - + - - - - + + + + + + + + - + + + + | ((p->flags&MEM_Ephem)!=0 ? 1 : 0) + ((p->flags&MEM_Static)!=0 ? 1 : 0) == 1 ); } return 1; } #endif /* ** Render a Mem object which is one of MEM_Int, MEM_Real, or MEM_IntReal ** into a buffer. */ static void vdbeMemRenderNum(int sz, char *zBuf, Mem *p){ StrAccum acc; assert( p->flags & (MEM_Int|MEM_Real|MEM_IntReal) ); sqlite3StrAccumInit(&acc, 0, zBuf, sz, 0); if( p->flags & MEM_Int ){ sqlite3_str_appendf(&acc, "%lld", p->u.i); }else if( p->flags & MEM_IntReal ){ sqlite3_str_appendf(&acc, "%!.15g", (double)p->u.i); }else{ sqlite3_str_appendf(&acc, "%!.15g", p->u.r); } assert( acc.zText==zBuf && acc.mxAlloc<=0 ); zBuf[acc.nChar] = 0; /* Fast version of sqlite3StrAccumFinish(&acc) */ } #ifdef SQLITE_DEBUG /* ** Validity checks on pMem. pMem holds a string. ** |
︙ | |||
74651 74652 74653 74654 74655 74656 74657 | 74767 74768 74769 74770 74771 74772 74773 74774 74775 74776 74777 74778 74779 74780 74781 74782 74783 74784 74785 74786 74787 74788 74789 74790 74791 74792 74793 74794 74795 74796 74797 74798 74799 74800 74801 74802 74803 74804 74805 74806 74807 74808 74809 74810 74811 74812 74813 74814 | - - + + - + + + + + + - + + | /* ** Change the pMem->zMalloc allocation to be at least szNew bytes. ** If pMem->zMalloc already meets or exceeds the requested size, this ** routine is a no-op. ** ** Any prior string or blob content in the pMem object may be discarded. ** The pMem->xDel destructor is called, if it exists. Though MEM_Str |
︙ | |||
74752 74753 74754 74755 74756 74757 74758 | 74874 74875 74876 74877 74878 74879 74880 74881 74882 74883 74884 74885 74886 74887 74888 74889 74890 74891 74892 74893 74894 74895 74896 74897 74898 74899 74900 74901 74902 74903 74904 74905 74906 74907 74908 74909 74910 74911 74912 74913 74914 74915 74916 74917 74918 74919 74920 74921 74922 | - - - + + + - - + + - - - - + + + - - - - - - - - + - - - - - + | return SQLITE_OK; /* Nothing to do */ }else{ return vdbeMemAddTerminator(pMem); } } /* |
︙ | |||
74972 74973 74974 74975 74976 74977 74978 | 75082 75083 75084 75085 75086 75087 75088 75089 75090 75091 75092 75093 75094 75095 75096 75097 | + - + | return value; } SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ int flags; assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); flags = pMem->flags; if( flags & (MEM_Int|MEM_IntReal) ){ |
︙ | |||
75001 75002 75003 75004 75005 75006 75007 | 75112 75113 75114 75115 75116 75117 75118 75119 75120 75121 75122 75123 75124 75125 75126 75127 75128 75129 75130 75131 75132 75133 75134 75135 75136 75137 75138 75139 75140 75141 75142 75143 | - + + - + + | return val; } SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){ assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); assert( EIGHT_BYTE_ALIGNMENT(pMem) ); if( pMem->flags & MEM_Real ){ return pMem->u.r; |
︙ | |||
75078 75079 75080 75081 75082 75083 75084 75085 75086 75087 75088 75089 | 75191 75192 75193 75194 75195 75196 75197 75198 75199 75200 75201 75202 75203 75204 75205 75206 75207 75208 75209 75210 75211 75212 75213 75214 75215 75216 75217 75218 75219 75220 75221 75222 75223 75224 75225 75226 75227 75228 75229 75230 75231 75232 75233 75234 75235 75236 75237 75238 75239 75240 75241 75242 75243 75244 75245 75246 75247 | + + - + + - + + - + + + + + - + + - - - - - - - - - - - - - + + + + + + + + + + - - + | pMem->u.r = sqlite3VdbeRealValue(pMem); MemSetTypeFlag(pMem, MEM_Real); return SQLITE_OK; } /* Compare a floating point value to an integer. Return true if the two ** values are the same within the precision of the floating point value. ** ** This function assumes that i was obtained by assignment from r1. ** ** For some versions of GCC on 32-bit machines, if you do the more obvious ** comparison of "r1==(double)i" you sometimes get an answer of false even ** though the r1 and (double)i values are bit-for-bit the same. */ |
︙ | |||
75158 75159 75160 75161 75162 75163 75164 | 75276 75277 75278 75279 75280 75281 75282 75283 75284 75285 75286 75287 75288 75289 75290 | - + | } default: { assert( aff==SQLITE_AFF_TEXT ); assert( MEM_Str==(MEM_Blob>>3) ); pMem->flags |= (pMem->flags&MEM_Blob)>>3; sqlite3ValueApplyAffinity(pMem, SQLITE_AFF_TEXT, encoding); assert( pMem->flags & MEM_Str || pMem->db->mallocFailed ); |
︙ | |||
75342 75343 75344 75345 75346 75347 75348 | 75460 75461 75462 75463 75464 75465 75466 75467 75468 75469 75470 75471 75472 75473 75474 | - + | /* If pX is marked as a shallow copy of pMem, then verify that ** no significant changes have been made to pX since the OP_SCopy. ** A significant change would indicated a missed call to this ** function for pX. Minor changes, such as adding or removing a ** dual type, are allowed, as long as the underlying value is the ** same. */ u16 mFlags = pMem->flags & pX->flags & pX->mScopyFlags; |
︙ | |||
75617 75618 75619 75620 75621 75622 75623 | 75735 75736 75737 75738 75739 75740 75741 75742 75743 75744 75745 75746 75747 75748 75749 | - + | }else{ sqlite3VdbeMemStringify(pVal, enc, 0); assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) ); } assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0 || pVal->db->mallocFailed ); if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){ |
︙ | |||
75640 75641 75642 75643 75644 75645 75646 | 75758 75759 75760 75761 75762 75763 75764 75765 75766 75767 75768 75769 75770 75771 75772 | - + | */ SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ if( !pVal ) return 0; assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) ); assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) ); assert( !sqlite3VdbeMemIsRowSet(pVal) ); if( (pVal->flags&(MEM_Str|MEM_Term))==(MEM_Str|MEM_Term) && pVal->enc==enc ){ |
︙ | |||
75905 75906 75907 75908 75909 75910 75911 | 76023 76024 76025 76026 76027 76028 76029 76030 76031 76032 76033 76034 76035 76036 76037 76038 76039 76040 76041 76042 | + - + + + + + | sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); } if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_BLOB ){ sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); }else{ sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); } assert( (pVal->flags & MEM_IntReal)==0 ); |
︙ | |||
75928 75929 75930 75931 75932 75933 75934 | 76051 76052 76053 76054 76055 76056 76057 76058 76059 76060 76061 76062 76063 76064 76065 | - + | pVal->u.i = -pVal->u.i; } sqlite3ValueApplyAffinity(pVal, affinity, enc); } }else if( op==TK_NULL ){ pVal = valueNew(db, pCtx); if( pVal==0 ) goto no_mem; |
︙ | |||
76940 76941 76942 76943 76944 76945 76946 76947 76948 76949 76950 76951 76952 76953 76954 76955 76956 76957 76958 76959 76960 76961 76962 76963 76964 76965 76966 76967 76968 76969 76970 76971 76972 76973 76974 76975 76976 76977 76978 76979 | 77063 77064 77065 77066 77067 77068 77069 77070 77071 77072 77073 77074 77075 77076 77077 77078 77079 77080 77081 77082 77083 77084 77085 77086 77087 77088 77089 77090 77091 77092 77093 77094 77095 77096 77097 77098 77099 77100 77101 77102 77103 77104 77105 77106 77107 77108 77109 77110 77111 77112 77113 77114 77115 77116 77117 77118 77119 77120 | + + + + + + + + + - + + | ** ** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) ); */ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ int hasAbort = 0; int hasFkCounter = 0; int hasCreateTable = 0; int hasCreateIndex = 0; int hasInitCoroutine = 0; Op *pOp; VdbeOpIter sIter; memset(&sIter, 0, sizeof(sIter)); sIter.v = v; while( (pOp = opIterNext(&sIter))!=0 ){ int opcode = pOp->opcode; if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename || opcode==OP_VDestroy || (opcode==OP_Function0 && pOp->p4.pFunc->funcFlags&SQLITE_FUNC_INTERNAL) || ((opcode==OP_Halt || opcode==OP_HaltIfNull) && ((pOp->p1)!=SQLITE_OK && pOp->p2==OE_Abort)) ){ hasAbort = 1; break; } if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1; if( mayAbort ){ /* hasCreateIndex may also be set for some DELETE statements that use ** OP_Clear. So this routine may end up returning true in the case ** where a "DELETE FROM tbl" has a statement-journal but does not ** require one. This is not so bad - it is an inefficiency, not a bug. */ if( opcode==OP_CreateBtree && pOp->p3==BTREE_BLOBKEY ) hasCreateIndex = 1; if( opcode==OP_Clear ) hasCreateIndex = 1; } if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1; #ifndef SQLITE_OMIT_FOREIGN_KEY if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){ hasFkCounter = 1; } #endif } sqlite3DbFree(v->db, sIter.apSub); /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. ** If malloc failed, then the while() loop above may not have iterated ** through all opcodes and hasAbort may be set incorrectly. Return ** true for this case to prevent the assert() in the callers frame ** from failing. */ return ( v->db->mallocFailed || hasAbort==mayAbort || hasFkCounter |
︙ | |||
77845 77846 77847 77848 77849 77850 77851 | 77978 77979 77980 77981 77982 77983 77984 77985 77986 77987 77988 77989 77990 77991 77992 | - + | sqlite3_str_appendf(&x, "%.16g", *pOp->p4.pReal); break; } case P4_MEM: { Mem *pMem = pOp->p4.pMem; if( pMem->flags & MEM_Str ){ zP4 = pMem->z; |
︙ | |||
79207 79208 79209 79210 79211 79212 79213 | 79340 79341 79342 79343 79344 79345 79346 79347 79348 79349 79350 79351 79352 79353 79354 | - + | db->autoCommit = 1; p->nChange = 0; } } } /* Check for immediate foreign key violations. */ |
︙ | |||
79733 79734 79735 79736 79737 79738 79739 79740 79741 79742 79743 79744 79745 79746 79747 79748 79749 | 79866 79867 79868 79869 79870 79871 79872 79873 79874 79875 79876 79877 79878 79879 79880 79881 79882 79883 79884 79885 79886 79887 79888 79889 79890 79891 79892 79893 79894 79895 79896 79897 79898 79899 79900 79901 79902 79903 79904 79905 79906 79907 79908 79909 79910 79911 79912 79913 79914 79915 79916 79917 79918 79919 79920 79921 79922 79923 79924 79925 79926 | + + - + + + + + + + + + + + + | ** ** The 8 and 9 types were added in 3.3.0, file format 4. Prior versions ** of SQLite will not understand those serial types. */ /* ** Return the serial-type for the value stored in pMem. ** ** This routine might convert a large MEM_IntReal value into MEM_Real. */ SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32 *pLen){ int flags = pMem->flags; u32 n; assert( pLen!=0 ); if( flags&MEM_Null ){ *pLen = 0; return 0; } |
︙ | |||
79940 79941 79942 79943 79944 79945 79946 | 80086 80087 80088 80089 80090 80091 80092 80093 80094 80095 80096 80097 80098 80099 80100 | - + | ** and store the result in pMem. Return the number of bytes read. ** ** This function is implemented as two separate routines for performance. ** The few cases that require local variables are broken out into a separate ** routine so that in most cases the overhead of moving the stack pointer ** is avoided. */ |
︙ | |||
79972 79973 79974 79975 79976 79977 79978 | 80118 80119 80120 80121 80122 80123 80124 80125 80126 80127 80128 80129 80130 80131 80132 | - + | u64 t2 = t1; swapMixedEndianFloat(t2); assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 ); #endif assert( sizeof(x)==8 && sizeof(pMem->u.r)==8 ); swapMixedEndianFloat(x); memcpy(&pMem->u.r, &x, sizeof(x)); |
︙ | |||
80422 80423 80424 80425 80426 80427 80428 | 80568 80569 80570 80571 80572 80573 80574 80575 80576 80577 80578 80579 80580 80581 80582 80583 80584 80585 80586 80587 80588 80589 80590 80591 80592 80593 80594 80595 80596 80597 80598 80599 80600 80601 80602 80603 80604 80605 80606 80607 80608 80609 80610 80611 80612 80613 80614 | - - + + + + + + + + - + + + + + + + - + + | */ if( combined_flags&MEM_Null ){ return (f2&MEM_Null) - (f1&MEM_Null); } /* At least one of the two values is a number */ |
︙ | |||
80590 80591 80592 80593 80594 80595 80596 | 80749 80750 80751 80752 80753 80754 80755 80756 80757 80758 80759 80760 80761 80762 80763 80764 80765 | + - + + | assert( pPKey2->pKeyInfo->aSortOrder!=0 ); assert( pPKey2->pKeyInfo->nKeyField>0 ); assert( idx1<=szHdr1 || CORRUPT_DB ); do{ u32 serial_type; /* RHS is an integer */ if( pRhs->flags & (MEM_Int|MEM_IntReal) ){ |
︙ | |||
80935 80936 80937 80938 80939 80940 80941 | 81096 81097 81098 81099 81100 81101 81102 81103 81104 81105 81106 81107 81108 81109 81110 81111 81112 | + - + + | } if( (flags & MEM_Int) ){ return vdbeRecordCompareInt; } testcase( flags & MEM_Real ); testcase( flags & MEM_Null ); testcase( flags & MEM_Blob ); if( (flags & (MEM_Real|MEM_IntReal|MEM_Null|MEM_Blob))==0 |
︙ | |||
81525 81526 81527 81528 81529 81530 81531 | 81688 81689 81690 81691 81692 81693 81694 81695 81696 81697 81698 81699 81700 81701 81702 81703 81704 81705 81706 81707 81708 81709 81710 81711 81712 81713 81714 81715 81716 81717 81718 81719 81720 81721 81722 81723 81724 81725 81726 81727 81728 81729 81730 81731 81732 81733 81734 81735 81736 81737 81738 81739 81740 81741 81742 81743 81744 81745 81746 81747 81748 81749 81750 81751 81752 81753 81754 81755 81756 81757 81758 81759 81760 81761 81762 81763 81764 81765 81766 81767 81768 81769 81770 81771 81772 81773 81774 81775 81776 81777 81778 81779 81780 81781 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #endif /* SQLITE_OMIT_UTF16 */ /* EVIDENCE-OF: R-12793-43283 Every value in SQLite has one of five ** fundamental datatypes: 64-bit signed integer 64-bit IEEE floating ** point number string BLOB NULL */ SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){ static const u8 aType[] = { |
︙ | |||
81806 81807 81808 81809 81810 81811 81812 81813 81814 81815 81816 81817 81818 81819 | 82016 82017 82018 82019 82020 82021 82022 82023 82024 82025 82026 82027 82028 82029 82030 82031 82032 82033 82034 82035 82036 82037 82038 82039 82040 82041 82042 82043 82044 | + + + + + + + + + + + + + + + | /* An SQLITE_NOMEM error. */ SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){ assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); sqlite3VdbeMemSetNull(pCtx->pOut); pCtx->isError = SQLITE_NOMEM_BKPT; sqlite3OomFault(pCtx->pOut->db); } #ifndef SQLITE_UNTESTABLE /* Force the INT64 value currently stored as the result to be ** a MEM_IntReal value. See the SQLITE_TESTCTRL_RESULT_INTREAL ** test-control. */ SQLITE_PRIVATE void sqlite3ResultIntReal(sqlite3_context *pCtx){ assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) ); if( pCtx->pOut->flags & MEM_Int ){ pCtx->pOut->flags &= ~MEM_Int; pCtx->pOut->flags |= MEM_IntReal; } } #endif /* ** This function is called after a transaction has been committed. It ** invokes callbacks registered with sqlite3_wal_hook() as required. */ static int doWalCallbacks(sqlite3 *db){ int rc = SQLITE_OK; |
︙ | |||
83093 83094 83095 83096 83097 83098 83099 | 83318 83319 83320 83321 83322 83323 83324 83325 83326 83327 83328 83329 83330 83331 83332 83333 83334 | + - + + | pMem = *ppValue = &p->pUnpacked->aMem[iIdx]; if( iIdx==p->pTab->iPKey ){ sqlite3VdbeMemSetInt64(pMem, p->iKey1); }else if( iIdx>=p->pUnpacked->nField ){ *ppValue = (sqlite3_value *)columnNullValue(); }else if( p->pTab->aCol[iIdx].affinity==SQLITE_AFF_REAL ){ if( pMem->flags & (MEM_Int|MEM_IntReal) ){ |
︙ | |||
83412 83413 83414 83415 83416 83417 83418 | 83639 83640 83641 83642 83643 83644 83645 83646 83647 83648 83649 83650 83651 83652 83653 | - + | } zRawSql += nToken; nextIndex = idx + 1; assert( idx>0 && idx<=p->nVar ); pVar = &p->aVar[idx-1]; if( pVar->flags & MEM_Null ){ sqlite3_str_append(&out, "NULL", 4); |
︙ | |||
83674 83675 83676 83677 83678 83679 83680 | 83901 83902 83903 83904 83905 83906 83907 83908 83909 83910 83911 83912 83913 83914 | - - - - - - - - | if( (mNever&0x08)!=0 && (I&0x05)!=0) I |= 0x05; /*NO_TEST*/ } sqlite3GlobalConfig.xVdbeBranch(sqlite3GlobalConfig.pVdbeBranchArg, iSrcLine&0xffffff, I, M); } #endif |
︙ | |||
83743 83744 83745 83746 83747 83748 83749 | 83962 83963 83964 83965 83966 83967 83968 83969 83970 83971 83972 83973 83974 83975 83976 83977 83978 83979 83980 83981 83982 83983 83984 83985 83986 83987 83988 83989 83990 83991 83992 83993 83994 83995 83996 83997 83998 83999 84000 84001 84002 84003 84004 84005 84006 84007 84008 84009 84010 84011 84012 84013 84014 84015 84016 84017 84018 84019 84020 84021 84022 84023 84024 84025 84026 84027 84028 84029 84030 84031 84032 84033 | - + + + + + + + + + + + + + + + + - + - - - - + + + + | assert( iCur>=0 && iCur<p->nCursor ); if( p->apCsr[iCur] ){ /*OPTIMIZATION-IF-FALSE*/ /* Before calling sqlite3VdbeFreeCursor(), ensure the isEphemeral flag ** is clear. Otherwise, if this is an ephemeral cursor created by ** OP_OpenDup, the cursor will not be closed and will still be part ** of a BtShared.pCursor list. */ |
︙ | |||
83839 83840 83841 83842 83843 83844 83845 | 84073 84074 84075 84076 84077 84078 84079 84080 84081 84082 84083 84084 84085 84086 84087 84088 84089 84090 84091 84092 84093 84094 | - + + + + - + | }else if( affinity==SQLITE_AFF_TEXT ){ /* Only attempt the conversion to TEXT if there is an integer or real ** representation (blob and NULL do not get converted) but no string ** representation. It would be harmless to repeat the conversion if ** there is already a string rep, but it is pointless to waste those ** CPU cycles. */ if( 0==(pRec->flags&MEM_Str) ){ /*OPTIMIZATION-IF-FALSE*/ |
︙ | |||
83882 83883 83884 83885 83886 83887 83888 | 84119 84120 84121 84122 84123 84124 84125 84126 84127 84128 84129 84130 84131 84132 84133 84134 84135 84136 84137 84138 84139 84140 84141 84142 84143 84144 84145 84146 84147 84148 84149 84150 84151 84152 84153 84154 84155 84156 84157 84158 84159 84160 84161 84162 84163 84164 84165 84166 84167 84168 84169 | + + - + - - - - + + + + + + + + + + - - + + + + + + + | /* ** pMem currently only holds a string type (or maybe a BLOB that we can ** interpret as a string if we want to). Compute its corresponding ** numeric type, if has one. Set the pMem->u.r and pMem->u.i fields ** accordingly. */ static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){ int rc; sqlite3_int64 ix; |
︙ | |||
84001 84002 84003 84004 84005 84006 84007 84008 84009 84010 84011 84012 84013 84014 | 84251 84252 84253 84254 84255 84256 84257 84258 84259 84260 84261 84262 84263 84264 84265 84266 | + + | static void memTracePrint(Mem *p){ if( p->flags & MEM_Undefined ){ printf(" undefined"); }else if( p->flags & MEM_Null ){ printf(p->flags & MEM_Zero ? " NULL-nochng" : " NULL"); }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){ printf(" si:%lld", p->u.i); }else if( (p->flags & (MEM_IntReal))!=0 ){ printf(" ir:%lld", p->u.i); }else if( p->flags & MEM_Int ){ printf(" i:%lld", p->u.i); #ifndef SQLITE_OMIT_FLOATING_POINT }else if( p->flags & MEM_Real ){ printf(" r:%g", p->u.r); #endif }else if( sqlite3VdbeMemIsRowSet(p) ){ |
︙ | |||
85031 85032 85033 85034 85035 85036 85037 | 85283 85284 85285 85286 85287 85288 85289 85290 85291 85292 85293 85294 85295 85296 85297 85298 85299 85300 85301 85302 85303 85304 85305 85306 85307 85308 85309 85310 85311 85312 85313 85314 85315 85316 85317 85318 85319 85320 85321 85322 85323 85324 85325 85326 85327 85328 85329 85330 85331 85332 85333 85334 85335 85336 85337 85338 85339 85340 85341 85342 85343 85344 85345 85346 85347 | - + + + + + + + + - + + + + + - - - + + + + + + + + + + + - + + + + + + | ** P3 = P2 || P1 ** ** It is illegal for P1 and P3 to be the same register. Sometimes, ** if P3 is the same register as P2, the implementation is able ** to avoid a memcpy(). */ case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */ |
︙ | |||
85108 85109 85110 85111 85112 85113 85114 | 85384 85385 85386 85387 85388 85389 85390 85391 85392 85393 85394 85395 85396 85397 85398 85399 85400 85401 85402 85403 85404 85405 85406 85407 85408 85409 85410 85411 85412 85413 85414 | - - | ** If either operand is NULL, the result is NULL. */ case OP_Add: /* same as TK_PLUS, in1, in2, out3 */ case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */ case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */ case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */ case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ |
︙ | |||
85149 85150 85151 85152 85153 85154 85155 | 85423 85424 85425 85426 85427 85428 85429 85430 85431 85432 85433 85434 85435 85436 | - | } } pOut->u.i = iB; MemSetTypeFlag(pOut, MEM_Int); }else if( (flags & MEM_Null)!=0 ){ goto arithmetic_result_is_null; }else{ |
︙ | |||
85181 85182 85183 85184 85185 85186 85187 | 85454 85455 85456 85457 85458 85459 85460 85461 85462 85463 85464 85465 85466 85467 | - - - | MemSetTypeFlag(pOut, MEM_Int); #else if( sqlite3IsNaN(rB) ){ goto arithmetic_result_is_null; } pOut->u.r = rB; MemSetTypeFlag(pOut, MEM_Real); |
︙ | |||
85352 85353 85354 85355 85356 85357 85358 | 85622 85623 85624 85625 85626 85627 85628 85629 85630 85631 85632 85633 85634 85635 85636 85637 85638 | + - + + | ** This opcode is used when extracting information from a column that ** has REAL affinity. Such column values may still be stored as ** integers, for space efficiency, but after extraction we want them ** to have only a real value. */ case OP_RealAffinity: { /* in1 */ pIn1 = &aMem[pOp->p1]; if( pIn1->flags & (MEM_Int|MEM_IntReal) ){ |
︙ | |||
85544 85545 85546 85547 85548 85549 85550 | 85816 85817 85818 85819 85820 85821 85822 85823 85824 85825 85826 85827 85828 85829 85830 85831 85832 85833 85834 85835 85836 85837 85838 85839 85840 85841 85842 85843 85844 85845 85846 85847 85848 85849 85850 85851 85852 85853 85854 85855 85856 85857 85858 85859 85860 85861 85862 85863 85864 85865 | - + - + - + + - + + | break; } }else{ /* Neither operand is NULL. Do a comparison. */ affinity = pOp->p5 & SQLITE_AFF_MASK; if( affinity>=SQLITE_AFF_NUMERIC ){ if( (flags1 | flags3)&MEM_Str ){ |
︙ | |||
86333 86334 86335 86336 86337 86338 86339 | 86607 86608 86609 86610 86611 86612 86613 86614 86615 86616 86617 86618 86619 86620 86621 86622 86623 86624 86625 86626 86627 86628 86629 86630 86631 86632 86633 86634 86635 86636 86637 86638 86639 86640 86641 86642 86643 86644 86645 86646 86647 86648 86649 86650 86651 86652 86653 86654 86655 86656 86657 86658 86659 86660 86661 86662 86663 86664 86665 86666 86667 86668 86669 86670 | - + - + + + + + + + + + + - + - - - + + | const char *zAffinity; /* The affinity to be applied */ zAffinity = pOp->p4.z; assert( zAffinity!=0 ); assert( pOp->p2>0 ); assert( zAffinity[pOp->p2]==0 ); pIn1 = &aMem[pOp->p1]; |
︙ | |||
86413 86414 86415 86416 86417 86418 86419 | 86695 86696 86697 86698 86699 86700 86701 86702 86703 86704 86705 86706 86707 86708 86709 86710 86711 86712 86713 86714 86715 86716 | - + + + + + + + + | /* Apply the requested affinity to all inputs */ assert( pData0<=pLast ); if( zAffinity ){ pRec = pData0; do{ |
︙ | |||
86501 86502 86503 86504 86505 86506 86507 | 86790 86791 86792 86793 86794 86795 86796 86797 86798 86799 86800 86801 86802 86803 86804 86805 86806 86807 86808 86809 86810 86811 86812 86813 86814 86815 86816 86817 86818 86819 86820 86821 86822 86823 86824 86825 86826 86827 86828 86829 86830 86831 | + + + + + + + - + + - + - - + - + - - + + - - - - - - - | if( nByte+nZero>db->aLimit[SQLITE_LIMIT_LENGTH] ){ goto too_big; } if( sqlite3VdbeMemClearAndResize(pOut, (int)nByte) ){ goto no_mem; } } pOut->n = (int)nByte; pOut->flags = MEM_Blob; if( nZero ){ pOut->u.nZero = nZero; pOut->flags |= MEM_Zero; } UPDATE_MAX_BLOBSIZE(pOut); |
︙ | |||
86558 86559 86560 86561 86562 86563 86564 | 86847 86848 86849 86850 86851 86852 86853 86854 86855 86856 86857 86858 86859 86860 86861 86862 86863 | - - + + + | break; } #endif /* Opcode: Savepoint P1 * * P4 * ** ** Open, release or rollback the savepoint named by parameter P4, depending |
︙ | |||
86627 86628 86629 86630 86631 86632 86633 86634 86635 86636 86637 86638 86639 86640 | 86917 86918 86919 86920 86921 86922 86923 86924 86925 86926 86927 86928 86929 86930 86931 | + | pNew->pNext = db->pSavepoint; db->pSavepoint = pNew; pNew->nDeferredCons = db->nDeferredCons; pNew->nDeferredImmCons = db->nDeferredImmCons; } } }else{ assert( p1==SAVEPOINT_RELEASE || p1==SAVEPOINT_ROLLBACK ); iSavepoint = 0; /* Find the named savepoint. If there is no such savepoint, then an ** an error is returned to the user. */ for( pSavepoint = db->pSavepoint; pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName); |
︙ | |||
86680 86681 86682 86683 86684 86685 86686 86687 86688 86689 86690 86691 86692 86693 | 86971 86972 86973 86974 86975 86976 86977 86978 86979 86980 86981 86982 86983 86984 86985 | + | for(ii=0; ii<db->nDb; ii++){ rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT_ROLLBACK, isSchemaChange==0); if( rc!=SQLITE_OK ) goto abort_due_to_error; } }else{ assert( p1==SAVEPOINT_RELEASE ); isSchemaChange = 0; } for(ii=0; ii<db->nDb; ii++){ rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint); if( rc!=SQLITE_OK ){ goto abort_due_to_error; } |
︙ | |||
86716 86717 86718 86719 86720 86721 86722 86723 86724 86725 86726 86727 86728 86729 | 87008 87009 87010 87011 87012 87013 87014 87015 87016 87017 87018 87019 87020 87021 87022 | + | assert( pSavepoint==db->pSavepoint ); db->pSavepoint = pSavepoint->pNext; sqlite3DbFree(db, pSavepoint); if( !isTransaction ){ db->nSavepoint--; } }else{ assert( p1==SAVEPOINT_ROLLBACK ); db->nDeferredCons = pSavepoint->nDeferredCons; db->nDeferredImmCons = pSavepoint->nDeferredImmCons; } if( !isTransaction || p1==SAVEPOINT_ROLLBACK ){ rc = sqlite3VtabSavepoint(db, p1, iSavepoint); if( rc!=SQLITE_OK ) goto abort_due_to_error; |
︙ | |||
87254 87255 87256 87257 87258 87259 87260 | 87547 87548 87549 87550 87551 87552 87553 87554 87555 87556 87557 87558 87559 87560 87561 87562 87563 87564 87565 87566 87567 87568 87569 | + + + + - + + - | SQLITE_OPEN_TRANSIENT_DB; assert( pOp->p1>=0 ); assert( pOp->p2>=0 ); pCx = p->apCsr[pOp->p1]; if( pCx ){ /* If the ephermeral table is already open, erase all existing content ** so that the table is empty again, rather than creating a new table. */ assert( pCx->isEphemeral ); pCx->seqCount = 0; pCx->cacheStatus = CACHE_STALE; if( pCx->pBtx ){ |
︙ | |||
87294 87295 87296 87297 87298 87299 87300 87301 87302 87303 87304 87305 87306 87307 | 87591 87592 87593 87594 87595 87596 87597 87598 87599 87600 87601 87602 87603 87604 87605 | + | 0, pCx->uc.pCursor); pCx->isTable = 1; } } pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); } if( rc ) goto abort_due_to_error; pCx->nullRow = 1; break; } /* Opcode: SorterOpen P1 P2 P3 P4 * ** ** This opcode works like OP_OpenEphemeral except that it opens ** a transient index that is specifically designed to sort large |
︙ | |||
87522 87523 87524 87525 87526 87527 87528 87529 87530 87531 87532 87533 87534 87535 87536 87537 | 87820 87821 87822 87823 87824 87825 87826 87827 87828 87829 87830 87831 87832 87833 87834 87835 87836 87837 87838 87839 87840 87841 87842 87843 87844 87845 87846 87847 87848 87849 87850 87851 87852 87853 87854 87855 87856 87857 87858 87859 87860 87861 87862 | + + - + - + - + - - - - + + + + + + + + | oc = pOp->opcode; eqOnly = 0; pC->nullRow = 0; #ifdef SQLITE_DEBUG pC->seekOp = pOp->opcode; #endif pC->deferredMoveto = 0; pC->cacheStatus = CACHE_STALE; if( pC->isTable ){ /* The BTREE_SEEK_EQ flag is only set on index cursors */ assert( sqlite3BtreeCursorHasHint(pC->uc.pCursor, BTREE_SEEK_EQ)==0 || CORRUPT_DB ); /* The input value in P3 might be of any type: integer, real, string, ** blob, or NULL. But it needs to be an integer before we can do ** the seek, so convert it. */ pIn3 = &aMem[pOp->p3]; |
︙ | |||
87568 87569 87570 87571 87572 87573 87574 | 87872 87873 87874 87875 87876 87877 87878 87879 87880 87881 87882 87883 87884 87885 87886 | - + | ** term, substitute <= for < and > for >=. */ else if( pIn3->u.r>(double)iKey ){ assert( OP_SeekLE==(OP_SeekLT+1) ); assert( OP_SeekGT==(OP_SeekGE+1) ); assert( (OP_SeekLT & 0x0001)==(OP_SeekGE & 0x0001) ); if( (oc & 0x0001)==(OP_SeekLT & 0x0001) ) oc++; } |
︙ | |||
87622 87623 87624 87625 87626 87627 87628 | 87926 87927 87928 87929 87930 87931 87932 87933 87934 87935 87936 87937 87938 87939 | - - | goto abort_due_to_error; } if( eqOnly && r.eqSeen==0 ){ assert( res!=0 ); goto seek_not_found; } } |
︙ | |||
87923 87924 87925 87926 87927 87928 87929 | 88225 88226 88227 88228 88229 88230 88231 88232 88233 88234 88235 88236 88237 88238 88239 88240 88241 | + + - + | case OP_SeekRowid: { /* jump, in3 */ VdbeCursor *pC; BtCursor *pCrsr; int res; u64 iKey; pIn3 = &aMem[pOp->p3]; testcase( pIn3->flags & MEM_Int ); testcase( pIn3->flags & MEM_IntReal ); |
︙ | |||
88298 88299 88300 88301 88302 88303 88304 | 88602 88603 88604 88605 88606 88607 88608 88609 88610 88611 88612 88613 88614 88615 88616 | - + | #ifdef SQLITE_DEBUG if( pOp->p4type==P4_TABLE && HasRowid(pOp->p4.pTab) && pOp->p5==0 ){ /* If p5 is zero, the seek operation that positioned the cursor prior to ** OP_Delete will have also set the pC->movetoTarget field to the rowid of ** the row that is being deleted */ i64 iKey = sqlite3BtreeIntegerKey(pC->uc.pCursor); |
︙ | |||
93545 93546 93547 93548 93549 93550 93551 | 93849 93850 93851 93852 93853 93854 93855 93856 93857 93858 93859 93860 93861 93862 93863 93864 93865 93866 93867 93868 93869 93870 93871 93872 93873 93874 93875 | - + + + + - + - + + | } if( pSorter->list.aMemory ){ int nMin = pSorter->iMemory + nReq; if( nMin>pSorter->nMemory ){ u8 *aNew; |
︙ | |||
95252 95253 95254 95255 95256 95257 95258 95259 95260 95261 95262 95263 95264 95265 | 95560 95561 95562 95563 95564 95565 95566 95567 95568 95569 95570 95571 95572 95573 95574 95575 95576 95577 95578 95579 95580 95581 95582 95583 95584 95585 95586 95587 95588 95589 95590 | + + + + + + + + + + + + + + + + + | } zSpan += n+1; if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){ return 0; } return 1; } /* ** Return TRUE if the double-quoted string mis-feature should be supported. */ static int areDoubleQuotedStringsEnabled(sqlite3 *db, NameContext *pTopNC){ if( db->init.busy ) return 1; /* Always support for legacy schemas */ if( pTopNC->ncFlags & NC_IsDDL ){ /* Currently parsing a DDL statement */ if( sqlite3WritableSchema(db) && (db->flags & SQLITE_DqsDML)!=0 ){ return 1; } return (db->flags & SQLITE_DqsDDL)!=0; }else{ /* Currently parsing a DML statement */ return (db->flags & SQLITE_DqsDML)!=0; } } /* ** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up ** that name in the set of source tables in pSrcList and make the pExpr ** expression node refer back to that source column. The following changes ** are made to pExpr: ** |
︙ | |||
95581 95582 95583 95584 95585 95586 95587 | 95906 95907 95908 95909 95910 95911 95912 95913 95914 95915 95916 95917 95918 95919 95920 95921 95922 | - + + + | ** pExpr. ** ** Because no reference was made to outer contexts, the pNC->nRef ** fields are not changed in any context. */ if( cnt==0 && zTab==0 ){ assert( pExpr->op==TK_ID ); |
︙ | |||
95850 95851 95852 95853 95854 95855 95856 | 96177 96178 96179 96180 96181 96182 96183 96184 96185 96186 96187 96188 96189 96190 96191 | - + | no_such_func = 1; }else{ wrong_num_args = 1; } }else{ is_agg = pDef->xFinalize!=0; if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){ |
︙ | |||
95971 95972 95973 95974 95975 95976 95977 | 96298 96299 96300 96301 96302 96303 96304 96305 96306 96307 96308 96309 96310 96311 96312 96313 96314 | + - + + | } } sqlite3WalkExprList(pWalker, pList); if( is_agg ){ #ifndef SQLITE_OMIT_WINDOWFUNC if( pExpr->y.pWin ){ Select *pSel = pNC->pWinSelect; if( IN_RENAME_OBJECT==0 ){ |
︙ | |||
96031 96032 96033 96034 96035 96036 96037 | 96360 96361 96362 96363 96364 96365 96366 96367 96368 96369 96370 96371 96372 96373 96374 96375 96376 96377 96378 | - + - + | } case TK_VARIABLE: { notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr); break; } case TK_IS: case TK_ISNOT: { |
︙ | |||
96757 96758 96759 96760 96761 96762 96763 | 97086 97087 97088 97089 97090 97091 97092 97093 97094 97095 97096 97097 97098 97099 97100 | - + | ** An error message is left in pParse if anything is amiss. The number ** if errors is returned. */ SQLITE_PRIVATE int sqlite3ResolveExprNames( NameContext *pNC, /* Namespace to resolve expressions in. */ Expr *pExpr /* The expression to be analyzed. */ ){ |
︙ | |||
96871 96872 96873 96874 96875 96876 96877 | 97200 97201 97202 97203 97204 97205 97206 97207 97208 97209 97210 97211 97212 97213 97214 | - + | sSrc.nSrc = 1; sSrc.a[0].zName = pTab->zName; sSrc.a[0].pTab = pTab; sSrc.a[0].iCursor = -1; } sNC.pParse = pParse; sNC.pSrcList = &sSrc; |
︙ | |||
96925 96926 96927 96928 96929 96930 96931 | 97254 97255 97256 97257 97258 97259 97260 97261 97262 97263 97264 97265 97266 97267 97268 97269 97270 97271 97272 97273 | - + + + + + | ** CREATE TABLE t1(a); ** SELECT * FROM t1 WHERE a; ** SELECT a AS b FROM t1 WHERE b; ** SELECT * FROM t1 WHERE (select a from t1); */ SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){ int op; |
︙ | |||
96987 96988 96989 96990 96991 96992 96993 | 97320 97321 97322 97323 97324 97325 97326 97327 97328 97329 97330 97331 97332 97333 97334 | - + | } /* ** Skip over any TK_COLLATE operators and any unlikely() ** or likelihood() function at the root of an expression. */ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){ |
︙ | |||
97654 97655 97656 97657 97658 97659 97660 | 97987 97988 97989 97990 97991 97992 97993 97994 97995 97996 97997 97998 97999 98000 98001 | - + | pNew = sqlite3DbMallocRawNN(db, sizeof(Expr)+nExtra); if( pNew ){ memset(pNew, 0, sizeof(Expr)); pNew->op = (u8)op; pNew->iAgg = -1; if( pToken ){ if( nExtra==0 ){ |
︙ | |||
97731 97732 97733 97734 97735 97736 97737 | 98064 98065 98066 98067 98068 98069 98070 98071 98072 98073 98074 98075 98076 98077 98078 98079 98080 98081 98082 98083 98084 98085 98086 98087 98088 98089 98090 98091 98092 98093 98094 98095 98096 98097 98098 98099 98100 98101 98102 98103 98104 98105 98106 98107 98108 98109 98110 98111 98112 98113 98114 98115 98116 98117 98118 98119 98120 98121 98122 98123 98124 98125 98126 98127 | - - - - - - - - - + + + + + - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - - - + + + - - - + | SQLITE_PRIVATE Expr *sqlite3PExpr( Parse *pParse, /* Parsing context */ int op, /* Expression opcode */ Expr *pLeft, /* Left operand */ Expr *pRight /* Right operand */ ){ Expr *p; |
︙ | |||
97968 97969 97970 97971 97972 97973 97974 97975 97976 97977 97978 97979 97980 97981 | 98269 98270 98271 98272 98273 98274 98275 98276 98277 98278 98279 98280 98281 98282 98283 98284 98285 98286 98287 98288 98289 98290 98291 98292 98293 98294 | + + + + + + + + + + + + | if( !ExprHasProperty(p, EP_Static) ){ sqlite3DbFreeNN(db, p); } } SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){ if( p ) sqlite3ExprDeleteNN(db, p); } /* Invoke sqlite3RenameExprUnmap() and sqlite3ExprDelete() on the ** expression. */ SQLITE_PRIVATE void sqlite3ExprUnmapAndDelete(Parse *pParse, Expr *p){ if( p ){ if( IN_RENAME_OBJECT ){ sqlite3RenameExprUnmap(pParse, p); } sqlite3ExprDeleteNN(pParse->db, p); } } /* ** Return the number of bytes allocated for the expression structure ** passed as the first argument. This is always one of EXPR_FULLSIZE, ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. */ static int exprStructSize(Expr *p){ |
︙ | |||
98551 98552 98553 98554 98555 98556 98557 | 98864 98865 98866 98867 98868 98869 98870 98871 98872 98873 98874 98875 98876 98877 98878 | - - + - - | /* Remember the size of the LHS in iTable so that we can check that ** the RHS and LHS sizes match during code generation. */ pFirst->iTable = pColumns->nId; } vector_append_error: |
︙ | |||
98702 98703 98704 98705 98706 98707 98708 98709 98710 98711 98712 98713 98714 98715 98716 98717 98718 98719 98720 98721 98722 98723 98724 98725 98726 98727 98728 98729 98730 | 99012 99013 99014 99015 99016 99017 99018 99019 99020 99021 99022 99023 99024 99025 99026 99027 99028 99029 99030 99031 99032 99033 99034 99035 99036 99037 99038 99039 99040 99041 99042 99043 99044 99045 99046 99047 99048 99049 99050 99051 99052 99053 99054 99055 99056 99057 99058 99059 99060 99061 99062 99063 99064 99065 99066 99067 99068 99069 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | SQLITE_PRIVATE int sqlite3ExprIdToTrueFalse(Expr *pExpr){ assert( pExpr->op==TK_ID || pExpr->op==TK_STRING ); if( !ExprHasProperty(pExpr, EP_Quoted) && (sqlite3StrICmp(pExpr->u.zToken, "true")==0 || sqlite3StrICmp(pExpr->u.zToken, "false")==0) ){ pExpr->op = TK_TRUEFALSE; ExprSetProperty(pExpr, pExpr->u.zToken[4]==0 ? EP_IsTrue : EP_IsFalse); return 1; } return 0; } /* ** The argument must be a TK_TRUEFALSE Expr node. Return 1 if it is TRUE ** and 0 if it is FALSE. */ SQLITE_PRIVATE int sqlite3ExprTruthValue(const Expr *pExpr){ pExpr = sqlite3ExprSkipCollate((Expr*)pExpr); assert( pExpr->op==TK_TRUEFALSE ); assert( sqlite3StrICmp(pExpr->u.zToken,"true")==0 || sqlite3StrICmp(pExpr->u.zToken,"false")==0 ); return pExpr->u.zToken[4]==0; } /* ** If pExpr is an AND or OR expression, try to simplify it by eliminating ** terms that are always true or false. Return the simplified expression. ** Or return the original expression if no simplification is possible. ** ** Examples: ** ** (x<10) AND true => (x<10) ** (x<10) AND false => false ** (x<10) AND (y=22 OR false) => (x<10) AND (y=22) ** (x<10) AND (y=22 OR true) => (x<10) ** (y=22) OR true => true */ SQLITE_PRIVATE Expr *sqlite3ExprSimplifiedAndOr(Expr *pExpr){ assert( pExpr!=0 ); if( pExpr->op==TK_AND || pExpr->op==TK_OR ){ Expr *pRight = sqlite3ExprSimplifiedAndOr(pExpr->pRight); Expr *pLeft = sqlite3ExprSimplifiedAndOr(pExpr->pLeft); if( ExprAlwaysTrue(pLeft) || ExprAlwaysFalse(pRight) ){ pExpr = pExpr->op==TK_AND ? pRight : pLeft; }else if( ExprAlwaysTrue(pRight) || ExprAlwaysFalse(pLeft) ){ pExpr = pExpr->op==TK_AND ? pLeft : pRight; } } return pExpr; } /* ** These routines are Walker callbacks used to check expressions to ** see if they are "constant" for some definition of constant. The ** Walker.eCode value determines the type of "constant" we are looking ** for. |
︙ | |||
98962 98963 98964 98965 98966 98967 98968 | 99301 99302 99303 99304 99305 99306 99307 99308 99309 99310 99311 99312 99313 99314 99315 | - + | ** If the expression p codes a constant integer that is small enough ** to fit in a 32-bit integer, return 1 and put the value of the integer ** in *pValue. If the expression is not an integer or if it is too big ** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. */ SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ int rc = 0; |
︙ | |||
99691 99692 99693 99694 99695 99696 99697 99698 99699 99700 99701 99702 99703 99704 | 100030 100031 100032 100033 100034 100035 100036 100037 100038 100039 100040 100041 100042 100043 100044 | + | /* If the expression is not constant then we will need to ** disable the test that was generated above that makes sure ** this code only executes once. Because for a non-constant ** expression we need to rerun this code each time. */ if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ sqlite3VdbeChangeToNoop(v, addrOnce); ExprClearProperty(pExpr, EP_Subrtn); addrOnce = 0; } /* Evaluate the expression and insert it into the temp table */ r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iTab, r2, r3, 1); |
︙ | |||
100257 100258 100259 100260 100261 100262 100263 | 100597 100598 100599 100600 100601 100602 100603 100604 100605 100606 100607 100608 100609 100610 100611 100612 | - + + | } /* ** Convert a scalar expression node to a TK_REGISTER referencing ** register iReg. The caller must ensure that iReg already contains ** the correct value for the expression. */ |
︙ | |||
101309 101310 101311 101312 101313 101314 101315 | 101650 101651 101652 101653 101654 101655 101656 101657 101658 101659 101660 101661 101662 101663 101664 101665 101666 101667 101668 101669 101670 101671 101672 101673 101674 101675 101676 101677 101678 101679 101680 | - - - - - - + + + + + + + + + + + + - - + - - - - + + + + | int r1, r2; assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 ); if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */ if( NEVER(pExpr==0) ) return; /* No way this can happen */ op = pExpr->op; switch( op ){ |
︙ | |||
101406 101407 101408 101409 101410 101411 101412 | 101752 101753 101754 101755 101756 101757 101758 101759 101760 101761 101762 101763 101764 101765 101766 101767 101768 | - + - + | sqlite3VdbeGoto(v, dest); sqlite3VdbeResolveLabel(v, destIfFalse); break; } #endif default: { default_expr: |
︙ | |||
101476 101477 101478 101479 101480 101481 101482 | 101822 101823 101824 101825 101826 101827 101828 101829 101830 101831 101832 101833 101834 101835 101836 101837 101838 101839 101840 101841 101842 101843 101844 101845 101846 101847 101848 101849 101850 101851 101852 | - - - - + + + + + + + + + - - + - - - - - - + + + + + + + | assert( pExpr->op!=TK_EQ || op==OP_Ne ); assert( pExpr->op!=TK_LT || op==OP_Ge ); assert( pExpr->op!=TK_LE || op==OP_Gt ); assert( pExpr->op!=TK_GT || op==OP_Le ); assert( pExpr->op!=TK_GE || op==OP_Lt ); switch( pExpr->op ){ |
︙ | |||
101576 101577 101578 101579 101580 101581 101582 | 101927 101928 101929 101930 101931 101932 101933 101934 101935 101936 101937 101938 101939 101940 101941 101942 101943 | - + - + | sqlite3VdbeResolveLabel(v, destIfNull); } break; } #endif default: { default_expr: |
︙ | |||
101734 101735 101736 101737 101738 101739 101740 101741 101742 101743 101744 101745 101746 101747 | 102085 102086 102087 102088 102089 102090 102091 102092 102093 102094 102095 102096 102097 102098 102099 | + | if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE && (combinedFlags & EP_Reduced)==0 ){ if( pA->iColumn!=pB->iColumn ) return 2; if( pA->op2!=pB->op2 ) return 2; if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; } } return 0; } |
︙ | |||
101780 101781 101782 101783 101784 101785 101786 101787 101788 101789 101790 101791 101792 101793 | 102132 102133 102134 102135 102136 102137 102138 102139 102140 102141 102142 102143 102144 102145 102146 102147 102148 102149 102150 102151 102152 102153 102154 102155 102156 102157 102158 102159 102160 102161 102162 102163 102164 102165 102166 102167 102168 102169 102170 102171 102172 102173 102174 102175 102176 102177 102178 102179 102180 102181 102182 102183 102184 102185 102186 102187 102188 102189 102190 102191 102192 102193 102194 102195 102196 102197 102198 102199 102200 102201 102202 102203 102204 102205 102206 102207 102208 102209 102210 102211 102212 102213 102214 102215 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | */ SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ return sqlite3ExprCompare(0, sqlite3ExprSkipCollate(pA), sqlite3ExprSkipCollate(pB), iTab); } /* ** Return non-zero if Expr p can only be true if pNN is not NULL. */ static int exprImpliesNotNull( Parse *pParse, /* Parsing context */ Expr *p, /* The expression to be checked */ Expr *pNN, /* The expression that is NOT NULL */ int iTab, /* Table being evaluated */ int seenNot /* True if p is an operand of NOT */ ){ assert( p ); assert( pNN ); if( sqlite3ExprCompare(pParse, p, pNN, iTab)==0 ) return 1; switch( p->op ){ case TK_IN: { if( seenNot && ExprHasProperty(p, EP_xIsSelect) ) return 0; assert( ExprHasProperty(p,EP_xIsSelect) || (p->x.pList!=0 && p->x.pList->nExpr>0) ); return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot); } case TK_BETWEEN: { ExprList *pList = p->x.pList; assert( pList!=0 ); assert( pList->nExpr==2 ); if( seenNot ) return 0; if( exprImpliesNotNull(pParse, pList->a[0].pExpr, pNN, iTab, seenNot) || exprImpliesNotNull(pParse, pList->a[1].pExpr, pNN, iTab, seenNot) ){ return 1; } return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot); } case TK_EQ: case TK_NE: case TK_LT: case TK_LE: case TK_GT: case TK_GE: case TK_PLUS: case TK_MINUS: case TK_STAR: case TK_REM: case TK_BITAND: case TK_BITOR: case TK_SLASH: case TK_LSHIFT: case TK_RSHIFT: case TK_CONCAT: { if( exprImpliesNotNull(pParse, p->pRight, pNN, iTab, seenNot) ) return 1; /* Fall thru into the next case */ } case TK_SPAN: case TK_COLLATE: case TK_BITNOT: case TK_UPLUS: case TK_UMINUS: { return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot); } case TK_TRUTH: { if( seenNot ) return 0; if( p->op2!=TK_IS ) return 0; return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, seenNot); } case TK_NOT: { return exprImpliesNotNull(pParse, p->pLeft, pNN, iTab, 1); } } return 0; } /* ** Return true if we can prove the pE2 will always be true if pE1 is ** true. Return false if we cannot complete the proof or if pE2 might ** be false. Examples: ** ** pE1: x==5 pE2: x==5 Result: true |
︙ | |||
101816 101817 101818 101819 101820 101821 101822 | 102238 102239 102240 102241 102242 102243 102244 102245 102246 102247 102248 102249 102250 102251 102252 102253 102254 102255 | - - - - + + + + | } if( pE2->op==TK_OR && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab) || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) ) ){ return 1; } |
︙ | |||
102393 102394 102395 102396 102397 102398 102399 | 102815 102816 102817 102818 102819 102820 102821 102822 102823 102824 102825 102826 102827 102828 102829 102830 102831 102832 102833 102834 102835 102836 102837 102838 102839 102840 | - + - + | ** statement to ensure that the operation has not rendered any schema ** objects unusable. */ static void renameTestSchema(Parse *pParse, const char *zDb, int bTemp){ sqlite3NestedParse(pParse, "SELECT 1 " "FROM \"%w\".%s " |
︙ | |||
102525 102526 102527 102528 102529 102530 102531 | 102947 102948 102949 102950 102951 102952 102953 102954 102955 102956 102957 102958 102959 102960 102961 102962 102963 102964 102965 102966 102967 102968 102969 102970 102971 102972 102973 | - + + - + | /* Rewrite all CREATE TABLE, INDEX, TRIGGER or VIEW statements in ** the schema to use the new table name. */ sqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_table(%Q, type, name, sql, %Q, %Q, %d) " "WHERE (type!='index' OR tbl_name=%Q COLLATE nocase)" |
︙ | |||
102910 102911 102912 102913 102914 102915 102916 | 103333 103334 103335 103336 103337 103338 103339 103340 103341 103342 103343 103344 103345 103346 103347 103348 | - + + | zNew = sqlite3NameFromToken(db, pNew); if( !zNew ) goto exit_rename_column; assert( pNew->n>0 ); bQuote = sqlite3Isquote(pNew->z[0]); sqlite3NestedParse(pParse, "UPDATE \"%w\".%s SET " "sql = sqlite_rename_column(sql, type, name, %Q, %Q, %d, %Q, %d, %d) " |
︙ | |||
103063 103064 103065 103066 103067 103068 103069 103070 103071 103072 103073 103074 103075 103076 103077 103078 103079 103080 103081 103082 103083 103084 103085 | 103487 103488 103489 103490 103491 103492 103493 103494 103495 103496 103497 103498 103499 103500 103501 103502 103503 103504 103505 103506 103507 103508 103509 103510 103511 103512 103513 103514 103515 103516 103517 103518 103519 103520 103521 103522 103523 103524 103525 103526 103527 103528 103529 103530 103531 103532 103533 | + + + + + + + + + + + + + + + + + + + + + + + + | ** Walker callback used by sqlite3RenameExprUnmap(). */ static int renameUnmapExprCb(Walker *pWalker, Expr *pExpr){ Parse *pParse = pWalker->pParse; sqlite3RenameTokenRemap(pParse, 0, (void*)pExpr); return WRC_Continue; } /* ** Walker callback used by sqlite3RenameExprUnmap(). */ static int renameUnmapSelectCb(Walker *pWalker, Select *p){ Parse *pParse = pWalker->pParse; int i; if( ALWAYS(p->pEList) ){ ExprList *pList = p->pEList; for(i=0; i<pList->nExpr; i++){ if( pList->a[i].zName ){ sqlite3RenameTokenRemap(pParse, 0, (void*)pList->a[i].zName); } } } if( ALWAYS(p->pSrc) ){ /* Every Select as a SrcList, even if it is empty */ SrcList *pSrc = p->pSrc; for(i=0; i<pSrc->nSrc; i++){ sqlite3RenameTokenRemap(pParse, 0, (void*)pSrc->a[i].zName); } } return WRC_Continue; } /* ** Remove all nodes that are part of expression pExpr from the rename list. */ SQLITE_PRIVATE void sqlite3RenameExprUnmap(Parse *pParse, Expr *pExpr){ Walker sWalker; memset(&sWalker, 0, sizeof(Walker)); sWalker.pParse = pParse; sWalker.xExprCallback = renameUnmapExprCb; sWalker.xSelectCallback = renameUnmapSelectCb; sqlite3WalkExpr(&sWalker, pExpr); } /* ** Remove all nodes that are part of expression-list pEList from the ** rename list. */ |
︙ | |||
106164 106165 106166 106167 106168 106169 106170 | 106612 106613 106614 106615 106616 106617 106618 106619 106620 106621 106622 106623 106624 106625 106626 | - + | if( !REOPEN_AS_MEMDB(db) ){ rc = sqlite3Init(db, &zErrDyn); } sqlite3BtreeLeaveAll(db); assert( zErrDyn==0 || rc!=SQLITE_OK ); } #ifdef SQLITE_USER_AUTHENTICATION |
︙ | |||
107451 107452 107453 107454 107455 107456 107457 | 107899 107900 107901 107902 107903 107904 107905 107906 107907 107908 107909 107910 107911 107912 107913 107914 107915 107916 107917 107918 107919 107920 | - - + + + + + + - + | ** used by the Table object. */ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){ Index *pIndex, *pNext; #ifdef SQLITE_DEBUG /* Record the number of outstanding lookaside allocations in schema Tables |
︙ | |||
108162 108163 108164 108165 108166 108167 108168 | 108614 108615 108616 108617 108618 108619 108620 108621 108622 108623 108624 108625 108626 108627 108628 | - + | ** CREATE TABLE xyz(a,b,c,d,e,PRIMARY KEY('a'),UNIQUE('b','c' COLLATE trim) ** CREATE INDEX abc ON xyz('c','d' DESC,'e' COLLATE nocase DESC); ** ** This is goofy. But to preserve backwards compatibility we continue to ** accept it. This routine does the necessary conversion. It converts ** the expression given in its argument from a TK_STRING into a TK_ID ** if the expression is just a TK_STRING with an optional COLLATE clause. |
︙ | |||
108559 108560 108561 108562 108563 108564 108565 | 109011 109012 109013 109014 109015 109016 109017 109018 109019 109020 109021 109022 109023 109024 109025 109026 109027 109028 109029 109030 109031 109032 109033 109034 109035 109036 109037 109038 109039 109040 109041 109042 109043 109044 109045 109046 109047 109048 109049 109050 109051 109052 109053 109054 109055 109056 109057 109058 109059 109060 109061 109062 109063 109064 109065 109066 109067 109068 109069 | - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | i16 x = pIdx->aiColumn[i]; assert( x<pIdx->pTable->nCol ); wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst; } pIdx->szIdxRow = sqlite3LogEst(wIndex*4); } |
︙ | |||
108651 108652 108653 108654 108655 108656 108657 108658 108659 108660 108661 108662 108663 | 109144 109145 109146 109147 109148 109149 109150 109151 109152 109153 109154 109155 109156 109157 109158 109159 109160 109161 109162 109163 109164 109165 109166 109167 109168 109169 109170 109171 109172 109173 109174 109175 109176 109177 109178 109179 109180 109181 | + + + + - - + + | if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; if( IN_RENAME_OBJECT ){ sqlite3RenameTokenRemap(pParse, pList->a[0].pExpr, &pTab->iPKey); } pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); pTab->iPKey = -1; sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed || pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); |
︙ | |||
108700 108701 108702 108703 108704 108705 108706 | 109197 109198 109199 109200 109201 109202 109203 109204 109205 109206 109207 109208 109209 109210 109211 109212 109213 109214 109215 109216 109217 109218 109219 109220 109221 109222 109223 109224 109225 109226 109227 109228 109229 109230 | + - + + + + - + + + + + | /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) continue; for(i=n=0; i<nPk; i++){ if( !isDupColumn(pIdx, pIdx->nKeyCol, pPk, i) ){ |
︙ | |||
109830 109831 109832 109833 109834 109835 109836 109837 109838 109839 | 110335 110336 110337 110338 110339 110340 110341 110342 110343 110344 110345 110346 110347 110348 110349 110350 110351 110352 110353 110354 110355 110356 110357 110358 110359 110360 110361 110362 110363 110364 110365 110366 110367 110368 110369 | + + + + + + + + + + + + + + + + - + + | addr2 = sqlite3VdbeCurrentAddr(v); sqlite3VdbeVerifyAbortable(v, OE_Abort); sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord, pIndex->nKeyCol); VdbeCoverage(v); sqlite3UniqueConstraint(pParse, OE_Abort, pIndex); sqlite3VdbeJumpHere(v, j2); }else{ /* Most CREATE INDEX and REINDEX statements that are not UNIQUE can not ** abort. The exception is if one of the indexed expressions contains a ** user function that throws an exception when it is evaluated. But the ** overhead of adding a statement journal to a CREATE INDEX statement is ** very small (since most of the pages written do not contain content that ** needs to be restored if the statement aborts), so we call ** sqlite3MayAbort() for all CREATE INDEX statements. */ sqlite3MayAbort(pParse); addr2 = sqlite3VdbeCurrentAddr(v); } sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx); if( !pIndex->bAscKeyBug ){ /* This OP_SeekEnd opcode makes index insert for a REINDEX go much ** faster by avoiding unnecessary seeks. But the optimization does ** not work for UNIQUE constraint indexes on WITHOUT ROWID tables ** with DESC primary keys, since those indexes have there keys in ** a different order from the main table. ** See ticket: https://www.sqlite.org/src/info/bba7b69f9849b5bf */ |
︙ | |||
110225 110226 110227 110228 110229 110230 110231 | 110747 110748 110749 110750 110751 110752 110753 110754 110755 110756 110757 110758 110759 110760 110761 110762 110763 110764 | - + + | ** tables (when pPk!=0) this will be the declared PRIMARY KEY. For ** normal tables (when pPk==0) this will be the rowid. */ if( pPk ){ for(j=0; j<pPk->nKeyCol; j++){ int x = pPk->aiColumn[j]; assert( x>=0 ); |
︙ | |||
112998 112999 113000 113001 113002 113003 113004 113005 113006 113007 113008 113009 113010 113011 | 113521 113522 113523 113524 113525 113526 113527 113528 113529 113530 113531 113532 113533 113534 113535 | + | ** This file contains the C-language implementations for many of the SQL ** functions of SQLite. (Some function, and in particular the date and ** time functions, are implemented separately.) */ /* #include "sqliteInt.h" */ /* #include <stdlib.h> */ /* #include <assert.h> */ /* #include <math.h> */ /* #include "vdbeInt.h" */ /* ** Return the collating function associated with a function. */ static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ VdbeOp *pOp; |
︙ | |||
113368 113369 113370 113371 113372 113373 113374 | 113892 113893 113894 113895 113896 113897 113898 113899 113900 113901 113902 113903 113904 113905 113906 113907 113908 113909 | - - - - + + + + | } if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; r = sqlite3_value_double(argv[0]); /* If Y==0 and X will fit in a 64-bit int, ** handle the rounding directly, ** otherwise use printf. */ |
︙ | |||
113825 113826 113827 113828 113829 113830 113831 | 114349 114350 114351 114352 114353 114354 114355 114356 114357 114358 114359 114360 114361 114362 114363 114364 114365 114366 114367 114368 114369 114370 114371 114372 114373 114374 114375 114376 114377 114378 114379 114380 114381 114382 114383 114384 114385 114386 114387 114388 114389 114390 | - - - - + + | #ifdef SQLITE_TEST sqlite3_like_count++; #endif sqlite3_result_int(context, 0); return; } #endif |
︙ | |||
114780 114781 114782 114783 114784 114785 114786 | 115302 115303 115304 115305 115306 115307 115308 115309 115310 115311 115312 115313 115314 115315 115316 115317 115318 115319 115320 115321 115322 115323 115324 115325 115326 115327 115328 115329 115330 115331 115332 115333 | - - - - - - - - - - - - - - - - + - + + + + - + - - - + - | assert( rc==SQLITE_NOMEM || rc==SQLITE_OK ); if( rc==SQLITE_NOMEM ){ sqlite3OomFault(db); } } /* |
︙ | |||
115602 115603 115604 115605 115606 115607 115608 | 116109 116110 116111 116112 116113 116114 116115 116116 116117 116118 116119 116120 116121 116122 116123 | - + | iCol = pIdx ? pIdx->aiColumn[i] : -1; pLeft = exprTableRegister(pParse, pTab, regData, iCol); iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; assert( iCol>=0 ); zCol = pFKey->pFrom->aCol[iCol].zName; pRight = sqlite3Expr(db, TK_ID, zCol); pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight); |
︙ | |||
115636 115637 115638 115639 115640 115641 115642 | 116143 116144 116145 116146 116147 116148 116149 116150 116151 116152 116153 116154 116155 116156 116157 116158 116159 116160 116161 | - + - + | assert( pIdx!=0 ); for(i=0; i<pIdx->nKeyCol; i++){ i16 iCol = pIdx->aiColumn[i]; assert( iCol>=0 ); pLeft = exprTableRegister(pParse, pTab, regData, iCol); pRight = sqlite3Expr(db, TK_ID, pTab->aCol[iCol].zName); pEq = sqlite3PExpr(pParse, TK_IS, pLeft, pRight); |
︙ | |||
116246 116247 116248 116249 116250 116251 116252 | 116753 116754 116755 116756 116757 116758 116759 116760 116761 116762 116763 116764 116765 116766 116767 116768 116769 116770 116771 116772 116773 116774 116775 116776 116777 116778 116779 116780 116781 116782 116783 | - + - + | ** parent table are used for the comparison. */ pEq = sqlite3PExpr(pParse, TK_EQ, sqlite3PExpr(pParse, TK_DOT, sqlite3ExprAlloc(db, TK_ID, &tOld, 0), sqlite3ExprAlloc(db, TK_ID, &tToCol, 0)), sqlite3ExprAlloc(db, TK_ID, &tFromCol, 0) ); |
︙ | |||
117259 117260 117261 117262 117263 117264 117265 | 117766 117767 117768 117769 117770 117771 117772 117773 117774 117775 117776 117777 117778 117779 117780 117781 117782 117783 117784 117785 117786 117787 117788 117789 | - + + | } /* If this is not a view, open the table and and all indices */ if( !isView ){ int nIdx; nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, 0, -1, 0, &iDataCur, &iIdxCur); |
︙ | |||
117670 117671 117672 117673 117674 117675 117676 117677 117678 117679 117680 117681 117682 117683 | 118178 118179 118180 118181 118182 118183 118184 118185 118186 118187 118188 118189 118190 118191 118192 118193 118194 118195 118196 118197 118198 118199 | + + + + + + + + | ** value for either the rowid column or its INTEGER PRIMARY KEY alias. ** ** The code generated by this routine will store new index entries into ** registers identified by aRegIdx[]. No index entry is created for ** indices where aRegIdx[i]==0. The order of indices in aRegIdx[] is ** the same as the order of indices on the linked list of indices ** at pTab->pIndex. ** ** (2019-05-07) The generated code also creates a new record for the ** main table, if pTab is a rowid table, and stores that record in the ** register identified by aRegIdx[nIdx] - in other words in the first ** entry of aRegIdx[] past the last index. It is important that the ** record be generated during constraint checks to avoid affinity changes ** to the register content that occur after constraint checks but before ** the new record is inserted. ** ** The caller must have already opened writeable cursors on the main ** table and all applicable indices (that is to say, all indices for which ** aRegIdx[] is not zero). iDataCur is the cursor for the main table when ** inserting or updating a rowid table, or the cursor for the PRIMARY KEY ** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor ** for the first index in the pTab->pIndex list. Cursors for other indices |
︙ | |||
117861 117862 117863 117864 117865 117866 117867 | 118377 118378 118379 118380 118381 118382 118383 118384 118385 118386 118387 118388 118389 118390 118391 | - + | sqlite3VdbeVerifyAbortable(v, onError); sqlite3ExprIfTrue(pParse, pExpr, allOk, SQLITE_JUMPIFNULL); if( onError==OE_Ignore ){ sqlite3VdbeGoto(v, ignoreDest); }else{ char *zName = pCheck->a[i].zName; if( zName==0 ) zName = pTab->zName; |
︙ | |||
118289 118290 118291 118292 118293 118294 118295 118296 118297 118298 118299 118300 118301 118302 | 118805 118806 118807 118808 118809 118810 118811 118812 118813 118814 118815 118816 118817 118818 118819 118820 118821 118822 118823 118824 118825 118826 118827 118828 | + + + + + + + + + + | /* If the IPK constraint is a REPLACE, run it last */ if( ipkTop ){ sqlite3VdbeGoto(v, ipkTop); VdbeComment((v, "Do IPK REPLACE")); sqlite3VdbeJumpHere(v, ipkBottom); } /* Generate the table record */ if( HasRowid(pTab) ){ int regRec = aRegIdx[ix]; sqlite3VdbeAddOp3(v, OP_MakeRecord, regNewData+1, pTab->nCol, regRec); sqlite3SetMakeRecordP5(v, pTab); if( !bAffinityDone ){ sqlite3TableAffinity(v, pTab, 0); } } *pbMayReplace = seenReplace; VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace)); } #ifdef SQLITE_ENABLE_NULL_TRIM /* |
︙ | |||
118339 118340 118341 118342 118343 118344 118345 | 118865 118866 118867 118868 118869 118870 118871 118872 118873 118874 118875 118876 118877 118878 118879 118880 118881 118882 118883 118884 118885 118886 118887 118888 118889 118890 | - - - - | int update_flags, /* True for UPDATE, False for INSERT */ int appendBias, /* True if this is likely to be an append */ int useSeekResult /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */ ){ Vdbe *v; /* Prepared statements under construction */ Index *pIdx; /* An index being inserted or updated */ u8 pik_flags; /* flag values passed to the btree insert */ |
︙ | |||
118382 118383 118384 118385 118386 118387 118388 | 118904 118905 118906 118907 118908 118909 118910 118911 118912 118913 118914 118915 118916 118917 118918 118919 118920 118921 118922 118923 118924 118925 118926 118927 118928 118929 118930 | - - - - - - - - + | } sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i], aRegIdx[i]+1, pIdx->uniqNotNull ? pIdx->nKeyCol: pIdx->nColumn); sqlite3VdbeChangeP5(v, pik_flags); } if( !HasRowid(pTab) ) return; |
︙ | |||
120587 120588 120589 120590 120591 120592 120593 | 121102 121103 121104 121105 121106 121107 121108 121109 121110 121111 121112 121113 121114 121115 121116 121117 121118 | - - - - + + + | #define PragTyp_TABLE_INFO 34 #define PragTyp_TEMP_STORE 35 #define PragTyp_TEMP_STORE_DIRECTORY 36 #define PragTyp_THREADS 37 #define PragTyp_WAL_AUTOCHECKPOINT 38 #define PragTyp_WAL_CHECKPOINT 39 #define PragTyp_ACTIVATE_EXTENSIONS 40 |
︙ | |||
120719 120720 120721 120722 120723 120724 120725 120726 120727 120728 120729 120730 120731 120732 120733 120734 120735 120736 120737 | 121233 121234 121235 121236 121237 121238 121239 121240 121241 121242 121243 121244 121245 121246 121247 121248 121249 121250 121251 121252 121253 | + + | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) {/* zName: */ "cache_spill", /* ePragTyp: */ PragTyp_CACHE_SPILL, /* ePragFlg: */ PragFlg_Result0|PragFlg_SchemaReq|PragFlg_NoColumns1, /* ColNames: */ 0, 0, /* iArg: */ 0 }, #endif #if !defined(SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA) {/* zName: */ "case_sensitive_like", /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE, /* ePragFlg: */ PragFlg_NoColumns, /* ColNames: */ 0, 0, /* iArg: */ 0 }, #endif {/* zName: */ "cell_size_check", /* ePragTyp: */ PragTyp_FLAG, /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, /* ColNames: */ 0, 0, /* iArg: */ SQLITE_CellSizeCk }, #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) {/* zName: */ "checkpoint_fullfsync", |
︙ | |||
120861 120862 120863 120864 120865 120866 120867 | 121377 121378 121379 121380 121381 121382 121383 121384 121385 121386 121387 121388 121389 121390 121391 121392 121393 121394 121395 121396 | - + - + | /* ePragFlg: */ PragFlg_Result0, /* ColNames: */ 41, 2, /* iArg: */ 0 }, #endif #endif #if defined(SQLITE_HAS_CODEC) {/* zName: */ "hexkey", |
︙ | |||
121827 121828 121829 121830 121831 121832 121833 121834 121835 121836 121837 121838 121839 121840 | 122343 122344 122345 122346 122347 122348 122349 122350 122351 122352 122353 122354 122355 122356 122357 122358 122359 122360 122361 | + + + + + | if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; } if( !zMode ){ /* If the "=MODE" part does not match any known journal mode, ** then do a query */ eMode = PAGER_JOURNALMODE_QUERY; } if( eMode==PAGER_JOURNALMODE_OFF && (db->flags & SQLITE_Defensive)!=0 ){ /* Do not allow journal-mode "OFF" in defensive since the database ** can become corrupted using ordinary SQL when the journal is off */ eMode = PAGER_JOURNALMODE_QUERY; } } if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){ /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ iDb = 0; pId2->n = 1; } for(ii=db->nDb-1; ii>=0; ii--){ |
︙ | |||
122604 122605 122606 122607 122608 122609 122610 122611 122612 122613 122614 122615 122616 122617 122618 122619 122620 122621 122622 122623 122624 122625 122626 | 123125 123126 123127 123128 123129 123130 123131 123132 123133 123134 123135 123136 123137 123138 123139 123140 123141 123142 123143 123144 123145 123146 123147 123148 123149 | + + | sqlite3VdbeJumpHere(v, addrTop); } } break; #endif /* !defined(SQLITE_OMIT_TRIGGER) */ #endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ #ifndef SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA /* Reinstall the LIKE and GLOB functions. The variant of LIKE ** used will be case sensitive or not depending on the RHS. */ case PragTyp_CASE_SENSITIVE_LIKE: { if( zRight ){ sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0)); } } break; #endif /* SQLITE_OMIT_CASE_SENSITIVE_LIKE_PRAGMA */ #ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX # define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100 #endif #ifndef SQLITE_OMIT_INTEGRITY_CHECK /* PRAGMA integrity_check |
︙ | |||
123306 123307 123308 123309 123310 123311 123312 | 123829 123830 123831 123832 123833 123834 123835 123836 123837 123838 123839 123840 123841 123842 123843 123844 123845 123846 123847 123848 123849 123850 123851 123852 123853 123854 123855 123856 123857 123858 123859 123860 123861 123862 123863 123864 123865 123866 | + + - - + + - - - - - - - - - - - + + - - - - - + + + + + + + + + - + - + + + + + + | ** hexkey 2 ** hexrekey 3 ** textkey 4 ** textrekey 5 */ case PragTyp_KEY: { if( zRight ){ char zBuf[40]; const char *zKey = zRight; |
︙ | |||
124968 124969 124970 124971 124972 124973 124974 | 125493 125494 125495 125496 125497 125498 125499 125500 125501 125502 125503 125504 125505 125506 125507 | - + | pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2); if( pEq && isOuterJoin ){ ExprSetProperty(pEq, EP_FromJoin); assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); ExprSetVVAProperty(pEq, EP_NoReduce); pEq->iRightJoinTable = (i16)pE2->iTable; } |
︙ | |||
125102 125103 125104 125105 125106 125107 125108 | 125627 125628 125629 125630 125631 125632 125633 125634 125635 125636 125637 125638 125639 125640 125641 | - + | } /* Add the ON clause to the end of the WHERE clause, connected by ** an AND operator. */ if( pRight->pOn ){ if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor); |
︙ | |||
126709 126710 126711 126712 126713 126714 126715 | 127234 127235 127236 127237 127238 127239 127240 127241 127242 127243 127244 127245 127246 127247 | - - - | db->flags = savedFlags; if( pParse->nErr ) return 0; while( pSelect->pPrior ) pSelect = pSelect->pPrior; pTab = sqlite3DbMallocZero(db, sizeof(Table) ); if( pTab==0 ){ return 0; } |
︙ | |||
127153 127154 127155 127156 127157 127158 127159 127160 127161 127162 127163 127164 127165 127166 | 127675 127676 127677 127678 127679 127680 127681 127682 127683 127684 127685 127686 127687 127688 127689 | + | sqlite3 *db; /* Database connection */ /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. */ assert( p && p->pPrior ); /* Calling function guarantees this much */ assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION ); assert( p->selFlags & SF_Compound ); db = pParse->db; pPrior = p->pPrior; dest = *pDest; if( pPrior->pOrderBy || pPrior->pLimit ){ sqlite3ErrorMsg(pParse,"%s clause should come after %s not before", pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op)); rc = 1; |
︙ | |||
128647 128648 128649 128650 128651 128652 128653 | 129170 129171 129172 129173 129174 129175 129176 129177 129178 129179 129180 129181 129182 129183 129184 129185 129186 129187 129188 129189 129190 129191 129192 129193 129194 129195 129196 129197 129198 | - + - - + + - - + + | pSub->pOrderBy = 0; } pWhere = pSub->pWhere; pSub->pWhere = 0; if( isLeftJoin>0 ){ setJoinExpr(pWhere, iNewParent); } |
︙ | |||
128982 128983 128984 128985 128986 128987 128988 | 129505 129506 129507 129508 129509 129510 129511 129512 129513 129514 129515 129516 129517 129518 129519 129520 129521 | - + - + | x.pParse = pParse; x.iTable = iCursor; x.iNewTable = iCursor; x.isLeftJoin = 0; x.pEList = pSubq->pEList; pNew = substExpr(&x, pNew); if( pSubq->selFlags & SF_Aggregate ){ |
︙ | |||
129410 129411 129412 129413 129414 129415 129416 | 129933 129934 129935 129936 129937 129938 129939 129940 129941 129942 129943 129944 129945 129946 129947 | - + | } while( pSel->pPrior ){ pSel = pSel->pPrior; } sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol); pTab->iPKey = -1; pTab->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); pTab->tabFlags |= TF_Ephemeral; |
︙ | |||
129456 129457 129458 129459 129460 129461 129462 129463 129464 129465 129466 129467 129468 129469 | 129979 129980 129981 129982 129983 129984 129985 129986 129987 129988 129989 129990 129991 129992 129993 129994 129995 129996 | + + + + | if( db->mallocFailed ){ return WRC_Abort; } assert( p->pSrc!=0 ); if( (selFlags & SF_Expanded)!=0 ){ return WRC_Prune; } if( pWalker->eCode ){ /* Renumber selId because it has been copied from a view */ p->selId = ++pParse->nSelect; } pTabList = p->pSrc; pEList = p->pEList; sqlite3WithPush(pParse, p->pWith, 0); /* Make sure cursor numbers have been assigned to all entries in ** the FROM clause of the SELECT statement. */ |
︙ | |||
129505 129506 129507 129508 129509 129510 129511 129512 129513 129514 129515 129516 129517 129518 129519 129520 129521 129522 129523 129524 | 130032 130033 130034 130035 130036 130037 130038 130039 130040 130041 130042 130043 130044 130045 130046 130047 130048 130049 130050 130051 130052 130053 130054 | + + + | pTab->nTabRef++; if( !IsVirtual(pTab) && cannotBeFunction(pParse, pFrom) ){ return WRC_Abort; } #if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) if( IsVirtual(pTab) || pTab->pSelect ){ i16 nCol; u8 eCodeOrig = pWalker->eCode; if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; assert( pFrom->pSelect==0 ); pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); nCol = pTab->nCol; pTab->nCol = -1; pWalker->eCode = 1; /* Turn on Select.selId renumbering */ sqlite3WalkSelect(pWalker, pFrom->pSelect); pWalker->eCode = eCodeOrig; pTab->nCol = nCol; } #endif } /* Locate the index named by the INDEXED BY clause, if any. */ if( sqlite3IndexedByLookup(pParse, pFrom) ){ |
︙ | |||
129760 129761 129762 129763 129764 129765 129766 129767 129768 129769 129770 129771 129772 129773 | 130290 130291 130292 130293 130294 130295 130296 130297 130298 130299 130300 130301 130302 130303 130304 | + | if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){ w.xSelectCallback = convertCompoundSelectToSubquery; w.xSelectCallback2 = 0; sqlite3WalkSelect(&w, pSelect); } w.xSelectCallback = selectExpander; w.xSelectCallback2 = selectPopWith; w.eCode = 0; sqlite3WalkSelect(&w, pSelect); } #ifndef SQLITE_OMIT_SUBQUERY /* ** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() |
︙ | |||
130031 130032 130033 130034 130035 130036 130037 | 130562 130563 130564 130565 130566 130567 130568 130569 130570 130571 130572 130573 130574 130575 130576 | - + | Select *pS = pWalker->u.pSelect; if( sqlite3ExprIsConstantOrGroupBy(pWalker->pParse, pExpr, pS->pGroupBy) ){ sqlite3 *db = pWalker->pParse->db; Expr *pNew = sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[1], 0); if( pNew ){ Expr *pWhere = pS->pWhere; SWAP(Expr, *pNew, *pExpr); |
︙ | |||
130086 130087 130088 130089 130090 130091 130092 | 130617 130618 130619 130620 130621 130622 130623 130624 130625 130626 130627 130628 130629 130630 130631 130632 130633 130634 130635 130636 130637 130638 130639 130640 130641 130642 130643 | + - + + - + - + + + | ){ struct SrcList_item *pItem; for(pItem = pTabList->a; pItem<pThis; pItem++){ Select *pS1; if( pItem->pSelect==0 ) continue; if( pItem->fg.viaCoroutine ) continue; if( pItem->zName==0 ) continue; assert( pItem->pTab!=0 ); |
︙ | |||
130119 130120 130121 130122 130123 130124 130125 | 130654 130655 130656 130657 130658 130659 130660 130661 130662 130663 130664 130665 130666 130667 130668 130669 130670 130671 130672 130673 130674 130675 130676 130677 130678 130679 130680 130681 | - + + + + | ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) ** ** The transformation only works if all of the following are true: ** ** * The subquery is a UNION ALL of two or more terms ** * The subquery does not have a LIMIT clause ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries |
︙ | |||
132780 132781 132782 132783 132784 132785 132786 132787 132788 132789 132790 | 133318 133319 133320 133321 133322 133323 133324 133325 133326 133327 133328 133329 133330 133331 133332 133333 133334 133335 133336 133337 | + - + | Table *pTab; /* The table to be updated */ int addrTop = 0; /* VDBE instruction address of the start of the loop */ WhereInfo *pWInfo; /* Information about the WHERE clause */ Vdbe *v; /* The virtual database engine */ Index *pIdx; /* For looping over indices */ Index *pPk; /* The PRIMARY KEY index for WITHOUT ROWID tables */ int nIdx; /* Number of indices that need updating */ int nAllIdx; /* Total number of indexes */ int iBaseCur; /* Base cursor number */ int iDataCur; /* Cursor for the canonical data btree */ int iIdxCur; /* Cursor for the first index */ sqlite3 *db; /* The database structure */ |
︙ | |||
132898 132899 132900 132901 132902 132903 132904 | 133437 133438 133439 133440 133441 133442 133443 133444 133445 133446 133447 133448 133449 133450 133451 133452 133453 133454 | - + - + | pParse->nTab = iBaseCur; } pTabList->a[0].iCursor = iDataCur; /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. ** Initialize aXRef[] and aToOpen[] to their default values. */ |
︙ | |||
132980 132981 132982 132983 132984 132985 132986 | 133519 133520 133521 133522 133523 133524 133525 133526 133527 133528 133529 133530 133531 133532 133533 133534 133535 133536 133537 133538 133539 133540 133541 133542 133543 133544 133545 133546 133547 133548 133549 133550 133551 133552 133553 133554 133555 133556 133557 133558 133559 133560 133561 133562 133563 133564 133565 133566 133567 133568 133569 133570 133571 133572 133573 133574 133575 133576 133577 | - + - - + + + + + + + + + - + | hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey); /* There is one entry in the aRegIdx[] array for each index on the table ** being updated. Fill in aRegIdx[] with a register number that will hold ** the key for accessing each index. */ if( onError==OE_Replace ) bReplace = 1; |
︙ | |||
133147 133148 133149 133150 133151 133152 133153 133154 133155 133156 133157 133158 133159 133160 | 133693 133694 133695 133696 133697 133698 133699 133700 133701 133702 133703 133704 133705 133706 133707 133708 | + + | if( HasRowid(pTab) ){ /* Read the rowid of the current row of the WHERE scan. In ONEPASS_OFF ** mode, write the rowid into the FIFO. In either of the one-pass modes, ** leave it in register regOldRowid. */ sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); if( eOnePass==ONEPASS_OFF ){ /* We need to use regRowSet, so reallocate aRegIdx[nAllIdx] */ aRegIdx[nAllIdx] = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid); } }else{ /* Read the PK of the current row into an array of registers. In ** ONEPASS_OFF mode, serialize the array into a record and store it in ** the ephemeral table. Or, in ONEPASS_SINGLE or MULTI mode, change ** the OP_OpenEphemeral instruction to a Noop (the ephemeral table |
︙ | |||
133978 133979 133980 133981 133982 133983 133984 133985 133986 133987 133988 133989 133990 133991 | 134526 134527 134528 134529 134530 134531 134532 134533 134534 134535 134536 134537 134538 134539 134540 | + | ** transient would cause the database file to appear to be deleted ** following reboot. */ SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse, Token *pNm, Expr *pInto){ Vdbe *v = sqlite3GetVdbe(pParse); int iDb = 0; if( v==0 ) goto build_vacuum_end; if( pParse->nErr ) goto build_vacuum_end; if( pNm ){ #ifndef SQLITE_BUG_COMPATIBLE_20160819 /* Default behavior: Report an error if the argument to VACUUM is ** not recognized */ iDb = sqlite3TwoPartName(pParse, pNm, pNm, &pNm); if( iDb<0 ) goto build_vacuum_end; #else |
︙ | |||
135130 135131 135132 135133 135134 135135 135136 135137 135138 135139 135140 135141 135142 135143 135144 135145 135146 135147 135148 135149 135150 135151 | 135679 135680 135681 135682 135683 135684 135685 135686 135687 135688 135689 135690 135691 135692 135693 135694 135695 135696 135697 135698 135699 135700 135701 135702 | + + | if( p->pVtab->nRef>0 ){ return SQLITE_LOCKED; } } p = vtabDisconnectAll(db, pTab); xDestroy = p->pMod->pModule->xDestroy; assert( xDestroy!=0 ); /* Checked before the virtual table is created */ pTab->nTabRef++; rc = xDestroy(p->pVtab); /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ if( rc==SQLITE_OK ){ assert( pTab->pVTable==p && p->pNext==0 ); p->pVtab = 0; pTab->pVTable = 0; sqlite3VtabUnlock(p); } sqlite3DeleteTable(db, pTab); } return rc; } /* ** This function invokes either the xRollback or xCommit method |
︙ | |||
135580 135581 135582 135583 135584 135585 135586 135587 135588 135589 135590 135591 135592 135593 | 136131 136132 136133 136134 136135 136136 136137 136138 136139 136140 136141 136142 136143 136144 136145 136146 | + + | ** ************************************************************************* ** ** This file contains structure and macro definitions for the query ** planner logic in "where.c". These definitions are broken out into ** a separate source file for easier editing. */ #ifndef SQLITE_WHEREINT_H #define SQLITE_WHEREINT_H /* ** Trace output macros */ #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) /***/ extern int sqlite3WhereTrace; #endif |
︙ | |||
136150 136151 136152 136153 136154 136155 136156 136157 136158 136159 136160 136161 136162 136163 | 136703 136704 136705 136706 136707 136708 136709 136710 136711 136712 136713 136714 136715 136716 136717 136718 | + + | #define WHERE_ONEROW 0x00001000 /* Selects no more than one row */ #define WHERE_MULTI_OR 0x00002000 /* OR using multiple indices */ #define WHERE_AUTO_INDEX 0x00004000 /* Uses an ephemeral index */ #define WHERE_SKIPSCAN 0x00008000 /* Uses the skip-scan algorithm */ #define WHERE_UNQ_WANTED 0x00010000 /* WHERE_ONEROW would have been helpful*/ #define WHERE_PARTIALIDX 0x00020000 /* The automatic index is partial */ #define WHERE_IN_EARLYOUT 0x00040000 /* Perhaps quit IN loops early */ #endif /* !defined(SQLITE_WHEREINT_H) */ /************** End of whereInt.h ********************************************/ /************** Continuing where we left off in wherecode.c ******************/ #ifndef SQLITE_OMIT_EXPLAIN /* |
︙ | |||
137133 137134 137135 137136 137137 137138 137139 | 137688 137689 137690 137691 137692 137693 137694 137695 137696 137697 137698 137699 137700 137701 137702 | - + | sWalker.eCode = 0; sWalker.xExprCallback = codeCursorHintCheckExpr; sqlite3WalkExpr(&sWalker, pTerm->pExpr); if( sWalker.eCode ) continue; } /* If we survive all prior tests, that means this term is worth hinting */ |
︙ | |||
138098 138099 138100 138101 138102 138103 138104 | 138653 138654 138655 138656 138657 138658 138659 138660 138661 138662 138663 138664 138665 138666 138667 | - + | if( &pWC->a[iTerm] == pTerm ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); testcase( pWC->a[iTerm].wtFlags & TERM_CODED ); if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED))!=0 ) continue; if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); pExpr = sqlite3ExprDup(db, pExpr, 0); |
︙ | |||
138249 138250 138251 138252 138253 138254 138255 | 138804 138805 138806 138807 138808 138809 138810 138811 138812 138813 138814 138815 138816 138817 138818 | - + | pAndExpr->pLeft = 0; sqlite3ExprDelete(db, pAndExpr); } sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); sqlite3VdbeGoto(v, pLevel->addrBrk); sqlite3VdbeResolveLabel(v, iLoopBody); |
︙ | |||
138682 138683 138684 138685 138686 138687 138688 138689 | 139237 139238 139239 139240 139241 139242 139243 139244 139245 139246 139247 139248 139249 139250 139251 139252 139253 139254 139255 139256 139257 139258 139259 139260 139261 139262 139263 139264 139265 139266 139267 139268 139269 139270 139271 139272 139273 139274 139275 139276 139277 | + - - - + + + - - - + + + - + - - - + + + - - - - - - - - + + + + + + + + + + + + + | char *zNew = pPrefix->u.zToken; zNew[cnt] = 0; for(iFrom=iTo=0; iFrom<cnt; iFrom++){ if( zNew[iFrom]==wc[3] ) iFrom++; zNew[iTo++] = zNew[iFrom]; } zNew[iTo] = 0; assert( iTo>0 ); |
︙ | |||
140589 140590 140591 140592 140593 140594 140595 | 141150 141151 141152 141153 141154 141155 141156 141157 141158 141159 141160 141161 141162 141163 141164 141165 141166 141167 141168 141169 141170 141171 141172 141173 141174 141175 141176 141177 141178 141179 141180 141181 141182 141183 141184 141185 141186 141187 141188 141189 141190 | - - - - + + + + - + - + - - - + + - | /* ** Convert OP_Column opcodes to OP_Copy in previously generated code. ** ** This routine runs over generated VDBE code and translates OP_Column ** opcodes into OP_Copy when the table is being accessed via co-routine ** instead of via table lookup. ** |
︙ | |||
140764 140765 140766 140767 140768 140769 140770 | 141323 141324 141325 141326 141327 141328 141329 141330 141331 141332 141333 141334 141335 141336 141337 | - + | assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */ || pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */ || pLoop->prereq!=0 ); /* table of a LEFT JOIN */ if( pLoop->prereq==0 && (pTerm->wtFlags & TERM_VIRTUAL)==0 && !ExprHasProperty(pExpr, EP_FromJoin) && sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){ |
︙ | |||
140891 140892 140893 140894 140895 140896 140897 140898 | 141450 141451 141452 141453 141454 141455 141456 141457 141458 141459 141460 141461 141462 141463 141464 141465 141466 | + - + | ); sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue); if( pTabItem->fg.viaCoroutine ){ sqlite3VdbeChangeP2(v, addrCounter, regBase+n); testcase( pParse->db->mallocFailed ); assert( pLevel->iIdxCur>0 ); translateColumnToCopy(pParse, addrTop, pLevel->iTabCur, |
︙ | |||
146137 146138 146139 146140 146141 146142 146143 146144 146145 146146 146147 146148 146149 146150 | 146697 146698 146699 146700 146701 146702 146703 146704 146705 146706 146707 146708 146709 146710 146711 | + | ** selectWindowRewriteExprCb() by selectWindowRewriteEList(). */ typedef struct WindowRewrite WindowRewrite; struct WindowRewrite { Window *pWin; SrcList *pSrc; ExprList *pSub; Table *pTab; Select *pSubSelect; /* Current sub-select, if any */ }; /* ** Callback function used by selectWindowRewriteEList(). If necessary, ** this function appends to the output expression-list and updates ** expression (*ppExpr) in place. |
︙ | |||
146197 146198 146199 146200 146201 146202 146203 146204 146205 146206 146207 146208 146209 146210 | 146758 146759 146760 146761 146762 146763 146764 146765 146766 146767 146768 146769 146770 146771 146772 | + | sqlite3ExprDelete(pParse->db, pExpr); ExprClearProperty(pExpr, EP_Static); memset(pExpr, 0, sizeof(Expr)); pExpr->op = TK_COLUMN; pExpr->iColumn = p->pSub->nExpr-1; pExpr->iTable = p->pWin->iEphCsr; pExpr->y.pTab = p->pTab; } break; } default: /* no-op */ break; |
︙ | |||
146240 146241 146242 146243 146244 146245 146246 146247 146248 146249 146250 146251 146252 146253 146254 146255 146256 146257 146258 146259 146260 146261 146262 146263 146264 146265 146266 146267 146268 146269 146270 146271 146272 146273 146274 146275 | 146802 146803 146804 146805 146806 146807 146808 146809 146810 146811 146812 146813 146814 146815 146816 146817 146818 146819 146820 146821 146822 146823 146824 146825 146826 146827 146828 146829 146830 146831 146832 146833 146834 146835 146836 146837 146838 146839 146840 146841 146842 146843 146844 146845 146846 146847 146848 146849 146850 146851 146852 146853 146854 146855 146856 146857 146858 | + + - + + + + + + | ** appending the new one. */ static void selectWindowRewriteEList( Parse *pParse, Window *pWin, SrcList *pSrc, ExprList *pEList, /* Rewrite expressions in this list */ Table *pTab, ExprList **ppSub /* IN/OUT: Sub-select expression-list */ ){ Walker sWalker; WindowRewrite sRewrite; memset(&sWalker, 0, sizeof(Walker)); memset(&sRewrite, 0, sizeof(WindowRewrite)); sRewrite.pSub = *ppSub; sRewrite.pWin = pWin; sRewrite.pSrc = pSrc; sRewrite.pTab = pTab; sWalker.pParse = pParse; sWalker.xExprCallback = selectWindowRewriteExprCb; sWalker.xSelectCallback = selectWindowRewriteSelectCb; sWalker.u.pRewrite = &sRewrite; (void)sqlite3WalkExprList(&sWalker, pEList); *ppSub = sRewrite.pSub; } /* ** Append a copy of each expression in expression-list pAppend to ** expression list pList. Return a pointer to the result list. */ static ExprList *exprListAppendList( Parse *pParse, /* Parsing context */ ExprList *pList, /* List to which to append. Might be NULL */ |
︙ | |||
146305 146306 146307 146308 146309 146310 146311 146312 146313 146314 146315 146316 146317 146318 146319 146320 146321 | 146874 146875 146876 146877 146878 146879 146880 146881 146882 146883 146884 146885 146886 146887 146888 146889 146890 146891 146892 146893 146894 146895 146896 146897 146898 146899 146900 146901 146902 146903 146904 146905 146906 146907 146908 146909 146910 146911 146912 146913 146914 146915 146916 146917 146918 146919 146920 146921 146922 146923 146924 146925 146926 146927 146928 146929 146930 146931 146932 146933 146934 146935 | + + + + + + + - + - - + + - - + + - + | ExprList *pGroupBy = p->pGroupBy; Expr *pHaving = p->pHaving; ExprList *pSort = 0; ExprList *pSublist = 0; /* Expression list for sub-query */ Window *pMWin = p->pWin; /* Master window object */ Window *pWin; /* Window object iterator */ Table *pTab; pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ){ return SQLITE_NOMEM; } p->pSrc = 0; p->pWhere = 0; p->pGroupBy = 0; p->pHaving = 0; p->selFlags &= ~SF_Aggregate; /* Create the ORDER BY clause for the sub-select. This is the concatenation ** of the window PARTITION and ORDER BY clauses. Then, if this makes it ** redundant, remove the ORDER BY from the parent SELECT. */ pSort = sqlite3ExprListDup(db, pMWin->pPartition, 0); |
︙ | |||
146372 146373 146374 146375 146376 146377 146378 146379 146380 | 146948 146949 146950 146951 146952 146953 146954 146955 146956 146957 146958 146959 146960 146961 146962 146963 146964 146965 146966 146967 146968 146969 146970 146971 146972 146973 146974 146975 146976 146977 146978 146979 146980 146981 146982 146983 | + + - + + + - - + + - + - + | } pSub = sqlite3SelectNew( pParse, pSublist, pSrc, pWhere, pGroupBy, pHaving, pSort, 0, 0 ); p->pSrc = sqlite3SrcListAppend(pParse, 0, 0, 0); if( p->pSrc ){ Table *pTab2; p->pSrc->a[0].pSelect = pSub; sqlite3SrcListAssignCursors(pParse, p->pSrc); pSub->selFlags |= SF_Expanded; |
︙ | |||
148357 148358 148359 148360 148361 148362 148363 | 148937 148938 148939 148940 148941 148942 148943 148944 148945 148946 148947 148948 148949 148950 148951 148952 148953 148954 148955 148956 148957 148958 148959 148960 148961 148962 148963 148964 148965 148966 148967 148968 148969 148970 148971 148972 148973 148974 148975 148976 148977 148978 148979 148980 148981 148982 148983 148984 148985 148986 148987 148988 148989 148990 148991 148992 148993 148994 148995 148996 148997 148998 | - + - - - - - - - - - + + + + + + + + + + + + - - - - + + - - + - - + + - - + + - + | ** YY_MAX_REDUCE Maximum value for reduce actions */ #ifndef INTERFACE # define INTERFACE 1 #endif /************* Begin control #defines *****************************************/ #define YYCODETYPE unsigned short int |
︙ | |||
148473 148474 148475 148476 148477 148478 148479 | 149053 149054 149055 149056 149057 149058 149059 149060 149061 149062 149063 149064 149065 149066 149067 149068 149069 149070 149071 149072 149073 149074 149075 149076 149077 149078 149079 149080 149081 149082 149083 149084 149085 149086 149087 149088 149089 149090 149091 149092 149093 149094 149095 149096 149097 149098 149099 149100 149101 149102 149103 149104 149105 149106 149107 149108 149109 149110 149111 149112 149113 149114 149115 149116 149117 149118 149119 149120 149121 149122 149123 149124 149125 149126 149127 149128 149129 149130 149131 149132 149133 149134 149135 149136 149137 149138 149139 149140 149141 149142 149143 149144 149145 149146 149147 149148 149149 149150 149151 149152 149153 149154 149155 149156 149157 149158 149159 149160 149161 149162 149163 149164 149165 149166 149167 149168 149169 149170 149171 149172 149173 149174 149175 149176 149177 149178 149179 149180 149181 149182 149183 149184 149185 149186 149187 149188 149189 149190 149191 149192 149193 149194 149195 149196 149197 149198 149199 149200 149201 149202 149203 149204 149205 149206 149207 149208 149209 149210 149211 149212 149213 149214 149215 149216 149217 149218 149219 149220 149221 149222 149223 149224 149225 149226 149227 149228 149229 149230 149231 149232 149233 149234 149235 149236 149237 149238 149239 149240 149241 149242 149243 149244 149245 149246 149247 149248 149249 149250 149251 149252 149253 149254 149255 149256 149257 149258 149259 149260 149261 149262 149263 149264 149265 149266 149267 149268 149269 149270 149271 149272 149273 149274 149275 149276 149277 149278 149279 149280 149281 149282 149283 149284 149285 149286 149287 149288 149289 149290 149291 149292 149293 149294 149295 149296 149297 149298 149299 149300 149301 149302 149303 149304 149305 149306 149307 149308 149309 149310 149311 149312 149313 149314 149315 149316 149317 149318 149319 149320 149321 149322 149323 149324 149325 149326 149327 149328 149329 149330 149331 149332 149333 149334 149335 149336 149337 149338 149339 149340 149341 149342 149343 149344 149345 149346 149347 149348 149349 149350 149351 149352 149353 149354 149355 149356 149357 149358 149359 149360 149361 149362 149363 149364 149365 149366 149367 149368 149369 149370 149371 149372 149373 149374 149375 149376 149377 149378 149379 149380 149381 149382 149383 149384 149385 149386 149387 149388 149389 149390 149391 149392 149393 149394 149395 149396 149397 149398 149399 149400 149401 149402 149403 149404 149405 149406 149407 149408 149409 149410 149411 149412 149413 149414 149415 149416 149417 149418 149419 149420 149421 149422 149423 149424 149425 149426 149427 149428 149429 149430 149431 149432 149433 149434 149435 149436 149437 149438 149439 149440 149441 149442 149443 149444 149445 149446 149447 149448 149449 149450 149451 149452 149453 149454 149455 149456 149457 149458 149459 149460 149461 149462 149463 149464 149465 149466 149467 149468 149469 149470 149471 149472 149473 149474 149475 149476 149477 149478 149479 149480 149481 149482 149483 149484 149485 149486 149487 149488 149489 149490 149491 149492 149493 149494 149495 149496 149497 149498 149499 149500 149501 149502 149503 149504 149505 149506 149507 149508 149509 149510 149511 149512 149513 149514 149515 149516 149517 149518 149519 149520 149521 149522 149523 149524 149525 149526 149527 149528 149529 149530 149531 149532 149533 149534 149535 149536 149537 149538 149539 149540 149541 149542 149543 149544 149545 149546 149547 149548 149549 149550 149551 149552 149553 149554 149555 149556 149557 149558 149559 149560 149561 149562 149563 149564 149565 149566 149567 149568 149569 149570 149571 149572 149573 149574 149575 149576 149577 149578 149579 149580 149581 149582 149583 149584 149585 149586 149587 149588 149589 149590 149591 149592 149593 149594 149595 149596 149597 149598 149599 149600 149601 149602 149603 149604 149605 149606 149607 149608 149609 149610 149611 149612 149613 149614 149615 149616 149617 149618 149619 149620 149621 149622 149623 149624 149625 149626 149627 149628 149629 149630 149631 149632 149633 149634 149635 149636 149637 149638 149639 149640 149641 149642 149643 149644 149645 149646 149647 149648 149649 149650 149651 149652 149653 149654 149655 149656 149657 149658 149659 | - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + - - + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - - - + + + - - - - - - - - - - + + + + + + + + + + - + - + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - + + + + - - - - + + + + - - - - + + + + - + - - - - + + + + - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - + - - + + - + - - - - - - - - - + + + + + + + + + - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - + + + + + - - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - + + - + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + + - - + + - + - + - + - | ** yy_reduce_ofst[] For each state, the offset into yy_action for ** shifting non-terminals after a reduce. ** yy_default[] Default action for each state. ** *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2142) static const YYACTIONTYPE yy_action[] = { |
︙ | |||
149473 149474 149475 149476 149477 149478 149479 | 150051 150052 150053 150054 150055 150056 150057 150058 150059 150060 150061 150062 150063 150064 150065 150066 150067 150068 150069 150070 150071 150072 150073 150074 150075 150076 150077 150078 150079 150080 150081 150082 150083 150084 150085 150086 150087 150088 150089 150090 150091 150092 150093 150094 150095 150096 150097 150098 150099 150100 150101 150102 150103 150104 150105 150106 150107 150108 150109 150110 150111 150112 150113 150114 150115 150116 150117 150118 150119 150120 150121 150122 150123 150124 150125 150126 150127 150128 150129 150130 150131 150132 150133 150134 150135 150136 150137 150138 150139 150140 150141 150142 150143 150144 150145 150146 150147 150148 150149 150150 150151 150152 150153 150154 150155 150156 150157 150158 150159 150160 150161 150162 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | /* 197 */ "carglist", /* 198 */ "typetoken", /* 199 */ "typename", /* 200 */ "signed", /* 201 */ "plus_num", /* 202 */ "minus_num", /* 203 */ "scanpt", |
︙ | |||
149606 149607 149608 149609 149610 149611 149612 | 150185 150186 150187 150188 150189 150190 150191 150192 150193 150194 150195 150196 150197 150198 150199 150200 150201 150202 150203 150204 150205 150206 150207 150208 150209 150210 150211 150212 150213 150214 150215 150216 150217 150218 150219 150220 150221 150222 150223 150224 150225 150226 150227 150228 150229 150230 150231 150232 150233 150234 150235 150236 150237 150238 150239 150240 150241 150242 150243 150244 150245 150246 150247 150248 150249 150250 150251 150252 150253 150254 150255 150256 150257 150258 150259 150260 150261 150262 150263 150264 150265 150266 150267 150268 150269 150270 150271 150272 150273 150274 150275 150276 150277 150278 150279 150280 150281 150282 150283 150284 150285 150286 150287 150288 150289 150290 150291 150292 150293 150294 150295 150296 150297 150298 150299 150300 150301 150302 150303 150304 150305 150306 150307 150308 150309 150310 150311 150312 150313 150314 150315 150316 150317 150318 150319 150320 150321 150322 150323 150324 150325 150326 150327 150328 150329 150330 150331 150332 150333 150334 150335 150336 150337 150338 150339 150340 150341 150342 150343 150344 150345 150346 150347 150348 150349 150350 150351 150352 150353 150354 150355 150356 150357 150358 150359 150360 150361 150362 150363 150364 150365 150366 150367 150368 150369 150370 150371 150372 150373 150374 150375 150376 150377 150378 150379 150380 150381 150382 150383 150384 150385 150386 150387 150388 150389 150390 150391 150392 150393 150394 150395 150396 150397 150398 150399 150400 150401 150402 150403 150404 150405 150406 150407 150408 150409 150410 150411 150412 150413 150414 150415 150416 150417 150418 150419 150420 150421 150422 150423 150424 150425 150426 150427 150428 150429 150430 150431 150432 150433 150434 150435 150436 150437 150438 150439 150440 150441 150442 150443 150444 150445 150446 150447 150448 150449 150450 150451 150452 150453 150454 150455 150456 150457 150458 150459 150460 150461 150462 150463 150464 150465 150466 150467 150468 150469 150470 150471 150472 150473 150474 150475 150476 150477 150478 150479 150480 150481 150482 150483 150484 150485 150486 150487 150488 150489 150490 150491 150492 150493 150494 150495 150496 150497 150498 150499 150500 150501 150502 150503 150504 150505 150506 150507 150508 150509 150510 150511 150512 150513 150514 150515 150516 150517 150518 150519 150520 150521 150522 150523 150524 150525 150526 150527 150528 150529 150530 150531 150532 150533 150534 150535 150536 150537 150538 150539 150540 150541 150542 150543 150544 150545 | - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + | /* 22 */ "table_options ::= WITHOUT nm", /* 23 */ "columnname ::= nm typetoken", /* 24 */ "typetoken ::=", /* 25 */ "typetoken ::= typename LP signed RP", /* 26 */ "typetoken ::= typename LP signed COMMA signed RP", /* 27 */ "typename ::= typename ID|STRING", /* 28 */ "scanpt ::=", |
︙ | |||
150078 150079 150080 150081 150082 150083 150084 | 150658 150659 150660 150661 150662 150663 150664 150665 150666 150667 150668 150669 150670 150671 150672 150673 150674 150675 150676 150677 150678 150679 150680 150681 150682 150683 150684 150685 150686 150687 150688 150689 150690 150691 150692 150693 150694 150695 150696 150697 150698 150699 150700 150701 150702 150703 150704 150705 150706 150707 150708 150709 150710 150711 150712 150713 150714 150715 150716 150717 150718 150719 150720 150721 150722 150723 150724 150725 150726 150727 150728 150729 150730 150731 150732 150733 150734 150735 150736 150737 150738 150739 150740 150741 150742 150743 150744 150745 150746 150747 150748 150749 150750 150751 150752 150753 150754 150755 150756 150757 150758 150759 150760 150761 | - - - + + + - + - - - - - - - - - - - + + + + + + + + + + + - + - - - - - - - - - - - - - + + + + + + + + + + + + + - + - - - - - + + + + + - + - + - + - - + + - + - - - + + + - + - + - - - + + + - + - - + + - + - + - + - - - + + + - + | ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are *not* used ** inside the C code. */ /********* Begin destructor definitions ***************************************/ case 195: /* select */ |
︙ | |||
150491 150492 150493 150494 150495 150496 150497 | 151071 151072 151073 151074 151075 151076 151077 151078 151079 151080 151081 151082 151083 151084 151085 151086 151087 151088 151089 151090 151091 151092 151093 151094 151095 151096 151097 151098 151099 151100 151101 151102 151103 151104 151105 151106 151107 151108 151109 151110 151111 151112 151113 151114 151115 151116 151117 151118 151119 151120 151121 151122 151123 151124 151125 151126 151127 151128 151129 151130 151131 151132 151133 151134 151135 151136 151137 151138 151139 151140 151141 151142 151143 151144 151145 151146 151147 151148 151149 151150 151151 151152 151153 151154 151155 151156 151157 151158 151159 151160 151161 151162 151163 151164 151165 151166 151167 151168 151169 151170 151171 151172 151173 151174 151175 151176 151177 151178 151179 151180 151181 151182 151183 151184 151185 151186 151187 151188 151189 151190 151191 151192 151193 151194 151195 151196 151197 151198 151199 151200 151201 151202 151203 151204 151205 151206 151207 151208 151209 151210 151211 151212 151213 151214 151215 151216 151217 151218 151219 151220 151221 151222 151223 151224 151225 151226 151227 151228 151229 151230 151231 151232 151233 151234 151235 151236 151237 151238 151239 151240 151241 151242 151243 151244 151245 151246 151247 151248 151249 151250 151251 151252 151253 151254 151255 151256 151257 151258 151259 151260 151261 151262 151263 151264 151265 151266 151267 151268 151269 151270 151271 151272 151273 151274 151275 151276 151277 151278 151279 151280 151281 151282 151283 151284 151285 151286 151287 151288 151289 151290 151291 151292 151293 151294 151295 151296 151297 151298 151299 151300 151301 151302 151303 151304 151305 151306 151307 151308 151309 151310 151311 151312 151313 151314 151315 151316 151317 151318 151319 151320 151321 151322 151323 151324 151325 151326 151327 151328 151329 151330 151331 151332 151333 151334 151335 151336 151337 151338 151339 151340 151341 151342 151343 151344 151345 151346 151347 151348 151349 151350 151351 151352 151353 151354 151355 151356 151357 151358 151359 151360 151361 151362 151363 151364 151365 151366 151367 151368 151369 151370 151371 151372 151373 151374 151375 151376 151377 151378 151379 151380 151381 151382 151383 151384 151385 151386 151387 151388 151389 151390 151391 151392 151393 151394 151395 151396 151397 151398 151399 151400 151401 151402 151403 151404 151405 151406 151407 151408 151409 151410 151411 151412 151413 151414 151415 151416 151417 151418 151419 151420 151421 151422 151423 151424 151425 151426 151427 151428 151429 151430 151431 | + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | 194, /* (22) table_options ::= WITHOUT nm */ 196, /* (23) columnname ::= nm typetoken */ 198, /* (24) typetoken ::= */ 198, /* (25) typetoken ::= typename LP signed RP */ 198, /* (26) typetoken ::= typename LP signed COMMA signed RP */ 199, /* (27) typename ::= typename ID|STRING */ 203, /* (28) scanpt ::= */ 204, /* (29) scantok ::= */ |
︙ | |||
150871 150872 150873 150874 150875 150876 150877 | 151452 151453 151454 151455 151456 151457 151458 151459 151460 151461 151462 151463 151464 151465 151466 151467 151468 151469 151470 151471 151472 151473 151474 151475 151476 151477 151478 151479 151480 151481 151482 151483 151484 151485 151486 151487 151488 151489 151490 151491 151492 151493 151494 151495 151496 151497 151498 151499 151500 151501 151502 151503 151504 151505 151506 151507 151508 151509 151510 151511 151512 151513 151514 151515 151516 151517 151518 151519 151520 151521 151522 151523 151524 151525 151526 151527 151528 151529 151530 151531 151532 151533 151534 151535 151536 151537 151538 151539 151540 151541 151542 151543 151544 151545 151546 151547 151548 151549 151550 151551 151552 151553 151554 151555 151556 151557 151558 151559 151560 151561 151562 151563 151564 151565 151566 151567 151568 151569 151570 151571 151572 151573 151574 151575 151576 151577 151578 151579 151580 151581 151582 151583 151584 151585 151586 151587 151588 151589 151590 151591 151592 151593 151594 151595 151596 151597 151598 151599 151600 151601 151602 151603 151604 151605 151606 151607 151608 151609 151610 151611 151612 151613 151614 151615 151616 151617 151618 151619 151620 151621 151622 151623 151624 151625 151626 151627 151628 151629 151630 151631 151632 151633 151634 151635 151636 151637 151638 151639 151640 151641 151642 151643 151644 151645 151646 151647 151648 151649 151650 151651 151652 151653 151654 151655 151656 151657 151658 151659 151660 151661 151662 151663 151664 151665 151666 151667 151668 151669 151670 151671 151672 151673 151674 151675 151676 151677 151678 151679 151680 151681 151682 151683 151684 151685 151686 151687 151688 151689 151690 151691 151692 151693 151694 151695 151696 151697 151698 151699 151700 151701 151702 151703 151704 151705 151706 151707 151708 151709 151710 151711 151712 151713 151714 151715 151716 151717 151718 151719 151720 151721 151722 151723 151724 151725 151726 151727 151728 151729 151730 151731 151732 151733 151734 151735 151736 151737 151738 151739 151740 151741 151742 151743 151744 151745 151746 151747 151748 151749 151750 151751 151752 151753 151754 151755 151756 151757 151758 151759 151760 151761 151762 151763 151764 151765 151766 151767 151768 151769 151770 151771 151772 151773 151774 151775 151776 151777 151778 151779 151780 151781 151782 151783 151784 151785 151786 151787 151788 151789 151790 151791 151792 151793 151794 151795 151796 151797 151798 151799 151800 151801 151802 151803 151804 151805 151806 151807 151808 151809 151810 151811 151812 | - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + | -2, /* (22) table_options ::= WITHOUT nm */ -2, /* (23) columnname ::= nm typetoken */ 0, /* (24) typetoken ::= */ -4, /* (25) typetoken ::= typename LP signed RP */ -6, /* (26) typetoken ::= typename LP signed COMMA signed RP */ -2, /* (27) typename ::= typename ID|STRING */ 0, /* (28) scanpt ::= */ |
︙ | |||
151313 151314 151315 151316 151317 151318 151319 | 151895 151896 151897 151898 151899 151900 151901 151902 151903 151904 151905 151906 151907 151908 151909 151910 151911 151912 151913 151914 151915 151916 151917 151918 | - + - + - - + + | case 1: /* explain ::= EXPLAIN QUERY PLAN */ { pParse->explain = 2; } break; case 2: /* cmdx ::= cmd */ { sqlite3FinishCoding(pParse); } break; case 3: /* cmd ::= BEGIN transtype trans_opt */ |
︙ | |||
151345 151346 151347 151348 151349 151350 151351 | 151927 151928 151929 151930 151931 151932 151933 151934 151935 151936 151937 151938 151939 151940 151941 151942 151943 151944 151945 151946 151947 151948 151949 151950 151951 151952 151953 151954 151955 151956 151957 151958 151959 151960 151961 151962 151963 151964 151965 151966 151967 151968 151969 151970 151971 151972 151973 151974 151975 151976 151977 151978 151979 151980 151981 151982 151983 151984 151985 151986 151987 151988 151989 151990 151991 151992 151993 151994 151995 151996 151997 151998 151999 152000 152001 152002 152003 152004 152005 152006 152007 152008 152009 152010 152011 152012 152013 152014 152015 152016 152017 152018 152019 152020 152021 152022 152023 152024 152025 152026 152027 152028 152029 152030 152031 152032 152033 152034 152035 152036 152037 152038 152039 152040 152041 152042 152043 152044 152045 152046 152047 152048 152049 152050 152051 152052 152053 152054 152055 152056 152057 152058 152059 152060 152061 152062 152063 152064 152065 152066 152067 152068 152069 152070 152071 152072 152073 152074 152075 152076 152077 152078 152079 152080 152081 152082 152083 152084 152085 152086 152087 152088 152089 152090 152091 152092 152093 152094 152095 152096 152097 152098 152099 152100 152101 152102 152103 152104 152105 152106 152107 152108 152109 152110 152111 152112 152113 152114 152115 152116 152117 152118 152119 152120 152121 152122 152123 152124 152125 152126 152127 152128 152129 152130 152131 152132 152133 152134 152135 152136 152137 152138 152139 152140 152141 152142 152143 152144 152145 152146 152147 152148 152149 152150 152151 152152 152153 152154 152155 152156 152157 152158 152159 152160 152161 152162 152163 152164 152165 152166 152167 152168 152169 152170 152171 152172 152173 152174 152175 152176 152177 152178 152179 152180 152181 152182 152183 152184 152185 152186 152187 152188 152189 152190 152191 152192 152193 152194 152195 152196 152197 152198 152199 152200 152201 152202 152203 152204 152205 152206 152207 152208 152209 152210 152211 152212 152213 152214 152215 152216 152217 152218 152219 152220 152221 152222 152223 152224 152225 152226 152227 152228 152229 152230 152231 152232 152233 152234 152235 152236 152237 152238 152239 152240 152241 152242 152243 152244 152245 152246 152247 152248 152249 152250 152251 152252 152253 152254 152255 152256 152257 152258 152259 152260 152261 152262 152263 152264 152265 152266 152267 152268 152269 152270 152271 152272 152273 152274 152275 152276 152277 152278 152279 152280 152281 152282 152283 152284 152285 152286 152287 152288 152289 152290 152291 152292 152293 152294 152295 152296 152297 152298 152299 152300 152301 152302 152303 152304 152305 152306 152307 152308 152309 152310 152311 152312 152313 152314 152315 152316 152317 152318 152319 152320 152321 152322 152323 152324 152325 152326 152327 152328 152329 152330 152331 152332 152333 152334 152335 152336 152337 152338 152339 152340 152341 152342 152343 152344 152345 152346 152347 152348 152349 152350 152351 152352 152353 152354 152355 152356 152357 152358 152359 152360 152361 152362 152363 152364 152365 152366 152367 152368 152369 152370 152371 152372 152373 152374 152375 152376 152377 152378 152379 152380 152381 152382 152383 152384 152385 152386 152387 152388 152389 152390 152391 152392 152393 152394 152395 152396 152397 152398 152399 152400 152401 152402 152403 152404 152405 152406 152407 152408 152409 152410 152411 152412 152413 152414 152415 152416 152417 152418 152419 152420 152421 152422 152423 152424 152425 152426 152427 152428 152429 152430 152431 152432 152433 152434 152435 152436 152437 152438 152439 152440 152441 152442 152443 152444 152445 152446 152447 152448 152449 152450 152451 152452 152453 152454 152455 152456 152457 152458 152459 152460 152461 152462 152463 152464 152465 152466 152467 152468 152469 152470 152471 152472 152473 152474 152475 152476 152477 152478 152479 152480 152481 152482 152483 152484 152485 152486 152487 152488 152489 152490 152491 152492 152493 152494 152495 152496 152497 152498 152499 152500 152501 152502 152503 152504 152505 152506 152507 152508 152509 152510 152511 152512 152513 152514 152515 152516 152517 152518 152519 152520 152521 152522 152523 152524 152525 152526 152527 152528 152529 152530 152531 152532 152533 152534 152535 152536 152537 152538 152539 152540 152541 152542 152543 152544 152545 152546 152547 152548 152549 152550 152551 152552 152553 152554 152555 152556 152557 152558 152559 152560 152561 152562 152563 152564 152565 152566 152567 152568 152569 152570 152571 152572 152573 152574 152575 152576 152577 152578 152579 152580 152581 152582 152583 152584 152585 152586 152587 152588 152589 152590 152591 152592 152593 152594 152595 152596 152597 152598 152599 152600 152601 152602 152603 152604 152605 152606 152607 152608 152609 152610 152611 152612 152613 152614 152615 152616 152617 152618 152619 152620 152621 152622 152623 152624 152625 152626 152627 152628 152629 152630 152631 152632 152633 152634 152635 152636 152637 152638 152639 152640 152641 152642 152643 152644 152645 152646 152647 152648 152649 152650 152651 152652 152653 152654 152655 152656 152657 152658 152659 152660 152661 152662 152663 152664 152665 152666 152667 152668 152669 152670 152671 152672 152673 152674 152675 152676 152677 152678 152679 152680 152681 152682 152683 152684 152685 152686 152687 152688 152689 152690 152691 152692 152693 152694 152695 152696 152697 152698 152699 152700 152701 152702 152703 152704 152705 152706 152707 152708 152709 152710 152711 152712 152713 152714 152715 152716 152717 152718 152719 152720 152721 152722 152723 152724 152725 152726 152727 152728 152729 152730 152731 152732 152733 152734 152735 152736 152737 152738 152739 152740 152741 152742 152743 152744 152745 152746 152747 152748 152749 152750 152751 152752 152753 152754 152755 152756 152757 152758 152759 152760 152761 152762 152763 152764 152765 152766 152767 152768 152769 152770 152771 152772 152773 152774 152775 152776 152777 152778 152779 152780 152781 152782 152783 152784 152785 152786 152787 152788 152789 152790 152791 152792 152793 152794 152795 152796 152797 152798 152799 152800 152801 152802 152803 152804 152805 152806 152807 152808 152809 152810 152811 152812 152813 152814 152815 152816 152817 152818 152819 152820 152821 152822 152823 152824 152825 152826 152827 152828 152829 152830 152831 152832 152833 152834 152835 152836 152837 152838 152839 152840 152841 152842 152843 152844 152845 152846 152847 152848 152849 152850 152851 152852 152853 152854 152855 152856 152857 152858 152859 152860 152861 152862 152863 152864 152865 152866 152867 152868 152869 152870 152871 152872 152873 152874 152875 152876 152877 152878 152879 152880 152881 152882 152883 152884 152885 152886 152887 152888 152889 152890 152891 152892 152893 152894 152895 152896 152897 152898 152899 152900 152901 152902 152903 152904 152905 152906 152907 152908 152909 152910 152911 152912 152913 152914 152915 152916 152917 152918 152919 152920 152921 152922 152923 152924 152925 152926 152927 152928 152929 152930 152931 152932 152933 152934 152935 152936 152937 152938 152939 152940 152941 152942 152943 152944 152945 152946 152947 152948 152949 152950 152951 152952 152953 152954 152955 152956 152957 152958 152959 152960 152961 152962 152963 152964 152965 152966 152967 152968 152969 152970 152971 152972 152973 152974 152975 152976 152977 152978 152979 152980 152981 152982 152983 152984 152985 152986 152987 152988 152989 152990 152991 152992 152993 152994 152995 152996 152997 152998 152999 153000 153001 153002 153003 153004 153005 153006 153007 153008 153009 153010 153011 153012 153013 153014 153015 153016 153017 153018 153019 153020 153021 153022 153023 153024 153025 153026 153027 153028 153029 153030 153031 153032 153033 153034 153035 153036 153037 153038 153039 153040 153041 153042 153043 153044 153045 153046 153047 153048 153049 153050 153051 153052 153053 153054 153055 153056 153057 153058 153059 153060 153061 153062 153063 153064 153065 153066 153067 153068 153069 153070 153071 153072 153073 153074 153075 153076 153077 153078 153079 153080 153081 153082 153083 153084 153085 153086 153087 153088 153089 153090 153091 153092 153093 153094 153095 153096 153097 153098 153099 153100 153101 153102 153103 153104 153105 153106 153107 153108 153109 153110 153111 153112 153113 153114 153115 153116 153117 153118 153119 153120 153121 153122 153123 153124 153125 153126 153127 153128 153129 153130 153131 153132 153133 153134 153135 153136 153137 153138 153139 153140 153141 153142 153143 153144 153145 153146 153147 153148 153149 153150 153151 153152 153153 153154 153155 153156 153157 153158 153159 153160 153161 153162 153163 153164 153165 153166 153167 153168 153169 153170 153171 153172 153173 153174 153175 153176 153177 153178 153179 153180 153181 153182 153183 153184 153185 153186 153187 153188 153189 153190 153191 153192 153193 153194 153195 153196 153197 153198 153199 153200 153201 153202 153203 153204 153205 153206 153207 153208 153209 153210 153211 153212 153213 153214 153215 153216 153217 153218 153219 153220 153221 153222 153223 153224 153225 153226 153227 153228 153229 153230 153231 153232 153233 153234 153235 153236 153237 153238 153239 153240 153241 153242 153243 153244 153245 153246 153247 153248 153249 153250 153251 153252 153253 153254 153255 153256 153257 153258 153259 153260 153261 153262 153263 153264 153265 153266 153267 153268 153269 153270 153271 153272 153273 153274 153275 153276 153277 153278 153279 153280 153281 153282 153283 153284 153285 153286 153287 153288 153289 153290 153291 153292 153293 153294 153295 153296 153297 153298 153299 153300 153301 153302 153303 153304 153305 153306 153307 153308 153309 153310 153311 153312 | - + - - - - - - - + + + + + + + - + - - + + - + - - + + - + - + - - + + - + + + + + + + - - + + - - + + - - + + - - + + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - - - - - - - - + + + + + + + + - - + + - + - - + + - - + + - - + + - + - - + + - - - + + + - - + + - - + + - - - + + + - + - + - + - + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - + + - + - + - + - - - + + + - - + + - + - + - + - - - + + + - + - + - + - + - - + + - + - + - - + + - - + + - - - - - - - + + + + + + + - + - - - + + + - + - + - + - + - - - - + + + + - - + + - + - - + + - + - + - - + + - + - - + + - + - - + + - + - + - + - - - - - - - + + + + + + + - + - - - + + + - - + + - + - - + + - + - + - - + + - + - - + + - - + + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - - - - - + + + + + + - - - - - - - - + + + + + + + + - + - + - - + + - - - + + + - - - + + + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - + - - - + + + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - + + + - + - + - + - + - + - + - - - + + + - + - + - + - + - - + + - + - - + + - + - + - + - - + + - + - + - + - + - + - + - + - - + + - + - + - - + + - + - + - + - + - + - - - - + + + + - - - - - - - - - + + + + + + + + + + + - + - + - - - - - + + + + + - + - - - - - - + + + + + + - - + + - - + + - + - - + + - + - - + + - - - + + + - + - + - - - + + + - + - - - - - + + + + + - + - + - + - - - + + - - + - - - + + + - + - - - - + + + + - + - + - + - - + + - + - - - + + + - + - - - - + + + + - + - - + + - + - - - - + + + + - - + + - + - - + + - + - - + + - - + + - - + + - - + + - - - + + + - + - - + + - - - + + + - - + + - + - + - + - + - - + + - - + + - - + + - + - + - + - + - + - + - + - + - + - - + + - - + + - - + + - - - + + + - - + + - - - - + + + + - - - + + + - + - - - + + + - + - - + + - + - + - + - - - + + + - + - + - + - - - + + + - - - + + + - + - - - + + + - + - - - + + + - - + + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - + + + - - - + + + - + - + - + - + - - - + + + - + - - - - + + + + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - - - - + + + + - - - - - + + + + + - - - + + + - - + + - - + + - - - + + + - - + + - - + + - + - - - + + + - + - + - - - - + + + + - + - + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { |
︙ | |||
155452 155453 155454 155455 155456 155457 155458 155459 155460 155461 155462 155463 155464 155465 | 156040 156041 156042 156043 156044 156045 156046 156047 156048 156049 156050 156051 156052 156053 156054 156055 156056 | + + + | { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose }, { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG }, { SQLITE_DBCONFIG_TRIGGER_EQP, SQLITE_TriggerEQP }, { SQLITE_DBCONFIG_RESET_DATABASE, SQLITE_ResetDatabase }, { SQLITE_DBCONFIG_DEFENSIVE, SQLITE_Defensive }, { SQLITE_DBCONFIG_WRITABLE_SCHEMA, SQLITE_WriteSchema| SQLITE_NoSchemaError }, { SQLITE_DBCONFIG_LEGACY_ALTER_TABLE, SQLITE_LegacyAlter }, { SQLITE_DBCONFIG_DQS_DDL, SQLITE_DqsDDL }, { SQLITE_DBCONFIG_DQS_DML, SQLITE_DqsDML }, }; unsigned int i; rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ for(i=0; i<ArraySize(aFlagOp); i++){ if( aFlagOp[i].op==op ){ int onoff = va_arg(ap, int); int *pRes = va_arg(ap, int*); |
︙ | |||
155482 155483 155484 155485 155486 155487 155488 | 156073 156074 156075 156076 156077 156078 156079 156080 156081 156082 156083 156084 156085 156086 156087 156088 156089 156090 156091 156092 156093 156094 156095 156096 156097 156098 156099 156100 156101 156102 156103 156104 156105 156106 156107 156108 156109 156110 156111 156112 156113 156114 156115 156116 156117 156118 156119 156120 156121 156122 156123 156124 156125 156126 156127 156128 156129 156130 156131 | - - - - - - - - - - - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + - + - - + | break; } } va_end(ap); return rc; } |
︙ | |||
157684 157685 157686 157687 157688 157689 157690 | 158268 158269 158270 158271 158272 158273 158274 158275 158276 158277 158278 158279 158280 158281 158282 158283 158284 158285 158286 158287 158288 158289 158290 158291 158292 158293 158294 158295 158296 158297 158298 158299 158300 158301 158302 158303 158304 158305 158306 158307 158308 158309 158310 | - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit)); db->aLimit[SQLITE_LIMIT_WORKER_THREADS] = SQLITE_DEFAULT_WORKER_THREADS; db->autoCommit = 1; db->nextAutovac = -1; db->szMmap = sqlite3GlobalConfig.szMmap; db->nextPagesize = 0; db->nMaxSorterMmap = 0x7FFFFFFF; |
︙ | |||
157735 157736 157737 157738 157739 157740 157741 | 158347 158348 158349 158350 158351 158352 158353 158354 158355 158356 158357 158358 158359 158360 158361 | - + | ** EVIDENCE-OF: R-52786-44878 SQLite defines three built-in collating ** functions: */ createCollation(db, sqlite3StrBINARY, SQLITE_UTF8, 0, binCollFunc, 0); createCollation(db, sqlite3StrBINARY, SQLITE_UTF16BE, 0, binCollFunc, 0); createCollation(db, sqlite3StrBINARY, SQLITE_UTF16LE, 0, binCollFunc, 0); createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0); |
︙ | |||
158711 158712 158713 158714 158715 158716 158717 158718 158719 158720 158721 158722 158723 158724 | 159323 159324 159325 159326 159327 159328 159329 159330 159331 159332 159333 159334 159335 159336 159337 159338 159339 159340 159341 159342 159343 159344 159345 159346 159347 159348 159349 159350 159351 159352 | + + + + + + + + + + + + + + + + | */ case SQLITE_TESTCTRL_PARSER_COVERAGE: { FILE *out = va_arg(ap, FILE*); if( sqlite3ParserCoverage(out) ) rc = SQLITE_ERROR; break; } #endif /* defined(YYCOVERAGE) */ /* sqlite3_test_control(SQLITE_TESTCTRL_RESULT_INTREAL, sqlite3_context*); ** ** This test-control causes the most recent sqlite3_result_int64() value ** to be interpreted as a MEM_IntReal instead of as an MEM_Int. Normally, ** MEM_IntReal values only arise during an INSERT operation of integer ** values into a REAL column, so they can be challenging to test. This ** test-control enables us to write an intreal() SQL function that can ** inject an intreal() value at arbitrary places in an SQL statement, ** for testing purposes. */ case SQLITE_TESTCTRL_RESULT_INTREAL: { sqlite3_context *pCtx = va_arg(ap, sqlite3_context*); sqlite3ResultIntReal(pCtx); break; } } va_end(ap); #endif /* SQLITE_UNTESTABLE */ return rc; } /* |
︙ | |||
172989 172990 172991 172992 172993 172994 172995 | 173617 173618 173619 173620 173621 173622 173623 173624 173625 173626 173627 173628 173629 173630 173631 173632 173633 173634 173635 173636 173637 173638 | - + - + | if( iCol==iCurrent ){ nList = (int)(p - pList); break; } nList -= (int)(p - pList); pList = p; |
︙ | |||
174124 174125 174126 174127 174128 174129 174130 | 174752 174753 174754 174755 174756 174757 174758 174759 174760 174761 174762 174763 174764 174765 174766 174767 174768 174769 174770 174771 174772 174773 174774 174775 174776 174777 174778 174779 174780 174781 174782 174783 174784 174785 | - + - + | p->aNode = 0; }else{ if( bFirst==0 ){ p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix); } p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix); |
︙ | |||
174304 174305 174306 174307 174308 174309 174310 | 174932 174933 174934 174935 174936 174937 174938 174939 174940 174941 174942 174943 174944 174945 174946 | - + | int bFirst = (pPrev->n==0); /* True if this is the first term written */ int nPrefix; /* Size of term prefix in bytes */ int nSuffix; /* Size of term suffix in bytes */ /* Node must have already been started. There must be a doclist for a ** leaf node, and there must not be a doclist for an internal node. */ assert( pNode->n>0 ); |
︙ | |||
174520 174521 174522 174523 174524 174525 174526 | 175148 175149 175150 175151 175152 175153 175154 175155 175156 175157 175158 175159 175160 175161 175162 | - + | static int fts3TermCmp( const char *zLhs, int nLhs, /* LHS of comparison */ const char *zRhs, int nRhs /* RHS of comparison */ ){ int nCmp = MIN(nLhs, nRhs); int res; |
︙ | |||
174652 174653 174654 174655 174656 174657 174658 | 175280 175281 175282 175283 175284 175285 175286 175287 175288 175289 175290 175291 175292 175293 175294 175295 175296 175297 175298 175299 175300 175301 175302 175303 175304 175305 175306 175307 175308 175309 175310 175311 175312 175313 175314 175315 175316 175317 175318 175319 175320 175321 175322 175323 175324 175325 175326 175327 175328 175329 | - + + + + + - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + | for(i=nHeight+1; i<FTS_MAX_APPENDABLE_HEIGHT; i++){ pWriter->aNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst; } pNode = &pWriter->aNodeWriter[nHeight]; pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight; |
︙ | |||
174922 174923 174924 174925 174926 174927 174928 | 175558 175559 175560 175561 175562 175563 175564 175565 175566 175567 175568 175569 175570 175571 175572 175573 175574 175575 | + + + - + | const char *zTerm, /* Omit all terms smaller than this */ int nTerm, /* Size of zTerm in bytes */ sqlite3_int64 *piBlock /* OUT: Block number in next layer down */ ){ NodeReader reader; /* Reader object */ Blob prev = {0, 0, 0}; /* Previous term written to new node */ int rc = SQLITE_OK; /* Return code */ int bLeaf; /* True for a leaf node */ if( nNode<1 ) return FTS_CORRUPT_VTAB; |
︙ | |||
179724 179725 179726 179727 179728 179729 179730 | 180363 180364 180365 180366 180367 180368 180369 180370 180371 180372 180373 180374 180375 180376 180377 | - + | pRoot = &pParse->aNode[iRoot]; j = 1; } if( pApnd ){ u32 iStart, iLabel; JsonNode *pNode; iStart = jsonParseAddNode(pParse, JSON_OBJECT, 2, 0); |
︙ | |||
189784 189785 189786 189787 189788 189789 189790 | 190423 190424 190425 190426 190427 190428 190429 190430 190431 190432 190433 190434 190435 190436 190437 190438 | + - + | sqlite3rbu *p = sqlite3_user_data(pCtx); const char *zIn; assert( argc==1 || argc==2 ); zIn = (const char*)sqlite3_value_text(argv[0]); if( zIn ){ if( rbuIsVacuum(p) ){ assert( argc==2 ); |
︙ | |||
190235 190236 190237 190238 190239 190240 190241 | 190875 190876 190877 190878 190879 190880 190881 190882 190883 190884 190885 190886 190887 190888 190889 190890 | + - + | if( i!=iOrder ){ SWAP(int, pIter->aiSrcOrder[i], pIter->aiSrcOrder[iOrder]); SWAP(char*, pIter->azTblCol[i], pIter->azTblCol[iOrder]); } pIter->azTblType[iOrder] = rbuStrndup(zType, &p->rc); assert( iPk>=0 ); |
︙ | |||
190269 190270 190271 190272 190273 190274 190275 190276 190277 190278 190279 190280 190281 190282 | 190910 190911 190912 190913 190914 190915 190916 190917 190918 190919 190920 190921 190922 190923 190924 190925 190926 190927 190928 190929 190930 190931 190932 190933 190934 190935 190936 190937 190938 190939 190940 190941 190942 190943 190944 190945 190946 190947 190948 190949 190950 190951 190952 190953 190954 190955 190956 190957 190958 190959 190960 190961 190962 190963 190964 190965 190966 190967 190968 190969 190970 190971 190972 190973 190974 190975 190976 190977 190978 190979 190980 190981 190982 190983 190984 190985 190986 190987 190988 190989 190990 190991 190992 190993 190994 190995 190996 190997 190998 190999 191000 191001 191002 191003 191004 191005 191006 191007 191008 191009 191010 191011 191012 191013 191014 191015 191016 191017 191018 191019 191020 191021 191022 191023 191024 191025 191026 191027 191028 191029 191030 191031 191032 191033 191034 191035 191036 191037 191038 191039 191040 191041 191042 191043 191044 191045 191046 191047 191048 191049 191050 191051 191052 191053 191054 191055 191056 191057 191058 191059 191060 191061 191062 191063 191064 191065 191066 191067 191068 191069 191070 191071 191072 191073 191074 191075 191076 191077 191078 191079 191080 191081 191082 191083 191084 191085 191086 191087 191088 191089 191090 191091 191092 191093 191094 191095 191096 191097 191098 191099 191100 191101 191102 191103 191104 191105 191106 191107 191108 191109 191110 191111 191112 191113 191114 191115 191116 191117 191118 191119 191120 191121 191122 191123 191124 191125 191126 191127 191128 191129 191130 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | for(i=0; i<pIter->nTblCol; i++){ const char *z = pIter->azTblCol[i]; zList = rbuMPrintf(p, "%z%s\"%w\"", zList, zSep, z); zSep = ", "; } return zList; } /* ** Return a comma separated list of the quoted PRIMARY KEY column names, ** in order, for the current table. Before each column name, add the text ** zPre. After each column name, add the zPost text. Use zSeparator as ** the separator text (usually ", "). */ static char *rbuObjIterGetPkList( sqlite3rbu *p, /* RBU object */ RbuObjIter *pIter, /* Object iterator for column names */ const char *zPre, /* Before each quoted column name */ const char *zSeparator, /* Separator to use between columns */ const char *zPost /* After each quoted column name */ ){ int iPk = 1; char *zRet = 0; const char *zSep = ""; while( 1 ){ int i; for(i=0; i<pIter->nTblCol; i++){ if( (int)pIter->abTblPk[i]==iPk ){ const char *zCol = pIter->azTblCol[i]; zRet = rbuMPrintf(p, "%z%s%s\"%w\"%s", zRet, zSep, zPre, zCol, zPost); zSep = zSeparator; break; } } if( i==pIter->nTblCol ) break; iPk++; } return zRet; } /* ** This function is called as part of restarting an RBU vacuum within ** stage 1 of the process (while the *-oal file is being built) while ** updating a table (not an index). The table may be a rowid table or ** a WITHOUT ROWID table. It queries the target database to find the ** largest key that has already been written to the target table and ** constructs a WHERE clause that can be used to extract the remaining ** rows from the source table. For a rowid table, the WHERE clause ** is of the form: ** ** "WHERE _rowid_ > ?" ** ** and for WITHOUT ROWID tables: ** ** "WHERE (key1, key2) > (?, ?)" ** ** Instead of "?" placeholders, the actual WHERE clauses created by ** this function contain literal SQL values. */ static char *rbuVacuumTableStart( sqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter, /* RBU iterator object */ int bRowid, /* True for a rowid table */ const char *zWrite /* Target table name prefix */ ){ sqlite3_stmt *pMax = 0; char *zRet = 0; if( bRowid ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, sqlite3_mprintf( "SELECT max(_rowid_) FROM \"%s%w\"", zWrite, pIter->zTbl ) ); if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ sqlite3_int64 iMax = sqlite3_column_int64(pMax, 0); zRet = rbuMPrintf(p, " WHERE _rowid_ > %lld ", iMax); } rbuFinalize(p, pMax); }else{ char *zOrder = rbuObjIterGetPkList(p, pIter, "", ", ", " DESC"); char *zSelect = rbuObjIterGetPkList(p, pIter, "quote(", "||','||", ")"); char *zList = rbuObjIterGetPkList(p, pIter, "", ", ", ""); if( p->rc==SQLITE_OK ){ p->rc = prepareFreeAndCollectError(p->dbMain, &pMax, &p->zErrmsg, sqlite3_mprintf( "SELECT %s FROM \"%s%w\" ORDER BY %s LIMIT 1", zSelect, zWrite, pIter->zTbl, zOrder ) ); if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pMax) ){ const char *zVal = (const char*)sqlite3_column_text(pMax, 0); zRet = rbuMPrintf(p, " WHERE (%s) > (%s) ", zList, zVal); } rbuFinalize(p, pMax); } sqlite3_free(zOrder); sqlite3_free(zSelect); sqlite3_free(zList); } return zRet; } /* ** This function is called as part of restating an RBU vacuum when the ** current operation is writing content to an index. If possible, it ** queries the target index b-tree for the largest key already written to ** it, then composes and returns an expression that can be used in a WHERE ** clause to select the remaining required rows from the source table. ** It is only possible to return such an expression if: ** ** * The index contains no DESC columns, and ** * The last key written to the index before the operation was ** suspended does not contain any NULL values. ** ** The expression is of the form: ** ** (index-field1, index-field2, ...) > (?, ?, ...) ** ** except that the "?" placeholders are replaced with literal values. ** ** If the expression cannot be created, NULL is returned. In this case, ** the caller has to use an OFFSET clause to extract only the required ** rows from the sourct table, just as it does for an RBU update operation. */ char *rbuVacuumIndexStart( sqlite3rbu *p, /* RBU handle */ RbuObjIter *pIter /* RBU iterator object */ ){ char *zOrder = 0; char *zLhs = 0; char *zSelect = 0; char *zVector = 0; char *zRet = 0; int bFailed = 0; const char *zSep = ""; int iCol = 0; sqlite3_stmt *pXInfo = 0; p->rc = prepareFreeAndCollectError(p->dbMain, &pXInfo, &p->zErrmsg, sqlite3_mprintf("PRAGMA main.index_xinfo = %Q", pIter->zIdx) ); while( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pXInfo) ){ int iCid = sqlite3_column_int(pXInfo, 1); const char *zCollate = (const char*)sqlite3_column_text(pXInfo, 4); const char *zCol; if( sqlite3_column_int(pXInfo, 3) ){ bFailed = 1; break; } if( iCid<0 ){ if( pIter->eType==RBU_PK_IPK ){ int i; for(i=0; pIter->abTblPk[i]==0; i++); assert( i<pIter->nTblCol ); zCol = pIter->azTblCol[i]; }else{ zCol = "_rowid_"; } }else{ zCol = pIter->azTblCol[iCid]; } zLhs = rbuMPrintf(p, "%z%s \"%w\" COLLATE %Q", zLhs, zSep, zCol, zCollate ); zOrder = rbuMPrintf(p, "%z%s \"rbu_imp_%d%w\" COLLATE %Q DESC", zOrder, zSep, iCol, zCol, zCollate ); zSelect = rbuMPrintf(p, "%z%s quote(\"rbu_imp_%d%w\")", zSelect, zSep, iCol, zCol ); zSep = ", "; iCol++; } rbuFinalize(p, pXInfo); if( bFailed ) goto index_start_out; if( p->rc==SQLITE_OK ){ sqlite3_stmt *pSel = 0; p->rc = prepareFreeAndCollectError(p->dbMain, &pSel, &p->zErrmsg, sqlite3_mprintf("SELECT %s FROM \"rbu_imp_%w\" ORDER BY %s LIMIT 1", zSelect, pIter->zTbl, zOrder ) ); if( p->rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pSel) ){ zSep = ""; for(iCol=0; iCol<pIter->nCol; iCol++){ const char *zQuoted = (const char*)sqlite3_column_text(pSel, iCol); if( zQuoted[0]=='N' ){ bFailed = 1; break; } zVector = rbuMPrintf(p, "%z%s%s", zVector, zSep, zQuoted); zSep = ", "; } if( !bFailed ){ zRet = rbuMPrintf(p, "(%s) > (%s)", zLhs, zVector); } } rbuFinalize(p, pSel); } index_start_out: sqlite3_free(zOrder); sqlite3_free(zSelect); sqlite3_free(zVector); sqlite3_free(zLhs); return zRet; } /* ** This function is used to create a SELECT list (the list of SQL ** expressions that follows a SELECT keyword) for a SELECT statement ** used to read from an data_xxx or rbu_tmp_xxx table while updating the ** index object currently indicated by the iterator object passed as the ** second argument. A "PRAGMA index_xinfo = <idxname>" statement is used |
︙ | |||
190946 190947 190948 190949 190950 190951 190952 190953 | 191794 191795 191796 191797 191798 191799 191800 191801 191802 191803 191804 191805 191806 191807 191808 191809 191810 191811 191812 191813 191814 191815 191816 191817 191818 191819 191820 191821 191822 191823 191824 191825 | + + + + + + + + + - + + + - + + | ); } /* Create the SELECT statement to read keys in sorted order */ if( p->rc==SQLITE_OK ){ char *zSql; if( rbuIsVacuum(p) ){ char *zStart = 0; if( nOffset ){ zStart = rbuVacuumIndexStart(p, pIter); if( zStart ){ sqlite3_free(zLimit); zLimit = 0; } } zSql = sqlite3_mprintf( |
︙ | |||
190974 190975 190976 190977 190978 190979 190980 | 191834 191835 191836 191837 191838 191839 191840 191841 191842 191843 191844 191845 191846 191847 191848 191849 191850 191851 191852 | + - + + + + | zCollist, p->zStateDb, pIter->zDataTbl, zPart, zCollist, pIter->zDataTbl, zPart, (zPart ? "AND" : "WHERE"), zCollist, zLimit ); } if( p->rc==SQLITE_OK ){ |
︙ | |||
191074 191075 191076 191077 191078 191079 191080 191081 191082 191083 | 191938 191939 191940 191941 191942 191943 191944 191945 191946 191947 191948 191949 191950 191951 191952 191953 191954 191955 191956 191957 191958 191959 191960 191961 191962 191963 191964 191965 191966 191967 191968 191969 191970 191971 191972 191973 191974 191975 191976 191977 191978 191979 191980 191981 191982 191983 191984 191985 191986 191987 | + + + + + + + + + + + + + + + + + + + - - - - - - - - - + + + + + + + + + + + + + + | rbuObjIterPrepareTmpInsert(p, pIter, zCollist, zRbuRowid); } /* Create the SELECT statement to read keys from data_xxx */ if( p->rc==SQLITE_OK ){ const char *zRbuRowid = ""; char *zStart = 0; char *zOrder = 0; if( bRbuRowid ){ zRbuRowid = rbuIsVacuum(p) ? ",_rowid_ " : ",rbu_rowid"; } if( rbuIsVacuum(p) ){ if( nOffset ){ zStart = rbuVacuumTableStart(p, pIter, bRbuRowid, zWrite); if( zStart ){ sqlite3_free(zLimit); zLimit = 0; } } if( bRbuRowid ){ zOrder = rbuMPrintf(p, "_rowid_"); }else{ zOrder = rbuObjIterGetPkList(p, pIter, "", ", ", ""); } } if( p->rc==SQLITE_OK ){ |
︙ | |||
193312 193313 193314 193315 193316 193317 193318 | 194200 194201 194202 194203 194204 194205 194206 194207 194208 194209 194210 194211 194212 194213 194214 | - - + - | rc = xControl(p->pReal, SQLITE_FCNTL_ZIPVFS, &dummy); if( rc==SQLITE_OK ){ rc = SQLITE_ERROR; pRbu->zErrmsg = sqlite3_mprintf("rbu/zipvfs setup error"); }else if( rc==SQLITE_NOTFOUND ){ pRbu->pTargetFd = p; p->pRbu = pRbu; |
︙ | |||
193377 193378 193379 193380 193381 193382 193383 | 194263 194264 194265 194266 194267 194268 194269 194270 194271 194272 194273 194274 194275 194276 194277 | - - + - - | /* Magic number 1 is the WAL_CKPT_LOCK lock. Preventing SQLite from ** taking this lock also prevents any checkpoints from occurring. ** todo: really, it's not clear why this might occur, as ** wal_autocheckpoint ought to be turned off. */ if( ofst==WAL_LOCK_CKPT && n==1 ) rc = SQLITE_BUSY; }else{ int bCapture = 0; |
︙ | |||
193413 193414 193415 193416 193417 193418 193419 | 194296 194297 194298 194299 194300 194301 194302 194303 194304 194305 194306 194307 194308 194309 194310 194311 194312 194313 194314 194315 194316 194317 194318 194319 194320 194321 194322 194323 194324 194325 194326 194327 | - + - - - - - - - - - - - + + + + + + + + + + + + + + + + - - + | int rc = SQLITE_OK; int eStage = (p->pRbu ? p->pRbu->eStage : 0); /* If not in RBU_STAGE_OAL, allow this call to pass through. Or, if this ** rbu is in the RBU_STAGE_OAL state, use heap memory for *-shm space ** instead of a file on disk. */ assert( p->openFlags & (SQLITE_OPEN_MAIN_DB|SQLITE_OPEN_TEMP_DB) ); |
︙ | |||
193655 193656 193657 193658 193659 193660 193661 | 194542 194543 194544 194545 194546 194547 194548 194549 194550 194551 194552 194553 194554 194555 194556 194557 | - + + | ** b) if the *-wal file does not exist, claim that it does anyway, ** causing SQLite to call xOpen() to open it. This call will also ** be intercepted (see the rbuVfsOpen() function) and the *-oal ** file opened instead. */ if( rc==SQLITE_OK && flags==SQLITE_ACCESS_EXISTS ){ rbu_file *pDb = rbuFindMaindb(pRbuVfs, zPath, 1); |
︙ | |||
196648 196649 196650 196651 196652 196653 196654 | 197536 197537 197538 197539 197540 197541 197542 197543 197544 197545 197546 197547 197548 197549 197550 197551 197552 | + - + + | if( sqlite3_stricmp(azCol[i], pTo->azCol[i]) ) bMismatch = 1; if( abPK[i] ) bHasPk = 1; } } } sqlite3_free((char*)azCol); if( bMismatch ){ if( pzErrMsg ){ |
︙ | |||
196854 196855 196856 196857 196858 196859 196860 | 197744 197745 197746 197747 197748 197749 197750 197751 197752 197753 197754 197755 197756 197757 197758 | - + | ** Ensure that there is room in the buffer to append nByte bytes of data. ** If not, use sqlite3_realloc() to grow the buffer so that there is. ** ** If successful, return zero. Otherwise, if an OOM condition is encountered, ** set *pRc to SQLITE_NOMEM and return non-zero. */ static int sessionBufferGrow(SessionBuffer *p, size_t nByte, int *pRc){ |
︙ | |||
204279 204280 204281 204282 204283 204284 204285 | 205169 205170 205171 205172 205173 205174 205175 205176 205177 205178 205179 205180 205181 205182 205183 205184 205185 205186 205187 205188 205189 205190 205191 205192 205193 205194 205195 | - + + + + + + + + + + | /* EOF */ *piOff = -1; return 1; }else{ i64 iOff = *piOff; int iVal; fts5FastGetVarint32(a, i, iVal); |
︙ | |||
209865 209866 209867 209868 209869 209870 209871 | 210764 210765 210766 210767 210768 210769 210770 210771 210772 210773 210774 210775 210776 210777 210778 | - + | Fts5Data *pData; pData = fts5DataRead(p, FTS5_STRUCTURE_ROWID); if( p->rc==SQLITE_OK ){ /* TODO: Do we need this if the leaf-index is appended? Probably... */ memset(&pData->p[pData->nn], 0, FTS5_DATA_PADDING); p->rc = fts5StructureDecode(pData->p, pData->nn, &iCookie, &pRet); |
︙ | |||
213826 213827 213828 213829 213830 213831 213832 | 214725 214726 214727 214728 214729 214730 214731 214732 214733 214734 214735 214736 214737 214738 214739 214740 214741 214742 214743 214744 214745 214746 214747 214748 214749 214750 214751 214752 214753 214754 214755 214756 214757 214758 214759 214760 214761 214762 214763 214764 214765 | - - + + + + + + + + + + | Fts5Buffer tmp = {0, 0, 0}; /* The maximum size of the output is equal to the sum of the two ** input sizes + 1 varint (9 bytes). The extra varint is because if the ** first rowid in one input is a large negative number, and the first in ** the other a non-negative number, the delta for the non-negative ** number will be larger on disk than the literal integer value |
︙ | |||
213868 213869 213870 213871 213872 213873 213874 | 214775 214776 214777 214778 214779 214780 214781 214782 214783 214784 214785 214786 214787 214788 214789 214790 214791 214792 214793 214794 214795 214796 214797 | - + - | fts5MergeAppendDocid(&out, iLastRowid, i2.iRowid); fts5BufferZero(&tmp); sqlite3Fts5BufferSize(&p->rc, &tmp, i1.nPoslist + i2.nPoslist); if( p->rc ) break; sqlite3Fts5PoslistNext64(a1, i1.nPoslist, &iOff1, &iPos1); sqlite3Fts5PoslistNext64(a2, i2.nPoslist, &iOff2, &iPos2); |
︙ | |||
213902 213903 213904 213905 213906 213907 213908 | 214808 214809 214810 214811 214812 214813 214814 214815 214816 214817 214818 214819 214820 214821 214822 214823 214824 214825 214826 214827 214828 214829 214830 214831 214832 214833 214834 214835 214836 214837 214838 214839 214840 214841 214842 214843 214844 214845 214846 214847 214848 214849 214850 | - + - + + - + | if( iPos1>=0 ){ if( iPos1!=iPrev ){ sqlite3Fts5PoslistSafeAppend(&tmp, &iPrev, iPos1); } aCopy = &a1[iOff1]; nCopy = i1.nPoslist - iOff1; }else{ |
︙ | |||
218095 218096 218097 218098 218099 218100 218101 | 219002 219003 219004 219005 219006 219007 219008 219009 219010 219011 219012 219013 219014 219015 219016 | - + | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); |
︙ | |||
222354 222355 222356 222357 222358 222359 222360 | 223261 223262 223263 223264 223265 223266 223267 223268 223269 223270 223271 223272 223273 223274 223275 223276 223277 223278 | - - + + + + | if( sqlite3Fts5IterEof(pCsr->pIter) ) break; } } } } if( rc==SQLITE_OK && pCsr->bEof==0 && pTab->eType==FTS5_VOCAB_COL ){ |
︙ | |||
222859 222860 222861 222862 222863 222864 222865 | 223768 223769 223770 223771 223772 223773 223774 223775 223776 223777 223778 223779 223780 223781 | - + - + | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ |
Changes to src/sqlite3.h.
︙ | |||
119 120 121 122 123 124 125 | 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | - - - + + + | ** been edited in any way since it was last checked in, then the last ** four hexadecimal digits of the hash may be modified. ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ |
︙ | |||
1292 1293 1294 1295 1296 1297 1298 | 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 | - - + + + + + + + + | ** element will be valid after xOpen returns regardless of the success ** or failure of the xOpen call. ** ** [[sqlite3_vfs.xAccess]] ** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] ** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to ** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] |
︙ | |||
2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 | 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + | ** <dd>The SQLITE_DBCONFIG_DEFENSIVE option activates or deactivates the ** "defensive" flag for a database connection. When the defensive ** flag is enabled, language features that allow ordinary SQL to ** deliberately corrupt the database file are disabled. The disabled ** features include but are not limited to the following: ** <ul> ** <li> The [PRAGMA writable_schema=ON] statement. ** <li> The [PRAGMA journal_mode=OFF] statement. ** <li> Writes to the [sqlite_dbpage] virtual table. ** <li> Direct writes to [shadow tables]. ** </ul> ** </dd> ** ** [[SQLITE_DBCONFIG_WRITABLE_SCHEMA]] <dt>SQLITE_DBCONFIG_WRITABLE_SCHEMA</dt> ** <dd>The SQLITE_DBCONFIG_WRITABLE_SCHEMA option activates or deactivates the ** "writable_schema" flag. This has the same effect and is logically equivalent ** to setting [PRAGMA writable_schema=ON] or [PRAGMA writable_schema=OFF]. ** The first argument to this setting is an integer which is 0 to disable ** the writable_schema, positive to enable writable_schema, or negative to ** leave the setting unchanged. The second parameter is a pointer to an ** integer into which is written 0 or 1 to indicate whether the writable_schema ** is enabled or disabled following this call. ** </dd> ** ** [[SQLITE_DBCONFIG_LEGACY_ALTER_TABLE]] ** <dt>SQLITE_DBCONFIG_LEGACY_ALTER_TABLE</dt> ** <dd>The SQLITE_DBCONFIG_LEGACY_ALTER_TABLE option activates or deactivates ** the legacy behavior of the [ALTER TABLE RENAME] command such it ** behaves as it did prior to [version 3.24.0] (2018-06-04). See the ** "Compatibility Notice" on the [ALTER TABLE RENAME documentation] for ** additional information. This feature can also be turned on and off ** using the [PRAGMA legacy_alter_table] statement. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DML]] ** <dt>SQLITE_DBCONFIG_DQS_DML</td> ** <dd>The SQLITE_DBCONFIG_DQS_DML option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DML statement ** only, that is DELETE, INSERT, SELECT, and UPDATE statements. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** ** [[SQLITE_DBCONFIG_DQS_DDL]] ** <dt>SQLITE_DBCONFIG_DQS_DDL</td> ** <dd>The SQLITE_DBCONFIG_DQS option activates or deactivates ** the legacy [double-quoted string literal] misfeature for DDL statements, ** such as CREATE TABLE and CREATE INDEX. The ** default value of this setting is determined by the [-DSQLITE_DQS] ** compile-time option. ** </dd> ** </dl> */ #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ #define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ #define SQLITE_DBCONFIG_TRIGGER_EQP 1008 /* int int* */ #define SQLITE_DBCONFIG_RESET_DATABASE 1009 /* int int* */ #define SQLITE_DBCONFIG_DEFENSIVE 1010 /* int int* */ #define SQLITE_DBCONFIG_WRITABLE_SCHEMA 1011 /* int int* */ #define SQLITE_DBCONFIG_LEGACY_ALTER_TABLE 1012 /* int int* */ #define SQLITE_DBCONFIG_DQS_DML 1013 /* int int* */ #define SQLITE_DBCONFIG_DQS_DDL 1014 /* int int* */ |
︙ | |||
7315 7316 7317 7318 7319 7320 7321 | 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 | + - + | #define SQLITE_TESTCTRL_NEVER_CORRUPT 20 #define SQLITE_TESTCTRL_VDBE_COVERAGE 21 #define SQLITE_TESTCTRL_BYTEORDER 22 #define SQLITE_TESTCTRL_ISINIT 23 #define SQLITE_TESTCTRL_SORTER_MMAP 24 #define SQLITE_TESTCTRL_IMPOSTER 25 #define SQLITE_TESTCTRL_PARSER_COVERAGE 26 #define SQLITE_TESTCTRL_RESULT_INTREAL 27 |
︙ |