Fossil SCM
Update the built-in SQLite to the latest version on the fullscan-covering-index branch. This is for the purpose of testing SQLite changes.
Commit
ac2d29326be52d3298e1986d554a94d3b7366f8a
Parent
f4022040f819d76…
2 files changed
+426
-261
+24
-4
+426
-261
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | -** version 3.7.14. By combining all the individual C code files into this | |
| 3 | +** version 3.7.15. By combining all the individual C code files into this | |
| 4 | 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | ||
| 671 | 671 | ** |
| 672 | 672 | ** See also: [sqlite3_libversion()], |
| 673 | 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | 675 | */ |
| 676 | -#define SQLITE_VERSION "3.7.14" | |
| 677 | -#define SQLITE_VERSION_NUMBER 3007014 | |
| 678 | -#define SQLITE_SOURCE_ID "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a" | |
| 676 | +#define SQLITE_VERSION "3.7.15" | |
| 677 | +#define SQLITE_VERSION_NUMBER 3007015 | |
| 678 | +#define SQLITE_SOURCE_ID "2012-09-17 21:24:01 698b2a28004a9a2f0eabaadf36d833da4400b2bf" | |
| 679 | 679 | |
| 680 | 680 | /* |
| 681 | 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | 683 | ** |
| @@ -1042,10 +1042,11 @@ | ||
| 1042 | 1042 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1043 | 1043 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1044 | 1044 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1045 | 1045 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1046 | 1046 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1047 | +#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) | |
| 1047 | 1048 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1048 | 1049 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1049 | 1050 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1050 | 1051 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1051 | 1052 | |
| @@ -2130,10 +2131,22 @@ | ||
| 2130 | 2131 | ** connection is opened. If it is globally disabled, filenames are |
| 2131 | 2132 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 2132 | 2133 | ** database connection is opened. By default, URI handling is globally |
| 2133 | 2134 | ** disabled. The default value may be changed by compiling with the |
| 2134 | 2135 | ** [SQLITE_USE_URI] symbol defined. |
| 2136 | +** | |
| 2137 | +** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN | |
| 2138 | +** <dd> This option taks a single integer argument which is interpreted as | |
| 2139 | +** a boolean in order to enable or disable the use of covering indices for | |
| 2140 | +** full table scans in the query optimizer. The default setting is determined | |
| 2141 | +** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" | |
| 2142 | +** if that compile-time option is omitted. | |
| 2143 | +** The ability to disable the use of covering indices for full table scans | |
| 2144 | +** is because some incorrectly coded legacy applications might malfunction | |
| 2145 | +** malfunction when the optimization is enabled. Providing the ability to | |
| 2146 | +** disable the optimization allows the older, buggy application code to work | |
| 2147 | +** without change even with newer versions of SQLite. | |
| 2135 | 2148 | ** |
| 2136 | 2149 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 2137 | 2150 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 2138 | 2151 | ** <dd> These options are obsolete and should not be used by new code. |
| 2139 | 2152 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -2156,10 +2169,11 @@ | ||
| 2156 | 2169 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 2157 | 2170 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 2158 | 2171 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 2159 | 2172 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 2160 | 2173 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 2174 | +#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ | |
| 2161 | 2175 | |
| 2162 | 2176 | /* |
| 2163 | 2177 | ** CAPI3REF: Database Connection Configuration Options |
| 2164 | 2178 | ** |
| 2165 | 2179 | ** These constants are the available integer configuration options that |
| @@ -3164,11 +3178,11 @@ | ||
| 3164 | 3178 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 3165 | 3179 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 3166 | 3180 | ** an error)^. |
| 3167 | 3181 | ** ^If "ro" is specified, then the database is opened for read-only |
| 3168 | 3182 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 3169 | -** third argument to sqlite3_prepare_v2(). ^If the mode option is set to | |
| 3183 | +** third argument to sqlite3_open_v2(). ^If the mode option is set to | |
| 3170 | 3184 | ** "rw", then the database is opened for read-write (but not create) |
| 3171 | 3185 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 3172 | 3186 | ** been set. ^Value "rwc" is equivalent to setting both |
| 3173 | 3187 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 3174 | 3188 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -3315,10 +3329,15 @@ | ||
| 3315 | 3329 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 3316 | 3330 | ** ^(Memory to hold the error message string is managed internally. |
| 3317 | 3331 | ** The application does not need to worry about freeing the result. |
| 3318 | 3332 | ** However, the error string might be overwritten or deallocated by |
| 3319 | 3333 | ** subsequent calls to other SQLite interface functions.)^ |
| 3334 | +** | |
| 3335 | +** ^The sqlite3_errstr() interface returns the English-language text | |
| 3336 | +** that describes the [result code], as UTF-8. | |
| 3337 | +** ^(Memory to hold the error message string is managed internally | |
| 3338 | +** and must not be freed by the application)^. | |
| 3320 | 3339 | ** |
| 3321 | 3340 | ** When the serialized [threading mode] is in use, it might be the |
| 3322 | 3341 | ** case that a second error occurs on a separate thread in between |
| 3323 | 3342 | ** the time of the first error and the call to these interfaces. |
| 3324 | 3343 | ** When that happens, the second error will be reported since these |
| @@ -3334,10 +3353,11 @@ | ||
| 3334 | 3353 | */ |
| 3335 | 3354 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 3336 | 3355 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 3337 | 3356 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 3338 | 3357 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 3358 | +SQLITE_API const char *sqlite3_errstr(int); | |
| 3339 | 3359 | |
| 3340 | 3360 | /* |
| 3341 | 3361 | ** CAPI3REF: SQL Statement Object |
| 3342 | 3362 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 3343 | 3363 | ** |
| @@ -9959,20 +9979,18 @@ | ||
| 9959 | 9979 | /* |
| 9960 | 9980 | ** Bits of the sqlite3.flags field that are used by the |
| 9961 | 9981 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface. |
| 9962 | 9982 | ** These must be the low-order bits of the flags field. |
| 9963 | 9983 | */ |
| 9964 | -#define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ | |
| 9965 | -#define SQLITE_ColumnCache 0x02 /* Disable the column cache */ | |
| 9966 | -#define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ | |
| 9967 | -#define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ | |
| 9968 | -#define SQLITE_IndexCover 0x10 /* Disable index covering table */ | |
| 9969 | -#define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ | |
| 9970 | -#define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ | |
| 9971 | -#define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */ | |
| 9972 | -#define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */ | |
| 9973 | -#define SQLITE_OptMask 0xff /* Mask of all disablable opts */ | |
| 9984 | +#define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ | |
| 9985 | +#define SQLITE_ColumnCache 0x02 /* Disable the column cache */ | |
| 9986 | +#define SQLITE_GroupByOrder 0x04 /* Disable GROUPBY cover of ORDERBY */ | |
| 9987 | +#define SQLITE_FactorOutConst 0x08 /* Disable factoring out constants */ | |
| 9988 | +#define SQLITE_IdxRealAsInt 0x10 /* Store REAL as INT in indices */ | |
| 9989 | +#define SQLITE_DistinctOpt 0x20 /* DISTINCT using indexes */ | |
| 9990 | +#define SQLITE_CoverIdxScan 0x40 /* Disable covering index scans */ | |
| 9991 | +#define SQLITE_OptMask 0xff /* Mask of all disablable opts */ | |
| 9974 | 9992 | |
| 9975 | 9993 | /* |
| 9976 | 9994 | ** Possible values for the sqlite.magic field. |
| 9977 | 9995 | ** The numbers are obtained at random and have no special meaning, other |
| 9978 | 9996 | ** than being distinct from one another. |
| @@ -10119,18 +10137,20 @@ | ||
| 10119 | 10137 | char *zName; /* Name of this column */ |
| 10120 | 10138 | Expr *pDflt; /* Default value of this column */ |
| 10121 | 10139 | char *zDflt; /* Original text of the default value */ |
| 10122 | 10140 | char *zType; /* Data type for this column */ |
| 10123 | 10141 | char *zColl; /* Collating sequence. If NULL, use the default */ |
| 10124 | - u8 notNull; /* True if there is a NOT NULL constraint */ | |
| 10125 | - u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */ | |
| 10142 | + u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ | |
| 10126 | 10143 | char affinity; /* One of the SQLITE_AFF_... values */ |
| 10127 | -#ifndef SQLITE_OMIT_VIRTUALTABLE | |
| 10128 | - u8 isHidden; /* True if this column is 'hidden' */ | |
| 10129 | -#endif | |
| 10144 | + u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */ | |
| 10130 | 10145 | }; |
| 10131 | 10146 | |
| 10147 | +/* Allowed values for Column.colFlags: | |
| 10148 | +*/ | |
| 10149 | +#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ | |
| 10150 | +#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ | |
| 10151 | + | |
| 10132 | 10152 | /* |
| 10133 | 10153 | ** A "Collating Sequence" is defined by an instance of the following |
| 10134 | 10154 | ** structure. Conceptually, a collating sequence consists of a name and |
| 10135 | 10155 | ** a comparison routine that defines the order of that sequence. |
| 10136 | 10156 | ** |
| @@ -10282,32 +10302,32 @@ | ||
| 10282 | 10302 | ** sub-query that appears instead of a real table name in the FROM clause |
| 10283 | 10303 | ** of a SELECT statement. |
| 10284 | 10304 | */ |
| 10285 | 10305 | struct Table { |
| 10286 | 10306 | char *zName; /* Name of the table or view */ |
| 10287 | - int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ | |
| 10288 | - int nCol; /* Number of columns in this table */ | |
| 10289 | 10307 | Column *aCol; /* Information about each column */ |
| 10290 | 10308 | Index *pIndex; /* List of SQL indexes on this table. */ |
| 10291 | - int tnum; /* Root BTree node for this table (see note above) */ | |
| 10292 | - tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ | |
| 10293 | 10309 | Select *pSelect; /* NULL for tables. Points to definition if a view. */ |
| 10294 | - u16 nRef; /* Number of pointers to this Table */ | |
| 10295 | - u8 tabFlags; /* Mask of TF_* values */ | |
| 10296 | - u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ | |
| 10297 | 10310 | FKey *pFKey; /* Linked list of all foreign keys in this table */ |
| 10298 | 10311 | char *zColAff; /* String defining the affinity of each column */ |
| 10299 | 10312 | #ifndef SQLITE_OMIT_CHECK |
| 10300 | 10313 | ExprList *pCheck; /* All CHECK constraints */ |
| 10301 | 10314 | #endif |
| 10315 | + tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ | |
| 10316 | + int tnum; /* Root BTree node for this table (see note above) */ | |
| 10317 | + i16 iPKey; /* If not negative, use aCol[iPKey] as the primary key */ | |
| 10318 | + i16 nCol; /* Number of columns in this table */ | |
| 10319 | + u16 nRef; /* Number of pointers to this Table */ | |
| 10320 | + u8 tabFlags; /* Mask of TF_* values */ | |
| 10321 | + u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ | |
| 10302 | 10322 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 10303 | 10323 | int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ |
| 10304 | 10324 | #endif |
| 10305 | 10325 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10306 | - VTable *pVTable; /* List of VTable objects. */ | |
| 10307 | 10326 | int nModuleArg; /* Number of arguments to the module */ |
| 10308 | 10327 | char **azModuleArg; /* Text of all module args. [0] is module name */ |
| 10328 | + VTable *pVTable; /* List of VTable objects. */ | |
| 10309 | 10329 | #endif |
| 10310 | 10330 | Trigger *pTrigger; /* List of triggers stored in pSchema */ |
| 10311 | 10331 | Schema *pSchema; /* Schema that contains this table */ |
| 10312 | 10332 | Table *pNextZombie; /* Next on the Parse.pZombieTab list */ |
| 10313 | 10333 | }; |
| @@ -10327,11 +10347,11 @@ | ||
| 10327 | 10347 | ** done as a macro so that it will be optimized out when virtual |
| 10328 | 10348 | ** table support is omitted from the build. |
| 10329 | 10349 | */ |
| 10330 | 10350 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10331 | 10351 | # define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) |
| 10332 | -# define IsHiddenColumn(X) ((X)->isHidden) | |
| 10352 | +# define IsHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0) | |
| 10333 | 10353 | #else |
| 10334 | 10354 | # define IsVirtual(X) 0 |
| 10335 | 10355 | # define IsHiddenColumn(X) 0 |
| 10336 | 10356 | #endif |
| 10337 | 10357 | |
| @@ -10679,10 +10699,13 @@ | ||
| 10679 | 10699 | /* If the EP_Reduced flag is set in the Expr.flags mask, then no |
| 10680 | 10700 | ** space is allocated for the fields below this point. An attempt to |
| 10681 | 10701 | ** access them will result in a segfault or malfunction. |
| 10682 | 10702 | *********************************************************************/ |
| 10683 | 10703 | |
| 10704 | +#if SQLITE_MAX_EXPR_DEPTH>0 | |
| 10705 | + int nHeight; /* Height of the tree headed by this node */ | |
| 10706 | +#endif | |
| 10684 | 10707 | int iTable; /* TK_COLUMN: cursor number of table holding column |
| 10685 | 10708 | ** TK_REGISTER: register number |
| 10686 | 10709 | ** TK_TRIGGER: 1 -> new, 0 -> old */ |
| 10687 | 10710 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 10688 | 10711 | ** TK_VARIABLE: variable number (always >= 1). */ |
| @@ -10692,13 +10715,10 @@ | ||
| 10692 | 10715 | u8 op2; /* TK_REGISTER: original value of Expr.op |
| 10693 | 10716 | ** TK_COLUMN: the value of p5 for OP_Column |
| 10694 | 10717 | ** TK_AGG_FUNCTION: nesting depth */ |
| 10695 | 10718 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 10696 | 10719 | Table *pTab; /* Table for TK_COLUMN expressions. */ |
| 10697 | -#if SQLITE_MAX_EXPR_DEPTH>0 | |
| 10698 | - int nHeight; /* Height of the tree headed by this node */ | |
| 10699 | -#endif | |
| 10700 | 10720 | }; |
| 10701 | 10721 | |
| 10702 | 10722 | /* |
| 10703 | 10723 | ** The following are the meanings of bits in the Expr.flags field. |
| 10704 | 10724 | */ |
| @@ -11459,10 +11479,11 @@ | ||
| 11459 | 11479 | struct Sqlite3Config { |
| 11460 | 11480 | int bMemstat; /* True to enable memory status */ |
| 11461 | 11481 | int bCoreMutex; /* True to enable core mutexing */ |
| 11462 | 11482 | int bFullMutex; /* True to enable full mutexing */ |
| 11463 | 11483 | int bOpenUri; /* True to interpret filenames as URIs */ |
| 11484 | + int bUseCis; /* Use covering indices for full-scans */ | |
| 11464 | 11485 | int mxStrlen; /* Maximum string length */ |
| 11465 | 11486 | int szLookaside; /* Default lookaside buffer size */ |
| 11466 | 11487 | int nLookaside; /* Default lookaside buffer count */ |
| 11467 | 11488 | sqlite3_mem_methods m; /* Low-level memory allocation interface */ |
| 11468 | 11489 | sqlite3_mutex_methods mutex; /* Low-level mutex interface */ |
| @@ -11775,10 +11796,11 @@ | ||
| 11775 | 11796 | SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); |
| 11776 | 11797 | #else |
| 11777 | 11798 | # define sqlite3AutoincrementBegin(X) |
| 11778 | 11799 | # define sqlite3AutoincrementEnd(X) |
| 11779 | 11800 | #endif |
| 11801 | +SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse*, Select*, SelectDest*); | |
| 11780 | 11802 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int); |
| 11781 | 11803 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 11782 | 11804 | SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 11783 | 11805 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 11784 | 11806 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| @@ -11950,11 +11972,11 @@ | ||
| 11950 | 11972 | SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); |
| 11951 | 11973 | SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); |
| 11952 | 11974 | SQLITE_PRIVATE int sqlite3Atoi(const char*); |
| 11953 | 11975 | SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); |
| 11954 | 11976 | SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); |
| 11955 | -SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8*, const u8**); | |
| 11977 | +SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); | |
| 11956 | 11978 | |
| 11957 | 11979 | /* |
| 11958 | 11980 | ** Routines to read and write variable-length integers. These used to |
| 11959 | 11981 | ** be defined locally, but now we use the varint routines in the util.c |
| 11960 | 11982 | ** file. Code should use the MACRO forms below, as the Varint32 versions |
| @@ -12450,19 +12472,24 @@ | ||
| 12450 | 12472 | |
| 12451 | 12473 | #ifndef SQLITE_USE_URI |
| 12452 | 12474 | # define SQLITE_USE_URI 0 |
| 12453 | 12475 | #endif |
| 12454 | 12476 | |
| 12477 | +#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN | |
| 12478 | +# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 | |
| 12479 | +#endif | |
| 12480 | + | |
| 12455 | 12481 | /* |
| 12456 | 12482 | ** The following singleton contains the global configuration for |
| 12457 | 12483 | ** the SQLite library. |
| 12458 | 12484 | */ |
| 12459 | 12485 | SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { |
| 12460 | 12486 | SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ |
| 12461 | 12487 | 1, /* bCoreMutex */ |
| 12462 | 12488 | SQLITE_THREADSAFE==1, /* bFullMutex */ |
| 12463 | 12489 | SQLITE_USE_URI, /* bOpenUri */ |
| 12490 | + SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ | |
| 12464 | 12491 | 0x7ffffffe, /* mxStrlen */ |
| 12465 | 12492 | 128, /* szLookaside */ |
| 12466 | 12493 | 500, /* nLookaside */ |
| 12467 | 12494 | {0,0,0,0,0,0,0,0}, /* m */ |
| 12468 | 12495 | {0,0,0,0,0,0,0,0,0}, /* mutex */ |
| @@ -12876,10 +12903,13 @@ | ||
| 12876 | 12903 | #ifdef SQLITE_PERFORMANCE_TRACE |
| 12877 | 12904 | "PERFORMANCE_TRACE", |
| 12878 | 12905 | #endif |
| 12879 | 12906 | #ifdef SQLITE_PROXY_DEBUG |
| 12880 | 12907 | "PROXY_DEBUG", |
| 12908 | +#endif | |
| 12909 | +#ifdef SQLITE_RTREE_INT_ONLY | |
| 12910 | + "RTREE_INT_ONLY", | |
| 12881 | 12911 | #endif |
| 12882 | 12912 | #ifdef SQLITE_SECURE_DELETE |
| 12883 | 12913 | "SECURE_DELETE", |
| 12884 | 12914 | #endif |
| 12885 | 12915 | #ifdef SQLITE_SMALL_STACK |
| @@ -13234,10 +13264,15 @@ | ||
| 13234 | 13264 | int nIndent; /* Number of elements in aIndent */ |
| 13235 | 13265 | u16 aIndent[100]; /* Levels of indentation */ |
| 13236 | 13266 | char zBase[100]; /* Initial space */ |
| 13237 | 13267 | }; |
| 13238 | 13268 | |
| 13269 | +/* A bitfield type for use inside of structures. Always follow with :N where | |
| 13270 | +** N is the number of bits. | |
| 13271 | +*/ | |
| 13272 | +typedef unsigned bft; /* Bit Field Type */ | |
| 13273 | + | |
| 13239 | 13274 | /* |
| 13240 | 13275 | ** An instance of the virtual machine. This structure contains the complete |
| 13241 | 13276 | ** state of the virtual machine. |
| 13242 | 13277 | ** |
| 13243 | 13278 | ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() |
| @@ -13275,19 +13310,20 @@ | ||
| 13275 | 13310 | ynVar nzVar; /* Number of entries in azVar[] */ |
| 13276 | 13311 | u32 cacheCtr; /* VdbeCursor row cache generation counter */ |
| 13277 | 13312 | int pc; /* The program counter */ |
| 13278 | 13313 | int rc; /* Value to return */ |
| 13279 | 13314 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 13280 | - u8 explain; /* True if EXPLAIN present on SQL command */ | |
| 13281 | - u8 changeCntOn; /* True to update the change-counter */ | |
| 13282 | - u8 expired; /* True if the VM needs to be recompiled */ | |
| 13283 | - u8 runOnlyOnce; /* Automatically expire on reset */ | |
| 13284 | 13315 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| 13285 | - u8 inVtabMethod; /* See comments above */ | |
| 13286 | - u8 usesStmtJournal; /* True if uses a statement journal */ | |
| 13287 | - u8 readOnly; /* True for read-only statements */ | |
| 13288 | - u8 isPrepareV2; /* True if prepared with prepare_v2() */ | |
| 13316 | + bft explain:2; /* True if EXPLAIN present on SQL command */ | |
| 13317 | + bft inVtabMethod:2; /* See comments above */ | |
| 13318 | + bft changeCntOn:1; /* True to update the change-counter */ | |
| 13319 | + bft expired:1; /* True if the VM needs to be recompiled */ | |
| 13320 | + bft runOnlyOnce:1; /* Automatically expire on reset */ | |
| 13321 | + bft usesStmtJournal:1; /* True if uses a statement journal */ | |
| 13322 | + bft readOnly:1; /* True for read-only statements */ | |
| 13323 | + bft isPrepareV2:1; /* True if prepared with prepare_v2() */ | |
| 13324 | + bft doingRerun:1; /* True if rerunning after an auto-reprepare */ | |
| 13289 | 13325 | int nChange; /* Number of db changes made since last reset */ |
| 13290 | 13326 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 13291 | 13327 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 13292 | 13328 | int iStatement; /* Statement number (or 0 if has not opened stmt) */ |
| 13293 | 13329 | int aCounter[3]; /* Counters used by sqlite3_stmt_status() */ |
| @@ -20525,29 +20561,27 @@ | ||
| 20525 | 20561 | if( c<0x80 \ |
| 20526 | 20562 | || (c&0xFFFFF800)==0xD800 \ |
| 20527 | 20563 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ |
| 20528 | 20564 | } |
| 20529 | 20565 | SQLITE_PRIVATE u32 sqlite3Utf8Read( |
| 20530 | - const unsigned char *zIn, /* First byte of UTF-8 character */ | |
| 20531 | - const unsigned char **pzNext /* Write first byte past UTF-8 char here */ | |
| 20566 | + const unsigned char **pz /* Pointer to string from which to read char */ | |
| 20532 | 20567 | ){ |
| 20533 | 20568 | unsigned int c; |
| 20534 | 20569 | |
| 20535 | 20570 | /* Same as READ_UTF8() above but without the zTerm parameter. |
| 20536 | 20571 | ** For this routine, we assume the UTF8 string is always zero-terminated. |
| 20537 | 20572 | */ |
| 20538 | - c = *(zIn++); | |
| 20573 | + c = *((*pz)++); | |
| 20539 | 20574 | if( c>=0xc0 ){ |
| 20540 | 20575 | c = sqlite3Utf8Trans1[c-0xc0]; |
| 20541 | - while( (*zIn & 0xc0)==0x80 ){ | |
| 20542 | - c = (c<<6) + (0x3f & *(zIn++)); | |
| 20576 | + while( (*(*pz) & 0xc0)==0x80 ){ | |
| 20577 | + c = (c<<6) + (0x3f & *((*pz)++)); | |
| 20543 | 20578 | } |
| 20544 | 20579 | if( c<0x80 |
| 20545 | 20580 | || (c&0xFFFFF800)==0xD800 |
| 20546 | 20581 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } |
| 20547 | 20582 | } |
| 20548 | - *pzNext = zIn; | |
| 20549 | 20583 | return c; |
| 20550 | 20584 | } |
| 20551 | 20585 | |
| 20552 | 20586 | |
| 20553 | 20587 | |
| @@ -20644,19 +20678,17 @@ | ||
| 20644 | 20678 | |
| 20645 | 20679 | if( pMem->enc==SQLITE_UTF8 ){ |
| 20646 | 20680 | if( desiredEnc==SQLITE_UTF16LE ){ |
| 20647 | 20681 | /* UTF-8 -> UTF-16 Little-endian */ |
| 20648 | 20682 | while( zIn<zTerm ){ |
| 20649 | - /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */ | |
| 20650 | 20683 | READ_UTF8(zIn, zTerm, c); |
| 20651 | 20684 | WRITE_UTF16LE(z, c); |
| 20652 | 20685 | } |
| 20653 | 20686 | }else{ |
| 20654 | 20687 | assert( desiredEnc==SQLITE_UTF16BE ); |
| 20655 | 20688 | /* UTF-8 -> UTF-16 Big-endian */ |
| 20656 | 20689 | while( zIn<zTerm ){ |
| 20657 | - /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */ | |
| 20658 | 20690 | READ_UTF8(zIn, zTerm, c); |
| 20659 | 20691 | WRITE_UTF16BE(z, c); |
| 20660 | 20692 | } |
| 20661 | 20693 | } |
| 20662 | 20694 | pMem->n = (int)(z - zOut); |
| @@ -20780,11 +20812,11 @@ | ||
| 20780 | 20812 | unsigned char *zOut = zIn; |
| 20781 | 20813 | unsigned char *zStart = zIn; |
| 20782 | 20814 | u32 c; |
| 20783 | 20815 | |
| 20784 | 20816 | while( zIn[0] && zOut<=zIn ){ |
| 20785 | - c = sqlite3Utf8Read(zIn, (const u8**)&zIn); | |
| 20817 | + c = sqlite3Utf8Read((const u8**)&zIn); | |
| 20786 | 20818 | if( c!=0xfffd ){ |
| 20787 | 20819 | WRITE_UTF8(zOut, c); |
| 20788 | 20820 | } |
| 20789 | 20821 | } |
| 20790 | 20822 | *zOut = 0; |
| @@ -20885,11 +20917,11 @@ | ||
| 20885 | 20917 | WRITE_UTF8(z, i); |
| 20886 | 20918 | n = (int)(z-zBuf); |
| 20887 | 20919 | assert( n>0 && n<=4 ); |
| 20888 | 20920 | z[0] = 0; |
| 20889 | 20921 | z = zBuf; |
| 20890 | - c = sqlite3Utf8Read(z, (const u8**)&z); | |
| 20922 | + c = sqlite3Utf8Read((const u8**)&z); | |
| 20891 | 20923 | t = i; |
| 20892 | 20924 | if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD; |
| 20893 | 20925 | if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD; |
| 20894 | 20926 | assert( c==t ); |
| 20895 | 20927 | assert( (z-zBuf)==n ); |
| @@ -29887,10 +29919,19 @@ | ||
| 29887 | 29919 | #endif /* !defined(_OS_COMMON_H_) */ |
| 29888 | 29920 | |
| 29889 | 29921 | /************** End of os_common.h *******************************************/ |
| 29890 | 29922 | /************** Continuing where we left off in os_win.c *********************/ |
| 29891 | 29923 | |
| 29924 | +/* | |
| 29925 | +** Compiling and using WAL mode requires several APIs that are only | |
| 29926 | +** available in Windows platforms based on the NT kernel. | |
| 29927 | +*/ | |
| 29928 | +#if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL) | |
| 29929 | +# error "WAL mode requires support from the Windows NT kernel, compile\ | |
| 29930 | + with SQLITE_OMIT_WAL." | |
| 29931 | +#endif | |
| 29932 | + | |
| 29892 | 29933 | /* |
| 29893 | 29934 | ** Macro to find the minimum of two numeric values. |
| 29894 | 29935 | */ |
| 29895 | 29936 | #ifndef MIN |
| 29896 | 29937 | # define MIN(x,y) ((x)<(y)?(x):(y)) |
| @@ -30170,166 +30211,176 @@ | ||
| 30170 | 30211 | { "CreateFileW", (SYSCALL)0, 0 }, |
| 30171 | 30212 | #endif |
| 30172 | 30213 | |
| 30173 | 30214 | #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \ |
| 30174 | 30215 | LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent) |
| 30216 | + | |
| 30217 | +#if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \ | |
| 30218 | + !defined(SQLITE_OMIT_WAL)) | |
| 30219 | + { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 }, | |
| 30220 | +#else | |
| 30221 | + { "CreateFileMappingA", (SYSCALL)0, 0 }, | |
| 30222 | +#endif | |
| 30223 | + | |
| 30224 | +#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ | |
| 30225 | + DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent) | |
| 30175 | 30226 | |
| 30176 | 30227 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 30177 | 30228 | !defined(SQLITE_OMIT_WAL)) |
| 30178 | 30229 | { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 }, |
| 30179 | 30230 | #else |
| 30180 | 30231 | { "CreateFileMappingW", (SYSCALL)0, 0 }, |
| 30181 | 30232 | #endif |
| 30182 | 30233 | |
| 30183 | 30234 | #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 30184 | - DWORD,DWORD,DWORD,LPCWSTR))aSyscall[6].pCurrent) | |
| 30235 | + DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent) | |
| 30185 | 30236 | |
| 30186 | 30237 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30187 | 30238 | { "CreateMutexW", (SYSCALL)CreateMutexW, 0 }, |
| 30188 | 30239 | #else |
| 30189 | 30240 | { "CreateMutexW", (SYSCALL)0, 0 }, |
| 30190 | 30241 | #endif |
| 30191 | 30242 | |
| 30192 | 30243 | #define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \ |
| 30193 | - LPCWSTR))aSyscall[7].pCurrent) | |
| 30244 | + LPCWSTR))aSyscall[8].pCurrent) | |
| 30194 | 30245 | |
| 30195 | 30246 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30196 | 30247 | { "DeleteFileA", (SYSCALL)DeleteFileA, 0 }, |
| 30197 | 30248 | #else |
| 30198 | 30249 | { "DeleteFileA", (SYSCALL)0, 0 }, |
| 30199 | 30250 | #endif |
| 30200 | 30251 | |
| 30201 | -#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[8].pCurrent) | |
| 30252 | +#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent) | |
| 30202 | 30253 | |
| 30203 | 30254 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30204 | 30255 | { "DeleteFileW", (SYSCALL)DeleteFileW, 0 }, |
| 30205 | 30256 | #else |
| 30206 | 30257 | { "DeleteFileW", (SYSCALL)0, 0 }, |
| 30207 | 30258 | #endif |
| 30208 | 30259 | |
| 30209 | -#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[9].pCurrent) | |
| 30260 | +#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent) | |
| 30210 | 30261 | |
| 30211 | 30262 | #if SQLITE_OS_WINCE |
| 30212 | 30263 | { "FileTimeToLocalFileTime", (SYSCALL)FileTimeToLocalFileTime, 0 }, |
| 30213 | 30264 | #else |
| 30214 | 30265 | { "FileTimeToLocalFileTime", (SYSCALL)0, 0 }, |
| 30215 | 30266 | #endif |
| 30216 | 30267 | |
| 30217 | 30268 | #define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30218 | - LPFILETIME))aSyscall[10].pCurrent) | |
| 30269 | + LPFILETIME))aSyscall[11].pCurrent) | |
| 30219 | 30270 | |
| 30220 | 30271 | #if SQLITE_OS_WINCE |
| 30221 | 30272 | { "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 }, |
| 30222 | 30273 | #else |
| 30223 | 30274 | { "FileTimeToSystemTime", (SYSCALL)0, 0 }, |
| 30224 | 30275 | #endif |
| 30225 | 30276 | |
| 30226 | 30277 | #define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30227 | - LPSYSTEMTIME))aSyscall[11].pCurrent) | |
| 30278 | + LPSYSTEMTIME))aSyscall[12].pCurrent) | |
| 30228 | 30279 | |
| 30229 | 30280 | { "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 }, |
| 30230 | 30281 | |
| 30231 | -#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[12].pCurrent) | |
| 30282 | +#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent) | |
| 30232 | 30283 | |
| 30233 | 30284 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30234 | 30285 | { "FormatMessageA", (SYSCALL)FormatMessageA, 0 }, |
| 30235 | 30286 | #else |
| 30236 | 30287 | { "FormatMessageA", (SYSCALL)0, 0 }, |
| 30237 | 30288 | #endif |
| 30238 | 30289 | |
| 30239 | 30290 | #define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \ |
| 30240 | - DWORD,va_list*))aSyscall[13].pCurrent) | |
| 30291 | + DWORD,va_list*))aSyscall[14].pCurrent) | |
| 30241 | 30292 | |
| 30242 | 30293 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30243 | 30294 | { "FormatMessageW", (SYSCALL)FormatMessageW, 0 }, |
| 30244 | 30295 | #else |
| 30245 | 30296 | { "FormatMessageW", (SYSCALL)0, 0 }, |
| 30246 | 30297 | #endif |
| 30247 | 30298 | |
| 30248 | 30299 | #define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \ |
| 30249 | - DWORD,va_list*))aSyscall[14].pCurrent) | |
| 30300 | + DWORD,va_list*))aSyscall[15].pCurrent) | |
| 30250 | 30301 | |
| 30251 | 30302 | { "FreeLibrary", (SYSCALL)FreeLibrary, 0 }, |
| 30252 | 30303 | |
| 30253 | -#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[15].pCurrent) | |
| 30304 | +#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent) | |
| 30254 | 30305 | |
| 30255 | 30306 | { "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 }, |
| 30256 | 30307 | |
| 30257 | -#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[16].pCurrent) | |
| 30308 | +#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent) | |
| 30258 | 30309 | |
| 30259 | 30310 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30260 | 30311 | { "GetDiskFreeSpaceA", (SYSCALL)GetDiskFreeSpaceA, 0 }, |
| 30261 | 30312 | #else |
| 30262 | 30313 | { "GetDiskFreeSpaceA", (SYSCALL)0, 0 }, |
| 30263 | 30314 | #endif |
| 30264 | 30315 | |
| 30265 | 30316 | #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30266 | - LPDWORD))aSyscall[17].pCurrent) | |
| 30317 | + LPDWORD))aSyscall[18].pCurrent) | |
| 30267 | 30318 | |
| 30268 | 30319 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30269 | 30320 | { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 }, |
| 30270 | 30321 | #else |
| 30271 | 30322 | { "GetDiskFreeSpaceW", (SYSCALL)0, 0 }, |
| 30272 | 30323 | #endif |
| 30273 | 30324 | |
| 30274 | 30325 | #define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30275 | - LPDWORD))aSyscall[18].pCurrent) | |
| 30326 | + LPDWORD))aSyscall[19].pCurrent) | |
| 30276 | 30327 | |
| 30277 | 30328 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30278 | 30329 | { "GetFileAttributesA", (SYSCALL)GetFileAttributesA, 0 }, |
| 30279 | 30330 | #else |
| 30280 | 30331 | { "GetFileAttributesA", (SYSCALL)0, 0 }, |
| 30281 | 30332 | #endif |
| 30282 | 30333 | |
| 30283 | -#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[19].pCurrent) | |
| 30334 | +#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent) | |
| 30284 | 30335 | |
| 30285 | 30336 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30286 | 30337 | { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 }, |
| 30287 | 30338 | #else |
| 30288 | 30339 | { "GetFileAttributesW", (SYSCALL)0, 0 }, |
| 30289 | 30340 | #endif |
| 30290 | 30341 | |
| 30291 | -#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[20].pCurrent) | |
| 30342 | +#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent) | |
| 30292 | 30343 | |
| 30293 | 30344 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30294 | 30345 | { "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 }, |
| 30295 | 30346 | #else |
| 30296 | 30347 | { "GetFileAttributesExW", (SYSCALL)0, 0 }, |
| 30297 | 30348 | #endif |
| 30298 | 30349 | |
| 30299 | 30350 | #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \ |
| 30300 | - LPVOID))aSyscall[21].pCurrent) | |
| 30351 | + LPVOID))aSyscall[22].pCurrent) | |
| 30301 | 30352 | |
| 30302 | 30353 | #if !SQLITE_OS_WINRT |
| 30303 | 30354 | { "GetFileSize", (SYSCALL)GetFileSize, 0 }, |
| 30304 | 30355 | #else |
| 30305 | 30356 | { "GetFileSize", (SYSCALL)0, 0 }, |
| 30306 | 30357 | #endif |
| 30307 | 30358 | |
| 30308 | -#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[22].pCurrent) | |
| 30359 | +#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent) | |
| 30309 | 30360 | |
| 30310 | 30361 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30311 | 30362 | { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 }, |
| 30312 | 30363 | #else |
| 30313 | 30364 | { "GetFullPathNameA", (SYSCALL)0, 0 }, |
| 30314 | 30365 | #endif |
| 30315 | 30366 | |
| 30316 | 30367 | #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \ |
| 30317 | - LPSTR*))aSyscall[23].pCurrent) | |
| 30368 | + LPSTR*))aSyscall[24].pCurrent) | |
| 30318 | 30369 | |
| 30319 | 30370 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30320 | 30371 | { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 }, |
| 30321 | 30372 | #else |
| 30322 | 30373 | { "GetFullPathNameW", (SYSCALL)0, 0 }, |
| 30323 | 30374 | #endif |
| 30324 | 30375 | |
| 30325 | 30376 | #define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \ |
| 30326 | - LPWSTR*))aSyscall[24].pCurrent) | |
| 30377 | + LPWSTR*))aSyscall[25].pCurrent) | |
| 30327 | 30378 | |
| 30328 | 30379 | { "GetLastError", (SYSCALL)GetLastError, 0 }, |
| 30329 | 30380 | |
| 30330 | -#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[25].pCurrent) | |
| 30381 | +#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent) | |
| 30331 | 30382 | |
| 30332 | 30383 | #if SQLITE_OS_WINCE |
| 30333 | 30384 | /* The GetProcAddressA() routine is only available on Windows CE. */ |
| 30334 | 30385 | { "GetProcAddressA", (SYSCALL)GetProcAddressA, 0 }, |
| 30335 | 30386 | #else |
| @@ -30337,144 +30388,144 @@ | ||
| 30337 | 30388 | ** an ANSI string regardless of the _UNICODE setting */ |
| 30338 | 30389 | { "GetProcAddressA", (SYSCALL)GetProcAddress, 0 }, |
| 30339 | 30390 | #endif |
| 30340 | 30391 | |
| 30341 | 30392 | #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \ |
| 30342 | - LPCSTR))aSyscall[26].pCurrent) | |
| 30393 | + LPCSTR))aSyscall[27].pCurrent) | |
| 30343 | 30394 | |
| 30344 | 30395 | #if !SQLITE_OS_WINRT |
| 30345 | 30396 | { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 }, |
| 30346 | 30397 | #else |
| 30347 | 30398 | { "GetSystemInfo", (SYSCALL)0, 0 }, |
| 30348 | 30399 | #endif |
| 30349 | 30400 | |
| 30350 | -#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[27].pCurrent) | |
| 30401 | +#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent) | |
| 30351 | 30402 | |
| 30352 | 30403 | { "GetSystemTime", (SYSCALL)GetSystemTime, 0 }, |
| 30353 | 30404 | |
| 30354 | -#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[28].pCurrent) | |
| 30405 | +#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent) | |
| 30355 | 30406 | |
| 30356 | 30407 | #if !SQLITE_OS_WINCE |
| 30357 | 30408 | { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 }, |
| 30358 | 30409 | #else |
| 30359 | 30410 | { "GetSystemTimeAsFileTime", (SYSCALL)0, 0 }, |
| 30360 | 30411 | #endif |
| 30361 | 30412 | |
| 30362 | 30413 | #define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \ |
| 30363 | - LPFILETIME))aSyscall[29].pCurrent) | |
| 30414 | + LPFILETIME))aSyscall[30].pCurrent) | |
| 30364 | 30415 | |
| 30365 | 30416 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30366 | 30417 | { "GetTempPathA", (SYSCALL)GetTempPathA, 0 }, |
| 30367 | 30418 | #else |
| 30368 | 30419 | { "GetTempPathA", (SYSCALL)0, 0 }, |
| 30369 | 30420 | #endif |
| 30370 | 30421 | |
| 30371 | -#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[30].pCurrent) | |
| 30422 | +#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent) | |
| 30372 | 30423 | |
| 30373 | 30424 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30374 | 30425 | { "GetTempPathW", (SYSCALL)GetTempPathW, 0 }, |
| 30375 | 30426 | #else |
| 30376 | 30427 | { "GetTempPathW", (SYSCALL)0, 0 }, |
| 30377 | 30428 | #endif |
| 30378 | 30429 | |
| 30379 | -#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[31].pCurrent) | |
| 30430 | +#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent) | |
| 30380 | 30431 | |
| 30381 | 30432 | #if !SQLITE_OS_WINRT |
| 30382 | 30433 | { "GetTickCount", (SYSCALL)GetTickCount, 0 }, |
| 30383 | 30434 | #else |
| 30384 | 30435 | { "GetTickCount", (SYSCALL)0, 0 }, |
| 30385 | 30436 | #endif |
| 30386 | 30437 | |
| 30387 | -#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[32].pCurrent) | |
| 30438 | +#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent) | |
| 30388 | 30439 | |
| 30389 | 30440 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30390 | 30441 | { "GetVersionExA", (SYSCALL)GetVersionExA, 0 }, |
| 30391 | 30442 | #else |
| 30392 | 30443 | { "GetVersionExA", (SYSCALL)0, 0 }, |
| 30393 | 30444 | #endif |
| 30394 | 30445 | |
| 30395 | 30446 | #define osGetVersionExA ((BOOL(WINAPI*)( \ |
| 30396 | - LPOSVERSIONINFOA))aSyscall[33].pCurrent) | |
| 30447 | + LPOSVERSIONINFOA))aSyscall[34].pCurrent) | |
| 30397 | 30448 | |
| 30398 | 30449 | { "HeapAlloc", (SYSCALL)HeapAlloc, 0 }, |
| 30399 | 30450 | |
| 30400 | 30451 | #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \ |
| 30401 | - SIZE_T))aSyscall[34].pCurrent) | |
| 30452 | + SIZE_T))aSyscall[35].pCurrent) | |
| 30402 | 30453 | |
| 30403 | 30454 | #if !SQLITE_OS_WINRT |
| 30404 | 30455 | { "HeapCreate", (SYSCALL)HeapCreate, 0 }, |
| 30405 | 30456 | #else |
| 30406 | 30457 | { "HeapCreate", (SYSCALL)0, 0 }, |
| 30407 | 30458 | #endif |
| 30408 | 30459 | |
| 30409 | 30460 | #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \ |
| 30410 | - SIZE_T))aSyscall[35].pCurrent) | |
| 30461 | + SIZE_T))aSyscall[36].pCurrent) | |
| 30411 | 30462 | |
| 30412 | 30463 | #if !SQLITE_OS_WINRT |
| 30413 | 30464 | { "HeapDestroy", (SYSCALL)HeapDestroy, 0 }, |
| 30414 | 30465 | #else |
| 30415 | 30466 | { "HeapDestroy", (SYSCALL)0, 0 }, |
| 30416 | 30467 | #endif |
| 30417 | 30468 | |
| 30418 | -#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[36].pCurrent) | |
| 30469 | +#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[37].pCurrent) | |
| 30419 | 30470 | |
| 30420 | 30471 | { "HeapFree", (SYSCALL)HeapFree, 0 }, |
| 30421 | 30472 | |
| 30422 | -#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[37].pCurrent) | |
| 30473 | +#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[38].pCurrent) | |
| 30423 | 30474 | |
| 30424 | 30475 | { "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 }, |
| 30425 | 30476 | |
| 30426 | 30477 | #define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \ |
| 30427 | - SIZE_T))aSyscall[38].pCurrent) | |
| 30478 | + SIZE_T))aSyscall[39].pCurrent) | |
| 30428 | 30479 | |
| 30429 | 30480 | { "HeapSize", (SYSCALL)HeapSize, 0 }, |
| 30430 | 30481 | |
| 30431 | 30482 | #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \ |
| 30432 | - LPCVOID))aSyscall[39].pCurrent) | |
| 30483 | + LPCVOID))aSyscall[40].pCurrent) | |
| 30433 | 30484 | |
| 30434 | 30485 | #if !SQLITE_OS_WINRT |
| 30435 | 30486 | { "HeapValidate", (SYSCALL)HeapValidate, 0 }, |
| 30436 | 30487 | #else |
| 30437 | 30488 | { "HeapValidate", (SYSCALL)0, 0 }, |
| 30438 | 30489 | #endif |
| 30439 | 30490 | |
| 30440 | 30491 | #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \ |
| 30441 | - LPCVOID))aSyscall[40].pCurrent) | |
| 30492 | + LPCVOID))aSyscall[41].pCurrent) | |
| 30442 | 30493 | |
| 30443 | 30494 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30444 | 30495 | { "LoadLibraryA", (SYSCALL)LoadLibraryA, 0 }, |
| 30445 | 30496 | #else |
| 30446 | 30497 | { "LoadLibraryA", (SYSCALL)0, 0 }, |
| 30447 | 30498 | #endif |
| 30448 | 30499 | |
| 30449 | -#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[41].pCurrent) | |
| 30500 | +#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[42].pCurrent) | |
| 30450 | 30501 | |
| 30451 | 30502 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30452 | 30503 | { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 }, |
| 30453 | 30504 | #else |
| 30454 | 30505 | { "LoadLibraryW", (SYSCALL)0, 0 }, |
| 30455 | 30506 | #endif |
| 30456 | 30507 | |
| 30457 | -#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[42].pCurrent) | |
| 30508 | +#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[43].pCurrent) | |
| 30458 | 30509 | |
| 30459 | 30510 | #if !SQLITE_OS_WINRT |
| 30460 | 30511 | { "LocalFree", (SYSCALL)LocalFree, 0 }, |
| 30461 | 30512 | #else |
| 30462 | 30513 | { "LocalFree", (SYSCALL)0, 0 }, |
| 30463 | 30514 | #endif |
| 30464 | 30515 | |
| 30465 | -#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[43].pCurrent) | |
| 30516 | +#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[44].pCurrent) | |
| 30466 | 30517 | |
| 30467 | 30518 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30468 | 30519 | { "LockFile", (SYSCALL)LockFile, 0 }, |
| 30469 | 30520 | #else |
| 30470 | 30521 | { "LockFile", (SYSCALL)0, 0 }, |
| 30471 | 30522 | #endif |
| 30472 | 30523 | |
| 30473 | 30524 | #ifndef osLockFile |
| 30474 | 30525 | #define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30475 | - DWORD))aSyscall[44].pCurrent) | |
| 30526 | + DWORD))aSyscall[45].pCurrent) | |
| 30476 | 30527 | #endif |
| 30477 | 30528 | |
| 30478 | 30529 | #if !SQLITE_OS_WINCE |
| 30479 | 30530 | { "LockFileEx", (SYSCALL)LockFileEx, 0 }, |
| 30480 | 30531 | #else |
| @@ -30481,218 +30532,218 @@ | ||
| 30481 | 30532 | { "LockFileEx", (SYSCALL)0, 0 }, |
| 30482 | 30533 | #endif |
| 30483 | 30534 | |
| 30484 | 30535 | #ifndef osLockFileEx |
| 30485 | 30536 | #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \ |
| 30486 | - LPOVERLAPPED))aSyscall[45].pCurrent) | |
| 30537 | + LPOVERLAPPED))aSyscall[46].pCurrent) | |
| 30487 | 30538 | #endif |
| 30488 | 30539 | |
| 30489 | 30540 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)) |
| 30490 | 30541 | { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 }, |
| 30491 | 30542 | #else |
| 30492 | 30543 | { "MapViewOfFile", (SYSCALL)0, 0 }, |
| 30493 | 30544 | #endif |
| 30494 | 30545 | |
| 30495 | 30546 | #define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30496 | - SIZE_T))aSyscall[46].pCurrent) | |
| 30547 | + SIZE_T))aSyscall[47].pCurrent) | |
| 30497 | 30548 | |
| 30498 | 30549 | { "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 }, |
| 30499 | 30550 | |
| 30500 | 30551 | #define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \ |
| 30501 | - int))aSyscall[47].pCurrent) | |
| 30552 | + int))aSyscall[48].pCurrent) | |
| 30502 | 30553 | |
| 30503 | 30554 | { "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 }, |
| 30504 | 30555 | |
| 30505 | 30556 | #define osQueryPerformanceCounter ((BOOL(WINAPI*)( \ |
| 30506 | - LARGE_INTEGER*))aSyscall[48].pCurrent) | |
| 30557 | + LARGE_INTEGER*))aSyscall[49].pCurrent) | |
| 30507 | 30558 | |
| 30508 | 30559 | { "ReadFile", (SYSCALL)ReadFile, 0 }, |
| 30509 | 30560 | |
| 30510 | 30561 | #define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \ |
| 30511 | - LPOVERLAPPED))aSyscall[49].pCurrent) | |
| 30562 | + LPOVERLAPPED))aSyscall[50].pCurrent) | |
| 30512 | 30563 | |
| 30513 | 30564 | { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 }, |
| 30514 | 30565 | |
| 30515 | -#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[50].pCurrent) | |
| 30566 | +#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[51].pCurrent) | |
| 30516 | 30567 | |
| 30517 | 30568 | #if !SQLITE_OS_WINRT |
| 30518 | 30569 | { "SetFilePointer", (SYSCALL)SetFilePointer, 0 }, |
| 30519 | 30570 | #else |
| 30520 | 30571 | { "SetFilePointer", (SYSCALL)0, 0 }, |
| 30521 | 30572 | #endif |
| 30522 | 30573 | |
| 30523 | 30574 | #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \ |
| 30524 | - DWORD))aSyscall[51].pCurrent) | |
| 30575 | + DWORD))aSyscall[52].pCurrent) | |
| 30525 | 30576 | |
| 30526 | 30577 | #if !SQLITE_OS_WINRT |
| 30527 | 30578 | { "Sleep", (SYSCALL)Sleep, 0 }, |
| 30528 | 30579 | #else |
| 30529 | 30580 | { "Sleep", (SYSCALL)0, 0 }, |
| 30530 | 30581 | #endif |
| 30531 | 30582 | |
| 30532 | -#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[52].pCurrent) | |
| 30583 | +#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[53].pCurrent) | |
| 30533 | 30584 | |
| 30534 | 30585 | { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 }, |
| 30535 | 30586 | |
| 30536 | 30587 | #define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \ |
| 30537 | - LPFILETIME))aSyscall[53].pCurrent) | |
| 30588 | + LPFILETIME))aSyscall[54].pCurrent) | |
| 30538 | 30589 | |
| 30539 | 30590 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30540 | 30591 | { "UnlockFile", (SYSCALL)UnlockFile, 0 }, |
| 30541 | 30592 | #else |
| 30542 | 30593 | { "UnlockFile", (SYSCALL)0, 0 }, |
| 30543 | 30594 | #endif |
| 30544 | 30595 | |
| 30545 | 30596 | #ifndef osUnlockFile |
| 30546 | 30597 | #define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30547 | - DWORD))aSyscall[54].pCurrent) | |
| 30598 | + DWORD))aSyscall[55].pCurrent) | |
| 30548 | 30599 | #endif |
| 30549 | 30600 | |
| 30550 | 30601 | #if !SQLITE_OS_WINCE |
| 30551 | 30602 | { "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 }, |
| 30552 | 30603 | #else |
| 30553 | 30604 | { "UnlockFileEx", (SYSCALL)0, 0 }, |
| 30554 | 30605 | #endif |
| 30555 | 30606 | |
| 30556 | 30607 | #define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30557 | - LPOVERLAPPED))aSyscall[55].pCurrent) | |
| 30608 | + LPOVERLAPPED))aSyscall[56].pCurrent) | |
| 30558 | 30609 | |
| 30559 | 30610 | #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) |
| 30560 | 30611 | { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 }, |
| 30561 | 30612 | #else |
| 30562 | 30613 | { "UnmapViewOfFile", (SYSCALL)0, 0 }, |
| 30563 | 30614 | #endif |
| 30564 | 30615 | |
| 30565 | -#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[56].pCurrent) | |
| 30616 | +#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[57].pCurrent) | |
| 30566 | 30617 | |
| 30567 | 30618 | { "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 }, |
| 30568 | 30619 | |
| 30569 | 30620 | #define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \ |
| 30570 | - LPCSTR,LPBOOL))aSyscall[57].pCurrent) | |
| 30621 | + LPCSTR,LPBOOL))aSyscall[58].pCurrent) | |
| 30571 | 30622 | |
| 30572 | 30623 | { "WriteFile", (SYSCALL)WriteFile, 0 }, |
| 30573 | 30624 | |
| 30574 | 30625 | #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \ |
| 30575 | - LPOVERLAPPED))aSyscall[58].pCurrent) | |
| 30626 | + LPOVERLAPPED))aSyscall[59].pCurrent) | |
| 30576 | 30627 | |
| 30577 | 30628 | #if SQLITE_OS_WINRT |
| 30578 | 30629 | { "CreateEventExW", (SYSCALL)CreateEventExW, 0 }, |
| 30579 | 30630 | #else |
| 30580 | 30631 | { "CreateEventExW", (SYSCALL)0, 0 }, |
| 30581 | 30632 | #endif |
| 30582 | 30633 | |
| 30583 | 30634 | #define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \ |
| 30584 | - DWORD,DWORD))aSyscall[59].pCurrent) | |
| 30635 | + DWORD,DWORD))aSyscall[60].pCurrent) | |
| 30585 | 30636 | |
| 30586 | 30637 | #if !SQLITE_OS_WINRT |
| 30587 | 30638 | { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 }, |
| 30588 | 30639 | #else |
| 30589 | 30640 | { "WaitForSingleObject", (SYSCALL)0, 0 }, |
| 30590 | 30641 | #endif |
| 30591 | 30642 | |
| 30592 | 30643 | #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \ |
| 30593 | - DWORD))aSyscall[60].pCurrent) | |
| 30644 | + DWORD))aSyscall[61].pCurrent) | |
| 30594 | 30645 | |
| 30595 | 30646 | #if SQLITE_OS_WINRT |
| 30596 | 30647 | { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 }, |
| 30597 | 30648 | #else |
| 30598 | 30649 | { "WaitForSingleObjectEx", (SYSCALL)0, 0 }, |
| 30599 | 30650 | #endif |
| 30600 | 30651 | |
| 30601 | 30652 | #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ |
| 30602 | - BOOL))aSyscall[61].pCurrent) | |
| 30653 | + BOOL))aSyscall[62].pCurrent) | |
| 30603 | 30654 | |
| 30604 | 30655 | #if SQLITE_OS_WINRT |
| 30605 | 30656 | { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, |
| 30606 | 30657 | #else |
| 30607 | 30658 | { "SetFilePointerEx", (SYSCALL)0, 0 }, |
| 30608 | 30659 | #endif |
| 30609 | 30660 | |
| 30610 | 30661 | #define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \ |
| 30611 | - PLARGE_INTEGER,DWORD))aSyscall[62].pCurrent) | |
| 30662 | + PLARGE_INTEGER,DWORD))aSyscall[63].pCurrent) | |
| 30612 | 30663 | |
| 30613 | 30664 | #if SQLITE_OS_WINRT |
| 30614 | 30665 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, |
| 30615 | 30666 | #else |
| 30616 | 30667 | { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, |
| 30617 | 30668 | #endif |
| 30618 | 30669 | |
| 30619 | 30670 | #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ |
| 30620 | - FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[63].pCurrent) | |
| 30671 | + FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[64].pCurrent) | |
| 30621 | 30672 | |
| 30622 | 30673 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30623 | 30674 | { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 }, |
| 30624 | 30675 | #else |
| 30625 | 30676 | { "MapViewOfFileFromApp", (SYSCALL)0, 0 }, |
| 30626 | 30677 | #endif |
| 30627 | 30678 | |
| 30628 | 30679 | #define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \ |
| 30629 | - SIZE_T))aSyscall[64].pCurrent) | |
| 30680 | + SIZE_T))aSyscall[65].pCurrent) | |
| 30630 | 30681 | |
| 30631 | 30682 | #if SQLITE_OS_WINRT |
| 30632 | 30683 | { "CreateFile2", (SYSCALL)CreateFile2, 0 }, |
| 30633 | 30684 | #else |
| 30634 | 30685 | { "CreateFile2", (SYSCALL)0, 0 }, |
| 30635 | 30686 | #endif |
| 30636 | 30687 | |
| 30637 | 30688 | #define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \ |
| 30638 | - LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[65].pCurrent) | |
| 30689 | + LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[66].pCurrent) | |
| 30639 | 30690 | |
| 30640 | 30691 | #if SQLITE_OS_WINRT |
| 30641 | 30692 | { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 }, |
| 30642 | 30693 | #else |
| 30643 | 30694 | { "LoadPackagedLibrary", (SYSCALL)0, 0 }, |
| 30644 | 30695 | #endif |
| 30645 | 30696 | |
| 30646 | 30697 | #define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \ |
| 30647 | - DWORD))aSyscall[66].pCurrent) | |
| 30698 | + DWORD))aSyscall[67].pCurrent) | |
| 30648 | 30699 | |
| 30649 | 30700 | #if SQLITE_OS_WINRT |
| 30650 | 30701 | { "GetTickCount64", (SYSCALL)GetTickCount64, 0 }, |
| 30651 | 30702 | #else |
| 30652 | 30703 | { "GetTickCount64", (SYSCALL)0, 0 }, |
| 30653 | 30704 | #endif |
| 30654 | 30705 | |
| 30655 | -#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[67].pCurrent) | |
| 30706 | +#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[68].pCurrent) | |
| 30656 | 30707 | |
| 30657 | 30708 | #if SQLITE_OS_WINRT |
| 30658 | 30709 | { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 }, |
| 30659 | 30710 | #else |
| 30660 | 30711 | { "GetNativeSystemInfo", (SYSCALL)0, 0 }, |
| 30661 | 30712 | #endif |
| 30662 | 30713 | |
| 30663 | 30714 | #define osGetNativeSystemInfo ((VOID(WINAPI*)( \ |
| 30664 | - LPSYSTEM_INFO))aSyscall[68].pCurrent) | |
| 30715 | + LPSYSTEM_INFO))aSyscall[69].pCurrent) | |
| 30665 | 30716 | |
| 30666 | 30717 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30667 | 30718 | { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 }, |
| 30668 | 30719 | #else |
| 30669 | 30720 | { "OutputDebugStringA", (SYSCALL)0, 0 }, |
| 30670 | 30721 | #endif |
| 30671 | 30722 | |
| 30672 | -#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[69].pCurrent) | |
| 30723 | +#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[70].pCurrent) | |
| 30673 | 30724 | |
| 30674 | 30725 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30675 | 30726 | { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 }, |
| 30676 | 30727 | #else |
| 30677 | 30728 | { "OutputDebugStringW", (SYSCALL)0, 0 }, |
| 30678 | 30729 | #endif |
| 30679 | 30730 | |
| 30680 | -#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[70].pCurrent) | |
| 30731 | +#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[71].pCurrent) | |
| 30681 | 30732 | |
| 30682 | 30733 | { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 }, |
| 30683 | 30734 | |
| 30684 | -#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[71].pCurrent) | |
| 30735 | +#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[72].pCurrent) | |
| 30685 | 30736 | |
| 30686 | 30737 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30687 | 30738 | { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 }, |
| 30688 | 30739 | #else |
| 30689 | 30740 | { "CreateFileMappingFromApp", (SYSCALL)0, 0 }, |
| 30690 | 30741 | #endif |
| 30691 | 30742 | |
| 30692 | 30743 | #define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \ |
| 30693 | - LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[72].pCurrent) | |
| 30744 | + LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[73].pCurrent) | |
| 30694 | 30745 | |
| 30695 | 30746 | }; /* End of the overrideable system calls */ |
| 30696 | 30747 | |
| 30697 | 30748 | /* |
| 30698 | 30749 | ** This is the xSetSystemCall() method of sqlite3_vfs for all of the |
| @@ -30846,10 +30897,12 @@ | ||
| 30846 | 30897 | ** WinNT/2K/XP so that we will know whether or not we can safely call |
| 30847 | 30898 | ** the LockFileEx() API. |
| 30848 | 30899 | */ |
| 30849 | 30900 | #if SQLITE_OS_WINCE || SQLITE_OS_WINRT |
| 30850 | 30901 | # define isNT() (1) |
| 30902 | +#elif !defined(SQLITE_WIN32_HAS_WIDE) | |
| 30903 | +# define isNT() (0) | |
| 30851 | 30904 | #else |
| 30852 | 30905 | static int isNT(void){ |
| 30853 | 30906 | if( sqlite3_os_type==0 ){ |
| 30854 | 30907 | OSVERSIONINFOA sInfo; |
| 30855 | 30908 | sInfo.dwOSVersionInfoSize = sizeof(sInfo); |
| @@ -30856,11 +30909,11 @@ | ||
| 30856 | 30909 | osGetVersionExA(&sInfo); |
| 30857 | 30910 | sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; |
| 30858 | 30911 | } |
| 30859 | 30912 | return sqlite3_os_type==2; |
| 30860 | 30913 | } |
| 30861 | -#endif /* SQLITE_OS_WINCE */ | |
| 30914 | +#endif | |
| 30862 | 30915 | |
| 30863 | 30916 | #ifdef SQLITE_WIN32_MALLOC |
| 30864 | 30917 | /* |
| 30865 | 30918 | ** Allocate nBytes of memory. |
| 30866 | 30919 | */ |
| @@ -31066,11 +31119,11 @@ | ||
| 31066 | 31119 | |
| 31067 | 31120 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0); |
| 31068 | 31121 | if( nChar==0 ){ |
| 31069 | 31122 | return 0; |
| 31070 | 31123 | } |
| 31071 | - zWideFilename = sqlite3_malloc( nChar*sizeof(zWideFilename[0]) ); | |
| 31124 | + zWideFilename = sqlite3MallocZero( nChar*sizeof(zWideFilename[0]) ); | |
| 31072 | 31125 | if( zWideFilename==0 ){ |
| 31073 | 31126 | return 0; |
| 31074 | 31127 | } |
| 31075 | 31128 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, |
| 31076 | 31129 | nChar); |
| @@ -31091,11 +31144,11 @@ | ||
| 31091 | 31144 | |
| 31092 | 31145 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31093 | 31146 | if( nByte == 0 ){ |
| 31094 | 31147 | return 0; |
| 31095 | 31148 | } |
| 31096 | - zFilename = sqlite3_malloc( nByte ); | |
| 31149 | + zFilename = sqlite3MallocZero( nByte ); | |
| 31097 | 31150 | if( zFilename==0 ){ |
| 31098 | 31151 | return 0; |
| 31099 | 31152 | } |
| 31100 | 31153 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte, |
| 31101 | 31154 | 0, 0); |
| @@ -31121,11 +31174,11 @@ | ||
| 31121 | 31174 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, NULL, |
| 31122 | 31175 | 0)*sizeof(WCHAR); |
| 31123 | 31176 | if( nByte==0 ){ |
| 31124 | 31177 | return 0; |
| 31125 | 31178 | } |
| 31126 | - zMbcsFilename = sqlite3_malloc( nByte*sizeof(zMbcsFilename[0]) ); | |
| 31179 | + zMbcsFilename = sqlite3MallocZero( nByte*sizeof(zMbcsFilename[0]) ); | |
| 31127 | 31180 | if( zMbcsFilename==0 ){ |
| 31128 | 31181 | return 0; |
| 31129 | 31182 | } |
| 31130 | 31183 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, |
| 31131 | 31184 | nByte); |
| @@ -31150,11 +31203,11 @@ | ||
| 31150 | 31203 | |
| 31151 | 31204 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31152 | 31205 | if( nByte == 0 ){ |
| 31153 | 31206 | return 0; |
| 31154 | 31207 | } |
| 31155 | - zFilename = sqlite3_malloc( nByte ); | |
| 31208 | + zFilename = sqlite3MallocZero( nByte ); | |
| 31156 | 31209 | if( zFilename==0 ){ |
| 31157 | 31210 | return 0; |
| 31158 | 31211 | } |
| 31159 | 31212 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, |
| 31160 | 31213 | nByte, 0, 0); |
| @@ -32797,20 +32850,18 @@ | ||
| 32797 | 32850 | assert( pDbFd->pShm==0 ); /* Not previously opened */ |
| 32798 | 32851 | |
| 32799 | 32852 | /* Allocate space for the new sqlite3_shm object. Also speculatively |
| 32800 | 32853 | ** allocate space for a new winShmNode and filename. |
| 32801 | 32854 | */ |
| 32802 | - p = sqlite3_malloc( sizeof(*p) ); | |
| 32855 | + p = sqlite3MallocZero( sizeof(*p) ); | |
| 32803 | 32856 | if( p==0 ) return SQLITE_IOERR_NOMEM; |
| 32804 | - memset(p, 0, sizeof(*p)); | |
| 32805 | 32857 | nName = sqlite3Strlen30(pDbFd->zPath); |
| 32806 | - pNew = sqlite3_malloc( sizeof(*pShmNode) + nName + 17 ); | |
| 32858 | + pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); | |
| 32807 | 32859 | if( pNew==0 ){ |
| 32808 | 32860 | sqlite3_free(p); |
| 32809 | 32861 | return SQLITE_IOERR_NOMEM; |
| 32810 | 32862 | } |
| 32811 | - memset(pNew, 0, sizeof(*pNew) + nName + 17); | |
| 32812 | 32863 | pNew->zFilename = (char*)&pNew[1]; |
| 32813 | 32864 | sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); |
| 32814 | 32865 | sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); |
| 32815 | 32866 | |
| 32816 | 32867 | /* Look to see if there is an existing winShmNode that can be used. |
| @@ -33143,21 +33194,25 @@ | ||
| 33143 | 33194 | goto shmpage_out; |
| 33144 | 33195 | } |
| 33145 | 33196 | pShmNode->aRegion = apNew; |
| 33146 | 33197 | |
| 33147 | 33198 | while( pShmNode->nRegion<=iRegion ){ |
| 33148 | - HANDLE hMap; /* file-mapping handle */ | |
| 33199 | + HANDLE hMap = NULL; /* file-mapping handle */ | |
| 33149 | 33200 | void *pMap = 0; /* Mapped memory region */ |
| 33150 | 33201 | |
| 33151 | 33202 | #if SQLITE_OS_WINRT |
| 33152 | 33203 | hMap = osCreateFileMappingFromApp(pShmNode->hFile.h, |
| 33153 | 33204 | NULL, PAGE_READWRITE, nByte, NULL |
| 33154 | 33205 | ); |
| 33155 | -#else | |
| 33206 | +#elif defined(SQLITE_WIN32_HAS_WIDE) | |
| 33156 | 33207 | hMap = osCreateFileMappingW(pShmNode->hFile.h, |
| 33157 | 33208 | NULL, PAGE_READWRITE, 0, nByte, NULL |
| 33158 | 33209 | ); |
| 33210 | +#elif defined(SQLITE_WIN32_HAS_ANSI) | |
| 33211 | + hMap = osCreateFileMappingA(pShmNode->hFile.h, | |
| 33212 | + NULL, PAGE_READWRITE, 0, nByte, NULL | |
| 33213 | + ); | |
| 33159 | 33214 | #endif |
| 33160 | 33215 | OSTRACE(("SHM-MAP pid-%d create region=%d nbyte=%d %s\n", |
| 33161 | 33216 | (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte, |
| 33162 | 33217 | hMap ? "ok" : "failed")); |
| 33163 | 33218 | if( hMap ){ |
| @@ -33902,11 +33957,11 @@ | ||
| 33902 | 33957 | } |
| 33903 | 33958 | return SQLITE_OK; |
| 33904 | 33959 | #endif |
| 33905 | 33960 | |
| 33906 | 33961 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 33907 | - int nByte; | |
| 33962 | + DWORD nByte; | |
| 33908 | 33963 | void *zConverted; |
| 33909 | 33964 | char *zOut; |
| 33910 | 33965 | |
| 33911 | 33966 | /* If this path name begins with "/X:", where "X" is any alphabetic |
| 33912 | 33967 | ** character, discard the initial "/" from the pathname. |
| @@ -33936,31 +33991,59 @@ | ||
| 33936 | 33991 | if( zConverted==0 ){ |
| 33937 | 33992 | return SQLITE_IOERR_NOMEM; |
| 33938 | 33993 | } |
| 33939 | 33994 | if( isNT() ){ |
| 33940 | 33995 | LPWSTR zTemp; |
| 33941 | - nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0) + 3; | |
| 33942 | - zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) ); | |
| 33996 | + nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0); | |
| 33997 | + if( nByte==0 ){ | |
| 33998 | + winLogError(SQLITE_ERROR, osGetLastError(), | |
| 33999 | + "GetFullPathNameW1", zConverted); | |
| 34000 | + sqlite3_free(zConverted); | |
| 34001 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 34002 | + } | |
| 34003 | + nByte += 3; | |
| 34004 | + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); | |
| 33943 | 34005 | if( zTemp==0 ){ |
| 33944 | 34006 | sqlite3_free(zConverted); |
| 33945 | 34007 | return SQLITE_IOERR_NOMEM; |
| 33946 | 34008 | } |
| 33947 | - osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); | |
| 34009 | + nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); | |
| 34010 | + if( nByte==0 ){ | |
| 34011 | + winLogError(SQLITE_ERROR, osGetLastError(), | |
| 34012 | + "GetFullPathNameW2", zConverted); | |
| 34013 | + sqlite3_free(zConverted); | |
| 34014 | + sqlite3_free(zTemp); | |
| 34015 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 34016 | + } | |
| 33948 | 34017 | sqlite3_free(zConverted); |
| 33949 | 34018 | zOut = unicodeToUtf8(zTemp); |
| 33950 | 34019 | sqlite3_free(zTemp); |
| 33951 | 34020 | } |
| 33952 | 34021 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 33953 | 34022 | else{ |
| 33954 | 34023 | char *zTemp; |
| 33955 | - nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0) + 3; | |
| 33956 | - zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) ); | |
| 34024 | + nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0); | |
| 34025 | + if( nByte==0 ){ | |
| 34026 | + winLogError(SQLITE_ERROR, osGetLastError(), | |
| 34027 | + "GetFullPathNameA1", zConverted); | |
| 34028 | + sqlite3_free(zConverted); | |
| 34029 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 34030 | + } | |
| 34031 | + nByte += 3; | |
| 34032 | + zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); | |
| 33957 | 34033 | if( zTemp==0 ){ |
| 33958 | 34034 | sqlite3_free(zConverted); |
| 33959 | 34035 | return SQLITE_IOERR_NOMEM; |
| 33960 | 34036 | } |
| 33961 | - osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); | |
| 34037 | + nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); | |
| 34038 | + if( nByte==0 ){ | |
| 34039 | + winLogError(SQLITE_ERROR, osGetLastError(), | |
| 34040 | + "GetFullPathNameA2", zConverted); | |
| 34041 | + sqlite3_free(zConverted); | |
| 34042 | + sqlite3_free(zTemp); | |
| 34043 | + return SQLITE_CANTOPEN_FULLPATH; | |
| 34044 | + } | |
| 33962 | 34045 | sqlite3_free(zConverted); |
| 33963 | 34046 | zOut = sqlite3_win32_mbcs_to_utf8(zTemp); |
| 33964 | 34047 | sqlite3_free(zTemp); |
| 33965 | 34048 | } |
| 33966 | 34049 | #endif |
| @@ -34214,11 +34297,11 @@ | ||
| 34214 | 34297 | winNextSystemCall, /* xNextSystemCall */ |
| 34215 | 34298 | }; |
| 34216 | 34299 | |
| 34217 | 34300 | /* Double-check that the aSyscall[] array has been constructed |
| 34218 | 34301 | ** correctly. See ticket [bb3a86e890c8e96ab] */ |
| 34219 | - assert( ArraySize(aSyscall)==73 ); | |
| 34302 | + assert( ArraySize(aSyscall)==74 ); | |
| 34220 | 34303 | |
| 34221 | 34304 | #ifndef SQLITE_OMIT_WAL |
| 34222 | 34305 | /* get memory map allocation granularity */ |
| 34223 | 34306 | memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); |
| 34224 | 34307 | #if SQLITE_OS_WINRT |
| @@ -34233,11 +34316,11 @@ | ||
| 34233 | 34316 | return SQLITE_OK; |
| 34234 | 34317 | } |
| 34235 | 34318 | |
| 34236 | 34319 | SQLITE_API int sqlite3_os_end(void){ |
| 34237 | 34320 | #if SQLITE_OS_WINRT |
| 34238 | - if( sleepObj != NULL ){ | |
| 34321 | + if( sleepObj!=NULL ){ | |
| 34239 | 34322 | osCloseHandle(sleepObj); |
| 34240 | 34323 | sleepObj = NULL; |
| 34241 | 34324 | } |
| 34242 | 34325 | #endif |
| 34243 | 34326 | return SQLITE_OK; |
| @@ -41395,11 +41478,11 @@ | ||
| 41395 | 41478 | assert( nPathname>0 ); |
| 41396 | 41479 | pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUri); |
| 41397 | 41480 | memcpy(pPager->zFilename, zPathname, nPathname); |
| 41398 | 41481 | if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri); |
| 41399 | 41482 | memcpy(pPager->zJournal, zPathname, nPathname); |
| 41400 | - memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+1); | |
| 41483 | + memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+2); | |
| 41401 | 41484 | sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal); |
| 41402 | 41485 | #ifndef SQLITE_OMIT_WAL |
| 41403 | 41486 | pPager->zWal = &pPager->zJournal[nPathname+8+1]; |
| 41404 | 41487 | memcpy(pPager->zWal, zPathname, nPathname); |
| 41405 | 41488 | memcpy(&pPager->zWal[nPathname], "-wal\000", 4+1); |
| @@ -58860,14 +58943,13 @@ | ||
| 58860 | 58943 | pOp->p4.pKeyInfo = pKeyInfo; |
| 58861 | 58944 | if( pKeyInfo ){ |
| 58862 | 58945 | u8 *aSortOrder; |
| 58863 | 58946 | memcpy((char*)pKeyInfo, zP4, nByte - nField); |
| 58864 | 58947 | aSortOrder = pKeyInfo->aSortOrder; |
| 58865 | - if( aSortOrder ){ | |
| 58866 | - pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField]; | |
| 58867 | - memcpy(pKeyInfo->aSortOrder, aSortOrder, nField); | |
| 58868 | - } | |
| 58948 | + assert( aSortOrder!=0 ); | |
| 58949 | + pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField]; | |
| 58950 | + memcpy(pKeyInfo->aSortOrder, aSortOrder, nField); | |
| 58869 | 58951 | pOp->p4type = P4_KEYINFO; |
| 58870 | 58952 | }else{ |
| 58871 | 58953 | p->db->mallocFailed = 1; |
| 58872 | 58954 | pOp->p4type = P4_NOTUSED; |
| 58873 | 58955 | } |
| @@ -58976,10 +59058,11 @@ | ||
| 58976 | 59058 | switch( pOp->p4type ){ |
| 58977 | 59059 | case P4_KEYINFO_STATIC: |
| 58978 | 59060 | case P4_KEYINFO: { |
| 58979 | 59061 | int i, j; |
| 58980 | 59062 | KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; |
| 59063 | + assert( pKeyInfo->aSortOrder!=0 ); | |
| 58981 | 59064 | sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField); |
| 58982 | 59065 | i = sqlite3Strlen30(zTemp); |
| 58983 | 59066 | for(j=0; j<pKeyInfo->nField; j++){ |
| 58984 | 59067 | CollSeq *pColl = pKeyInfo->aColl[j]; |
| 58985 | 59068 | if( pColl ){ |
| @@ -58987,11 +59070,11 @@ | ||
| 58987 | 59070 | if( i+n>nTemp-6 ){ |
| 58988 | 59071 | memcpy(&zTemp[i],",...",4); |
| 58989 | 59072 | break; |
| 58990 | 59073 | } |
| 58991 | 59074 | zTemp[i++] = ','; |
| 58992 | - if( pKeyInfo->aSortOrder && pKeyInfo->aSortOrder[j] ){ | |
| 59075 | + if( pKeyInfo->aSortOrder[j] ){ | |
| 58993 | 59076 | zTemp[i++] = '-'; |
| 58994 | 59077 | } |
| 58995 | 59078 | memcpy(&zTemp[i], pColl->zName,n+1); |
| 58996 | 59079 | i += n; |
| 58997 | 59080 | }else if( i+4<nTemp-6 ){ |
| @@ -60698,21 +60781,20 @@ | ||
| 60698 | 60781 | if( flags&MEM_Int ){ |
| 60699 | 60782 | /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */ |
| 60700 | 60783 | # define MAX_6BYTE ((((i64)0x00008000)<<32)-1) |
| 60701 | 60784 | i64 i = pMem->u.i; |
| 60702 | 60785 | u64 u; |
| 60703 | - if( file_format>=4 && (i&1)==i ){ | |
| 60704 | - return 8+(u32)i; | |
| 60705 | - } | |
| 60706 | 60786 | if( i<0 ){ |
| 60707 | 60787 | if( i<(-MAX_6BYTE) ) return 6; |
| 60708 | 60788 | /* Previous test prevents: u = -(-9223372036854775808) */ |
| 60709 | 60789 | u = -i; |
| 60710 | 60790 | }else{ |
| 60711 | 60791 | u = i; |
| 60712 | 60792 | } |
| 60713 | - if( u<=127 ) return 1; | |
| 60793 | + if( u<=127 ){ | |
| 60794 | + return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1; | |
| 60795 | + } | |
| 60714 | 60796 | if( u<=32767 ) return 2; |
| 60715 | 60797 | if( u<=8388607 ) return 3; |
| 60716 | 60798 | if( u<=2147483647 ) return 4; |
| 60717 | 60799 | if( u<=MAX_6BYTE ) return 5; |
| 60718 | 60800 | return 6; |
| @@ -60993,10 +61075,11 @@ | ||
| 60993 | 61075 | p = (UnpackedRecord*)&pSpace[nOff]; |
| 60994 | 61076 | *ppFree = 0; |
| 60995 | 61077 | } |
| 60996 | 61078 | |
| 60997 | 61079 | p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; |
| 61080 | + assert( pKeyInfo->aSortOrder!=0 ); | |
| 60998 | 61081 | p->pKeyInfo = pKeyInfo; |
| 60999 | 61082 | p->nField = pKeyInfo->nField + 1; |
| 61000 | 61083 | return p; |
| 61001 | 61084 | } |
| 61002 | 61085 | |
| @@ -61086,10 +61169,11 @@ | ||
| 61086 | 61169 | /* mem1.u.i = 0; // not needed, here to silence compiler warning */ |
| 61087 | 61170 | |
| 61088 | 61171 | idx1 = getVarint32(aKey1, szHdr1); |
| 61089 | 61172 | d1 = szHdr1; |
| 61090 | 61173 | nField = pKeyInfo->nField; |
| 61174 | + assert( pKeyInfo->aSortOrder!=0 ); | |
| 61091 | 61175 | while( idx1<szHdr1 && i<pPKey2->nField ){ |
| 61092 | 61176 | u32 serial_type1; |
| 61093 | 61177 | |
| 61094 | 61178 | /* Read the serial types for the next element in each key. */ |
| 61095 | 61179 | idx1 += getVarint32( aKey1+idx1, serial_type1 ); |
| @@ -61105,11 +61189,11 @@ | ||
| 61105 | 61189 | i<nField ? pKeyInfo->aColl[i] : 0); |
| 61106 | 61190 | if( rc!=0 ){ |
| 61107 | 61191 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 61108 | 61192 | |
| 61109 | 61193 | /* Invert the result if we are using DESC sort order. */ |
| 61110 | - if( pKeyInfo->aSortOrder && i<nField && pKeyInfo->aSortOrder[i] ){ | |
| 61194 | + if( i<nField && pKeyInfo->aSortOrder[i] ){ | |
| 61111 | 61195 | rc = -rc; |
| 61112 | 61196 | } |
| 61113 | 61197 | |
| 61114 | 61198 | /* If the PREFIX_SEARCH flag is set and all fields except the final |
| 61115 | 61199 | ** rowid field were equal, then clear the PREFIX_SEARCH flag and set |
| @@ -61831,14 +61915,16 @@ | ||
| 61831 | 61915 | if( vdbeSafetyNotNull(v) ){ |
| 61832 | 61916 | return SQLITE_MISUSE_BKPT; |
| 61833 | 61917 | } |
| 61834 | 61918 | db = v->db; |
| 61835 | 61919 | sqlite3_mutex_enter(db->mutex); |
| 61920 | + v->doingRerun = 0; | |
| 61836 | 61921 | while( (rc = sqlite3Step(v))==SQLITE_SCHEMA |
| 61837 | 61922 | && cnt++ < SQLITE_MAX_SCHEMA_RETRY |
| 61838 | 61923 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 61839 | 61924 | sqlite3_reset(pStmt); |
| 61925 | + v->doingRerun = 1; | |
| 61840 | 61926 | assert( v->expired==0 ); |
| 61841 | 61927 | } |
| 61842 | 61928 | if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){ |
| 61843 | 61929 | /* This case occurs after failing to recompile an sql statement. |
| 61844 | 61930 | ** The error message from the SQL compiler has already been loaded |
| @@ -63957,11 +64043,10 @@ | ||
| 63957 | 64043 | struct OP_JournalMode_stack_vars { |
| 63958 | 64044 | Btree *pBt; /* Btree to change journal mode of */ |
| 63959 | 64045 | Pager *pPager; /* Pager associated with pBt */ |
| 63960 | 64046 | int eNew; /* New journal mode */ |
| 63961 | 64047 | int eOld; /* The old journal mode */ |
| 63962 | - const char *zFilename; /* Name of database file for pPager */ | |
| 63963 | 64048 | } ci; |
| 63964 | 64049 | struct OP_IncrVacuum_stack_vars { |
| 63965 | 64050 | Btree *pBt; |
| 63966 | 64051 | } cj; |
| 63967 | 64052 | struct OP_VBegin_stack_vars { |
| @@ -69061,12 +69146,14 @@ | ||
| 69061 | 69146 | #if 0 /* local variables moved into u.ci */ |
| 69062 | 69147 | Btree *pBt; /* Btree to change journal mode of */ |
| 69063 | 69148 | Pager *pPager; /* Pager associated with pBt */ |
| 69064 | 69149 | int eNew; /* New journal mode */ |
| 69065 | 69150 | int eOld; /* The old journal mode */ |
| 69066 | - const char *zFilename; /* Name of database file for pPager */ | |
| 69067 | 69151 | #endif /* local variables moved into u.ci */ |
| 69152 | +#ifndef SQLITE_OMIT_WAL | |
| 69153 | + const char *zFilename; /* Name of database file for u.ci.pPager */ | |
| 69154 | +#endif | |
| 69068 | 69155 | |
| 69069 | 69156 | u.ci.eNew = pOp->p3; |
| 69070 | 69157 | assert( u.ci.eNew==PAGER_JOURNALMODE_DELETE |
| 69071 | 69158 | || u.ci.eNew==PAGER_JOURNALMODE_TRUNCATE |
| 69072 | 69159 | || u.ci.eNew==PAGER_JOURNALMODE_PERSIST |
| @@ -69082,17 +69169,17 @@ | ||
| 69082 | 69169 | u.ci.eOld = sqlite3PagerGetJournalMode(u.ci.pPager); |
| 69083 | 69170 | if( u.ci.eNew==PAGER_JOURNALMODE_QUERY ) u.ci.eNew = u.ci.eOld; |
| 69084 | 69171 | if( !sqlite3PagerOkToChangeJournalMode(u.ci.pPager) ) u.ci.eNew = u.ci.eOld; |
| 69085 | 69172 | |
| 69086 | 69173 | #ifndef SQLITE_OMIT_WAL |
| 69087 | - u.ci.zFilename = sqlite3PagerFilename(u.ci.pPager, 1); | |
| 69174 | + zFilename = sqlite3PagerFilename(u.ci.pPager, 1); | |
| 69088 | 69175 | |
| 69089 | 69176 | /* Do not allow a transition to journal_mode=WAL for a database |
| 69090 | 69177 | ** in temporary storage or if the VFS does not support shared memory |
| 69091 | 69178 | */ |
| 69092 | 69179 | if( u.ci.eNew==PAGER_JOURNALMODE_WAL |
| 69093 | - && (sqlite3Strlen30(u.ci.zFilename)==0 /* Temp file */ | |
| 69180 | + && (sqlite3Strlen30(zFilename)==0 /* Temp file */ | |
| 69094 | 69181 | || !sqlite3PagerWalSupported(u.ci.pPager)) /* No shared-memory support */ |
| 69095 | 69182 | ){ |
| 69096 | 69183 | u.ci.eNew = u.ci.eOld; |
| 69097 | 69184 | } |
| 69098 | 69185 | |
| @@ -69660,11 +69747,14 @@ | ||
| 69660 | 69747 | #if 0 /* local variables moved into u.cr */ |
| 69661 | 69748 | char *zTrace; |
| 69662 | 69749 | char *z; |
| 69663 | 69750 | #endif /* local variables moved into u.cr */ |
| 69664 | 69751 | |
| 69665 | - if( db->xTrace && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){ | |
| 69752 | + if( db->xTrace | |
| 69753 | + && !p->doingRerun | |
| 69754 | + && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 | |
| 69755 | + ){ | |
| 69666 | 69756 | u.cr.z = sqlite3VdbeExpandSql(p, u.cr.zTrace); |
| 69667 | 69757 | db->xTrace(db->pTraceArg, u.cr.z); |
| 69668 | 69758 | sqlite3DbFree(db, u.cr.z); |
| 69669 | 69759 | } |
| 69670 | 69760 | #ifdef SQLITE_DEBUG |
| @@ -74885,10 +74975,11 @@ | ||
| 74885 | 74975 | |
| 74886 | 74976 | switch( pExpr->op ){ |
| 74887 | 74977 | case TK_IN: { |
| 74888 | 74978 | char affinity; /* Affinity of the LHS of the IN */ |
| 74889 | 74979 | KeyInfo keyInfo; /* Keyinfo for the generated table */ |
| 74980 | + static u8 sortOrder = 0; /* Fake aSortOrder for keyInfo */ | |
| 74890 | 74981 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 74891 | 74982 | Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ |
| 74892 | 74983 | |
| 74893 | 74984 | if( rMayHaveNull ){ |
| 74894 | 74985 | sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull); |
| @@ -74912,10 +75003,11 @@ | ||
| 74912 | 75003 | pExpr->iTable = pParse->nTab++; |
| 74913 | 75004 | addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid); |
| 74914 | 75005 | if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED); |
| 74915 | 75006 | memset(&keyInfo, 0, sizeof(keyInfo)); |
| 74916 | 75007 | keyInfo.nField = 1; |
| 75008 | + keyInfo.aSortOrder = &sortOrder; | |
| 74917 | 75009 | |
| 74918 | 75010 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 74919 | 75011 | /* Case 1: expr IN (SELECT ...) |
| 74920 | 75012 | ** |
| 74921 | 75013 | ** Generate code to write the results of the select into the temporary |
| @@ -74952,10 +75044,11 @@ | ||
| 74952 | 75044 | |
| 74953 | 75045 | if( !affinity ){ |
| 74954 | 75046 | affinity = SQLITE_AFF_NONE; |
| 74955 | 75047 | } |
| 74956 | 75048 | keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
| 75049 | + keyInfo.aSortOrder = &sortOrder; | |
| 74957 | 75050 | |
| 74958 | 75051 | /* Loop through each expression in <exprlist>. */ |
| 74959 | 75052 | r1 = sqlite3GetTempReg(pParse); |
| 74960 | 75053 | r2 = sqlite3GetTempReg(pParse); |
| 74961 | 75054 | sqlite3VdbeAddOp2(v, OP_Null, 0, r2); |
| @@ -78030,11 +78123,11 @@ | ||
| 78030 | 78123 | |
| 78031 | 78124 | /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. |
| 78032 | 78125 | ** If there is a NOT NULL constraint, then the default value for the |
| 78033 | 78126 | ** column must not be NULL. |
| 78034 | 78127 | */ |
| 78035 | - if( pCol->isPrimKey ){ | |
| 78128 | + if( pCol->colFlags & COLFLAG_PRIMKEY ){ | |
| 78036 | 78129 | sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); |
| 78037 | 78130 | return; |
| 78038 | 78131 | } |
| 78039 | 78132 | if( pNew->pIndex ){ |
| 78040 | 78133 | sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); |
| @@ -81299,20 +81392,20 @@ | ||
| 81299 | 81392 | goto primary_key_exit; |
| 81300 | 81393 | } |
| 81301 | 81394 | pTab->tabFlags |= TF_HasPrimaryKey; |
| 81302 | 81395 | if( pList==0 ){ |
| 81303 | 81396 | iCol = pTab->nCol - 1; |
| 81304 | - pTab->aCol[iCol].isPrimKey = 1; | |
| 81397 | + pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; | |
| 81305 | 81398 | }else{ |
| 81306 | 81399 | for(i=0; i<pList->nExpr; i++){ |
| 81307 | 81400 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 81308 | 81401 | if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ |
| 81309 | 81402 | break; |
| 81310 | 81403 | } |
| 81311 | 81404 | } |
| 81312 | 81405 | if( iCol<pTab->nCol ){ |
| 81313 | - pTab->aCol[iCol].isPrimKey = 1; | |
| 81406 | + pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; | |
| 81314 | 81407 | } |
| 81315 | 81408 | } |
| 81316 | 81409 | if( pList->nExpr>1 ) iCol = -1; |
| 81317 | 81410 | } |
| 81318 | 81411 | if( iCol>=0 && iCol<pTab->nCol ){ |
| @@ -85468,37 +85561,18 @@ | ||
| 85468 | 85561 | sqlite3_result_text(context, z1, n, sqlite3_free); |
| 85469 | 85562 | } |
| 85470 | 85563 | } |
| 85471 | 85564 | } |
| 85472 | 85565 | |
| 85473 | - | |
| 85474 | -#if 0 /* This function is never used. */ | |
| 85475 | -/* | |
| 85476 | -** The COALESCE() and IFNULL() functions used to be implemented as shown | |
| 85477 | -** here. But now they are implemented as VDBE code so that unused arguments | |
| 85478 | -** do not have to be computed. This legacy implementation is retained as | |
| 85479 | -** comment. | |
| 85480 | -*/ | |
| 85481 | -/* | |
| 85482 | -** Implementation of the IFNULL(), NVL(), and COALESCE() functions. | |
| 85483 | -** All three do the same thing. They return the first non-NULL | |
| 85484 | -** argument. | |
| 85485 | -*/ | |
| 85486 | -static void ifnullFunc( | |
| 85487 | - sqlite3_context *context, | |
| 85488 | - int argc, | |
| 85489 | - sqlite3_value **argv | |
| 85490 | -){ | |
| 85491 | - int i; | |
| 85492 | - for(i=0; i<argc; i++){ | |
| 85493 | - if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){ | |
| 85494 | - sqlite3_result_value(context, argv[i]); | |
| 85495 | - break; | |
| 85496 | - } | |
| 85497 | - } | |
| 85498 | -} | |
| 85499 | -#endif /* NOT USED */ | |
| 85566 | +/* | |
| 85567 | +** The COALESCE() and IFNULL() functions are implemented as VDBE code so | |
| 85568 | +** that unused argument values do not have to be computed. However, we | |
| 85569 | +** still need some kind of function implementation for this routines in | |
| 85570 | +** the function table. That function implementation will never be called | |
| 85571 | +** so it doesn't matter what the implementation is. We might as well use | |
| 85572 | +** the "version()" function as a substitute. | |
| 85573 | +*/ | |
| 85500 | 85574 | #define ifnullFunc versionFunc /* Substitute function - never called */ |
| 85501 | 85575 | |
| 85502 | 85576 | /* |
| 85503 | 85577 | ** Implementation of random(). Return a random integer. |
| 85504 | 85578 | */ |
| @@ -85613,11 +85687,11 @@ | ||
| 85613 | 85687 | ** character is exactly one byte in size. Also, all characters are |
| 85614 | 85688 | ** able to participate in upper-case-to-lower-case mappings in EBCDIC |
| 85615 | 85689 | ** whereas only characters less than 0x80 do in ASCII. |
| 85616 | 85690 | */ |
| 85617 | 85691 | #if defined(SQLITE_EBCDIC) |
| 85618 | -# define sqlite3Utf8Read(A,C) (*(A++)) | |
| 85692 | +# define sqlite3Utf8Read(A) (*((*A)++)) | |
| 85619 | 85693 | # define GlogUpperToLower(A) A = sqlite3UpperToLower[A] |
| 85620 | 85694 | #else |
| 85621 | 85695 | # define GlogUpperToLower(A) if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; } |
| 85622 | 85696 | #endif |
| 85623 | 85697 | |
| @@ -85670,22 +85744,22 @@ | ||
| 85670 | 85744 | u8 matchAll = pInfo->matchAll; |
| 85671 | 85745 | u8 matchSet = pInfo->matchSet; |
| 85672 | 85746 | u8 noCase = pInfo->noCase; |
| 85673 | 85747 | int prevEscape = 0; /* True if the previous character was 'escape' */ |
| 85674 | 85748 | |
| 85675 | - while( (c = sqlite3Utf8Read(zPattern,&zPattern))!=0 ){ | |
| 85676 | - if( !prevEscape && c==matchAll ){ | |
| 85677 | - while( (c=sqlite3Utf8Read(zPattern,&zPattern)) == matchAll | |
| 85749 | + while( (c = sqlite3Utf8Read(&zPattern))!=0 ){ | |
| 85750 | + if( c==matchAll && !prevEscape ){ | |
| 85751 | + while( (c=sqlite3Utf8Read(&zPattern)) == matchAll | |
| 85678 | 85752 | || c == matchOne ){ |
| 85679 | - if( c==matchOne && sqlite3Utf8Read(zString, &zString)==0 ){ | |
| 85753 | + if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){ | |
| 85680 | 85754 | return 0; |
| 85681 | 85755 | } |
| 85682 | 85756 | } |
| 85683 | 85757 | if( c==0 ){ |
| 85684 | 85758 | return 1; |
| 85685 | 85759 | }else if( c==esc ){ |
| 85686 | - c = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85760 | + c = sqlite3Utf8Read(&zPattern); | |
| 85687 | 85761 | if( c==0 ){ |
| 85688 | 85762 | return 0; |
| 85689 | 85763 | } |
| 85690 | 85764 | }else if( c==matchSet ){ |
| 85691 | 85765 | assert( esc==0 ); /* This is GLOB, not LIKE */ |
| @@ -85693,67 +85767,67 @@ | ||
| 85693 | 85767 | while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){ |
| 85694 | 85768 | SQLITE_SKIP_UTF8(zString); |
| 85695 | 85769 | } |
| 85696 | 85770 | return *zString!=0; |
| 85697 | 85771 | } |
| 85698 | - while( (c2 = sqlite3Utf8Read(zString,&zString))!=0 ){ | |
| 85772 | + while( (c2 = sqlite3Utf8Read(&zString))!=0 ){ | |
| 85699 | 85773 | if( noCase ){ |
| 85700 | 85774 | GlogUpperToLower(c2); |
| 85701 | 85775 | GlogUpperToLower(c); |
| 85702 | 85776 | while( c2 != 0 && c2 != c ){ |
| 85703 | - c2 = sqlite3Utf8Read(zString, &zString); | |
| 85777 | + c2 = sqlite3Utf8Read(&zString); | |
| 85704 | 85778 | GlogUpperToLower(c2); |
| 85705 | 85779 | } |
| 85706 | 85780 | }else{ |
| 85707 | 85781 | while( c2 != 0 && c2 != c ){ |
| 85708 | - c2 = sqlite3Utf8Read(zString, &zString); | |
| 85782 | + c2 = sqlite3Utf8Read(&zString); | |
| 85709 | 85783 | } |
| 85710 | 85784 | } |
| 85711 | 85785 | if( c2==0 ) return 0; |
| 85712 | 85786 | if( patternCompare(zPattern,zString,pInfo,esc) ) return 1; |
| 85713 | 85787 | } |
| 85714 | 85788 | return 0; |
| 85715 | - }else if( !prevEscape && c==matchOne ){ | |
| 85716 | - if( sqlite3Utf8Read(zString, &zString)==0 ){ | |
| 85789 | + }else if( c==matchOne && !prevEscape ){ | |
| 85790 | + if( sqlite3Utf8Read(&zString)==0 ){ | |
| 85717 | 85791 | return 0; |
| 85718 | 85792 | } |
| 85719 | 85793 | }else if( c==matchSet ){ |
| 85720 | 85794 | u32 prior_c = 0; |
| 85721 | 85795 | assert( esc==0 ); /* This only occurs for GLOB, not LIKE */ |
| 85722 | 85796 | seen = 0; |
| 85723 | 85797 | invert = 0; |
| 85724 | - c = sqlite3Utf8Read(zString, &zString); | |
| 85798 | + c = sqlite3Utf8Read(&zString); | |
| 85725 | 85799 | if( c==0 ) return 0; |
| 85726 | - c2 = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85800 | + c2 = sqlite3Utf8Read(&zPattern); | |
| 85727 | 85801 | if( c2=='^' ){ |
| 85728 | 85802 | invert = 1; |
| 85729 | - c2 = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85803 | + c2 = sqlite3Utf8Read(&zPattern); | |
| 85730 | 85804 | } |
| 85731 | 85805 | if( c2==']' ){ |
| 85732 | 85806 | if( c==']' ) seen = 1; |
| 85733 | - c2 = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85807 | + c2 = sqlite3Utf8Read(&zPattern); | |
| 85734 | 85808 | } |
| 85735 | 85809 | while( c2 && c2!=']' ){ |
| 85736 | 85810 | if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){ |
| 85737 | - c2 = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85811 | + c2 = sqlite3Utf8Read(&zPattern); | |
| 85738 | 85812 | if( c>=prior_c && c<=c2 ) seen = 1; |
| 85739 | 85813 | prior_c = 0; |
| 85740 | 85814 | }else{ |
| 85741 | 85815 | if( c==c2 ){ |
| 85742 | 85816 | seen = 1; |
| 85743 | 85817 | } |
| 85744 | 85818 | prior_c = c2; |
| 85745 | 85819 | } |
| 85746 | - c2 = sqlite3Utf8Read(zPattern, &zPattern); | |
| 85820 | + c2 = sqlite3Utf8Read(&zPattern); | |
| 85747 | 85821 | } |
| 85748 | 85822 | if( c2==0 || (seen ^ invert)==0 ){ |
| 85749 | 85823 | return 0; |
| 85750 | 85824 | } |
| 85751 | 85825 | }else if( esc==c && !prevEscape ){ |
| 85752 | 85826 | prevEscape = 1; |
| 85753 | 85827 | }else{ |
| 85754 | - c2 = sqlite3Utf8Read(zString, &zString); | |
| 85828 | + c2 = sqlite3Utf8Read(&zString); | |
| 85755 | 85829 | if( noCase ){ |
| 85756 | 85830 | GlogUpperToLower(c); |
| 85757 | 85831 | GlogUpperToLower(c2); |
| 85758 | 85832 | } |
| 85759 | 85833 | if( c!=c2 ){ |
| @@ -85821,11 +85895,11 @@ | ||
| 85821 | 85895 | if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ |
| 85822 | 85896 | sqlite3_result_error(context, |
| 85823 | 85897 | "ESCAPE expression must be a single character", -1); |
| 85824 | 85898 | return; |
| 85825 | 85899 | } |
| 85826 | - escape = sqlite3Utf8Read(zEsc, &zEsc); | |
| 85900 | + escape = sqlite3Utf8Read(&zEsc); | |
| 85827 | 85901 | } |
| 85828 | 85902 | if( zA && zB ){ |
| 85829 | 85903 | struct compareInfo *pInfo = sqlite3_user_data(context); |
| 85830 | 85904 | #ifdef SQLITE_TEST |
| 85831 | 85905 | sqlite3_like_count++; |
| @@ -87653,11 +87727,12 @@ | ||
| 87653 | 87727 | for(i=0; i<p->nCol; i++){ |
| 87654 | 87728 | char *zKey = p->aCol[i].zCol; |
| 87655 | 87729 | int iKey; |
| 87656 | 87730 | for(iKey=0; iKey<pTab->nCol; iKey++){ |
| 87657 | 87731 | Column *pCol = &pTab->aCol[iKey]; |
| 87658 | - if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey) : pCol->isPrimKey) ){ | |
| 87732 | + if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey) | |
| 87733 | + : (pCol->colFlags & COLFLAG_PRIMKEY)!=0) ){ | |
| 87659 | 87734 | if( aChange[iKey]>=0 ) return 1; |
| 87660 | 87735 | if( iKey==pTab->iPKey && chngRowid ) return 1; |
| 87661 | 87736 | } |
| 87662 | 87737 | } |
| 87663 | 87738 | } |
| @@ -88268,10 +88343,101 @@ | ||
| 88268 | 88343 | */ |
| 88269 | 88344 | # define autoIncBegin(A,B,C) (0) |
| 88270 | 88345 | # define autoIncStep(A,B,C) |
| 88271 | 88346 | #endif /* SQLITE_OMIT_AUTOINCREMENT */ |
| 88272 | 88347 | |
| 88348 | + | |
| 88349 | +/* | |
| 88350 | +** Generate code for a co-routine that will evaluate a subquery one | |
| 88351 | +** row at a time. | |
| 88352 | +** | |
| 88353 | +** The pSelect parameter is the subquery that the co-routine will evaluation. | |
| 88354 | +** Information about the location of co-routine and the registers it will use | |
| 88355 | +** is returned by filling in the pDest object. | |
| 88356 | +** | |
| 88357 | +** Registers are allocated as follows: | |
| 88358 | +** | |
| 88359 | +** pDest->iSDParm The register holding the next entry-point of the | |
| 88360 | +** co-routine. Run the co-routine to its next breakpoint | |
| 88361 | +** by calling "OP_Yield $X" where $X is pDest->iSDParm. | |
| 88362 | +** | |
| 88363 | +** pDest->iSDParm+1 The register holding the "completed" flag for the | |
| 88364 | +** co-routine. This register is 0 if the previous Yield | |
| 88365 | +** generated a new result row, or 1 if the subquery | |
| 88366 | +** has completed. If the Yield is called again | |
| 88367 | +** after this register becomes 1, then the VDBE will | |
| 88368 | +** halt with an SQLITE_INTERNAL error. | |
| 88369 | +** | |
| 88370 | +** pDest->iSdst First result register. | |
| 88371 | +** | |
| 88372 | +** pDest->nSdst Number of result registers. | |
| 88373 | +** | |
| 88374 | +** This routine handles all of the register allocation and fills in the | |
| 88375 | +** pDest structure appropriately. | |
| 88376 | +** | |
| 88377 | +** Here is a schematic of the generated code assuming that X is the | |
| 88378 | +** co-routine entry-point register reg[pDest->iSDParm], that EOF is the | |
| 88379 | +** completed flag reg[pDest->iSDParm+1], and R and S are the range of | |
| 88380 | +** registers that hold the result set, reg[pDest->iSdst] through | |
| 88381 | +** reg[pDest->iSdst+pDest->nSdst-1]: | |
| 88382 | +** | |
| 88383 | +** X <- A | |
| 88384 | +** EOF <- 0 | |
| 88385 | +** goto B | |
| 88386 | +** A: setup for the SELECT | |
| 88387 | +** loop rows in the SELECT | |
| 88388 | +** load results into registers R..S | |
| 88389 | +** yield X | |
| 88390 | +** end loop | |
| 88391 | +** cleanup after the SELECT | |
| 88392 | +** EOF <- 1 | |
| 88393 | +** yield X | |
| 88394 | +** halt-error | |
| 88395 | +** B: | |
| 88396 | +** | |
| 88397 | +** To use this subroutine, the caller generates code as follows: | |
| 88398 | +** | |
| 88399 | +** [ Co-routine generated by this subroutine, shown above ] | |
| 88400 | +** S: yield X | |
| 88401 | +** if EOF goto E | |
| 88402 | +** if skip this row, goto C | |
| 88403 | +** if terminate loop, goto E | |
| 88404 | +** deal with this row | |
| 88405 | +** C: goto S | |
| 88406 | +** E: | |
| 88407 | +*/ | |
| 88408 | +SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse *pParse, Select *pSelect, SelectDest *pDest){ | |
| 88409 | + int regYield; /* Register holding co-routine entry-point */ | |
| 88410 | + int regEof; /* Register holding co-routine completion flag */ | |
| 88411 | + int addrTop; /* Top of the co-routine */ | |
| 88412 | + int j1; /* Jump instruction */ | |
| 88413 | + int rc; /* Result code */ | |
| 88414 | + Vdbe *v; /* VDBE under construction */ | |
| 88415 | + | |
| 88416 | + regYield = ++pParse->nMem; | |
| 88417 | + regEof = ++pParse->nMem; | |
| 88418 | + v = sqlite3GetVdbe(pParse); | |
| 88419 | + addrTop = sqlite3VdbeCurrentAddr(v); | |
| 88420 | + sqlite3VdbeAddOp2(v, OP_Integer, addrTop+2, regYield); /* X <- A */ | |
| 88421 | + VdbeComment((v, "Co-routine entry point")); | |
| 88422 | + sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof); /* EOF <- 0 */ | |
| 88423 | + VdbeComment((v, "Co-routine completion flag")); | |
| 88424 | + sqlite3SelectDestInit(pDest, SRT_Coroutine, regYield); | |
| 88425 | + j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); | |
| 88426 | + rc = sqlite3Select(pParse, pSelect, pDest); | |
| 88427 | + assert( pParse->nErr==0 || rc ); | |
| 88428 | + if( pParse->db->mallocFailed && rc==SQLITE_OK ) rc = SQLITE_NOMEM; | |
| 88429 | + if( rc ) return rc; | |
| 88430 | + sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof); /* EOF <- 1 */ | |
| 88431 | + sqlite3VdbeAddOp1(v, OP_Yield, regYield); /* yield X */ | |
| 88432 | + sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort); | |
| 88433 | + VdbeComment((v, "End of coroutine")); | |
| 88434 | + sqlite3VdbeJumpHere(v, j1); /* label B: */ | |
| 88435 | + return rc; | |
| 88436 | +} | |
| 88437 | + | |
| 88438 | + | |
| 88273 | 88439 | |
| 88274 | 88440 | /* Forward declaration */ |
| 88275 | 88441 | static int xferOptimization( |
| 88276 | 88442 | Parse *pParse, /* Parser context */ |
| 88277 | 88443 | Table *pDest, /* The table we are inserting into */ |
| @@ -88517,55 +88683,16 @@ | ||
| 88517 | 88683 | ** is coming from a SELECT statement, then generate a co-routine that |
| 88518 | 88684 | ** produces a single row of the SELECT on each invocation. The |
| 88519 | 88685 | ** co-routine is the common header to the 3rd and 4th templates. |
| 88520 | 88686 | */ |
| 88521 | 88687 | if( pSelect ){ |
| 88522 | - /* Data is coming from a SELECT. Generate code to implement that SELECT | |
| 88523 | - ** as a co-routine. The code is common to both the 3rd and 4th | |
| 88524 | - ** templates: | |
| 88525 | - ** | |
| 88526 | - ** EOF <- 0 | |
| 88527 | - ** X <- A | |
| 88528 | - ** goto B | |
| 88529 | - ** A: setup for the SELECT | |
| 88530 | - ** loop over the tables in the SELECT | |
| 88531 | - ** load value into register R..R+n | |
| 88532 | - ** yield X | |
| 88533 | - ** end loop | |
| 88534 | - ** cleanup after the SELECT | |
| 88535 | - ** EOF <- 1 | |
| 88536 | - ** yield X | |
| 88537 | - ** halt-error | |
| 88538 | - ** | |
| 88539 | - ** On each invocation of the co-routine, it puts a single row of the | |
| 88540 | - ** SELECT result into registers dest.iMem...dest.iMem+dest.nMem-1. | |
| 88541 | - ** (These output registers are allocated by sqlite3Select().) When | |
| 88542 | - ** the SELECT completes, it sets the EOF flag stored in regEof. | |
| 88543 | - */ | |
| 88544 | - int rc, j1; | |
| 88545 | - | |
| 88546 | - regEof = ++pParse->nMem; | |
| 88547 | - sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof); /* EOF <- 0 */ | |
| 88548 | - VdbeComment((v, "SELECT eof flag")); | |
| 88549 | - sqlite3SelectDestInit(&dest, SRT_Coroutine, ++pParse->nMem); | |
| 88550 | - addrSelect = sqlite3VdbeCurrentAddr(v)+2; | |
| 88551 | - sqlite3VdbeAddOp2(v, OP_Integer, addrSelect-1, dest.iSDParm); | |
| 88552 | - j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); | |
| 88553 | - VdbeComment((v, "Jump over SELECT coroutine")); | |
| 88554 | - | |
| 88555 | - /* Resolve the expressions in the SELECT statement and execute it. */ | |
| 88556 | - rc = sqlite3Select(pParse, pSelect, &dest); | |
| 88557 | - assert( pParse->nErr==0 || rc ); | |
| 88558 | - if( rc || NEVER(pParse->nErr) || db->mallocFailed ){ | |
| 88559 | - goto insert_cleanup; | |
| 88560 | - } | |
| 88561 | - sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof); /* EOF <- 1 */ | |
| 88562 | - sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); /* yield X */ | |
| 88563 | - sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort); | |
| 88564 | - VdbeComment((v, "End of SELECT coroutine")); | |
| 88565 | - sqlite3VdbeJumpHere(v, j1); /* label B: */ | |
| 88566 | - | |
| 88688 | + /* Data is coming from a SELECT. Generate a co-routine to run that | |
| 88689 | + ** SELECT. */ | |
| 88690 | + int rc = sqlite3CodeCoroutine(pParse, pSelect, &dest); | |
| 88691 | + if( rc ) goto insert_cleanup; | |
| 88692 | + | |
| 88693 | + regEof = dest.iSDParm + 1; | |
| 88567 | 88694 | regFromSelect = dest.iSdst; |
| 88568 | 88695 | assert( pSelect->pEList ); |
| 88569 | 88696 | nColumn = pSelect->pEList->nExpr; |
| 88570 | 88697 | assert( dest.nSdst==nColumn ); |
| 88571 | 88698 | |
| @@ -92035,11 +92162,12 @@ | ||
| 92035 | 92162 | if( pCol->zDflt ){ |
| 92036 | 92163 | sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); |
| 92037 | 92164 | }else{ |
| 92038 | 92165 | sqlite3VdbeAddOp2(v, OP_Null, 0, 5); |
| 92039 | 92166 | } |
| 92040 | - sqlite3VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6); | |
| 92167 | + sqlite3VdbeAddOp2(v, OP_Integer, | |
| 92168 | + (pCol->colFlags&COLFLAG_PRIMKEY)!=0, 6); | |
| 92041 | 92169 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6); |
| 92042 | 92170 | } |
| 92043 | 92171 | } |
| 92044 | 92172 | }else |
| 92045 | 92173 | |
| @@ -94803,11 +94931,11 @@ | ||
| 94803 | 94931 | ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. |
| 94804 | 94932 | */ |
| 94805 | 94933 | static int selectColumnsFromExprList( |
| 94806 | 94934 | Parse *pParse, /* Parsing context */ |
| 94807 | 94935 | ExprList *pEList, /* Expr list from which to derive column names */ |
| 94808 | - int *pnCol, /* Write the number of columns here */ | |
| 94936 | + i16 *pnCol, /* Write the number of columns here */ | |
| 94809 | 94937 | Column **paCol /* Write the new column list here */ |
| 94810 | 94938 | ){ |
| 94811 | 94939 | sqlite3 *db = pParse->db; /* Database connection */ |
| 94812 | 94940 | int i, j; /* Loop counters */ |
| 94813 | 94941 | int cnt; /* Index added to make the name unique */ |
| @@ -95449,10 +95577,11 @@ | ||
| 95449 | 95577 | *apColl = multiSelectCollSeq(pParse, p, i); |
| 95450 | 95578 | if( 0==*apColl ){ |
| 95451 | 95579 | *apColl = db->pDfltColl; |
| 95452 | 95580 | } |
| 95453 | 95581 | } |
| 95582 | + pKeyInfo->aSortOrder = (u8*)apColl; | |
| 95454 | 95583 | |
| 95455 | 95584 | for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ |
| 95456 | 95585 | for(i=0; i<2; i++){ |
| 95457 | 95586 | int addr = pLoop->addrOpenEphm[i]; |
| 95458 | 95587 | if( addr<0 ){ |
| @@ -101068,11 +101197,11 @@ | ||
| 101068 | 101197 | }else{ |
| 101069 | 101198 | int iCol; |
| 101070 | 101199 | /* If everything went according to plan, link the new VTable structure |
| 101071 | 101200 | ** into the linked list headed by pTab->pVTable. Then loop through the |
| 101072 | 101201 | ** columns of the table to see if any of them contain the token "hidden". |
| 101073 | - ** If so, set the Column.isHidden flag and remove the token from | |
| 101202 | + ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from | |
| 101074 | 101203 | ** the type string. */ |
| 101075 | 101204 | pVTable->pNext = pTab->pVTable; |
| 101076 | 101205 | pTab->pVTable = pVTable; |
| 101077 | 101206 | |
| 101078 | 101207 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| @@ -101099,11 +101228,11 @@ | ||
| 101099 | 101228 | } |
| 101100 | 101229 | if( zType[i]=='\0' && i>0 ){ |
| 101101 | 101230 | assert(zType[i-1]==' '); |
| 101102 | 101231 | zType[i-1] = '\0'; |
| 101103 | 101232 | } |
| 101104 | - pTab->aCol[iCol].isHidden = 1; | |
| 101233 | + pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN; | |
| 101105 | 101234 | } |
| 101106 | 101235 | } |
| 101107 | 101236 | } |
| 101108 | 101237 | } |
| 101109 | 101238 | |
| @@ -101901,10 +102030,11 @@ | ||
| 101901 | 102030 | #define WHERE_UNIQUE 0x04000000 /* Selects no more than one row */ |
| 101902 | 102031 | #define WHERE_VIRTUALTABLE 0x08000000 /* Use virtual-table processing */ |
| 101903 | 102032 | #define WHERE_MULTI_OR 0x10000000 /* OR using multiple indices */ |
| 101904 | 102033 | #define WHERE_TEMP_INDEX 0x20000000 /* Uses an ephemeral index */ |
| 101905 | 102034 | #define WHERE_DISTINCT 0x40000000 /* Correct order for DISTINCT */ |
| 102035 | +#define WHERE_COVER_SCAN 0x80000000 /* Full scan of a covering index */ | |
| 101906 | 102036 | |
| 101907 | 102037 | /* |
| 101908 | 102038 | ** Initialize a preallocated WhereClause structure. |
| 101909 | 102039 | */ |
| 101910 | 102040 | static void whereClauseInit( |
| @@ -104770,11 +104900,11 @@ | ||
| 104770 | 104900 | /* If currently calculating the cost of using an index (not the IPK |
| 104771 | 104901 | ** index), determine if all required column data may be obtained without |
| 104772 | 104902 | ** using the main table (i.e. if the index is a covering |
| 104773 | 104903 | ** index for this query). If it is, set the WHERE_IDX_ONLY flag in |
| 104774 | 104904 | ** wsFlags. Otherwise, set the bLookup variable to true. */ |
| 104775 | - if( pIdx && wsFlags ){ | |
| 104905 | + if( pIdx ){ | |
| 104776 | 104906 | Bitmask m = pSrc->colUsed; |
| 104777 | 104907 | int j; |
| 104778 | 104908 | for(j=0; j<pIdx->nColumn; j++){ |
| 104779 | 104909 | int x = pIdx->aiColumn[j]; |
| 104780 | 104910 | if( x<BMS-1 ){ |
| @@ -104835,11 +104965,24 @@ | ||
| 104835 | 104965 | ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do |
| 104836 | 104966 | ** not give us data on the relative sizes of table and index records. |
| 104837 | 104967 | ** So this computation assumes table records are about twice as big |
| 104838 | 104968 | ** as index records |
| 104839 | 104969 | */ |
| 104840 | - if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ | |
| 104970 | + if( wsFlags==WHERE_IDX_ONLY | |
| 104971 | + && (pWC->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 | |
| 104972 | + && sqlite3GlobalConfig.bUseCis | |
| 104973 | +#ifndef SQLITE_OMIT_BUILTIN_TEST | |
| 104974 | + && (pParse->db->flags & SQLITE_CoverIdxScan)==0 | |
| 104975 | +#endif | |
| 104976 | + ){ | |
| 104977 | + /* This index is not useful for indexing, but it is a covering index. | |
| 104978 | + ** A full-scan of the index might be a little faster than a full-scan | |
| 104979 | + ** of the table, so give this case a cost slightly less than a table | |
| 104980 | + ** scan. */ | |
| 104981 | + cost = aiRowEst[0]*3 + pProbe->nColumn; | |
| 104982 | + wsFlags |= WHERE_COVER_SCAN|WHERE_COLUMN_RANGE; | |
| 104983 | + }else if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ | |
| 104841 | 104984 | /* The cost of a full table scan is a number of move operations equal |
| 104842 | 104985 | ** to the number of rows in the table. |
| 104843 | 104986 | ** |
| 104844 | 104987 | ** We add an additional 4x penalty to full table scans. This causes |
| 104845 | 104988 | ** the cost function to err on the side of choosing an index over |
| @@ -104846,10 +104989,11 @@ | ||
| 104846 | 104989 | ** choosing a full scan. This 4x full-scan penalty is an arguable |
| 104847 | 104990 | ** decision and one which we expect to revisit in the future. But |
| 104848 | 104991 | ** it seems to be working well enough at the moment. |
| 104849 | 104992 | */ |
| 104850 | 104993 | cost = aiRowEst[0]*4; |
| 104994 | + wsFlags &= ~WHERE_IDX_ONLY; | |
| 104851 | 104995 | }else{ |
| 104852 | 104996 | log10N = estLog(aiRowEst[0]); |
| 104853 | 104997 | cost = nRow; |
| 104854 | 104998 | if( pIdx ){ |
| 104855 | 104999 | if( bLookup ){ |
| @@ -105889,10 +106033,15 @@ | ||
| 105889 | 106033 | pLevel->op = OP_Prev; |
| 105890 | 106034 | }else{ |
| 105891 | 106035 | pLevel->op = OP_Next; |
| 105892 | 106036 | } |
| 105893 | 106037 | pLevel->p1 = iIdxCur; |
| 106038 | + if( pLevel->plan.wsFlags & WHERE_COVER_SCAN ){ | |
| 106039 | + pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; | |
| 106040 | + }else{ | |
| 106041 | + assert( pLevel->p5==0 ); | |
| 106042 | + } | |
| 105894 | 106043 | }else |
| 105895 | 106044 | |
| 105896 | 106045 | #ifndef SQLITE_OMIT_OR_OPTIMIZATION |
| 105897 | 106046 | if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){ |
| 105898 | 106047 | /* Case 4: Two or more separately indexed terms connected by OR |
| @@ -106765,31 +106914,33 @@ | ||
| 106765 | 106914 | ** index name is '*'. |
| 106766 | 106915 | */ |
| 106767 | 106916 | for(i=0; i<nTabList; i++){ |
| 106768 | 106917 | char *z; |
| 106769 | 106918 | int n; |
| 106919 | + int w; | |
| 106770 | 106920 | pLevel = &pWInfo->a[i]; |
| 106921 | + w = pLevel->plan.wsFlags; | |
| 106771 | 106922 | pTabItem = &pTabList->a[pLevel->iFrom]; |
| 106772 | 106923 | z = pTabItem->zAlias; |
| 106773 | 106924 | if( z==0 ) z = pTabItem->pTab->zName; |
| 106774 | 106925 | n = sqlite3Strlen30(z); |
| 106775 | 106926 | if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){ |
| 106776 | - if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){ | |
| 106927 | + if( (w & WHERE_IDX_ONLY)!=0 && (w & WHERE_COVER_SCAN)==0 ){ | |
| 106777 | 106928 | memcpy(&sqlite3_query_plan[nQPlan], "{}", 2); |
| 106778 | 106929 | nQPlan += 2; |
| 106779 | 106930 | }else{ |
| 106780 | 106931 | memcpy(&sqlite3_query_plan[nQPlan], z, n); |
| 106781 | 106932 | nQPlan += n; |
| 106782 | 106933 | } |
| 106783 | 106934 | sqlite3_query_plan[nQPlan++] = ' '; |
| 106784 | 106935 | } |
| 106785 | - testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ ); | |
| 106786 | - testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ); | |
| 106787 | - if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){ | |
| 106936 | + testcase( w & WHERE_ROWID_EQ ); | |
| 106937 | + testcase( w & WHERE_ROWID_RANGE ); | |
| 106938 | + if( w & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){ | |
| 106788 | 106939 | memcpy(&sqlite3_query_plan[nQPlan], "* ", 2); |
| 106789 | 106940 | nQPlan += 2; |
| 106790 | - }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){ | |
| 106941 | + }else if( (w & WHERE_INDEXED)!=0 && (w & WHERE_COVER_SCAN)==0 ){ | |
| 106791 | 106942 | n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName); |
| 106792 | 106943 | if( n+nQPlan < sizeof(sqlite3_query_plan)-2 ){ |
| 106793 | 106944 | memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n); |
| 106794 | 106945 | nQPlan += n; |
| 106795 | 106946 | sqlite3_query_plan[nQPlan++] = ' '; |
| @@ -112076,10 +112227,15 @@ | ||
| 112076 | 112227 | |
| 112077 | 112228 | case SQLITE_CONFIG_URI: { |
| 112078 | 112229 | sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); |
| 112079 | 112230 | break; |
| 112080 | 112231 | } |
| 112232 | + | |
| 112233 | + case SQLITE_CONFIG_COVERING_INDEX_SCAN: { | |
| 112234 | + sqlite3GlobalConfig.bUseCis = va_arg(ap, int); | |
| 112235 | + break; | |
| 112236 | + } | |
| 112081 | 112237 | |
| 112082 | 112238 | default: { |
| 112083 | 112239 | rc = SQLITE_ERROR; |
| 112084 | 112240 | break; |
| 112085 | 112241 | } |
| @@ -113368,10 +113524,19 @@ | ||
| 113368 | 113524 | if( !db || db->mallocFailed ){ |
| 113369 | 113525 | return SQLITE_NOMEM; |
| 113370 | 113526 | } |
| 113371 | 113527 | return db->errCode; |
| 113372 | 113528 | } |
| 113529 | + | |
| 113530 | +/* | |
| 113531 | +** Return a string that describes the kind of error specified in the | |
| 113532 | +** argument. For now, this simply calls the internal sqlite3ErrStr() | |
| 113533 | +** function. | |
| 113534 | +*/ | |
| 113535 | +SQLITE_API const char *sqlite3_errstr(int rc){ | |
| 113536 | + return sqlite3ErrStr(rc); | |
| 113537 | +} | |
| 113373 | 113538 | |
| 113374 | 113539 | /* |
| 113375 | 113540 | ** Create a new collating function for database "db". The name is zName |
| 113376 | 113541 | ** and the encoding is enc. |
| 113377 | 113542 | */ |
| @@ -114343,11 +114508,11 @@ | ||
| 114343 | 114508 | */ |
| 114344 | 114509 | if( pCol ){ |
| 114345 | 114510 | zDataType = pCol->zType; |
| 114346 | 114511 | zCollSeq = pCol->zColl; |
| 114347 | 114512 | notnull = pCol->notNull!=0; |
| 114348 | - primarykey = pCol->isPrimKey!=0; | |
| 114513 | + primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; | |
| 114349 | 114514 | autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0; |
| 114350 | 114515 | }else{ |
| 114351 | 114516 | zDataType = "INTEGER"; |
| 114352 | 114517 | primarykey = 1; |
| 114353 | 114518 | } |
| 114354 | 114519 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.7.14. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | |
| 671 | ** |
| 672 | ** See also: [sqlite3_libversion()], |
| 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | */ |
| 676 | #define SQLITE_VERSION "3.7.14" |
| 677 | #define SQLITE_VERSION_NUMBER 3007014 |
| 678 | #define SQLITE_SOURCE_ID "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a" |
| 679 | |
| 680 | /* |
| 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | ** |
| @@ -1042,10 +1042,11 @@ | |
| 1042 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1043 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1044 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1045 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1046 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1047 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1048 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1049 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1050 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1051 | |
| @@ -2130,10 +2131,22 @@ | |
| 2130 | ** connection is opened. If it is globally disabled, filenames are |
| 2131 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 2132 | ** database connection is opened. By default, URI handling is globally |
| 2133 | ** disabled. The default value may be changed by compiling with the |
| 2134 | ** [SQLITE_USE_URI] symbol defined. |
| 2135 | ** |
| 2136 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 2137 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 2138 | ** <dd> These options are obsolete and should not be used by new code. |
| 2139 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -2156,10 +2169,11 @@ | |
| 2156 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 2157 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 2158 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 2159 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 2160 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 2161 | |
| 2162 | /* |
| 2163 | ** CAPI3REF: Database Connection Configuration Options |
| 2164 | ** |
| 2165 | ** These constants are the available integer configuration options that |
| @@ -3164,11 +3178,11 @@ | |
| 3164 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 3165 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 3166 | ** an error)^. |
| 3167 | ** ^If "ro" is specified, then the database is opened for read-only |
| 3168 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 3169 | ** third argument to sqlite3_prepare_v2(). ^If the mode option is set to |
| 3170 | ** "rw", then the database is opened for read-write (but not create) |
| 3171 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 3172 | ** been set. ^Value "rwc" is equivalent to setting both |
| 3173 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 3174 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -3315,10 +3329,15 @@ | |
| 3315 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 3316 | ** ^(Memory to hold the error message string is managed internally. |
| 3317 | ** The application does not need to worry about freeing the result. |
| 3318 | ** However, the error string might be overwritten or deallocated by |
| 3319 | ** subsequent calls to other SQLite interface functions.)^ |
| 3320 | ** |
| 3321 | ** When the serialized [threading mode] is in use, it might be the |
| 3322 | ** case that a second error occurs on a separate thread in between |
| 3323 | ** the time of the first error and the call to these interfaces. |
| 3324 | ** When that happens, the second error will be reported since these |
| @@ -3334,10 +3353,11 @@ | |
| 3334 | */ |
| 3335 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 3336 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 3337 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 3338 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 3339 | |
| 3340 | /* |
| 3341 | ** CAPI3REF: SQL Statement Object |
| 3342 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 3343 | ** |
| @@ -9959,20 +9979,18 @@ | |
| 9959 | /* |
| 9960 | ** Bits of the sqlite3.flags field that are used by the |
| 9961 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface. |
| 9962 | ** These must be the low-order bits of the flags field. |
| 9963 | */ |
| 9964 | #define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ |
| 9965 | #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 9966 | #define SQLITE_IndexSort 0x04 /* Disable indexes for sorting */ |
| 9967 | #define SQLITE_IndexSearch 0x08 /* Disable indexes for searching */ |
| 9968 | #define SQLITE_IndexCover 0x10 /* Disable index covering table */ |
| 9969 | #define SQLITE_GroupByOrder 0x20 /* Disable GROUPBY cover of ORDERBY */ |
| 9970 | #define SQLITE_FactorOutConst 0x40 /* Disable factoring out constants */ |
| 9971 | #define SQLITE_IdxRealAsInt 0x80 /* Store REAL as INT in indices */ |
| 9972 | #define SQLITE_DistinctOpt 0x80 /* DISTINCT using indexes */ |
| 9973 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9974 | |
| 9975 | /* |
| 9976 | ** Possible values for the sqlite.magic field. |
| 9977 | ** The numbers are obtained at random and have no special meaning, other |
| 9978 | ** than being distinct from one another. |
| @@ -10119,18 +10137,20 @@ | |
| 10119 | char *zName; /* Name of this column */ |
| 10120 | Expr *pDflt; /* Default value of this column */ |
| 10121 | char *zDflt; /* Original text of the default value */ |
| 10122 | char *zType; /* Data type for this column */ |
| 10123 | char *zColl; /* Collating sequence. If NULL, use the default */ |
| 10124 | u8 notNull; /* True if there is a NOT NULL constraint */ |
| 10125 | u8 isPrimKey; /* True if this column is part of the PRIMARY KEY */ |
| 10126 | char affinity; /* One of the SQLITE_AFF_... values */ |
| 10127 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10128 | u8 isHidden; /* True if this column is 'hidden' */ |
| 10129 | #endif |
| 10130 | }; |
| 10131 | |
| 10132 | /* |
| 10133 | ** A "Collating Sequence" is defined by an instance of the following |
| 10134 | ** structure. Conceptually, a collating sequence consists of a name and |
| 10135 | ** a comparison routine that defines the order of that sequence. |
| 10136 | ** |
| @@ -10282,32 +10302,32 @@ | |
| 10282 | ** sub-query that appears instead of a real table name in the FROM clause |
| 10283 | ** of a SELECT statement. |
| 10284 | */ |
| 10285 | struct Table { |
| 10286 | char *zName; /* Name of the table or view */ |
| 10287 | int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ |
| 10288 | int nCol; /* Number of columns in this table */ |
| 10289 | Column *aCol; /* Information about each column */ |
| 10290 | Index *pIndex; /* List of SQL indexes on this table. */ |
| 10291 | int tnum; /* Root BTree node for this table (see note above) */ |
| 10292 | tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ |
| 10293 | Select *pSelect; /* NULL for tables. Points to definition if a view. */ |
| 10294 | u16 nRef; /* Number of pointers to this Table */ |
| 10295 | u8 tabFlags; /* Mask of TF_* values */ |
| 10296 | u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ |
| 10297 | FKey *pFKey; /* Linked list of all foreign keys in this table */ |
| 10298 | char *zColAff; /* String defining the affinity of each column */ |
| 10299 | #ifndef SQLITE_OMIT_CHECK |
| 10300 | ExprList *pCheck; /* All CHECK constraints */ |
| 10301 | #endif |
| 10302 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 10303 | int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ |
| 10304 | #endif |
| 10305 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10306 | VTable *pVTable; /* List of VTable objects. */ |
| 10307 | int nModuleArg; /* Number of arguments to the module */ |
| 10308 | char **azModuleArg; /* Text of all module args. [0] is module name */ |
| 10309 | #endif |
| 10310 | Trigger *pTrigger; /* List of triggers stored in pSchema */ |
| 10311 | Schema *pSchema; /* Schema that contains this table */ |
| 10312 | Table *pNextZombie; /* Next on the Parse.pZombieTab list */ |
| 10313 | }; |
| @@ -10327,11 +10347,11 @@ | |
| 10327 | ** done as a macro so that it will be optimized out when virtual |
| 10328 | ** table support is omitted from the build. |
| 10329 | */ |
| 10330 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10331 | # define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) |
| 10332 | # define IsHiddenColumn(X) ((X)->isHidden) |
| 10333 | #else |
| 10334 | # define IsVirtual(X) 0 |
| 10335 | # define IsHiddenColumn(X) 0 |
| 10336 | #endif |
| 10337 | |
| @@ -10679,10 +10699,13 @@ | |
| 10679 | /* If the EP_Reduced flag is set in the Expr.flags mask, then no |
| 10680 | ** space is allocated for the fields below this point. An attempt to |
| 10681 | ** access them will result in a segfault or malfunction. |
| 10682 | *********************************************************************/ |
| 10683 | |
| 10684 | int iTable; /* TK_COLUMN: cursor number of table holding column |
| 10685 | ** TK_REGISTER: register number |
| 10686 | ** TK_TRIGGER: 1 -> new, 0 -> old */ |
| 10687 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 10688 | ** TK_VARIABLE: variable number (always >= 1). */ |
| @@ -10692,13 +10715,10 @@ | |
| 10692 | u8 op2; /* TK_REGISTER: original value of Expr.op |
| 10693 | ** TK_COLUMN: the value of p5 for OP_Column |
| 10694 | ** TK_AGG_FUNCTION: nesting depth */ |
| 10695 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 10696 | Table *pTab; /* Table for TK_COLUMN expressions. */ |
| 10697 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 10698 | int nHeight; /* Height of the tree headed by this node */ |
| 10699 | #endif |
| 10700 | }; |
| 10701 | |
| 10702 | /* |
| 10703 | ** The following are the meanings of bits in the Expr.flags field. |
| 10704 | */ |
| @@ -11459,10 +11479,11 @@ | |
| 11459 | struct Sqlite3Config { |
| 11460 | int bMemstat; /* True to enable memory status */ |
| 11461 | int bCoreMutex; /* True to enable core mutexing */ |
| 11462 | int bFullMutex; /* True to enable full mutexing */ |
| 11463 | int bOpenUri; /* True to interpret filenames as URIs */ |
| 11464 | int mxStrlen; /* Maximum string length */ |
| 11465 | int szLookaside; /* Default lookaside buffer size */ |
| 11466 | int nLookaside; /* Default lookaside buffer count */ |
| 11467 | sqlite3_mem_methods m; /* Low-level memory allocation interface */ |
| 11468 | sqlite3_mutex_methods mutex; /* Low-level mutex interface */ |
| @@ -11775,10 +11796,11 @@ | |
| 11775 | SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); |
| 11776 | #else |
| 11777 | # define sqlite3AutoincrementBegin(X) |
| 11778 | # define sqlite3AutoincrementEnd(X) |
| 11779 | #endif |
| 11780 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int); |
| 11781 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 11782 | SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 11783 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 11784 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| @@ -11950,11 +11972,11 @@ | |
| 11950 | SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); |
| 11951 | SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); |
| 11952 | SQLITE_PRIVATE int sqlite3Atoi(const char*); |
| 11953 | SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); |
| 11954 | SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); |
| 11955 | SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8*, const u8**); |
| 11956 | |
| 11957 | /* |
| 11958 | ** Routines to read and write variable-length integers. These used to |
| 11959 | ** be defined locally, but now we use the varint routines in the util.c |
| 11960 | ** file. Code should use the MACRO forms below, as the Varint32 versions |
| @@ -12450,19 +12472,24 @@ | |
| 12450 | |
| 12451 | #ifndef SQLITE_USE_URI |
| 12452 | # define SQLITE_USE_URI 0 |
| 12453 | #endif |
| 12454 | |
| 12455 | /* |
| 12456 | ** The following singleton contains the global configuration for |
| 12457 | ** the SQLite library. |
| 12458 | */ |
| 12459 | SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { |
| 12460 | SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ |
| 12461 | 1, /* bCoreMutex */ |
| 12462 | SQLITE_THREADSAFE==1, /* bFullMutex */ |
| 12463 | SQLITE_USE_URI, /* bOpenUri */ |
| 12464 | 0x7ffffffe, /* mxStrlen */ |
| 12465 | 128, /* szLookaside */ |
| 12466 | 500, /* nLookaside */ |
| 12467 | {0,0,0,0,0,0,0,0}, /* m */ |
| 12468 | {0,0,0,0,0,0,0,0,0}, /* mutex */ |
| @@ -12876,10 +12903,13 @@ | |
| 12876 | #ifdef SQLITE_PERFORMANCE_TRACE |
| 12877 | "PERFORMANCE_TRACE", |
| 12878 | #endif |
| 12879 | #ifdef SQLITE_PROXY_DEBUG |
| 12880 | "PROXY_DEBUG", |
| 12881 | #endif |
| 12882 | #ifdef SQLITE_SECURE_DELETE |
| 12883 | "SECURE_DELETE", |
| 12884 | #endif |
| 12885 | #ifdef SQLITE_SMALL_STACK |
| @@ -13234,10 +13264,15 @@ | |
| 13234 | int nIndent; /* Number of elements in aIndent */ |
| 13235 | u16 aIndent[100]; /* Levels of indentation */ |
| 13236 | char zBase[100]; /* Initial space */ |
| 13237 | }; |
| 13238 | |
| 13239 | /* |
| 13240 | ** An instance of the virtual machine. This structure contains the complete |
| 13241 | ** state of the virtual machine. |
| 13242 | ** |
| 13243 | ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() |
| @@ -13275,19 +13310,20 @@ | |
| 13275 | ynVar nzVar; /* Number of entries in azVar[] */ |
| 13276 | u32 cacheCtr; /* VdbeCursor row cache generation counter */ |
| 13277 | int pc; /* The program counter */ |
| 13278 | int rc; /* Value to return */ |
| 13279 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 13280 | u8 explain; /* True if EXPLAIN present on SQL command */ |
| 13281 | u8 changeCntOn; /* True to update the change-counter */ |
| 13282 | u8 expired; /* True if the VM needs to be recompiled */ |
| 13283 | u8 runOnlyOnce; /* Automatically expire on reset */ |
| 13284 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| 13285 | u8 inVtabMethod; /* See comments above */ |
| 13286 | u8 usesStmtJournal; /* True if uses a statement journal */ |
| 13287 | u8 readOnly; /* True for read-only statements */ |
| 13288 | u8 isPrepareV2; /* True if prepared with prepare_v2() */ |
| 13289 | int nChange; /* Number of db changes made since last reset */ |
| 13290 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 13291 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 13292 | int iStatement; /* Statement number (or 0 if has not opened stmt) */ |
| 13293 | int aCounter[3]; /* Counters used by sqlite3_stmt_status() */ |
| @@ -20525,29 +20561,27 @@ | |
| 20525 | if( c<0x80 \ |
| 20526 | || (c&0xFFFFF800)==0xD800 \ |
| 20527 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ |
| 20528 | } |
| 20529 | SQLITE_PRIVATE u32 sqlite3Utf8Read( |
| 20530 | const unsigned char *zIn, /* First byte of UTF-8 character */ |
| 20531 | const unsigned char **pzNext /* Write first byte past UTF-8 char here */ |
| 20532 | ){ |
| 20533 | unsigned int c; |
| 20534 | |
| 20535 | /* Same as READ_UTF8() above but without the zTerm parameter. |
| 20536 | ** For this routine, we assume the UTF8 string is always zero-terminated. |
| 20537 | */ |
| 20538 | c = *(zIn++); |
| 20539 | if( c>=0xc0 ){ |
| 20540 | c = sqlite3Utf8Trans1[c-0xc0]; |
| 20541 | while( (*zIn & 0xc0)==0x80 ){ |
| 20542 | c = (c<<6) + (0x3f & *(zIn++)); |
| 20543 | } |
| 20544 | if( c<0x80 |
| 20545 | || (c&0xFFFFF800)==0xD800 |
| 20546 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } |
| 20547 | } |
| 20548 | *pzNext = zIn; |
| 20549 | return c; |
| 20550 | } |
| 20551 | |
| 20552 | |
| 20553 | |
| @@ -20644,19 +20678,17 @@ | |
| 20644 | |
| 20645 | if( pMem->enc==SQLITE_UTF8 ){ |
| 20646 | if( desiredEnc==SQLITE_UTF16LE ){ |
| 20647 | /* UTF-8 -> UTF-16 Little-endian */ |
| 20648 | while( zIn<zTerm ){ |
| 20649 | /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */ |
| 20650 | READ_UTF8(zIn, zTerm, c); |
| 20651 | WRITE_UTF16LE(z, c); |
| 20652 | } |
| 20653 | }else{ |
| 20654 | assert( desiredEnc==SQLITE_UTF16BE ); |
| 20655 | /* UTF-8 -> UTF-16 Big-endian */ |
| 20656 | while( zIn<zTerm ){ |
| 20657 | /* c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); */ |
| 20658 | READ_UTF8(zIn, zTerm, c); |
| 20659 | WRITE_UTF16BE(z, c); |
| 20660 | } |
| 20661 | } |
| 20662 | pMem->n = (int)(z - zOut); |
| @@ -20780,11 +20812,11 @@ | |
| 20780 | unsigned char *zOut = zIn; |
| 20781 | unsigned char *zStart = zIn; |
| 20782 | u32 c; |
| 20783 | |
| 20784 | while( zIn[0] && zOut<=zIn ){ |
| 20785 | c = sqlite3Utf8Read(zIn, (const u8**)&zIn); |
| 20786 | if( c!=0xfffd ){ |
| 20787 | WRITE_UTF8(zOut, c); |
| 20788 | } |
| 20789 | } |
| 20790 | *zOut = 0; |
| @@ -20885,11 +20917,11 @@ | |
| 20885 | WRITE_UTF8(z, i); |
| 20886 | n = (int)(z-zBuf); |
| 20887 | assert( n>0 && n<=4 ); |
| 20888 | z[0] = 0; |
| 20889 | z = zBuf; |
| 20890 | c = sqlite3Utf8Read(z, (const u8**)&z); |
| 20891 | t = i; |
| 20892 | if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD; |
| 20893 | if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD; |
| 20894 | assert( c==t ); |
| 20895 | assert( (z-zBuf)==n ); |
| @@ -29887,10 +29919,19 @@ | |
| 29887 | #endif /* !defined(_OS_COMMON_H_) */ |
| 29888 | |
| 29889 | /************** End of os_common.h *******************************************/ |
| 29890 | /************** Continuing where we left off in os_win.c *********************/ |
| 29891 | |
| 29892 | /* |
| 29893 | ** Macro to find the minimum of two numeric values. |
| 29894 | */ |
| 29895 | #ifndef MIN |
| 29896 | # define MIN(x,y) ((x)<(y)?(x):(y)) |
| @@ -30170,166 +30211,176 @@ | |
| 30170 | { "CreateFileW", (SYSCALL)0, 0 }, |
| 30171 | #endif |
| 30172 | |
| 30173 | #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \ |
| 30174 | LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent) |
| 30175 | |
| 30176 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 30177 | !defined(SQLITE_OMIT_WAL)) |
| 30178 | { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 }, |
| 30179 | #else |
| 30180 | { "CreateFileMappingW", (SYSCALL)0, 0 }, |
| 30181 | #endif |
| 30182 | |
| 30183 | #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 30184 | DWORD,DWORD,DWORD,LPCWSTR))aSyscall[6].pCurrent) |
| 30185 | |
| 30186 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30187 | { "CreateMutexW", (SYSCALL)CreateMutexW, 0 }, |
| 30188 | #else |
| 30189 | { "CreateMutexW", (SYSCALL)0, 0 }, |
| 30190 | #endif |
| 30191 | |
| 30192 | #define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \ |
| 30193 | LPCWSTR))aSyscall[7].pCurrent) |
| 30194 | |
| 30195 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30196 | { "DeleteFileA", (SYSCALL)DeleteFileA, 0 }, |
| 30197 | #else |
| 30198 | { "DeleteFileA", (SYSCALL)0, 0 }, |
| 30199 | #endif |
| 30200 | |
| 30201 | #define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[8].pCurrent) |
| 30202 | |
| 30203 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30204 | { "DeleteFileW", (SYSCALL)DeleteFileW, 0 }, |
| 30205 | #else |
| 30206 | { "DeleteFileW", (SYSCALL)0, 0 }, |
| 30207 | #endif |
| 30208 | |
| 30209 | #define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[9].pCurrent) |
| 30210 | |
| 30211 | #if SQLITE_OS_WINCE |
| 30212 | { "FileTimeToLocalFileTime", (SYSCALL)FileTimeToLocalFileTime, 0 }, |
| 30213 | #else |
| 30214 | { "FileTimeToLocalFileTime", (SYSCALL)0, 0 }, |
| 30215 | #endif |
| 30216 | |
| 30217 | #define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30218 | LPFILETIME))aSyscall[10].pCurrent) |
| 30219 | |
| 30220 | #if SQLITE_OS_WINCE |
| 30221 | { "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 }, |
| 30222 | #else |
| 30223 | { "FileTimeToSystemTime", (SYSCALL)0, 0 }, |
| 30224 | #endif |
| 30225 | |
| 30226 | #define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30227 | LPSYSTEMTIME))aSyscall[11].pCurrent) |
| 30228 | |
| 30229 | { "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 }, |
| 30230 | |
| 30231 | #define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[12].pCurrent) |
| 30232 | |
| 30233 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30234 | { "FormatMessageA", (SYSCALL)FormatMessageA, 0 }, |
| 30235 | #else |
| 30236 | { "FormatMessageA", (SYSCALL)0, 0 }, |
| 30237 | #endif |
| 30238 | |
| 30239 | #define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \ |
| 30240 | DWORD,va_list*))aSyscall[13].pCurrent) |
| 30241 | |
| 30242 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30243 | { "FormatMessageW", (SYSCALL)FormatMessageW, 0 }, |
| 30244 | #else |
| 30245 | { "FormatMessageW", (SYSCALL)0, 0 }, |
| 30246 | #endif |
| 30247 | |
| 30248 | #define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \ |
| 30249 | DWORD,va_list*))aSyscall[14].pCurrent) |
| 30250 | |
| 30251 | { "FreeLibrary", (SYSCALL)FreeLibrary, 0 }, |
| 30252 | |
| 30253 | #define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[15].pCurrent) |
| 30254 | |
| 30255 | { "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 }, |
| 30256 | |
| 30257 | #define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[16].pCurrent) |
| 30258 | |
| 30259 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30260 | { "GetDiskFreeSpaceA", (SYSCALL)GetDiskFreeSpaceA, 0 }, |
| 30261 | #else |
| 30262 | { "GetDiskFreeSpaceA", (SYSCALL)0, 0 }, |
| 30263 | #endif |
| 30264 | |
| 30265 | #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30266 | LPDWORD))aSyscall[17].pCurrent) |
| 30267 | |
| 30268 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30269 | { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 }, |
| 30270 | #else |
| 30271 | { "GetDiskFreeSpaceW", (SYSCALL)0, 0 }, |
| 30272 | #endif |
| 30273 | |
| 30274 | #define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30275 | LPDWORD))aSyscall[18].pCurrent) |
| 30276 | |
| 30277 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30278 | { "GetFileAttributesA", (SYSCALL)GetFileAttributesA, 0 }, |
| 30279 | #else |
| 30280 | { "GetFileAttributesA", (SYSCALL)0, 0 }, |
| 30281 | #endif |
| 30282 | |
| 30283 | #define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[19].pCurrent) |
| 30284 | |
| 30285 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30286 | { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 }, |
| 30287 | #else |
| 30288 | { "GetFileAttributesW", (SYSCALL)0, 0 }, |
| 30289 | #endif |
| 30290 | |
| 30291 | #define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[20].pCurrent) |
| 30292 | |
| 30293 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30294 | { "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 }, |
| 30295 | #else |
| 30296 | { "GetFileAttributesExW", (SYSCALL)0, 0 }, |
| 30297 | #endif |
| 30298 | |
| 30299 | #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \ |
| 30300 | LPVOID))aSyscall[21].pCurrent) |
| 30301 | |
| 30302 | #if !SQLITE_OS_WINRT |
| 30303 | { "GetFileSize", (SYSCALL)GetFileSize, 0 }, |
| 30304 | #else |
| 30305 | { "GetFileSize", (SYSCALL)0, 0 }, |
| 30306 | #endif |
| 30307 | |
| 30308 | #define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[22].pCurrent) |
| 30309 | |
| 30310 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30311 | { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 }, |
| 30312 | #else |
| 30313 | { "GetFullPathNameA", (SYSCALL)0, 0 }, |
| 30314 | #endif |
| 30315 | |
| 30316 | #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \ |
| 30317 | LPSTR*))aSyscall[23].pCurrent) |
| 30318 | |
| 30319 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30320 | { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 }, |
| 30321 | #else |
| 30322 | { "GetFullPathNameW", (SYSCALL)0, 0 }, |
| 30323 | #endif |
| 30324 | |
| 30325 | #define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \ |
| 30326 | LPWSTR*))aSyscall[24].pCurrent) |
| 30327 | |
| 30328 | { "GetLastError", (SYSCALL)GetLastError, 0 }, |
| 30329 | |
| 30330 | #define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[25].pCurrent) |
| 30331 | |
| 30332 | #if SQLITE_OS_WINCE |
| 30333 | /* The GetProcAddressA() routine is only available on Windows CE. */ |
| 30334 | { "GetProcAddressA", (SYSCALL)GetProcAddressA, 0 }, |
| 30335 | #else |
| @@ -30337,144 +30388,144 @@ | |
| 30337 | ** an ANSI string regardless of the _UNICODE setting */ |
| 30338 | { "GetProcAddressA", (SYSCALL)GetProcAddress, 0 }, |
| 30339 | #endif |
| 30340 | |
| 30341 | #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \ |
| 30342 | LPCSTR))aSyscall[26].pCurrent) |
| 30343 | |
| 30344 | #if !SQLITE_OS_WINRT |
| 30345 | { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 }, |
| 30346 | #else |
| 30347 | { "GetSystemInfo", (SYSCALL)0, 0 }, |
| 30348 | #endif |
| 30349 | |
| 30350 | #define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[27].pCurrent) |
| 30351 | |
| 30352 | { "GetSystemTime", (SYSCALL)GetSystemTime, 0 }, |
| 30353 | |
| 30354 | #define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[28].pCurrent) |
| 30355 | |
| 30356 | #if !SQLITE_OS_WINCE |
| 30357 | { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 }, |
| 30358 | #else |
| 30359 | { "GetSystemTimeAsFileTime", (SYSCALL)0, 0 }, |
| 30360 | #endif |
| 30361 | |
| 30362 | #define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \ |
| 30363 | LPFILETIME))aSyscall[29].pCurrent) |
| 30364 | |
| 30365 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30366 | { "GetTempPathA", (SYSCALL)GetTempPathA, 0 }, |
| 30367 | #else |
| 30368 | { "GetTempPathA", (SYSCALL)0, 0 }, |
| 30369 | #endif |
| 30370 | |
| 30371 | #define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[30].pCurrent) |
| 30372 | |
| 30373 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30374 | { "GetTempPathW", (SYSCALL)GetTempPathW, 0 }, |
| 30375 | #else |
| 30376 | { "GetTempPathW", (SYSCALL)0, 0 }, |
| 30377 | #endif |
| 30378 | |
| 30379 | #define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[31].pCurrent) |
| 30380 | |
| 30381 | #if !SQLITE_OS_WINRT |
| 30382 | { "GetTickCount", (SYSCALL)GetTickCount, 0 }, |
| 30383 | #else |
| 30384 | { "GetTickCount", (SYSCALL)0, 0 }, |
| 30385 | #endif |
| 30386 | |
| 30387 | #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[32].pCurrent) |
| 30388 | |
| 30389 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30390 | { "GetVersionExA", (SYSCALL)GetVersionExA, 0 }, |
| 30391 | #else |
| 30392 | { "GetVersionExA", (SYSCALL)0, 0 }, |
| 30393 | #endif |
| 30394 | |
| 30395 | #define osGetVersionExA ((BOOL(WINAPI*)( \ |
| 30396 | LPOSVERSIONINFOA))aSyscall[33].pCurrent) |
| 30397 | |
| 30398 | { "HeapAlloc", (SYSCALL)HeapAlloc, 0 }, |
| 30399 | |
| 30400 | #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \ |
| 30401 | SIZE_T))aSyscall[34].pCurrent) |
| 30402 | |
| 30403 | #if !SQLITE_OS_WINRT |
| 30404 | { "HeapCreate", (SYSCALL)HeapCreate, 0 }, |
| 30405 | #else |
| 30406 | { "HeapCreate", (SYSCALL)0, 0 }, |
| 30407 | #endif |
| 30408 | |
| 30409 | #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \ |
| 30410 | SIZE_T))aSyscall[35].pCurrent) |
| 30411 | |
| 30412 | #if !SQLITE_OS_WINRT |
| 30413 | { "HeapDestroy", (SYSCALL)HeapDestroy, 0 }, |
| 30414 | #else |
| 30415 | { "HeapDestroy", (SYSCALL)0, 0 }, |
| 30416 | #endif |
| 30417 | |
| 30418 | #define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[36].pCurrent) |
| 30419 | |
| 30420 | { "HeapFree", (SYSCALL)HeapFree, 0 }, |
| 30421 | |
| 30422 | #define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[37].pCurrent) |
| 30423 | |
| 30424 | { "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 }, |
| 30425 | |
| 30426 | #define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \ |
| 30427 | SIZE_T))aSyscall[38].pCurrent) |
| 30428 | |
| 30429 | { "HeapSize", (SYSCALL)HeapSize, 0 }, |
| 30430 | |
| 30431 | #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \ |
| 30432 | LPCVOID))aSyscall[39].pCurrent) |
| 30433 | |
| 30434 | #if !SQLITE_OS_WINRT |
| 30435 | { "HeapValidate", (SYSCALL)HeapValidate, 0 }, |
| 30436 | #else |
| 30437 | { "HeapValidate", (SYSCALL)0, 0 }, |
| 30438 | #endif |
| 30439 | |
| 30440 | #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \ |
| 30441 | LPCVOID))aSyscall[40].pCurrent) |
| 30442 | |
| 30443 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30444 | { "LoadLibraryA", (SYSCALL)LoadLibraryA, 0 }, |
| 30445 | #else |
| 30446 | { "LoadLibraryA", (SYSCALL)0, 0 }, |
| 30447 | #endif |
| 30448 | |
| 30449 | #define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[41].pCurrent) |
| 30450 | |
| 30451 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30452 | { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 }, |
| 30453 | #else |
| 30454 | { "LoadLibraryW", (SYSCALL)0, 0 }, |
| 30455 | #endif |
| 30456 | |
| 30457 | #define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[42].pCurrent) |
| 30458 | |
| 30459 | #if !SQLITE_OS_WINRT |
| 30460 | { "LocalFree", (SYSCALL)LocalFree, 0 }, |
| 30461 | #else |
| 30462 | { "LocalFree", (SYSCALL)0, 0 }, |
| 30463 | #endif |
| 30464 | |
| 30465 | #define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[43].pCurrent) |
| 30466 | |
| 30467 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30468 | { "LockFile", (SYSCALL)LockFile, 0 }, |
| 30469 | #else |
| 30470 | { "LockFile", (SYSCALL)0, 0 }, |
| 30471 | #endif |
| 30472 | |
| 30473 | #ifndef osLockFile |
| 30474 | #define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30475 | DWORD))aSyscall[44].pCurrent) |
| 30476 | #endif |
| 30477 | |
| 30478 | #if !SQLITE_OS_WINCE |
| 30479 | { "LockFileEx", (SYSCALL)LockFileEx, 0 }, |
| 30480 | #else |
| @@ -30481,218 +30532,218 @@ | |
| 30481 | { "LockFileEx", (SYSCALL)0, 0 }, |
| 30482 | #endif |
| 30483 | |
| 30484 | #ifndef osLockFileEx |
| 30485 | #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \ |
| 30486 | LPOVERLAPPED))aSyscall[45].pCurrent) |
| 30487 | #endif |
| 30488 | |
| 30489 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)) |
| 30490 | { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 }, |
| 30491 | #else |
| 30492 | { "MapViewOfFile", (SYSCALL)0, 0 }, |
| 30493 | #endif |
| 30494 | |
| 30495 | #define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30496 | SIZE_T))aSyscall[46].pCurrent) |
| 30497 | |
| 30498 | { "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 }, |
| 30499 | |
| 30500 | #define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \ |
| 30501 | int))aSyscall[47].pCurrent) |
| 30502 | |
| 30503 | { "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 }, |
| 30504 | |
| 30505 | #define osQueryPerformanceCounter ((BOOL(WINAPI*)( \ |
| 30506 | LARGE_INTEGER*))aSyscall[48].pCurrent) |
| 30507 | |
| 30508 | { "ReadFile", (SYSCALL)ReadFile, 0 }, |
| 30509 | |
| 30510 | #define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \ |
| 30511 | LPOVERLAPPED))aSyscall[49].pCurrent) |
| 30512 | |
| 30513 | { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 }, |
| 30514 | |
| 30515 | #define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[50].pCurrent) |
| 30516 | |
| 30517 | #if !SQLITE_OS_WINRT |
| 30518 | { "SetFilePointer", (SYSCALL)SetFilePointer, 0 }, |
| 30519 | #else |
| 30520 | { "SetFilePointer", (SYSCALL)0, 0 }, |
| 30521 | #endif |
| 30522 | |
| 30523 | #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \ |
| 30524 | DWORD))aSyscall[51].pCurrent) |
| 30525 | |
| 30526 | #if !SQLITE_OS_WINRT |
| 30527 | { "Sleep", (SYSCALL)Sleep, 0 }, |
| 30528 | #else |
| 30529 | { "Sleep", (SYSCALL)0, 0 }, |
| 30530 | #endif |
| 30531 | |
| 30532 | #define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[52].pCurrent) |
| 30533 | |
| 30534 | { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 }, |
| 30535 | |
| 30536 | #define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \ |
| 30537 | LPFILETIME))aSyscall[53].pCurrent) |
| 30538 | |
| 30539 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30540 | { "UnlockFile", (SYSCALL)UnlockFile, 0 }, |
| 30541 | #else |
| 30542 | { "UnlockFile", (SYSCALL)0, 0 }, |
| 30543 | #endif |
| 30544 | |
| 30545 | #ifndef osUnlockFile |
| 30546 | #define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30547 | DWORD))aSyscall[54].pCurrent) |
| 30548 | #endif |
| 30549 | |
| 30550 | #if !SQLITE_OS_WINCE |
| 30551 | { "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 }, |
| 30552 | #else |
| 30553 | { "UnlockFileEx", (SYSCALL)0, 0 }, |
| 30554 | #endif |
| 30555 | |
| 30556 | #define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30557 | LPOVERLAPPED))aSyscall[55].pCurrent) |
| 30558 | |
| 30559 | #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) |
| 30560 | { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 }, |
| 30561 | #else |
| 30562 | { "UnmapViewOfFile", (SYSCALL)0, 0 }, |
| 30563 | #endif |
| 30564 | |
| 30565 | #define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[56].pCurrent) |
| 30566 | |
| 30567 | { "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 }, |
| 30568 | |
| 30569 | #define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \ |
| 30570 | LPCSTR,LPBOOL))aSyscall[57].pCurrent) |
| 30571 | |
| 30572 | { "WriteFile", (SYSCALL)WriteFile, 0 }, |
| 30573 | |
| 30574 | #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \ |
| 30575 | LPOVERLAPPED))aSyscall[58].pCurrent) |
| 30576 | |
| 30577 | #if SQLITE_OS_WINRT |
| 30578 | { "CreateEventExW", (SYSCALL)CreateEventExW, 0 }, |
| 30579 | #else |
| 30580 | { "CreateEventExW", (SYSCALL)0, 0 }, |
| 30581 | #endif |
| 30582 | |
| 30583 | #define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \ |
| 30584 | DWORD,DWORD))aSyscall[59].pCurrent) |
| 30585 | |
| 30586 | #if !SQLITE_OS_WINRT |
| 30587 | { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 }, |
| 30588 | #else |
| 30589 | { "WaitForSingleObject", (SYSCALL)0, 0 }, |
| 30590 | #endif |
| 30591 | |
| 30592 | #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \ |
| 30593 | DWORD))aSyscall[60].pCurrent) |
| 30594 | |
| 30595 | #if SQLITE_OS_WINRT |
| 30596 | { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 }, |
| 30597 | #else |
| 30598 | { "WaitForSingleObjectEx", (SYSCALL)0, 0 }, |
| 30599 | #endif |
| 30600 | |
| 30601 | #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ |
| 30602 | BOOL))aSyscall[61].pCurrent) |
| 30603 | |
| 30604 | #if SQLITE_OS_WINRT |
| 30605 | { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, |
| 30606 | #else |
| 30607 | { "SetFilePointerEx", (SYSCALL)0, 0 }, |
| 30608 | #endif |
| 30609 | |
| 30610 | #define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \ |
| 30611 | PLARGE_INTEGER,DWORD))aSyscall[62].pCurrent) |
| 30612 | |
| 30613 | #if SQLITE_OS_WINRT |
| 30614 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, |
| 30615 | #else |
| 30616 | { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, |
| 30617 | #endif |
| 30618 | |
| 30619 | #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ |
| 30620 | FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[63].pCurrent) |
| 30621 | |
| 30622 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30623 | { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 }, |
| 30624 | #else |
| 30625 | { "MapViewOfFileFromApp", (SYSCALL)0, 0 }, |
| 30626 | #endif |
| 30627 | |
| 30628 | #define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \ |
| 30629 | SIZE_T))aSyscall[64].pCurrent) |
| 30630 | |
| 30631 | #if SQLITE_OS_WINRT |
| 30632 | { "CreateFile2", (SYSCALL)CreateFile2, 0 }, |
| 30633 | #else |
| 30634 | { "CreateFile2", (SYSCALL)0, 0 }, |
| 30635 | #endif |
| 30636 | |
| 30637 | #define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \ |
| 30638 | LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[65].pCurrent) |
| 30639 | |
| 30640 | #if SQLITE_OS_WINRT |
| 30641 | { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 }, |
| 30642 | #else |
| 30643 | { "LoadPackagedLibrary", (SYSCALL)0, 0 }, |
| 30644 | #endif |
| 30645 | |
| 30646 | #define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \ |
| 30647 | DWORD))aSyscall[66].pCurrent) |
| 30648 | |
| 30649 | #if SQLITE_OS_WINRT |
| 30650 | { "GetTickCount64", (SYSCALL)GetTickCount64, 0 }, |
| 30651 | #else |
| 30652 | { "GetTickCount64", (SYSCALL)0, 0 }, |
| 30653 | #endif |
| 30654 | |
| 30655 | #define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[67].pCurrent) |
| 30656 | |
| 30657 | #if SQLITE_OS_WINRT |
| 30658 | { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 }, |
| 30659 | #else |
| 30660 | { "GetNativeSystemInfo", (SYSCALL)0, 0 }, |
| 30661 | #endif |
| 30662 | |
| 30663 | #define osGetNativeSystemInfo ((VOID(WINAPI*)( \ |
| 30664 | LPSYSTEM_INFO))aSyscall[68].pCurrent) |
| 30665 | |
| 30666 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30667 | { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 }, |
| 30668 | #else |
| 30669 | { "OutputDebugStringA", (SYSCALL)0, 0 }, |
| 30670 | #endif |
| 30671 | |
| 30672 | #define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[69].pCurrent) |
| 30673 | |
| 30674 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30675 | { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 }, |
| 30676 | #else |
| 30677 | { "OutputDebugStringW", (SYSCALL)0, 0 }, |
| 30678 | #endif |
| 30679 | |
| 30680 | #define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[70].pCurrent) |
| 30681 | |
| 30682 | { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 }, |
| 30683 | |
| 30684 | #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[71].pCurrent) |
| 30685 | |
| 30686 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30687 | { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 }, |
| 30688 | #else |
| 30689 | { "CreateFileMappingFromApp", (SYSCALL)0, 0 }, |
| 30690 | #endif |
| 30691 | |
| 30692 | #define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \ |
| 30693 | LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[72].pCurrent) |
| 30694 | |
| 30695 | }; /* End of the overrideable system calls */ |
| 30696 | |
| 30697 | /* |
| 30698 | ** This is the xSetSystemCall() method of sqlite3_vfs for all of the |
| @@ -30846,10 +30897,12 @@ | |
| 30846 | ** WinNT/2K/XP so that we will know whether or not we can safely call |
| 30847 | ** the LockFileEx() API. |
| 30848 | */ |
| 30849 | #if SQLITE_OS_WINCE || SQLITE_OS_WINRT |
| 30850 | # define isNT() (1) |
| 30851 | #else |
| 30852 | static int isNT(void){ |
| 30853 | if( sqlite3_os_type==0 ){ |
| 30854 | OSVERSIONINFOA sInfo; |
| 30855 | sInfo.dwOSVersionInfoSize = sizeof(sInfo); |
| @@ -30856,11 +30909,11 @@ | |
| 30856 | osGetVersionExA(&sInfo); |
| 30857 | sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; |
| 30858 | } |
| 30859 | return sqlite3_os_type==2; |
| 30860 | } |
| 30861 | #endif /* SQLITE_OS_WINCE */ |
| 30862 | |
| 30863 | #ifdef SQLITE_WIN32_MALLOC |
| 30864 | /* |
| 30865 | ** Allocate nBytes of memory. |
| 30866 | */ |
| @@ -31066,11 +31119,11 @@ | |
| 31066 | |
| 31067 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0); |
| 31068 | if( nChar==0 ){ |
| 31069 | return 0; |
| 31070 | } |
| 31071 | zWideFilename = sqlite3_malloc( nChar*sizeof(zWideFilename[0]) ); |
| 31072 | if( zWideFilename==0 ){ |
| 31073 | return 0; |
| 31074 | } |
| 31075 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, |
| 31076 | nChar); |
| @@ -31091,11 +31144,11 @@ | |
| 31091 | |
| 31092 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31093 | if( nByte == 0 ){ |
| 31094 | return 0; |
| 31095 | } |
| 31096 | zFilename = sqlite3_malloc( nByte ); |
| 31097 | if( zFilename==0 ){ |
| 31098 | return 0; |
| 31099 | } |
| 31100 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte, |
| 31101 | 0, 0); |
| @@ -31121,11 +31174,11 @@ | |
| 31121 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, NULL, |
| 31122 | 0)*sizeof(WCHAR); |
| 31123 | if( nByte==0 ){ |
| 31124 | return 0; |
| 31125 | } |
| 31126 | zMbcsFilename = sqlite3_malloc( nByte*sizeof(zMbcsFilename[0]) ); |
| 31127 | if( zMbcsFilename==0 ){ |
| 31128 | return 0; |
| 31129 | } |
| 31130 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, |
| 31131 | nByte); |
| @@ -31150,11 +31203,11 @@ | |
| 31150 | |
| 31151 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31152 | if( nByte == 0 ){ |
| 31153 | return 0; |
| 31154 | } |
| 31155 | zFilename = sqlite3_malloc( nByte ); |
| 31156 | if( zFilename==0 ){ |
| 31157 | return 0; |
| 31158 | } |
| 31159 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, |
| 31160 | nByte, 0, 0); |
| @@ -32797,20 +32850,18 @@ | |
| 32797 | assert( pDbFd->pShm==0 ); /* Not previously opened */ |
| 32798 | |
| 32799 | /* Allocate space for the new sqlite3_shm object. Also speculatively |
| 32800 | ** allocate space for a new winShmNode and filename. |
| 32801 | */ |
| 32802 | p = sqlite3_malloc( sizeof(*p) ); |
| 32803 | if( p==0 ) return SQLITE_IOERR_NOMEM; |
| 32804 | memset(p, 0, sizeof(*p)); |
| 32805 | nName = sqlite3Strlen30(pDbFd->zPath); |
| 32806 | pNew = sqlite3_malloc( sizeof(*pShmNode) + nName + 17 ); |
| 32807 | if( pNew==0 ){ |
| 32808 | sqlite3_free(p); |
| 32809 | return SQLITE_IOERR_NOMEM; |
| 32810 | } |
| 32811 | memset(pNew, 0, sizeof(*pNew) + nName + 17); |
| 32812 | pNew->zFilename = (char*)&pNew[1]; |
| 32813 | sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); |
| 32814 | sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); |
| 32815 | |
| 32816 | /* Look to see if there is an existing winShmNode that can be used. |
| @@ -33143,21 +33194,25 @@ | |
| 33143 | goto shmpage_out; |
| 33144 | } |
| 33145 | pShmNode->aRegion = apNew; |
| 33146 | |
| 33147 | while( pShmNode->nRegion<=iRegion ){ |
| 33148 | HANDLE hMap; /* file-mapping handle */ |
| 33149 | void *pMap = 0; /* Mapped memory region */ |
| 33150 | |
| 33151 | #if SQLITE_OS_WINRT |
| 33152 | hMap = osCreateFileMappingFromApp(pShmNode->hFile.h, |
| 33153 | NULL, PAGE_READWRITE, nByte, NULL |
| 33154 | ); |
| 33155 | #else |
| 33156 | hMap = osCreateFileMappingW(pShmNode->hFile.h, |
| 33157 | NULL, PAGE_READWRITE, 0, nByte, NULL |
| 33158 | ); |
| 33159 | #endif |
| 33160 | OSTRACE(("SHM-MAP pid-%d create region=%d nbyte=%d %s\n", |
| 33161 | (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte, |
| 33162 | hMap ? "ok" : "failed")); |
| 33163 | if( hMap ){ |
| @@ -33902,11 +33957,11 @@ | |
| 33902 | } |
| 33903 | return SQLITE_OK; |
| 33904 | #endif |
| 33905 | |
| 33906 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 33907 | int nByte; |
| 33908 | void *zConverted; |
| 33909 | char *zOut; |
| 33910 | |
| 33911 | /* If this path name begins with "/X:", where "X" is any alphabetic |
| 33912 | ** character, discard the initial "/" from the pathname. |
| @@ -33936,31 +33991,59 @@ | |
| 33936 | if( zConverted==0 ){ |
| 33937 | return SQLITE_IOERR_NOMEM; |
| 33938 | } |
| 33939 | if( isNT() ){ |
| 33940 | LPWSTR zTemp; |
| 33941 | nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0) + 3; |
| 33942 | zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) ); |
| 33943 | if( zTemp==0 ){ |
| 33944 | sqlite3_free(zConverted); |
| 33945 | return SQLITE_IOERR_NOMEM; |
| 33946 | } |
| 33947 | osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); |
| 33948 | sqlite3_free(zConverted); |
| 33949 | zOut = unicodeToUtf8(zTemp); |
| 33950 | sqlite3_free(zTemp); |
| 33951 | } |
| 33952 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 33953 | else{ |
| 33954 | char *zTemp; |
| 33955 | nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0) + 3; |
| 33956 | zTemp = sqlite3_malloc( nByte*sizeof(zTemp[0]) ); |
| 33957 | if( zTemp==0 ){ |
| 33958 | sqlite3_free(zConverted); |
| 33959 | return SQLITE_IOERR_NOMEM; |
| 33960 | } |
| 33961 | osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); |
| 33962 | sqlite3_free(zConverted); |
| 33963 | zOut = sqlite3_win32_mbcs_to_utf8(zTemp); |
| 33964 | sqlite3_free(zTemp); |
| 33965 | } |
| 33966 | #endif |
| @@ -34214,11 +34297,11 @@ | |
| 34214 | winNextSystemCall, /* xNextSystemCall */ |
| 34215 | }; |
| 34216 | |
| 34217 | /* Double-check that the aSyscall[] array has been constructed |
| 34218 | ** correctly. See ticket [bb3a86e890c8e96ab] */ |
| 34219 | assert( ArraySize(aSyscall)==73 ); |
| 34220 | |
| 34221 | #ifndef SQLITE_OMIT_WAL |
| 34222 | /* get memory map allocation granularity */ |
| 34223 | memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); |
| 34224 | #if SQLITE_OS_WINRT |
| @@ -34233,11 +34316,11 @@ | |
| 34233 | return SQLITE_OK; |
| 34234 | } |
| 34235 | |
| 34236 | SQLITE_API int sqlite3_os_end(void){ |
| 34237 | #if SQLITE_OS_WINRT |
| 34238 | if( sleepObj != NULL ){ |
| 34239 | osCloseHandle(sleepObj); |
| 34240 | sleepObj = NULL; |
| 34241 | } |
| 34242 | #endif |
| 34243 | return SQLITE_OK; |
| @@ -41395,11 +41478,11 @@ | |
| 41395 | assert( nPathname>0 ); |
| 41396 | pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUri); |
| 41397 | memcpy(pPager->zFilename, zPathname, nPathname); |
| 41398 | if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri); |
| 41399 | memcpy(pPager->zJournal, zPathname, nPathname); |
| 41400 | memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+1); |
| 41401 | sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal); |
| 41402 | #ifndef SQLITE_OMIT_WAL |
| 41403 | pPager->zWal = &pPager->zJournal[nPathname+8+1]; |
| 41404 | memcpy(pPager->zWal, zPathname, nPathname); |
| 41405 | memcpy(&pPager->zWal[nPathname], "-wal\000", 4+1); |
| @@ -58860,14 +58943,13 @@ | |
| 58860 | pOp->p4.pKeyInfo = pKeyInfo; |
| 58861 | if( pKeyInfo ){ |
| 58862 | u8 *aSortOrder; |
| 58863 | memcpy((char*)pKeyInfo, zP4, nByte - nField); |
| 58864 | aSortOrder = pKeyInfo->aSortOrder; |
| 58865 | if( aSortOrder ){ |
| 58866 | pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField]; |
| 58867 | memcpy(pKeyInfo->aSortOrder, aSortOrder, nField); |
| 58868 | } |
| 58869 | pOp->p4type = P4_KEYINFO; |
| 58870 | }else{ |
| 58871 | p->db->mallocFailed = 1; |
| 58872 | pOp->p4type = P4_NOTUSED; |
| 58873 | } |
| @@ -58976,10 +59058,11 @@ | |
| 58976 | switch( pOp->p4type ){ |
| 58977 | case P4_KEYINFO_STATIC: |
| 58978 | case P4_KEYINFO: { |
| 58979 | int i, j; |
| 58980 | KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; |
| 58981 | sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField); |
| 58982 | i = sqlite3Strlen30(zTemp); |
| 58983 | for(j=0; j<pKeyInfo->nField; j++){ |
| 58984 | CollSeq *pColl = pKeyInfo->aColl[j]; |
| 58985 | if( pColl ){ |
| @@ -58987,11 +59070,11 @@ | |
| 58987 | if( i+n>nTemp-6 ){ |
| 58988 | memcpy(&zTemp[i],",...",4); |
| 58989 | break; |
| 58990 | } |
| 58991 | zTemp[i++] = ','; |
| 58992 | if( pKeyInfo->aSortOrder && pKeyInfo->aSortOrder[j] ){ |
| 58993 | zTemp[i++] = '-'; |
| 58994 | } |
| 58995 | memcpy(&zTemp[i], pColl->zName,n+1); |
| 58996 | i += n; |
| 58997 | }else if( i+4<nTemp-6 ){ |
| @@ -60698,21 +60781,20 @@ | |
| 60698 | if( flags&MEM_Int ){ |
| 60699 | /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */ |
| 60700 | # define MAX_6BYTE ((((i64)0x00008000)<<32)-1) |
| 60701 | i64 i = pMem->u.i; |
| 60702 | u64 u; |
| 60703 | if( file_format>=4 && (i&1)==i ){ |
| 60704 | return 8+(u32)i; |
| 60705 | } |
| 60706 | if( i<0 ){ |
| 60707 | if( i<(-MAX_6BYTE) ) return 6; |
| 60708 | /* Previous test prevents: u = -(-9223372036854775808) */ |
| 60709 | u = -i; |
| 60710 | }else{ |
| 60711 | u = i; |
| 60712 | } |
| 60713 | if( u<=127 ) return 1; |
| 60714 | if( u<=32767 ) return 2; |
| 60715 | if( u<=8388607 ) return 3; |
| 60716 | if( u<=2147483647 ) return 4; |
| 60717 | if( u<=MAX_6BYTE ) return 5; |
| 60718 | return 6; |
| @@ -60993,10 +61075,11 @@ | |
| 60993 | p = (UnpackedRecord*)&pSpace[nOff]; |
| 60994 | *ppFree = 0; |
| 60995 | } |
| 60996 | |
| 60997 | p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; |
| 60998 | p->pKeyInfo = pKeyInfo; |
| 60999 | p->nField = pKeyInfo->nField + 1; |
| 61000 | return p; |
| 61001 | } |
| 61002 | |
| @@ -61086,10 +61169,11 @@ | |
| 61086 | /* mem1.u.i = 0; // not needed, here to silence compiler warning */ |
| 61087 | |
| 61088 | idx1 = getVarint32(aKey1, szHdr1); |
| 61089 | d1 = szHdr1; |
| 61090 | nField = pKeyInfo->nField; |
| 61091 | while( idx1<szHdr1 && i<pPKey2->nField ){ |
| 61092 | u32 serial_type1; |
| 61093 | |
| 61094 | /* Read the serial types for the next element in each key. */ |
| 61095 | idx1 += getVarint32( aKey1+idx1, serial_type1 ); |
| @@ -61105,11 +61189,11 @@ | |
| 61105 | i<nField ? pKeyInfo->aColl[i] : 0); |
| 61106 | if( rc!=0 ){ |
| 61107 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 61108 | |
| 61109 | /* Invert the result if we are using DESC sort order. */ |
| 61110 | if( pKeyInfo->aSortOrder && i<nField && pKeyInfo->aSortOrder[i] ){ |
| 61111 | rc = -rc; |
| 61112 | } |
| 61113 | |
| 61114 | /* If the PREFIX_SEARCH flag is set and all fields except the final |
| 61115 | ** rowid field were equal, then clear the PREFIX_SEARCH flag and set |
| @@ -61831,14 +61915,16 @@ | |
| 61831 | if( vdbeSafetyNotNull(v) ){ |
| 61832 | return SQLITE_MISUSE_BKPT; |
| 61833 | } |
| 61834 | db = v->db; |
| 61835 | sqlite3_mutex_enter(db->mutex); |
| 61836 | while( (rc = sqlite3Step(v))==SQLITE_SCHEMA |
| 61837 | && cnt++ < SQLITE_MAX_SCHEMA_RETRY |
| 61838 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 61839 | sqlite3_reset(pStmt); |
| 61840 | assert( v->expired==0 ); |
| 61841 | } |
| 61842 | if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){ |
| 61843 | /* This case occurs after failing to recompile an sql statement. |
| 61844 | ** The error message from the SQL compiler has already been loaded |
| @@ -63957,11 +64043,10 @@ | |
| 63957 | struct OP_JournalMode_stack_vars { |
| 63958 | Btree *pBt; /* Btree to change journal mode of */ |
| 63959 | Pager *pPager; /* Pager associated with pBt */ |
| 63960 | int eNew; /* New journal mode */ |
| 63961 | int eOld; /* The old journal mode */ |
| 63962 | const char *zFilename; /* Name of database file for pPager */ |
| 63963 | } ci; |
| 63964 | struct OP_IncrVacuum_stack_vars { |
| 63965 | Btree *pBt; |
| 63966 | } cj; |
| 63967 | struct OP_VBegin_stack_vars { |
| @@ -69061,12 +69146,14 @@ | |
| 69061 | #if 0 /* local variables moved into u.ci */ |
| 69062 | Btree *pBt; /* Btree to change journal mode of */ |
| 69063 | Pager *pPager; /* Pager associated with pBt */ |
| 69064 | int eNew; /* New journal mode */ |
| 69065 | int eOld; /* The old journal mode */ |
| 69066 | const char *zFilename; /* Name of database file for pPager */ |
| 69067 | #endif /* local variables moved into u.ci */ |
| 69068 | |
| 69069 | u.ci.eNew = pOp->p3; |
| 69070 | assert( u.ci.eNew==PAGER_JOURNALMODE_DELETE |
| 69071 | || u.ci.eNew==PAGER_JOURNALMODE_TRUNCATE |
| 69072 | || u.ci.eNew==PAGER_JOURNALMODE_PERSIST |
| @@ -69082,17 +69169,17 @@ | |
| 69082 | u.ci.eOld = sqlite3PagerGetJournalMode(u.ci.pPager); |
| 69083 | if( u.ci.eNew==PAGER_JOURNALMODE_QUERY ) u.ci.eNew = u.ci.eOld; |
| 69084 | if( !sqlite3PagerOkToChangeJournalMode(u.ci.pPager) ) u.ci.eNew = u.ci.eOld; |
| 69085 | |
| 69086 | #ifndef SQLITE_OMIT_WAL |
| 69087 | u.ci.zFilename = sqlite3PagerFilename(u.ci.pPager, 1); |
| 69088 | |
| 69089 | /* Do not allow a transition to journal_mode=WAL for a database |
| 69090 | ** in temporary storage or if the VFS does not support shared memory |
| 69091 | */ |
| 69092 | if( u.ci.eNew==PAGER_JOURNALMODE_WAL |
| 69093 | && (sqlite3Strlen30(u.ci.zFilename)==0 /* Temp file */ |
| 69094 | || !sqlite3PagerWalSupported(u.ci.pPager)) /* No shared-memory support */ |
| 69095 | ){ |
| 69096 | u.ci.eNew = u.ci.eOld; |
| 69097 | } |
| 69098 | |
| @@ -69660,11 +69747,14 @@ | |
| 69660 | #if 0 /* local variables moved into u.cr */ |
| 69661 | char *zTrace; |
| 69662 | char *z; |
| 69663 | #endif /* local variables moved into u.cr */ |
| 69664 | |
| 69665 | if( db->xTrace && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 ){ |
| 69666 | u.cr.z = sqlite3VdbeExpandSql(p, u.cr.zTrace); |
| 69667 | db->xTrace(db->pTraceArg, u.cr.z); |
| 69668 | sqlite3DbFree(db, u.cr.z); |
| 69669 | } |
| 69670 | #ifdef SQLITE_DEBUG |
| @@ -74885,10 +74975,11 @@ | |
| 74885 | |
| 74886 | switch( pExpr->op ){ |
| 74887 | case TK_IN: { |
| 74888 | char affinity; /* Affinity of the LHS of the IN */ |
| 74889 | KeyInfo keyInfo; /* Keyinfo for the generated table */ |
| 74890 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 74891 | Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ |
| 74892 | |
| 74893 | if( rMayHaveNull ){ |
| 74894 | sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull); |
| @@ -74912,10 +75003,11 @@ | |
| 74912 | pExpr->iTable = pParse->nTab++; |
| 74913 | addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid); |
| 74914 | if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED); |
| 74915 | memset(&keyInfo, 0, sizeof(keyInfo)); |
| 74916 | keyInfo.nField = 1; |
| 74917 | |
| 74918 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 74919 | /* Case 1: expr IN (SELECT ...) |
| 74920 | ** |
| 74921 | ** Generate code to write the results of the select into the temporary |
| @@ -74952,10 +75044,11 @@ | |
| 74952 | |
| 74953 | if( !affinity ){ |
| 74954 | affinity = SQLITE_AFF_NONE; |
| 74955 | } |
| 74956 | keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
| 74957 | |
| 74958 | /* Loop through each expression in <exprlist>. */ |
| 74959 | r1 = sqlite3GetTempReg(pParse); |
| 74960 | r2 = sqlite3GetTempReg(pParse); |
| 74961 | sqlite3VdbeAddOp2(v, OP_Null, 0, r2); |
| @@ -78030,11 +78123,11 @@ | |
| 78030 | |
| 78031 | /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. |
| 78032 | ** If there is a NOT NULL constraint, then the default value for the |
| 78033 | ** column must not be NULL. |
| 78034 | */ |
| 78035 | if( pCol->isPrimKey ){ |
| 78036 | sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); |
| 78037 | return; |
| 78038 | } |
| 78039 | if( pNew->pIndex ){ |
| 78040 | sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); |
| @@ -81299,20 +81392,20 @@ | |
| 81299 | goto primary_key_exit; |
| 81300 | } |
| 81301 | pTab->tabFlags |= TF_HasPrimaryKey; |
| 81302 | if( pList==0 ){ |
| 81303 | iCol = pTab->nCol - 1; |
| 81304 | pTab->aCol[iCol].isPrimKey = 1; |
| 81305 | }else{ |
| 81306 | for(i=0; i<pList->nExpr; i++){ |
| 81307 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 81308 | if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ |
| 81309 | break; |
| 81310 | } |
| 81311 | } |
| 81312 | if( iCol<pTab->nCol ){ |
| 81313 | pTab->aCol[iCol].isPrimKey = 1; |
| 81314 | } |
| 81315 | } |
| 81316 | if( pList->nExpr>1 ) iCol = -1; |
| 81317 | } |
| 81318 | if( iCol>=0 && iCol<pTab->nCol ){ |
| @@ -85468,37 +85561,18 @@ | |
| 85468 | sqlite3_result_text(context, z1, n, sqlite3_free); |
| 85469 | } |
| 85470 | } |
| 85471 | } |
| 85472 | |
| 85473 | |
| 85474 | #if 0 /* This function is never used. */ |
| 85475 | /* |
| 85476 | ** The COALESCE() and IFNULL() functions used to be implemented as shown |
| 85477 | ** here. But now they are implemented as VDBE code so that unused arguments |
| 85478 | ** do not have to be computed. This legacy implementation is retained as |
| 85479 | ** comment. |
| 85480 | */ |
| 85481 | /* |
| 85482 | ** Implementation of the IFNULL(), NVL(), and COALESCE() functions. |
| 85483 | ** All three do the same thing. They return the first non-NULL |
| 85484 | ** argument. |
| 85485 | */ |
| 85486 | static void ifnullFunc( |
| 85487 | sqlite3_context *context, |
| 85488 | int argc, |
| 85489 | sqlite3_value **argv |
| 85490 | ){ |
| 85491 | int i; |
| 85492 | for(i=0; i<argc; i++){ |
| 85493 | if( SQLITE_NULL!=sqlite3_value_type(argv[i]) ){ |
| 85494 | sqlite3_result_value(context, argv[i]); |
| 85495 | break; |
| 85496 | } |
| 85497 | } |
| 85498 | } |
| 85499 | #endif /* NOT USED */ |
| 85500 | #define ifnullFunc versionFunc /* Substitute function - never called */ |
| 85501 | |
| 85502 | /* |
| 85503 | ** Implementation of random(). Return a random integer. |
| 85504 | */ |
| @@ -85613,11 +85687,11 @@ | |
| 85613 | ** character is exactly one byte in size. Also, all characters are |
| 85614 | ** able to participate in upper-case-to-lower-case mappings in EBCDIC |
| 85615 | ** whereas only characters less than 0x80 do in ASCII. |
| 85616 | */ |
| 85617 | #if defined(SQLITE_EBCDIC) |
| 85618 | # define sqlite3Utf8Read(A,C) (*(A++)) |
| 85619 | # define GlogUpperToLower(A) A = sqlite3UpperToLower[A] |
| 85620 | #else |
| 85621 | # define GlogUpperToLower(A) if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; } |
| 85622 | #endif |
| 85623 | |
| @@ -85670,22 +85744,22 @@ | |
| 85670 | u8 matchAll = pInfo->matchAll; |
| 85671 | u8 matchSet = pInfo->matchSet; |
| 85672 | u8 noCase = pInfo->noCase; |
| 85673 | int prevEscape = 0; /* True if the previous character was 'escape' */ |
| 85674 | |
| 85675 | while( (c = sqlite3Utf8Read(zPattern,&zPattern))!=0 ){ |
| 85676 | if( !prevEscape && c==matchAll ){ |
| 85677 | while( (c=sqlite3Utf8Read(zPattern,&zPattern)) == matchAll |
| 85678 | || c == matchOne ){ |
| 85679 | if( c==matchOne && sqlite3Utf8Read(zString, &zString)==0 ){ |
| 85680 | return 0; |
| 85681 | } |
| 85682 | } |
| 85683 | if( c==0 ){ |
| 85684 | return 1; |
| 85685 | }else if( c==esc ){ |
| 85686 | c = sqlite3Utf8Read(zPattern, &zPattern); |
| 85687 | if( c==0 ){ |
| 85688 | return 0; |
| 85689 | } |
| 85690 | }else if( c==matchSet ){ |
| 85691 | assert( esc==0 ); /* This is GLOB, not LIKE */ |
| @@ -85693,67 +85767,67 @@ | |
| 85693 | while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){ |
| 85694 | SQLITE_SKIP_UTF8(zString); |
| 85695 | } |
| 85696 | return *zString!=0; |
| 85697 | } |
| 85698 | while( (c2 = sqlite3Utf8Read(zString,&zString))!=0 ){ |
| 85699 | if( noCase ){ |
| 85700 | GlogUpperToLower(c2); |
| 85701 | GlogUpperToLower(c); |
| 85702 | while( c2 != 0 && c2 != c ){ |
| 85703 | c2 = sqlite3Utf8Read(zString, &zString); |
| 85704 | GlogUpperToLower(c2); |
| 85705 | } |
| 85706 | }else{ |
| 85707 | while( c2 != 0 && c2 != c ){ |
| 85708 | c2 = sqlite3Utf8Read(zString, &zString); |
| 85709 | } |
| 85710 | } |
| 85711 | if( c2==0 ) return 0; |
| 85712 | if( patternCompare(zPattern,zString,pInfo,esc) ) return 1; |
| 85713 | } |
| 85714 | return 0; |
| 85715 | }else if( !prevEscape && c==matchOne ){ |
| 85716 | if( sqlite3Utf8Read(zString, &zString)==0 ){ |
| 85717 | return 0; |
| 85718 | } |
| 85719 | }else if( c==matchSet ){ |
| 85720 | u32 prior_c = 0; |
| 85721 | assert( esc==0 ); /* This only occurs for GLOB, not LIKE */ |
| 85722 | seen = 0; |
| 85723 | invert = 0; |
| 85724 | c = sqlite3Utf8Read(zString, &zString); |
| 85725 | if( c==0 ) return 0; |
| 85726 | c2 = sqlite3Utf8Read(zPattern, &zPattern); |
| 85727 | if( c2=='^' ){ |
| 85728 | invert = 1; |
| 85729 | c2 = sqlite3Utf8Read(zPattern, &zPattern); |
| 85730 | } |
| 85731 | if( c2==']' ){ |
| 85732 | if( c==']' ) seen = 1; |
| 85733 | c2 = sqlite3Utf8Read(zPattern, &zPattern); |
| 85734 | } |
| 85735 | while( c2 && c2!=']' ){ |
| 85736 | if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){ |
| 85737 | c2 = sqlite3Utf8Read(zPattern, &zPattern); |
| 85738 | if( c>=prior_c && c<=c2 ) seen = 1; |
| 85739 | prior_c = 0; |
| 85740 | }else{ |
| 85741 | if( c==c2 ){ |
| 85742 | seen = 1; |
| 85743 | } |
| 85744 | prior_c = c2; |
| 85745 | } |
| 85746 | c2 = sqlite3Utf8Read(zPattern, &zPattern); |
| 85747 | } |
| 85748 | if( c2==0 || (seen ^ invert)==0 ){ |
| 85749 | return 0; |
| 85750 | } |
| 85751 | }else if( esc==c && !prevEscape ){ |
| 85752 | prevEscape = 1; |
| 85753 | }else{ |
| 85754 | c2 = sqlite3Utf8Read(zString, &zString); |
| 85755 | if( noCase ){ |
| 85756 | GlogUpperToLower(c); |
| 85757 | GlogUpperToLower(c2); |
| 85758 | } |
| 85759 | if( c!=c2 ){ |
| @@ -85821,11 +85895,11 @@ | |
| 85821 | if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ |
| 85822 | sqlite3_result_error(context, |
| 85823 | "ESCAPE expression must be a single character", -1); |
| 85824 | return; |
| 85825 | } |
| 85826 | escape = sqlite3Utf8Read(zEsc, &zEsc); |
| 85827 | } |
| 85828 | if( zA && zB ){ |
| 85829 | struct compareInfo *pInfo = sqlite3_user_data(context); |
| 85830 | #ifdef SQLITE_TEST |
| 85831 | sqlite3_like_count++; |
| @@ -87653,11 +87727,12 @@ | |
| 87653 | for(i=0; i<p->nCol; i++){ |
| 87654 | char *zKey = p->aCol[i].zCol; |
| 87655 | int iKey; |
| 87656 | for(iKey=0; iKey<pTab->nCol; iKey++){ |
| 87657 | Column *pCol = &pTab->aCol[iKey]; |
| 87658 | if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey) : pCol->isPrimKey) ){ |
| 87659 | if( aChange[iKey]>=0 ) return 1; |
| 87660 | if( iKey==pTab->iPKey && chngRowid ) return 1; |
| 87661 | } |
| 87662 | } |
| 87663 | } |
| @@ -88268,10 +88343,101 @@ | |
| 88268 | */ |
| 88269 | # define autoIncBegin(A,B,C) (0) |
| 88270 | # define autoIncStep(A,B,C) |
| 88271 | #endif /* SQLITE_OMIT_AUTOINCREMENT */ |
| 88272 | |
| 88273 | |
| 88274 | /* Forward declaration */ |
| 88275 | static int xferOptimization( |
| 88276 | Parse *pParse, /* Parser context */ |
| 88277 | Table *pDest, /* The table we are inserting into */ |
| @@ -88517,55 +88683,16 @@ | |
| 88517 | ** is coming from a SELECT statement, then generate a co-routine that |
| 88518 | ** produces a single row of the SELECT on each invocation. The |
| 88519 | ** co-routine is the common header to the 3rd and 4th templates. |
| 88520 | */ |
| 88521 | if( pSelect ){ |
| 88522 | /* Data is coming from a SELECT. Generate code to implement that SELECT |
| 88523 | ** as a co-routine. The code is common to both the 3rd and 4th |
| 88524 | ** templates: |
| 88525 | ** |
| 88526 | ** EOF <- 0 |
| 88527 | ** X <- A |
| 88528 | ** goto B |
| 88529 | ** A: setup for the SELECT |
| 88530 | ** loop over the tables in the SELECT |
| 88531 | ** load value into register R..R+n |
| 88532 | ** yield X |
| 88533 | ** end loop |
| 88534 | ** cleanup after the SELECT |
| 88535 | ** EOF <- 1 |
| 88536 | ** yield X |
| 88537 | ** halt-error |
| 88538 | ** |
| 88539 | ** On each invocation of the co-routine, it puts a single row of the |
| 88540 | ** SELECT result into registers dest.iMem...dest.iMem+dest.nMem-1. |
| 88541 | ** (These output registers are allocated by sqlite3Select().) When |
| 88542 | ** the SELECT completes, it sets the EOF flag stored in regEof. |
| 88543 | */ |
| 88544 | int rc, j1; |
| 88545 | |
| 88546 | regEof = ++pParse->nMem; |
| 88547 | sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof); /* EOF <- 0 */ |
| 88548 | VdbeComment((v, "SELECT eof flag")); |
| 88549 | sqlite3SelectDestInit(&dest, SRT_Coroutine, ++pParse->nMem); |
| 88550 | addrSelect = sqlite3VdbeCurrentAddr(v)+2; |
| 88551 | sqlite3VdbeAddOp2(v, OP_Integer, addrSelect-1, dest.iSDParm); |
| 88552 | j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); |
| 88553 | VdbeComment((v, "Jump over SELECT coroutine")); |
| 88554 | |
| 88555 | /* Resolve the expressions in the SELECT statement and execute it. */ |
| 88556 | rc = sqlite3Select(pParse, pSelect, &dest); |
| 88557 | assert( pParse->nErr==0 || rc ); |
| 88558 | if( rc || NEVER(pParse->nErr) || db->mallocFailed ){ |
| 88559 | goto insert_cleanup; |
| 88560 | } |
| 88561 | sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof); /* EOF <- 1 */ |
| 88562 | sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); /* yield X */ |
| 88563 | sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort); |
| 88564 | VdbeComment((v, "End of SELECT coroutine")); |
| 88565 | sqlite3VdbeJumpHere(v, j1); /* label B: */ |
| 88566 | |
| 88567 | regFromSelect = dest.iSdst; |
| 88568 | assert( pSelect->pEList ); |
| 88569 | nColumn = pSelect->pEList->nExpr; |
| 88570 | assert( dest.nSdst==nColumn ); |
| 88571 | |
| @@ -92035,11 +92162,12 @@ | |
| 92035 | if( pCol->zDflt ){ |
| 92036 | sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); |
| 92037 | }else{ |
| 92038 | sqlite3VdbeAddOp2(v, OP_Null, 0, 5); |
| 92039 | } |
| 92040 | sqlite3VdbeAddOp2(v, OP_Integer, pCol->isPrimKey, 6); |
| 92041 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6); |
| 92042 | } |
| 92043 | } |
| 92044 | }else |
| 92045 | |
| @@ -94803,11 +94931,11 @@ | |
| 94803 | ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. |
| 94804 | */ |
| 94805 | static int selectColumnsFromExprList( |
| 94806 | Parse *pParse, /* Parsing context */ |
| 94807 | ExprList *pEList, /* Expr list from which to derive column names */ |
| 94808 | int *pnCol, /* Write the number of columns here */ |
| 94809 | Column **paCol /* Write the new column list here */ |
| 94810 | ){ |
| 94811 | sqlite3 *db = pParse->db; /* Database connection */ |
| 94812 | int i, j; /* Loop counters */ |
| 94813 | int cnt; /* Index added to make the name unique */ |
| @@ -95449,10 +95577,11 @@ | |
| 95449 | *apColl = multiSelectCollSeq(pParse, p, i); |
| 95450 | if( 0==*apColl ){ |
| 95451 | *apColl = db->pDfltColl; |
| 95452 | } |
| 95453 | } |
| 95454 | |
| 95455 | for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ |
| 95456 | for(i=0; i<2; i++){ |
| 95457 | int addr = pLoop->addrOpenEphm[i]; |
| 95458 | if( addr<0 ){ |
| @@ -101068,11 +101197,11 @@ | |
| 101068 | }else{ |
| 101069 | int iCol; |
| 101070 | /* If everything went according to plan, link the new VTable structure |
| 101071 | ** into the linked list headed by pTab->pVTable. Then loop through the |
| 101072 | ** columns of the table to see if any of them contain the token "hidden". |
| 101073 | ** If so, set the Column.isHidden flag and remove the token from |
| 101074 | ** the type string. */ |
| 101075 | pVTable->pNext = pTab->pVTable; |
| 101076 | pTab->pVTable = pVTable; |
| 101077 | |
| 101078 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| @@ -101099,11 +101228,11 @@ | |
| 101099 | } |
| 101100 | if( zType[i]=='\0' && i>0 ){ |
| 101101 | assert(zType[i-1]==' '); |
| 101102 | zType[i-1] = '\0'; |
| 101103 | } |
| 101104 | pTab->aCol[iCol].isHidden = 1; |
| 101105 | } |
| 101106 | } |
| 101107 | } |
| 101108 | } |
| 101109 | |
| @@ -101901,10 +102030,11 @@ | |
| 101901 | #define WHERE_UNIQUE 0x04000000 /* Selects no more than one row */ |
| 101902 | #define WHERE_VIRTUALTABLE 0x08000000 /* Use virtual-table processing */ |
| 101903 | #define WHERE_MULTI_OR 0x10000000 /* OR using multiple indices */ |
| 101904 | #define WHERE_TEMP_INDEX 0x20000000 /* Uses an ephemeral index */ |
| 101905 | #define WHERE_DISTINCT 0x40000000 /* Correct order for DISTINCT */ |
| 101906 | |
| 101907 | /* |
| 101908 | ** Initialize a preallocated WhereClause structure. |
| 101909 | */ |
| 101910 | static void whereClauseInit( |
| @@ -104770,11 +104900,11 @@ | |
| 104770 | /* If currently calculating the cost of using an index (not the IPK |
| 104771 | ** index), determine if all required column data may be obtained without |
| 104772 | ** using the main table (i.e. if the index is a covering |
| 104773 | ** index for this query). If it is, set the WHERE_IDX_ONLY flag in |
| 104774 | ** wsFlags. Otherwise, set the bLookup variable to true. */ |
| 104775 | if( pIdx && wsFlags ){ |
| 104776 | Bitmask m = pSrc->colUsed; |
| 104777 | int j; |
| 104778 | for(j=0; j<pIdx->nColumn; j++){ |
| 104779 | int x = pIdx->aiColumn[j]; |
| 104780 | if( x<BMS-1 ){ |
| @@ -104835,11 +104965,24 @@ | |
| 104835 | ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do |
| 104836 | ** not give us data on the relative sizes of table and index records. |
| 104837 | ** So this computation assumes table records are about twice as big |
| 104838 | ** as index records |
| 104839 | */ |
| 104840 | if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ |
| 104841 | /* The cost of a full table scan is a number of move operations equal |
| 104842 | ** to the number of rows in the table. |
| 104843 | ** |
| 104844 | ** We add an additional 4x penalty to full table scans. This causes |
| 104845 | ** the cost function to err on the side of choosing an index over |
| @@ -104846,10 +104989,11 @@ | |
| 104846 | ** choosing a full scan. This 4x full-scan penalty is an arguable |
| 104847 | ** decision and one which we expect to revisit in the future. But |
| 104848 | ** it seems to be working well enough at the moment. |
| 104849 | */ |
| 104850 | cost = aiRowEst[0]*4; |
| 104851 | }else{ |
| 104852 | log10N = estLog(aiRowEst[0]); |
| 104853 | cost = nRow; |
| 104854 | if( pIdx ){ |
| 104855 | if( bLookup ){ |
| @@ -105889,10 +106033,15 @@ | |
| 105889 | pLevel->op = OP_Prev; |
| 105890 | }else{ |
| 105891 | pLevel->op = OP_Next; |
| 105892 | } |
| 105893 | pLevel->p1 = iIdxCur; |
| 105894 | }else |
| 105895 | |
| 105896 | #ifndef SQLITE_OMIT_OR_OPTIMIZATION |
| 105897 | if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){ |
| 105898 | /* Case 4: Two or more separately indexed terms connected by OR |
| @@ -106765,31 +106914,33 @@ | |
| 106765 | ** index name is '*'. |
| 106766 | */ |
| 106767 | for(i=0; i<nTabList; i++){ |
| 106768 | char *z; |
| 106769 | int n; |
| 106770 | pLevel = &pWInfo->a[i]; |
| 106771 | pTabItem = &pTabList->a[pLevel->iFrom]; |
| 106772 | z = pTabItem->zAlias; |
| 106773 | if( z==0 ) z = pTabItem->pTab->zName; |
| 106774 | n = sqlite3Strlen30(z); |
| 106775 | if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){ |
| 106776 | if( pLevel->plan.wsFlags & WHERE_IDX_ONLY ){ |
| 106777 | memcpy(&sqlite3_query_plan[nQPlan], "{}", 2); |
| 106778 | nQPlan += 2; |
| 106779 | }else{ |
| 106780 | memcpy(&sqlite3_query_plan[nQPlan], z, n); |
| 106781 | nQPlan += n; |
| 106782 | } |
| 106783 | sqlite3_query_plan[nQPlan++] = ' '; |
| 106784 | } |
| 106785 | testcase( pLevel->plan.wsFlags & WHERE_ROWID_EQ ); |
| 106786 | testcase( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ); |
| 106787 | if( pLevel->plan.wsFlags & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){ |
| 106788 | memcpy(&sqlite3_query_plan[nQPlan], "* ", 2); |
| 106789 | nQPlan += 2; |
| 106790 | }else if( (pLevel->plan.wsFlags & WHERE_INDEXED)!=0 ){ |
| 106791 | n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName); |
| 106792 | if( n+nQPlan < sizeof(sqlite3_query_plan)-2 ){ |
| 106793 | memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n); |
| 106794 | nQPlan += n; |
| 106795 | sqlite3_query_plan[nQPlan++] = ' '; |
| @@ -112076,10 +112227,15 @@ | |
| 112076 | |
| 112077 | case SQLITE_CONFIG_URI: { |
| 112078 | sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); |
| 112079 | break; |
| 112080 | } |
| 112081 | |
| 112082 | default: { |
| 112083 | rc = SQLITE_ERROR; |
| 112084 | break; |
| 112085 | } |
| @@ -113368,10 +113524,19 @@ | |
| 113368 | if( !db || db->mallocFailed ){ |
| 113369 | return SQLITE_NOMEM; |
| 113370 | } |
| 113371 | return db->errCode; |
| 113372 | } |
| 113373 | |
| 113374 | /* |
| 113375 | ** Create a new collating function for database "db". The name is zName |
| 113376 | ** and the encoding is enc. |
| 113377 | */ |
| @@ -114343,11 +114508,11 @@ | |
| 114343 | */ |
| 114344 | if( pCol ){ |
| 114345 | zDataType = pCol->zType; |
| 114346 | zCollSeq = pCol->zColl; |
| 114347 | notnull = pCol->notNull!=0; |
| 114348 | primarykey = pCol->isPrimKey!=0; |
| 114349 | autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0; |
| 114350 | }else{ |
| 114351 | zDataType = "INTEGER"; |
| 114352 | primarykey = 1; |
| 114353 | } |
| 114354 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -1,8 +1,8 @@ | |
| 1 | /****************************************************************************** |
| 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | ** version 3.7.15. By combining all the individual C code files into this |
| 4 | ** single large file, the entire code can be compiled as a single translation |
| 5 | ** unit. This allows many compilers to do optimizations that would not be |
| 6 | ** possible if the files were compiled separately. Performance improvements |
| 7 | ** of 5% or more are commonly seen when SQLite is compiled as a single |
| 8 | ** translation unit. |
| @@ -671,13 +671,13 @@ | |
| 671 | ** |
| 672 | ** See also: [sqlite3_libversion()], |
| 673 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 674 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 675 | */ |
| 676 | #define SQLITE_VERSION "3.7.15" |
| 677 | #define SQLITE_VERSION_NUMBER 3007015 |
| 678 | #define SQLITE_SOURCE_ID "2012-09-17 21:24:01 698b2a28004a9a2f0eabaadf36d833da4400b2bf" |
| 679 | |
| 680 | /* |
| 681 | ** CAPI3REF: Run-Time Library Version Numbers |
| 682 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 683 | ** |
| @@ -1042,10 +1042,11 @@ | |
| 1042 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 1043 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 1044 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 1045 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 1046 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1047 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 1048 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1049 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1050 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1051 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1052 | |
| @@ -2130,10 +2131,22 @@ | |
| 2131 | ** connection is opened. If it is globally disabled, filenames are |
| 2132 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 2133 | ** database connection is opened. By default, URI handling is globally |
| 2134 | ** disabled. The default value may be changed by compiling with the |
| 2135 | ** [SQLITE_USE_URI] symbol defined. |
| 2136 | ** |
| 2137 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 2138 | ** <dd> This option taks a single integer argument which is interpreted as |
| 2139 | ** a boolean in order to enable or disable the use of covering indices for |
| 2140 | ** full table scans in the query optimizer. The default setting is determined |
| 2141 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 2142 | ** if that compile-time option is omitted. |
| 2143 | ** The ability to disable the use of covering indices for full table scans |
| 2144 | ** is because some incorrectly coded legacy applications might malfunction |
| 2145 | ** malfunction when the optimization is enabled. Providing the ability to |
| 2146 | ** disable the optimization allows the older, buggy application code to work |
| 2147 | ** without change even with newer versions of SQLite. |
| 2148 | ** |
| 2149 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 2150 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 2151 | ** <dd> These options are obsolete and should not be used by new code. |
| 2152 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -2156,10 +2169,11 @@ | |
| 2169 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 2170 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 2171 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 2172 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 2173 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 2174 | #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ |
| 2175 | |
| 2176 | /* |
| 2177 | ** CAPI3REF: Database Connection Configuration Options |
| 2178 | ** |
| 2179 | ** These constants are the available integer configuration options that |
| @@ -3164,11 +3178,11 @@ | |
| 3178 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 3179 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 3180 | ** an error)^. |
| 3181 | ** ^If "ro" is specified, then the database is opened for read-only |
| 3182 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 3183 | ** third argument to sqlite3_open_v2(). ^If the mode option is set to |
| 3184 | ** "rw", then the database is opened for read-write (but not create) |
| 3185 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 3186 | ** been set. ^Value "rwc" is equivalent to setting both |
| 3187 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 3188 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -3315,10 +3329,15 @@ | |
| 3329 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 3330 | ** ^(Memory to hold the error message string is managed internally. |
| 3331 | ** The application does not need to worry about freeing the result. |
| 3332 | ** However, the error string might be overwritten or deallocated by |
| 3333 | ** subsequent calls to other SQLite interface functions.)^ |
| 3334 | ** |
| 3335 | ** ^The sqlite3_errstr() interface returns the English-language text |
| 3336 | ** that describes the [result code], as UTF-8. |
| 3337 | ** ^(Memory to hold the error message string is managed internally |
| 3338 | ** and must not be freed by the application)^. |
| 3339 | ** |
| 3340 | ** When the serialized [threading mode] is in use, it might be the |
| 3341 | ** case that a second error occurs on a separate thread in between |
| 3342 | ** the time of the first error and the call to these interfaces. |
| 3343 | ** When that happens, the second error will be reported since these |
| @@ -3334,10 +3353,11 @@ | |
| 3353 | */ |
| 3354 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 3355 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 3356 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 3357 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 3358 | SQLITE_API const char *sqlite3_errstr(int); |
| 3359 | |
| 3360 | /* |
| 3361 | ** CAPI3REF: SQL Statement Object |
| 3362 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 3363 | ** |
| @@ -9959,20 +9979,18 @@ | |
| 9979 | /* |
| 9980 | ** Bits of the sqlite3.flags field that are used by the |
| 9981 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface. |
| 9982 | ** These must be the low-order bits of the flags field. |
| 9983 | */ |
| 9984 | #define SQLITE_QueryFlattener 0x01 /* Disable query flattening */ |
| 9985 | #define SQLITE_ColumnCache 0x02 /* Disable the column cache */ |
| 9986 | #define SQLITE_GroupByOrder 0x04 /* Disable GROUPBY cover of ORDERBY */ |
| 9987 | #define SQLITE_FactorOutConst 0x08 /* Disable factoring out constants */ |
| 9988 | #define SQLITE_IdxRealAsInt 0x10 /* Store REAL as INT in indices */ |
| 9989 | #define SQLITE_DistinctOpt 0x20 /* DISTINCT using indexes */ |
| 9990 | #define SQLITE_CoverIdxScan 0x40 /* Disable covering index scans */ |
| 9991 | #define SQLITE_OptMask 0xff /* Mask of all disablable opts */ |
| 9992 | |
| 9993 | /* |
| 9994 | ** Possible values for the sqlite.magic field. |
| 9995 | ** The numbers are obtained at random and have no special meaning, other |
| 9996 | ** than being distinct from one another. |
| @@ -10119,18 +10137,20 @@ | |
| 10137 | char *zName; /* Name of this column */ |
| 10138 | Expr *pDflt; /* Default value of this column */ |
| 10139 | char *zDflt; /* Original text of the default value */ |
| 10140 | char *zType; /* Data type for this column */ |
| 10141 | char *zColl; /* Collating sequence. If NULL, use the default */ |
| 10142 | u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ |
| 10143 | char affinity; /* One of the SQLITE_AFF_... values */ |
| 10144 | u16 colFlags; /* Boolean properties. See COLFLAG_ defines below */ |
| 10145 | }; |
| 10146 | |
| 10147 | /* Allowed values for Column.colFlags: |
| 10148 | */ |
| 10149 | #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ |
| 10150 | #define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ |
| 10151 | |
| 10152 | /* |
| 10153 | ** A "Collating Sequence" is defined by an instance of the following |
| 10154 | ** structure. Conceptually, a collating sequence consists of a name and |
| 10155 | ** a comparison routine that defines the order of that sequence. |
| 10156 | ** |
| @@ -10282,32 +10302,32 @@ | |
| 10302 | ** sub-query that appears instead of a real table name in the FROM clause |
| 10303 | ** of a SELECT statement. |
| 10304 | */ |
| 10305 | struct Table { |
| 10306 | char *zName; /* Name of the table or view */ |
| 10307 | Column *aCol; /* Information about each column */ |
| 10308 | Index *pIndex; /* List of SQL indexes on this table. */ |
| 10309 | Select *pSelect; /* NULL for tables. Points to definition if a view. */ |
| 10310 | FKey *pFKey; /* Linked list of all foreign keys in this table */ |
| 10311 | char *zColAff; /* String defining the affinity of each column */ |
| 10312 | #ifndef SQLITE_OMIT_CHECK |
| 10313 | ExprList *pCheck; /* All CHECK constraints */ |
| 10314 | #endif |
| 10315 | tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ |
| 10316 | int tnum; /* Root BTree node for this table (see note above) */ |
| 10317 | i16 iPKey; /* If not negative, use aCol[iPKey] as the primary key */ |
| 10318 | i16 nCol; /* Number of columns in this table */ |
| 10319 | u16 nRef; /* Number of pointers to this Table */ |
| 10320 | u8 tabFlags; /* Mask of TF_* values */ |
| 10321 | u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ |
| 10322 | #ifndef SQLITE_OMIT_ALTERTABLE |
| 10323 | int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ |
| 10324 | #endif |
| 10325 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10326 | int nModuleArg; /* Number of arguments to the module */ |
| 10327 | char **azModuleArg; /* Text of all module args. [0] is module name */ |
| 10328 | VTable *pVTable; /* List of VTable objects. */ |
| 10329 | #endif |
| 10330 | Trigger *pTrigger; /* List of triggers stored in pSchema */ |
| 10331 | Schema *pSchema; /* Schema that contains this table */ |
| 10332 | Table *pNextZombie; /* Next on the Parse.pZombieTab list */ |
| 10333 | }; |
| @@ -10327,11 +10347,11 @@ | |
| 10347 | ** done as a macro so that it will be optimized out when virtual |
| 10348 | ** table support is omitted from the build. |
| 10349 | */ |
| 10350 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 10351 | # define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) |
| 10352 | # define IsHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0) |
| 10353 | #else |
| 10354 | # define IsVirtual(X) 0 |
| 10355 | # define IsHiddenColumn(X) 0 |
| 10356 | #endif |
| 10357 | |
| @@ -10679,10 +10699,13 @@ | |
| 10699 | /* If the EP_Reduced flag is set in the Expr.flags mask, then no |
| 10700 | ** space is allocated for the fields below this point. An attempt to |
| 10701 | ** access them will result in a segfault or malfunction. |
| 10702 | *********************************************************************/ |
| 10703 | |
| 10704 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 10705 | int nHeight; /* Height of the tree headed by this node */ |
| 10706 | #endif |
| 10707 | int iTable; /* TK_COLUMN: cursor number of table holding column |
| 10708 | ** TK_REGISTER: register number |
| 10709 | ** TK_TRIGGER: 1 -> new, 0 -> old */ |
| 10710 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 10711 | ** TK_VARIABLE: variable number (always >= 1). */ |
| @@ -10692,13 +10715,10 @@ | |
| 10715 | u8 op2; /* TK_REGISTER: original value of Expr.op |
| 10716 | ** TK_COLUMN: the value of p5 for OP_Column |
| 10717 | ** TK_AGG_FUNCTION: nesting depth */ |
| 10718 | AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ |
| 10719 | Table *pTab; /* Table for TK_COLUMN expressions. */ |
| 10720 | }; |
| 10721 | |
| 10722 | /* |
| 10723 | ** The following are the meanings of bits in the Expr.flags field. |
| 10724 | */ |
| @@ -11459,10 +11479,11 @@ | |
| 11479 | struct Sqlite3Config { |
| 11480 | int bMemstat; /* True to enable memory status */ |
| 11481 | int bCoreMutex; /* True to enable core mutexing */ |
| 11482 | int bFullMutex; /* True to enable full mutexing */ |
| 11483 | int bOpenUri; /* True to interpret filenames as URIs */ |
| 11484 | int bUseCis; /* Use covering indices for full-scans */ |
| 11485 | int mxStrlen; /* Maximum string length */ |
| 11486 | int szLookaside; /* Default lookaside buffer size */ |
| 11487 | int nLookaside; /* Default lookaside buffer count */ |
| 11488 | sqlite3_mem_methods m; /* Low-level memory allocation interface */ |
| 11489 | sqlite3_mutex_methods mutex; /* Low-level mutex interface */ |
| @@ -11775,10 +11796,11 @@ | |
| 11796 | SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); |
| 11797 | #else |
| 11798 | # define sqlite3AutoincrementBegin(X) |
| 11799 | # define sqlite3AutoincrementEnd(X) |
| 11800 | #endif |
| 11801 | SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse*, Select*, SelectDest*); |
| 11802 | SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, ExprList*, Select*, IdList*, int); |
| 11803 | SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); |
| 11804 | SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); |
| 11805 | SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); |
| 11806 | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); |
| @@ -11950,11 +11972,11 @@ | |
| 11972 | SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); |
| 11973 | SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); |
| 11974 | SQLITE_PRIVATE int sqlite3Atoi(const char*); |
| 11975 | SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); |
| 11976 | SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); |
| 11977 | SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); |
| 11978 | |
| 11979 | /* |
| 11980 | ** Routines to read and write variable-length integers. These used to |
| 11981 | ** be defined locally, but now we use the varint routines in the util.c |
| 11982 | ** file. Code should use the MACRO forms below, as the Varint32 versions |
| @@ -12450,19 +12472,24 @@ | |
| 12472 | |
| 12473 | #ifndef SQLITE_USE_URI |
| 12474 | # define SQLITE_USE_URI 0 |
| 12475 | #endif |
| 12476 | |
| 12477 | #ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN |
| 12478 | # define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 |
| 12479 | #endif |
| 12480 | |
| 12481 | /* |
| 12482 | ** The following singleton contains the global configuration for |
| 12483 | ** the SQLite library. |
| 12484 | */ |
| 12485 | SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { |
| 12486 | SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ |
| 12487 | 1, /* bCoreMutex */ |
| 12488 | SQLITE_THREADSAFE==1, /* bFullMutex */ |
| 12489 | SQLITE_USE_URI, /* bOpenUri */ |
| 12490 | SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ |
| 12491 | 0x7ffffffe, /* mxStrlen */ |
| 12492 | 128, /* szLookaside */ |
| 12493 | 500, /* nLookaside */ |
| 12494 | {0,0,0,0,0,0,0,0}, /* m */ |
| 12495 | {0,0,0,0,0,0,0,0,0}, /* mutex */ |
| @@ -12876,10 +12903,13 @@ | |
| 12903 | #ifdef SQLITE_PERFORMANCE_TRACE |
| 12904 | "PERFORMANCE_TRACE", |
| 12905 | #endif |
| 12906 | #ifdef SQLITE_PROXY_DEBUG |
| 12907 | "PROXY_DEBUG", |
| 12908 | #endif |
| 12909 | #ifdef SQLITE_RTREE_INT_ONLY |
| 12910 | "RTREE_INT_ONLY", |
| 12911 | #endif |
| 12912 | #ifdef SQLITE_SECURE_DELETE |
| 12913 | "SECURE_DELETE", |
| 12914 | #endif |
| 12915 | #ifdef SQLITE_SMALL_STACK |
| @@ -13234,10 +13264,15 @@ | |
| 13264 | int nIndent; /* Number of elements in aIndent */ |
| 13265 | u16 aIndent[100]; /* Levels of indentation */ |
| 13266 | char zBase[100]; /* Initial space */ |
| 13267 | }; |
| 13268 | |
| 13269 | /* A bitfield type for use inside of structures. Always follow with :N where |
| 13270 | ** N is the number of bits. |
| 13271 | */ |
| 13272 | typedef unsigned bft; /* Bit Field Type */ |
| 13273 | |
| 13274 | /* |
| 13275 | ** An instance of the virtual machine. This structure contains the complete |
| 13276 | ** state of the virtual machine. |
| 13277 | ** |
| 13278 | ** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() |
| @@ -13275,19 +13310,20 @@ | |
| 13310 | ynVar nzVar; /* Number of entries in azVar[] */ |
| 13311 | u32 cacheCtr; /* VdbeCursor row cache generation counter */ |
| 13312 | int pc; /* The program counter */ |
| 13313 | int rc; /* Value to return */ |
| 13314 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 13315 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| 13316 | bft explain:2; /* True if EXPLAIN present on SQL command */ |
| 13317 | bft inVtabMethod:2; /* See comments above */ |
| 13318 | bft changeCntOn:1; /* True to update the change-counter */ |
| 13319 | bft expired:1; /* True if the VM needs to be recompiled */ |
| 13320 | bft runOnlyOnce:1; /* Automatically expire on reset */ |
| 13321 | bft usesStmtJournal:1; /* True if uses a statement journal */ |
| 13322 | bft readOnly:1; /* True for read-only statements */ |
| 13323 | bft isPrepareV2:1; /* True if prepared with prepare_v2() */ |
| 13324 | bft doingRerun:1; /* True if rerunning after an auto-reprepare */ |
| 13325 | int nChange; /* Number of db changes made since last reset */ |
| 13326 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 13327 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 13328 | int iStatement; /* Statement number (or 0 if has not opened stmt) */ |
| 13329 | int aCounter[3]; /* Counters used by sqlite3_stmt_status() */ |
| @@ -20525,29 +20561,27 @@ | |
| 20561 | if( c<0x80 \ |
| 20562 | || (c&0xFFFFF800)==0xD800 \ |
| 20563 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ |
| 20564 | } |
| 20565 | SQLITE_PRIVATE u32 sqlite3Utf8Read( |
| 20566 | const unsigned char **pz /* Pointer to string from which to read char */ |
| 20567 | ){ |
| 20568 | unsigned int c; |
| 20569 | |
| 20570 | /* Same as READ_UTF8() above but without the zTerm parameter. |
| 20571 | ** For this routine, we assume the UTF8 string is always zero-terminated. |
| 20572 | */ |
| 20573 | c = *((*pz)++); |
| 20574 | if( c>=0xc0 ){ |
| 20575 | c = sqlite3Utf8Trans1[c-0xc0]; |
| 20576 | while( (*(*pz) & 0xc0)==0x80 ){ |
| 20577 | c = (c<<6) + (0x3f & *((*pz)++)); |
| 20578 | } |
| 20579 | if( c<0x80 |
| 20580 | || (c&0xFFFFF800)==0xD800 |
| 20581 | || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } |
| 20582 | } |
| 20583 | return c; |
| 20584 | } |
| 20585 | |
| 20586 | |
| 20587 | |
| @@ -20644,19 +20678,17 @@ | |
| 20678 | |
| 20679 | if( pMem->enc==SQLITE_UTF8 ){ |
| 20680 | if( desiredEnc==SQLITE_UTF16LE ){ |
| 20681 | /* UTF-8 -> UTF-16 Little-endian */ |
| 20682 | while( zIn<zTerm ){ |
| 20683 | READ_UTF8(zIn, zTerm, c); |
| 20684 | WRITE_UTF16LE(z, c); |
| 20685 | } |
| 20686 | }else{ |
| 20687 | assert( desiredEnc==SQLITE_UTF16BE ); |
| 20688 | /* UTF-8 -> UTF-16 Big-endian */ |
| 20689 | while( zIn<zTerm ){ |
| 20690 | READ_UTF8(zIn, zTerm, c); |
| 20691 | WRITE_UTF16BE(z, c); |
| 20692 | } |
| 20693 | } |
| 20694 | pMem->n = (int)(z - zOut); |
| @@ -20780,11 +20812,11 @@ | |
| 20812 | unsigned char *zOut = zIn; |
| 20813 | unsigned char *zStart = zIn; |
| 20814 | u32 c; |
| 20815 | |
| 20816 | while( zIn[0] && zOut<=zIn ){ |
| 20817 | c = sqlite3Utf8Read((const u8**)&zIn); |
| 20818 | if( c!=0xfffd ){ |
| 20819 | WRITE_UTF8(zOut, c); |
| 20820 | } |
| 20821 | } |
| 20822 | *zOut = 0; |
| @@ -20885,11 +20917,11 @@ | |
| 20917 | WRITE_UTF8(z, i); |
| 20918 | n = (int)(z-zBuf); |
| 20919 | assert( n>0 && n<=4 ); |
| 20920 | z[0] = 0; |
| 20921 | z = zBuf; |
| 20922 | c = sqlite3Utf8Read((const u8**)&z); |
| 20923 | t = i; |
| 20924 | if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD; |
| 20925 | if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD; |
| 20926 | assert( c==t ); |
| 20927 | assert( (z-zBuf)==n ); |
| @@ -29887,10 +29919,19 @@ | |
| 29919 | #endif /* !defined(_OS_COMMON_H_) */ |
| 29920 | |
| 29921 | /************** End of os_common.h *******************************************/ |
| 29922 | /************** Continuing where we left off in os_win.c *********************/ |
| 29923 | |
| 29924 | /* |
| 29925 | ** Compiling and using WAL mode requires several APIs that are only |
| 29926 | ** available in Windows platforms based on the NT kernel. |
| 29927 | */ |
| 29928 | #if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL) |
| 29929 | # error "WAL mode requires support from the Windows NT kernel, compile\ |
| 29930 | with SQLITE_OMIT_WAL." |
| 29931 | #endif |
| 29932 | |
| 29933 | /* |
| 29934 | ** Macro to find the minimum of two numeric values. |
| 29935 | */ |
| 29936 | #ifndef MIN |
| 29937 | # define MIN(x,y) ((x)<(y)?(x):(y)) |
| @@ -30170,166 +30211,176 @@ | |
| 30211 | { "CreateFileW", (SYSCALL)0, 0 }, |
| 30212 | #endif |
| 30213 | |
| 30214 | #define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \ |
| 30215 | LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent) |
| 30216 | |
| 30217 | #if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \ |
| 30218 | !defined(SQLITE_OMIT_WAL)) |
| 30219 | { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 }, |
| 30220 | #else |
| 30221 | { "CreateFileMappingA", (SYSCALL)0, 0 }, |
| 30222 | #endif |
| 30223 | |
| 30224 | #define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 30225 | DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent) |
| 30226 | |
| 30227 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ |
| 30228 | !defined(SQLITE_OMIT_WAL)) |
| 30229 | { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 }, |
| 30230 | #else |
| 30231 | { "CreateFileMappingW", (SYSCALL)0, 0 }, |
| 30232 | #endif |
| 30233 | |
| 30234 | #define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ |
| 30235 | DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent) |
| 30236 | |
| 30237 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30238 | { "CreateMutexW", (SYSCALL)CreateMutexW, 0 }, |
| 30239 | #else |
| 30240 | { "CreateMutexW", (SYSCALL)0, 0 }, |
| 30241 | #endif |
| 30242 | |
| 30243 | #define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \ |
| 30244 | LPCWSTR))aSyscall[8].pCurrent) |
| 30245 | |
| 30246 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30247 | { "DeleteFileA", (SYSCALL)DeleteFileA, 0 }, |
| 30248 | #else |
| 30249 | { "DeleteFileA", (SYSCALL)0, 0 }, |
| 30250 | #endif |
| 30251 | |
| 30252 | #define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent) |
| 30253 | |
| 30254 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30255 | { "DeleteFileW", (SYSCALL)DeleteFileW, 0 }, |
| 30256 | #else |
| 30257 | { "DeleteFileW", (SYSCALL)0, 0 }, |
| 30258 | #endif |
| 30259 | |
| 30260 | #define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent) |
| 30261 | |
| 30262 | #if SQLITE_OS_WINCE |
| 30263 | { "FileTimeToLocalFileTime", (SYSCALL)FileTimeToLocalFileTime, 0 }, |
| 30264 | #else |
| 30265 | { "FileTimeToLocalFileTime", (SYSCALL)0, 0 }, |
| 30266 | #endif |
| 30267 | |
| 30268 | #define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30269 | LPFILETIME))aSyscall[11].pCurrent) |
| 30270 | |
| 30271 | #if SQLITE_OS_WINCE |
| 30272 | { "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 }, |
| 30273 | #else |
| 30274 | { "FileTimeToSystemTime", (SYSCALL)0, 0 }, |
| 30275 | #endif |
| 30276 | |
| 30277 | #define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \ |
| 30278 | LPSYSTEMTIME))aSyscall[12].pCurrent) |
| 30279 | |
| 30280 | { "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 }, |
| 30281 | |
| 30282 | #define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent) |
| 30283 | |
| 30284 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30285 | { "FormatMessageA", (SYSCALL)FormatMessageA, 0 }, |
| 30286 | #else |
| 30287 | { "FormatMessageA", (SYSCALL)0, 0 }, |
| 30288 | #endif |
| 30289 | |
| 30290 | #define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \ |
| 30291 | DWORD,va_list*))aSyscall[14].pCurrent) |
| 30292 | |
| 30293 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30294 | { "FormatMessageW", (SYSCALL)FormatMessageW, 0 }, |
| 30295 | #else |
| 30296 | { "FormatMessageW", (SYSCALL)0, 0 }, |
| 30297 | #endif |
| 30298 | |
| 30299 | #define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \ |
| 30300 | DWORD,va_list*))aSyscall[15].pCurrent) |
| 30301 | |
| 30302 | { "FreeLibrary", (SYSCALL)FreeLibrary, 0 }, |
| 30303 | |
| 30304 | #define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent) |
| 30305 | |
| 30306 | { "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 }, |
| 30307 | |
| 30308 | #define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent) |
| 30309 | |
| 30310 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30311 | { "GetDiskFreeSpaceA", (SYSCALL)GetDiskFreeSpaceA, 0 }, |
| 30312 | #else |
| 30313 | { "GetDiskFreeSpaceA", (SYSCALL)0, 0 }, |
| 30314 | #endif |
| 30315 | |
| 30316 | #define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30317 | LPDWORD))aSyscall[18].pCurrent) |
| 30318 | |
| 30319 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30320 | { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 }, |
| 30321 | #else |
| 30322 | { "GetDiskFreeSpaceW", (SYSCALL)0, 0 }, |
| 30323 | #endif |
| 30324 | |
| 30325 | #define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \ |
| 30326 | LPDWORD))aSyscall[19].pCurrent) |
| 30327 | |
| 30328 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30329 | { "GetFileAttributesA", (SYSCALL)GetFileAttributesA, 0 }, |
| 30330 | #else |
| 30331 | { "GetFileAttributesA", (SYSCALL)0, 0 }, |
| 30332 | #endif |
| 30333 | |
| 30334 | #define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent) |
| 30335 | |
| 30336 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30337 | { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 }, |
| 30338 | #else |
| 30339 | { "GetFileAttributesW", (SYSCALL)0, 0 }, |
| 30340 | #endif |
| 30341 | |
| 30342 | #define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent) |
| 30343 | |
| 30344 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30345 | { "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 }, |
| 30346 | #else |
| 30347 | { "GetFileAttributesExW", (SYSCALL)0, 0 }, |
| 30348 | #endif |
| 30349 | |
| 30350 | #define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \ |
| 30351 | LPVOID))aSyscall[22].pCurrent) |
| 30352 | |
| 30353 | #if !SQLITE_OS_WINRT |
| 30354 | { "GetFileSize", (SYSCALL)GetFileSize, 0 }, |
| 30355 | #else |
| 30356 | { "GetFileSize", (SYSCALL)0, 0 }, |
| 30357 | #endif |
| 30358 | |
| 30359 | #define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent) |
| 30360 | |
| 30361 | #if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) |
| 30362 | { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 }, |
| 30363 | #else |
| 30364 | { "GetFullPathNameA", (SYSCALL)0, 0 }, |
| 30365 | #endif |
| 30366 | |
| 30367 | #define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \ |
| 30368 | LPSTR*))aSyscall[24].pCurrent) |
| 30369 | |
| 30370 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30371 | { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 }, |
| 30372 | #else |
| 30373 | { "GetFullPathNameW", (SYSCALL)0, 0 }, |
| 30374 | #endif |
| 30375 | |
| 30376 | #define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \ |
| 30377 | LPWSTR*))aSyscall[25].pCurrent) |
| 30378 | |
| 30379 | { "GetLastError", (SYSCALL)GetLastError, 0 }, |
| 30380 | |
| 30381 | #define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent) |
| 30382 | |
| 30383 | #if SQLITE_OS_WINCE |
| 30384 | /* The GetProcAddressA() routine is only available on Windows CE. */ |
| 30385 | { "GetProcAddressA", (SYSCALL)GetProcAddressA, 0 }, |
| 30386 | #else |
| @@ -30337,144 +30388,144 @@ | |
| 30388 | ** an ANSI string regardless of the _UNICODE setting */ |
| 30389 | { "GetProcAddressA", (SYSCALL)GetProcAddress, 0 }, |
| 30390 | #endif |
| 30391 | |
| 30392 | #define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \ |
| 30393 | LPCSTR))aSyscall[27].pCurrent) |
| 30394 | |
| 30395 | #if !SQLITE_OS_WINRT |
| 30396 | { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 }, |
| 30397 | #else |
| 30398 | { "GetSystemInfo", (SYSCALL)0, 0 }, |
| 30399 | #endif |
| 30400 | |
| 30401 | #define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent) |
| 30402 | |
| 30403 | { "GetSystemTime", (SYSCALL)GetSystemTime, 0 }, |
| 30404 | |
| 30405 | #define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent) |
| 30406 | |
| 30407 | #if !SQLITE_OS_WINCE |
| 30408 | { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 }, |
| 30409 | #else |
| 30410 | { "GetSystemTimeAsFileTime", (SYSCALL)0, 0 }, |
| 30411 | #endif |
| 30412 | |
| 30413 | #define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \ |
| 30414 | LPFILETIME))aSyscall[30].pCurrent) |
| 30415 | |
| 30416 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30417 | { "GetTempPathA", (SYSCALL)GetTempPathA, 0 }, |
| 30418 | #else |
| 30419 | { "GetTempPathA", (SYSCALL)0, 0 }, |
| 30420 | #endif |
| 30421 | |
| 30422 | #define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent) |
| 30423 | |
| 30424 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30425 | { "GetTempPathW", (SYSCALL)GetTempPathW, 0 }, |
| 30426 | #else |
| 30427 | { "GetTempPathW", (SYSCALL)0, 0 }, |
| 30428 | #endif |
| 30429 | |
| 30430 | #define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent) |
| 30431 | |
| 30432 | #if !SQLITE_OS_WINRT |
| 30433 | { "GetTickCount", (SYSCALL)GetTickCount, 0 }, |
| 30434 | #else |
| 30435 | { "GetTickCount", (SYSCALL)0, 0 }, |
| 30436 | #endif |
| 30437 | |
| 30438 | #define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent) |
| 30439 | |
| 30440 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30441 | { "GetVersionExA", (SYSCALL)GetVersionExA, 0 }, |
| 30442 | #else |
| 30443 | { "GetVersionExA", (SYSCALL)0, 0 }, |
| 30444 | #endif |
| 30445 | |
| 30446 | #define osGetVersionExA ((BOOL(WINAPI*)( \ |
| 30447 | LPOSVERSIONINFOA))aSyscall[34].pCurrent) |
| 30448 | |
| 30449 | { "HeapAlloc", (SYSCALL)HeapAlloc, 0 }, |
| 30450 | |
| 30451 | #define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \ |
| 30452 | SIZE_T))aSyscall[35].pCurrent) |
| 30453 | |
| 30454 | #if !SQLITE_OS_WINRT |
| 30455 | { "HeapCreate", (SYSCALL)HeapCreate, 0 }, |
| 30456 | #else |
| 30457 | { "HeapCreate", (SYSCALL)0, 0 }, |
| 30458 | #endif |
| 30459 | |
| 30460 | #define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \ |
| 30461 | SIZE_T))aSyscall[36].pCurrent) |
| 30462 | |
| 30463 | #if !SQLITE_OS_WINRT |
| 30464 | { "HeapDestroy", (SYSCALL)HeapDestroy, 0 }, |
| 30465 | #else |
| 30466 | { "HeapDestroy", (SYSCALL)0, 0 }, |
| 30467 | #endif |
| 30468 | |
| 30469 | #define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[37].pCurrent) |
| 30470 | |
| 30471 | { "HeapFree", (SYSCALL)HeapFree, 0 }, |
| 30472 | |
| 30473 | #define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[38].pCurrent) |
| 30474 | |
| 30475 | { "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 }, |
| 30476 | |
| 30477 | #define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \ |
| 30478 | SIZE_T))aSyscall[39].pCurrent) |
| 30479 | |
| 30480 | { "HeapSize", (SYSCALL)HeapSize, 0 }, |
| 30481 | |
| 30482 | #define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \ |
| 30483 | LPCVOID))aSyscall[40].pCurrent) |
| 30484 | |
| 30485 | #if !SQLITE_OS_WINRT |
| 30486 | { "HeapValidate", (SYSCALL)HeapValidate, 0 }, |
| 30487 | #else |
| 30488 | { "HeapValidate", (SYSCALL)0, 0 }, |
| 30489 | #endif |
| 30490 | |
| 30491 | #define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \ |
| 30492 | LPCVOID))aSyscall[41].pCurrent) |
| 30493 | |
| 30494 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30495 | { "LoadLibraryA", (SYSCALL)LoadLibraryA, 0 }, |
| 30496 | #else |
| 30497 | { "LoadLibraryA", (SYSCALL)0, 0 }, |
| 30498 | #endif |
| 30499 | |
| 30500 | #define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[42].pCurrent) |
| 30501 | |
| 30502 | #if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) |
| 30503 | { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 }, |
| 30504 | #else |
| 30505 | { "LoadLibraryW", (SYSCALL)0, 0 }, |
| 30506 | #endif |
| 30507 | |
| 30508 | #define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[43].pCurrent) |
| 30509 | |
| 30510 | #if !SQLITE_OS_WINRT |
| 30511 | { "LocalFree", (SYSCALL)LocalFree, 0 }, |
| 30512 | #else |
| 30513 | { "LocalFree", (SYSCALL)0, 0 }, |
| 30514 | #endif |
| 30515 | |
| 30516 | #define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[44].pCurrent) |
| 30517 | |
| 30518 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30519 | { "LockFile", (SYSCALL)LockFile, 0 }, |
| 30520 | #else |
| 30521 | { "LockFile", (SYSCALL)0, 0 }, |
| 30522 | #endif |
| 30523 | |
| 30524 | #ifndef osLockFile |
| 30525 | #define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30526 | DWORD))aSyscall[45].pCurrent) |
| 30527 | #endif |
| 30528 | |
| 30529 | #if !SQLITE_OS_WINCE |
| 30530 | { "LockFileEx", (SYSCALL)LockFileEx, 0 }, |
| 30531 | #else |
| @@ -30481,218 +30532,218 @@ | |
| 30532 | { "LockFileEx", (SYSCALL)0, 0 }, |
| 30533 | #endif |
| 30534 | |
| 30535 | #ifndef osLockFileEx |
| 30536 | #define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \ |
| 30537 | LPOVERLAPPED))aSyscall[46].pCurrent) |
| 30538 | #endif |
| 30539 | |
| 30540 | #if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)) |
| 30541 | { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 }, |
| 30542 | #else |
| 30543 | { "MapViewOfFile", (SYSCALL)0, 0 }, |
| 30544 | #endif |
| 30545 | |
| 30546 | #define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30547 | SIZE_T))aSyscall[47].pCurrent) |
| 30548 | |
| 30549 | { "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 }, |
| 30550 | |
| 30551 | #define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \ |
| 30552 | int))aSyscall[48].pCurrent) |
| 30553 | |
| 30554 | { "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 }, |
| 30555 | |
| 30556 | #define osQueryPerformanceCounter ((BOOL(WINAPI*)( \ |
| 30557 | LARGE_INTEGER*))aSyscall[49].pCurrent) |
| 30558 | |
| 30559 | { "ReadFile", (SYSCALL)ReadFile, 0 }, |
| 30560 | |
| 30561 | #define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \ |
| 30562 | LPOVERLAPPED))aSyscall[50].pCurrent) |
| 30563 | |
| 30564 | { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 }, |
| 30565 | |
| 30566 | #define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[51].pCurrent) |
| 30567 | |
| 30568 | #if !SQLITE_OS_WINRT |
| 30569 | { "SetFilePointer", (SYSCALL)SetFilePointer, 0 }, |
| 30570 | #else |
| 30571 | { "SetFilePointer", (SYSCALL)0, 0 }, |
| 30572 | #endif |
| 30573 | |
| 30574 | #define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \ |
| 30575 | DWORD))aSyscall[52].pCurrent) |
| 30576 | |
| 30577 | #if !SQLITE_OS_WINRT |
| 30578 | { "Sleep", (SYSCALL)Sleep, 0 }, |
| 30579 | #else |
| 30580 | { "Sleep", (SYSCALL)0, 0 }, |
| 30581 | #endif |
| 30582 | |
| 30583 | #define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[53].pCurrent) |
| 30584 | |
| 30585 | { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 }, |
| 30586 | |
| 30587 | #define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \ |
| 30588 | LPFILETIME))aSyscall[54].pCurrent) |
| 30589 | |
| 30590 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT |
| 30591 | { "UnlockFile", (SYSCALL)UnlockFile, 0 }, |
| 30592 | #else |
| 30593 | { "UnlockFile", (SYSCALL)0, 0 }, |
| 30594 | #endif |
| 30595 | |
| 30596 | #ifndef osUnlockFile |
| 30597 | #define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30598 | DWORD))aSyscall[55].pCurrent) |
| 30599 | #endif |
| 30600 | |
| 30601 | #if !SQLITE_OS_WINCE |
| 30602 | { "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 }, |
| 30603 | #else |
| 30604 | { "UnlockFileEx", (SYSCALL)0, 0 }, |
| 30605 | #endif |
| 30606 | |
| 30607 | #define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ |
| 30608 | LPOVERLAPPED))aSyscall[56].pCurrent) |
| 30609 | |
| 30610 | #if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) |
| 30611 | { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 }, |
| 30612 | #else |
| 30613 | { "UnmapViewOfFile", (SYSCALL)0, 0 }, |
| 30614 | #endif |
| 30615 | |
| 30616 | #define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[57].pCurrent) |
| 30617 | |
| 30618 | { "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 }, |
| 30619 | |
| 30620 | #define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \ |
| 30621 | LPCSTR,LPBOOL))aSyscall[58].pCurrent) |
| 30622 | |
| 30623 | { "WriteFile", (SYSCALL)WriteFile, 0 }, |
| 30624 | |
| 30625 | #define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \ |
| 30626 | LPOVERLAPPED))aSyscall[59].pCurrent) |
| 30627 | |
| 30628 | #if SQLITE_OS_WINRT |
| 30629 | { "CreateEventExW", (SYSCALL)CreateEventExW, 0 }, |
| 30630 | #else |
| 30631 | { "CreateEventExW", (SYSCALL)0, 0 }, |
| 30632 | #endif |
| 30633 | |
| 30634 | #define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \ |
| 30635 | DWORD,DWORD))aSyscall[60].pCurrent) |
| 30636 | |
| 30637 | #if !SQLITE_OS_WINRT |
| 30638 | { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 }, |
| 30639 | #else |
| 30640 | { "WaitForSingleObject", (SYSCALL)0, 0 }, |
| 30641 | #endif |
| 30642 | |
| 30643 | #define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \ |
| 30644 | DWORD))aSyscall[61].pCurrent) |
| 30645 | |
| 30646 | #if SQLITE_OS_WINRT |
| 30647 | { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 }, |
| 30648 | #else |
| 30649 | { "WaitForSingleObjectEx", (SYSCALL)0, 0 }, |
| 30650 | #endif |
| 30651 | |
| 30652 | #define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ |
| 30653 | BOOL))aSyscall[62].pCurrent) |
| 30654 | |
| 30655 | #if SQLITE_OS_WINRT |
| 30656 | { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, |
| 30657 | #else |
| 30658 | { "SetFilePointerEx", (SYSCALL)0, 0 }, |
| 30659 | #endif |
| 30660 | |
| 30661 | #define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \ |
| 30662 | PLARGE_INTEGER,DWORD))aSyscall[63].pCurrent) |
| 30663 | |
| 30664 | #if SQLITE_OS_WINRT |
| 30665 | { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, |
| 30666 | #else |
| 30667 | { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, |
| 30668 | #endif |
| 30669 | |
| 30670 | #define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ |
| 30671 | FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[64].pCurrent) |
| 30672 | |
| 30673 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30674 | { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 }, |
| 30675 | #else |
| 30676 | { "MapViewOfFileFromApp", (SYSCALL)0, 0 }, |
| 30677 | #endif |
| 30678 | |
| 30679 | #define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \ |
| 30680 | SIZE_T))aSyscall[65].pCurrent) |
| 30681 | |
| 30682 | #if SQLITE_OS_WINRT |
| 30683 | { "CreateFile2", (SYSCALL)CreateFile2, 0 }, |
| 30684 | #else |
| 30685 | { "CreateFile2", (SYSCALL)0, 0 }, |
| 30686 | #endif |
| 30687 | |
| 30688 | #define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \ |
| 30689 | LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[66].pCurrent) |
| 30690 | |
| 30691 | #if SQLITE_OS_WINRT |
| 30692 | { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 }, |
| 30693 | #else |
| 30694 | { "LoadPackagedLibrary", (SYSCALL)0, 0 }, |
| 30695 | #endif |
| 30696 | |
| 30697 | #define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \ |
| 30698 | DWORD))aSyscall[67].pCurrent) |
| 30699 | |
| 30700 | #if SQLITE_OS_WINRT |
| 30701 | { "GetTickCount64", (SYSCALL)GetTickCount64, 0 }, |
| 30702 | #else |
| 30703 | { "GetTickCount64", (SYSCALL)0, 0 }, |
| 30704 | #endif |
| 30705 | |
| 30706 | #define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[68].pCurrent) |
| 30707 | |
| 30708 | #if SQLITE_OS_WINRT |
| 30709 | { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 }, |
| 30710 | #else |
| 30711 | { "GetNativeSystemInfo", (SYSCALL)0, 0 }, |
| 30712 | #endif |
| 30713 | |
| 30714 | #define osGetNativeSystemInfo ((VOID(WINAPI*)( \ |
| 30715 | LPSYSTEM_INFO))aSyscall[69].pCurrent) |
| 30716 | |
| 30717 | #if defined(SQLITE_WIN32_HAS_ANSI) |
| 30718 | { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 }, |
| 30719 | #else |
| 30720 | { "OutputDebugStringA", (SYSCALL)0, 0 }, |
| 30721 | #endif |
| 30722 | |
| 30723 | #define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[70].pCurrent) |
| 30724 | |
| 30725 | #if defined(SQLITE_WIN32_HAS_WIDE) |
| 30726 | { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 }, |
| 30727 | #else |
| 30728 | { "OutputDebugStringW", (SYSCALL)0, 0 }, |
| 30729 | #endif |
| 30730 | |
| 30731 | #define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[71].pCurrent) |
| 30732 | |
| 30733 | { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 }, |
| 30734 | |
| 30735 | #define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[72].pCurrent) |
| 30736 | |
| 30737 | #if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) |
| 30738 | { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 }, |
| 30739 | #else |
| 30740 | { "CreateFileMappingFromApp", (SYSCALL)0, 0 }, |
| 30741 | #endif |
| 30742 | |
| 30743 | #define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \ |
| 30744 | LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[73].pCurrent) |
| 30745 | |
| 30746 | }; /* End of the overrideable system calls */ |
| 30747 | |
| 30748 | /* |
| 30749 | ** This is the xSetSystemCall() method of sqlite3_vfs for all of the |
| @@ -30846,10 +30897,12 @@ | |
| 30897 | ** WinNT/2K/XP so that we will know whether or not we can safely call |
| 30898 | ** the LockFileEx() API. |
| 30899 | */ |
| 30900 | #if SQLITE_OS_WINCE || SQLITE_OS_WINRT |
| 30901 | # define isNT() (1) |
| 30902 | #elif !defined(SQLITE_WIN32_HAS_WIDE) |
| 30903 | # define isNT() (0) |
| 30904 | #else |
| 30905 | static int isNT(void){ |
| 30906 | if( sqlite3_os_type==0 ){ |
| 30907 | OSVERSIONINFOA sInfo; |
| 30908 | sInfo.dwOSVersionInfoSize = sizeof(sInfo); |
| @@ -30856,11 +30909,11 @@ | |
| 30909 | osGetVersionExA(&sInfo); |
| 30910 | sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; |
| 30911 | } |
| 30912 | return sqlite3_os_type==2; |
| 30913 | } |
| 30914 | #endif |
| 30915 | |
| 30916 | #ifdef SQLITE_WIN32_MALLOC |
| 30917 | /* |
| 30918 | ** Allocate nBytes of memory. |
| 30919 | */ |
| @@ -31066,11 +31119,11 @@ | |
| 31119 | |
| 31120 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0); |
| 31121 | if( nChar==0 ){ |
| 31122 | return 0; |
| 31123 | } |
| 31124 | zWideFilename = sqlite3MallocZero( nChar*sizeof(zWideFilename[0]) ); |
| 31125 | if( zWideFilename==0 ){ |
| 31126 | return 0; |
| 31127 | } |
| 31128 | nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, |
| 31129 | nChar); |
| @@ -31091,11 +31144,11 @@ | |
| 31144 | |
| 31145 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31146 | if( nByte == 0 ){ |
| 31147 | return 0; |
| 31148 | } |
| 31149 | zFilename = sqlite3MallocZero( nByte ); |
| 31150 | if( zFilename==0 ){ |
| 31151 | return 0; |
| 31152 | } |
| 31153 | nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte, |
| 31154 | 0, 0); |
| @@ -31121,11 +31174,11 @@ | |
| 31174 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, NULL, |
| 31175 | 0)*sizeof(WCHAR); |
| 31176 | if( nByte==0 ){ |
| 31177 | return 0; |
| 31178 | } |
| 31179 | zMbcsFilename = sqlite3MallocZero( nByte*sizeof(zMbcsFilename[0]) ); |
| 31180 | if( zMbcsFilename==0 ){ |
| 31181 | return 0; |
| 31182 | } |
| 31183 | nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, |
| 31184 | nByte); |
| @@ -31150,11 +31203,11 @@ | |
| 31203 | |
| 31204 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0); |
| 31205 | if( nByte == 0 ){ |
| 31206 | return 0; |
| 31207 | } |
| 31208 | zFilename = sqlite3MallocZero( nByte ); |
| 31209 | if( zFilename==0 ){ |
| 31210 | return 0; |
| 31211 | } |
| 31212 | nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, |
| 31213 | nByte, 0, 0); |
| @@ -32797,20 +32850,18 @@ | |
| 32850 | assert( pDbFd->pShm==0 ); /* Not previously opened */ |
| 32851 | |
| 32852 | /* Allocate space for the new sqlite3_shm object. Also speculatively |
| 32853 | ** allocate space for a new winShmNode and filename. |
| 32854 | */ |
| 32855 | p = sqlite3MallocZero( sizeof(*p) ); |
| 32856 | if( p==0 ) return SQLITE_IOERR_NOMEM; |
| 32857 | nName = sqlite3Strlen30(pDbFd->zPath); |
| 32858 | pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); |
| 32859 | if( pNew==0 ){ |
| 32860 | sqlite3_free(p); |
| 32861 | return SQLITE_IOERR_NOMEM; |
| 32862 | } |
| 32863 | pNew->zFilename = (char*)&pNew[1]; |
| 32864 | sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); |
| 32865 | sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); |
| 32866 | |
| 32867 | /* Look to see if there is an existing winShmNode that can be used. |
| @@ -33143,21 +33194,25 @@ | |
| 33194 | goto shmpage_out; |
| 33195 | } |
| 33196 | pShmNode->aRegion = apNew; |
| 33197 | |
| 33198 | while( pShmNode->nRegion<=iRegion ){ |
| 33199 | HANDLE hMap = NULL; /* file-mapping handle */ |
| 33200 | void *pMap = 0; /* Mapped memory region */ |
| 33201 | |
| 33202 | #if SQLITE_OS_WINRT |
| 33203 | hMap = osCreateFileMappingFromApp(pShmNode->hFile.h, |
| 33204 | NULL, PAGE_READWRITE, nByte, NULL |
| 33205 | ); |
| 33206 | #elif defined(SQLITE_WIN32_HAS_WIDE) |
| 33207 | hMap = osCreateFileMappingW(pShmNode->hFile.h, |
| 33208 | NULL, PAGE_READWRITE, 0, nByte, NULL |
| 33209 | ); |
| 33210 | #elif defined(SQLITE_WIN32_HAS_ANSI) |
| 33211 | hMap = osCreateFileMappingA(pShmNode->hFile.h, |
| 33212 | NULL, PAGE_READWRITE, 0, nByte, NULL |
| 33213 | ); |
| 33214 | #endif |
| 33215 | OSTRACE(("SHM-MAP pid-%d create region=%d nbyte=%d %s\n", |
| 33216 | (int)osGetCurrentProcessId(), pShmNode->nRegion, nByte, |
| 33217 | hMap ? "ok" : "failed")); |
| 33218 | if( hMap ){ |
| @@ -33902,11 +33957,11 @@ | |
| 33957 | } |
| 33958 | return SQLITE_OK; |
| 33959 | #endif |
| 33960 | |
| 33961 | #if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) |
| 33962 | DWORD nByte; |
| 33963 | void *zConverted; |
| 33964 | char *zOut; |
| 33965 | |
| 33966 | /* If this path name begins with "/X:", where "X" is any alphabetic |
| 33967 | ** character, discard the initial "/" from the pathname. |
| @@ -33936,31 +33991,59 @@ | |
| 33991 | if( zConverted==0 ){ |
| 33992 | return SQLITE_IOERR_NOMEM; |
| 33993 | } |
| 33994 | if( isNT() ){ |
| 33995 | LPWSTR zTemp; |
| 33996 | nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0); |
| 33997 | if( nByte==0 ){ |
| 33998 | winLogError(SQLITE_ERROR, osGetLastError(), |
| 33999 | "GetFullPathNameW1", zConverted); |
| 34000 | sqlite3_free(zConverted); |
| 34001 | return SQLITE_CANTOPEN_FULLPATH; |
| 34002 | } |
| 34003 | nByte += 3; |
| 34004 | zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); |
| 34005 | if( zTemp==0 ){ |
| 34006 | sqlite3_free(zConverted); |
| 34007 | return SQLITE_IOERR_NOMEM; |
| 34008 | } |
| 34009 | nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); |
| 34010 | if( nByte==0 ){ |
| 34011 | winLogError(SQLITE_ERROR, osGetLastError(), |
| 34012 | "GetFullPathNameW2", zConverted); |
| 34013 | sqlite3_free(zConverted); |
| 34014 | sqlite3_free(zTemp); |
| 34015 | return SQLITE_CANTOPEN_FULLPATH; |
| 34016 | } |
| 34017 | sqlite3_free(zConverted); |
| 34018 | zOut = unicodeToUtf8(zTemp); |
| 34019 | sqlite3_free(zTemp); |
| 34020 | } |
| 34021 | #ifdef SQLITE_WIN32_HAS_ANSI |
| 34022 | else{ |
| 34023 | char *zTemp; |
| 34024 | nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0); |
| 34025 | if( nByte==0 ){ |
| 34026 | winLogError(SQLITE_ERROR, osGetLastError(), |
| 34027 | "GetFullPathNameA1", zConverted); |
| 34028 | sqlite3_free(zConverted); |
| 34029 | return SQLITE_CANTOPEN_FULLPATH; |
| 34030 | } |
| 34031 | nByte += 3; |
| 34032 | zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); |
| 34033 | if( zTemp==0 ){ |
| 34034 | sqlite3_free(zConverted); |
| 34035 | return SQLITE_IOERR_NOMEM; |
| 34036 | } |
| 34037 | nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); |
| 34038 | if( nByte==0 ){ |
| 34039 | winLogError(SQLITE_ERROR, osGetLastError(), |
| 34040 | "GetFullPathNameA2", zConverted); |
| 34041 | sqlite3_free(zConverted); |
| 34042 | sqlite3_free(zTemp); |
| 34043 | return SQLITE_CANTOPEN_FULLPATH; |
| 34044 | } |
| 34045 | sqlite3_free(zConverted); |
| 34046 | zOut = sqlite3_win32_mbcs_to_utf8(zTemp); |
| 34047 | sqlite3_free(zTemp); |
| 34048 | } |
| 34049 | #endif |
| @@ -34214,11 +34297,11 @@ | |
| 34297 | winNextSystemCall, /* xNextSystemCall */ |
| 34298 | }; |
| 34299 | |
| 34300 | /* Double-check that the aSyscall[] array has been constructed |
| 34301 | ** correctly. See ticket [bb3a86e890c8e96ab] */ |
| 34302 | assert( ArraySize(aSyscall)==74 ); |
| 34303 | |
| 34304 | #ifndef SQLITE_OMIT_WAL |
| 34305 | /* get memory map allocation granularity */ |
| 34306 | memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); |
| 34307 | #if SQLITE_OS_WINRT |
| @@ -34233,11 +34316,11 @@ | |
| 34316 | return SQLITE_OK; |
| 34317 | } |
| 34318 | |
| 34319 | SQLITE_API int sqlite3_os_end(void){ |
| 34320 | #if SQLITE_OS_WINRT |
| 34321 | if( sleepObj!=NULL ){ |
| 34322 | osCloseHandle(sleepObj); |
| 34323 | sleepObj = NULL; |
| 34324 | } |
| 34325 | #endif |
| 34326 | return SQLITE_OK; |
| @@ -41395,11 +41478,11 @@ | |
| 41478 | assert( nPathname>0 ); |
| 41479 | pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUri); |
| 41480 | memcpy(pPager->zFilename, zPathname, nPathname); |
| 41481 | if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri); |
| 41482 | memcpy(pPager->zJournal, zPathname, nPathname); |
| 41483 | memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+2); |
| 41484 | sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal); |
| 41485 | #ifndef SQLITE_OMIT_WAL |
| 41486 | pPager->zWal = &pPager->zJournal[nPathname+8+1]; |
| 41487 | memcpy(pPager->zWal, zPathname, nPathname); |
| 41488 | memcpy(&pPager->zWal[nPathname], "-wal\000", 4+1); |
| @@ -58860,14 +58943,13 @@ | |
| 58943 | pOp->p4.pKeyInfo = pKeyInfo; |
| 58944 | if( pKeyInfo ){ |
| 58945 | u8 *aSortOrder; |
| 58946 | memcpy((char*)pKeyInfo, zP4, nByte - nField); |
| 58947 | aSortOrder = pKeyInfo->aSortOrder; |
| 58948 | assert( aSortOrder!=0 ); |
| 58949 | pKeyInfo->aSortOrder = (unsigned char*)&pKeyInfo->aColl[nField]; |
| 58950 | memcpy(pKeyInfo->aSortOrder, aSortOrder, nField); |
| 58951 | pOp->p4type = P4_KEYINFO; |
| 58952 | }else{ |
| 58953 | p->db->mallocFailed = 1; |
| 58954 | pOp->p4type = P4_NOTUSED; |
| 58955 | } |
| @@ -58976,10 +59058,11 @@ | |
| 59058 | switch( pOp->p4type ){ |
| 59059 | case P4_KEYINFO_STATIC: |
| 59060 | case P4_KEYINFO: { |
| 59061 | int i, j; |
| 59062 | KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; |
| 59063 | assert( pKeyInfo->aSortOrder!=0 ); |
| 59064 | sqlite3_snprintf(nTemp, zTemp, "keyinfo(%d", pKeyInfo->nField); |
| 59065 | i = sqlite3Strlen30(zTemp); |
| 59066 | for(j=0; j<pKeyInfo->nField; j++){ |
| 59067 | CollSeq *pColl = pKeyInfo->aColl[j]; |
| 59068 | if( pColl ){ |
| @@ -58987,11 +59070,11 @@ | |
| 59070 | if( i+n>nTemp-6 ){ |
| 59071 | memcpy(&zTemp[i],",...",4); |
| 59072 | break; |
| 59073 | } |
| 59074 | zTemp[i++] = ','; |
| 59075 | if( pKeyInfo->aSortOrder[j] ){ |
| 59076 | zTemp[i++] = '-'; |
| 59077 | } |
| 59078 | memcpy(&zTemp[i], pColl->zName,n+1); |
| 59079 | i += n; |
| 59080 | }else if( i+4<nTemp-6 ){ |
| @@ -60698,21 +60781,20 @@ | |
| 60781 | if( flags&MEM_Int ){ |
| 60782 | /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */ |
| 60783 | # define MAX_6BYTE ((((i64)0x00008000)<<32)-1) |
| 60784 | i64 i = pMem->u.i; |
| 60785 | u64 u; |
| 60786 | if( i<0 ){ |
| 60787 | if( i<(-MAX_6BYTE) ) return 6; |
| 60788 | /* Previous test prevents: u = -(-9223372036854775808) */ |
| 60789 | u = -i; |
| 60790 | }else{ |
| 60791 | u = i; |
| 60792 | } |
| 60793 | if( u<=127 ){ |
| 60794 | return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1; |
| 60795 | } |
| 60796 | if( u<=32767 ) return 2; |
| 60797 | if( u<=8388607 ) return 3; |
| 60798 | if( u<=2147483647 ) return 4; |
| 60799 | if( u<=MAX_6BYTE ) return 5; |
| 60800 | return 6; |
| @@ -60993,10 +61075,11 @@ | |
| 61075 | p = (UnpackedRecord*)&pSpace[nOff]; |
| 61076 | *ppFree = 0; |
| 61077 | } |
| 61078 | |
| 61079 | p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; |
| 61080 | assert( pKeyInfo->aSortOrder!=0 ); |
| 61081 | p->pKeyInfo = pKeyInfo; |
| 61082 | p->nField = pKeyInfo->nField + 1; |
| 61083 | return p; |
| 61084 | } |
| 61085 | |
| @@ -61086,10 +61169,11 @@ | |
| 61169 | /* mem1.u.i = 0; // not needed, here to silence compiler warning */ |
| 61170 | |
| 61171 | idx1 = getVarint32(aKey1, szHdr1); |
| 61172 | d1 = szHdr1; |
| 61173 | nField = pKeyInfo->nField; |
| 61174 | assert( pKeyInfo->aSortOrder!=0 ); |
| 61175 | while( idx1<szHdr1 && i<pPKey2->nField ){ |
| 61176 | u32 serial_type1; |
| 61177 | |
| 61178 | /* Read the serial types for the next element in each key. */ |
| 61179 | idx1 += getVarint32( aKey1+idx1, serial_type1 ); |
| @@ -61105,11 +61189,11 @@ | |
| 61189 | i<nField ? pKeyInfo->aColl[i] : 0); |
| 61190 | if( rc!=0 ){ |
| 61191 | assert( mem1.zMalloc==0 ); /* See comment below */ |
| 61192 | |
| 61193 | /* Invert the result if we are using DESC sort order. */ |
| 61194 | if( i<nField && pKeyInfo->aSortOrder[i] ){ |
| 61195 | rc = -rc; |
| 61196 | } |
| 61197 | |
| 61198 | /* If the PREFIX_SEARCH flag is set and all fields except the final |
| 61199 | ** rowid field were equal, then clear the PREFIX_SEARCH flag and set |
| @@ -61831,14 +61915,16 @@ | |
| 61915 | if( vdbeSafetyNotNull(v) ){ |
| 61916 | return SQLITE_MISUSE_BKPT; |
| 61917 | } |
| 61918 | db = v->db; |
| 61919 | sqlite3_mutex_enter(db->mutex); |
| 61920 | v->doingRerun = 0; |
| 61921 | while( (rc = sqlite3Step(v))==SQLITE_SCHEMA |
| 61922 | && cnt++ < SQLITE_MAX_SCHEMA_RETRY |
| 61923 | && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ |
| 61924 | sqlite3_reset(pStmt); |
| 61925 | v->doingRerun = 1; |
| 61926 | assert( v->expired==0 ); |
| 61927 | } |
| 61928 | if( rc2!=SQLITE_OK && ALWAYS(v->isPrepareV2) && ALWAYS(db->pErr) ){ |
| 61929 | /* This case occurs after failing to recompile an sql statement. |
| 61930 | ** The error message from the SQL compiler has already been loaded |
| @@ -63957,11 +64043,10 @@ | |
| 64043 | struct OP_JournalMode_stack_vars { |
| 64044 | Btree *pBt; /* Btree to change journal mode of */ |
| 64045 | Pager *pPager; /* Pager associated with pBt */ |
| 64046 | int eNew; /* New journal mode */ |
| 64047 | int eOld; /* The old journal mode */ |
| 64048 | } ci; |
| 64049 | struct OP_IncrVacuum_stack_vars { |
| 64050 | Btree *pBt; |
| 64051 | } cj; |
| 64052 | struct OP_VBegin_stack_vars { |
| @@ -69061,12 +69146,14 @@ | |
| 69146 | #if 0 /* local variables moved into u.ci */ |
| 69147 | Btree *pBt; /* Btree to change journal mode of */ |
| 69148 | Pager *pPager; /* Pager associated with pBt */ |
| 69149 | int eNew; /* New journal mode */ |
| 69150 | int eOld; /* The old journal mode */ |
| 69151 | #endif /* local variables moved into u.ci */ |
| 69152 | #ifndef SQLITE_OMIT_WAL |
| 69153 | const char *zFilename; /* Name of database file for u.ci.pPager */ |
| 69154 | #endif |
| 69155 | |
| 69156 | u.ci.eNew = pOp->p3; |
| 69157 | assert( u.ci.eNew==PAGER_JOURNALMODE_DELETE |
| 69158 | || u.ci.eNew==PAGER_JOURNALMODE_TRUNCATE |
| 69159 | || u.ci.eNew==PAGER_JOURNALMODE_PERSIST |
| @@ -69082,17 +69169,17 @@ | |
| 69169 | u.ci.eOld = sqlite3PagerGetJournalMode(u.ci.pPager); |
| 69170 | if( u.ci.eNew==PAGER_JOURNALMODE_QUERY ) u.ci.eNew = u.ci.eOld; |
| 69171 | if( !sqlite3PagerOkToChangeJournalMode(u.ci.pPager) ) u.ci.eNew = u.ci.eOld; |
| 69172 | |
| 69173 | #ifndef SQLITE_OMIT_WAL |
| 69174 | zFilename = sqlite3PagerFilename(u.ci.pPager, 1); |
| 69175 | |
| 69176 | /* Do not allow a transition to journal_mode=WAL for a database |
| 69177 | ** in temporary storage or if the VFS does not support shared memory |
| 69178 | */ |
| 69179 | if( u.ci.eNew==PAGER_JOURNALMODE_WAL |
| 69180 | && (sqlite3Strlen30(zFilename)==0 /* Temp file */ |
| 69181 | || !sqlite3PagerWalSupported(u.ci.pPager)) /* No shared-memory support */ |
| 69182 | ){ |
| 69183 | u.ci.eNew = u.ci.eOld; |
| 69184 | } |
| 69185 | |
| @@ -69660,11 +69747,14 @@ | |
| 69747 | #if 0 /* local variables moved into u.cr */ |
| 69748 | char *zTrace; |
| 69749 | char *z; |
| 69750 | #endif /* local variables moved into u.cr */ |
| 69751 | |
| 69752 | if( db->xTrace |
| 69753 | && !p->doingRerun |
| 69754 | && (u.cr.zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 |
| 69755 | ){ |
| 69756 | u.cr.z = sqlite3VdbeExpandSql(p, u.cr.zTrace); |
| 69757 | db->xTrace(db->pTraceArg, u.cr.z); |
| 69758 | sqlite3DbFree(db, u.cr.z); |
| 69759 | } |
| 69760 | #ifdef SQLITE_DEBUG |
| @@ -74885,10 +74975,11 @@ | |
| 74975 | |
| 74976 | switch( pExpr->op ){ |
| 74977 | case TK_IN: { |
| 74978 | char affinity; /* Affinity of the LHS of the IN */ |
| 74979 | KeyInfo keyInfo; /* Keyinfo for the generated table */ |
| 74980 | static u8 sortOrder = 0; /* Fake aSortOrder for keyInfo */ |
| 74981 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 74982 | Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ |
| 74983 | |
| 74984 | if( rMayHaveNull ){ |
| 74985 | sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull); |
| @@ -74912,10 +75003,11 @@ | |
| 75003 | pExpr->iTable = pParse->nTab++; |
| 75004 | addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid); |
| 75005 | if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED); |
| 75006 | memset(&keyInfo, 0, sizeof(keyInfo)); |
| 75007 | keyInfo.nField = 1; |
| 75008 | keyInfo.aSortOrder = &sortOrder; |
| 75009 | |
| 75010 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 75011 | /* Case 1: expr IN (SELECT ...) |
| 75012 | ** |
| 75013 | ** Generate code to write the results of the select into the temporary |
| @@ -74952,10 +75044,11 @@ | |
| 75044 | |
| 75045 | if( !affinity ){ |
| 75046 | affinity = SQLITE_AFF_NONE; |
| 75047 | } |
| 75048 | keyInfo.aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
| 75049 | keyInfo.aSortOrder = &sortOrder; |
| 75050 | |
| 75051 | /* Loop through each expression in <exprlist>. */ |
| 75052 | r1 = sqlite3GetTempReg(pParse); |
| 75053 | r2 = sqlite3GetTempReg(pParse); |
| 75054 | sqlite3VdbeAddOp2(v, OP_Null, 0, r2); |
| @@ -78030,11 +78123,11 @@ | |
| 78123 | |
| 78124 | /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. |
| 78125 | ** If there is a NOT NULL constraint, then the default value for the |
| 78126 | ** column must not be NULL. |
| 78127 | */ |
| 78128 | if( pCol->colFlags & COLFLAG_PRIMKEY ){ |
| 78129 | sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); |
| 78130 | return; |
| 78131 | } |
| 78132 | if( pNew->pIndex ){ |
| 78133 | sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); |
| @@ -81299,20 +81392,20 @@ | |
| 81392 | goto primary_key_exit; |
| 81393 | } |
| 81394 | pTab->tabFlags |= TF_HasPrimaryKey; |
| 81395 | if( pList==0 ){ |
| 81396 | iCol = pTab->nCol - 1; |
| 81397 | pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; |
| 81398 | }else{ |
| 81399 | for(i=0; i<pList->nExpr; i++){ |
| 81400 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| 81401 | if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ |
| 81402 | break; |
| 81403 | } |
| 81404 | } |
| 81405 | if( iCol<pTab->nCol ){ |
| 81406 | pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; |
| 81407 | } |
| 81408 | } |
| 81409 | if( pList->nExpr>1 ) iCol = -1; |
| 81410 | } |
| 81411 | if( iCol>=0 && iCol<pTab->nCol ){ |
| @@ -85468,37 +85561,18 @@ | |
| 85561 | sqlite3_result_text(context, z1, n, sqlite3_free); |
| 85562 | } |
| 85563 | } |
| 85564 | } |
| 85565 | |
| 85566 | /* |
| 85567 | ** The COALESCE() and IFNULL() functions are implemented as VDBE code so |
| 85568 | ** that unused argument values do not have to be computed. However, we |
| 85569 | ** still need some kind of function implementation for this routines in |
| 85570 | ** the function table. That function implementation will never be called |
| 85571 | ** so it doesn't matter what the implementation is. We might as well use |
| 85572 | ** the "version()" function as a substitute. |
| 85573 | */ |
| 85574 | #define ifnullFunc versionFunc /* Substitute function - never called */ |
| 85575 | |
| 85576 | /* |
| 85577 | ** Implementation of random(). Return a random integer. |
| 85578 | */ |
| @@ -85613,11 +85687,11 @@ | |
| 85687 | ** character is exactly one byte in size. Also, all characters are |
| 85688 | ** able to participate in upper-case-to-lower-case mappings in EBCDIC |
| 85689 | ** whereas only characters less than 0x80 do in ASCII. |
| 85690 | */ |
| 85691 | #if defined(SQLITE_EBCDIC) |
| 85692 | # define sqlite3Utf8Read(A) (*((*A)++)) |
| 85693 | # define GlogUpperToLower(A) A = sqlite3UpperToLower[A] |
| 85694 | #else |
| 85695 | # define GlogUpperToLower(A) if( !((A)&~0x7f) ){ A = sqlite3UpperToLower[A]; } |
| 85696 | #endif |
| 85697 | |
| @@ -85670,22 +85744,22 @@ | |
| 85744 | u8 matchAll = pInfo->matchAll; |
| 85745 | u8 matchSet = pInfo->matchSet; |
| 85746 | u8 noCase = pInfo->noCase; |
| 85747 | int prevEscape = 0; /* True if the previous character was 'escape' */ |
| 85748 | |
| 85749 | while( (c = sqlite3Utf8Read(&zPattern))!=0 ){ |
| 85750 | if( c==matchAll && !prevEscape ){ |
| 85751 | while( (c=sqlite3Utf8Read(&zPattern)) == matchAll |
| 85752 | || c == matchOne ){ |
| 85753 | if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){ |
| 85754 | return 0; |
| 85755 | } |
| 85756 | } |
| 85757 | if( c==0 ){ |
| 85758 | return 1; |
| 85759 | }else if( c==esc ){ |
| 85760 | c = sqlite3Utf8Read(&zPattern); |
| 85761 | if( c==0 ){ |
| 85762 | return 0; |
| 85763 | } |
| 85764 | }else if( c==matchSet ){ |
| 85765 | assert( esc==0 ); /* This is GLOB, not LIKE */ |
| @@ -85693,67 +85767,67 @@ | |
| 85767 | while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){ |
| 85768 | SQLITE_SKIP_UTF8(zString); |
| 85769 | } |
| 85770 | return *zString!=0; |
| 85771 | } |
| 85772 | while( (c2 = sqlite3Utf8Read(&zString))!=0 ){ |
| 85773 | if( noCase ){ |
| 85774 | GlogUpperToLower(c2); |
| 85775 | GlogUpperToLower(c); |
| 85776 | while( c2 != 0 && c2 != c ){ |
| 85777 | c2 = sqlite3Utf8Read(&zString); |
| 85778 | GlogUpperToLower(c2); |
| 85779 | } |
| 85780 | }else{ |
| 85781 | while( c2 != 0 && c2 != c ){ |
| 85782 | c2 = sqlite3Utf8Read(&zString); |
| 85783 | } |
| 85784 | } |
| 85785 | if( c2==0 ) return 0; |
| 85786 | if( patternCompare(zPattern,zString,pInfo,esc) ) return 1; |
| 85787 | } |
| 85788 | return 0; |
| 85789 | }else if( c==matchOne && !prevEscape ){ |
| 85790 | if( sqlite3Utf8Read(&zString)==0 ){ |
| 85791 | return 0; |
| 85792 | } |
| 85793 | }else if( c==matchSet ){ |
| 85794 | u32 prior_c = 0; |
| 85795 | assert( esc==0 ); /* This only occurs for GLOB, not LIKE */ |
| 85796 | seen = 0; |
| 85797 | invert = 0; |
| 85798 | c = sqlite3Utf8Read(&zString); |
| 85799 | if( c==0 ) return 0; |
| 85800 | c2 = sqlite3Utf8Read(&zPattern); |
| 85801 | if( c2=='^' ){ |
| 85802 | invert = 1; |
| 85803 | c2 = sqlite3Utf8Read(&zPattern); |
| 85804 | } |
| 85805 | if( c2==']' ){ |
| 85806 | if( c==']' ) seen = 1; |
| 85807 | c2 = sqlite3Utf8Read(&zPattern); |
| 85808 | } |
| 85809 | while( c2 && c2!=']' ){ |
| 85810 | if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){ |
| 85811 | c2 = sqlite3Utf8Read(&zPattern); |
| 85812 | if( c>=prior_c && c<=c2 ) seen = 1; |
| 85813 | prior_c = 0; |
| 85814 | }else{ |
| 85815 | if( c==c2 ){ |
| 85816 | seen = 1; |
| 85817 | } |
| 85818 | prior_c = c2; |
| 85819 | } |
| 85820 | c2 = sqlite3Utf8Read(&zPattern); |
| 85821 | } |
| 85822 | if( c2==0 || (seen ^ invert)==0 ){ |
| 85823 | return 0; |
| 85824 | } |
| 85825 | }else if( esc==c && !prevEscape ){ |
| 85826 | prevEscape = 1; |
| 85827 | }else{ |
| 85828 | c2 = sqlite3Utf8Read(&zString); |
| 85829 | if( noCase ){ |
| 85830 | GlogUpperToLower(c); |
| 85831 | GlogUpperToLower(c2); |
| 85832 | } |
| 85833 | if( c!=c2 ){ |
| @@ -85821,11 +85895,11 @@ | |
| 85895 | if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ |
| 85896 | sqlite3_result_error(context, |
| 85897 | "ESCAPE expression must be a single character", -1); |
| 85898 | return; |
| 85899 | } |
| 85900 | escape = sqlite3Utf8Read(&zEsc); |
| 85901 | } |
| 85902 | if( zA && zB ){ |
| 85903 | struct compareInfo *pInfo = sqlite3_user_data(context); |
| 85904 | #ifdef SQLITE_TEST |
| 85905 | sqlite3_like_count++; |
| @@ -87653,11 +87727,12 @@ | |
| 87727 | for(i=0; i<p->nCol; i++){ |
| 87728 | char *zKey = p->aCol[i].zCol; |
| 87729 | int iKey; |
| 87730 | for(iKey=0; iKey<pTab->nCol; iKey++){ |
| 87731 | Column *pCol = &pTab->aCol[iKey]; |
| 87732 | if( (zKey ? !sqlite3StrICmp(pCol->zName, zKey) |
| 87733 | : (pCol->colFlags & COLFLAG_PRIMKEY)!=0) ){ |
| 87734 | if( aChange[iKey]>=0 ) return 1; |
| 87735 | if( iKey==pTab->iPKey && chngRowid ) return 1; |
| 87736 | } |
| 87737 | } |
| 87738 | } |
| @@ -88268,10 +88343,101 @@ | |
| 88343 | */ |
| 88344 | # define autoIncBegin(A,B,C) (0) |
| 88345 | # define autoIncStep(A,B,C) |
| 88346 | #endif /* SQLITE_OMIT_AUTOINCREMENT */ |
| 88347 | |
| 88348 | |
| 88349 | /* |
| 88350 | ** Generate code for a co-routine that will evaluate a subquery one |
| 88351 | ** row at a time. |
| 88352 | ** |
| 88353 | ** The pSelect parameter is the subquery that the co-routine will evaluation. |
| 88354 | ** Information about the location of co-routine and the registers it will use |
| 88355 | ** is returned by filling in the pDest object. |
| 88356 | ** |
| 88357 | ** Registers are allocated as follows: |
| 88358 | ** |
| 88359 | ** pDest->iSDParm The register holding the next entry-point of the |
| 88360 | ** co-routine. Run the co-routine to its next breakpoint |
| 88361 | ** by calling "OP_Yield $X" where $X is pDest->iSDParm. |
| 88362 | ** |
| 88363 | ** pDest->iSDParm+1 The register holding the "completed" flag for the |
| 88364 | ** co-routine. This register is 0 if the previous Yield |
| 88365 | ** generated a new result row, or 1 if the subquery |
| 88366 | ** has completed. If the Yield is called again |
| 88367 | ** after this register becomes 1, then the VDBE will |
| 88368 | ** halt with an SQLITE_INTERNAL error. |
| 88369 | ** |
| 88370 | ** pDest->iSdst First result register. |
| 88371 | ** |
| 88372 | ** pDest->nSdst Number of result registers. |
| 88373 | ** |
| 88374 | ** This routine handles all of the register allocation and fills in the |
| 88375 | ** pDest structure appropriately. |
| 88376 | ** |
| 88377 | ** Here is a schematic of the generated code assuming that X is the |
| 88378 | ** co-routine entry-point register reg[pDest->iSDParm], that EOF is the |
| 88379 | ** completed flag reg[pDest->iSDParm+1], and R and S are the range of |
| 88380 | ** registers that hold the result set, reg[pDest->iSdst] through |
| 88381 | ** reg[pDest->iSdst+pDest->nSdst-1]: |
| 88382 | ** |
| 88383 | ** X <- A |
| 88384 | ** EOF <- 0 |
| 88385 | ** goto B |
| 88386 | ** A: setup for the SELECT |
| 88387 | ** loop rows in the SELECT |
| 88388 | ** load results into registers R..S |
| 88389 | ** yield X |
| 88390 | ** end loop |
| 88391 | ** cleanup after the SELECT |
| 88392 | ** EOF <- 1 |
| 88393 | ** yield X |
| 88394 | ** halt-error |
| 88395 | ** B: |
| 88396 | ** |
| 88397 | ** To use this subroutine, the caller generates code as follows: |
| 88398 | ** |
| 88399 | ** [ Co-routine generated by this subroutine, shown above ] |
| 88400 | ** S: yield X |
| 88401 | ** if EOF goto E |
| 88402 | ** if skip this row, goto C |
| 88403 | ** if terminate loop, goto E |
| 88404 | ** deal with this row |
| 88405 | ** C: goto S |
| 88406 | ** E: |
| 88407 | */ |
| 88408 | SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse *pParse, Select *pSelect, SelectDest *pDest){ |
| 88409 | int regYield; /* Register holding co-routine entry-point */ |
| 88410 | int regEof; /* Register holding co-routine completion flag */ |
| 88411 | int addrTop; /* Top of the co-routine */ |
| 88412 | int j1; /* Jump instruction */ |
| 88413 | int rc; /* Result code */ |
| 88414 | Vdbe *v; /* VDBE under construction */ |
| 88415 | |
| 88416 | regYield = ++pParse->nMem; |
| 88417 | regEof = ++pParse->nMem; |
| 88418 | v = sqlite3GetVdbe(pParse); |
| 88419 | addrTop = sqlite3VdbeCurrentAddr(v); |
| 88420 | sqlite3VdbeAddOp2(v, OP_Integer, addrTop+2, regYield); /* X <- A */ |
| 88421 | VdbeComment((v, "Co-routine entry point")); |
| 88422 | sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof); /* EOF <- 0 */ |
| 88423 | VdbeComment((v, "Co-routine completion flag")); |
| 88424 | sqlite3SelectDestInit(pDest, SRT_Coroutine, regYield); |
| 88425 | j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); |
| 88426 | rc = sqlite3Select(pParse, pSelect, pDest); |
| 88427 | assert( pParse->nErr==0 || rc ); |
| 88428 | if( pParse->db->mallocFailed && rc==SQLITE_OK ) rc = SQLITE_NOMEM; |
| 88429 | if( rc ) return rc; |
| 88430 | sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof); /* EOF <- 1 */ |
| 88431 | sqlite3VdbeAddOp1(v, OP_Yield, regYield); /* yield X */ |
| 88432 | sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort); |
| 88433 | VdbeComment((v, "End of coroutine")); |
| 88434 | sqlite3VdbeJumpHere(v, j1); /* label B: */ |
| 88435 | return rc; |
| 88436 | } |
| 88437 | |
| 88438 | |
| 88439 | |
| 88440 | /* Forward declaration */ |
| 88441 | static int xferOptimization( |
| 88442 | Parse *pParse, /* Parser context */ |
| 88443 | Table *pDest, /* The table we are inserting into */ |
| @@ -88517,55 +88683,16 @@ | |
| 88683 | ** is coming from a SELECT statement, then generate a co-routine that |
| 88684 | ** produces a single row of the SELECT on each invocation. The |
| 88685 | ** co-routine is the common header to the 3rd and 4th templates. |
| 88686 | */ |
| 88687 | if( pSelect ){ |
| 88688 | /* Data is coming from a SELECT. Generate a co-routine to run that |
| 88689 | ** SELECT. */ |
| 88690 | int rc = sqlite3CodeCoroutine(pParse, pSelect, &dest); |
| 88691 | if( rc ) goto insert_cleanup; |
| 88692 | |
| 88693 | regEof = dest.iSDParm + 1; |
| 88694 | regFromSelect = dest.iSdst; |
| 88695 | assert( pSelect->pEList ); |
| 88696 | nColumn = pSelect->pEList->nExpr; |
| 88697 | assert( dest.nSdst==nColumn ); |
| 88698 | |
| @@ -92035,11 +92162,12 @@ | |
| 92162 | if( pCol->zDflt ){ |
| 92163 | sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); |
| 92164 | }else{ |
| 92165 | sqlite3VdbeAddOp2(v, OP_Null, 0, 5); |
| 92166 | } |
| 92167 | sqlite3VdbeAddOp2(v, OP_Integer, |
| 92168 | (pCol->colFlags&COLFLAG_PRIMKEY)!=0, 6); |
| 92169 | sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6); |
| 92170 | } |
| 92171 | } |
| 92172 | }else |
| 92173 | |
| @@ -94803,11 +94931,11 @@ | |
| 94931 | ** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. |
| 94932 | */ |
| 94933 | static int selectColumnsFromExprList( |
| 94934 | Parse *pParse, /* Parsing context */ |
| 94935 | ExprList *pEList, /* Expr list from which to derive column names */ |
| 94936 | i16 *pnCol, /* Write the number of columns here */ |
| 94937 | Column **paCol /* Write the new column list here */ |
| 94938 | ){ |
| 94939 | sqlite3 *db = pParse->db; /* Database connection */ |
| 94940 | int i, j; /* Loop counters */ |
| 94941 | int cnt; /* Index added to make the name unique */ |
| @@ -95449,10 +95577,11 @@ | |
| 95577 | *apColl = multiSelectCollSeq(pParse, p, i); |
| 95578 | if( 0==*apColl ){ |
| 95579 | *apColl = db->pDfltColl; |
| 95580 | } |
| 95581 | } |
| 95582 | pKeyInfo->aSortOrder = (u8*)apColl; |
| 95583 | |
| 95584 | for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ |
| 95585 | for(i=0; i<2; i++){ |
| 95586 | int addr = pLoop->addrOpenEphm[i]; |
| 95587 | if( addr<0 ){ |
| @@ -101068,11 +101197,11 @@ | |
| 101197 | }else{ |
| 101198 | int iCol; |
| 101199 | /* If everything went according to plan, link the new VTable structure |
| 101200 | ** into the linked list headed by pTab->pVTable. Then loop through the |
| 101201 | ** columns of the table to see if any of them contain the token "hidden". |
| 101202 | ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from |
| 101203 | ** the type string. */ |
| 101204 | pVTable->pNext = pTab->pVTable; |
| 101205 | pTab->pVTable = pVTable; |
| 101206 | |
| 101207 | for(iCol=0; iCol<pTab->nCol; iCol++){ |
| @@ -101099,11 +101228,11 @@ | |
| 101228 | } |
| 101229 | if( zType[i]=='\0' && i>0 ){ |
| 101230 | assert(zType[i-1]==' '); |
| 101231 | zType[i-1] = '\0'; |
| 101232 | } |
| 101233 | pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN; |
| 101234 | } |
| 101235 | } |
| 101236 | } |
| 101237 | } |
| 101238 | |
| @@ -101901,10 +102030,11 @@ | |
| 102030 | #define WHERE_UNIQUE 0x04000000 /* Selects no more than one row */ |
| 102031 | #define WHERE_VIRTUALTABLE 0x08000000 /* Use virtual-table processing */ |
| 102032 | #define WHERE_MULTI_OR 0x10000000 /* OR using multiple indices */ |
| 102033 | #define WHERE_TEMP_INDEX 0x20000000 /* Uses an ephemeral index */ |
| 102034 | #define WHERE_DISTINCT 0x40000000 /* Correct order for DISTINCT */ |
| 102035 | #define WHERE_COVER_SCAN 0x80000000 /* Full scan of a covering index */ |
| 102036 | |
| 102037 | /* |
| 102038 | ** Initialize a preallocated WhereClause structure. |
| 102039 | */ |
| 102040 | static void whereClauseInit( |
| @@ -104770,11 +104900,11 @@ | |
| 104900 | /* If currently calculating the cost of using an index (not the IPK |
| 104901 | ** index), determine if all required column data may be obtained without |
| 104902 | ** using the main table (i.e. if the index is a covering |
| 104903 | ** index for this query). If it is, set the WHERE_IDX_ONLY flag in |
| 104904 | ** wsFlags. Otherwise, set the bLookup variable to true. */ |
| 104905 | if( pIdx ){ |
| 104906 | Bitmask m = pSrc->colUsed; |
| 104907 | int j; |
| 104908 | for(j=0; j<pIdx->nColumn; j++){ |
| 104909 | int x = pIdx->aiColumn[j]; |
| 104910 | if( x<BMS-1 ){ |
| @@ -104835,11 +104965,24 @@ | |
| 104965 | ** The ANALYZE command and the sqlite_stat1 and sqlite_stat3 tables do |
| 104966 | ** not give us data on the relative sizes of table and index records. |
| 104967 | ** So this computation assumes table records are about twice as big |
| 104968 | ** as index records |
| 104969 | */ |
| 104970 | if( wsFlags==WHERE_IDX_ONLY |
| 104971 | && (pWC->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 |
| 104972 | && sqlite3GlobalConfig.bUseCis |
| 104973 | #ifndef SQLITE_OMIT_BUILTIN_TEST |
| 104974 | && (pParse->db->flags & SQLITE_CoverIdxScan)==0 |
| 104975 | #endif |
| 104976 | ){ |
| 104977 | /* This index is not useful for indexing, but it is a covering index. |
| 104978 | ** A full-scan of the index might be a little faster than a full-scan |
| 104979 | ** of the table, so give this case a cost slightly less than a table |
| 104980 | ** scan. */ |
| 104981 | cost = aiRowEst[0]*3 + pProbe->nColumn; |
| 104982 | wsFlags |= WHERE_COVER_SCAN|WHERE_COLUMN_RANGE; |
| 104983 | }else if( (wsFlags & WHERE_NOT_FULLSCAN)==0 ){ |
| 104984 | /* The cost of a full table scan is a number of move operations equal |
| 104985 | ** to the number of rows in the table. |
| 104986 | ** |
| 104987 | ** We add an additional 4x penalty to full table scans. This causes |
| 104988 | ** the cost function to err on the side of choosing an index over |
| @@ -104846,10 +104989,11 @@ | |
| 104989 | ** choosing a full scan. This 4x full-scan penalty is an arguable |
| 104990 | ** decision and one which we expect to revisit in the future. But |
| 104991 | ** it seems to be working well enough at the moment. |
| 104992 | */ |
| 104993 | cost = aiRowEst[0]*4; |
| 104994 | wsFlags &= ~WHERE_IDX_ONLY; |
| 104995 | }else{ |
| 104996 | log10N = estLog(aiRowEst[0]); |
| 104997 | cost = nRow; |
| 104998 | if( pIdx ){ |
| 104999 | if( bLookup ){ |
| @@ -105889,10 +106033,15 @@ | |
| 106033 | pLevel->op = OP_Prev; |
| 106034 | }else{ |
| 106035 | pLevel->op = OP_Next; |
| 106036 | } |
| 106037 | pLevel->p1 = iIdxCur; |
| 106038 | if( pLevel->plan.wsFlags & WHERE_COVER_SCAN ){ |
| 106039 | pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; |
| 106040 | }else{ |
| 106041 | assert( pLevel->p5==0 ); |
| 106042 | } |
| 106043 | }else |
| 106044 | |
| 106045 | #ifndef SQLITE_OMIT_OR_OPTIMIZATION |
| 106046 | if( pLevel->plan.wsFlags & WHERE_MULTI_OR ){ |
| 106047 | /* Case 4: Two or more separately indexed terms connected by OR |
| @@ -106765,31 +106914,33 @@ | |
| 106914 | ** index name is '*'. |
| 106915 | */ |
| 106916 | for(i=0; i<nTabList; i++){ |
| 106917 | char *z; |
| 106918 | int n; |
| 106919 | int w; |
| 106920 | pLevel = &pWInfo->a[i]; |
| 106921 | w = pLevel->plan.wsFlags; |
| 106922 | pTabItem = &pTabList->a[pLevel->iFrom]; |
| 106923 | z = pTabItem->zAlias; |
| 106924 | if( z==0 ) z = pTabItem->pTab->zName; |
| 106925 | n = sqlite3Strlen30(z); |
| 106926 | if( n+nQPlan < sizeof(sqlite3_query_plan)-10 ){ |
| 106927 | if( (w & WHERE_IDX_ONLY)!=0 && (w & WHERE_COVER_SCAN)==0 ){ |
| 106928 | memcpy(&sqlite3_query_plan[nQPlan], "{}", 2); |
| 106929 | nQPlan += 2; |
| 106930 | }else{ |
| 106931 | memcpy(&sqlite3_query_plan[nQPlan], z, n); |
| 106932 | nQPlan += n; |
| 106933 | } |
| 106934 | sqlite3_query_plan[nQPlan++] = ' '; |
| 106935 | } |
| 106936 | testcase( w & WHERE_ROWID_EQ ); |
| 106937 | testcase( w & WHERE_ROWID_RANGE ); |
| 106938 | if( w & (WHERE_ROWID_EQ|WHERE_ROWID_RANGE) ){ |
| 106939 | memcpy(&sqlite3_query_plan[nQPlan], "* ", 2); |
| 106940 | nQPlan += 2; |
| 106941 | }else if( (w & WHERE_INDEXED)!=0 && (w & WHERE_COVER_SCAN)==0 ){ |
| 106942 | n = sqlite3Strlen30(pLevel->plan.u.pIdx->zName); |
| 106943 | if( n+nQPlan < sizeof(sqlite3_query_plan)-2 ){ |
| 106944 | memcpy(&sqlite3_query_plan[nQPlan], pLevel->plan.u.pIdx->zName, n); |
| 106945 | nQPlan += n; |
| 106946 | sqlite3_query_plan[nQPlan++] = ' '; |
| @@ -112076,10 +112227,15 @@ | |
| 112227 | |
| 112228 | case SQLITE_CONFIG_URI: { |
| 112229 | sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); |
| 112230 | break; |
| 112231 | } |
| 112232 | |
| 112233 | case SQLITE_CONFIG_COVERING_INDEX_SCAN: { |
| 112234 | sqlite3GlobalConfig.bUseCis = va_arg(ap, int); |
| 112235 | break; |
| 112236 | } |
| 112237 | |
| 112238 | default: { |
| 112239 | rc = SQLITE_ERROR; |
| 112240 | break; |
| 112241 | } |
| @@ -113368,10 +113524,19 @@ | |
| 113524 | if( !db || db->mallocFailed ){ |
| 113525 | return SQLITE_NOMEM; |
| 113526 | } |
| 113527 | return db->errCode; |
| 113528 | } |
| 113529 | |
| 113530 | /* |
| 113531 | ** Return a string that describes the kind of error specified in the |
| 113532 | ** argument. For now, this simply calls the internal sqlite3ErrStr() |
| 113533 | ** function. |
| 113534 | */ |
| 113535 | SQLITE_API const char *sqlite3_errstr(int rc){ |
| 113536 | return sqlite3ErrStr(rc); |
| 113537 | } |
| 113538 | |
| 113539 | /* |
| 113540 | ** Create a new collating function for database "db". The name is zName |
| 113541 | ** and the encoding is enc. |
| 113542 | */ |
| @@ -114343,11 +114508,11 @@ | |
| 114508 | */ |
| 114509 | if( pCol ){ |
| 114510 | zDataType = pCol->zType; |
| 114511 | zCollSeq = pCol->zColl; |
| 114512 | notnull = pCol->notNull!=0; |
| 114513 | primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; |
| 114514 | autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0; |
| 114515 | }else{ |
| 114516 | zDataType = "INTEGER"; |
| 114517 | primarykey = 1; |
| 114518 | } |
| 114519 |
+24
-4
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -105,13 +105,13 @@ | ||
| 105 | 105 | ** |
| 106 | 106 | ** See also: [sqlite3_libversion()], |
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | -#define SQLITE_VERSION "3.7.14" | |
| 111 | -#define SQLITE_VERSION_NUMBER 3007014 | |
| 112 | -#define SQLITE_SOURCE_ID "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a" | |
| 110 | +#define SQLITE_VERSION "3.7.15" | |
| 111 | +#define SQLITE_VERSION_NUMBER 3007015 | |
| 112 | +#define SQLITE_SOURCE_ID "2012-09-17 21:24:01 698b2a28004a9a2f0eabaadf36d833da4400b2bf" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -476,10 +476,11 @@ | ||
| 476 | 476 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 477 | 477 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 478 | 478 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 479 | 479 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 480 | 480 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 481 | +#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) | |
| 481 | 482 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 482 | 483 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 483 | 484 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 484 | 485 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 485 | 486 | |
| @@ -1564,10 +1565,22 @@ | ||
| 1564 | 1565 | ** connection is opened. If it is globally disabled, filenames are |
| 1565 | 1566 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 1566 | 1567 | ** database connection is opened. By default, URI handling is globally |
| 1567 | 1568 | ** disabled. The default value may be changed by compiling with the |
| 1568 | 1569 | ** [SQLITE_USE_URI] symbol defined. |
| 1570 | +** | |
| 1571 | +** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN | |
| 1572 | +** <dd> This option taks a single integer argument which is interpreted as | |
| 1573 | +** a boolean in order to enable or disable the use of covering indices for | |
| 1574 | +** full table scans in the query optimizer. The default setting is determined | |
| 1575 | +** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" | |
| 1576 | +** if that compile-time option is omitted. | |
| 1577 | +** The ability to disable the use of covering indices for full table scans | |
| 1578 | +** is because some incorrectly coded legacy applications might malfunction | |
| 1579 | +** malfunction when the optimization is enabled. Providing the ability to | |
| 1580 | +** disable the optimization allows the older, buggy application code to work | |
| 1581 | +** without change even with newer versions of SQLite. | |
| 1569 | 1582 | ** |
| 1570 | 1583 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 1571 | 1584 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 1572 | 1585 | ** <dd> These options are obsolete and should not be used by new code. |
| 1573 | 1586 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -1590,10 +1603,11 @@ | ||
| 1590 | 1603 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 1591 | 1604 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 1592 | 1605 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 1593 | 1606 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 1594 | 1607 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 1608 | +#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ | |
| 1595 | 1609 | |
| 1596 | 1610 | /* |
| 1597 | 1611 | ** CAPI3REF: Database Connection Configuration Options |
| 1598 | 1612 | ** |
| 1599 | 1613 | ** These constants are the available integer configuration options that |
| @@ -2598,11 +2612,11 @@ | ||
| 2598 | 2612 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 2599 | 2613 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 2600 | 2614 | ** an error)^. |
| 2601 | 2615 | ** ^If "ro" is specified, then the database is opened for read-only |
| 2602 | 2616 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 2603 | -** third argument to sqlite3_prepare_v2(). ^If the mode option is set to | |
| 2617 | +** third argument to sqlite3_open_v2(). ^If the mode option is set to | |
| 2604 | 2618 | ** "rw", then the database is opened for read-write (but not create) |
| 2605 | 2619 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 2606 | 2620 | ** been set. ^Value "rwc" is equivalent to setting both |
| 2607 | 2621 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 2608 | 2622 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -2749,10 +2763,15 @@ | ||
| 2749 | 2763 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 2750 | 2764 | ** ^(Memory to hold the error message string is managed internally. |
| 2751 | 2765 | ** The application does not need to worry about freeing the result. |
| 2752 | 2766 | ** However, the error string might be overwritten or deallocated by |
| 2753 | 2767 | ** subsequent calls to other SQLite interface functions.)^ |
| 2768 | +** | |
| 2769 | +** ^The sqlite3_errstr() interface returns the English-language text | |
| 2770 | +** that describes the [result code], as UTF-8. | |
| 2771 | +** ^(Memory to hold the error message string is managed internally | |
| 2772 | +** and must not be freed by the application)^. | |
| 2754 | 2773 | ** |
| 2755 | 2774 | ** When the serialized [threading mode] is in use, it might be the |
| 2756 | 2775 | ** case that a second error occurs on a separate thread in between |
| 2757 | 2776 | ** the time of the first error and the call to these interfaces. |
| 2758 | 2777 | ** When that happens, the second error will be reported since these |
| @@ -2768,10 +2787,11 @@ | ||
| 2768 | 2787 | */ |
| 2769 | 2788 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 2770 | 2789 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 2771 | 2790 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 2772 | 2791 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 2792 | +SQLITE_API const char *sqlite3_errstr(int); | |
| 2773 | 2793 | |
| 2774 | 2794 | /* |
| 2775 | 2795 | ** CAPI3REF: SQL Statement Object |
| 2776 | 2796 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 2777 | 2797 | ** |
| 2778 | 2798 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -105,13 +105,13 @@ | |
| 105 | ** |
| 106 | ** See also: [sqlite3_libversion()], |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.14" |
| 111 | #define SQLITE_VERSION_NUMBER 3007014 |
| 112 | #define SQLITE_SOURCE_ID "2012-09-03 15:42:36 c0d89d4a9752922f9e367362366efde4f1b06f2a" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 477 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 478 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 479 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 480 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 481 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 482 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 483 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 484 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 485 | |
| @@ -1564,10 +1565,22 @@ | |
| 1564 | ** connection is opened. If it is globally disabled, filenames are |
| 1565 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 1566 | ** database connection is opened. By default, URI handling is globally |
| 1567 | ** disabled. The default value may be changed by compiling with the |
| 1568 | ** [SQLITE_USE_URI] symbol defined. |
| 1569 | ** |
| 1570 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 1571 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 1572 | ** <dd> These options are obsolete and should not be used by new code. |
| 1573 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -1590,10 +1603,11 @@ | |
| 1590 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 1591 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 1592 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 1593 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 1594 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 1595 | |
| 1596 | /* |
| 1597 | ** CAPI3REF: Database Connection Configuration Options |
| 1598 | ** |
| 1599 | ** These constants are the available integer configuration options that |
| @@ -2598,11 +2612,11 @@ | |
| 2598 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 2599 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 2600 | ** an error)^. |
| 2601 | ** ^If "ro" is specified, then the database is opened for read-only |
| 2602 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 2603 | ** third argument to sqlite3_prepare_v2(). ^If the mode option is set to |
| 2604 | ** "rw", then the database is opened for read-write (but not create) |
| 2605 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 2606 | ** been set. ^Value "rwc" is equivalent to setting both |
| 2607 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 2608 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -2749,10 +2763,15 @@ | |
| 2749 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 2750 | ** ^(Memory to hold the error message string is managed internally. |
| 2751 | ** The application does not need to worry about freeing the result. |
| 2752 | ** However, the error string might be overwritten or deallocated by |
| 2753 | ** subsequent calls to other SQLite interface functions.)^ |
| 2754 | ** |
| 2755 | ** When the serialized [threading mode] is in use, it might be the |
| 2756 | ** case that a second error occurs on a separate thread in between |
| 2757 | ** the time of the first error and the call to these interfaces. |
| 2758 | ** When that happens, the second error will be reported since these |
| @@ -2768,10 +2787,11 @@ | |
| 2768 | */ |
| 2769 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 2770 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 2771 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 2772 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 2773 | |
| 2774 | /* |
| 2775 | ** CAPI3REF: SQL Statement Object |
| 2776 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 2777 | ** |
| 2778 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -105,13 +105,13 @@ | |
| 105 | ** |
| 106 | ** See also: [sqlite3_libversion()], |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.15" |
| 111 | #define SQLITE_VERSION_NUMBER 3007015 |
| 112 | #define SQLITE_SOURCE_ID "2012-09-17 21:24:01 698b2a28004a9a2f0eabaadf36d833da4400b2bf" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -476,10 +476,11 @@ | |
| 476 | #define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) |
| 477 | #define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) |
| 478 | #define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) |
| 479 | #define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) |
| 480 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 481 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 482 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 483 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 484 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 485 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 486 | |
| @@ -1564,10 +1565,22 @@ | |
| 1565 | ** connection is opened. If it is globally disabled, filenames are |
| 1566 | ** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the |
| 1567 | ** database connection is opened. By default, URI handling is globally |
| 1568 | ** disabled. The default value may be changed by compiling with the |
| 1569 | ** [SQLITE_USE_URI] symbol defined. |
| 1570 | ** |
| 1571 | ** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]] <dt>SQLITE_CONFIG_COVERING_INDEX_SCAN |
| 1572 | ** <dd> This option taks a single integer argument which is interpreted as |
| 1573 | ** a boolean in order to enable or disable the use of covering indices for |
| 1574 | ** full table scans in the query optimizer. The default setting is determined |
| 1575 | ** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" |
| 1576 | ** if that compile-time option is omitted. |
| 1577 | ** The ability to disable the use of covering indices for full table scans |
| 1578 | ** is because some incorrectly coded legacy applications might malfunction |
| 1579 | ** malfunction when the optimization is enabled. Providing the ability to |
| 1580 | ** disable the optimization allows the older, buggy application code to work |
| 1581 | ** without change even with newer versions of SQLite. |
| 1582 | ** |
| 1583 | ** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] |
| 1584 | ** <dt>SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE |
| 1585 | ** <dd> These options are obsolete and should not be used by new code. |
| 1586 | ** They are retained for backwards compatibility but are now no-ops. |
| @@ -1590,10 +1603,11 @@ | |
| 1603 | #define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ |
| 1604 | #define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ |
| 1605 | #define SQLITE_CONFIG_URI 17 /* int */ |
| 1606 | #define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ |
| 1607 | #define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ |
| 1608 | #define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ |
| 1609 | |
| 1610 | /* |
| 1611 | ** CAPI3REF: Database Connection Configuration Options |
| 1612 | ** |
| 1613 | ** These constants are the available integer configuration options that |
| @@ -2598,11 +2612,11 @@ | |
| 2612 | ** <li> <b>mode</b>: ^(The mode parameter may be set to either "ro", "rw", |
| 2613 | ** "rwc", or "memory". Attempting to set it to any other value is |
| 2614 | ** an error)^. |
| 2615 | ** ^If "ro" is specified, then the database is opened for read-only |
| 2616 | ** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the |
| 2617 | ** third argument to sqlite3_open_v2(). ^If the mode option is set to |
| 2618 | ** "rw", then the database is opened for read-write (but not create) |
| 2619 | ** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had |
| 2620 | ** been set. ^Value "rwc" is equivalent to setting both |
| 2621 | ** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is |
| 2622 | ** set to "memory" then a pure [in-memory database] that never reads |
| @@ -2749,10 +2763,15 @@ | |
| 2763 | ** text that describes the error, as either UTF-8 or UTF-16 respectively. |
| 2764 | ** ^(Memory to hold the error message string is managed internally. |
| 2765 | ** The application does not need to worry about freeing the result. |
| 2766 | ** However, the error string might be overwritten or deallocated by |
| 2767 | ** subsequent calls to other SQLite interface functions.)^ |
| 2768 | ** |
| 2769 | ** ^The sqlite3_errstr() interface returns the English-language text |
| 2770 | ** that describes the [result code], as UTF-8. |
| 2771 | ** ^(Memory to hold the error message string is managed internally |
| 2772 | ** and must not be freed by the application)^. |
| 2773 | ** |
| 2774 | ** When the serialized [threading mode] is in use, it might be the |
| 2775 | ** case that a second error occurs on a separate thread in between |
| 2776 | ** the time of the first error and the call to these interfaces. |
| 2777 | ** When that happens, the second error will be reported since these |
| @@ -2768,10 +2787,11 @@ | |
| 2787 | */ |
| 2788 | SQLITE_API int sqlite3_errcode(sqlite3 *db); |
| 2789 | SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); |
| 2790 | SQLITE_API const char *sqlite3_errmsg(sqlite3*); |
| 2791 | SQLITE_API const void *sqlite3_errmsg16(sqlite3*); |
| 2792 | SQLITE_API const char *sqlite3_errstr(int); |
| 2793 | |
| 2794 | /* |
| 2795 | ** CAPI3REF: SQL Statement Object |
| 2796 | ** KEYWORDS: {prepared statement} {prepared statements} |
| 2797 | ** |
| 2798 |