| | @@ -1,8 +1,8 @@ |
| 1 | 1 | /****************************************************************************** |
| 2 | 2 | ** This file is an amalgamation of many separate C source files from SQLite |
| 3 | | -** version 3.20.0. By combining all the individual C code files into this |
| 3 | +** version 3.19.3. 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. |
| | @@ -20,762 +20,10 @@ |
| 20 | 20 | #define SQLITE_CORE 1 |
| 21 | 21 | #define SQLITE_AMALGAMATION 1 |
| 22 | 22 | #ifndef SQLITE_PRIVATE |
| 23 | 23 | # define SQLITE_PRIVATE static |
| 24 | 24 | #endif |
| 25 | | -/************** Begin file ctime.c *******************************************/ |
| 26 | | -/* |
| 27 | | -** 2010 February 23 |
| 28 | | -** |
| 29 | | -** The author disclaims copyright to this source code. In place of |
| 30 | | -** a legal notice, here is a blessing: |
| 31 | | -** |
| 32 | | -** May you do good and not evil. |
| 33 | | -** May you find forgiveness for yourself and forgive others. |
| 34 | | -** May you share freely, never taking more than you give. |
| 35 | | -** |
| 36 | | -************************************************************************* |
| 37 | | -** |
| 38 | | -** This file implements routines used to report what compile-time options |
| 39 | | -** SQLite was built with. |
| 40 | | -*/ |
| 41 | | - |
| 42 | | -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 43 | | - |
| 44 | | -/* |
| 45 | | -** Include the configuration header output by 'configure' if we're using the |
| 46 | | -** autoconf-based build |
| 47 | | -*/ |
| 48 | | -#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) |
| 49 | | -#include "config.h" |
| 50 | | -#define SQLITECONFIG_H 1 |
| 51 | | -#endif |
| 52 | | - |
| 53 | | -/* These macros are provided to "stringify" the value of the define |
| 54 | | -** for those options in which the value is meaningful. */ |
| 55 | | -#define CTIMEOPT_VAL_(opt) #opt |
| 56 | | -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) |
| 57 | | - |
| 58 | | -/* |
| 59 | | -** An array of names of all compile-time options. This array should |
| 60 | | -** be sorted A-Z. |
| 61 | | -** |
| 62 | | -** This array looks large, but in a typical installation actually uses |
| 63 | | -** only a handful of compile-time options, so most times this array is usually |
| 64 | | -** rather short and uses little memory space. |
| 65 | | -*/ |
| 66 | | -static const char * const sqlite3azCompileOpt[] = { |
| 67 | | - |
| 68 | | -/* |
| 69 | | -** BEGIN CODE GENERATED BY tool/mkctime.tcl |
| 70 | | -*/ |
| 71 | | -#if SQLITE_32BIT_ROWID |
| 72 | | - "32BIT_ROWID", |
| 73 | | -#endif |
| 74 | | -#if SQLITE_4_BYTE_ALIGNED_MALLOC |
| 75 | | - "4_BYTE_ALIGNED_MALLOC", |
| 76 | | -#endif |
| 77 | | -#if SQLITE_64BIT_STATS |
| 78 | | - "64BIT_STATS", |
| 79 | | -#endif |
| 80 | | -#if SQLITE_ALLOW_COVERING_INDEX_SCAN |
| 81 | | - "ALLOW_COVERING_INDEX_SCAN", |
| 82 | | -#endif |
| 83 | | -#if SQLITE_ALLOW_URI_AUTHORITY |
| 84 | | - "ALLOW_URI_AUTHORITY", |
| 85 | | -#endif |
| 86 | | -#ifdef SQLITE_BITMASK_TYPE |
| 87 | | - "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE), |
| 88 | | -#endif |
| 89 | | -#if SQLITE_BUG_COMPATIBLE_20160819 |
| 90 | | - "BUG_COMPATIBLE_20160819", |
| 91 | | -#endif |
| 92 | | -#if SQLITE_CASE_SENSITIVE_LIKE |
| 93 | | - "CASE_SENSITIVE_LIKE", |
| 94 | | -#endif |
| 95 | | -#if SQLITE_CHECK_PAGES |
| 96 | | - "CHECK_PAGES", |
| 97 | | -#endif |
| 98 | | -#if defined(__clang__) && defined(__clang_major__) |
| 99 | | - "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." |
| 100 | | - CTIMEOPT_VAL(__clang_minor__) "." |
| 101 | | - CTIMEOPT_VAL(__clang_patchlevel__), |
| 102 | | -#elif defined(_MSC_VER) |
| 103 | | - "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), |
| 104 | | -#elif defined(__GNUC__) && defined(__VERSION__) |
| 105 | | - "COMPILER=gcc-" __VERSION__, |
| 106 | | -#endif |
| 107 | | -#if SQLITE_COVERAGE_TEST |
| 108 | | - "COVERAGE_TEST", |
| 109 | | -#endif |
| 110 | | -#if SQLITE_DEBUG |
| 111 | | - "DEBUG", |
| 112 | | -#endif |
| 113 | | -#if SQLITE_DEFAULT_AUTOMATIC_INDEX |
| 114 | | - "DEFAULT_AUTOMATIC_INDEX", |
| 115 | | -#endif |
| 116 | | -#if SQLITE_DEFAULT_AUTOVACUUM |
| 117 | | - "DEFAULT_AUTOVACUUM", |
| 118 | | -#endif |
| 119 | | -#ifdef SQLITE_DEFAULT_CACHE_SIZE |
| 120 | | - "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE), |
| 121 | | -#endif |
| 122 | | -#if SQLITE_DEFAULT_CKPTFULLFSYNC |
| 123 | | - "DEFAULT_CKPTFULLFSYNC", |
| 124 | | -#endif |
| 125 | | -#ifdef SQLITE_DEFAULT_FILE_FORMAT |
| 126 | | - "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT), |
| 127 | | -#endif |
| 128 | | -#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS |
| 129 | | - "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS), |
| 130 | | -#endif |
| 131 | | -#if SQLITE_DEFAULT_FOREIGN_KEYS |
| 132 | | - "DEFAULT_FOREIGN_KEYS", |
| 133 | | -#endif |
| 134 | | -#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT |
| 135 | | - "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT), |
| 136 | | -#endif |
| 137 | | -#ifdef SQLITE_DEFAULT_LOCKING_MODE |
| 138 | | - "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), |
| 139 | | -#endif |
| 140 | | -#ifdef SQLITE_DEFAULT_LOOKASIDE |
| 141 | | - "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOOKASIDE), |
| 142 | | -#endif |
| 143 | | -#if SQLITE_DEFAULT_MEMSTATUS |
| 144 | | - "DEFAULT_MEMSTATUS", |
| 145 | | -#endif |
| 146 | | -#ifdef SQLITE_DEFAULT_MMAP_SIZE |
| 147 | | - "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), |
| 148 | | -#endif |
| 149 | | -#ifdef SQLITE_DEFAULT_PAGE_SIZE |
| 150 | | - "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE), |
| 151 | | -#endif |
| 152 | | -#ifdef SQLITE_DEFAULT_PCACHE_INITSZ |
| 153 | | - "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ), |
| 154 | | -#endif |
| 155 | | -#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS |
| 156 | | - "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS), |
| 157 | | -#endif |
| 158 | | -#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS |
| 159 | | - "DEFAULT_RECURSIVE_TRIGGERS", |
| 160 | | -#endif |
| 161 | | -#ifdef SQLITE_DEFAULT_ROWEST |
| 162 | | - "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST), |
| 163 | | -#endif |
| 164 | | -#ifdef SQLITE_DEFAULT_SECTOR_SIZE |
| 165 | | - "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE), |
| 166 | | -#endif |
| 167 | | -#ifdef SQLITE_DEFAULT_SYNCHRONOUS |
| 168 | | - "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), |
| 169 | | -#endif |
| 170 | | -#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT |
| 171 | | - "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT), |
| 172 | | -#endif |
| 173 | | -#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS |
| 174 | | - "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), |
| 175 | | -#endif |
| 176 | | -#ifdef SQLITE_DEFAULT_WORKER_THREADS |
| 177 | | - "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS), |
| 178 | | -#endif |
| 179 | | -#if SQLITE_DIRECT_OVERFLOW_READ |
| 180 | | - "DIRECT_OVERFLOW_READ", |
| 181 | | -#endif |
| 182 | | -#if SQLITE_DISABLE_DIRSYNC |
| 183 | | - "DISABLE_DIRSYNC", |
| 184 | | -#endif |
| 185 | | -#if SQLITE_DISABLE_FTS3_UNICODE |
| 186 | | - "DISABLE_FTS3_UNICODE", |
| 187 | | -#endif |
| 188 | | -#if SQLITE_DISABLE_FTS4_DEFERRED |
| 189 | | - "DISABLE_FTS4_DEFERRED", |
| 190 | | -#endif |
| 191 | | -#if SQLITE_DISABLE_INTRINSIC |
| 192 | | - "DISABLE_INTRINSIC", |
| 193 | | -#endif |
| 194 | | -#if SQLITE_DISABLE_LFS |
| 195 | | - "DISABLE_LFS", |
| 196 | | -#endif |
| 197 | | -#if SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS |
| 198 | | - "DISABLE_PAGECACHE_OVERFLOW_STATS", |
| 199 | | -#endif |
| 200 | | -#if SQLITE_DISABLE_SKIPAHEAD_DISTINCT |
| 201 | | - "DISABLE_SKIPAHEAD_DISTINCT", |
| 202 | | -#endif |
| 203 | | -#ifdef SQLITE_ENABLE_8_3_NAMES |
| 204 | | - "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), |
| 205 | | -#endif |
| 206 | | -#if SQLITE_ENABLE_API_ARMOR |
| 207 | | - "ENABLE_API_ARMOR", |
| 208 | | -#endif |
| 209 | | -#if SQLITE_ENABLE_ATOMIC_WRITE |
| 210 | | - "ENABLE_ATOMIC_WRITE", |
| 211 | | -#endif |
| 212 | | -#if SQLITE_ENABLE_CEROD |
| 213 | | - "ENABLE_CEROD", |
| 214 | | -#endif |
| 215 | | -#if SQLITE_ENABLE_COLUMN_METADATA |
| 216 | | - "ENABLE_COLUMN_METADATA", |
| 217 | | -#endif |
| 218 | | -#if SQLITE_ENABLE_COLUMN_USED_MASK |
| 219 | | - "ENABLE_COLUMN_USED_MASK", |
| 220 | | -#endif |
| 221 | | -#if SQLITE_ENABLE_COSTMULT |
| 222 | | - "ENABLE_COSTMULT", |
| 223 | | -#endif |
| 224 | | -#if SQLITE_ENABLE_CURSOR_HINTS |
| 225 | | - "ENABLE_CURSOR_HINTS", |
| 226 | | -#endif |
| 227 | | -#if SQLITE_ENABLE_DBSTAT_VTAB |
| 228 | | - "ENABLE_DBSTAT_VTAB", |
| 229 | | -#endif |
| 230 | | -#if SQLITE_ENABLE_EXPENSIVE_ASSERT |
| 231 | | - "ENABLE_EXPENSIVE_ASSERT", |
| 232 | | -#endif |
| 233 | | -#if SQLITE_ENABLE_FTS1 |
| 234 | | - "ENABLE_FTS1", |
| 235 | | -#endif |
| 236 | | -#if SQLITE_ENABLE_FTS2 |
| 237 | | - "ENABLE_FTS2", |
| 238 | | -#endif |
| 239 | | -#if SQLITE_ENABLE_FTS3 |
| 240 | | - "ENABLE_FTS3", |
| 241 | | -#endif |
| 242 | | -#if SQLITE_ENABLE_FTS3_PARENTHESIS |
| 243 | | - "ENABLE_FTS3_PARENTHESIS", |
| 244 | | -#endif |
| 245 | | -#if SQLITE_ENABLE_FTS3_TOKENIZER |
| 246 | | - "ENABLE_FTS3_TOKENIZER", |
| 247 | | -#endif |
| 248 | | -#if SQLITE_ENABLE_FTS4 |
| 249 | | - "ENABLE_FTS4", |
| 250 | | -#endif |
| 251 | | -#if SQLITE_ENABLE_FTS5 |
| 252 | | - "ENABLE_FTS5", |
| 253 | | -#endif |
| 254 | | -#if SQLITE_ENABLE_HIDDEN_COLUMNS |
| 255 | | - "ENABLE_HIDDEN_COLUMNS", |
| 256 | | -#endif |
| 257 | | -#if SQLITE_ENABLE_ICU |
| 258 | | - "ENABLE_ICU", |
| 259 | | -#endif |
| 260 | | -#if SQLITE_ENABLE_IOTRACE |
| 261 | | - "ENABLE_IOTRACE", |
| 262 | | -#endif |
| 263 | | -#if SQLITE_ENABLE_JSON1 |
| 264 | | - "ENABLE_JSON1", |
| 265 | | -#endif |
| 266 | | -#if SQLITE_ENABLE_LOAD_EXTENSION |
| 267 | | - "ENABLE_LOAD_EXTENSION", |
| 268 | | -#endif |
| 269 | | -#ifdef SQLITE_ENABLE_LOCKING_STYLE |
| 270 | | - "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), |
| 271 | | -#endif |
| 272 | | -#if SQLITE_ENABLE_MEMORY_MANAGEMENT |
| 273 | | - "ENABLE_MEMORY_MANAGEMENT", |
| 274 | | -#endif |
| 275 | | -#if SQLITE_ENABLE_MEMSYS3 |
| 276 | | - "ENABLE_MEMSYS3", |
| 277 | | -#endif |
| 278 | | -#if SQLITE_ENABLE_MEMSYS5 |
| 279 | | - "ENABLE_MEMSYS5", |
| 280 | | -#endif |
| 281 | | -#if SQLITE_ENABLE_MULTIPLEX |
| 282 | | - "ENABLE_MULTIPLEX", |
| 283 | | -#endif |
| 284 | | -#if SQLITE_ENABLE_NULL_TRIM |
| 285 | | - "ENABLE_NULL_TRIM", |
| 286 | | -#endif |
| 287 | | -#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK |
| 288 | | - "ENABLE_OVERSIZE_CELL_CHECK", |
| 289 | | -#endif |
| 290 | | -#if SQLITE_ENABLE_PREUPDATE_HOOK |
| 291 | | - "ENABLE_PREUPDATE_HOOK", |
| 292 | | -#endif |
| 293 | | -#if SQLITE_ENABLE_QPSG |
| 294 | | - "ENABLE_QPSG", |
| 295 | | -#endif |
| 296 | | -#if SQLITE_ENABLE_RBU |
| 297 | | - "ENABLE_RBU", |
| 298 | | -#endif |
| 299 | | -#if SQLITE_ENABLE_RTREE |
| 300 | | - "ENABLE_RTREE", |
| 301 | | -#endif |
| 302 | | -#if SQLITE_ENABLE_SELECTTRACE |
| 303 | | - "ENABLE_SELECTTRACE", |
| 304 | | -#endif |
| 305 | | -#if SQLITE_ENABLE_SESSION |
| 306 | | - "ENABLE_SESSION", |
| 307 | | -#endif |
| 308 | | -#if SQLITE_ENABLE_SNAPSHOT |
| 309 | | - "ENABLE_SNAPSHOT", |
| 310 | | -#endif |
| 311 | | -#if SQLITE_ENABLE_SQLLOG |
| 312 | | - "ENABLE_SQLLOG", |
| 313 | | -#endif |
| 314 | | -#if defined(SQLITE_ENABLE_STAT4) |
| 315 | | - "ENABLE_STAT4", |
| 316 | | -#elif defined(SQLITE_ENABLE_STAT3) |
| 317 | | - "ENABLE_STAT3", |
| 318 | | -#endif |
| 319 | | -#if SQLITE_ENABLE_STMTVTAB |
| 320 | | - "ENABLE_STMTVTAB", |
| 321 | | -#endif |
| 322 | | -#if SQLITE_ENABLE_STMT_SCANSTATUS |
| 323 | | - "ENABLE_STMT_SCANSTATUS", |
| 324 | | -#endif |
| 325 | | -#if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION |
| 326 | | - "ENABLE_UNKNOWN_SQL_FUNCTION", |
| 327 | | -#endif |
| 328 | | -#if SQLITE_ENABLE_UNLOCK_NOTIFY |
| 329 | | - "ENABLE_UNLOCK_NOTIFY", |
| 330 | | -#endif |
| 331 | | -#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT |
| 332 | | - "ENABLE_UPDATE_DELETE_LIMIT", |
| 333 | | -#endif |
| 334 | | -#if SQLITE_ENABLE_URI_00_ERROR |
| 335 | | - "ENABLE_URI_00_ERROR", |
| 336 | | -#endif |
| 337 | | -#if SQLITE_ENABLE_VFSTRACE |
| 338 | | - "ENABLE_VFSTRACE", |
| 339 | | -#endif |
| 340 | | -#if SQLITE_ENABLE_WHERETRACE |
| 341 | | - "ENABLE_WHERETRACE", |
| 342 | | -#endif |
| 343 | | -#if SQLITE_ENABLE_ZIPVFS |
| 344 | | - "ENABLE_ZIPVFS", |
| 345 | | -#endif |
| 346 | | -#if SQLITE_EXPLAIN_ESTIMATED_ROWS |
| 347 | | - "EXPLAIN_ESTIMATED_ROWS", |
| 348 | | -#endif |
| 349 | | -#if SQLITE_EXTRA_IFNULLROW |
| 350 | | - "EXTRA_IFNULLROW", |
| 351 | | -#endif |
| 352 | | -#ifdef SQLITE_EXTRA_INIT |
| 353 | | - "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT), |
| 354 | | -#endif |
| 355 | | -#ifdef SQLITE_EXTRA_SHUTDOWN |
| 356 | | - "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN), |
| 357 | | -#endif |
| 358 | | -#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH |
| 359 | | - "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH), |
| 360 | | -#endif |
| 361 | | -#if SQLITE_FTS5_ENABLE_TEST_MI |
| 362 | | - "FTS5_ENABLE_TEST_MI", |
| 363 | | -#endif |
| 364 | | -#if SQLITE_FTS5_NO_WITHOUT_ROWID |
| 365 | | - "FTS5_NO_WITHOUT_ROWID", |
| 366 | | -#endif |
| 367 | | -#if SQLITE_HAS_CODEC |
| 368 | | - "HAS_CODEC", |
| 369 | | -#endif |
| 370 | | -#if HAVE_ISNAN || SQLITE_HAVE_ISNAN |
| 371 | | - "HAVE_ISNAN", |
| 372 | | -#endif |
| 373 | | -#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX |
| 374 | | - "HOMEGROWN_RECURSIVE_MUTEX", |
| 375 | | -#endif |
| 376 | | -#if SQLITE_IGNORE_AFP_LOCK_ERRORS |
| 377 | | - "IGNORE_AFP_LOCK_ERRORS", |
| 378 | | -#endif |
| 379 | | -#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS |
| 380 | | - "IGNORE_FLOCK_LOCK_ERRORS", |
| 381 | | -#endif |
| 382 | | -#if SQLITE_INLINE_MEMCPY |
| 383 | | - "INLINE_MEMCPY", |
| 384 | | -#endif |
| 385 | | -#if SQLITE_INT64_TYPE |
| 386 | | - "INT64_TYPE", |
| 387 | | -#endif |
| 388 | | -#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX |
| 389 | | - "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX), |
| 390 | | -#endif |
| 391 | | -#if SQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 392 | | - "LIKE_DOESNT_MATCH_BLOBS", |
| 393 | | -#endif |
| 394 | | -#if SQLITE_LOCK_TRACE |
| 395 | | - "LOCK_TRACE", |
| 396 | | -#endif |
| 397 | | -#if SQLITE_LOG_CACHE_SPILL |
| 398 | | - "LOG_CACHE_SPILL", |
| 399 | | -#endif |
| 400 | | -#ifdef SQLITE_MALLOC_SOFT_LIMIT |
| 401 | | - "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT), |
| 402 | | -#endif |
| 403 | | -#ifdef SQLITE_MAX_ATTACHED |
| 404 | | - "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED), |
| 405 | | -#endif |
| 406 | | -#ifdef SQLITE_MAX_COLUMN |
| 407 | | - "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN), |
| 408 | | -#endif |
| 409 | | -#ifdef SQLITE_MAX_COMPOUND_SELECT |
| 410 | | - "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT), |
| 411 | | -#endif |
| 412 | | -#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE |
| 413 | | - "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE), |
| 414 | | -#endif |
| 415 | | -#ifdef SQLITE_MAX_EXPR_DEPTH |
| 416 | | - "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH), |
| 417 | | -#endif |
| 418 | | -#ifdef SQLITE_MAX_FUNCTION_ARG |
| 419 | | - "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG), |
| 420 | | -#endif |
| 421 | | -#ifdef SQLITE_MAX_LENGTH |
| 422 | | - "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH), |
| 423 | | -#endif |
| 424 | | -#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH |
| 425 | | - "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH), |
| 426 | | -#endif |
| 427 | | -#ifdef SQLITE_MAX_MEMORY |
| 428 | | - "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY), |
| 429 | | -#endif |
| 430 | | -#ifdef SQLITE_MAX_MMAP_SIZE |
| 431 | | - "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), |
| 432 | | -#endif |
| 433 | | -#ifdef SQLITE_MAX_MMAP_SIZE_ |
| 434 | | - "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_), |
| 435 | | -#endif |
| 436 | | -#ifdef SQLITE_MAX_PAGE_COUNT |
| 437 | | - "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT), |
| 438 | | -#endif |
| 439 | | -#ifdef SQLITE_MAX_PAGE_SIZE |
| 440 | | - "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE), |
| 441 | | -#endif |
| 442 | | -#ifdef SQLITE_MAX_SCHEMA_RETRY |
| 443 | | - "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), |
| 444 | | -#endif |
| 445 | | -#ifdef SQLITE_MAX_SQL_LENGTH |
| 446 | | - "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH), |
| 447 | | -#endif |
| 448 | | -#ifdef SQLITE_MAX_TRIGGER_DEPTH |
| 449 | | - "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH), |
| 450 | | -#endif |
| 451 | | -#ifdef SQLITE_MAX_VARIABLE_NUMBER |
| 452 | | - "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER), |
| 453 | | -#endif |
| 454 | | -#ifdef SQLITE_MAX_VDBE_OP |
| 455 | | - "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP), |
| 456 | | -#endif |
| 457 | | -#ifdef SQLITE_MAX_WORKER_THREADS |
| 458 | | - "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS), |
| 459 | | -#endif |
| 460 | | -#if SQLITE_MEMDEBUG |
| 461 | | - "MEMDEBUG", |
| 462 | | -#endif |
| 463 | | -#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT |
| 464 | | - "MIXED_ENDIAN_64BIT_FLOAT", |
| 465 | | -#endif |
| 466 | | -#if SQLITE_MMAP_READWRITE |
| 467 | | - "MMAP_READWRITE", |
| 468 | | -#endif |
| 469 | | -#if SQLITE_MUTEX_NOOP |
| 470 | | - "MUTEX_NOOP", |
| 471 | | -#endif |
| 472 | | -#if SQLITE_MUTEX_NREF |
| 473 | | - "MUTEX_NREF", |
| 474 | | -#endif |
| 475 | | -#if SQLITE_MUTEX_OMIT |
| 476 | | - "MUTEX_OMIT", |
| 477 | | -#endif |
| 478 | | -#if SQLITE_MUTEX_PTHREADS |
| 479 | | - "MUTEX_PTHREADS", |
| 480 | | -#endif |
| 481 | | -#if SQLITE_MUTEX_W32 |
| 482 | | - "MUTEX_W32", |
| 483 | | -#endif |
| 484 | | -#if SQLITE_NEED_ERR_NAME |
| 485 | | - "NEED_ERR_NAME", |
| 486 | | -#endif |
| 487 | | -#if SQLITE_NOINLINE |
| 488 | | - "NOINLINE", |
| 489 | | -#endif |
| 490 | | -#if SQLITE_NO_SYNC |
| 491 | | - "NO_SYNC", |
| 492 | | -#endif |
| 493 | | -#if SQLITE_OMIT_ALTERTABLE |
| 494 | | - "OMIT_ALTERTABLE", |
| 495 | | -#endif |
| 496 | | -#if SQLITE_OMIT_ANALYZE |
| 497 | | - "OMIT_ANALYZE", |
| 498 | | -#endif |
| 499 | | -#if SQLITE_OMIT_ATTACH |
| 500 | | - "OMIT_ATTACH", |
| 501 | | -#endif |
| 502 | | -#if SQLITE_OMIT_AUTHORIZATION |
| 503 | | - "OMIT_AUTHORIZATION", |
| 504 | | -#endif |
| 505 | | -#if SQLITE_OMIT_AUTOINCREMENT |
| 506 | | - "OMIT_AUTOINCREMENT", |
| 507 | | -#endif |
| 508 | | -#if SQLITE_OMIT_AUTOINIT |
| 509 | | - "OMIT_AUTOINIT", |
| 510 | | -#endif |
| 511 | | -#if SQLITE_OMIT_AUTOMATIC_INDEX |
| 512 | | - "OMIT_AUTOMATIC_INDEX", |
| 513 | | -#endif |
| 514 | | -#if SQLITE_OMIT_AUTORESET |
| 515 | | - "OMIT_AUTORESET", |
| 516 | | -#endif |
| 517 | | -#if SQLITE_OMIT_AUTOVACUUM |
| 518 | | - "OMIT_AUTOVACUUM", |
| 519 | | -#endif |
| 520 | | -#if SQLITE_OMIT_BETWEEN_OPTIMIZATION |
| 521 | | - "OMIT_BETWEEN_OPTIMIZATION", |
| 522 | | -#endif |
| 523 | | -#if SQLITE_OMIT_BLOB_LITERAL |
| 524 | | - "OMIT_BLOB_LITERAL", |
| 525 | | -#endif |
| 526 | | -#if SQLITE_OMIT_BTREECOUNT |
| 527 | | - "OMIT_BTREECOUNT", |
| 528 | | -#endif |
| 529 | | -#if SQLITE_OMIT_CAST |
| 530 | | - "OMIT_CAST", |
| 531 | | -#endif |
| 532 | | -#if SQLITE_OMIT_CHECK |
| 533 | | - "OMIT_CHECK", |
| 534 | | -#endif |
| 535 | | -#if SQLITE_OMIT_COMPLETE |
| 536 | | - "OMIT_COMPLETE", |
| 537 | | -#endif |
| 538 | | -#if SQLITE_OMIT_COMPOUND_SELECT |
| 539 | | - "OMIT_COMPOUND_SELECT", |
| 540 | | -#endif |
| 541 | | -#if SQLITE_OMIT_CONFLICT_CLAUSE |
| 542 | | - "OMIT_CONFLICT_CLAUSE", |
| 543 | | -#endif |
| 544 | | -#if SQLITE_OMIT_CTE |
| 545 | | - "OMIT_CTE", |
| 546 | | -#endif |
| 547 | | -#if SQLITE_OMIT_DATETIME_FUNCS |
| 548 | | - "OMIT_DATETIME_FUNCS", |
| 549 | | -#endif |
| 550 | | -#if SQLITE_OMIT_DECLTYPE |
| 551 | | - "OMIT_DECLTYPE", |
| 552 | | -#endif |
| 553 | | -#if SQLITE_OMIT_DEPRECATED |
| 554 | | - "OMIT_DEPRECATED", |
| 555 | | -#endif |
| 556 | | -#if SQLITE_OMIT_DISKIO |
| 557 | | - "OMIT_DISKIO", |
| 558 | | -#endif |
| 559 | | -#if SQLITE_OMIT_EXPLAIN |
| 560 | | - "OMIT_EXPLAIN", |
| 561 | | -#endif |
| 562 | | -#if SQLITE_OMIT_FLAG_PRAGMAS |
| 563 | | - "OMIT_FLAG_PRAGMAS", |
| 564 | | -#endif |
| 565 | | -#if SQLITE_OMIT_FLOATING_POINT |
| 566 | | - "OMIT_FLOATING_POINT", |
| 567 | | -#endif |
| 568 | | -#if SQLITE_OMIT_FOREIGN_KEY |
| 569 | | - "OMIT_FOREIGN_KEY", |
| 570 | | -#endif |
| 571 | | -#if SQLITE_OMIT_GET_TABLE |
| 572 | | - "OMIT_GET_TABLE", |
| 573 | | -#endif |
| 574 | | -#if SQLITE_OMIT_HEX_INTEGER |
| 575 | | - "OMIT_HEX_INTEGER", |
| 576 | | -#endif |
| 577 | | -#if SQLITE_OMIT_INCRBLOB |
| 578 | | - "OMIT_INCRBLOB", |
| 579 | | -#endif |
| 580 | | -#if SQLITE_OMIT_INTEGRITY_CHECK |
| 581 | | - "OMIT_INTEGRITY_CHECK", |
| 582 | | -#endif |
| 583 | | -#if SQLITE_OMIT_LIKE_OPTIMIZATION |
| 584 | | - "OMIT_LIKE_OPTIMIZATION", |
| 585 | | -#endif |
| 586 | | -#if SQLITE_OMIT_LOAD_EXTENSION |
| 587 | | - "OMIT_LOAD_EXTENSION", |
| 588 | | -#endif |
| 589 | | -#if SQLITE_OMIT_LOCALTIME |
| 590 | | - "OMIT_LOCALTIME", |
| 591 | | -#endif |
| 592 | | -#if SQLITE_OMIT_LOOKASIDE |
| 593 | | - "OMIT_LOOKASIDE", |
| 594 | | -#endif |
| 595 | | -#if SQLITE_OMIT_MEMORYDB |
| 596 | | - "OMIT_MEMORYDB", |
| 597 | | -#endif |
| 598 | | -#if SQLITE_OMIT_OR_OPTIMIZATION |
| 599 | | - "OMIT_OR_OPTIMIZATION", |
| 600 | | -#endif |
| 601 | | -#if SQLITE_OMIT_PAGER_PRAGMAS |
| 602 | | - "OMIT_PAGER_PRAGMAS", |
| 603 | | -#endif |
| 604 | | -#if SQLITE_OMIT_PARSER_TRACE |
| 605 | | - "OMIT_PARSER_TRACE", |
| 606 | | -#endif |
| 607 | | -#if SQLITE_OMIT_POPEN |
| 608 | | - "OMIT_POPEN", |
| 609 | | -#endif |
| 610 | | -#if SQLITE_OMIT_PRAGMA |
| 611 | | - "OMIT_PRAGMA", |
| 612 | | -#endif |
| 613 | | -#if SQLITE_OMIT_PROGRESS_CALLBACK |
| 614 | | - "OMIT_PROGRESS_CALLBACK", |
| 615 | | -#endif |
| 616 | | -#if SQLITE_OMIT_QUICKBALANCE |
| 617 | | - "OMIT_QUICKBALANCE", |
| 618 | | -#endif |
| 619 | | -#if SQLITE_OMIT_REINDEX |
| 620 | | - "OMIT_REINDEX", |
| 621 | | -#endif |
| 622 | | -#if SQLITE_OMIT_SCHEMA_PRAGMAS |
| 623 | | - "OMIT_SCHEMA_PRAGMAS", |
| 624 | | -#endif |
| 625 | | -#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS |
| 626 | | - "OMIT_SCHEMA_VERSION_PRAGMAS", |
| 627 | | -#endif |
| 628 | | -#if SQLITE_OMIT_SHARED_CACHE |
| 629 | | - "OMIT_SHARED_CACHE", |
| 630 | | -#endif |
| 631 | | -#if SQLITE_OMIT_SHUTDOWN_DIRECTORIES |
| 632 | | - "OMIT_SHUTDOWN_DIRECTORIES", |
| 633 | | -#endif |
| 634 | | -#if SQLITE_OMIT_SUBQUERY |
| 635 | | - "OMIT_SUBQUERY", |
| 636 | | -#endif |
| 637 | | -#if SQLITE_OMIT_TCL_VARIABLE |
| 638 | | - "OMIT_TCL_VARIABLE", |
| 639 | | -#endif |
| 640 | | -#if SQLITE_OMIT_TEMPDB |
| 641 | | - "OMIT_TEMPDB", |
| 642 | | -#endif |
| 643 | | -#if SQLITE_OMIT_TEST_CONTROL |
| 644 | | - "OMIT_TEST_CONTROL", |
| 645 | | -#endif |
| 646 | | -#if SQLITE_OMIT_TRACE |
| 647 | | - "OMIT_TRACE", |
| 648 | | -#endif |
| 649 | | -#if SQLITE_OMIT_TRIGGER |
| 650 | | - "OMIT_TRIGGER", |
| 651 | | -#endif |
| 652 | | -#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION |
| 653 | | - "OMIT_TRUNCATE_OPTIMIZATION", |
| 654 | | -#endif |
| 655 | | -#if SQLITE_OMIT_UTF16 |
| 656 | | - "OMIT_UTF16", |
| 657 | | -#endif |
| 658 | | -#if SQLITE_OMIT_VACUUM |
| 659 | | - "OMIT_VACUUM", |
| 660 | | -#endif |
| 661 | | -#if SQLITE_OMIT_VIEW |
| 662 | | - "OMIT_VIEW", |
| 663 | | -#endif |
| 664 | | -#if SQLITE_OMIT_VIRTUALTABLE |
| 665 | | - "OMIT_VIRTUALTABLE", |
| 666 | | -#endif |
| 667 | | -#if SQLITE_OMIT_WAL |
| 668 | | - "OMIT_WAL", |
| 669 | | -#endif |
| 670 | | -#if SQLITE_OMIT_WSD |
| 671 | | - "OMIT_WSD", |
| 672 | | -#endif |
| 673 | | -#if SQLITE_OMIT_XFER_OPT |
| 674 | | - "OMIT_XFER_OPT", |
| 675 | | -#endif |
| 676 | | -#if SQLITE_PCACHE_SEPARATE_HEADER |
| 677 | | - "PCACHE_SEPARATE_HEADER", |
| 678 | | -#endif |
| 679 | | -#if SQLITE_PERFORMANCE_TRACE |
| 680 | | - "PERFORMANCE_TRACE", |
| 681 | | -#endif |
| 682 | | -#if SQLITE_POWERSAFE_OVERWRITE |
| 683 | | - "POWERSAFE_OVERWRITE", |
| 684 | | -#endif |
| 685 | | -#if SQLITE_PREFER_PROXY_LOCKING |
| 686 | | - "PREFER_PROXY_LOCKING", |
| 687 | | -#endif |
| 688 | | -#if SQLITE_PROXY_DEBUG |
| 689 | | - "PROXY_DEBUG", |
| 690 | | -#endif |
| 691 | | -#if SQLITE_REVERSE_UNORDERED_SELECTS |
| 692 | | - "REVERSE_UNORDERED_SELECTS", |
| 693 | | -#endif |
| 694 | | -#if SQLITE_RTREE_INT_ONLY |
| 695 | | - "RTREE_INT_ONLY", |
| 696 | | -#endif |
| 697 | | -#if SQLITE_SECURE_DELETE |
| 698 | | - "SECURE_DELETE", |
| 699 | | -#endif |
| 700 | | -#if SQLITE_SMALL_STACK |
| 701 | | - "SMALL_STACK", |
| 702 | | -#endif |
| 703 | | -#ifdef SQLITE_SORTER_PMASZ |
| 704 | | - "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ), |
| 705 | | -#endif |
| 706 | | -#if SQLITE_SOUNDEX |
| 707 | | - "SOUNDEX", |
| 708 | | -#endif |
| 709 | | -#ifdef SQLITE_STAT4_SAMPLES |
| 710 | | - "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES), |
| 711 | | -#endif |
| 712 | | -#ifdef SQLITE_STMTJRNL_SPILL |
| 713 | | - "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL), |
| 714 | | -#endif |
| 715 | | -#if SQLITE_SUBSTR_COMPATIBILITY |
| 716 | | - "SUBSTR_COMPATIBILITY", |
| 717 | | -#endif |
| 718 | | -#if SQLITE_SYSTEM_MALLOC |
| 719 | | - "SYSTEM_MALLOC", |
| 720 | | -#endif |
| 721 | | -#if SQLITE_TCL |
| 722 | | - "TCL", |
| 723 | | -#endif |
| 724 | | -#ifdef SQLITE_TEMP_STORE |
| 725 | | - "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), |
| 726 | | -#endif |
| 727 | | -#if SQLITE_TEST |
| 728 | | - "TEST", |
| 729 | | -#endif |
| 730 | | -#if defined(SQLITE_THREADSAFE) |
| 731 | | - "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), |
| 732 | | -#elif defined(THREADSAFE) |
| 733 | | - "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE), |
| 734 | | -#else |
| 735 | | - "THREADSAFE=1", |
| 736 | | -#endif |
| 737 | | -#if SQLITE_UNLINK_AFTER_CLOSE |
| 738 | | - "UNLINK_AFTER_CLOSE", |
| 739 | | -#endif |
| 740 | | -#if SQLITE_UNTESTABLE |
| 741 | | - "UNTESTABLE", |
| 742 | | -#endif |
| 743 | | -#if SQLITE_USER_AUTHENTICATION |
| 744 | | - "USER_AUTHENTICATION", |
| 745 | | -#endif |
| 746 | | -#if SQLITE_USE_ALLOCA |
| 747 | | - "USE_ALLOCA", |
| 748 | | -#endif |
| 749 | | -#if SQLITE_USE_FCNTL_TRACE |
| 750 | | - "USE_FCNTL_TRACE", |
| 751 | | -#endif |
| 752 | | -#if SQLITE_USE_URI |
| 753 | | - "USE_URI", |
| 754 | | -#endif |
| 755 | | -#if SQLITE_VDBE_COVERAGE |
| 756 | | - "VDBE_COVERAGE", |
| 757 | | -#endif |
| 758 | | -#if SQLITE_WIN32_MALLOC |
| 759 | | - "WIN32_MALLOC", |
| 760 | | -#endif |
| 761 | | -#if SQLITE_ZERO_MALLOC |
| 762 | | - "ZERO_MALLOC", |
| 763 | | -#endif |
| 764 | | -/* |
| 765 | | -** END CODE GENERATED BY tool/mkctime.tcl |
| 766 | | -*/ |
| 767 | | -}; |
| 768 | | - |
| 769 | | -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){ |
| 770 | | - *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]); |
| 771 | | - return (const char**)sqlite3azCompileOpt; |
| 772 | | -} |
| 773 | | - |
| 774 | | -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ |
| 775 | | - |
| 776 | | -/************** End of ctime.c ***********************************************/ |
| 777 | 25 | /************** Begin file sqliteInt.h ***************************************/ |
| 778 | 26 | /* |
| 779 | 27 | ** 2001 September 15 |
| 780 | 28 | ** |
| 781 | 29 | ** The author disclaims copyright to this source code. In place of |
| | @@ -1026,11 +274,11 @@ |
| 1026 | 274 | ** MinGW. |
| 1027 | 275 | */ |
| 1028 | 276 | /************** Include sqlite3.h in the middle of sqliteInt.h ***************/ |
| 1029 | 277 | /************** Begin file sqlite3.h *****************************************/ |
| 1030 | 278 | /* |
| 1031 | | -** 2001-09-15 |
| 279 | +** 2001 September 15 |
| 1032 | 280 | ** |
| 1033 | 281 | ** The author disclaims copyright to this source code. In place of |
| 1034 | 282 | ** a legal notice, here is a blessing: |
| 1035 | 283 | ** |
| 1036 | 284 | ** May you do good and not evil. |
| | @@ -1148,13 +396,13 @@ |
| 1148 | 396 | ** |
| 1149 | 397 | ** See also: [sqlite3_libversion()], |
| 1150 | 398 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 1151 | 399 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 1152 | 400 | */ |
| 1153 | | -#define SQLITE_VERSION "3.20.0" |
| 1154 | | -#define SQLITE_VERSION_NUMBER 3020000 |
| 1155 | | -#define SQLITE_SOURCE_ID "2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954" |
| 401 | +#define SQLITE_VERSION "3.19.3" |
| 402 | +#define SQLITE_VERSION_NUMBER 3019003 |
| 403 | +#define SQLITE_SOURCE_ID "2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b" |
| 1156 | 404 | |
| 1157 | 405 | /* |
| 1158 | 406 | ** CAPI3REF: Run-Time Library Version Numbers |
| 1159 | 407 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 1160 | 408 | ** |
| | @@ -1262,11 +510,11 @@ |
| 1262 | 510 | ** the opaque structure named "sqlite3". It is useful to think of an sqlite3 |
| 1263 | 511 | ** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and |
| 1264 | 512 | ** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] |
| 1265 | 513 | ** and [sqlite3_close_v2()] are its destructors. There are many other |
| 1266 | 514 | ** interfaces (such as |
| 1267 | | -** [sqlite3_prepare_v3()], [sqlite3_create_function()], and |
| 515 | +** [sqlite3_prepare_v2()], [sqlite3_create_function()], and |
| 1268 | 516 | ** [sqlite3_busy_timeout()] to name but three) that are methods on an |
| 1269 | 517 | ** sqlite3 object. |
| 1270 | 518 | */ |
| 1271 | 519 | typedef struct sqlite3 sqlite3; |
| 1272 | 520 | |
| | @@ -1366,11 +614,11 @@ |
| 1366 | 614 | /* |
| 1367 | 615 | ** CAPI3REF: One-Step Query Execution Interface |
| 1368 | 616 | ** METHOD: sqlite3 |
| 1369 | 617 | ** |
| 1370 | 618 | ** The sqlite3_exec() interface is a convenience wrapper around |
| 1371 | | -** [sqlite3_prepare_v3()], [sqlite3_step()], and [sqlite3_finalize()], |
| 619 | +** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], |
| 1372 | 620 | ** that allows an application to run multiple statements of SQL |
| 1373 | 621 | ** without having to use a lot of C code. |
| 1374 | 622 | ** |
| 1375 | 623 | ** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, |
| 1376 | 624 | ** semicolon-separate SQL statements passed into its 2nd argument, |
| | @@ -3034,31 +2282,19 @@ |
| 3034 | 2282 | ** default) to enable them. The second parameter is a pointer to an integer |
| 3035 | 2283 | ** into which is written 0 or 1 to indicate whether checkpoints-on-close |
| 3036 | 2284 | ** have been disabled - 0 if they are not disabled, 1 if they are. |
| 3037 | 2285 | ** </dd> |
| 3038 | 2286 | ** |
| 3039 | | -** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt> |
| 3040 | | -** <dd>The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates |
| 3041 | | -** the [query planner stability guarantee] (QPSG). When the QPSG is active, |
| 3042 | | -** a single SQL query statement will always use the same algorithm regardless |
| 3043 | | -** of values of [bound parameters]. The QPSG disables some query optimizations |
| 3044 | | -** that look at the values of bound parameters, which can make some queries |
| 3045 | | -** slower. But the QPSG has the advantage of more predictable behavior. With |
| 3046 | | -** the QPSG active, SQLite will always use the same query plan in the field as |
| 3047 | | -** was used during testing in the lab. |
| 3048 | | -** </dd> |
| 3049 | | -** |
| 3050 | 2287 | ** </dl> |
| 3051 | 2288 | */ |
| 3052 | 2289 | #define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */ |
| 3053 | 2290 | #define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ |
| 3054 | 2291 | #define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ |
| 3055 | 2292 | #define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ |
| 3056 | 2293 | #define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */ |
| 3057 | 2294 | #define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */ |
| 3058 | 2295 | #define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */ |
| 3059 | | -#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */ |
| 3060 | 2296 | |
| 3061 | 2297 | |
| 3062 | 2298 | /* |
| 3063 | 2299 | ** CAPI3REF: Enable Or Disable Extended Result Codes |
| 3064 | 2300 | ** METHOD: sqlite3 |
| | @@ -3718,26 +2954,25 @@ |
| 3718 | 2954 | ** |
| 3719 | 2955 | ** ^This routine registers an authorizer callback with a particular |
| 3720 | 2956 | ** [database connection], supplied in the first argument. |
| 3721 | 2957 | ** ^The authorizer callback is invoked as SQL statements are being compiled |
| 3722 | 2958 | ** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], |
| 3723 | | -** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()], |
| 3724 | | -** and [sqlite3_prepare16_v3()]. ^At various |
| 2959 | +** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various |
| 3725 | 2960 | ** points during the compilation process, as logic is being created |
| 3726 | 2961 | ** to perform various actions, the authorizer callback is invoked to |
| 3727 | 2962 | ** see if those actions are allowed. ^The authorizer callback should |
| 3728 | 2963 | ** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the |
| 3729 | 2964 | ** specific action but allow the SQL statement to continue to be |
| 3730 | 2965 | ** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be |
| 3731 | 2966 | ** rejected with an error. ^If the authorizer callback returns |
| 3732 | 2967 | ** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] |
| 3733 | | -** then the [sqlite3_prepare_v3()] or equivalent call that triggered |
| 2968 | +** then the [sqlite3_prepare_v2()] or equivalent call that triggered |
| 3734 | 2969 | ** the authorizer will fail with an error message. |
| 3735 | 2970 | ** |
| 3736 | 2971 | ** When the callback returns [SQLITE_OK], that means the operation |
| 3737 | 2972 | ** requested is ok. ^When the callback returns [SQLITE_DENY], the |
| 3738 | | -** [sqlite3_prepare_v3()] or equivalent call that triggered the |
| 2973 | +** [sqlite3_prepare_v2()] or equivalent call that triggered the |
| 3739 | 2974 | ** authorizer will fail with an error message explaining that |
| 3740 | 2975 | ** access is denied. |
| 3741 | 2976 | ** |
| 3742 | 2977 | ** ^The first parameter to the authorizer callback is a copy of the third |
| 3743 | 2978 | ** parameter to the sqlite3_set_authorizer() interface. ^The second parameter |
| | @@ -3784,23 +3019,23 @@ |
| 3784 | 3019 | ** previous call.)^ ^Disable the authorizer by installing a NULL callback. |
| 3785 | 3020 | ** The authorizer is disabled by default. |
| 3786 | 3021 | ** |
| 3787 | 3022 | ** The authorizer callback must not do anything that will modify |
| 3788 | 3023 | ** the database connection that invoked the authorizer callback. |
| 3789 | | -** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 3024 | +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 3790 | 3025 | ** database connections for the meaning of "modify" in this paragraph. |
| 3791 | 3026 | ** |
| 3792 | | -** ^When [sqlite3_prepare_v3()] is used to prepare a statement, the |
| 3027 | +** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the |
| 3793 | 3028 | ** statement might be re-prepared during [sqlite3_step()] due to a |
| 3794 | 3029 | ** schema change. Hence, the application should ensure that the |
| 3795 | 3030 | ** correct authorizer callback remains in place during the [sqlite3_step()]. |
| 3796 | 3031 | ** |
| 3797 | 3032 | ** ^Note that the authorizer callback is invoked only during |
| 3798 | 3033 | ** [sqlite3_prepare()] or its variants. Authorization is not |
| 3799 | 3034 | ** performed during statement evaluation in [sqlite3_step()], unless |
| 3800 | 3035 | ** as stated in the previous paragraph, sqlite3_step() invokes |
| 3801 | | -** sqlite3_prepare_v3() to reprepare a statement after a schema change. |
| 3036 | +** sqlite3_prepare_v2() to reprepare a statement after a schema change. |
| 3802 | 3037 | */ |
| 3803 | 3038 | SQLITE_API int sqlite3_set_authorizer( |
| 3804 | 3039 | sqlite3*, |
| 3805 | 3040 | int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), |
| 3806 | 3041 | void *pUserData |
| | @@ -4032,11 +3267,11 @@ |
| 4032 | 3267 | ** interrupted. This feature can be used to implement a |
| 4033 | 3268 | ** "Cancel" button on a GUI progress dialog box. |
| 4034 | 3269 | ** |
| 4035 | 3270 | ** The progress handler callback must not do anything that will modify |
| 4036 | 3271 | ** the database connection that invoked the progress handler. |
| 4037 | | -** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 3272 | +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 4038 | 3273 | ** database connections for the meaning of "modify" in this paragraph. |
| 4039 | 3274 | ** |
| 4040 | 3275 | */ |
| 4041 | 3276 | SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); |
| 4042 | 3277 | |
| | @@ -4386,11 +3621,11 @@ |
| 4386 | 3621 | ** prepared statement before it can be run. |
| 4387 | 3622 | ** |
| 4388 | 3623 | ** The life-cycle of a prepared statement object usually goes like this: |
| 4389 | 3624 | ** |
| 4390 | 3625 | ** <ol> |
| 4391 | | -** <li> Create the prepared statement object using [sqlite3_prepare_v3()]. |
| 3626 | +** <li> Create the prepared statement object using [sqlite3_prepare_v2()]. |
| 4392 | 3627 | ** <li> Bind values to [parameters] using the sqlite3_bind_*() |
| 4393 | 3628 | ** interfaces. |
| 4394 | 3629 | ** <li> Run the SQL by calling [sqlite3_step()] one or more times. |
| 4395 | 3630 | ** <li> Reset the prepared statement using [sqlite3_reset()] then go back |
| 4396 | 3631 | ** to step 2. Do this zero or more times. |
| | @@ -4468,11 +3703,11 @@ |
| 4468 | 3703 | ** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(<dt>SQLITE_LIMIT_COMPOUND_SELECT</dt> |
| 4469 | 3704 | ** <dd>The maximum number of terms in a compound SELECT statement.</dd>)^ |
| 4470 | 3705 | ** |
| 4471 | 3706 | ** [[SQLITE_LIMIT_VDBE_OP]] ^(<dt>SQLITE_LIMIT_VDBE_OP</dt> |
| 4472 | 3707 | ** <dd>The maximum number of instructions in a virtual machine program |
| 4473 | | -** used to implement an SQL statement. If [sqlite3_prepare_v3()] or |
| 3708 | +** used to implement an SQL statement. If [sqlite3_prepare_v2()] or |
| 4474 | 3709 | ** the equivalent tries to allocate space for more than this many opcodes |
| 4475 | 3710 | ** in a single prepared statement, an SQLITE_NOMEM error is returned.</dd>)^ |
| 4476 | 3711 | ** |
| 4477 | 3712 | ** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(<dt>SQLITE_LIMIT_FUNCTION_ARG</dt> |
| 4478 | 3713 | ** <dd>The maximum number of arguments on a function.</dd>)^ |
| | @@ -4508,61 +3743,28 @@ |
| 4508 | 3743 | #define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 |
| 4509 | 3744 | #define SQLITE_LIMIT_VARIABLE_NUMBER 9 |
| 4510 | 3745 | #define SQLITE_LIMIT_TRIGGER_DEPTH 10 |
| 4511 | 3746 | #define SQLITE_LIMIT_WORKER_THREADS 11 |
| 4512 | 3747 | |
| 4513 | | -/* |
| 4514 | | -** CAPI3REF: Prepare Flags |
| 4515 | | -** |
| 4516 | | -** These constants define various flags that can be passed into |
| 4517 | | -** "prepFlags" parameter of the [sqlite3_prepare_v3()] and |
| 4518 | | -** [sqlite3_prepare16_v3()] interfaces. |
| 4519 | | -** |
| 4520 | | -** New flags may be added in future releases of SQLite. |
| 4521 | | -** |
| 4522 | | -** <dl> |
| 4523 | | -** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt> |
| 4524 | | -** <dd>The SQLITE_PREPARE_PERSISTENT flag causes [sqlite3_prepare_v3()] |
| 4525 | | -** and [sqlite3_prepare16_v3()] |
| 4526 | | -** to optimize the resulting prepared statement to be retained for a |
| 4527 | | -** relatively long amount of time.)^ ^Without this flag, |
| 4528 | | -** [sqlite3_prepare_v3()] and [sqlite3_prepare16_v3()] assume that |
| 4529 | | -** the prepared statement will be used just once or at most a few times |
| 4530 | | -** and then destroyed using [sqlite3_finalize()] relatively soon. |
| 4531 | | -** </dl> |
| 4532 | | -*/ |
| 4533 | | -#define SQLITE_PREPARE_PERSISTENT 0x01 |
| 4534 | 3748 | |
| 4535 | 3749 | /* |
| 4536 | 3750 | ** CAPI3REF: Compiling An SQL Statement |
| 4537 | 3751 | ** KEYWORDS: {SQL statement compiler} |
| 4538 | 3752 | ** METHOD: sqlite3 |
| 4539 | 3753 | ** CONSTRUCTOR: sqlite3_stmt |
| 4540 | 3754 | ** |
| 4541 | | -** To execute an SQL statement, it must first be compiled into a byte-code |
| 4542 | | -** program using one of these routines. Or, in other words, these routines |
| 4543 | | -** are constructors for the [prepared statement] object. |
| 4544 | | -** |
| 4545 | | -** The preferred routine to use is [sqlite3_prepare_v2()]. The |
| 4546 | | -** [sqlite3_prepare()] interface is legacy and should be avoided. |
| 4547 | | -** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used |
| 4548 | | -** for special purposes. |
| 4549 | | -** |
| 4550 | | -** The use of the UTF-8 interfaces is preferred, as SQLite currently |
| 4551 | | -** does all parsing using UTF-8. The UTF-16 interfaces are provided |
| 4552 | | -** as a convenience. The UTF-16 interfaces work by converting the |
| 4553 | | -** input text into UTF-8, then invoking the corresponding UTF-8 interface. |
| 3755 | +** To execute an SQL query, it must first be compiled into a byte-code |
| 3756 | +** program using one of these routines. |
| 4554 | 3757 | ** |
| 4555 | 3758 | ** The first argument, "db", is a [database connection] obtained from a |
| 4556 | 3759 | ** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or |
| 4557 | 3760 | ** [sqlite3_open16()]. The database connection must not have been closed. |
| 4558 | 3761 | ** |
| 4559 | 3762 | ** The second argument, "zSql", is the statement to be compiled, encoded |
| 4560 | | -** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(), |
| 4561 | | -** and sqlite3_prepare_v3() |
| 4562 | | -** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(), |
| 4563 | | -** and sqlite3_prepare16_v3() use UTF-16. |
| 3763 | +** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() |
| 3764 | +** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() |
| 3765 | +** use UTF-16. |
| 4564 | 3766 | ** |
| 4565 | 3767 | ** ^If the nByte argument is negative, then zSql is read up to the |
| 4566 | 3768 | ** first zero terminator. ^If nByte is positive, then it is the |
| 4567 | 3769 | ** number of bytes read from zSql. ^If nByte is zero, then no prepared |
| 4568 | 3770 | ** statement is generated. |
| | @@ -4585,15 +3787,14 @@ |
| 4585 | 3787 | ** ppStmt may not be NULL. |
| 4586 | 3788 | ** |
| 4587 | 3789 | ** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; |
| 4588 | 3790 | ** otherwise an [error code] is returned. |
| 4589 | 3791 | ** |
| 4590 | | -** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(), |
| 4591 | | -** and sqlite3_prepare16_v3() interfaces are recommended for all new programs. |
| 4592 | | -** The older interfaces (sqlite3_prepare() and sqlite3_prepare16()) |
| 4593 | | -** are retained for backwards compatibility, but their use is discouraged. |
| 4594 | | -** ^In the "vX" interfaces, the prepared statement |
| 3792 | +** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are |
| 3793 | +** recommended for all new programs. The two older interfaces are retained |
| 3794 | +** for backwards compatibility, but their use is discouraged. |
| 3795 | +** ^In the "v2" interfaces, the prepared statement |
| 4595 | 3796 | ** that is returned (the [sqlite3_stmt] object) contains a copy of the |
| 4596 | 3797 | ** original SQL text. This causes the [sqlite3_step()] interface to |
| 4597 | 3798 | ** behave differently in three ways: |
| 4598 | 3799 | ** |
| 4599 | 3800 | ** <ol> |
| | @@ -4622,16 +3823,10 @@ |
| 4622 | 3823 | ** ^The specific value of WHERE-clause [parameter] might influence the |
| 4623 | 3824 | ** choice of query plan if the parameter is the left-hand side of a [LIKE] |
| 4624 | 3825 | ** or [GLOB] operator or if the parameter is compared to an indexed column |
| 4625 | 3826 | ** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. |
| 4626 | 3827 | ** </li> |
| 4627 | | -** |
| 4628 | | -** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having |
| 4629 | | -** the extra prepFlags parameter, which is a bit array consisting of zero or |
| 4630 | | -** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The |
| 4631 | | -** sqlite3_prepare_v2() interface works exactly the same as |
| 4632 | | -** sqlite3_prepare_v3() with a zero prepFlags parameter. |
| 4633 | 3828 | ** </ol> |
| 4634 | 3829 | */ |
| 4635 | 3830 | SQLITE_API int sqlite3_prepare( |
| 4636 | 3831 | sqlite3 *db, /* Database handle */ |
| 4637 | 3832 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| | @@ -4642,18 +3837,10 @@ |
| 4642 | 3837 | SQLITE_API int sqlite3_prepare_v2( |
| 4643 | 3838 | sqlite3 *db, /* Database handle */ |
| 4644 | 3839 | const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 4645 | 3840 | int nByte, /* Maximum length of zSql in bytes. */ |
| 4646 | 3841 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4647 | | - const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4648 | | -); |
| 4649 | | -SQLITE_API int sqlite3_prepare_v3( |
| 4650 | | - sqlite3 *db, /* Database handle */ |
| 4651 | | - const char *zSql, /* SQL statement, UTF-8 encoded */ |
| 4652 | | - int nByte, /* Maximum length of zSql in bytes. */ |
| 4653 | | - unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */ |
| 4654 | | - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4655 | 3842 | const char **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4656 | 3843 | ); |
| 4657 | 3844 | SQLITE_API int sqlite3_prepare16( |
| 4658 | 3845 | sqlite3 *db, /* Database handle */ |
| 4659 | 3846 | const void *zSql, /* SQL statement, UTF-16 encoded */ |
| | @@ -4666,27 +3853,18 @@ |
| 4666 | 3853 | const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 4667 | 3854 | int nByte, /* Maximum length of zSql in bytes. */ |
| 4668 | 3855 | sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4669 | 3856 | const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4670 | 3857 | ); |
| 4671 | | -SQLITE_API int sqlite3_prepare16_v3( |
| 4672 | | - sqlite3 *db, /* Database handle */ |
| 4673 | | - const void *zSql, /* SQL statement, UTF-16 encoded */ |
| 4674 | | - int nByte, /* Maximum length of zSql in bytes. */ |
| 4675 | | - unsigned int prepFalgs, /* Zero or more SQLITE_PREPARE_ flags */ |
| 4676 | | - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ |
| 4677 | | - const void **pzTail /* OUT: Pointer to unused portion of zSql */ |
| 4678 | | -); |
| 4679 | 3858 | |
| 4680 | 3859 | /* |
| 4681 | 3860 | ** CAPI3REF: Retrieving Statement SQL |
| 4682 | 3861 | ** METHOD: sqlite3_stmt |
| 4683 | 3862 | ** |
| 4684 | 3863 | ** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8 |
| 4685 | 3864 | ** SQL text used to create [prepared statement] P if P was |
| 4686 | | -** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], |
| 4687 | | -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| 3865 | +** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. |
| 4688 | 3866 | ** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8 |
| 4689 | 3867 | ** string containing the SQL text of prepared statement P with |
| 4690 | 3868 | ** [bound parameters] expanded. |
| 4691 | 3869 | ** |
| 4692 | 3870 | ** ^(For example, if a prepared statement is created using the SQL |
| | @@ -4828,11 +4006,11 @@ |
| 4828 | 4006 | ** CAPI3REF: Binding Values To Prepared Statements |
| 4829 | 4007 | ** KEYWORDS: {host parameter} {host parameters} {host parameter name} |
| 4830 | 4008 | ** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} |
| 4831 | 4009 | ** METHOD: sqlite3_stmt |
| 4832 | 4010 | ** |
| 4833 | | -** ^(In the SQL statement text input to [sqlite3_prepare_v3()] and its variants, |
| 4011 | +** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, |
| 4834 | 4012 | ** literals may be replaced by a [parameter] that matches one of following |
| 4835 | 4013 | ** templates: |
| 4836 | 4014 | ** |
| 4837 | 4015 | ** <ul> |
| 4838 | 4016 | ** <li> ? |
| | @@ -4847,11 +4025,11 @@ |
| 4847 | 4025 | ** parameters (also called "host parameter names" or "SQL parameters") |
| 4848 | 4026 | ** can be set using the sqlite3_bind_*() routines defined here. |
| 4849 | 4027 | ** |
| 4850 | 4028 | ** ^The first argument to the sqlite3_bind_*() routines is always |
| 4851 | 4029 | ** a pointer to the [sqlite3_stmt] object returned from |
| 4852 | | -** [sqlite3_prepare_v3()] or its variants. |
| 4030 | +** [sqlite3_prepare_v2()] or its variants. |
| 4853 | 4031 | ** |
| 4854 | 4032 | ** ^The second argument is the index of the SQL parameter to be set. |
| 4855 | 4033 | ** ^The leftmost SQL parameter has an index of 1. ^When the same named |
| 4856 | 4034 | ** SQL parameter is used more than once, second and subsequent |
| 4857 | 4035 | ** occurrences have the same index as the first occurrence. |
| | @@ -4984,12 +4162,12 @@ |
| 4984 | 4162 | ** ^The first host parameter has an index of 1, not 0. |
| 4985 | 4163 | ** |
| 4986 | 4164 | ** ^If the value N is out of range or if the N-th parameter is |
| 4987 | 4165 | ** nameless, then NULL is returned. ^The returned string is |
| 4988 | 4166 | ** always in UTF-8 encoding even if the named parameter was |
| 4989 | | -** originally specified as UTF-16 in [sqlite3_prepare16()], |
| 4990 | | -** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()]. |
| 4167 | +** originally specified as UTF-16 in [sqlite3_prepare16()] or |
| 4168 | +** [sqlite3_prepare16_v2()]. |
| 4991 | 4169 | ** |
| 4992 | 4170 | ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| 4993 | 4171 | ** [sqlite3_bind_parameter_count()], and |
| 4994 | 4172 | ** [sqlite3_bind_parameter_index()]. |
| 4995 | 4173 | */ |
| | @@ -5002,12 +4180,11 @@ |
| 5002 | 4180 | ** ^Return the index of an SQL parameter given its name. ^The |
| 5003 | 4181 | ** index value returned is suitable for use as the second |
| 5004 | 4182 | ** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero |
| 5005 | 4183 | ** is returned if no matching parameter is found. ^The parameter |
| 5006 | 4184 | ** name must be given in UTF-8 even if the original statement |
| 5007 | | -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or |
| 5008 | | -** [sqlite3_prepare16_v3()]. |
| 4185 | +** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. |
| 5009 | 4186 | ** |
| 5010 | 4187 | ** See also: [sqlite3_bind_blob|sqlite3_bind()], |
| 5011 | 4188 | ** [sqlite3_bind_parameter_count()], and |
| 5012 | 4189 | ** [sqlite3_bind_parameter_name()]. |
| 5013 | 4190 | */ |
| | @@ -5157,22 +4334,20 @@ |
| 5157 | 4334 | |
| 5158 | 4335 | /* |
| 5159 | 4336 | ** CAPI3REF: Evaluate An SQL Statement |
| 5160 | 4337 | ** METHOD: sqlite3_stmt |
| 5161 | 4338 | ** |
| 5162 | | -** After a [prepared statement] has been prepared using any of |
| 5163 | | -** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()], |
| 5164 | | -** or [sqlite3_prepare16_v3()] or one of the legacy |
| 4339 | +** After a [prepared statement] has been prepared using either |
| 4340 | +** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy |
| 5165 | 4341 | ** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function |
| 5166 | 4342 | ** must be called one or more times to evaluate the statement. |
| 5167 | 4343 | ** |
| 5168 | 4344 | ** The details of the behavior of the sqlite3_step() interface depend |
| 5169 | | -** on whether the statement was prepared using the newer "vX" interfaces |
| 5170 | | -** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()], |
| 5171 | | -** [sqlite3_prepare16_v2()] or the older legacy |
| 5172 | | -** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the |
| 5173 | | -** new "vX" interface is recommended for new applications but the legacy |
| 4345 | +** on whether the statement was prepared using the newer "v2" interface |
| 4346 | +** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy |
| 4347 | +** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the |
| 4348 | +** new "v2" interface is recommended for new applications but the legacy |
| 5174 | 4349 | ** interface will continue to be supported. |
| 5175 | 4350 | ** |
| 5176 | 4351 | ** ^In the legacy interface, the return value will be either [SQLITE_BUSY], |
| 5177 | 4352 | ** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. |
| 5178 | 4353 | ** ^With the "v2" interface, any of the other [result codes] or |
| | @@ -5229,15 +4404,14 @@ |
| 5229 | 4404 | ** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call |
| 5230 | 4405 | ** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the |
| 5231 | 4406 | ** specific [error codes] that better describes the error. |
| 5232 | 4407 | ** We admit that this is a goofy design. The problem has been fixed |
| 5233 | 4408 | ** with the "v2" interface. If you prepare all of your SQL statements |
| 5234 | | -** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()] |
| 5235 | | -** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead |
| 4409 | +** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead |
| 5236 | 4410 | ** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, |
| 5237 | 4411 | ** then the more specific [error codes] are returned directly |
| 5238 | | -** by sqlite3_step(). The use of the "vX" interfaces is recommended. |
| 4412 | +** by sqlite3_step(). The use of the "v2" interface is recommended. |
| 5239 | 4413 | */ |
| 5240 | 4414 | SQLITE_API int sqlite3_step(sqlite3_stmt*); |
| 5241 | 4415 | |
| 5242 | 4416 | /* |
| 5243 | 4417 | ** CAPI3REF: Number of columns in a result set |
| | @@ -5298,11 +4472,11 @@ |
| 5298 | 4472 | ** METHOD: sqlite3_stmt |
| 5299 | 4473 | ** |
| 5300 | 4474 | ** ^These routines return information about a single column of the current |
| 5301 | 4475 | ** result row of a query. ^In every case the first argument is a pointer |
| 5302 | 4476 | ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] |
| 5303 | | -** that was returned from [sqlite3_prepare_v3()] or one of its variants) |
| 4477 | +** that was returned from [sqlite3_prepare_v2()] or one of its variants) |
| 5304 | 4478 | ** and the second argument is the index of the column for which information |
| 5305 | 4479 | ** should be returned. ^The leftmost column of the result set has the index 0. |
| 5306 | 4480 | ** ^The number of columns in the result can be determined using |
| 5307 | 4481 | ** [sqlite3_column_count()]. |
| 5308 | 4482 | ** |
| | @@ -6422,11 +5596,11 @@ |
| 6422 | 5596 | ** |
| 6423 | 5597 | ** ^The sqlite3_db_handle interface returns the [database connection] handle |
| 6424 | 5598 | ** to which a [prepared statement] belongs. ^The [database connection] |
| 6425 | 5599 | ** returned by sqlite3_db_handle is the same [database connection] |
| 6426 | 5600 | ** that was the first argument |
| 6427 | | -** to the [sqlite3_prepare_v3()] call (or its variants) that was used to |
| 5601 | +** to the [sqlite3_prepare_v2()] call (or its variants) that was used to |
| 6428 | 5602 | ** create the statement in the first place. |
| 6429 | 5603 | */ |
| 6430 | 5604 | SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); |
| 6431 | 5605 | |
| 6432 | 5606 | /* |
| | @@ -6498,11 +5672,11 @@ |
| 6498 | 5672 | ** the database connection that invoked the callback. Any actions |
| 6499 | 5673 | ** to modify the database connection must be deferred until after the |
| 6500 | 5674 | ** completion of the [sqlite3_step()] call that triggered the commit |
| 6501 | 5675 | ** or rollback hook in the first place. |
| 6502 | 5676 | ** Note that running any other SQL statements, including SELECT statements, |
| 6503 | | -** or merely calling [sqlite3_prepare_v3()] and [sqlite3_step()] will modify |
| 5677 | +** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify |
| 6504 | 5678 | ** the database connections for the meaning of "modify" in this paragraph. |
| 6505 | 5679 | ** |
| 6506 | 5680 | ** ^Registering a NULL function disables the callback. |
| 6507 | 5681 | ** |
| 6508 | 5682 | ** ^When the commit hook callback routine returns zero, the [COMMIT] |
| | @@ -6558,11 +5732,11 @@ |
| 6558 | 5732 | ** |
| 6559 | 5733 | ** The update hook implementation must not do anything that will modify |
| 6560 | 5734 | ** the database connection that invoked the update hook. Any actions |
| 6561 | 5735 | ** to modify the database connection must be deferred until after the |
| 6562 | 5736 | ** completion of the [sqlite3_step()] call that triggered the update hook. |
| 6563 | | -** Note that [sqlite3_prepare_v3()] and [sqlite3_step()] both modify their |
| 5737 | +** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their |
| 6564 | 5738 | ** database connections for the meaning of "modify" in this paragraph. |
| 6565 | 5739 | ** |
| 6566 | 5740 | ** ^The sqlite3_update_hook(D,C,P) function |
| 6567 | 5741 | ** returns the P argument from the previous call |
| 6568 | 5742 | ** on the same [database connection] D, or NULL for |
| | @@ -6721,13 +5895,11 @@ |
| 6721 | 5895 | ** column exists. ^The sqlite3_table_column_metadata() interface returns |
| 6722 | 5896 | ** SQLITE_ERROR and if the specified column does not exist. |
| 6723 | 5897 | ** ^If the column-name parameter to sqlite3_table_column_metadata() is a |
| 6724 | 5898 | ** NULL pointer, then this routine simply checks for the existence of the |
| 6725 | 5899 | ** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it |
| 6726 | | -** does not. If the table name parameter T in a call to |
| 6727 | | -** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is |
| 6728 | | -** undefined behavior. |
| 5900 | +** does not. |
| 6729 | 5901 | ** |
| 6730 | 5902 | ** ^The column is identified by the second, third and fourth parameters to |
| 6731 | 5903 | ** this function. ^(The second parameter is either the name of the database |
| 6732 | 5904 | ** (i.e. "main", "temp", or an attached database) containing the specified |
| 6733 | 5905 | ** table or NULL.)^ ^If it is NULL, then all attached databases are searched |
| | @@ -8236,38 +7408,17 @@ |
| 8236 | 7408 | ** by the prepared statement if that number is less than or equal |
| 8237 | 7409 | ** to 2147483647. The number of virtual machine operations can be |
| 8238 | 7410 | ** used as a proxy for the total work done by the prepared statement. |
| 8239 | 7411 | ** If the number of virtual machine operations exceeds 2147483647 |
| 8240 | 7412 | ** then the value returned by this statement status code is undefined. |
| 8241 | | -** |
| 8242 | | -** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt> |
| 8243 | | -** <dd>^This is the number of times that the prepare statement has been |
| 8244 | | -** automatically regenerated due to schema changes or change to |
| 8245 | | -** [bound parameters] that might affect the query plan. |
| 8246 | | -** |
| 8247 | | -** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt> |
| 8248 | | -** <dd>^This is the number of times that the prepared statement has |
| 8249 | | -** been run. A single "run" for the purposes of this counter is one |
| 8250 | | -** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()]. |
| 8251 | | -** The counter is incremented on the first [sqlite3_step()] call of each |
| 8252 | | -** cycle. |
| 8253 | | -** |
| 8254 | | -** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt> |
| 8255 | | -** <dd>^This is the approximate number of bytes of heap memory |
| 8256 | | -** used to store the prepared statement. ^This value is not actually |
| 8257 | | -** a counter, and so the resetFlg parameter to sqlite3_stmt_status() |
| 8258 | | -** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED. |
| 8259 | 7413 | ** </dd> |
| 8260 | 7414 | ** </dl> |
| 8261 | 7415 | */ |
| 8262 | 7416 | #define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 |
| 8263 | 7417 | #define SQLITE_STMTSTATUS_SORT 2 |
| 8264 | 7418 | #define SQLITE_STMTSTATUS_AUTOINDEX 3 |
| 8265 | 7419 | #define SQLITE_STMTSTATUS_VM_STEP 4 |
| 8266 | | -#define SQLITE_STMTSTATUS_REPREPARE 5 |
| 8267 | | -#define SQLITE_STMTSTATUS_RUN 6 |
| 8268 | | -#define SQLITE_STMTSTATUS_MEMUSED 99 |
| 8269 | 7420 | |
| 8270 | 7421 | /* |
| 8271 | 7422 | ** CAPI3REF: Custom Page Cache Object |
| 8272 | 7423 | ** |
| 8273 | 7424 | ** The sqlite3_pcache type is opaque. It is implemented by |
| | @@ -11630,13 +10781,12 @@ |
| 11630 | 10781 | |
| 11631 | 10782 | /* |
| 11632 | 10783 | ** Include the configuration header output by 'configure' if we're using the |
| 11633 | 10784 | ** autoconf-based build |
| 11634 | 10785 | */ |
| 11635 | | -#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H) |
| 11636 | | -/* #include "config.h" */ |
| 11637 | | -#define SQLITECONFIG_H 1 |
| 10786 | +#ifdef _HAVE_SQLITE_CONFIG_H |
| 10787 | +#include "config.h" |
| 11638 | 10788 | #endif |
| 11639 | 10789 | |
| 11640 | 10790 | /************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/ |
| 11641 | 10791 | /************** Begin file sqliteLimit.h *************************************/ |
| 11642 | 10792 | /* |
| | @@ -11942,15 +11092,10 @@ |
| 11942 | 11092 | ** threads can use SQLite as long as no two threads try to use the same |
| 11943 | 11093 | ** database connection at the same time. |
| 11944 | 11094 | ** |
| 11945 | 11095 | ** Older versions of SQLite used an optional THREADSAFE macro. |
| 11946 | 11096 | ** We support that for legacy. |
| 11947 | | -** |
| 11948 | | -** To ensure that the correct value of "THREADSAFE" is reported when querying |
| 11949 | | -** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this |
| 11950 | | -** logic is partially replicated in ctime.c. If it is updated here, it should |
| 11951 | | -** also be updated there. |
| 11952 | 11097 | */ |
| 11953 | 11098 | #if !defined(SQLITE_THREADSAFE) |
| 11954 | 11099 | # if defined(THREADSAFE) |
| 11955 | 11100 | # define SQLITE_THREADSAFE THREADSAFE |
| 11956 | 11101 | # else |
| | @@ -12537,10 +11682,11 @@ |
| 12537 | 11682 | ** Provide a default value for SQLITE_TEMP_STORE in case it is not specified |
| 12538 | 11683 | ** on the command-line |
| 12539 | 11684 | */ |
| 12540 | 11685 | #ifndef SQLITE_TEMP_STORE |
| 12541 | 11686 | # define SQLITE_TEMP_STORE 1 |
| 11687 | +# define SQLITE_TEMP_STORE_xc 1 /* Exclude from ctime.c */ |
| 12542 | 11688 | #endif |
| 12543 | 11689 | |
| 12544 | 11690 | /* |
| 12545 | 11691 | ** If no value has been provided for SQLITE_MAX_WORKER_THREADS, or if |
| 12546 | 11692 | ** SQLITE_TEMP_STORE is set to 3 (never use temporary files), set it |
| | @@ -12837,19 +11983,21 @@ |
| 12837 | 11983 | || defined(__DragonFly__) |
| 12838 | 11984 | # define SQLITE_MAX_MMAP_SIZE 0x7fff0000 /* 2147418112 */ |
| 12839 | 11985 | # else |
| 12840 | 11986 | # define SQLITE_MAX_MMAP_SIZE 0 |
| 12841 | 11987 | # endif |
| 11988 | +# define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */ |
| 12842 | 11989 | #endif |
| 12843 | 11990 | |
| 12844 | 11991 | /* |
| 12845 | 11992 | ** The default MMAP_SIZE is zero on all platforms. Or, even if a larger |
| 12846 | 11993 | ** default MMAP_SIZE is specified at compile-time, make sure that it does |
| 12847 | 11994 | ** not exceed the maximum mmap size. |
| 12848 | 11995 | */ |
| 12849 | 11996 | #ifndef SQLITE_DEFAULT_MMAP_SIZE |
| 12850 | 11997 | # define SQLITE_DEFAULT_MMAP_SIZE 0 |
| 11998 | +# define SQLITE_DEFAULT_MMAP_SIZE_xc 1 /* Exclude from ctime.c */ |
| 12851 | 11999 | #endif |
| 12852 | 12000 | #if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE |
| 12853 | 12001 | # undef SQLITE_DEFAULT_MMAP_SIZE |
| 12854 | 12002 | # define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE |
| 12855 | 12003 | #endif |
| | @@ -13330,13 +12478,13 @@ |
| 13330 | 12478 | |
| 13331 | 12479 | SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload, |
| 13332 | 12480 | int flags, int seekResult); |
| 13333 | 12481 | SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); |
| 13334 | 12482 | SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); |
| 13335 | | -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int flags); |
| 12483 | +SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); |
| 13336 | 12484 | SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); |
| 13337 | | -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int flags); |
| 12485 | +SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); |
| 13338 | 12486 | SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*); |
| 13339 | 12487 | SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*); |
| 13340 | 12488 | SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt); |
| 13341 | 12489 | SQLITE_PRIVATE u32 sqlite3BtreePayloadSize(BtCursor*); |
| 13342 | 12490 | |
| | @@ -13483,11 +12631,11 @@ |
| 13483 | 12631 | SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ |
| 13484 | 12632 | Table *pTab; /* Used when p4type is P4_TABLE */ |
| 13485 | 12633 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 13486 | 12634 | Expr *pExpr; /* Used when p4type is P4_EXPR */ |
| 13487 | 12635 | #endif |
| 13488 | | - int (*xAdvance)(BtCursor *, int); |
| 12636 | + int (*xAdvance)(BtCursor *, int *); |
| 13489 | 12637 | } p4; |
| 13490 | 12638 | #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS |
| 13491 | 12639 | char *zComment; /* Comment to improve readability */ |
| 13492 | 12640 | #endif |
| 13493 | 12641 | #ifdef VDBE_PROFILE |
| | @@ -13717,11 +12865,11 @@ |
| 13717 | 12865 | #define OP_Rowid 125 /* synopsis: r[P2]=rowid */ |
| 13718 | 12866 | #define OP_NullRow 126 |
| 13719 | 12867 | #define OP_SorterInsert 127 /* synopsis: key=r[P2] */ |
| 13720 | 12868 | #define OP_IdxInsert 128 /* synopsis: key=r[P2] */ |
| 13721 | 12869 | #define OP_IdxDelete 129 /* synopsis: key=r[P2@P3] */ |
| 13722 | | -#define OP_DeferredSeek 130 /* synopsis: Move P3 to P1.rowid if needed */ |
| 12870 | +#define OP_Seek 130 /* synopsis: Move P3 to P1.rowid */ |
| 13723 | 12871 | #define OP_IdxRowid 131 /* synopsis: r[P2]=rowid */ |
| 13724 | 12872 | #define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 13725 | 12873 | #define OP_Destroy 133 |
| 13726 | 12874 | #define OP_Clear 134 |
| 13727 | 12875 | #define OP_ResetSorter 135 |
| | @@ -13798,16 +12946,10 @@ |
| 13798 | 12946 | #define SQLITE_MX_JUMP_OPCODE 83 /* Maximum JUMP opcode */ |
| 13799 | 12947 | |
| 13800 | 12948 | /************** End of opcodes.h *********************************************/ |
| 13801 | 12949 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 13802 | 12950 | |
| 13803 | | -/* |
| 13804 | | -** Additional non-public SQLITE_PREPARE_* flags |
| 13805 | | -*/ |
| 13806 | | -#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */ |
| 13807 | | -#define SQLITE_PREPARE_MASK 0x0f /* Mask of public flags */ |
| 13808 | | - |
| 13809 | 12951 | /* |
| 13810 | 12952 | ** Prototypes for the VDBE interface. See comments on the implementation |
| 13811 | 12953 | ** for a description of what each of these routines does. |
| 13812 | 12954 | */ |
| 13813 | 12955 | SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*); |
| | @@ -13861,12 +13003,11 @@ |
| 13861 | 13003 | SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); |
| 13862 | 13004 | SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int); |
| 13863 | 13005 | SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); |
| 13864 | 13006 | SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); |
| 13865 | 13007 | SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); |
| 13866 | | -SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*); |
| 13867 | | -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8); |
| 13008 | +SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); |
| 13868 | 13009 | SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); |
| 13869 | 13010 | SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); |
| 13870 | 13011 | SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); |
| 13871 | 13012 | SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); |
| 13872 | 13013 | #ifndef SQLITE_OMIT_TRACE |
| | @@ -14228,25 +13369,25 @@ |
| 14228 | 13369 | */ |
| 14229 | 13370 | struct PgHdr { |
| 14230 | 13371 | sqlite3_pcache_page *pPage; /* Pcache object page handle */ |
| 14231 | 13372 | void *pData; /* Page data */ |
| 14232 | 13373 | void *pExtra; /* Extra content */ |
| 14233 | | - PCache *pCache; /* PRIVATE: Cache that owns this page */ |
| 14234 | 13374 | PgHdr *pDirty; /* Transient list of dirty sorted by pgno */ |
| 14235 | 13375 | Pager *pPager; /* The pager this page is part of */ |
| 14236 | 13376 | Pgno pgno; /* Page number for this page */ |
| 14237 | 13377 | #ifdef SQLITE_CHECK_PAGES |
| 14238 | 13378 | u32 pageHash; /* Hash of page content */ |
| 14239 | 13379 | #endif |
| 14240 | 13380 | u16 flags; /* PGHDR flags defined below */ |
| 14241 | 13381 | |
| 14242 | 13382 | /********************************************************************** |
| 14243 | | - ** Elements above, except pCache, are public. All that follow are |
| 14244 | | - ** private to pcache.c and should not be accessed by other modules. |
| 14245 | | - ** pCache is grouped with the public elements for efficiency. |
| 13383 | + ** Elements above are public. All that follows is private to pcache.c |
| 13384 | + ** and should not be accessed by other modules. |
| 14246 | 13385 | */ |
| 14247 | 13386 | i16 nRef; /* Number of users of this page */ |
| 13387 | + PCache *pCache; /* Cache that owns this page */ |
| 13388 | + |
| 14248 | 13389 | PgHdr *pDirtyNext; /* Next element in list of dirty pages */ |
| 14249 | 13390 | PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */ |
| 14250 | 13391 | }; |
| 14251 | 13392 | |
| 14252 | 13393 | /* Bit values for PgHdr.flags */ |
| | @@ -15084,12 +14225,12 @@ |
| 15084 | 14225 | ** Value constraints (enforced via assert()): |
| 15085 | 14226 | ** SQLITE_FullFSync == PAGER_FULLFSYNC |
| 15086 | 14227 | ** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC |
| 15087 | 14228 | ** SQLITE_CacheSpill == PAGER_CACHE_SPILL |
| 15088 | 14229 | */ |
| 15089 | | -#define SQLITE_WriteSchema 0x00000001 /* OK to update SQLITE_MASTER */ |
| 15090 | | -#define SQLITE_LegacyFileFmt 0x00000002 /* Create new databases in format 1 */ |
| 14230 | +#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ |
| 14231 | +#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */ |
| 15091 | 14232 | #define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */ |
| 15092 | 14233 | #define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */ |
| 15093 | 14234 | #define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */ |
| 15094 | 14235 | #define SQLITE_CacheSpill 0x00000020 /* OK to spill pager cache */ |
| 15095 | 14236 | #define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ |
| | @@ -15096,38 +14237,33 @@ |
| 15096 | 14237 | #define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ |
| 15097 | 14238 | /* DELETE, or UPDATE and return */ |
| 15098 | 14239 | /* the count using a callback. */ |
| 15099 | 14240 | #define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ |
| 15100 | 14241 | /* result set is empty */ |
| 15101 | | -#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */ |
| 15102 | | -#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */ |
| 15103 | | -#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */ |
| 15104 | | -#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */ |
| 15105 | | -#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */ |
| 15106 | | -#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */ |
| 15107 | | -#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */ |
| 15108 | | -#define SQLITE_LoadExtension 0x00010000 /* Enable load_extension */ |
| 15109 | | -#define SQLITE_EnableTrigger 0x00020000 /* True to enable triggers */ |
| 15110 | | -#define SQLITE_DeferFKs 0x00040000 /* Defer all FK constraints */ |
| 15111 | | -#define SQLITE_QueryOnly 0x00080000 /* Disable database changes */ |
| 15112 | | -#define SQLITE_CellSizeCk 0x00100000 /* Check btree cell sizes on load */ |
| 15113 | | -#define SQLITE_Fts3Tokenizer 0x00200000 /* Enable fts3_tokenizer(2) */ |
| 15114 | | -#define SQLITE_EnableQPSG 0x00400000 /* Query Planner Stability Guarantee */ |
| 15115 | | -/* The next four values are not used by PRAGMAs or by sqlite3_dbconfig() and |
| 15116 | | -** could be factored out into a separate bit vector of the sqlite3 object. */ |
| 15117 | | -#define SQLITE_InternChanges 0x00800000 /* Uncommitted Hash table changes */ |
| 15118 | | -#define SQLITE_LoadExtFunc 0x01000000 /* Enable load_extension() SQL func */ |
| 15119 | | -#define SQLITE_PreferBuiltin 0x02000000 /* Preference to built-in funcs */ |
| 15120 | | -#define SQLITE_Vacuum 0x04000000 /* Currently in a VACUUM */ |
| 15121 | | -/* Flags used only if debugging */ |
| 15122 | | -#ifdef SQLITE_DEBUG |
| 15123 | | -#define SQLITE_SqlTrace 0x08000000 /* Debug print SQL as it executes */ |
| 15124 | | -#define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */ |
| 15125 | | -#define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */ |
| 15126 | | -#define SQLITE_VdbeAddopTrace 0x40000000 /* Trace sqlite3VdbeAddOp() calls */ |
| 15127 | | -#define SQLITE_VdbeEQP 0x80000000 /* Debug EXPLAIN QUERY PLAN */ |
| 15128 | | -#endif |
| 14242 | +#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */ |
| 14243 | +#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */ |
| 14244 | +#define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */ |
| 14245 | +#define SQLITE_VdbeAddopTrace 0x00001000 /* Trace sqlite3VdbeAddOp() calls */ |
| 14246 | +#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ |
| 14247 | +#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */ |
| 14248 | +#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ |
| 14249 | +#define SQLITE_RecoveryMode 0x00010000 /* Ignore schema errors */ |
| 14250 | +#define SQLITE_ReverseOrder 0x00020000 /* Reverse unordered SELECTs */ |
| 14251 | +#define SQLITE_RecTriggers 0x00040000 /* Enable recursive triggers */ |
| 14252 | +#define SQLITE_ForeignKeys 0x00080000 /* Enforce foreign key constraints */ |
| 14253 | +#define SQLITE_AutoIndex 0x00100000 /* Enable automatic indexes */ |
| 14254 | +#define SQLITE_PreferBuiltin 0x00200000 /* Preference to built-in funcs */ |
| 14255 | +#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */ |
| 14256 | +#define SQLITE_LoadExtFunc 0x00800000 /* Enable load_extension() SQL func */ |
| 14257 | +#define SQLITE_EnableTrigger 0x01000000 /* True to enable triggers */ |
| 14258 | +#define SQLITE_DeferFKs 0x02000000 /* Defer all FK constraints */ |
| 14259 | +#define SQLITE_QueryOnly 0x04000000 /* Disable database changes */ |
| 14260 | +#define SQLITE_VdbeEQP 0x08000000 /* Debug EXPLAIN QUERY PLAN */ |
| 14261 | +#define SQLITE_Vacuum 0x10000000 /* Currently in a VACUUM */ |
| 14262 | +#define SQLITE_CellSizeCk 0x20000000 /* Check btree cell sizes on load */ |
| 14263 | +#define SQLITE_Fts3Tokenizer 0x40000000 /* Enable fts3_tokenizer(2) */ |
| 14264 | +#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */ |
| 15129 | 14265 | |
| 15130 | 14266 | |
| 15131 | 14267 | /* |
| 15132 | 14268 | ** Bits of the sqlite3.dbOptFlags field that are used by the |
| 15133 | 14269 | ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to |
| | @@ -16006,11 +15142,11 @@ |
| 16006 | 15142 | ** The following are the meanings of bits in the Expr.flags field. |
| 16007 | 15143 | */ |
| 16008 | 15144 | #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */ |
| 16009 | 15145 | #define EP_Agg 0x000002 /* Contains one or more aggregate functions */ |
| 16010 | 15146 | #define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */ |
| 16011 | | - /* 0x000008 // available for use */ |
| 15147 | +#define EP_Error 0x000008 /* Expression contains one or more errors */ |
| 16012 | 15148 | #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */ |
| 16013 | 15149 | #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ |
| 16014 | 15150 | #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ |
| 16015 | 15151 | #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ |
| 16016 | 15152 | #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ |
| | @@ -16473,14 +15609,14 @@ |
| 16473 | 15609 | ** An instance of this object describes where to put of the results of |
| 16474 | 15610 | ** a SELECT statement. |
| 16475 | 15611 | */ |
| 16476 | 15612 | struct SelectDest { |
| 16477 | 15613 | u8 eDest; /* How to dispose of the results. On of SRT_* above. */ |
| 15614 | + char *zAffSdst; /* Affinity used when eDest==SRT_Set */ |
| 16478 | 15615 | int iSDParm; /* A parameter used by the eDest disposal method */ |
| 16479 | 15616 | int iSdst; /* Base register where results are written */ |
| 16480 | 15617 | int nSdst; /* Number of registers allocated */ |
| 16481 | | - char *zAffSdst; /* Affinity used when eDest==SRT_Set */ |
| 16482 | 15618 | ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */ |
| 16483 | 15619 | }; |
| 16484 | 15620 | |
| 16485 | 15621 | /* |
| 16486 | 15622 | ** During code generation of statements that do inserts into AUTOINCREMENT |
| | @@ -16979,14 +16115,10 @@ |
| 16979 | 16115 | SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); |
| 16980 | 16116 | SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); |
| 16981 | 16117 | SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*); |
| 16982 | 16118 | SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*); |
| 16983 | 16119 | SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*); |
| 16984 | | -SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*); |
| 16985 | | -#ifdef SQLITE_DEBUG |
| 16986 | | -SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*); |
| 16987 | | -#endif |
| 16988 | 16120 | |
| 16989 | 16121 | /* |
| 16990 | 16122 | ** Return code from the parse-tree walking primitives and their |
| 16991 | 16123 | ** callbacks. |
| 16992 | 16124 | */ |
| | @@ -17044,18 +16176,15 @@ |
| 17044 | 16176 | #define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__) |
| 17045 | 16177 | #define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) |
| 17046 | 16178 | #ifdef SQLITE_DEBUG |
| 17047 | 16179 | SQLITE_PRIVATE int sqlite3NomemError(int); |
| 17048 | 16180 | SQLITE_PRIVATE int sqlite3IoerrnomemError(int); |
| 17049 | | -SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno); |
| 17050 | 16181 | # define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__) |
| 17051 | 16182 | # define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__) |
| 17052 | | -# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptPgnoError(__LINE__,(P)) |
| 17053 | 16183 | #else |
| 17054 | 16184 | # define SQLITE_NOMEM_BKPT SQLITE_NOMEM |
| 17055 | 16185 | # define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM |
| 17056 | | -# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptError(__LINE__) |
| 17057 | 16186 | #endif |
| 17058 | 16187 | |
| 17059 | 16188 | /* |
| 17060 | 16189 | ** FTS3 and FTS4 both require virtual table support |
| 17061 | 16190 | */ |
| | @@ -17420,14 +16549,14 @@ |
| 17420 | 16549 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); |
| 17421 | 16550 | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); |
| 17422 | 16551 | SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*); |
| 17423 | 16552 | SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int); |
| 17424 | 16553 | SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); |
| 17425 | | -SQLITE_PRIVATE int sqlite3ExprCompare(Parse*,Expr*, Expr*, int); |
| 16554 | +SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int); |
| 17426 | 16555 | SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int); |
| 17427 | 16556 | SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); |
| 17428 | | -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int); |
| 16557 | +SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int); |
| 17429 | 16558 | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); |
| 17430 | 16559 | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); |
| 17431 | 16560 | SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx); |
| 17432 | 16561 | SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); |
| 17433 | 16562 | SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); |
| | @@ -18012,12 +17141,10 @@ |
| 18012 | 17141 | SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr); |
| 18013 | 17142 | SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int); |
| 18014 | 17143 | SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int); |
| 18015 | 17144 | SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*); |
| 18016 | 17145 | |
| 18017 | | -SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt); |
| 18018 | | - |
| 18019 | 17146 | #endif /* SQLITEINT_H */ |
| 18020 | 17147 | |
| 18021 | 17148 | /************** End of sqliteInt.h *******************************************/ |
| 18022 | 17149 | /************** Begin file global.c ******************************************/ |
| 18023 | 17150 | /* |
| | @@ -18318,10 +17445,476 @@ |
| 18318 | 17445 | ** Name of the default collating sequence |
| 18319 | 17446 | */ |
| 18320 | 17447 | SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY"; |
| 18321 | 17448 | |
| 18322 | 17449 | /************** End of global.c **********************************************/ |
| 17450 | +/************** Begin file ctime.c *******************************************/ |
| 17451 | +/* |
| 17452 | +** 2010 February 23 |
| 17453 | +** |
| 17454 | +** The author disclaims copyright to this source code. In place of |
| 17455 | +** a legal notice, here is a blessing: |
| 17456 | +** |
| 17457 | +** May you do good and not evil. |
| 17458 | +** May you find forgiveness for yourself and forgive others. |
| 17459 | +** May you share freely, never taking more than you give. |
| 17460 | +** |
| 17461 | +************************************************************************* |
| 17462 | +** |
| 17463 | +** This file implements routines used to report what compile-time options |
| 17464 | +** SQLite was built with. |
| 17465 | +*/ |
| 17466 | + |
| 17467 | +#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 17468 | + |
| 17469 | +/* #include "sqliteInt.h" */ |
| 17470 | + |
| 17471 | +/* |
| 17472 | +** An array of names of all compile-time options. This array should |
| 17473 | +** be sorted A-Z. |
| 17474 | +** |
| 17475 | +** This array looks large, but in a typical installation actually uses |
| 17476 | +** only a handful of compile-time options, so most times this array is usually |
| 17477 | +** rather short and uses little memory space. |
| 17478 | +*/ |
| 17479 | +static const char * const azCompileOpt[] = { |
| 17480 | + |
| 17481 | +/* These macros are provided to "stringify" the value of the define |
| 17482 | +** for those options in which the value is meaningful. */ |
| 17483 | +#define CTIMEOPT_VAL_(opt) #opt |
| 17484 | +#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) |
| 17485 | + |
| 17486 | +#if SQLITE_32BIT_ROWID |
| 17487 | + "32BIT_ROWID", |
| 17488 | +#endif |
| 17489 | +#if SQLITE_4_BYTE_ALIGNED_MALLOC |
| 17490 | + "4_BYTE_ALIGNED_MALLOC", |
| 17491 | +#endif |
| 17492 | +#if SQLITE_CASE_SENSITIVE_LIKE |
| 17493 | + "CASE_SENSITIVE_LIKE", |
| 17494 | +#endif |
| 17495 | +#if SQLITE_CHECK_PAGES |
| 17496 | + "CHECK_PAGES", |
| 17497 | +#endif |
| 17498 | +#if defined(__clang__) && defined(__clang_major__) |
| 17499 | + "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "." |
| 17500 | + CTIMEOPT_VAL(__clang_minor__) "." |
| 17501 | + CTIMEOPT_VAL(__clang_patchlevel__), |
| 17502 | +#elif defined(_MSC_VER) |
| 17503 | + "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER), |
| 17504 | +#elif defined(__GNUC__) && defined(__VERSION__) |
| 17505 | + "COMPILER=gcc-" __VERSION__, |
| 17506 | +#endif |
| 17507 | +#if SQLITE_COVERAGE_TEST |
| 17508 | + "COVERAGE_TEST", |
| 17509 | +#endif |
| 17510 | +#ifdef SQLITE_DEBUG |
| 17511 | + "DEBUG", |
| 17512 | +#endif |
| 17513 | +#if SQLITE_DEFAULT_LOCKING_MODE |
| 17514 | + "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), |
| 17515 | +#endif |
| 17516 | +#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc) |
| 17517 | + "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), |
| 17518 | +#endif |
| 17519 | +#if SQLITE_DEFAULT_SYNCHRONOUS |
| 17520 | + "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS), |
| 17521 | +#endif |
| 17522 | +#if SQLITE_DEFAULT_WAL_SYNCHRONOUS |
| 17523 | + "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS), |
| 17524 | +#endif |
| 17525 | +#if SQLITE_DIRECT_OVERFLOW_READ |
| 17526 | + "DIRECT_OVERFLOW_READ", |
| 17527 | +#endif |
| 17528 | +#if SQLITE_DISABLE_DIRSYNC |
| 17529 | + "DISABLE_DIRSYNC", |
| 17530 | +#endif |
| 17531 | +#if SQLITE_DISABLE_LFS |
| 17532 | + "DISABLE_LFS", |
| 17533 | +#endif |
| 17534 | +#if SQLITE_ENABLE_8_3_NAMES |
| 17535 | + "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES), |
| 17536 | +#endif |
| 17537 | +#if SQLITE_ENABLE_API_ARMOR |
| 17538 | + "ENABLE_API_ARMOR", |
| 17539 | +#endif |
| 17540 | +#if SQLITE_ENABLE_ATOMIC_WRITE |
| 17541 | + "ENABLE_ATOMIC_WRITE", |
| 17542 | +#endif |
| 17543 | +#if SQLITE_ENABLE_CEROD |
| 17544 | + "ENABLE_CEROD", |
| 17545 | +#endif |
| 17546 | +#if SQLITE_ENABLE_COLUMN_METADATA |
| 17547 | + "ENABLE_COLUMN_METADATA", |
| 17548 | +#endif |
| 17549 | +#if SQLITE_ENABLE_DBSTAT_VTAB |
| 17550 | + "ENABLE_DBSTAT_VTAB", |
| 17551 | +#endif |
| 17552 | +#if SQLITE_ENABLE_EXPENSIVE_ASSERT |
| 17553 | + "ENABLE_EXPENSIVE_ASSERT", |
| 17554 | +#endif |
| 17555 | +#if SQLITE_ENABLE_FTS1 |
| 17556 | + "ENABLE_FTS1", |
| 17557 | +#endif |
| 17558 | +#if SQLITE_ENABLE_FTS2 |
| 17559 | + "ENABLE_FTS2", |
| 17560 | +#endif |
| 17561 | +#if SQLITE_ENABLE_FTS3 |
| 17562 | + "ENABLE_FTS3", |
| 17563 | +#endif |
| 17564 | +#if SQLITE_ENABLE_FTS3_PARENTHESIS |
| 17565 | + "ENABLE_FTS3_PARENTHESIS", |
| 17566 | +#endif |
| 17567 | +#if SQLITE_ENABLE_FTS4 |
| 17568 | + "ENABLE_FTS4", |
| 17569 | +#endif |
| 17570 | +#if SQLITE_ENABLE_FTS5 |
| 17571 | + "ENABLE_FTS5", |
| 17572 | +#endif |
| 17573 | +#if SQLITE_ENABLE_ICU |
| 17574 | + "ENABLE_ICU", |
| 17575 | +#endif |
| 17576 | +#if SQLITE_ENABLE_IOTRACE |
| 17577 | + "ENABLE_IOTRACE", |
| 17578 | +#endif |
| 17579 | +#if SQLITE_ENABLE_JSON1 |
| 17580 | + "ENABLE_JSON1", |
| 17581 | +#endif |
| 17582 | +#if SQLITE_ENABLE_LOAD_EXTENSION |
| 17583 | + "ENABLE_LOAD_EXTENSION", |
| 17584 | +#endif |
| 17585 | +#if SQLITE_ENABLE_LOCKING_STYLE |
| 17586 | + "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), |
| 17587 | +#endif |
| 17588 | +#if SQLITE_ENABLE_MEMORY_MANAGEMENT |
| 17589 | + "ENABLE_MEMORY_MANAGEMENT", |
| 17590 | +#endif |
| 17591 | +#if SQLITE_ENABLE_MEMSYS3 |
| 17592 | + "ENABLE_MEMSYS3", |
| 17593 | +#endif |
| 17594 | +#if SQLITE_ENABLE_MEMSYS5 |
| 17595 | + "ENABLE_MEMSYS5", |
| 17596 | +#endif |
| 17597 | +#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK |
| 17598 | + "ENABLE_OVERSIZE_CELL_CHECK", |
| 17599 | +#endif |
| 17600 | +#if SQLITE_ENABLE_RTREE |
| 17601 | + "ENABLE_RTREE", |
| 17602 | +#endif |
| 17603 | +#if defined(SQLITE_ENABLE_STAT4) |
| 17604 | + "ENABLE_STAT4", |
| 17605 | +#elif defined(SQLITE_ENABLE_STAT3) |
| 17606 | + "ENABLE_STAT3", |
| 17607 | +#endif |
| 17608 | +#if SQLITE_ENABLE_UNLOCK_NOTIFY |
| 17609 | + "ENABLE_UNLOCK_NOTIFY", |
| 17610 | +#endif |
| 17611 | +#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT |
| 17612 | + "ENABLE_UPDATE_DELETE_LIMIT", |
| 17613 | +#endif |
| 17614 | +#if defined(SQLITE_ENABLE_URI_00_ERROR) |
| 17615 | + "ENABLE_URI_00_ERROR", |
| 17616 | +#endif |
| 17617 | +#if SQLITE_HAS_CODEC |
| 17618 | + "HAS_CODEC", |
| 17619 | +#endif |
| 17620 | +#if HAVE_ISNAN || SQLITE_HAVE_ISNAN |
| 17621 | + "HAVE_ISNAN", |
| 17622 | +#endif |
| 17623 | +#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX |
| 17624 | + "HOMEGROWN_RECURSIVE_MUTEX", |
| 17625 | +#endif |
| 17626 | +#if SQLITE_IGNORE_AFP_LOCK_ERRORS |
| 17627 | + "IGNORE_AFP_LOCK_ERRORS", |
| 17628 | +#endif |
| 17629 | +#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS |
| 17630 | + "IGNORE_FLOCK_LOCK_ERRORS", |
| 17631 | +#endif |
| 17632 | +#ifdef SQLITE_INT64_TYPE |
| 17633 | + "INT64_TYPE", |
| 17634 | +#endif |
| 17635 | +#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 17636 | + "LIKE_DOESNT_MATCH_BLOBS", |
| 17637 | +#endif |
| 17638 | +#if SQLITE_LOCK_TRACE |
| 17639 | + "LOCK_TRACE", |
| 17640 | +#endif |
| 17641 | +#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc) |
| 17642 | + "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), |
| 17643 | +#endif |
| 17644 | +#ifdef SQLITE_MAX_SCHEMA_RETRY |
| 17645 | + "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), |
| 17646 | +#endif |
| 17647 | +#if SQLITE_MEMDEBUG |
| 17648 | + "MEMDEBUG", |
| 17649 | +#endif |
| 17650 | +#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT |
| 17651 | + "MIXED_ENDIAN_64BIT_FLOAT", |
| 17652 | +#endif |
| 17653 | +#if SQLITE_NO_SYNC |
| 17654 | + "NO_SYNC", |
| 17655 | +#endif |
| 17656 | +#if SQLITE_OMIT_ALTERTABLE |
| 17657 | + "OMIT_ALTERTABLE", |
| 17658 | +#endif |
| 17659 | +#if SQLITE_OMIT_ANALYZE |
| 17660 | + "OMIT_ANALYZE", |
| 17661 | +#endif |
| 17662 | +#if SQLITE_OMIT_ATTACH |
| 17663 | + "OMIT_ATTACH", |
| 17664 | +#endif |
| 17665 | +#if SQLITE_OMIT_AUTHORIZATION |
| 17666 | + "OMIT_AUTHORIZATION", |
| 17667 | +#endif |
| 17668 | +#if SQLITE_OMIT_AUTOINCREMENT |
| 17669 | + "OMIT_AUTOINCREMENT", |
| 17670 | +#endif |
| 17671 | +#if SQLITE_OMIT_AUTOINIT |
| 17672 | + "OMIT_AUTOINIT", |
| 17673 | +#endif |
| 17674 | +#if SQLITE_OMIT_AUTOMATIC_INDEX |
| 17675 | + "OMIT_AUTOMATIC_INDEX", |
| 17676 | +#endif |
| 17677 | +#if SQLITE_OMIT_AUTORESET |
| 17678 | + "OMIT_AUTORESET", |
| 17679 | +#endif |
| 17680 | +#if SQLITE_OMIT_AUTOVACUUM |
| 17681 | + "OMIT_AUTOVACUUM", |
| 17682 | +#endif |
| 17683 | +#if SQLITE_OMIT_BETWEEN_OPTIMIZATION |
| 17684 | + "OMIT_BETWEEN_OPTIMIZATION", |
| 17685 | +#endif |
| 17686 | +#if SQLITE_OMIT_BLOB_LITERAL |
| 17687 | + "OMIT_BLOB_LITERAL", |
| 17688 | +#endif |
| 17689 | +#if SQLITE_OMIT_BTREECOUNT |
| 17690 | + "OMIT_BTREECOUNT", |
| 17691 | +#endif |
| 17692 | +#if SQLITE_OMIT_CAST |
| 17693 | + "OMIT_CAST", |
| 17694 | +#endif |
| 17695 | +#if SQLITE_OMIT_CHECK |
| 17696 | + "OMIT_CHECK", |
| 17697 | +#endif |
| 17698 | +#if SQLITE_OMIT_COMPLETE |
| 17699 | + "OMIT_COMPLETE", |
| 17700 | +#endif |
| 17701 | +#if SQLITE_OMIT_COMPOUND_SELECT |
| 17702 | + "OMIT_COMPOUND_SELECT", |
| 17703 | +#endif |
| 17704 | +#if SQLITE_OMIT_CTE |
| 17705 | + "OMIT_CTE", |
| 17706 | +#endif |
| 17707 | +#if SQLITE_OMIT_DATETIME_FUNCS |
| 17708 | + "OMIT_DATETIME_FUNCS", |
| 17709 | +#endif |
| 17710 | +#if SQLITE_OMIT_DECLTYPE |
| 17711 | + "OMIT_DECLTYPE", |
| 17712 | +#endif |
| 17713 | +#if SQLITE_OMIT_DEPRECATED |
| 17714 | + "OMIT_DEPRECATED", |
| 17715 | +#endif |
| 17716 | +#if SQLITE_OMIT_DISKIO |
| 17717 | + "OMIT_DISKIO", |
| 17718 | +#endif |
| 17719 | +#if SQLITE_OMIT_EXPLAIN |
| 17720 | + "OMIT_EXPLAIN", |
| 17721 | +#endif |
| 17722 | +#if SQLITE_OMIT_FLAG_PRAGMAS |
| 17723 | + "OMIT_FLAG_PRAGMAS", |
| 17724 | +#endif |
| 17725 | +#if SQLITE_OMIT_FLOATING_POINT |
| 17726 | + "OMIT_FLOATING_POINT", |
| 17727 | +#endif |
| 17728 | +#if SQLITE_OMIT_FOREIGN_KEY |
| 17729 | + "OMIT_FOREIGN_KEY", |
| 17730 | +#endif |
| 17731 | +#if SQLITE_OMIT_GET_TABLE |
| 17732 | + "OMIT_GET_TABLE", |
| 17733 | +#endif |
| 17734 | +#if SQLITE_OMIT_INCRBLOB |
| 17735 | + "OMIT_INCRBLOB", |
| 17736 | +#endif |
| 17737 | +#if SQLITE_OMIT_INTEGRITY_CHECK |
| 17738 | + "OMIT_INTEGRITY_CHECK", |
| 17739 | +#endif |
| 17740 | +#if SQLITE_OMIT_LIKE_OPTIMIZATION |
| 17741 | + "OMIT_LIKE_OPTIMIZATION", |
| 17742 | +#endif |
| 17743 | +#if SQLITE_OMIT_LOAD_EXTENSION |
| 17744 | + "OMIT_LOAD_EXTENSION", |
| 17745 | +#endif |
| 17746 | +#if SQLITE_OMIT_LOCALTIME |
| 17747 | + "OMIT_LOCALTIME", |
| 17748 | +#endif |
| 17749 | +#if SQLITE_OMIT_LOOKASIDE |
| 17750 | + "OMIT_LOOKASIDE", |
| 17751 | +#endif |
| 17752 | +#if SQLITE_OMIT_MEMORYDB |
| 17753 | + "OMIT_MEMORYDB", |
| 17754 | +#endif |
| 17755 | +#if SQLITE_OMIT_OR_OPTIMIZATION |
| 17756 | + "OMIT_OR_OPTIMIZATION", |
| 17757 | +#endif |
| 17758 | +#if SQLITE_OMIT_PAGER_PRAGMAS |
| 17759 | + "OMIT_PAGER_PRAGMAS", |
| 17760 | +#endif |
| 17761 | +#if SQLITE_OMIT_PRAGMA |
| 17762 | + "OMIT_PRAGMA", |
| 17763 | +#endif |
| 17764 | +#if SQLITE_OMIT_PROGRESS_CALLBACK |
| 17765 | + "OMIT_PROGRESS_CALLBACK", |
| 17766 | +#endif |
| 17767 | +#if SQLITE_OMIT_QUICKBALANCE |
| 17768 | + "OMIT_QUICKBALANCE", |
| 17769 | +#endif |
| 17770 | +#if SQLITE_OMIT_REINDEX |
| 17771 | + "OMIT_REINDEX", |
| 17772 | +#endif |
| 17773 | +#if SQLITE_OMIT_SCHEMA_PRAGMAS |
| 17774 | + "OMIT_SCHEMA_PRAGMAS", |
| 17775 | +#endif |
| 17776 | +#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS |
| 17777 | + "OMIT_SCHEMA_VERSION_PRAGMAS", |
| 17778 | +#endif |
| 17779 | +#if SQLITE_OMIT_SHARED_CACHE |
| 17780 | + "OMIT_SHARED_CACHE", |
| 17781 | +#endif |
| 17782 | +#if SQLITE_OMIT_SUBQUERY |
| 17783 | + "OMIT_SUBQUERY", |
| 17784 | +#endif |
| 17785 | +#if SQLITE_OMIT_TCL_VARIABLE |
| 17786 | + "OMIT_TCL_VARIABLE", |
| 17787 | +#endif |
| 17788 | +#if SQLITE_OMIT_TEMPDB |
| 17789 | + "OMIT_TEMPDB", |
| 17790 | +#endif |
| 17791 | +#if SQLITE_OMIT_TRACE |
| 17792 | + "OMIT_TRACE", |
| 17793 | +#endif |
| 17794 | +#if SQLITE_OMIT_TRIGGER |
| 17795 | + "OMIT_TRIGGER", |
| 17796 | +#endif |
| 17797 | +#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION |
| 17798 | + "OMIT_TRUNCATE_OPTIMIZATION", |
| 17799 | +#endif |
| 17800 | +#if SQLITE_OMIT_UTF16 |
| 17801 | + "OMIT_UTF16", |
| 17802 | +#endif |
| 17803 | +#if SQLITE_OMIT_VACUUM |
| 17804 | + "OMIT_VACUUM", |
| 17805 | +#endif |
| 17806 | +#if SQLITE_OMIT_VIEW |
| 17807 | + "OMIT_VIEW", |
| 17808 | +#endif |
| 17809 | +#if SQLITE_OMIT_VIRTUALTABLE |
| 17810 | + "OMIT_VIRTUALTABLE", |
| 17811 | +#endif |
| 17812 | +#if SQLITE_OMIT_WAL |
| 17813 | + "OMIT_WAL", |
| 17814 | +#endif |
| 17815 | +#if SQLITE_OMIT_WSD |
| 17816 | + "OMIT_WSD", |
| 17817 | +#endif |
| 17818 | +#if SQLITE_OMIT_XFER_OPT |
| 17819 | + "OMIT_XFER_OPT", |
| 17820 | +#endif |
| 17821 | +#if SQLITE_PERFORMANCE_TRACE |
| 17822 | + "PERFORMANCE_TRACE", |
| 17823 | +#endif |
| 17824 | +#if SQLITE_PROXY_DEBUG |
| 17825 | + "PROXY_DEBUG", |
| 17826 | +#endif |
| 17827 | +#if SQLITE_RTREE_INT_ONLY |
| 17828 | + "RTREE_INT_ONLY", |
| 17829 | +#endif |
| 17830 | +#if SQLITE_SECURE_DELETE |
| 17831 | + "SECURE_DELETE", |
| 17832 | +#endif |
| 17833 | +#if SQLITE_SMALL_STACK |
| 17834 | + "SMALL_STACK", |
| 17835 | +#endif |
| 17836 | +#if SQLITE_SOUNDEX |
| 17837 | + "SOUNDEX", |
| 17838 | +#endif |
| 17839 | +#if SQLITE_SYSTEM_MALLOC |
| 17840 | + "SYSTEM_MALLOC", |
| 17841 | +#endif |
| 17842 | +#if SQLITE_TCL |
| 17843 | + "TCL", |
| 17844 | +#endif |
| 17845 | +#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc) |
| 17846 | + "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), |
| 17847 | +#endif |
| 17848 | +#if SQLITE_TEST |
| 17849 | + "TEST", |
| 17850 | +#endif |
| 17851 | +#if defined(SQLITE_THREADSAFE) |
| 17852 | + "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), |
| 17853 | +#endif |
| 17854 | +#if SQLITE_UNTESTABLE |
| 17855 | + "UNTESTABLE" |
| 17856 | +#endif |
| 17857 | +#if SQLITE_USE_ALLOCA |
| 17858 | + "USE_ALLOCA", |
| 17859 | +#endif |
| 17860 | +#if SQLITE_USER_AUTHENTICATION |
| 17861 | + "USER_AUTHENTICATION", |
| 17862 | +#endif |
| 17863 | +#if SQLITE_WIN32_MALLOC |
| 17864 | + "WIN32_MALLOC", |
| 17865 | +#endif |
| 17866 | +#if SQLITE_ZERO_MALLOC |
| 17867 | + "ZERO_MALLOC" |
| 17868 | +#endif |
| 17869 | +}; |
| 17870 | + |
| 17871 | +/* |
| 17872 | +** Given the name of a compile-time option, return true if that option |
| 17873 | +** was used and false if not. |
| 17874 | +** |
| 17875 | +** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix |
| 17876 | +** is not required for a match. |
| 17877 | +*/ |
| 17878 | +SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ |
| 17879 | + int i, n; |
| 17880 | + |
| 17881 | +#if SQLITE_ENABLE_API_ARMOR |
| 17882 | + if( zOptName==0 ){ |
| 17883 | + (void)SQLITE_MISUSE_BKPT; |
| 17884 | + return 0; |
| 17885 | + } |
| 17886 | +#endif |
| 17887 | + if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; |
| 17888 | + n = sqlite3Strlen30(zOptName); |
| 17889 | + |
| 17890 | + /* Since ArraySize(azCompileOpt) is normally in single digits, a |
| 17891 | + ** linear search is adequate. No need for a binary search. */ |
| 17892 | + for(i=0; i<ArraySize(azCompileOpt); i++){ |
| 17893 | + if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0 |
| 17894 | + && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0 |
| 17895 | + ){ |
| 17896 | + return 1; |
| 17897 | + } |
| 17898 | + } |
| 17899 | + return 0; |
| 17900 | +} |
| 17901 | + |
| 17902 | +/* |
| 17903 | +** Return the N-th compile-time option string. If N is out of range, |
| 17904 | +** return a NULL pointer. |
| 17905 | +*/ |
| 17906 | +SQLITE_API const char *sqlite3_compileoption_get(int N){ |
| 17907 | + if( N>=0 && N<ArraySize(azCompileOpt) ){ |
| 17908 | + return azCompileOpt[N]; |
| 17909 | + } |
| 17910 | + return 0; |
| 17911 | +} |
| 17912 | + |
| 17913 | +#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ |
| 17914 | + |
| 17915 | +/************** End of ctime.c ***********************************************/ |
| 18323 | 17916 | /************** Begin file status.c ******************************************/ |
| 18324 | 17917 | /* |
| 18325 | 17918 | ** 2008 June 18 |
| 18326 | 17919 | ** |
| 18327 | 17920 | ** The author disclaims copyright to this source code. In place of |
| | @@ -18721,22 +18314,22 @@ |
| 18721 | 18314 | int rcApp; /* errcode set by sqlite3_result_error_code() */ |
| 18722 | 18315 | #endif |
| 18723 | 18316 | u16 nResColumn; /* Number of columns in one row of the result set */ |
| 18724 | 18317 | u8 errorAction; /* Recovery action to do in case of an error */ |
| 18725 | 18318 | u8 minWriteFileFormat; /* Minimum file format for writable database files */ |
| 18726 | | - u8 prepFlags; /* SQLITE_PREPARE_* flags */ |
| 18727 | 18319 | bft expired:1; /* True if the VM needs to be recompiled */ |
| 18728 | 18320 | bft doingRerun:1; /* True if rerunning after an auto-reprepare */ |
| 18729 | 18321 | bft explain:2; /* True if EXPLAIN present on SQL command */ |
| 18730 | 18322 | bft changeCntOn:1; /* True to update the change-counter */ |
| 18731 | 18323 | bft runOnlyOnce:1; /* Automatically expire on reset */ |
| 18732 | 18324 | bft usesStmtJournal:1; /* True if uses a statement journal */ |
| 18733 | 18325 | bft readOnly:1; /* True for statements that do not write */ |
| 18734 | 18326 | bft bIsReader:1; /* True for statements that read */ |
| 18327 | + bft isPrepareV2:1; /* True if prepared with prepare_v2() */ |
| 18735 | 18328 | yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ |
| 18736 | 18329 | yDbMask lockMask; /* Subset of btreeMask that requires a lock */ |
| 18737 | | - u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */ |
| 18330 | + u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */ |
| 18738 | 18331 | char *zSql; /* Text of the SQL statement that generated this */ |
| 18739 | 18332 | void *pFree; /* Free this when deleting the vdbe */ |
| 18740 | 18333 | VdbeFrame *pFrame; /* Parent frame */ |
| 18741 | 18334 | VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */ |
| 18742 | 18335 | int nFrame; /* Number of frames in pFrame list */ |
| | @@ -18845,11 +18438,11 @@ |
| 18845 | 18438 | |
| 18846 | 18439 | SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *); |
| 18847 | 18440 | SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *); |
| 18848 | 18441 | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); |
| 18849 | 18442 | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); |
| 18850 | | -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *); |
| 18443 | +SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *); |
| 18851 | 18444 | SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *, int *); |
| 18852 | 18445 | SQLITE_PRIVATE int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *); |
| 18853 | 18446 | SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); |
| 18854 | 18447 | |
| 18855 | 18448 | #if !defined(SQLITE_OMIT_SHARED_CACHE) |
| | @@ -30045,11 +29638,11 @@ |
| 30045 | 29638 | /* 125 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 30046 | 29639 | /* 126 */ "NullRow" OpHelp(""), |
| 30047 | 29640 | /* 127 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 30048 | 29641 | /* 128 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 30049 | 29642 | /* 129 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 30050 | | - /* 130 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 29643 | + /* 130 */ "Seek" OpHelp("Move P3 to P1.rowid"), |
| 30051 | 29644 | /* 131 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 30052 | 29645 | /* 132 */ "Real" OpHelp("r[P2]=P4"), |
| 30053 | 29646 | /* 133 */ "Destroy" OpHelp(""), |
| 30054 | 29647 | /* 134 */ "Clear" OpHelp(""), |
| 30055 | 29648 | /* 135 */ "ResetSorter" OpHelp(""), |
| | @@ -50575,11 +50168,11 @@ |
| 50575 | 50168 | assert( isOpen(pPager->fd) ); |
| 50576 | 50169 | assert( pPager->tempFile==0 ); |
| 50577 | 50170 | nPage = sqlite3WalDbsize(pPager->pWal); |
| 50578 | 50171 | |
| 50579 | 50172 | /* If the number of pages in the database is not available from the |
| 50580 | | - ** WAL sub-system, determine the page count based on the size of |
| 50173 | + ** WAL sub-system, determine the page counte based on the size of |
| 50581 | 50174 | ** the database file. If the size of the database file is not an |
| 50582 | 50175 | ** integer multiple of the page-size, round up the result. |
| 50583 | 50176 | */ |
| 50584 | 50177 | if( nPage==0 && ALWAYS(isOpen(pPager->fd)) ){ |
| 50585 | 50178 | i64 n = 0; /* Size of db file in bytes */ |
| | @@ -50626,25 +50219,27 @@ |
| 50626 | 50219 | assert( pPager->eState==PAGER_OPEN ); |
| 50627 | 50220 | assert( pPager->eLock>=SHARED_LOCK ); |
| 50628 | 50221 | |
| 50629 | 50222 | if( !pPager->tempFile ){ |
| 50630 | 50223 | int isWal; /* True if WAL file exists */ |
| 50631 | | - rc = sqlite3OsAccess( |
| 50632 | | - pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal |
| 50633 | | - ); |
| 50224 | + Pgno nPage; /* Size of the database file */ |
| 50225 | + |
| 50226 | + rc = pagerPagecount(pPager, &nPage); |
| 50227 | + if( rc ) return rc; |
| 50228 | + if( nPage==0 ){ |
| 50229 | + rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); |
| 50230 | + if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK; |
| 50231 | + isWal = 0; |
| 50232 | + }else{ |
| 50233 | + rc = sqlite3OsAccess( |
| 50234 | + pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal |
| 50235 | + ); |
| 50236 | + } |
| 50634 | 50237 | if( rc==SQLITE_OK ){ |
| 50635 | 50238 | if( isWal ){ |
| 50636 | | - Pgno nPage; /* Size of the database file */ |
| 50637 | | - |
| 50638 | | - rc = pagerPagecount(pPager, &nPage); |
| 50639 | | - if( rc ) return rc; |
| 50640 | | - if( nPage==0 ){ |
| 50641 | | - rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); |
| 50642 | | - }else{ |
| 50643 | | - testcase( sqlite3PcachePagecount(pPager->pPCache)==0 ); |
| 50644 | | - rc = sqlite3PagerOpenWal(pPager, 0); |
| 50645 | | - } |
| 50239 | + testcase( sqlite3PcachePagecount(pPager->pPCache)==0 ); |
| 50240 | + rc = sqlite3PagerOpenWal(pPager, 0); |
| 50646 | 50241 | }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){ |
| 50647 | 50242 | pPager->journalMode = PAGER_JOURNALMODE_DELETE; |
| 50648 | 50243 | } |
| 50649 | 50244 | } |
| 50650 | 50245 | } |
| | @@ -52583,18 +52178,23 @@ |
| 52583 | 52178 | ** |
| 52584 | 52179 | ** There is a vanishingly small chance that a change will not be |
| 52585 | 52180 | ** detected. The chance of an undetected change is so small that |
| 52586 | 52181 | ** it can be neglected. |
| 52587 | 52182 | */ |
| 52183 | + Pgno nPage = 0; |
| 52588 | 52184 | char dbFileVers[sizeof(pPager->dbFileVers)]; |
| 52589 | 52185 | |
| 52590 | | - IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers))); |
| 52591 | | - rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24); |
| 52592 | | - if( rc!=SQLITE_OK ){ |
| 52593 | | - if( rc!=SQLITE_IOERR_SHORT_READ ){ |
| 52186 | + rc = pagerPagecount(pPager, &nPage); |
| 52187 | + if( rc ) goto failed; |
| 52188 | + |
| 52189 | + if( nPage>0 ){ |
| 52190 | + IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers))); |
| 52191 | + rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24); |
| 52192 | + if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){ |
| 52594 | 52193 | goto failed; |
| 52595 | 52194 | } |
| 52195 | + }else{ |
| 52596 | 52196 | memset(dbFileVers, 0, sizeof(dbFileVers)); |
| 52597 | 52197 | } |
| 52598 | 52198 | |
| 52599 | 52199 | if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){ |
| 52600 | 52200 | pager_reset(pPager); |
| | @@ -59584,11 +59184,11 @@ |
| 59584 | 59184 | /* If this database is not shareable, or if the client is reading |
| 59585 | 59185 | ** and has the read-uncommitted flag set, then no lock is required. |
| 59586 | 59186 | ** Return true immediately. |
| 59587 | 59187 | */ |
| 59588 | 59188 | if( (pBtree->sharable==0) |
| 59589 | | - || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommit)) |
| 59189 | + || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted)) |
| 59590 | 59190 | ){ |
| 59591 | 59191 | return 1; |
| 59592 | 59192 | } |
| 59593 | 59193 | |
| 59594 | 59194 | /* If the client is reading or writing an index and the schema is |
| | @@ -59661,11 +59261,11 @@ |
| 59661 | 59261 | static int hasReadConflicts(Btree *pBtree, Pgno iRoot){ |
| 59662 | 59262 | BtCursor *p; |
| 59663 | 59263 | for(p=pBtree->pBt->pCursor; p; p=p->pNext){ |
| 59664 | 59264 | if( p->pgnoRoot==iRoot |
| 59665 | 59265 | && p->pBtree!=pBtree |
| 59666 | | - && 0==(p->pBtree->db->flags & SQLITE_ReadUncommit) |
| 59266 | + && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted) |
| 59667 | 59267 | ){ |
| 59668 | 59268 | return 1; |
| 59669 | 59269 | } |
| 59670 | 59270 | } |
| 59671 | 59271 | return 0; |
| | @@ -59683,11 +59283,11 @@ |
| 59683 | 59283 | BtLock *pIter; |
| 59684 | 59284 | |
| 59685 | 59285 | assert( sqlite3BtreeHoldsMutex(p) ); |
| 59686 | 59286 | assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); |
| 59687 | 59287 | assert( p->db!=0 ); |
| 59688 | | - assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 ); |
| 59288 | + assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 ); |
| 59689 | 59289 | |
| 59690 | 59290 | /* If requesting a write-lock, then the Btree must have an open write |
| 59691 | 59291 | ** transaction on this file. And, obviously, for this to be so there |
| 59692 | 59292 | ** must be an open write transaction on the file itself. |
| 59693 | 59293 | */ |
| | @@ -59761,11 +59361,11 @@ |
| 59761 | 59361 | |
| 59762 | 59362 | /* A connection with the read-uncommitted flag set will never try to |
| 59763 | 59363 | ** obtain a read-lock using this function. The only read-lock obtained |
| 59764 | 59364 | ** by a connection in read-uncommitted mode is on the sqlite_master |
| 59765 | 59365 | ** table, and that lock is obtained in BtreeBeginTrans(). */ |
| 59766 | | - assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK ); |
| 59366 | + assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK ); |
| 59767 | 59367 | |
| 59768 | 59368 | /* This function should only be called on a sharable b-tree after it |
| 59769 | 59369 | ** has been determined that no other b-tree holds a conflicting lock. */ |
| 59770 | 59370 | assert( p->sharable ); |
| 59771 | 59371 | assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) ); |
| | @@ -60203,11 +59803,11 @@ |
| 60203 | 59803 | assert( nKey==(i64)(int)nKey ); |
| 60204 | 59804 | pIdxKey = sqlite3VdbeAllocUnpackedRecord(pCur->pKeyInfo); |
| 60205 | 59805 | if( pIdxKey==0 ) return SQLITE_NOMEM_BKPT; |
| 60206 | 59806 | sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey); |
| 60207 | 59807 | if( pIdxKey->nField==0 ){ |
| 60208 | | - rc = SQLITE_CORRUPT_PGNO(pCur->apPage[pCur->iPage]->pgno); |
| 59808 | + rc = SQLITE_CORRUPT_BKPT; |
| 60209 | 59809 | goto moveto_done; |
| 60210 | 59810 | } |
| 60211 | 59811 | }else{ |
| 60212 | 59812 | pIdxKey = 0; |
| 60213 | 59813 | } |
| | @@ -60432,11 +60032,11 @@ |
| 60432 | 60032 | assert( pEType!=0 ); |
| 60433 | 60033 | *pEType = pPtrmap[offset]; |
| 60434 | 60034 | if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]); |
| 60435 | 60035 | |
| 60436 | 60036 | sqlite3PagerUnref(pDbPage); |
| 60437 | | - if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap); |
| 60037 | + if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT; |
| 60438 | 60038 | return SQLITE_OK; |
| 60439 | 60039 | } |
| 60440 | 60040 | |
| 60441 | 60041 | #else /* if defined SQLITE_OMIT_AUTOVACUUM */ |
| 60442 | 60042 | #define ptrmapPut(w,x,y,z,rc) |
| | @@ -60817,11 +60417,11 @@ |
| 60817 | 60417 | u8 *pAddr; |
| 60818 | 60418 | int sz2 = 0; |
| 60819 | 60419 | int sz = get2byte(&data[iFree+2]); |
| 60820 | 60420 | int top = get2byte(&data[hdr+5]); |
| 60821 | 60421 | if( iFree2 ){ |
| 60822 | | - if( iFree+sz>iFree2 ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60422 | + if( iFree+sz>iFree2 ) return SQLITE_CORRUPT_BKPT; |
| 60823 | 60423 | sz2 = get2byte(&data[iFree2+2]); |
| 60824 | 60424 | assert( iFree+sz+sz2+iFree2-(iFree+sz) <= usableSize ); |
| 60825 | 60425 | memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz)); |
| 60826 | 60426 | sz += sz2; |
| 60827 | 60427 | } |
| | @@ -60848,17 +60448,17 @@ |
| 60848 | 60448 | testcase( pc==iCellLast ); |
| 60849 | 60449 | /* These conditions have already been verified in btreeInitPage() |
| 60850 | 60450 | ** if PRAGMA cell_size_check=ON. |
| 60851 | 60451 | */ |
| 60852 | 60452 | if( pc<iCellFirst || pc>iCellLast ){ |
| 60853 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60453 | + return SQLITE_CORRUPT_BKPT; |
| 60854 | 60454 | } |
| 60855 | 60455 | assert( pc>=iCellFirst && pc<=iCellLast ); |
| 60856 | 60456 | size = pPage->xCellSize(pPage, &src[pc]); |
| 60857 | 60457 | cbrk -= size; |
| 60858 | 60458 | if( cbrk<iCellFirst || pc+size>usableSize ){ |
| 60859 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60459 | + return SQLITE_CORRUPT_BKPT; |
| 60860 | 60460 | } |
| 60861 | 60461 | assert( cbrk+size<=usableSize && cbrk>=iCellFirst ); |
| 60862 | 60462 | testcase( cbrk+size==usableSize ); |
| 60863 | 60463 | testcase( pc+size==usableSize ); |
| 60864 | 60464 | put2byte(pAddr, cbrk); |
| | @@ -60874,11 +60474,11 @@ |
| 60874 | 60474 | } |
| 60875 | 60475 | data[hdr+7] = 0; |
| 60876 | 60476 | |
| 60877 | 60477 | defragment_out: |
| 60878 | 60478 | if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){ |
| 60879 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60479 | + return SQLITE_CORRUPT_BKPT; |
| 60880 | 60480 | } |
| 60881 | 60481 | assert( cbrk>=iCellFirst ); |
| 60882 | 60482 | put2byte(&data[hdr+5], cbrk); |
| 60883 | 60483 | data[hdr+1] = 0; |
| 60884 | 60484 | data[hdr+2] = 0; |
| | @@ -60913,11 +60513,11 @@ |
| 60913 | 60513 | do{ |
| 60914 | 60514 | int size; /* Size of the free slot */ |
| 60915 | 60515 | /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of |
| 60916 | 60516 | ** increasing offset. */ |
| 60917 | 60517 | if( pc>usableSize-4 || pc<iAddr+4 ){ |
| 60918 | | - *pRc = SQLITE_CORRUPT_PGNO(pPg->pgno); |
| 60518 | + *pRc = SQLITE_CORRUPT_BKPT; |
| 60919 | 60519 | return 0; |
| 60920 | 60520 | } |
| 60921 | 60521 | /* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each |
| 60922 | 60522 | ** freeblock form a big-endian integer which is the size of the freeblock |
| 60923 | 60523 | ** in bytes, including the 4-byte header. */ |
| | @@ -60924,11 +60524,11 @@ |
| 60924 | 60524 | size = get2byte(&aData[pc+2]); |
| 60925 | 60525 | if( (x = size - nByte)>=0 ){ |
| 60926 | 60526 | testcase( x==4 ); |
| 60927 | 60527 | testcase( x==3 ); |
| 60928 | 60528 | if( pc < pPg->cellOffset+2*pPg->nCell || size+pc > usableSize ){ |
| 60929 | | - *pRc = SQLITE_CORRUPT_PGNO(pPg->pgno); |
| 60529 | + *pRc = SQLITE_CORRUPT_BKPT; |
| 60930 | 60530 | return 0; |
| 60931 | 60531 | }else if( x<4 ){ |
| 60932 | 60532 | /* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total |
| 60933 | 60533 | ** number of bytes in fragments may not exceed 60. */ |
| 60934 | 60534 | if( aData[hdr+7]>57 ) return 0; |
| | @@ -60991,11 +60591,11 @@ |
| 60991 | 60591 | assert( top<=(int)pPage->pBt->usableSize ); /* Prevent by getAndInitPage() */ |
| 60992 | 60592 | if( gap>top ){ |
| 60993 | 60593 | if( top==0 && pPage->pBt->usableSize==65536 ){ |
| 60994 | 60594 | top = 65536; |
| 60995 | 60595 | }else{ |
| 60996 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60596 | + return SQLITE_CORRUPT_BKPT; |
| 60997 | 60597 | } |
| 60998 | 60598 | } |
| 60999 | 60599 | |
| 61000 | 60600 | /* If there is enough space between gap and top for one more cell pointer |
| 61001 | 60601 | ** array entry offset, and if the freelist is not empty, then search the |
| | @@ -61087,15 +60687,15 @@ |
| 61087 | 60687 | iFreeBlk = 0; /* Shortcut for the case when the freelist is empty */ |
| 61088 | 60688 | }else{ |
| 61089 | 60689 | while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){ |
| 61090 | 60690 | if( iFreeBlk<iPtr+4 ){ |
| 61091 | 60691 | if( iFreeBlk==0 ) break; |
| 61092 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60692 | + return SQLITE_CORRUPT_BKPT; |
| 61093 | 60693 | } |
| 61094 | 60694 | iPtr = iFreeBlk; |
| 61095 | 60695 | } |
| 61096 | | - if( iFreeBlk>iLast ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60696 | + if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT; |
| 61097 | 60697 | assert( iFreeBlk>iPtr || iFreeBlk==0 ); |
| 61098 | 60698 | |
| 61099 | 60699 | /* At this point: |
| 61100 | 60700 | ** iFreeBlk: First freeblock after iStart, or zero if none |
| 61101 | 60701 | ** iPtr: The address of a pointer to iFreeBlk |
| | @@ -61102,15 +60702,13 @@ |
| 61102 | 60702 | ** |
| 61103 | 60703 | ** Check to see if iFreeBlk should be coalesced onto the end of iStart. |
| 61104 | 60704 | */ |
| 61105 | 60705 | if( iFreeBlk && iEnd+3>=iFreeBlk ){ |
| 61106 | 60706 | nFrag = iFreeBlk - iEnd; |
| 61107 | | - if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60707 | + if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_BKPT; |
| 61108 | 60708 | iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]); |
| 61109 | | - if( iEnd > pPage->pBt->usableSize ){ |
| 61110 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61111 | | - } |
| 60709 | + if( iEnd > pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT; |
| 61112 | 60710 | iSize = iEnd - iStart; |
| 61113 | 60711 | iFreeBlk = get2byte(&data[iFreeBlk]); |
| 61114 | 60712 | } |
| 61115 | 60713 | |
| 61116 | 60714 | /* If iPtr is another freeblock (that is, if iPtr is not the freelist |
| | @@ -61118,24 +60716,24 @@ |
| 61118 | 60716 | ** coalesced onto the end of iPtr. |
| 61119 | 60717 | */ |
| 61120 | 60718 | if( iPtr>hdr+1 ){ |
| 61121 | 60719 | int iPtrEnd = iPtr + get2byte(&data[iPtr+2]); |
| 61122 | 60720 | if( iPtrEnd+3>=iStart ){ |
| 61123 | | - if( iPtrEnd>iStart ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60721 | + if( iPtrEnd>iStart ) return SQLITE_CORRUPT_BKPT; |
| 61124 | 60722 | nFrag += iStart - iPtrEnd; |
| 61125 | 60723 | iSize = iEnd - iPtr; |
| 61126 | 60724 | iStart = iPtr; |
| 61127 | 60725 | } |
| 61128 | 60726 | } |
| 61129 | | - if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60727 | + if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_BKPT; |
| 61130 | 60728 | data[hdr+7] -= nFrag; |
| 61131 | 60729 | } |
| 61132 | 60730 | if( iStart==get2byte(&data[hdr+5]) ){ |
| 61133 | 60731 | /* The new freeblock is at the beginning of the cell content area, |
| 61134 | 60732 | ** so just extend the cell content area rather than create another |
| 61135 | 60733 | ** freelist entry */ |
| 61136 | | - if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60734 | + if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_BKPT; |
| 61137 | 60735 | put2byte(&data[hdr+1], iFreeBlk); |
| 61138 | 60736 | put2byte(&data[hdr+5], iEnd); |
| 61139 | 60737 | }else{ |
| 61140 | 60738 | /* Insert the new freeblock into the freelist */ |
| 61141 | 60739 | put2byte(&data[iPtr], iStart); |
| | @@ -61199,11 +60797,11 @@ |
| 61199 | 60797 | pPage->maxLocal = pBt->maxLocal; |
| 61200 | 60798 | pPage->minLocal = pBt->minLocal; |
| 61201 | 60799 | }else{ |
| 61202 | 60800 | /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is |
| 61203 | 60801 | ** an error. */ |
| 61204 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 60802 | + return SQLITE_CORRUPT_BKPT; |
| 61205 | 60803 | } |
| 61206 | 60804 | pPage->max1bytePayload = pBt->max1bytePayload; |
| 61207 | 60805 | return SQLITE_OK; |
| 61208 | 60806 | } |
| 61209 | 60807 | |
| | @@ -61215,140 +60813,138 @@ |
| 61215 | 60813 | ** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not |
| 61216 | 60814 | ** guarantee that the page is well-formed. It only shows that |
| 61217 | 60815 | ** we failed to detect any corruption. |
| 61218 | 60816 | */ |
| 61219 | 60817 | static int btreeInitPage(MemPage *pPage){ |
| 61220 | | - int pc; /* Address of a freeblock within pPage->aData[] */ |
| 61221 | | - u8 hdr; /* Offset to beginning of page header */ |
| 61222 | | - u8 *data; /* Equal to pPage->aData */ |
| 61223 | | - BtShared *pBt; /* The main btree structure */ |
| 61224 | | - int usableSize; /* Amount of usable space on each page */ |
| 61225 | | - u16 cellOffset; /* Offset from start of page to first cell pointer */ |
| 61226 | | - int nFree; /* Number of unused bytes on the page */ |
| 61227 | | - int top; /* First byte of the cell content area */ |
| 61228 | | - int iCellFirst; /* First allowable cell or freeblock offset */ |
| 61229 | | - int iCellLast; /* Last possible cell or freeblock offset */ |
| 61230 | 60818 | |
| 61231 | 60819 | assert( pPage->pBt!=0 ); |
| 61232 | 60820 | assert( pPage->pBt->db!=0 ); |
| 61233 | 60821 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 61234 | 60822 | assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) ); |
| 61235 | 60823 | assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) ); |
| 61236 | 60824 | assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) ); |
| 61237 | | - assert( pPage->isInit==0 ); |
| 61238 | | - |
| 61239 | | - pBt = pPage->pBt; |
| 61240 | | - hdr = pPage->hdrOffset; |
| 61241 | | - data = pPage->aData; |
| 61242 | | - /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating |
| 61243 | | - ** the b-tree page type. */ |
| 61244 | | - if( decodeFlags(pPage, data[hdr]) ){ |
| 61245 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61246 | | - } |
| 61247 | | - assert( pBt->pageSize>=512 && pBt->pageSize<=65536 ); |
| 61248 | | - pPage->maskPage = (u16)(pBt->pageSize - 1); |
| 61249 | | - pPage->nOverflow = 0; |
| 61250 | | - usableSize = pBt->usableSize; |
| 61251 | | - pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize; |
| 61252 | | - pPage->aDataEnd = &data[usableSize]; |
| 61253 | | - pPage->aCellIdx = &data[cellOffset]; |
| 61254 | | - pPage->aDataOfst = &data[pPage->childPtrSize]; |
| 61255 | | - /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates |
| 61256 | | - ** the start of the cell content area. A zero value for this integer is |
| 61257 | | - ** interpreted as 65536. */ |
| 61258 | | - top = get2byteNotZero(&data[hdr+5]); |
| 61259 | | - /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the |
| 61260 | | - ** number of cells on the page. */ |
| 61261 | | - pPage->nCell = get2byte(&data[hdr+3]); |
| 61262 | | - if( pPage->nCell>MX_CELL(pBt) ){ |
| 61263 | | - /* To many cells for a single page. The page must be corrupt */ |
| 61264 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61265 | | - } |
| 61266 | | - testcase( pPage->nCell==MX_CELL(pBt) ); |
| 61267 | | - /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only |
| 61268 | | - ** possible for a root page of a table that contains no rows) then the |
| 61269 | | - ** offset to the cell content area will equal the page size minus the |
| 61270 | | - ** bytes of reserved space. */ |
| 61271 | | - assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB ); |
| 61272 | | - |
| 61273 | | - /* A malformed database page might cause us to read past the end |
| 61274 | | - ** of page when parsing a cell. |
| 61275 | | - ** |
| 61276 | | - ** The following block of code checks early to see if a cell extends |
| 61277 | | - ** past the end of a page boundary and causes SQLITE_CORRUPT to be |
| 61278 | | - ** returned if it does. |
| 61279 | | - */ |
| 61280 | | - iCellFirst = cellOffset + 2*pPage->nCell; |
| 61281 | | - iCellLast = usableSize - 4; |
| 61282 | | - if( pBt->db->flags & SQLITE_CellSizeCk ){ |
| 61283 | | - int i; /* Index into the cell pointer array */ |
| 61284 | | - int sz; /* Size of a cell */ |
| 61285 | | - |
| 61286 | | - if( !pPage->leaf ) iCellLast--; |
| 61287 | | - for(i=0; i<pPage->nCell; i++){ |
| 61288 | | - pc = get2byteAligned(&data[cellOffset+i*2]); |
| 61289 | | - testcase( pc==iCellFirst ); |
| 61290 | | - testcase( pc==iCellLast ); |
| 61291 | | - if( pc<iCellFirst || pc>iCellLast ){ |
| 61292 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61293 | | - } |
| 61294 | | - sz = pPage->xCellSize(pPage, &data[pc]); |
| 61295 | | - testcase( pc+sz==usableSize ); |
| 61296 | | - if( pc+sz>usableSize ){ |
| 61297 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61298 | | - } |
| 61299 | | - } |
| 61300 | | - if( !pPage->leaf ) iCellLast++; |
| 61301 | | - } |
| 61302 | | - |
| 61303 | | - /* Compute the total free space on the page |
| 61304 | | - ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the |
| 61305 | | - ** start of the first freeblock on the page, or is zero if there are no |
| 61306 | | - ** freeblocks. */ |
| 61307 | | - pc = get2byte(&data[hdr+1]); |
| 61308 | | - nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */ |
| 61309 | | - if( pc>0 ){ |
| 61310 | | - u32 next, size; |
| 61311 | | - if( pc<iCellFirst ){ |
| 61312 | | - /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will |
| 61313 | | - ** always be at least one cell before the first freeblock. |
| 61314 | | - */ |
| 61315 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61316 | | - } |
| 61317 | | - while( 1 ){ |
| 61318 | | - if( pc>iCellLast ){ |
| 61319 | | - /* Freeblock off the end of the page */ |
| 61320 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61321 | | - } |
| 61322 | | - next = get2byte(&data[pc]); |
| 61323 | | - size = get2byte(&data[pc+2]); |
| 61324 | | - nFree = nFree + size; |
| 61325 | | - if( next<=pc+size+3 ) break; |
| 61326 | | - pc = next; |
| 61327 | | - } |
| 61328 | | - if( next>0 ){ |
| 61329 | | - /* Freeblock not in ascending order */ |
| 61330 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61331 | | - } |
| 61332 | | - if( pc+size>(unsigned int)usableSize ){ |
| 61333 | | - /* Last freeblock extends past page end */ |
| 61334 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61335 | | - } |
| 61336 | | - } |
| 61337 | | - |
| 61338 | | - /* At this point, nFree contains the sum of the offset to the start |
| 61339 | | - ** of the cell-content area plus the number of free bytes within |
| 61340 | | - ** the cell-content area. If this is greater than the usable-size |
| 61341 | | - ** of the page, then the page must be corrupted. This check also |
| 61342 | | - ** serves to verify that the offset to the start of the cell-content |
| 61343 | | - ** area, according to the page header, lies within the page. |
| 61344 | | - */ |
| 61345 | | - if( nFree>usableSize ){ |
| 61346 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 61347 | | - } |
| 61348 | | - pPage->nFree = (u16)(nFree - iCellFirst); |
| 61349 | | - pPage->isInit = 1; |
| 60825 | + |
| 60826 | + if( !pPage->isInit ){ |
| 60827 | + int pc; /* Address of a freeblock within pPage->aData[] */ |
| 60828 | + u8 hdr; /* Offset to beginning of page header */ |
| 60829 | + u8 *data; /* Equal to pPage->aData */ |
| 60830 | + BtShared *pBt; /* The main btree structure */ |
| 60831 | + int usableSize; /* Amount of usable space on each page */ |
| 60832 | + u16 cellOffset; /* Offset from start of page to first cell pointer */ |
| 60833 | + int nFree; /* Number of unused bytes on the page */ |
| 60834 | + int top; /* First byte of the cell content area */ |
| 60835 | + int iCellFirst; /* First allowable cell or freeblock offset */ |
| 60836 | + int iCellLast; /* Last possible cell or freeblock offset */ |
| 60837 | + |
| 60838 | + pBt = pPage->pBt; |
| 60839 | + |
| 60840 | + hdr = pPage->hdrOffset; |
| 60841 | + data = pPage->aData; |
| 60842 | + /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating |
| 60843 | + ** the b-tree page type. */ |
| 60844 | + if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT; |
| 60845 | + assert( pBt->pageSize>=512 && pBt->pageSize<=65536 ); |
| 60846 | + pPage->maskPage = (u16)(pBt->pageSize - 1); |
| 60847 | + pPage->nOverflow = 0; |
| 60848 | + usableSize = pBt->usableSize; |
| 60849 | + pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize; |
| 60850 | + pPage->aDataEnd = &data[usableSize]; |
| 60851 | + pPage->aCellIdx = &data[cellOffset]; |
| 60852 | + pPage->aDataOfst = &data[pPage->childPtrSize]; |
| 60853 | + /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates |
| 60854 | + ** the start of the cell content area. A zero value for this integer is |
| 60855 | + ** interpreted as 65536. */ |
| 60856 | + top = get2byteNotZero(&data[hdr+5]); |
| 60857 | + /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the |
| 60858 | + ** number of cells on the page. */ |
| 60859 | + pPage->nCell = get2byte(&data[hdr+3]); |
| 60860 | + if( pPage->nCell>MX_CELL(pBt) ){ |
| 60861 | + /* To many cells for a single page. The page must be corrupt */ |
| 60862 | + return SQLITE_CORRUPT_BKPT; |
| 60863 | + } |
| 60864 | + testcase( pPage->nCell==MX_CELL(pBt) ); |
| 60865 | + /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only |
| 60866 | + ** possible for a root page of a table that contains no rows) then the |
| 60867 | + ** offset to the cell content area will equal the page size minus the |
| 60868 | + ** bytes of reserved space. */ |
| 60869 | + assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB ); |
| 60870 | + |
| 60871 | + /* A malformed database page might cause us to read past the end |
| 60872 | + ** of page when parsing a cell. |
| 60873 | + ** |
| 60874 | + ** The following block of code checks early to see if a cell extends |
| 60875 | + ** past the end of a page boundary and causes SQLITE_CORRUPT to be |
| 60876 | + ** returned if it does. |
| 60877 | + */ |
| 60878 | + iCellFirst = cellOffset + 2*pPage->nCell; |
| 60879 | + iCellLast = usableSize - 4; |
| 60880 | + if( pBt->db->flags & SQLITE_CellSizeCk ){ |
| 60881 | + int i; /* Index into the cell pointer array */ |
| 60882 | + int sz; /* Size of a cell */ |
| 60883 | + |
| 60884 | + if( !pPage->leaf ) iCellLast--; |
| 60885 | + for(i=0; i<pPage->nCell; i++){ |
| 60886 | + pc = get2byteAligned(&data[cellOffset+i*2]); |
| 60887 | + testcase( pc==iCellFirst ); |
| 60888 | + testcase( pc==iCellLast ); |
| 60889 | + if( pc<iCellFirst || pc>iCellLast ){ |
| 60890 | + return SQLITE_CORRUPT_BKPT; |
| 60891 | + } |
| 60892 | + sz = pPage->xCellSize(pPage, &data[pc]); |
| 60893 | + testcase( pc+sz==usableSize ); |
| 60894 | + if( pc+sz>usableSize ){ |
| 60895 | + return SQLITE_CORRUPT_BKPT; |
| 60896 | + } |
| 60897 | + } |
| 60898 | + if( !pPage->leaf ) iCellLast++; |
| 60899 | + } |
| 60900 | + |
| 60901 | + /* Compute the total free space on the page |
| 60902 | + ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the |
| 60903 | + ** start of the first freeblock on the page, or is zero if there are no |
| 60904 | + ** freeblocks. */ |
| 60905 | + pc = get2byte(&data[hdr+1]); |
| 60906 | + nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */ |
| 60907 | + if( pc>0 ){ |
| 60908 | + u32 next, size; |
| 60909 | + if( pc<iCellFirst ){ |
| 60910 | + /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will |
| 60911 | + ** always be at least one cell before the first freeblock. |
| 60912 | + */ |
| 60913 | + return SQLITE_CORRUPT_BKPT; |
| 60914 | + } |
| 60915 | + while( 1 ){ |
| 60916 | + if( pc>iCellLast ){ |
| 60917 | + return SQLITE_CORRUPT_BKPT; /* Freeblock off the end of the page */ |
| 60918 | + } |
| 60919 | + next = get2byte(&data[pc]); |
| 60920 | + size = get2byte(&data[pc+2]); |
| 60921 | + nFree = nFree + size; |
| 60922 | + if( next<=pc+size+3 ) break; |
| 60923 | + pc = next; |
| 60924 | + } |
| 60925 | + if( next>0 ){ |
| 60926 | + return SQLITE_CORRUPT_BKPT; /* Freeblock not in ascending order */ |
| 60927 | + } |
| 60928 | + if( pc+size>(unsigned int)usableSize ){ |
| 60929 | + return SQLITE_CORRUPT_BKPT; /* Last freeblock extends past page end */ |
| 60930 | + } |
| 60931 | + } |
| 60932 | + |
| 60933 | + /* At this point, nFree contains the sum of the offset to the start |
| 60934 | + ** of the cell-content area plus the number of free bytes within |
| 60935 | + ** the cell-content area. If this is greater than the usable-size |
| 60936 | + ** of the page, then the page must be corrupted. This check also |
| 60937 | + ** serves to verify that the offset to the start of the cell-content |
| 60938 | + ** area, according to the page header, lies within the page. |
| 60939 | + */ |
| 60940 | + if( nFree>usableSize ){ |
| 60941 | + return SQLITE_CORRUPT_BKPT; |
| 60942 | + } |
| 60943 | + pPage->nFree = (u16)(nFree - iCellFirst); |
| 60944 | + pPage->isInit = 1; |
| 60945 | + } |
| 61350 | 60946 | return SQLITE_OK; |
| 61351 | 60947 | } |
| 61352 | 60948 | |
| 61353 | 60949 | /* |
| 61354 | 60950 | ** Set up a raw page so that it looks like a database page holding |
| | @@ -61508,11 +61104,11 @@ |
| 61508 | 61104 | assert( (*ppPage)->aData==sqlite3PagerGetData(pDbPage) ); |
| 61509 | 61105 | |
| 61510 | 61106 | /* If obtaining a child page for a cursor, we must verify that the page is |
| 61511 | 61107 | ** compatible with the root page. */ |
| 61512 | 61108 | if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){ |
| 61513 | | - rc = SQLITE_CORRUPT_PGNO(pgno); |
| 61109 | + rc = SQLITE_CORRUPT_BKPT; |
| 61514 | 61110 | releasePage(*ppPage); |
| 61515 | 61111 | goto getAndInitPage_error; |
| 61516 | 61112 | } |
| 61517 | 61113 | return SQLITE_OK; |
| 61518 | 61114 | |
| | @@ -62453,11 +62049,11 @@ |
| 62453 | 62049 | freeTempSpace(pBt); |
| 62454 | 62050 | rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, |
| 62455 | 62051 | pageSize-usableSize); |
| 62456 | 62052 | return rc; |
| 62457 | 62053 | } |
| 62458 | | - if( (pBt->db->flags & SQLITE_WriteSchema)==0 && nPage>nPageFile ){ |
| 62054 | + if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){ |
| 62459 | 62055 | rc = SQLITE_CORRUPT_BKPT; |
| 62460 | 62056 | goto page1_init_failed; |
| 62461 | 62057 | } |
| 62462 | 62058 | /* EVIDENCE-OF: R-28312-64704 However, the usable size is not allowed to |
| 62463 | 62059 | ** be less than 480. In other words, if the page size is 512, then the |
| | @@ -62796,11 +62392,11 @@ |
| 62796 | 62392 | int rc; /* Return code */ |
| 62797 | 62393 | BtShared *pBt = pPage->pBt; |
| 62798 | 62394 | Pgno pgno = pPage->pgno; |
| 62799 | 62395 | |
| 62800 | 62396 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 62801 | | - rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage); |
| 62397 | + rc = btreeInitPage(pPage); |
| 62802 | 62398 | if( rc!=SQLITE_OK ) return rc; |
| 62803 | 62399 | nCell = pPage->nCell; |
| 62804 | 62400 | |
| 62805 | 62401 | for(i=0; i<nCell; i++){ |
| 62806 | 62402 | u8 *pCell = findCell(pPage, i); |
| | @@ -62839,19 +62435,19 @@ |
| 62839 | 62435 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 62840 | 62436 | assert( sqlite3PagerIswriteable(pPage->pDbPage) ); |
| 62841 | 62437 | if( eType==PTRMAP_OVERFLOW2 ){ |
| 62842 | 62438 | /* The pointer is always the first 4 bytes of the page in this case. */ |
| 62843 | 62439 | if( get4byte(pPage->aData)!=iFrom ){ |
| 62844 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 62440 | + return SQLITE_CORRUPT_BKPT; |
| 62845 | 62441 | } |
| 62846 | 62442 | put4byte(pPage->aData, iTo); |
| 62847 | 62443 | }else{ |
| 62848 | 62444 | int i; |
| 62849 | 62445 | int nCell; |
| 62850 | 62446 | int rc; |
| 62851 | 62447 | |
| 62852 | | - rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage); |
| 62448 | + rc = btreeInitPage(pPage); |
| 62853 | 62449 | if( rc ) return rc; |
| 62854 | 62450 | nCell = pPage->nCell; |
| 62855 | 62451 | |
| 62856 | 62452 | for(i=0; i<nCell; i++){ |
| 62857 | 62453 | u8 *pCell = findCell(pPage, i); |
| | @@ -62858,11 +62454,11 @@ |
| 62858 | 62454 | if( eType==PTRMAP_OVERFLOW1 ){ |
| 62859 | 62455 | CellInfo info; |
| 62860 | 62456 | pPage->xParseCell(pPage, pCell, &info); |
| 62861 | 62457 | if( info.nLocal<info.nPayload ){ |
| 62862 | 62458 | if( pCell+info.nSize > pPage->aData+pPage->pBt->usableSize ){ |
| 62863 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 62459 | + return SQLITE_CORRUPT_BKPT; |
| 62864 | 62460 | } |
| 62865 | 62461 | if( iFrom==get4byte(pCell+info.nSize-4) ){ |
| 62866 | 62462 | put4byte(pCell+info.nSize-4, iTo); |
| 62867 | 62463 | break; |
| 62868 | 62464 | } |
| | @@ -62876,11 +62472,11 @@ |
| 62876 | 62472 | } |
| 62877 | 62473 | |
| 62878 | 62474 | if( i==nCell ){ |
| 62879 | 62475 | if( eType!=PTRMAP_BTREE || |
| 62880 | 62476 | get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){ |
| 62881 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 62477 | + return SQLITE_CORRUPT_BKPT; |
| 62882 | 62478 | } |
| 62883 | 62479 | put4byte(&pPage->aData[pPage->hdrOffset+8], iTo); |
| 62884 | 62480 | } |
| 62885 | 62481 | } |
| 62886 | 62482 | return SQLITE_OK; |
| | @@ -63984,11 +63580,11 @@ |
| 63984 | 63580 | /* Trying to read or write past the end of the data is an error. The |
| 63985 | 63581 | ** conditional above is really: |
| 63986 | 63582 | ** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] |
| 63987 | 63583 | ** but is recast into its current form to avoid integer overflow problems |
| 63988 | 63584 | */ |
| 63989 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 63585 | + return SQLITE_CORRUPT_BKPT; |
| 63990 | 63586 | } |
| 63991 | 63587 | |
| 63992 | 63588 | /* Check if data must be read/written to/from the btree page itself. */ |
| 63993 | 63589 | if( offset<pCur->info.nLocal ){ |
| 63994 | 63590 | int a = amt; |
| | @@ -64131,12 +63727,11 @@ |
| 64131 | 63727 | iIdx++; |
| 64132 | 63728 | } |
| 64133 | 63729 | } |
| 64134 | 63730 | |
| 64135 | 63731 | if( rc==SQLITE_OK && amt>0 ){ |
| 64136 | | - /* Overflow chain ends prematurely */ |
| 64137 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 63732 | + return SQLITE_CORRUPT_BKPT; /* Overflow chain ends prematurely */ |
| 64138 | 63733 | } |
| 64139 | 63734 | return rc; |
| 64140 | 63735 | } |
| 64141 | 63736 | |
| 64142 | 63737 | /* |
| | @@ -64398,11 +63993,11 @@ |
| 64398 | 63993 | ** if pCur->iPage>=0). But this is not so if the database is corrupted |
| 64399 | 63994 | ** in such a way that page pRoot is linked into a second b-tree table |
| 64400 | 63995 | ** (or the freelist). */ |
| 64401 | 63996 | assert( pRoot->intKey==1 || pRoot->intKey==0 ); |
| 64402 | 63997 | if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){ |
| 64403 | | - return SQLITE_CORRUPT_PGNO(pCur->apPage[pCur->iPage]->pgno); |
| 63998 | + return SQLITE_CORRUPT_BKPT; |
| 64404 | 63999 | } |
| 64405 | 64000 | |
| 64406 | 64001 | skip_init: |
| 64407 | 64002 | pCur->ix = 0; |
| 64408 | 64003 | pCur->info.nSize = 0; |
| | @@ -64603,23 +64198,20 @@ |
| 64603 | 64198 | return SQLITE_OK; |
| 64604 | 64199 | } |
| 64605 | 64200 | /* If the requested key is one more than the previous key, then |
| 64606 | 64201 | ** try to get there using sqlite3BtreeNext() rather than a full |
| 64607 | 64202 | ** binary search. This is an optimization only. The correct answer |
| 64608 | | - ** is still obtained without this case, only a little more slowely */ |
| 64203 | + ** is still obtained without this ase, only a little more slowely */ |
| 64609 | 64204 | if( pCur->info.nKey+1==intKey && !pCur->skipNext ){ |
| 64610 | 64205 | *pRes = 0; |
| 64611 | | - rc = sqlite3BtreeNext(pCur, 0); |
| 64612 | | - if( rc==SQLITE_OK ){ |
| 64206 | + rc = sqlite3BtreeNext(pCur, pRes); |
| 64207 | + if( rc ) return rc; |
| 64208 | + if( *pRes==0 ){ |
| 64613 | 64209 | getCellInfo(pCur); |
| 64614 | 64210 | if( pCur->info.nKey==intKey ){ |
| 64615 | 64211 | return SQLITE_OK; |
| 64616 | 64212 | } |
| 64617 | | - }else if( rc==SQLITE_DONE ){ |
| 64618 | | - rc = SQLITE_OK; |
| 64619 | | - }else{ |
| 64620 | | - return rc; |
| 64621 | 64213 | } |
| 64622 | 64214 | } |
| 64623 | 64215 | } |
| 64624 | 64216 | } |
| 64625 | 64217 | |
| | @@ -64671,13 +64263,11 @@ |
| 64671 | 64263 | for(;;){ |
| 64672 | 64264 | i64 nCellKey; |
| 64673 | 64265 | pCell = findCellPastPtr(pPage, idx); |
| 64674 | 64266 | if( pPage->intKeyLeaf ){ |
| 64675 | 64267 | while( 0x80 <= *(pCell++) ){ |
| 64676 | | - if( pCell>=pPage->aDataEnd ){ |
| 64677 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 64678 | | - } |
| 64268 | + if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT; |
| 64679 | 64269 | } |
| 64680 | 64270 | } |
| 64681 | 64271 | getVarint(pCell, (u64*)&nCellKey); |
| 64682 | 64272 | if( nCellKey<intKey ){ |
| 64683 | 64273 | lwr = idx+1; |
| | @@ -64746,11 +64336,11 @@ |
| 64746 | 64336 | testcase( nCell<0 ); /* True if key size is 2^32 or more */ |
| 64747 | 64337 | testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */ |
| 64748 | 64338 | testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */ |
| 64749 | 64339 | testcase( nCell==2 ); /* Minimum legal index key size */ |
| 64750 | 64340 | if( nCell<2 ){ |
| 64751 | | - rc = SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 64341 | + rc = SQLITE_CORRUPT_BKPT; |
| 64752 | 64342 | goto moveto_finish; |
| 64753 | 64343 | } |
| 64754 | 64344 | pCellKey = sqlite3Malloc( nCell+18 ); |
| 64755 | 64345 | if( pCellKey==0 ){ |
| 64756 | 64346 | rc = SQLITE_NOMEM_BKPT; |
| | @@ -64851,44 +64441,47 @@ |
| 64851 | 64441 | } |
| 64852 | 64442 | return n; |
| 64853 | 64443 | } |
| 64854 | 64444 | |
| 64855 | 64445 | /* |
| 64856 | | -** Advance the cursor to the next entry in the database. |
| 64857 | | -** Return value: |
| 64858 | | -** |
| 64859 | | -** SQLITE_OK success |
| 64860 | | -** SQLITE_DONE cursor is already pointing at the last element |
| 64861 | | -** otherwise some kind of error occurred |
| 64446 | +** Advance the cursor to the next entry in the database. If |
| 64447 | +** successful then set *pRes=0. If the cursor |
| 64448 | +** was already pointing to the last entry in the database before |
| 64449 | +** this routine was called, then set *pRes=1. |
| 64862 | 64450 | ** |
| 64863 | 64451 | ** The main entry point is sqlite3BtreeNext(). That routine is optimized |
| 64864 | 64452 | ** for the common case of merely incrementing the cell counter BtCursor.aiIdx |
| 64865 | 64453 | ** to the next cell on the current page. The (slower) btreeNext() helper |
| 64866 | 64454 | ** routine is called when it is necessary to move to a different page or |
| 64867 | 64455 | ** to restore the cursor. |
| 64868 | 64456 | ** |
| 64869 | | -** If bit 0x01 of the flags argument is 1, then the cursor corresponds to |
| 64870 | | -** an SQL index and this routine could have been skipped if the SQL index |
| 64871 | | -** had been a unique index. The flags argument is a hint to the implement. |
| 64872 | | -** SQLite btree implementation does not use this hint, but COMDB2 does. |
| 64457 | +** The calling function will set *pRes to 0 or 1. The initial *pRes value |
| 64458 | +** will be 1 if the cursor being stepped corresponds to an SQL index and |
| 64459 | +** if this routine could have been skipped if that SQL index had been |
| 64460 | +** a unique index. Otherwise the caller will have set *pRes to zero. |
| 64461 | +** Zero is the common case. The btree implementation is free to use the |
| 64462 | +** initial *pRes value as a hint to improve performance, but the current |
| 64463 | +** SQLite btree implementation does not. (Note that the comdb2 btree |
| 64464 | +** implementation does use this hint, however.) |
| 64873 | 64465 | */ |
| 64874 | | -static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int flags){ |
| 64466 | +static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){ |
| 64875 | 64467 | int rc; |
| 64876 | 64468 | int idx; |
| 64877 | 64469 | MemPage *pPage; |
| 64878 | 64470 | |
| 64879 | 64471 | assert( cursorOwnsBtShared(pCur) ); |
| 64880 | 64472 | assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); |
| 64881 | | - assert( flags==0 ); |
| 64473 | + assert( *pRes==0 ); |
| 64882 | 64474 | if( pCur->eState!=CURSOR_VALID ){ |
| 64883 | 64475 | assert( (pCur->curFlags & BTCF_ValidOvfl)==0 ); |
| 64884 | 64476 | rc = restoreCursorPosition(pCur); |
| 64885 | 64477 | if( rc!=SQLITE_OK ){ |
| 64886 | 64478 | return rc; |
| 64887 | 64479 | } |
| 64888 | 64480 | if( CURSOR_INVALID==pCur->eState ){ |
| 64889 | | - return SQLITE_DONE; |
| 64481 | + *pRes = 1; |
| 64482 | + return SQLITE_OK; |
| 64890 | 64483 | } |
| 64891 | 64484 | if( pCur->skipNext ){ |
| 64892 | 64485 | assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT ); |
| 64893 | 64486 | pCur->eState = CURSOR_VALID; |
| 64894 | 64487 | if( pCur->skipNext>0 ){ |
| | @@ -64916,18 +64509,19 @@ |
| 64916 | 64509 | if( rc ) return rc; |
| 64917 | 64510 | return moveToLeftmost(pCur); |
| 64918 | 64511 | } |
| 64919 | 64512 | do{ |
| 64920 | 64513 | if( pCur->iPage==0 ){ |
| 64514 | + *pRes = 1; |
| 64921 | 64515 | pCur->eState = CURSOR_INVALID; |
| 64922 | | - return SQLITE_DONE; |
| 64516 | + return SQLITE_OK; |
| 64923 | 64517 | } |
| 64924 | 64518 | moveToParent(pCur); |
| 64925 | 64519 | pPage = pCur->apPage[pCur->iPage]; |
| 64926 | 64520 | }while( pCur->ix>=pPage->nCell ); |
| 64927 | 64521 | if( pPage->intKey ){ |
| 64928 | | - return sqlite3BtreeNext(pCur, flags); |
| 64522 | + return sqlite3BtreeNext(pCur, pRes); |
| 64929 | 64523 | }else{ |
| 64930 | 64524 | return SQLITE_OK; |
| 64931 | 64525 | } |
| 64932 | 64526 | } |
| 64933 | 64527 | if( pPage->leaf ){ |
| | @@ -64934,66 +64528,71 @@ |
| 64934 | 64528 | return SQLITE_OK; |
| 64935 | 64529 | }else{ |
| 64936 | 64530 | return moveToLeftmost(pCur); |
| 64937 | 64531 | } |
| 64938 | 64532 | } |
| 64939 | | -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){ |
| 64533 | +SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){ |
| 64940 | 64534 | MemPage *pPage; |
| 64941 | 64535 | assert( cursorOwnsBtShared(pCur) ); |
| 64942 | | - assert( flags==0 || flags==1 ); |
| 64536 | + assert( pRes!=0 ); |
| 64537 | + assert( *pRes==0 || *pRes==1 ); |
| 64943 | 64538 | assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); |
| 64944 | 64539 | pCur->info.nSize = 0; |
| 64945 | 64540 | pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl); |
| 64946 | | - if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, 0); |
| 64541 | + *pRes = 0; |
| 64542 | + if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, pRes); |
| 64947 | 64543 | pPage = pCur->apPage[pCur->iPage]; |
| 64948 | 64544 | if( (++pCur->ix)>=pPage->nCell ){ |
| 64949 | 64545 | pCur->ix--; |
| 64950 | | - return btreeNext(pCur, 0); |
| 64546 | + return btreeNext(pCur, pRes); |
| 64951 | 64547 | } |
| 64952 | 64548 | if( pPage->leaf ){ |
| 64953 | 64549 | return SQLITE_OK; |
| 64954 | 64550 | }else{ |
| 64955 | 64551 | return moveToLeftmost(pCur); |
| 64956 | 64552 | } |
| 64957 | 64553 | } |
| 64958 | 64554 | |
| 64959 | 64555 | /* |
| 64960 | | -** Step the cursor to the back to the previous entry in the database. |
| 64961 | | -** Return values: |
| 64962 | | -** |
| 64963 | | -** SQLITE_OK success |
| 64964 | | -** SQLITE_DONE the cursor is already on the first element of the table |
| 64965 | | -** otherwise some kind of error occurred |
| 64556 | +** Step the cursor to the back to the previous entry in the database. If |
| 64557 | +** successful then set *pRes=0. If the cursor |
| 64558 | +** was already pointing to the first entry in the database before |
| 64559 | +** this routine was called, then set *pRes=1. |
| 64966 | 64560 | ** |
| 64967 | 64561 | ** The main entry point is sqlite3BtreePrevious(). That routine is optimized |
| 64968 | 64562 | ** for the common case of merely decrementing the cell counter BtCursor.aiIdx |
| 64969 | 64563 | ** to the previous cell on the current page. The (slower) btreePrevious() |
| 64970 | 64564 | ** helper routine is called when it is necessary to move to a different page |
| 64971 | 64565 | ** or to restore the cursor. |
| 64972 | 64566 | ** |
| 64973 | | -** |
| 64974 | | -** If bit 0x01 of the flags argument is 1, then the cursor corresponds to |
| 64975 | | -** an SQL index and this routine could have been skipped if the SQL index |
| 64976 | | -** had been a unique index. The flags argument is a hint to the implement. |
| 64977 | | -** SQLite btree implementation does not use this hint, but COMDB2 does. |
| 64567 | +** The calling function will set *pRes to 0 or 1. The initial *pRes value |
| 64568 | +** will be 1 if the cursor being stepped corresponds to an SQL index and |
| 64569 | +** if this routine could have been skipped if that SQL index had been |
| 64570 | +** a unique index. Otherwise the caller will have set *pRes to zero. |
| 64571 | +** Zero is the common case. The btree implementation is free to use the |
| 64572 | +** initial *pRes value as a hint to improve performance, but the current |
| 64573 | +** SQLite btree implementation does not. (Note that the comdb2 btree |
| 64574 | +** implementation does use this hint, however.) |
| 64978 | 64575 | */ |
| 64979 | | -static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int flags){ |
| 64576 | +static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){ |
| 64980 | 64577 | int rc; |
| 64981 | 64578 | MemPage *pPage; |
| 64982 | 64579 | |
| 64983 | 64580 | assert( cursorOwnsBtShared(pCur) ); |
| 64984 | | - assert( flags==0 ); |
| 64581 | + assert( pRes!=0 ); |
| 64582 | + assert( *pRes==0 ); |
| 64985 | 64583 | assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); |
| 64986 | 64584 | assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 ); |
| 64987 | 64585 | assert( pCur->info.nSize==0 ); |
| 64988 | 64586 | if( pCur->eState!=CURSOR_VALID ){ |
| 64989 | 64587 | rc = restoreCursorPosition(pCur); |
| 64990 | 64588 | if( rc!=SQLITE_OK ){ |
| 64991 | 64589 | return rc; |
| 64992 | 64590 | } |
| 64993 | 64591 | if( CURSOR_INVALID==pCur->eState ){ |
| 64994 | | - return SQLITE_DONE; |
| 64592 | + *pRes = 1; |
| 64593 | + return SQLITE_OK; |
| 64995 | 64594 | } |
| 64996 | 64595 | if( pCur->skipNext ){ |
| 64997 | 64596 | assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT ); |
| 64998 | 64597 | pCur->eState = CURSOR_VALID; |
| 64999 | 64598 | if( pCur->skipNext<0 ){ |
| | @@ -65013,38 +64612,41 @@ |
| 65013 | 64612 | rc = moveToRightmost(pCur); |
| 65014 | 64613 | }else{ |
| 65015 | 64614 | while( pCur->ix==0 ){ |
| 65016 | 64615 | if( pCur->iPage==0 ){ |
| 65017 | 64616 | pCur->eState = CURSOR_INVALID; |
| 65018 | | - return SQLITE_DONE; |
| 64617 | + *pRes = 1; |
| 64618 | + return SQLITE_OK; |
| 65019 | 64619 | } |
| 65020 | 64620 | moveToParent(pCur); |
| 65021 | 64621 | } |
| 65022 | 64622 | assert( pCur->info.nSize==0 ); |
| 65023 | 64623 | assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 ); |
| 65024 | 64624 | |
| 65025 | 64625 | pCur->ix--; |
| 65026 | 64626 | pPage = pCur->apPage[pCur->iPage]; |
| 65027 | 64627 | if( pPage->intKey && !pPage->leaf ){ |
| 65028 | | - rc = sqlite3BtreePrevious(pCur, flags); |
| 64628 | + rc = sqlite3BtreePrevious(pCur, pRes); |
| 65029 | 64629 | }else{ |
| 65030 | 64630 | rc = SQLITE_OK; |
| 65031 | 64631 | } |
| 65032 | 64632 | } |
| 65033 | 64633 | return rc; |
| 65034 | 64634 | } |
| 65035 | | -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){ |
| 64635 | +SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){ |
| 65036 | 64636 | assert( cursorOwnsBtShared(pCur) ); |
| 65037 | | - assert( flags==0 || flags==1 ); |
| 64637 | + assert( pRes!=0 ); |
| 64638 | + assert( *pRes==0 || *pRes==1 ); |
| 65038 | 64639 | assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); |
| 64640 | + *pRes = 0; |
| 65039 | 64641 | pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey); |
| 65040 | 64642 | pCur->info.nSize = 0; |
| 65041 | 64643 | if( pCur->eState!=CURSOR_VALID |
| 65042 | 64644 | || pCur->ix==0 |
| 65043 | 64645 | || pCur->apPage[pCur->iPage]->leaf==0 |
| 65044 | 64646 | ){ |
| 65045 | | - return btreePrevious(pCur, 0); |
| 64647 | + return btreePrevious(pCur, pRes); |
| 65046 | 64648 | } |
| 65047 | 64649 | pCur->ix--; |
| 65048 | 64650 | return SQLITE_OK; |
| 65049 | 64651 | } |
| 65050 | 64652 | |
| | @@ -65148,11 +64750,11 @@ |
| 65148 | 64750 | ** the freelist is empty. */ |
| 65149 | 64751 | iTrunk = get4byte(&pPage1->aData[32]); |
| 65150 | 64752 | } |
| 65151 | 64753 | testcase( iTrunk==mxPage ); |
| 65152 | 64754 | if( iTrunk>mxPage || nSearch++ > n ){ |
| 65153 | | - rc = SQLITE_CORRUPT_PGNO(pPrevTrunk ? pPrevTrunk->pgno : 1); |
| 64755 | + rc = SQLITE_CORRUPT_BKPT; |
| 65154 | 64756 | }else{ |
| 65155 | 64757 | rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0); |
| 65156 | 64758 | } |
| 65157 | 64759 | if( rc ){ |
| 65158 | 64760 | pTrunk = 0; |
| | @@ -65177,11 +64779,11 @@ |
| 65177 | 64779 | *ppPage = pTrunk; |
| 65178 | 64780 | pTrunk = 0; |
| 65179 | 64781 | TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); |
| 65180 | 64782 | }else if( k>(u32)(pBt->usableSize/4 - 2) ){ |
| 65181 | 64783 | /* Value of k is out of range. Database corruption */ |
| 65182 | | - rc = SQLITE_CORRUPT_PGNO(iTrunk); |
| 64784 | + rc = SQLITE_CORRUPT_BKPT; |
| 65183 | 64785 | goto end_allocate_page; |
| 65184 | 64786 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| 65185 | 64787 | }else if( searchList |
| 65186 | 64788 | && (nearby==iTrunk || (iTrunk<nearby && eMode==BTALLOC_LE)) |
| 65187 | 64789 | ){ |
| | @@ -65211,11 +64813,11 @@ |
| 65211 | 64813 | ** page in this case. |
| 65212 | 64814 | */ |
| 65213 | 64815 | MemPage *pNewTrunk; |
| 65214 | 64816 | Pgno iNewTrunk = get4byte(&pTrunk->aData[8]); |
| 65215 | 64817 | if( iNewTrunk>mxPage ){ |
| 65216 | | - rc = SQLITE_CORRUPT_PGNO(iTrunk); |
| 64818 | + rc = SQLITE_CORRUPT_BKPT; |
| 65217 | 64819 | goto end_allocate_page; |
| 65218 | 64820 | } |
| 65219 | 64821 | testcase( iNewTrunk==mxPage ); |
| 65220 | 64822 | rc = btreeGetUnusedPage(pBt, iNewTrunk, &pNewTrunk, 0); |
| 65221 | 64823 | if( rc!=SQLITE_OK ){ |
| | @@ -65276,11 +64878,11 @@ |
| 65276 | 64878 | } |
| 65277 | 64879 | |
| 65278 | 64880 | iPage = get4byte(&aData[8+closest*4]); |
| 65279 | 64881 | testcase( iPage==mxPage ); |
| 65280 | 64882 | if( iPage>mxPage ){ |
| 65281 | | - rc = SQLITE_CORRUPT_PGNO(iTrunk); |
| 64883 | + rc = SQLITE_CORRUPT_BKPT; |
| 65282 | 64884 | goto end_allocate_page; |
| 65283 | 64885 | } |
| 65284 | 64886 | testcase( iPage==mxPage ); |
| 65285 | 64887 | if( !searchList |
| 65286 | 64888 | || (iPage==nearby || (iPage<nearby && eMode==BTALLOC_LE)) |
| | @@ -65546,12 +65148,11 @@ |
| 65546 | 65148 | pPage->xParseCell(pPage, pCell, pInfo); |
| 65547 | 65149 | if( pInfo->nLocal==pInfo->nPayload ){ |
| 65548 | 65150 | return SQLITE_OK; /* No overflow pages. Return without doing anything */ |
| 65549 | 65151 | } |
| 65550 | 65152 | if( pCell+pInfo->nSize-1 > pPage->aData+pPage->maskPage ){ |
| 65551 | | - /* Cell extends past end of page */ |
| 65552 | | - return SQLITE_CORRUPT_PGNO(pPage->pgno); |
| 65153 | + return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */ |
| 65553 | 65154 | } |
| 65554 | 65155 | ovflPgno = get4byte(pCell + pInfo->nSize - 4); |
| 65555 | 65156 | assert( pBt->usableSize > 4 ); |
| 65556 | 65157 | ovflPageSize = pBt->usableSize - 4; |
| 65557 | 65158 | nOvfl = (pInfo->nPayload - pInfo->nLocal + ovflPageSize - 1)/ovflPageSize; |
| | @@ -67762,12 +67363,12 @@ |
| 67762 | 67363 | ** from the internal node. The 'previous' entry is used for this instead |
| 67763 | 67364 | ** of the 'next' entry, as the previous entry is always a part of the |
| 67764 | 67365 | ** sub-tree headed by the child page of the cell being deleted. This makes |
| 67765 | 67366 | ** balancing the tree following the delete operation easier. */ |
| 67766 | 67367 | if( !pPage->leaf ){ |
| 67767 | | - rc = sqlite3BtreePrevious(pCur, 0); |
| 67768 | | - assert( rc!=SQLITE_DONE ); |
| 67368 | + int notUsed = 0; |
| 67369 | + rc = sqlite3BtreePrevious(pCur, ¬Used); |
| 67769 | 67370 | if( rc ) return rc; |
| 67770 | 67371 | } |
| 67771 | 67372 | |
| 67772 | 67373 | /* Save the positions of any other cursors open on this table before |
| 67773 | 67374 | ** making any modifications. */ |
| | @@ -71423,11 +71024,11 @@ |
| 71423 | 71024 | if( enc!=SQLITE_UTF8 ){ |
| 71424 | 71025 | rc = sqlite3VdbeChangeEncoding(pVal, enc); |
| 71425 | 71026 | } |
| 71426 | 71027 | }else if( op==TK_UMINUS ) { |
| 71427 | 71028 | /* This branch happens for multiple negative signs. Ex: -(-5) */ |
| 71428 | | - if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx) |
| 71029 | + if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) |
| 71429 | 71030 | && pVal!=0 |
| 71430 | 71031 | ){ |
| 71431 | 71032 | sqlite3VdbeMemNumerify(pVal); |
| 71432 | 71033 | if( pVal->flags & MEM_Real ){ |
| 71433 | 71034 | pVal->u.r = -pVal->u.r; |
| | @@ -71580,25 +71181,28 @@ |
| 71580 | 71181 | sqlite3 *db = pParse->db; |
| 71581 | 71182 | |
| 71582 | 71183 | /* Skip over any TK_COLLATE nodes */ |
| 71583 | 71184 | pExpr = sqlite3ExprSkipCollate(pExpr); |
| 71584 | 71185 | |
| 71585 | | - assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE ); |
| 71586 | 71186 | if( !pExpr ){ |
| 71587 | 71187 | pVal = valueNew(db, pAlloc); |
| 71588 | 71188 | if( pVal ){ |
| 71589 | 71189 | sqlite3VdbeMemSetNull((Mem*)pVal); |
| 71590 | 71190 | } |
| 71591 | | - }else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ |
| 71191 | + }else if( pExpr->op==TK_VARIABLE |
| 71192 | + || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) |
| 71193 | + ){ |
| 71592 | 71194 | Vdbe *v; |
| 71593 | 71195 | int iBindVar = pExpr->iColumn; |
| 71594 | 71196 | sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); |
| 71595 | 71197 | if( (v = pParse->pReprepare)!=0 ){ |
| 71596 | 71198 | pVal = valueNew(db, pAlloc); |
| 71597 | 71199 | if( pVal ){ |
| 71598 | 71200 | rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); |
| 71599 | | - sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 71201 | + if( rc==SQLITE_OK ){ |
| 71202 | + sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); |
| 71203 | + } |
| 71600 | 71204 | pVal->db = pParse->db; |
| 71601 | 71205 | } |
| 71602 | 71206 | } |
| 71603 | 71207 | }else{ |
| 71604 | 71208 | rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, pAlloc); |
| | @@ -71868,18 +71472,20 @@ |
| 71868 | 71472 | } |
| 71869 | 71473 | |
| 71870 | 71474 | /* |
| 71871 | 71475 | ** Remember the SQL string for a prepared statement. |
| 71872 | 71476 | */ |
| 71873 | | -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){ |
| 71477 | +SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){ |
| 71478 | + assert( isPrepareV2==1 || isPrepareV2==0 ); |
| 71874 | 71479 | if( p==0 ) return; |
| 71875 | | - p->prepFlags = prepFlags; |
| 71876 | | - if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){ |
| 71877 | | - p->expmask = 0; |
| 71878 | | - } |
| 71480 | + if( !isPrepareV2 ) p->expmask = 0; |
| 71481 | +#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG) |
| 71482 | + if( !isPrepareV2 ) return; |
| 71483 | +#endif |
| 71879 | 71484 | assert( p->zSql==0 ); |
| 71880 | 71485 | p->zSql = sqlite3DbStrNDup(p->db, z, n); |
| 71486 | + p->isPrepareV2 = (u8)isPrepareV2; |
| 71881 | 71487 | } |
| 71882 | 71488 | |
| 71883 | 71489 | /* |
| 71884 | 71490 | ** Swap all content between two VDBE structures. |
| 71885 | 71491 | */ |
| | @@ -71897,14 +71503,12 @@ |
| 71897 | 71503 | pA->pPrev = pB->pPrev; |
| 71898 | 71504 | pB->pPrev = pTmp; |
| 71899 | 71505 | zTmp = pA->zSql; |
| 71900 | 71506 | pA->zSql = pB->zSql; |
| 71901 | 71507 | pB->zSql = zTmp; |
| 71508 | + pB->isPrepareV2 = pA->isPrepareV2; |
| 71902 | 71509 | pB->expmask = pA->expmask; |
| 71903 | | - pB->prepFlags = pA->prepFlags; |
| 71904 | | - memcpy(pB->aCounter, pA->aCounter, sizeof(pB->aCounter)); |
| 71905 | | - pB->aCounter[SQLITE_STMTSTATUS_REPREPARE]++; |
| 71906 | 71510 | } |
| 71907 | 71511 | |
| 71908 | 71512 | /* |
| 71909 | 71513 | ** Resize the Vdbe.aOp array so that it is at least nOp elements larger |
| 71910 | 71514 | ** than its current size. nOp is guaranteed to be less than or equal |
| | @@ -73974,22 +73578,21 @@ |
| 73974 | 73578 | ** statement. This is now set at compile time, rather than during |
| 73975 | 73579 | ** execution of the vdbe program so that sqlite3_column_count() can |
| 73976 | 73580 | ** be called on an SQL statement before sqlite3_step(). |
| 73977 | 73581 | */ |
| 73978 | 73582 | SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ |
| 73583 | + Mem *pColName; |
| 73979 | 73584 | int n; |
| 73980 | 73585 | sqlite3 *db = p->db; |
| 73981 | 73586 | |
| 73982 | | - if( p->nResColumn ){ |
| 73983 | | - releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); |
| 73984 | | - sqlite3DbFree(db, p->aColName); |
| 73985 | | - } |
| 73587 | + releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); |
| 73588 | + sqlite3DbFree(db, p->aColName); |
| 73986 | 73589 | n = nResColumn*COLNAME_N; |
| 73987 | 73590 | p->nResColumn = (u16)nResColumn; |
| 73988 | | - p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n ); |
| 73591 | + p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n ); |
| 73989 | 73592 | if( p->aColName==0 ) return; |
| 73990 | | - initMemArray(p->aColName, n, db, MEM_Null); |
| 73593 | + initMemArray(p->aColName, n, p->db, MEM_Null); |
| 73991 | 73594 | } |
| 73992 | 73595 | |
| 73993 | 73596 | /* |
| 73994 | 73597 | ** Set the name of the idx'th column to be returned by the SQL statement. |
| 73995 | 73598 | ** zName must be a pointer to a nul terminated string. |
| | @@ -74635,14 +74238,14 @@ |
| 74635 | 74238 | sqlite3BeginBenignMalloc(); |
| 74636 | 74239 | if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); |
| 74637 | 74240 | sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); |
| 74638 | 74241 | sqlite3EndBenignMalloc(); |
| 74639 | 74242 | db->bBenignMalloc--; |
| 74640 | | - }else if( db->pErr ){ |
| 74641 | | - sqlite3ValueSetNull(db->pErr); |
| 74243 | + db->errCode = rc; |
| 74244 | + }else{ |
| 74245 | + sqlite3Error(db, rc); |
| 74642 | 74246 | } |
| 74643 | | - db->errCode = rc; |
| 74644 | 74247 | return rc; |
| 74645 | 74248 | } |
| 74646 | 74249 | |
| 74647 | 74250 | #ifdef SQLITE_ENABLE_SQLLOG |
| 74648 | 74251 | /* |
| | @@ -75546,24 +75149,23 @@ |
| 75546 | 75149 | ** comparison function directly */ |
| 75547 | 75150 | return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z); |
| 75548 | 75151 | }else{ |
| 75549 | 75152 | int rc; |
| 75550 | 75153 | const void *v1, *v2; |
| 75154 | + int n1, n2; |
| 75551 | 75155 | Mem c1; |
| 75552 | 75156 | Mem c2; |
| 75553 | 75157 | sqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null); |
| 75554 | 75158 | sqlite3VdbeMemInit(&c2, pMem1->db, MEM_Null); |
| 75555 | 75159 | sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem); |
| 75556 | 75160 | sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem); |
| 75557 | 75161 | v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc); |
| 75162 | + n1 = v1==0 ? 0 : c1.n; |
| 75558 | 75163 | v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc); |
| 75559 | | - if( (v1==0 || v2==0) ){ |
| 75560 | | - if( prcErr ) *prcErr = SQLITE_NOMEM_BKPT; |
| 75561 | | - rc = 0; |
| 75562 | | - }else{ |
| 75563 | | - rc = pColl->xCmp(pColl->pUser, c1.n, v1, c2.n, v2); |
| 75564 | | - } |
| 75164 | + n2 = v2==0 ? 0 : c2.n; |
| 75165 | + rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2); |
| 75166 | + if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM_BKPT; |
| 75565 | 75167 | sqlite3VdbeMemRelease(&c1); |
| 75566 | 75168 | sqlite3VdbeMemRelease(&c2); |
| 75567 | 75169 | return rc; |
| 75568 | 75170 | } |
| 75569 | 75171 | } |
| | @@ -76344,17 +75946,10 @@ |
| 76344 | 75946 | */ |
| 76345 | 75947 | SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){ |
| 76346 | 75948 | return v->db; |
| 76347 | 75949 | } |
| 76348 | 75950 | |
| 76349 | | -/* |
| 76350 | | -** Return the SQLITE_PREPARE flags for a Vdbe. |
| 76351 | | -*/ |
| 76352 | | -SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe *v){ |
| 76353 | | - return v->prepFlags; |
| 76354 | | -} |
| 76355 | | - |
| 76356 | 75951 | /* |
| 76357 | 75952 | ** Return a pointer to an sqlite3_value structure containing the value bound |
| 76358 | 75953 | ** parameter iVar of VM v. Except, if the value is an SQL NULL, return |
| 76359 | 75954 | ** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* |
| 76360 | 75955 | ** constants) to the value before returning it. |
| | @@ -76363,11 +75958,10 @@ |
| 76363 | 75958 | */ |
| 76364 | 75959 | SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ |
| 76365 | 75960 | assert( iVar>0 ); |
| 76366 | 75961 | if( v ){ |
| 76367 | 75962 | Mem *pMem = &v->aVar[iVar-1]; |
| 76368 | | - assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); |
| 76369 | 75963 | if( 0==(pMem->flags & MEM_Null) ){ |
| 76370 | 75964 | sqlite3_value *pRet = sqlite3ValueNew(v->db); |
| 76371 | 75965 | if( pRet ){ |
| 76372 | 75966 | sqlite3VdbeMemCopy((Mem *)pRet, pMem); |
| 76373 | 75967 | sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); |
| | @@ -76383,11 +75977,10 @@ |
| 76383 | 75977 | ** to sqlite3_reoptimize() that re-preparing the statement may result |
| 76384 | 75978 | ** in a better query plan. |
| 76385 | 75979 | */ |
| 76386 | 75980 | SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ |
| 76387 | 75981 | assert( iVar>0 ); |
| 76388 | | - assert( (v->db->flags & SQLITE_EnableQPSG)==0 ); |
| 76389 | 75982 | if( iVar>=32 ){ |
| 76390 | 75983 | v->expmask |= 0x80000000; |
| 76391 | 75984 | }else{ |
| 76392 | 75985 | v->expmask |= ((u32)1 << (iVar-1)); |
| 76393 | 75986 | } |
| | @@ -76655,11 +76248,11 @@ |
| 76655 | 76248 | sqlite3_mutex_enter(mutex); |
| 76656 | 76249 | for(i=0; i<p->nVar; i++){ |
| 76657 | 76250 | sqlite3VdbeMemRelease(&p->aVar[i]); |
| 76658 | 76251 | p->aVar[i].flags = MEM_Null; |
| 76659 | 76252 | } |
| 76660 | | - assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); |
| 76253 | + assert( p->isPrepareV2 || p->expmask==0 ); |
| 76661 | 76254 | if( p->expmask ){ |
| 76662 | 76255 | p->expired = 1; |
| 76663 | 76256 | } |
| 76664 | 76257 | sqlite3_mutex_leave(mutex); |
| 76665 | 76258 | return rc; |
| | @@ -77134,15 +76727,12 @@ |
| 77134 | 76727 | */ |
| 77135 | 76728 | assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR |
| 77136 | 76729 | || (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE |
| 77137 | 76730 | ); |
| 77138 | 76731 | assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp ); |
| 77139 | | - if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 |
| 77140 | | - && rc!=SQLITE_ROW |
| 77141 | | - && rc!=SQLITE_DONE |
| 77142 | | - ){ |
| 77143 | | - /* If this statement was prepared using saved SQL and an |
| 76732 | + if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ |
| 76733 | + /* If this statement was prepared using sqlite3_prepare_v2(), and an |
| 77144 | 76734 | ** error has occurred, then return the error code in p->rc to the |
| 77145 | 76735 | ** caller. Set the error code in the database handle to the same value. |
| 77146 | 76736 | */ |
| 77147 | 76737 | rc = sqlite3VdbeTransferError(p); |
| 77148 | 76738 | } |
| | @@ -77777,11 +77367,11 @@ |
| 77777 | 77367 | ** parameter in the WHERE clause might influence the choice of query plan |
| 77778 | 77368 | ** for a statement, then the statement will be automatically recompiled, |
| 77779 | 77369 | ** as if there had been a schema change, on the first sqlite3_step() call |
| 77780 | 77370 | ** following any change to the bindings of that parameter. |
| 77781 | 77371 | */ |
| 77782 | | - assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 ); |
| 77372 | + assert( p->isPrepareV2 || p->expmask==0 ); |
| 77783 | 77373 | if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){ |
| 77784 | 77374 | p->expired = 1; |
| 77785 | 77375 | } |
| 77786 | 77376 | return SQLITE_OK; |
| 77787 | 77377 | } |
| | @@ -77807,14 +77397,12 @@ |
| 77807 | 77397 | pVar = &p->aVar[i-1]; |
| 77808 | 77398 | rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel); |
| 77809 | 77399 | if( rc==SQLITE_OK && encoding!=0 ){ |
| 77810 | 77400 | rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db)); |
| 77811 | 77401 | } |
| 77812 | | - if( rc ){ |
| 77813 | | - sqlite3Error(p->db, rc); |
| 77814 | | - rc = sqlite3ApiExit(p->db, rc); |
| 77815 | | - } |
| 77402 | + sqlite3Error(p->db, rc); |
| 77403 | + rc = sqlite3ApiExit(p->db, rc); |
| 77816 | 77404 | } |
| 77817 | 77405 | sqlite3_mutex_leave(p->db->mutex); |
| 77818 | 77406 | }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){ |
| 77819 | 77407 | xDel((void*)zData); |
| 77820 | 77408 | } |
| | @@ -78043,15 +77631,15 @@ |
| 78043 | 77631 | Vdbe *pFrom = (Vdbe*)pFromStmt; |
| 78044 | 77632 | Vdbe *pTo = (Vdbe*)pToStmt; |
| 78045 | 77633 | if( pFrom->nVar!=pTo->nVar ){ |
| 78046 | 77634 | return SQLITE_ERROR; |
| 78047 | 77635 | } |
| 78048 | | - assert( (pTo->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pTo->expmask==0 ); |
| 77636 | + assert( pTo->isPrepareV2 || pTo->expmask==0 ); |
| 78049 | 77637 | if( pTo->expmask ){ |
| 78050 | 77638 | pTo->expired = 1; |
| 78051 | 77639 | } |
| 78052 | | - assert( (pFrom->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pFrom->expmask==0 ); |
| 77640 | + assert( pFrom->isPrepareV2 || pFrom->expmask==0 ); |
| 78053 | 77641 | if( pFrom->expmask ){ |
| 78054 | 77642 | pFrom->expired = 1; |
| 78055 | 77643 | } |
| 78056 | 77644 | return sqlite3TransferBindings(pFromStmt, pToStmt); |
| 78057 | 77645 | } |
| | @@ -78117,23 +77705,12 @@ |
| 78117 | 77705 | if( !pStmt ){ |
| 78118 | 77706 | (void)SQLITE_MISUSE_BKPT; |
| 78119 | 77707 | return 0; |
| 78120 | 77708 | } |
| 78121 | 77709 | #endif |
| 78122 | | - if( op==SQLITE_STMTSTATUS_MEMUSED ){ |
| 78123 | | - sqlite3 *db = pVdbe->db; |
| 78124 | | - sqlite3_mutex_enter(db->mutex); |
| 78125 | | - v = 0; |
| 78126 | | - db->pnBytesFreed = (int*)&v; |
| 78127 | | - sqlite3VdbeClearObject(db, pVdbe); |
| 78128 | | - sqlite3DbFree(db, pVdbe); |
| 78129 | | - db->pnBytesFreed = 0; |
| 78130 | | - sqlite3_mutex_leave(db->mutex); |
| 78131 | | - }else{ |
| 78132 | | - v = pVdbe->aCounter[op]; |
| 78133 | | - if( resetFlag ) pVdbe->aCounter[op] = 0; |
| 78134 | | - } |
| 77710 | + v = pVdbe->aCounter[op]; |
| 77711 | + if( resetFlag ) pVdbe->aCounter[op] = 0; |
| 78135 | 77712 | return (int)v; |
| 78136 | 77713 | } |
| 78137 | 77714 | |
| 78138 | 77715 | /* |
| 78139 | 77716 | ** Return the SQL associated with a prepared statement |
| | @@ -79284,11 +78861,11 @@ |
| 79284 | 78861 | u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */ |
| 79285 | 78862 | u8 encoding = ENC(db); /* The database encoding */ |
| 79286 | 78863 | int iCompare = 0; /* Result of last comparison */ |
| 79287 | 78864 | unsigned nVmStep = 0; /* Number of virtual machine steps */ |
| 79288 | 78865 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 79289 | | - unsigned nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */ |
| 78866 | + unsigned nProgressLimit = 0;/* Invoke xProgress() when nVmStep reaches this */ |
| 79290 | 78867 | #endif |
| 79291 | 78868 | Mem *aMem = p->aMem; /* Copy of p->aMem */ |
| 79292 | 78869 | Mem *pIn1 = 0; /* 1st input operand */ |
| 79293 | 78870 | Mem *pIn2 = 0; /* 2nd input operand */ |
| 79294 | 78871 | Mem *pIn3 = 0; /* 3rd input operand */ |
| | @@ -79316,12 +78893,10 @@ |
| 79316 | 78893 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 79317 | 78894 | if( db->xProgress ){ |
| 79318 | 78895 | u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP]; |
| 79319 | 78896 | assert( 0 < db->nProgressOps ); |
| 79320 | 78897 | nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps); |
| 79321 | | - }else{ |
| 79322 | | - nProgressLimit = 0xffffffff; |
| 79323 | 78898 | } |
| 79324 | 78899 | #endif |
| 79325 | 78900 | #ifdef SQLITE_DEBUG |
| 79326 | 78901 | sqlite3BeginBenignMalloc(); |
| 79327 | 78902 | if( p->pc==0 |
| | @@ -79495,11 +79070,11 @@ |
| 79495 | 79070 | ** of VDBE ops have been executed (either since this invocation of |
| 79496 | 79071 | ** sqlite3VdbeExec() or since last time the progress callback was called). |
| 79497 | 79072 | ** If the progress callback returns non-zero, exit the virtual machine with |
| 79498 | 79073 | ** a return code SQLITE_ABORT. |
| 79499 | 79074 | */ |
| 79500 | | - if( nVmStep>=nProgressLimit && db->xProgress!=0 ){ |
| 79075 | + if( db->xProgress!=0 && nVmStep>=nProgressLimit ){ |
| 79501 | 79076 | assert( db->nProgressOps!=0 ); |
| 79502 | 79077 | nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps); |
| 79503 | 79078 | if( db->xProgress(db->pProgressArg) ){ |
| 79504 | 79079 | rc = SQLITE_INTERRUPT; |
| 79505 | 79080 | goto abort_due_to_error; |
| | @@ -80037,11 +79612,11 @@ |
| 80037 | 79612 | |
| 80038 | 79613 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 80039 | 79614 | /* Run the progress counter just before returning. |
| 80040 | 79615 | */ |
| 80041 | 79616 | if( db->xProgress!=0 |
| 80042 | | - && nVmStep>=nProgressLimit |
| 79617 | + && nVmStep>=nProgressLimit |
| 80043 | 79618 | && db->xProgress(db->pProgressArg)!=0 |
| 80044 | 79619 | ){ |
| 80045 | 79620 | rc = SQLITE_INTERRUPT; |
| 80046 | 79621 | goto abort_due_to_error; |
| 80047 | 79622 | } |
| | @@ -81208,13 +80783,11 @@ |
| 81208 | 80783 | Mem *pReg; /* PseudoTable input register */ |
| 81209 | 80784 | |
| 81210 | 80785 | pC = p->apCsr[pOp->p1]; |
| 81211 | 80786 | p2 = pOp->p2; |
| 81212 | 80787 | |
| 81213 | | - /* If the cursor cache is stale (meaning it is not currently point at |
| 81214 | | - ** the correct row) then bring it up-to-date by doing the necessary |
| 81215 | | - ** B-Tree seek. */ |
| 80788 | + /* If the cursor cache is stale, bring it up-to-date */ |
| 81216 | 80789 | rc = sqlite3VdbeCursorMoveto(&pC, &p2); |
| 81217 | 80790 | if( rc ) goto abort_due_to_error; |
| 81218 | 80791 | |
| 81219 | 80792 | assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); |
| 81220 | 80793 | pDest = &aMem[pOp->p3]; |
| | @@ -82692,35 +82265,21 @@ |
| 82692 | 82265 | sqlite3_search_count++; |
| 82693 | 82266 | #endif |
| 82694 | 82267 | if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT ); |
| 82695 | 82268 | if( res<0 || (res==0 && oc==OP_SeekGT) ){ |
| 82696 | 82269 | res = 0; |
| 82697 | | - rc = sqlite3BtreeNext(pC->uc.pCursor, 0); |
| 82698 | | - if( rc!=SQLITE_OK ){ |
| 82699 | | - if( rc==SQLITE_DONE ){ |
| 82700 | | - rc = SQLITE_OK; |
| 82701 | | - res = 1; |
| 82702 | | - }else{ |
| 82703 | | - goto abort_due_to_error; |
| 82704 | | - } |
| 82705 | | - } |
| 82270 | + rc = sqlite3BtreeNext(pC->uc.pCursor, &res); |
| 82271 | + if( rc!=SQLITE_OK ) goto abort_due_to_error; |
| 82706 | 82272 | }else{ |
| 82707 | 82273 | res = 0; |
| 82708 | 82274 | } |
| 82709 | 82275 | }else{ |
| 82710 | 82276 | assert( oc==OP_SeekLT || oc==OP_SeekLE ); |
| 82711 | 82277 | if( res>0 || (res==0 && oc==OP_SeekLT) ){ |
| 82712 | 82278 | res = 0; |
| 82713 | | - rc = sqlite3BtreePrevious(pC->uc.pCursor, 0); |
| 82714 | | - if( rc!=SQLITE_OK ){ |
| 82715 | | - if( rc==SQLITE_DONE ){ |
| 82716 | | - rc = SQLITE_OK; |
| 82717 | | - res = 1; |
| 82718 | | - }else{ |
| 82719 | | - goto abort_due_to_error; |
| 82720 | | - } |
| 82721 | | - } |
| 82279 | + rc = sqlite3BtreePrevious(pC->uc.pCursor, &res); |
| 82280 | + if( rc!=SQLITE_OK ) goto abort_due_to_error; |
| 82722 | 82281 | }else{ |
| 82723 | 82282 | /* res might be negative because the table is empty. Check to |
| 82724 | 82283 | ** see if this is the case. |
| 82725 | 82284 | */ |
| 82726 | 82285 | res = sqlite3BtreeEof(pC->uc.pCursor); |
| | @@ -83822,14 +83381,16 @@ |
| 83822 | 83381 | ** invoked. This opcode advances the cursor to the next sorted |
| 83823 | 83382 | ** record, or jumps to P2 if there are no more sorted records. |
| 83824 | 83383 | */ |
| 83825 | 83384 | case OP_SorterNext: { /* jump */ |
| 83826 | 83385 | VdbeCursor *pC; |
| 83386 | + int res; |
| 83827 | 83387 | |
| 83828 | 83388 | pC = p->apCsr[pOp->p1]; |
| 83829 | 83389 | assert( isSorter(pC) ); |
| 83830 | | - rc = sqlite3VdbeSorterNext(db, pC); |
| 83390 | + res = 0; |
| 83391 | + rc = sqlite3VdbeSorterNext(db, pC, &res); |
| 83831 | 83392 | goto next_tail; |
| 83832 | 83393 | case OP_PrevIfOpen: /* jump */ |
| 83833 | 83394 | case OP_NextIfOpen: /* jump */ |
| 83834 | 83395 | if( p->apCsr[pOp->p1]==0 ) break; |
| 83835 | 83396 | /* Fall through */ |
| | @@ -83836,13 +83397,16 @@ |
| 83836 | 83397 | case OP_Prev: /* jump */ |
| 83837 | 83398 | case OP_Next: /* jump */ |
| 83838 | 83399 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 83839 | 83400 | assert( pOp->p5<ArraySize(p->aCounter) ); |
| 83840 | 83401 | pC = p->apCsr[pOp->p1]; |
| 83402 | + res = pOp->p3; |
| 83841 | 83403 | assert( pC!=0 ); |
| 83842 | 83404 | assert( pC->deferredMoveto==0 ); |
| 83843 | 83405 | assert( pC->eCurType==CURTYPE_BTREE ); |
| 83406 | + assert( res==0 || (res==1 && pC->isTable==0) ); |
| 83407 | + testcase( res==1 ); |
| 83844 | 83408 | assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext ); |
| 83845 | 83409 | assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious ); |
| 83846 | 83410 | assert( pOp->opcode!=OP_NextIfOpen || pOp->p4.xAdvance==sqlite3BtreeNext ); |
| 83847 | 83411 | assert( pOp->opcode!=OP_PrevIfOpen || pOp->p4.xAdvance==sqlite3BtreePrevious); |
| 83848 | 83412 | |
| | @@ -83853,25 +83417,25 @@ |
| 83853 | 83417 | || pC->seekOp==OP_Rewind || pC->seekOp==OP_Found); |
| 83854 | 83418 | assert( pOp->opcode!=OP_Prev || pOp->opcode!=OP_PrevIfOpen |
| 83855 | 83419 | || pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE |
| 83856 | 83420 | || pC->seekOp==OP_Last ); |
| 83857 | 83421 | |
| 83858 | | - rc = pOp->p4.xAdvance(pC->uc.pCursor, pOp->p3); |
| 83422 | + rc = pOp->p4.xAdvance(pC->uc.pCursor, &res); |
| 83859 | 83423 | next_tail: |
| 83860 | 83424 | pC->cacheStatus = CACHE_STALE; |
| 83861 | | - VdbeBranchTaken(rc==SQLITE_OK,2); |
| 83862 | | - if( rc==SQLITE_OK ){ |
| 83425 | + VdbeBranchTaken(res==0,2); |
| 83426 | + if( rc ) goto abort_due_to_error; |
| 83427 | + if( res==0 ){ |
| 83863 | 83428 | pC->nullRow = 0; |
| 83864 | 83429 | p->aCounter[pOp->p5]++; |
| 83865 | 83430 | #ifdef SQLITE_TEST |
| 83866 | 83431 | sqlite3_search_count++; |
| 83867 | 83432 | #endif |
| 83868 | 83433 | goto jump_to_p2_and_check_for_interrupt; |
| 83434 | + }else{ |
| 83435 | + pC->nullRow = 1; |
| 83869 | 83436 | } |
| 83870 | | - if( rc!=SQLITE_DONE ) goto abort_due_to_error; |
| 83871 | | - rc = SQLITE_OK; |
| 83872 | | - pC->nullRow = 1; |
| 83873 | 83437 | goto check_for_interrupt; |
| 83874 | 83438 | } |
| 83875 | 83439 | |
| 83876 | 83440 | /* Opcode: IdxInsert P1 P2 P3 P4 P5 |
| 83877 | 83441 | ** Synopsis: key=r[P2] |
| | @@ -83978,12 +83542,12 @@ |
| 83978 | 83542 | pC->cacheStatus = CACHE_STALE; |
| 83979 | 83543 | pC->seekResult = 0; |
| 83980 | 83544 | break; |
| 83981 | 83545 | } |
| 83982 | 83546 | |
| 83983 | | -/* Opcode: DeferredSeek P1 * P3 P4 * |
| 83984 | | -** Synopsis: Move P3 to P1.rowid if needed |
| 83547 | +/* Opcode: Seek P1 * P3 P4 * |
| 83548 | +** Synopsis: Move P3 to P1.rowid |
| 83985 | 83549 | ** |
| 83986 | 83550 | ** P1 is an open index cursor and P3 is a cursor on the corresponding |
| 83987 | 83551 | ** table. This opcode does a deferred seek of the P3 table cursor |
| 83988 | 83552 | ** to the row that corresponds to the current row of P1. |
| 83989 | 83553 | ** |
| | @@ -84006,15 +83570,15 @@ |
| 84006 | 83570 | ** the end of the index key pointed to by cursor P1. This integer should be |
| 84007 | 83571 | ** the rowid of the table entry to which this index entry points. |
| 84008 | 83572 | ** |
| 84009 | 83573 | ** See also: Rowid, MakeRecord. |
| 84010 | 83574 | */ |
| 84011 | | -case OP_DeferredSeek: |
| 84012 | | -case OP_IdxRowid: { /* out2 */ |
| 84013 | | - VdbeCursor *pC; /* The P1 index cursor */ |
| 84014 | | - VdbeCursor *pTabCur; /* The P2 table cursor (OP_DeferredSeek only) */ |
| 84015 | | - i64 rowid; /* Rowid that P1 current points to */ |
| 83575 | +case OP_Seek: |
| 83576 | +case OP_IdxRowid: { /* out2 */ |
| 83577 | + VdbeCursor *pC; /* The P1 index cursor */ |
| 83578 | + VdbeCursor *pTabCur; /* The P2 table cursor (OP_Seek only) */ |
| 83579 | + i64 rowid; /* Rowid that P1 current points to */ |
| 84016 | 83580 | |
| 84017 | 83581 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 84018 | 83582 | pC = p->apCsr[pOp->p1]; |
| 84019 | 83583 | assert( pC!=0 ); |
| 84020 | 83584 | assert( pC->eCurType==CURTYPE_BTREE ); |
| | @@ -84036,11 +83600,11 @@ |
| 84036 | 83600 | rowid = 0; /* Not needed. Only used to silence a warning. */ |
| 84037 | 83601 | rc = sqlite3VdbeIdxRowid(db, pC->uc.pCursor, &rowid); |
| 84038 | 83602 | if( rc!=SQLITE_OK ){ |
| 84039 | 83603 | goto abort_due_to_error; |
| 84040 | 83604 | } |
| 84041 | | - if( pOp->opcode==OP_DeferredSeek ){ |
| 83605 | + if( pOp->opcode==OP_Seek ){ |
| 84042 | 83606 | assert( pOp->p3>=0 && pOp->p3<p->nCursor ); |
| 84043 | 83607 | pTabCur = p->apCsr[pOp->p3]; |
| 84044 | 83608 | assert( pTabCur!=0 ); |
| 84045 | 83609 | assert( pTabCur->eCurType==CURTYPE_BTREE ); |
| 84046 | 83610 | assert( pTabCur->uc.pCursor!=0 ); |
| | @@ -85282,11 +84846,11 @@ |
| 85282 | 84846 | ** P4 contains a pointer to the name of the table being locked. This is only |
| 85283 | 84847 | ** used to generate an error message if the lock cannot be obtained. |
| 85284 | 84848 | */ |
| 85285 | 84849 | case OP_TableLock: { |
| 85286 | 84850 | u8 isWriteLock = (u8)pOp->p3; |
| 85287 | | - if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){ |
| 84851 | + if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){ |
| 85288 | 84852 | int p1 = pOp->p1; |
| 85289 | 84853 | assert( p1>=0 && p1<db->nDb ); |
| 85290 | 84854 | assert( DbMaskTest(p->btreeMask, p1) ); |
| 85291 | 84855 | assert( isWriteLock==0 || isWriteLock==1 ); |
| 85292 | 84856 | rc = sqlite3BtreeLockTable(db->aDb[p1].pBt, pOp->p2, isWriteLock); |
| | @@ -85790,11 +85354,10 @@ |
| 85790 | 85354 | if( p->aOp[i].opcode==OP_Once ) p->aOp[i].p1 = 0; |
| 85791 | 85355 | } |
| 85792 | 85356 | pOp->p1 = 0; |
| 85793 | 85357 | } |
| 85794 | 85358 | pOp->p1++; |
| 85795 | | - p->aCounter[SQLITE_STMTSTATUS_RUN]++; |
| 85796 | 85359 | goto jump_to_p2; |
| 85797 | 85360 | } |
| 85798 | 85361 | |
| 85799 | 85362 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 85800 | 85363 | /* Opcode: CursorHint P1 * * P4 * |
| | @@ -87264,13 +86827,13 @@ |
| 87264 | 86827 | |
| 87265 | 86828 | int n1; |
| 87266 | 86829 | int n2; |
| 87267 | 86830 | int res; |
| 87268 | 86831 | |
| 87269 | | - getVarint32(&p1[1], n1); |
| 87270 | | - getVarint32(&p2[1], n2); |
| 87271 | | - res = memcmp(v1, v2, (MIN(n1, n2) - 13)/2); |
| 86832 | + getVarint32(&p1[1], n1); n1 = (n1 - 13) / 2; |
| 86833 | + getVarint32(&p2[1], n2); n2 = (n2 - 13) / 2; |
| 86834 | + res = memcmp(v1, v2, MIN(n1, n2)); |
| 87272 | 86835 | if( res==0 ){ |
| 87273 | 86836 | res = n1 - n2; |
| 87274 | 86837 | } |
| 87275 | 86838 | |
| 87276 | 86839 | if( res==0 ){ |
| | @@ -89061,17 +88624,13 @@ |
| 89061 | 88624 | vdbeSorterRewindDebug("rewinddone"); |
| 89062 | 88625 | return rc; |
| 89063 | 88626 | } |
| 89064 | 88627 | |
| 89065 | 88628 | /* |
| 89066 | | -** Advance to the next element in the sorter. Return value: |
| 89067 | | -** |
| 89068 | | -** SQLITE_OK success |
| 89069 | | -** SQLITE_DONE end of data |
| 89070 | | -** otherwise some kind of error. |
| 88629 | +** Advance to the next element in the sorter. |
| 89071 | 88630 | */ |
| 89072 | | -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr){ |
| 88631 | +SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){ |
| 89073 | 88632 | VdbeSorter *pSorter; |
| 89074 | 88633 | int rc; /* Return code */ |
| 89075 | 88634 | |
| 89076 | 88635 | assert( pCsr->eCurType==CURTYPE_SORTER ); |
| 89077 | 88636 | pSorter = pCsr->uc.pSorter; |
| | @@ -89081,26 +88640,25 @@ |
| 89081 | 88640 | assert( pSorter->bUseThreads==0 || pSorter->pReader ); |
| 89082 | 88641 | assert( pSorter->bUseThreads==1 || pSorter->pMerger ); |
| 89083 | 88642 | #if SQLITE_MAX_WORKER_THREADS>0 |
| 89084 | 88643 | if( pSorter->bUseThreads ){ |
| 89085 | 88644 | rc = vdbePmaReaderNext(pSorter->pReader); |
| 89086 | | - if( rc==SQLITE_OK && pSorter->pReader->pFd==0 ) rc = SQLITE_DONE; |
| 88645 | + *pbEof = (pSorter->pReader->pFd==0); |
| 89087 | 88646 | }else |
| 89088 | 88647 | #endif |
| 89089 | 88648 | /*if( !pSorter->bUseThreads )*/ { |
| 89090 | | - int res = 0; |
| 89091 | 88649 | assert( pSorter->pMerger!=0 ); |
| 89092 | 88650 | assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) ); |
| 89093 | | - rc = vdbeMergeEngineStep(pSorter->pMerger, &res); |
| 89094 | | - if( rc==SQLITE_OK && res ) rc = SQLITE_DONE; |
| 88651 | + rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof); |
| 89095 | 88652 | } |
| 89096 | 88653 | }else{ |
| 89097 | 88654 | SorterRecord *pFree = pSorter->list.pList; |
| 89098 | 88655 | pSorter->list.pList = pFree->u.pNext; |
| 89099 | 88656 | pFree->u.pNext = 0; |
| 89100 | 88657 | if( pSorter->list.aMemory==0 ) vdbeSorterRecordFree(db, pFree); |
| 89101 | | - rc = pSorter->list.pList ? SQLITE_OK : SQLITE_DONE; |
| 88658 | + *pbEof = !pSorter->list.pList; |
| 88659 | + rc = SQLITE_OK; |
| 89102 | 88660 | } |
| 89103 | 88661 | return rc; |
| 89104 | 88662 | } |
| 89105 | 88663 | |
| 89106 | 88664 | /* |
| | @@ -89750,37 +89308,44 @@ |
| 89750 | 89308 | ** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and |
| 89751 | 89309 | ** on the compound select chain, p->pPrior. |
| 89752 | 89310 | ** |
| 89753 | 89311 | ** If it is not NULL, the xSelectCallback() callback is invoked before |
| 89754 | 89312 | ** the walk of the expressions and FROM clause. The xSelectCallback2() |
| 89755 | | -** method is invoked following the walk of the expressions and FROM clause, |
| 89756 | | -** but only if both xSelectCallback and xSelectCallback2 are both non-NULL |
| 89757 | | -** and if the expressions and FROM clause both return WRC_Continue; |
| 89313 | +** method, if it is not NULL, is invoked following the walk of the |
| 89314 | +** expressions and FROM clause. |
| 89758 | 89315 | ** |
| 89759 | 89316 | ** Return WRC_Continue under normal conditions. Return WRC_Abort if |
| 89760 | 89317 | ** there is an abort request. |
| 89761 | 89318 | ** |
| 89762 | 89319 | ** If the Walker does not have an xSelectCallback() then this routine |
| 89763 | 89320 | ** is a no-op returning WRC_Continue. |
| 89764 | 89321 | */ |
| 89765 | 89322 | SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){ |
| 89766 | 89323 | int rc; |
| 89767 | | - if( p==0 || pWalker->xSelectCallback==0 ) return WRC_Continue; |
| 89768 | | - do{ |
| 89769 | | - rc = pWalker->xSelectCallback(pWalker, p); |
| 89770 | | - if( rc ) return rc & WRC_Abort; |
| 89324 | + if( p==0 || (pWalker->xSelectCallback==0 && pWalker->xSelectCallback2==0) ){ |
| 89325 | + return WRC_Continue; |
| 89326 | + } |
| 89327 | + rc = WRC_Continue; |
| 89328 | + pWalker->walkerDepth++; |
| 89329 | + while( p ){ |
| 89330 | + if( pWalker->xSelectCallback ){ |
| 89331 | + rc = pWalker->xSelectCallback(pWalker, p); |
| 89332 | + if( rc ) break; |
| 89333 | + } |
| 89771 | 89334 | if( sqlite3WalkSelectExpr(pWalker, p) |
| 89772 | 89335 | || sqlite3WalkSelectFrom(pWalker, p) |
| 89773 | 89336 | ){ |
| 89337 | + pWalker->walkerDepth--; |
| 89774 | 89338 | return WRC_Abort; |
| 89775 | 89339 | } |
| 89776 | 89340 | if( pWalker->xSelectCallback2 ){ |
| 89777 | 89341 | pWalker->xSelectCallback2(pWalker, p); |
| 89778 | 89342 | } |
| 89779 | 89343 | p = p->pPrior; |
| 89780 | | - }while( p!=0 ); |
| 89781 | | - return WRC_Continue; |
| 89344 | + } |
| 89345 | + pWalker->walkerDepth--; |
| 89346 | + return rc & WRC_Abort; |
| 89782 | 89347 | } |
| 89783 | 89348 | |
| 89784 | 89349 | /************** End of walker.c **********************************************/ |
| 89785 | 89350 | /************** Begin file resolve.c *****************************************/ |
| 89786 | 89351 | /* |
| | @@ -90693,11 +90258,11 @@ |
| 90693 | 90258 | /* Try to match the ORDER BY expression against an expression |
| 90694 | 90259 | ** in the result set. Return an 1-based index of the matching |
| 90695 | 90260 | ** result-set entry. |
| 90696 | 90261 | */ |
| 90697 | 90262 | for(i=0; i<pEList->nExpr; i++){ |
| 90698 | | - if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){ |
| 90263 | + if( sqlite3ExprCompare(pEList->a[i].pExpr, pE, -1)<2 ){ |
| 90699 | 90264 | return i+1; |
| 90700 | 90265 | } |
| 90701 | 90266 | } |
| 90702 | 90267 | |
| 90703 | 90268 | /* If no match, return 0. */ |
| | @@ -90927,11 +90492,11 @@ |
| 90927 | 90492 | pItem->u.x.iOrderByCol = 0; |
| 90928 | 90493 | if( sqlite3ResolveExprNames(pNC, pE) ){ |
| 90929 | 90494 | return 1; |
| 90930 | 90495 | } |
| 90931 | 90496 | for(j=0; j<pSelect->pEList->nExpr; j++){ |
| 90932 | | - if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 90497 | + if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ |
| 90933 | 90498 | pItem->u.x.iOrderByCol = j+1; |
| 90934 | 90499 | } |
| 90935 | 90500 | } |
| 90936 | 90501 | } |
| 90937 | 90502 | return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); |
| | @@ -91213,33 +90778,41 @@ |
| 91213 | 90778 | Expr *pExpr /* The expression to be analyzed. */ |
| 91214 | 90779 | ){ |
| 91215 | 90780 | u16 savedHasAgg; |
| 91216 | 90781 | Walker w; |
| 91217 | 90782 | |
| 91218 | | - if( pExpr==0 ) return SQLITE_OK; |
| 90783 | + if( pExpr==0 ) return 0; |
| 90784 | +#if SQLITE_MAX_EXPR_DEPTH>0 |
| 90785 | + { |
| 90786 | + Parse *pParse = pNC->pParse; |
| 90787 | + if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){ |
| 90788 | + return 1; |
| 90789 | + } |
| 90790 | + pParse->nHeight += pExpr->nHeight; |
| 90791 | + } |
| 90792 | +#endif |
| 91219 | 90793 | savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg); |
| 91220 | 90794 | pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg); |
| 91221 | 90795 | w.pParse = pNC->pParse; |
| 91222 | 90796 | w.xExprCallback = resolveExprStep; |
| 91223 | 90797 | w.xSelectCallback = resolveSelectStep; |
| 91224 | 90798 | w.xSelectCallback2 = 0; |
| 90799 | + w.walkerDepth = 0; |
| 90800 | + w.eCode = 0; |
| 91225 | 90801 | w.u.pNC = pNC; |
| 91226 | | -#if SQLITE_MAX_EXPR_DEPTH>0 |
| 91227 | | - w.pParse->nHeight += pExpr->nHeight; |
| 91228 | | - if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){ |
| 91229 | | - return SQLITE_ERROR; |
| 91230 | | - } |
| 91231 | | -#endif |
| 91232 | 90802 | sqlite3WalkExpr(&w, pExpr); |
| 91233 | 90803 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 91234 | | - w.pParse->nHeight -= pExpr->nHeight; |
| 90804 | + pNC->pParse->nHeight -= pExpr->nHeight; |
| 91235 | 90805 | #endif |
| 90806 | + if( pNC->nErr>0 || w.pParse->nErr>0 ){ |
| 90807 | + ExprSetProperty(pExpr, EP_Error); |
| 90808 | + } |
| 91236 | 90809 | if( pNC->ncFlags & NC_HasAgg ){ |
| 91237 | 90810 | ExprSetProperty(pExpr, EP_Agg); |
| 91238 | 90811 | } |
| 91239 | 90812 | pNC->ncFlags |= savedHasAgg; |
| 91240 | | - return pNC->nErr>0 || w.pParse->nErr>0; |
| 90813 | + return ExprHasProperty(pExpr, EP_Error); |
| 91241 | 90814 | } |
| 91242 | 90815 | |
| 91243 | 90816 | /* |
| 91244 | 90817 | ** Resolve all names for all expression in an expression list. This is |
| 91245 | 90818 | ** just like sqlite3ResolveExprNames() except that it works for an expression |
| | @@ -91276,13 +90849,13 @@ |
| 91276 | 90849 | NameContext *pOuterNC /* Name context for parent SELECT statement */ |
| 91277 | 90850 | ){ |
| 91278 | 90851 | Walker w; |
| 91279 | 90852 | |
| 91280 | 90853 | assert( p!=0 ); |
| 90854 | + memset(&w, 0, sizeof(w)); |
| 91281 | 90855 | w.xExprCallback = resolveExprStep; |
| 91282 | 90856 | w.xSelectCallback = resolveSelectStep; |
| 91283 | | - w.xSelectCallback2 = 0; |
| 91284 | 90857 | w.pParse = pParse; |
| 91285 | 90858 | w.u.pNC = pOuterNC; |
| 91286 | 90859 | sqlite3WalkSelect(&w, p); |
| 91287 | 90860 | } |
| 91288 | 90861 | |
| | @@ -92811,13 +92384,11 @@ |
| 92811 | 92384 | } |
| 92812 | 92385 | pList = pNew; |
| 92813 | 92386 | pList->nAlloc *= 2; |
| 92814 | 92387 | } |
| 92815 | 92388 | pItem = &pList->a[pList->nExpr++]; |
| 92816 | | - assert( offsetof(struct ExprList_item,zName)==sizeof(pItem->pExpr) ); |
| 92817 | | - assert( offsetof(struct ExprList_item,pExpr)==0 ); |
| 92818 | | - memset(&pItem->zName,0,sizeof(*pItem)-offsetof(struct ExprList_item,zName)); |
| 92389 | + memset(pItem, 0, sizeof(*pItem)); |
| 92819 | 92390 | pItem->pExpr = pExpr; |
| 92820 | 92391 | return pList; |
| 92821 | 92392 | |
| 92822 | 92393 | no_mem: |
| 92823 | 92394 | /* Avoid leaking memory if malloc has failed. */ |
| | @@ -93097,16 +92668,14 @@ |
| 93097 | 92668 | pWalker->eCode = 0; |
| 93098 | 92669 | return WRC_Abort; |
| 93099 | 92670 | } |
| 93100 | 92671 | static int exprIsConst(Expr *p, int initFlag, int iCur){ |
| 93101 | 92672 | Walker w; |
| 92673 | + memset(&w, 0, sizeof(w)); |
| 93102 | 92674 | w.eCode = initFlag; |
| 93103 | 92675 | w.xExprCallback = exprNodeIsConstant; |
| 93104 | 92676 | w.xSelectCallback = selectNodeIsConstant; |
| 93105 | | -#ifdef SQLITE_DEBUG |
| 93106 | | - w.xSelectCallback2 = sqlite3SelectWalkAssert2; |
| 93107 | | -#endif |
| 93108 | 92677 | w.u.iCur = iCur; |
| 93109 | 92678 | sqlite3WalkExpr(&w, p); |
| 93110 | 92679 | return w.eCode; |
| 93111 | 92680 | } |
| 93112 | 92681 | |
| | @@ -93152,11 +92721,11 @@ |
| 93152 | 92721 | |
| 93153 | 92722 | /* Check if pExpr is identical to any GROUP BY term. If so, consider |
| 93154 | 92723 | ** it constant. */ |
| 93155 | 92724 | for(i=0; i<pGroupBy->nExpr; i++){ |
| 93156 | 92725 | Expr *p = pGroupBy->a[i].pExpr; |
| 93157 | | - if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){ |
| 92726 | + if( sqlite3ExprCompare(pExpr, p, -1)<2 ){ |
| 93158 | 92727 | CollSeq *pColl = sqlite3ExprCollSeq(pWalker->pParse, p); |
| 93159 | 92728 | if( pColl==0 || sqlite3_stricmp("BINARY", pColl->zName)==0 ){ |
| 93160 | 92729 | return WRC_Prune; |
| 93161 | 92730 | } |
| 93162 | 92731 | } |
| | @@ -93190,13 +92759,13 @@ |
| 93190 | 92759 | ** optimization, so we take the easy way out and simply require the |
| 93191 | 92760 | ** GROUP BY to use the BINARY collating sequence. |
| 93192 | 92761 | */ |
| 93193 | 92762 | SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){ |
| 93194 | 92763 | Walker w; |
| 92764 | + memset(&w, 0, sizeof(w)); |
| 93195 | 92765 | w.eCode = 1; |
| 93196 | 92766 | w.xExprCallback = exprNodeIsConstantOrGroupBy; |
| 93197 | | - w.xSelectCallback = 0; |
| 93198 | 92767 | w.u.pGroupBy = pGroupBy; |
| 93199 | 92768 | w.pParse = pParse; |
| 93200 | 92769 | sqlite3WalkExpr(&w, p); |
| 93201 | 92770 | return w.eCode; |
| 93202 | 92771 | } |
| | @@ -93220,16 +92789,14 @@ |
| 93220 | 92789 | ** Walk an expression tree. Return 1 if the expression contains a |
| 93221 | 92790 | ** subquery of some kind. Return 0 if there are no subqueries. |
| 93222 | 92791 | */ |
| 93223 | 92792 | SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){ |
| 93224 | 92793 | Walker w; |
| 92794 | + memset(&w, 0, sizeof(w)); |
| 93225 | 92795 | w.eCode = 1; |
| 93226 | 92796 | w.xExprCallback = sqlite3ExprWalkNoop; |
| 93227 | 92797 | w.xSelectCallback = selectNodeIsConstant; |
| 93228 | | -#ifdef SQLITE_DEBUG |
| 93229 | | - w.xSelectCallback2 = sqlite3SelectWalkAssert2; |
| 93230 | | -#endif |
| 93231 | 92798 | sqlite3WalkExpr(&w, p); |
| 93232 | 92799 | return w.eCode==0; |
| 93233 | 92800 | } |
| 93234 | 92801 | #endif |
| 93235 | 92802 | |
| | @@ -95428,11 +94995,11 @@ |
| 95428 | 94995 | p = pParse->pConstExpr; |
| 95429 | 94996 | if( regDest<0 && p ){ |
| 95430 | 94997 | struct ExprList_item *pItem; |
| 95431 | 94998 | int i; |
| 95432 | 94999 | for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){ |
| 95433 | | - if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){ |
| 95000 | + if( pItem->reusable && sqlite3ExprCompare(pItem->pExpr,pExpr,-1)==0 ){ |
| 95434 | 95001 | return pItem->u.iConstExprReg; |
| 95435 | 95002 | } |
| 95436 | 95003 | } |
| 95437 | 95004 | } |
| 95438 | 95005 | pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); |
| | @@ -95983,45 +95550,10 @@ |
| 95983 | 95550 | sqlite3ExprIfFalse(pParse, pCopy, dest, jumpIfNull); |
| 95984 | 95551 | } |
| 95985 | 95552 | sqlite3ExprDelete(db, pCopy); |
| 95986 | 95553 | } |
| 95987 | 95554 | |
| 95988 | | -/* |
| 95989 | | -** Expression pVar is guaranteed to be an SQL variable. pExpr may be any |
| 95990 | | -** type of expression. |
| 95991 | | -** |
| 95992 | | -** If pExpr is a simple SQL value - an integer, real, string, blob |
| 95993 | | -** or NULL value - then the VDBE currently being prepared is configured |
| 95994 | | -** to re-prepare each time a new value is bound to variable pVar. |
| 95995 | | -** |
| 95996 | | -** Additionally, if pExpr is a simple SQL value and the value is the |
| 95997 | | -** same as that currently bound to variable pVar, non-zero is returned. |
| 95998 | | -** Otherwise, if the values are not the same or if pExpr is not a simple |
| 95999 | | -** SQL value, zero is returned. |
| 96000 | | -*/ |
| 96001 | | -static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){ |
| 96002 | | - int res = 0; |
| 96003 | | - int iVar; |
| 96004 | | - sqlite3_value *pL, *pR = 0; |
| 96005 | | - |
| 96006 | | - sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR); |
| 96007 | | - if( pR ){ |
| 96008 | | - iVar = pVar->iColumn; |
| 96009 | | - sqlite3VdbeSetVarmask(pParse->pVdbe, iVar); |
| 96010 | | - pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB); |
| 96011 | | - if( pL ){ |
| 96012 | | - if( sqlite3_value_type(pL)==SQLITE_TEXT ){ |
| 96013 | | - sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */ |
| 96014 | | - } |
| 96015 | | - res = 0==sqlite3MemCompare(pL, pR, 0); |
| 96016 | | - } |
| 96017 | | - sqlite3ValueFree(pR); |
| 96018 | | - sqlite3ValueFree(pL); |
| 96019 | | - } |
| 96020 | | - |
| 96021 | | - return res; |
| 96022 | | -} |
| 96023 | 95555 | |
| 96024 | 95556 | /* |
| 96025 | 95557 | ** Do a deep comparison of two expression trees. Return 0 if the two |
| 96026 | 95558 | ** expressions are completely identical. Return 1 if they differ only |
| 96027 | 95559 | ** by a COLLATE operator at the top level. Return 2 if there are differences |
| | @@ -96040,38 +95572,28 @@ |
| 96040 | 95572 | ** expressions are the same. But if you get a 0 or 1 return, then you |
| 96041 | 95573 | ** can be sure the expressions are the same. In the places where |
| 96042 | 95574 | ** this routine is used, it does not hurt to get an extra 2 - that |
| 96043 | 95575 | ** just might result in some slightly slower code. But returning |
| 96044 | 95576 | ** an incorrect 0 or 1 could lead to a malfunction. |
| 96045 | | -** |
| 96046 | | -** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in |
| 96047 | | -** pParse->pReprepare can be matched against literals in pB. The |
| 96048 | | -** pParse->pVdbe->expmask bitmask is updated for each variable referenced. |
| 96049 | | -** If pParse is NULL (the normal case) then any TK_VARIABLE term in |
| 96050 | | -** Argument pParse should normally be NULL. If it is not NULL and pA or |
| 96051 | | -** pB causes a return value of 2. |
| 96052 | 95577 | */ |
| 96053 | | -SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){ |
| 95578 | +SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){ |
| 96054 | 95579 | u32 combinedFlags; |
| 96055 | 95580 | if( pA==0 || pB==0 ){ |
| 96056 | 95581 | return pB==pA ? 0 : 2; |
| 96057 | 95582 | } |
| 96058 | | - if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){ |
| 96059 | | - return 0; |
| 96060 | | - } |
| 96061 | 95583 | combinedFlags = pA->flags | pB->flags; |
| 96062 | 95584 | if( combinedFlags & EP_IntValue ){ |
| 96063 | 95585 | if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){ |
| 96064 | 95586 | return 0; |
| 96065 | 95587 | } |
| 96066 | 95588 | return 2; |
| 96067 | 95589 | } |
| 96068 | 95590 | if( pA->op!=pB->op ){ |
| 96069 | | - if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){ |
| 95591 | + if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){ |
| 96070 | 95592 | return 1; |
| 96071 | 95593 | } |
| 96072 | | - if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){ |
| 95594 | + if( pB->op==TK_COLLATE && sqlite3ExprCompare(pA, pB->pLeft, iTab)<2 ){ |
| 96073 | 95595 | return 1; |
| 96074 | 95596 | } |
| 96075 | 95597 | return 2; |
| 96076 | 95598 | } |
| 96077 | 95599 | if( pA->op!=TK_COLUMN && pA->op!=TK_AGG_COLUMN && pA->u.zToken ){ |
| | @@ -96082,12 +95604,12 @@ |
| 96082 | 95604 | } |
| 96083 | 95605 | } |
| 96084 | 95606 | if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; |
| 96085 | 95607 | if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ |
| 96086 | 95608 | if( combinedFlags & EP_xIsSelect ) return 2; |
| 96087 | | - if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; |
| 96088 | | - if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; |
| 95609 | + if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2; |
| 95610 | + if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2; |
| 96089 | 95611 | if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; |
| 96090 | 95612 | if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){ |
| 96091 | 95613 | if( pA->iColumn!=pB->iColumn ) return 2; |
| 96092 | 95614 | if( pA->iTable!=pB->iTable |
| 96093 | 95615 | && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; |
| | @@ -96118,21 +95640,21 @@ |
| 96118 | 95640 | if( pA->nExpr!=pB->nExpr ) return 1; |
| 96119 | 95641 | for(i=0; i<pA->nExpr; i++){ |
| 96120 | 95642 | Expr *pExprA = pA->a[i].pExpr; |
| 96121 | 95643 | Expr *pExprB = pB->a[i].pExpr; |
| 96122 | 95644 | if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1; |
| 96123 | | - if( sqlite3ExprCompare(0, pExprA, pExprB, iTab) ) return 1; |
| 95645 | + if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1; |
| 96124 | 95646 | } |
| 96125 | 95647 | return 0; |
| 96126 | 95648 | } |
| 96127 | 95649 | |
| 96128 | 95650 | /* |
| 96129 | 95651 | ** Like sqlite3ExprCompare() except COLLATE operators at the top-level |
| 96130 | 95652 | ** are ignored. |
| 96131 | 95653 | */ |
| 96132 | 95654 | SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){ |
| 96133 | | - return sqlite3ExprCompare(0, |
| 95655 | + return sqlite3ExprCompare( |
| 96134 | 95656 | sqlite3ExprSkipCollate(pA), |
| 96135 | 95657 | sqlite3ExprSkipCollate(pB), |
| 96136 | 95658 | iTab); |
| 96137 | 95659 | } |
| 96138 | 95660 | |
| | @@ -96150,33 +95672,28 @@ |
| 96150 | 95672 | ** pE1: x IS ?2 pE2: x IS NOT NULL Reuslt: false |
| 96151 | 95673 | ** |
| 96152 | 95674 | ** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has |
| 96153 | 95675 | ** Expr.iTable<0 then assume a table number given by iTab. |
| 96154 | 95676 | ** |
| 96155 | | -** If pParse is not NULL, then the values of bound variables in pE1 are |
| 96156 | | -** compared against literal values in pE2 and pParse->pVdbe->expmask is |
| 96157 | | -** modified to record which bound variables are referenced. If pParse |
| 96158 | | -** is NULL, then false will be returned if pE1 contains any bound variables. |
| 96159 | | -** |
| 96160 | 95677 | ** When in doubt, return false. Returning true might give a performance |
| 96161 | 95678 | ** improvement. Returning false might cause a performance reduction, but |
| 96162 | 95679 | ** it will always give the correct answer and is hence always safe. |
| 96163 | 95680 | */ |
| 96164 | | -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){ |
| 96165 | | - if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){ |
| 95681 | +SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){ |
| 95682 | + if( sqlite3ExprCompare(pE1, pE2, iTab)==0 ){ |
| 96166 | 95683 | return 1; |
| 96167 | 95684 | } |
| 96168 | 95685 | if( pE2->op==TK_OR |
| 96169 | | - && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab) |
| 96170 | | - || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) ) |
| 95686 | + && (sqlite3ExprImpliesExpr(pE1, pE2->pLeft, iTab) |
| 95687 | + || sqlite3ExprImpliesExpr(pE1, pE2->pRight, iTab) ) |
| 96171 | 95688 | ){ |
| 96172 | 95689 | return 1; |
| 96173 | 95690 | } |
| 96174 | 95691 | if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){ |
| 96175 | 95692 | Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft); |
| 96176 | 95693 | testcase( pX!=pE1->pLeft ); |
| 96177 | | - if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1; |
| 95694 | + if( sqlite3ExprCompare(pX, pE2->pLeft, iTab)==0 ) return 1; |
| 96178 | 95695 | } |
| 96179 | 95696 | return 0; |
| 96180 | 95697 | } |
| 96181 | 95698 | |
| 96182 | 95699 | /* |
| | @@ -96280,12 +95797,12 @@ |
| 96280 | 95797 | */ |
| 96281 | 95798 | SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ |
| 96282 | 95799 | Walker w; |
| 96283 | 95800 | struct SrcCount cnt; |
| 96284 | 95801 | assert( pExpr->op==TK_AGG_FUNCTION ); |
| 95802 | + memset(&w, 0, sizeof(w)); |
| 96285 | 95803 | w.xExprCallback = exprSrcCount; |
| 96286 | | - w.xSelectCallback = 0; |
| 96287 | 95804 | w.u.pSrcCount = &cnt; |
| 96288 | 95805 | cnt.pSrc = pSrcList; |
| 96289 | 95806 | cnt.nThis = 0; |
| 96290 | 95807 | cnt.nOther = 0; |
| 96291 | 95808 | sqlite3WalkExprList(&w, pExpr->x.pList); |
| | @@ -96413,11 +95930,11 @@ |
| 96413 | 95930 | /* Check to see if pExpr is a duplicate of another aggregate |
| 96414 | 95931 | ** function that is already in the pAggInfo structure |
| 96415 | 95932 | */ |
| 96416 | 95933 | struct AggInfo_func *pItem = pAggInfo->aFunc; |
| 96417 | 95934 | for(i=0; i<pAggInfo->nFunc; i++, pItem++){ |
| 96418 | | - if( sqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){ |
| 95935 | + if( sqlite3ExprCompare(pItem->pExpr, pExpr, -1)==0 ){ |
| 96419 | 95936 | break; |
| 96420 | 95937 | } |
| 96421 | 95938 | } |
| 96422 | 95939 | if( i>=pAggInfo->nFunc ){ |
| 96423 | 95940 | /* pExpr is original. Make a new entry in pAggInfo->aFunc[] |
| | @@ -96453,18 +95970,14 @@ |
| 96453 | 95970 | } |
| 96454 | 95971 | } |
| 96455 | 95972 | return WRC_Continue; |
| 96456 | 95973 | } |
| 96457 | 95974 | static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){ |
| 95975 | + UNUSED_PARAMETER(pWalker); |
| 96458 | 95976 | UNUSED_PARAMETER(pSelect); |
| 96459 | | - pWalker->walkerDepth++; |
| 96460 | 95977 | return WRC_Continue; |
| 96461 | 95978 | } |
| 96462 | | -static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){ |
| 96463 | | - UNUSED_PARAMETER(pSelect); |
| 96464 | | - pWalker->walkerDepth--; |
| 96465 | | -} |
| 96466 | 95979 | |
| 96467 | 95980 | /* |
| 96468 | 95981 | ** Analyze the pExpr expression looking for aggregate functions and |
| 96469 | 95982 | ** for variables that need to be added to AggInfo object that pNC->pAggInfo |
| 96470 | 95983 | ** points to. Additional entries are made on the AggInfo object as |
| | @@ -96473,14 +95986,13 @@ |
| 96473 | 95986 | ** This routine should only be called after the expression has been |
| 96474 | 95987 | ** analyzed by sqlite3ResolveExprNames(). |
| 96475 | 95988 | */ |
| 96476 | 95989 | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ |
| 96477 | 95990 | Walker w; |
| 95991 | + memset(&w, 0, sizeof(w)); |
| 96478 | 95992 | w.xExprCallback = analyzeAggregate; |
| 96479 | 95993 | w.xSelectCallback = analyzeAggregatesInSelect; |
| 96480 | | - w.xSelectCallback2 = analyzeAggregatesInSelectEnd; |
| 96481 | | - w.walkerDepth = 0; |
| 96482 | 95994 | w.u.pNC = pNC; |
| 96483 | 95995 | assert( pNC->pSrcList!=0 ); |
| 96484 | 95996 | sqlite3WalkExpr(&w, pExpr); |
| 96485 | 95997 | } |
| 96486 | 95998 | |
| | @@ -96970,11 +96482,11 @@ |
| 96970 | 96482 | ** in pParse->zErr (system tables may not be altered) and returns non-zero. |
| 96971 | 96483 | ** |
| 96972 | 96484 | ** Or, if zName is not a system table, zero is returned. |
| 96973 | 96485 | */ |
| 96974 | 96486 | static int isSystemTable(Parse *pParse, const char *zName){ |
| 96975 | | - if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ |
| 96487 | + if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ |
| 96976 | 96488 | sqlite3ErrorMsg(pParse, "table %s may not be altered", zName); |
| 96977 | 96489 | return 1; |
| 96978 | 96490 | } |
| 96979 | 96491 | return 0; |
| 96980 | 96492 | } |
| | @@ -99389,12 +98901,11 @@ |
| 99389 | 98901 | const char *zName; |
| 99390 | 98902 | const char *zFile; |
| 99391 | 98903 | char *zPath = 0; |
| 99392 | 98904 | char *zErr = 0; |
| 99393 | 98905 | unsigned int flags; |
| 99394 | | - Db *aNew; /* New array of Db pointers */ |
| 99395 | | - Db *pNew; /* Db object for the newly attached database */ |
| 98906 | + Db *aNew; |
| 99396 | 98907 | char *zErrDyn = 0; |
| 99397 | 98908 | sqlite3_vfs *pVfs; |
| 99398 | 98909 | |
| 99399 | 98910 | UNUSED_PARAMETER(NotUsed); |
| 99400 | 98911 | |
| | @@ -99438,12 +98949,12 @@ |
| 99438 | 98949 | }else{ |
| 99439 | 98950 | aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); |
| 99440 | 98951 | if( aNew==0 ) return; |
| 99441 | 98952 | } |
| 99442 | 98953 | db->aDb = aNew; |
| 99443 | | - pNew = &db->aDb[db->nDb]; |
| 99444 | | - memset(pNew, 0, sizeof(*pNew)); |
| 98954 | + aNew = &db->aDb[db->nDb]; |
| 98955 | + memset(aNew, 0, sizeof(*aNew)); |
| 99445 | 98956 | |
| 99446 | 98957 | /* Open the database file. If the btree is successfully opened, use |
| 99447 | 98958 | ** it to obtain the database schema. At this point the schema may |
| 99448 | 98959 | ** or may not be initialized. |
| 99449 | 98960 | */ |
| | @@ -99455,41 +98966,41 @@ |
| 99455 | 98966 | sqlite3_free(zErr); |
| 99456 | 98967 | return; |
| 99457 | 98968 | } |
| 99458 | 98969 | assert( pVfs ); |
| 99459 | 98970 | flags |= SQLITE_OPEN_MAIN_DB; |
| 99460 | | - rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags); |
| 98971 | + rc = sqlite3BtreeOpen(pVfs, zPath, db, &aNew->pBt, 0, flags); |
| 99461 | 98972 | sqlite3_free( zPath ); |
| 99462 | 98973 | db->nDb++; |
| 99463 | 98974 | db->skipBtreeMutex = 0; |
| 99464 | 98975 | if( rc==SQLITE_CONSTRAINT ){ |
| 99465 | 98976 | rc = SQLITE_ERROR; |
| 99466 | 98977 | zErrDyn = sqlite3MPrintf(db, "database is already attached"); |
| 99467 | 98978 | }else if( rc==SQLITE_OK ){ |
| 99468 | 98979 | Pager *pPager; |
| 99469 | | - pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt); |
| 99470 | | - if( !pNew->pSchema ){ |
| 98980 | + aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt); |
| 98981 | + if( !aNew->pSchema ){ |
| 99471 | 98982 | rc = SQLITE_NOMEM_BKPT; |
| 99472 | | - }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){ |
| 98983 | + }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){ |
| 99473 | 98984 | zErrDyn = sqlite3MPrintf(db, |
| 99474 | 98985 | "attached databases must use the same text encoding as main database"); |
| 99475 | 98986 | rc = SQLITE_ERROR; |
| 99476 | 98987 | } |
| 99477 | | - sqlite3BtreeEnter(pNew->pBt); |
| 99478 | | - pPager = sqlite3BtreePager(pNew->pBt); |
| 98988 | + sqlite3BtreeEnter(aNew->pBt); |
| 98989 | + pPager = sqlite3BtreePager(aNew->pBt); |
| 99479 | 98990 | sqlite3PagerLockingMode(pPager, db->dfltLockMode); |
| 99480 | | - sqlite3BtreeSecureDelete(pNew->pBt, |
| 98991 | + sqlite3BtreeSecureDelete(aNew->pBt, |
| 99481 | 98992 | sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); |
| 99482 | 98993 | #ifndef SQLITE_OMIT_PAGER_PRAGMAS |
| 99483 | | - sqlite3BtreeSetPagerFlags(pNew->pBt, |
| 98994 | + sqlite3BtreeSetPagerFlags(aNew->pBt, |
| 99484 | 98995 | PAGER_SYNCHRONOUS_FULL | (db->flags & PAGER_FLAGS_MASK)); |
| 99485 | 98996 | #endif |
| 99486 | | - sqlite3BtreeLeave(pNew->pBt); |
| 98997 | + sqlite3BtreeLeave(aNew->pBt); |
| 99487 | 98998 | } |
| 99488 | | - pNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1; |
| 99489 | | - pNew->zDbSName = sqlite3DbStrDup(db, zName); |
| 99490 | | - if( rc==SQLITE_OK && pNew->zDbSName==0 ){ |
| 98999 | + aNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1; |
| 99000 | + aNew->zDbSName = sqlite3DbStrDup(db, zName); |
| 99001 | + if( rc==SQLITE_OK && aNew->zDbSName==0 ){ |
| 99491 | 99002 | rc = SQLITE_NOMEM_BKPT; |
| 99492 | 99003 | } |
| 99493 | 99004 | |
| 99494 | 99005 | |
| 99495 | 99006 | #ifdef SQLITE_HAS_CODEC |
| | @@ -101122,15 +100633,11 @@ |
| 101122 | 100633 | } |
| 101123 | 100634 | pTable->zName = zName; |
| 101124 | 100635 | pTable->iPKey = -1; |
| 101125 | 100636 | pTable->pSchema = db->aDb[iDb].pSchema; |
| 101126 | 100637 | pTable->nTabRef = 1; |
| 101127 | | -#ifdef SQLITE_DEFAULT_ROWEST |
| 101128 | | - pTable->nRowLogEst = sqlite3LogEst(SQLITE_DEFAULT_ROWEST); |
| 101129 | | -#else |
| 101130 | 100638 | pTable->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) ); |
| 101131 | | -#endif |
| 101132 | 100639 | assert( pParse->pNewTable==0 ); |
| 101133 | 100640 | pParse->pNewTable = pTable; |
| 101134 | 100641 | |
| 101135 | 100642 | /* If this is the magic sqlite_sequence table used by autoincrement, |
| 101136 | 100643 | ** then record a pointer to this table in the main database structure |
| | @@ -104368,13 +103875,11 @@ |
| 104368 | 103875 | for(j=0; j<pIdx->nKeyCol; j++){ |
| 104369 | 103876 | char *zCol; |
| 104370 | 103877 | assert( pIdx->aiColumn[j]>=0 ); |
| 104371 | 103878 | zCol = pTab->aCol[pIdx->aiColumn[j]].zName; |
| 104372 | 103879 | if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2); |
| 104373 | | - sqlite3StrAccumAppendAll(&errMsg, pTab->zName); |
| 104374 | | - sqlite3StrAccumAppend(&errMsg, ".", 1); |
| 104375 | | - sqlite3StrAccumAppendAll(&errMsg, zCol); |
| 103880 | + sqlite3XPrintf(&errMsg, "%s.%s", pTab->zName, zCol); |
| 104376 | 103881 | } |
| 104377 | 103882 | } |
| 104378 | 103883 | zErr = sqlite3StrAccumFinish(&errMsg); |
| 104379 | 103884 | sqlite3HaltConstraint(pParse, |
| 104380 | 103885 | IsPrimaryKeyIndex(pIdx) ? SQLITE_CONSTRAINT_PRIMARYKEY |
| | @@ -105479,11 +104984,11 @@ |
| 105479 | 104984 | ** It is easier just to erase the whole table. Prior to version 3.6.5, |
| 105480 | 104985 | ** this optimization caused the row change count (the value returned by |
| 105481 | 104986 | ** API function sqlite3_count_changes) to be set incorrectly. |
| 105482 | 104987 | ** |
| 105483 | 104988 | ** The "rcauth==SQLITE_OK" terms is the |
| 105484 | | - ** IMPLEMENTATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and |
| 104989 | + ** IMPLEMENATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and |
| 105485 | 104990 | ** the callback returns SQLITE_IGNORE then the DELETE operation proceeds but |
| 105486 | 104991 | ** the truncate optimization is disabled and all rows are deleted |
| 105487 | 104992 | ** individually. |
| 105488 | 104993 | */ |
| 105489 | 104994 | if( rcauth==SQLITE_OK |
| | @@ -105585,11 +105090,11 @@ |
| 105585 | 105090 | sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey, |
| 105586 | 105091 | sqlite3IndexAffinityStr(pParse->db, pPk), nPk); |
| 105587 | 105092 | sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEphCur, iKey, iPk, nPk); |
| 105588 | 105093 | }else{ |
| 105589 | 105094 | /* Add the rowid of the row to be deleted to the RowSet */ |
| 105590 | | - nKey = 1; /* OP_DeferredSeek always uses a single rowid */ |
| 105095 | + nKey = 1; /* OP_Seek always uses a single rowid */ |
| 105591 | 105096 | sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey); |
| 105592 | 105097 | } |
| 105593 | 105098 | } |
| 105594 | 105099 | |
| 105595 | 105100 | /* If this DELETE cannot use the ONEPASS strategy, this is the |
| | @@ -108539,16 +108044,14 @@ |
| 108539 | 108044 | sqlite3ResolveExprNames(&sNameContext, pWhere); |
| 108540 | 108045 | |
| 108541 | 108046 | /* Create VDBE to loop through the entries in pSrc that match the WHERE |
| 108542 | 108047 | ** clause. For each row found, increment either the deferred or immediate |
| 108543 | 108048 | ** foreign key constraint counter. */ |
| 108544 | | - if( pParse->nErr==0 ){ |
| 108545 | | - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); |
| 108546 | | - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); |
| 108547 | | - if( pWInfo ){ |
| 108548 | | - sqlite3WhereEnd(pWInfo); |
| 108549 | | - } |
| 108049 | + pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); |
| 108050 | + sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); |
| 108051 | + if( pWInfo ){ |
| 108052 | + sqlite3WhereEnd(pWInfo); |
| 108550 | 108053 | } |
| 108551 | 108054 | |
| 108552 | 108055 | /* Clean up the WHERE clause constructed above. */ |
| 108553 | 108056 | sqlite3ExprDelete(db, pWhere); |
| 108554 | 108057 | if( iFkIfZero ){ |
| | @@ -109851,14 +109354,14 @@ |
| 109851 | 109354 | Trigger *pTrigger; /* List of triggers on pTab, if required */ |
| 109852 | 109355 | int tmask; /* Mask of trigger times */ |
| 109853 | 109356 | #endif |
| 109854 | 109357 | |
| 109855 | 109358 | db = pParse->db; |
| 109359 | + memset(&dest, 0, sizeof(dest)); |
| 109856 | 109360 | if( pParse->nErr || db->mallocFailed ){ |
| 109857 | 109361 | goto insert_cleanup; |
| 109858 | 109362 | } |
| 109859 | | - dest.iSDParm = 0; /* Suppress a harmless compiler warning */ |
| 109860 | 109363 | |
| 109861 | 109364 | /* If the Select object is really just a simple VALUES() list with a |
| 109862 | 109365 | ** single row (the common case) then keep that one row of values |
| 109863 | 109366 | ** and discard the other (unused) parts of the pSelect object |
| 109864 | 109367 | */ |
| | @@ -111228,11 +110731,11 @@ |
| 111228 | 110731 | if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){ |
| 111229 | 110732 | return 0; /* Different columns indexed */ |
| 111230 | 110733 | } |
| 111231 | 110734 | if( pSrc->aiColumn[i]==XN_EXPR ){ |
| 111232 | 110735 | assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 ); |
| 111233 | | - if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr, |
| 110736 | + if( sqlite3ExprCompare(pSrc->aColExpr->a[i].pExpr, |
| 111234 | 110737 | pDest->aColExpr->a[i].pExpr, -1)!=0 ){ |
| 111235 | 110738 | return 0; /* Different expressions in the index */ |
| 111236 | 110739 | } |
| 111237 | 110740 | } |
| 111238 | 110741 | if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){ |
| | @@ -111240,11 +110743,11 @@ |
| 111240 | 110743 | } |
| 111241 | 110744 | if( sqlite3_stricmp(pSrc->azColl[i],pDest->azColl[i])!=0 ){ |
| 111242 | 110745 | return 0; /* Different collating sequences */ |
| 111243 | 110746 | } |
| 111244 | 110747 | } |
| 111245 | | - if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ |
| 110748 | + if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ |
| 111246 | 110749 | return 0; /* Different WHERE clauses */ |
| 111247 | 110750 | } |
| 111248 | 110751 | |
| 111249 | 110752 | /* If no test above fails then the indices must be compatible */ |
| 111250 | 110753 | return 1; |
| | @@ -111720,12 +111223,15 @@ |
| 111720 | 111223 | if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt); |
| 111721 | 111224 | sqlite3DbFree(db, azCols); |
| 111722 | 111225 | |
| 111723 | 111226 | rc = sqlite3ApiExit(db, rc); |
| 111724 | 111227 | if( rc!=SQLITE_OK && pzErrMsg ){ |
| 111725 | | - *pzErrMsg = sqlite3DbStrDup(0, sqlite3_errmsg(db)); |
| 111726 | | - if( *pzErrMsg==0 ){ |
| 111228 | + int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db)); |
| 111229 | + *pzErrMsg = sqlite3Malloc(nErrMsg); |
| 111230 | + if( *pzErrMsg ){ |
| 111231 | + memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg); |
| 111232 | + }else{ |
| 111727 | 111233 | rc = SQLITE_NOMEM_BKPT; |
| 111728 | 111234 | sqlite3Error(db, SQLITE_NOMEM); |
| 111729 | 111235 | } |
| 111730 | 111236 | }else if( pzErrMsg ){ |
| 111731 | 111237 | *pzErrMsg = 0; |
| | @@ -113398,11 +112904,11 @@ |
| 113398 | 112904 | /* iArg: */ 0 }, |
| 113399 | 112905 | #endif |
| 113400 | 112906 | #if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) |
| 113401 | 112907 | {/* zName: */ "foreign_key_check", |
| 113402 | 112908 | /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, |
| 113403 | | - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0, |
| 112909 | + /* ePragFlg: */ PragFlg_NeedSchema, |
| 113404 | 112910 | /* ColNames: */ 39, 4, |
| 113405 | 112911 | /* iArg: */ 0 }, |
| 113406 | 112912 | #endif |
| 113407 | 112913 | #if !defined(SQLITE_OMIT_FOREIGN_KEY) |
| 113408 | 112914 | {/* zName: */ "foreign_key_list", |
| | @@ -113485,11 +112991,11 @@ |
| 113485 | 112991 | /* iArg: */ 1 }, |
| 113486 | 112992 | #endif |
| 113487 | 112993 | #if !defined(SQLITE_OMIT_INTEGRITY_CHECK) |
| 113488 | 112994 | {/* zName: */ "integrity_check", |
| 113489 | 112995 | /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, |
| 113490 | | - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1, |
| 112996 | + /* ePragFlg: */ PragFlg_NeedSchema, |
| 113491 | 112997 | /* ColNames: */ 0, 0, |
| 113492 | 112998 | /* iArg: */ 0 }, |
| 113493 | 112999 | #endif |
| 113494 | 113000 | #if !defined(SQLITE_OMIT_PAGER_PRAGMAS) |
| 113495 | 113001 | {/* zName: */ "journal_mode", |
| | @@ -113580,20 +113086,20 @@ |
| 113580 | 113086 | /* iArg: */ SQLITE_QueryOnly }, |
| 113581 | 113087 | #endif |
| 113582 | 113088 | #if !defined(SQLITE_OMIT_INTEGRITY_CHECK) |
| 113583 | 113089 | {/* zName: */ "quick_check", |
| 113584 | 113090 | /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, |
| 113585 | | - /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1, |
| 113091 | + /* ePragFlg: */ PragFlg_NeedSchema, |
| 113586 | 113092 | /* ColNames: */ 0, 0, |
| 113587 | 113093 | /* iArg: */ 0 }, |
| 113588 | 113094 | #endif |
| 113589 | 113095 | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 113590 | 113096 | {/* zName: */ "read_uncommitted", |
| 113591 | 113097 | /* ePragTyp: */ PragTyp_FLAG, |
| 113592 | 113098 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113593 | 113099 | /* ColNames: */ 0, 0, |
| 113594 | | - /* iArg: */ SQLITE_ReadUncommit }, |
| 113100 | + /* iArg: */ SQLITE_ReadUncommitted }, |
| 113595 | 113101 | {/* zName: */ "recursive_triggers", |
| 113596 | 113102 | /* ePragTyp: */ PragTyp_FLAG, |
| 113597 | 113103 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113598 | 113104 | /* ColNames: */ 0, 0, |
| 113599 | 113105 | /* iArg: */ SQLITE_RecTriggers }, |
| | @@ -113741,11 +113247,11 @@ |
| 113741 | 113247 | #if !defined(SQLITE_OMIT_FLAG_PRAGMAS) |
| 113742 | 113248 | {/* zName: */ "writable_schema", |
| 113743 | 113249 | /* ePragTyp: */ PragTyp_FLAG, |
| 113744 | 113250 | /* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1, |
| 113745 | 113251 | /* ColNames: */ 0, 0, |
| 113746 | | - /* iArg: */ SQLITE_WriteSchema }, |
| 113252 | + /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode }, |
| 113747 | 113253 | #endif |
| 113748 | 113254 | }; |
| 113749 | 113255 | /* Number of pragmas: 60 on by default, 74 total. */ |
| 113750 | 113256 | |
| 113751 | 113257 | /************** End of pragma.h **********************************************/ |
| | @@ -116183,11 +115689,11 @@ |
| 116183 | 115689 | InitData *pData, /* Initialization context */ |
| 116184 | 115690 | const char *zObj, /* Object being parsed at the point of error */ |
| 116185 | 115691 | const char *zExtra /* Error information */ |
| 116186 | 115692 | ){ |
| 116187 | 115693 | sqlite3 *db = pData->db; |
| 116188 | | - if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){ |
| 115694 | + if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){ |
| 116189 | 115695 | char *z; |
| 116190 | 115696 | if( zObj==0 ) zObj = "?"; |
| 116191 | 115697 | z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj); |
| 116192 | 115698 | if( zExtra ) z = sqlite3MPrintf(db, "%z - %s", z, zExtra); |
| 116193 | 115699 | sqlite3DbFree(db, *pData->pzErrMsg); |
| | @@ -116470,12 +115976,12 @@ |
| 116470 | 115976 | } |
| 116471 | 115977 | if( db->mallocFailed ){ |
| 116472 | 115978 | rc = SQLITE_NOMEM_BKPT; |
| 116473 | 115979 | sqlite3ResetAllSchemasOfConnection(db); |
| 116474 | 115980 | } |
| 116475 | | - if( rc==SQLITE_OK || (db->flags&SQLITE_WriteSchema)){ |
| 116476 | | - /* Black magic: If the SQLITE_WriteSchema flag is set, then consider |
| 115981 | + if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){ |
| 115982 | + /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider |
| 116477 | 115983 | ** the schema loaded, even if errors occurred. In this situation the |
| 116478 | 115984 | ** current sqlite3_prepare() operation will fail, but the following one |
| 116479 | 115985 | ** will attempt to compile the supplied statement against whatever subset |
| 116480 | 115986 | ** of the schema was loaded before the error occurred. The primary |
| 116481 | 115987 | ** purpose of this is to allow access to the sqlite_master table |
| | @@ -116671,11 +116177,11 @@ |
| 116671 | 116177 | */ |
| 116672 | 116178 | static int sqlite3Prepare( |
| 116673 | 116179 | sqlite3 *db, /* Database handle. */ |
| 116674 | 116180 | const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116675 | 116181 | int nBytes, /* Length of zSql in bytes. */ |
| 116676 | | - u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116182 | + int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ |
| 116677 | 116183 | Vdbe *pReprepare, /* VM being reprepared */ |
| 116678 | 116184 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116679 | 116185 | const char **pzTail /* OUT: End of parsed string */ |
| 116680 | 116186 | ){ |
| 116681 | 116187 | char *zErrMsg = 0; /* Error message */ |
| | @@ -116688,18 +116194,10 @@ |
| 116688 | 116194 | sParse.pReprepare = pReprepare; |
| 116689 | 116195 | assert( ppStmt && *ppStmt==0 ); |
| 116690 | 116196 | /* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */ |
| 116691 | 116197 | assert( sqlite3_mutex_held(db->mutex) ); |
| 116692 | 116198 | |
| 116693 | | - /* For a long-term use prepared statement avoid the use of |
| 116694 | | - ** lookaside memory. |
| 116695 | | - */ |
| 116696 | | - if( prepFlags & SQLITE_PREPARE_PERSISTENT ){ |
| 116697 | | - sParse.disableLookaside++; |
| 116698 | | - db->lookaside.bDisable++; |
| 116699 | | - } |
| 116700 | | - |
| 116701 | 116199 | /* Check to verify that it is possible to get a read lock on all |
| 116702 | 116200 | ** database schemas. The inability to get a read lock indicates that |
| 116703 | 116201 | ** some other database connection is holding a write-lock, which in |
| 116704 | 116202 | ** turn means that the other connection has made uncommitted changes |
| 116705 | 116203 | ** to the schema. |
| | @@ -116727,11 +116225,11 @@ |
| 116727 | 116225 | assert( sqlite3BtreeHoldsMutex(pBt) ); |
| 116728 | 116226 | rc = sqlite3BtreeSchemaLocked(pBt); |
| 116729 | 116227 | if( rc ){ |
| 116730 | 116228 | const char *zDb = db->aDb[i].zDbSName; |
| 116731 | 116229 | sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb); |
| 116732 | | - testcase( db->flags & SQLITE_ReadUncommit ); |
| 116230 | + testcase( db->flags & SQLITE_ReadUncommitted ); |
| 116733 | 116231 | goto end_prepare; |
| 116734 | 116232 | } |
| 116735 | 116233 | } |
| 116736 | 116234 | } |
| 116737 | 116235 | |
| | @@ -116795,11 +116293,12 @@ |
| 116795 | 116293 | } |
| 116796 | 116294 | } |
| 116797 | 116295 | #endif |
| 116798 | 116296 | |
| 116799 | 116297 | if( db->init.busy==0 ){ |
| 116800 | | - sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags); |
| 116298 | + Vdbe *pVdbe = sParse.pVdbe; |
| 116299 | + sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag); |
| 116801 | 116300 | } |
| 116802 | 116301 | if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){ |
| 116803 | 116302 | sqlite3VdbeFinalize(sParse.pVdbe); |
| 116804 | 116303 | assert(!(*ppStmt)); |
| 116805 | 116304 | }else{ |
| | @@ -116829,11 +116328,11 @@ |
| 116829 | 116328 | } |
| 116830 | 116329 | static int sqlite3LockAndPrepare( |
| 116831 | 116330 | sqlite3 *db, /* Database handle. */ |
| 116832 | 116331 | const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116833 | 116332 | int nBytes, /* Length of zSql in bytes. */ |
| 116834 | | - u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116333 | + int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ |
| 116835 | 116334 | Vdbe *pOld, /* VM being reprepared */ |
| 116836 | 116335 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116837 | 116336 | const char **pzTail /* OUT: End of parsed string */ |
| 116838 | 116337 | ){ |
| 116839 | 116338 | int rc; |
| | @@ -116845,14 +116344,14 @@ |
| 116845 | 116344 | if( !sqlite3SafetyCheckOk(db)||zSql==0 ){ |
| 116846 | 116345 | return SQLITE_MISUSE_BKPT; |
| 116847 | 116346 | } |
| 116848 | 116347 | sqlite3_mutex_enter(db->mutex); |
| 116849 | 116348 | sqlite3BtreeEnterAll(db); |
| 116850 | | - rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); |
| 116349 | + rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); |
| 116851 | 116350 | if( rc==SQLITE_SCHEMA ){ |
| 116852 | 116351 | sqlite3_finalize(*ppStmt); |
| 116853 | | - rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail); |
| 116352 | + rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); |
| 116854 | 116353 | } |
| 116855 | 116354 | sqlite3BtreeLeaveAll(db); |
| 116856 | 116355 | sqlite3_mutex_leave(db->mutex); |
| 116857 | 116356 | assert( rc==SQLITE_OK || *ppStmt==0 ); |
| 116858 | 116357 | return rc; |
| | @@ -116869,19 +116368,17 @@ |
| 116869 | 116368 | SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){ |
| 116870 | 116369 | int rc; |
| 116871 | 116370 | sqlite3_stmt *pNew; |
| 116872 | 116371 | const char *zSql; |
| 116873 | 116372 | sqlite3 *db; |
| 116874 | | - u8 prepFlags; |
| 116875 | 116373 | |
| 116876 | 116374 | assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) ); |
| 116877 | 116375 | zSql = sqlite3_sql((sqlite3_stmt *)p); |
| 116878 | 116376 | assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */ |
| 116879 | 116377 | db = sqlite3VdbeDb(p); |
| 116880 | 116378 | assert( sqlite3_mutex_held(db->mutex) ); |
| 116881 | | - prepFlags = sqlite3VdbePrepareFlags(p); |
| 116882 | | - rc = sqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0); |
| 116379 | + rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0); |
| 116883 | 116380 | if( rc ){ |
| 116884 | 116381 | if( rc==SQLITE_NOMEM ){ |
| 116885 | 116382 | sqlite3OomFault(db); |
| 116886 | 116383 | } |
| 116887 | 116384 | assert( pNew==0 ); |
| | @@ -116923,27 +116420,11 @@ |
| 116923 | 116420 | int nBytes, /* Length of zSql in bytes. */ |
| 116924 | 116421 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116925 | 116422 | const char **pzTail /* OUT: End of parsed string */ |
| 116926 | 116423 | ){ |
| 116927 | 116424 | int rc; |
| 116928 | | - rc = sqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0, |
| 116929 | | - ppStmt,pzTail); |
| 116930 | | - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 116931 | | - return rc; |
| 116932 | | -} |
| 116933 | | -SQLITE_API int sqlite3_prepare_v3( |
| 116934 | | - sqlite3 *db, /* Database handle. */ |
| 116935 | | - const char *zSql, /* UTF-8 encoded SQL statement. */ |
| 116936 | | - int nBytes, /* Length of zSql in bytes. */ |
| 116937 | | - unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116938 | | - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116939 | | - const char **pzTail /* OUT: End of parsed string */ |
| 116940 | | -){ |
| 116941 | | - int rc; |
| 116942 | | - rc = sqlite3LockAndPrepare(db,zSql,nBytes, |
| 116943 | | - SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), |
| 116944 | | - 0,ppStmt,pzTail); |
| 116425 | + rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail); |
| 116945 | 116426 | assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 116946 | 116427 | return rc; |
| 116947 | 116428 | } |
| 116948 | 116429 | |
| 116949 | 116430 | |
| | @@ -116953,11 +116434,11 @@ |
| 116953 | 116434 | */ |
| 116954 | 116435 | static int sqlite3Prepare16( |
| 116955 | 116436 | sqlite3 *db, /* Database handle. */ |
| 116956 | 116437 | const void *zSql, /* UTF-16 encoded SQL statement. */ |
| 116957 | 116438 | int nBytes, /* Length of zSql in bytes. */ |
| 116958 | | - u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 116439 | + int saveSqlFlag, /* True to save SQL text into the sqlite3_stmt */ |
| 116959 | 116440 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 116960 | 116441 | const void **pzTail /* OUT: End of parsed string */ |
| 116961 | 116442 | ){ |
| 116962 | 116443 | /* This function currently works by first transforming the UTF-16 |
| 116963 | 116444 | ** encoded string to UTF-8, then invoking sqlite3_prepare(). The |
| | @@ -116981,11 +116462,11 @@ |
| 116981 | 116462 | nBytes = sz; |
| 116982 | 116463 | } |
| 116983 | 116464 | sqlite3_mutex_enter(db->mutex); |
| 116984 | 116465 | zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE); |
| 116985 | 116466 | if( zSql8 ){ |
| 116986 | | - rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8); |
| 116467 | + rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8); |
| 116987 | 116468 | } |
| 116988 | 116469 | |
| 116989 | 116470 | if( zTail8 && pzTail ){ |
| 116990 | 116471 | /* If sqlite3_prepare returns a tail pointer, we calculate the |
| 116991 | 116472 | ** equivalent pointer into the UTF-16 string by counting the unicode |
| | @@ -117027,26 +116508,11 @@ |
| 117027 | 116508 | int nBytes, /* Length of zSql in bytes. */ |
| 117028 | 116509 | sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 117029 | 116510 | const void **pzTail /* OUT: End of parsed string */ |
| 117030 | 116511 | ){ |
| 117031 | 116512 | int rc; |
| 117032 | | - rc = sqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail); |
| 117033 | | - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 117034 | | - return rc; |
| 117035 | | -} |
| 117036 | | -SQLITE_API int sqlite3_prepare16_v3( |
| 117037 | | - sqlite3 *db, /* Database handle. */ |
| 117038 | | - const void *zSql, /* UTF-16 encoded SQL statement. */ |
| 117039 | | - int nBytes, /* Length of zSql in bytes. */ |
| 117040 | | - unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */ |
| 117041 | | - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ |
| 117042 | | - const void **pzTail /* OUT: End of parsed string */ |
| 117043 | | -){ |
| 117044 | | - int rc; |
| 117045 | | - rc = sqlite3Prepare16(db,zSql,nBytes, |
| 117046 | | - SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK), |
| 117047 | | - ppStmt,pzTail); |
| 116513 | + rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail); |
| 117048 | 116514 | assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ |
| 117049 | 116515 | return rc; |
| 117050 | 116516 | } |
| 117051 | 116517 | |
| 117052 | 116518 | #endif /* SQLITE_OMIT_UTF16 */ |
| | @@ -118084,11 +117550,11 @@ |
| 118084 | 117550 | /* |
| 118085 | 117551 | ** Allocate a KeyInfo object sufficient for an index of N key columns and |
| 118086 | 117552 | ** X extra columns. |
| 118087 | 117553 | */ |
| 118088 | 117554 | SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ |
| 118089 | | - int nExtra = (N+X)*(sizeof(CollSeq*)+1) - sizeof(CollSeq*); |
| 117555 | + int nExtra = (N+X)*(sizeof(CollSeq*)+1); |
| 118090 | 117556 | KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra); |
| 118091 | 117557 | if( p ){ |
| 118092 | 117558 | p->aSortOrder = (u8*)&p->aColl[N+X]; |
| 118093 | 117559 | p->nField = (u16)N; |
| 118094 | 117560 | p->nXField = (u16)X; |
| | @@ -120258,16 +119724,13 @@ |
| 120258 | 119724 | ifNullRow.pLeft = pCopy; |
| 120259 | 119725 | ifNullRow.iTable = pSubst->iNewTable; |
| 120260 | 119726 | pCopy = &ifNullRow; |
| 120261 | 119727 | } |
| 120262 | 119728 | pNew = sqlite3ExprDup(db, pCopy, 0); |
| 120263 | | - if( pNew && pSubst->isLeftJoin ){ |
| 120264 | | - ExprSetProperty(pNew, EP_CanBeNull); |
| 120265 | | - } |
| 120266 | | - if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){ |
| 119729 | + if( pNew && (pExpr->flags & EP_FromJoin) ){ |
| 120267 | 119730 | pNew->iRightJoinTable = pExpr->iRightJoinTable; |
| 120268 | | - ExprSetProperty(pNew, EP_FromJoin); |
| 119731 | + pNew->flags |= EP_FromJoin; |
| 120269 | 119732 | } |
| 120270 | 119733 | sqlite3ExprDelete(db, pExpr); |
| 120271 | 119734 | pExpr = pNew; |
| 120272 | 119735 | } |
| 120273 | 119736 | } |
| | @@ -120556,11 +120019,11 @@ |
| 120556 | 120019 | ** |
| 120557 | 120020 | ** which is not at all the same thing. |
| 120558 | 120021 | ** |
| 120559 | 120022 | ** If the subquery is the right operand of a LEFT JOIN, then the outer |
| 120560 | 120023 | ** query cannot be an aggregate. This is an artifact of the way aggregates |
| 120561 | | - ** are processed - there is no mechanism to determine if the LEFT JOIN |
| 120024 | + ** are processed - there is not mechanism to determine if the LEFT JOIN |
| 120562 | 120025 | ** table should be all-NULL. |
| 120563 | 120026 | ** |
| 120564 | 120027 | ** See also tickets #306, #350, and #3300. |
| 120565 | 120028 | */ |
| 120566 | 120029 | if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){ |
| | @@ -121667,29 +121130,10 @@ |
| 121667 | 121130 | UNUSED_PARAMETER2(NotUsed, NotUsed2); |
| 121668 | 121131 | return WRC_Continue; |
| 121669 | 121132 | } |
| 121670 | 121133 | |
| 121671 | 121134 | /* |
| 121672 | | -** No-op routine for the parse-tree walker for SELECT statements. |
| 121673 | | -** subquery in the parser tree. |
| 121674 | | -*/ |
| 121675 | | -SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){ |
| 121676 | | - UNUSED_PARAMETER2(NotUsed, NotUsed2); |
| 121677 | | - return WRC_Continue; |
| 121678 | | -} |
| 121679 | | - |
| 121680 | | -#if SQLITE_DEBUG |
| 121681 | | -/* |
| 121682 | | -** Always assert. This xSelectCallback2 implementation proves that the |
| 121683 | | -** xSelectCallback2 is never invoked. |
| 121684 | | -*/ |
| 121685 | | -SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){ |
| 121686 | | - UNUSED_PARAMETER2(NotUsed, NotUsed2); |
| 121687 | | - assert( 0 ); |
| 121688 | | -} |
| 121689 | | -#endif |
| 121690 | | -/* |
| 121691 | 121135 | ** This routine "expands" a SELECT statement and all of its subqueries. |
| 121692 | 121136 | ** For additional information on what it means to "expand" a SELECT |
| 121693 | 121137 | ** statement, see the comment on the selectExpand worker callback above. |
| 121694 | 121138 | ** |
| 121695 | 121139 | ** Expanding a SELECT statement is the first step in processing a |
| | @@ -121700,15 +121144,15 @@ |
| 121700 | 121144 | ** The calling function can detect the problem by looking at pParse->nErr |
| 121701 | 121145 | ** and/or pParse->db->mallocFailed. |
| 121702 | 121146 | */ |
| 121703 | 121147 | static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ |
| 121704 | 121148 | Walker w; |
| 121149 | + memset(&w, 0, sizeof(w)); |
| 121705 | 121150 | w.xExprCallback = sqlite3ExprWalkNoop; |
| 121706 | 121151 | w.pParse = pParse; |
| 121707 | 121152 | if( pParse->hasCompound ){ |
| 121708 | 121153 | w.xSelectCallback = convertCompoundSelectToSubquery; |
| 121709 | | - w.xSelectCallback2 = 0; |
| 121710 | 121154 | sqlite3WalkSelect(&w, pSelect); |
| 121711 | 121155 | } |
| 121712 | 121156 | w.xSelectCallback = selectExpander; |
| 121713 | 121157 | w.xSelectCallback2 = selectPopWith; |
| 121714 | 121158 | sqlite3WalkSelect(&w, pSelect); |
| | @@ -121764,11 +121208,11 @@ |
| 121764 | 121208 | ** Use this routine after name resolution. |
| 121765 | 121209 | */ |
| 121766 | 121210 | static void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){ |
| 121767 | 121211 | #ifndef SQLITE_OMIT_SUBQUERY |
| 121768 | 121212 | Walker w; |
| 121769 | | - w.xSelectCallback = sqlite3SelectWalkNoop; |
| 121213 | + memset(&w, 0, sizeof(w)); |
| 121770 | 121214 | w.xSelectCallback2 = selectAddSubqueryTypeInfo; |
| 121771 | 121215 | w.xExprCallback = sqlite3ExprWalkNoop; |
| 121772 | 121216 | w.pParse = pParse; |
| 121773 | 121217 | sqlite3WalkSelect(&w, pSelect); |
| 121774 | 121218 | #endif |
| | @@ -122058,13 +121502,11 @@ |
| 122058 | 121502 | if( pItem->pSelect==0 ) continue; |
| 122059 | 121503 | if( pItem->fg.viaCoroutine ) continue; |
| 122060 | 121504 | if( pItem->zName==0 ) continue; |
| 122061 | 121505 | if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue; |
| 122062 | 121506 | if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue; |
| 122063 | | - if( sqlite3ExprCompare(0, |
| 122064 | | - pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) |
| 122065 | | - ){ |
| 121507 | + if( sqlite3ExprCompare(pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) ){ |
| 122066 | 121508 | /* The view was modified by some other optimization such as |
| 122067 | 121509 | ** pushDownWhereTerms() */ |
| 122068 | 121510 | continue; |
| 122069 | 121511 | } |
| 122070 | 121512 | return pItem; |
| | @@ -122347,13 +121789,10 @@ |
| 122347 | 121789 | VdbeNoopComment((v, "materialize \"%s\"", pItem->pTab->zName)); |
| 122348 | 121790 | } |
| 122349 | 121791 | pPrior = isSelfJoinView(pTabList, pItem); |
| 122350 | 121792 | if( pPrior ){ |
| 122351 | 121793 | sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor); |
| 122352 | | - explainSetInteger(pItem->iSelectId, pPrior->iSelectId); |
| 122353 | | - assert( pPrior->pSelect!=0 ); |
| 122354 | | - pSub->nSelectRow = pPrior->pSelect->nSelectRow; |
| 122355 | 121794 | }else{ |
| 122356 | 121795 | sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor); |
| 122357 | 121796 | explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId); |
| 122358 | 121797 | sqlite3Select(pParse, pSub, &dest); |
| 122359 | 121798 | } |
| | @@ -123509,11 +122948,10 @@ |
| 123509 | 122948 | /* Make an entry in the sqlite_master table */ |
| 123510 | 122949 | v = sqlite3GetVdbe(pParse); |
| 123511 | 122950 | if( v==0 ) goto triggerfinish_cleanup; |
| 123512 | 122951 | sqlite3BeginWriteOperation(pParse, 0, iDb); |
| 123513 | 122952 | z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n); |
| 123514 | | - testcase( z==0 ); |
| 123515 | 122953 | sqlite3NestedParse(pParse, |
| 123516 | 122954 | "INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')", |
| 123517 | 122955 | db->aDb[iDb].zDbSName, MASTER_NAME, zName, |
| 123518 | 122956 | pTrig->table, z); |
| 123519 | 122957 | sqlite3DbFree(db, z); |
| | @@ -125377,11 +124815,11 @@ |
| 125377 | 124815 | #ifdef SQLITE_HAS_CODEC |
| 125378 | 124816 | if( db->nextPagesize ){ |
| 125379 | 124817 | extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); |
| 125380 | 124818 | int nKey; |
| 125381 | 124819 | char *zKey; |
| 125382 | | - sqlite3CodecGetKey(db, iDb, (void**)&zKey, &nKey); |
| 124820 | + sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); |
| 125383 | 124821 | if( nKey ) db->nextPagesize = 0; |
| 125384 | 124822 | } |
| 125385 | 124823 | #endif |
| 125386 | 124824 | |
| 125387 | 124825 | sqlite3BtreeSetCacheSize(pTemp, db->aDb[iDb].pSchema->cache_size); |
| | @@ -128317,14 +127755,14 @@ |
| 128317 | 127755 | ** function generates code to do a deferred seek of cursor iCur to the |
| 128318 | 127756 | ** rowid stored in register iRowid. |
| 128319 | 127757 | ** |
| 128320 | 127758 | ** Normally, this is just: |
| 128321 | 127759 | ** |
| 128322 | | -** OP_DeferredSeek $iCur $iRowid |
| 127760 | +** OP_Seek $iCur $iRowid |
| 128323 | 127761 | ** |
| 128324 | 127762 | ** However, if the scan currently being coded is a branch of an OR-loop and |
| 128325 | | -** the statement currently being coded is a SELECT, then P3 of OP_DeferredSeek |
| 127763 | +** the statement currently being coded is a SELECT, then P3 of the OP_Seek |
| 128326 | 127764 | ** is set to iIdxCur and P4 is set to point to an array of integers |
| 128327 | 127765 | ** containing one entry for each column of the table cursor iCur is open |
| 128328 | 127766 | ** on. For each table column, if the column is the i'th column of the |
| 128329 | 127767 | ** index, then the corresponding array entry is set to (i+1). If the column |
| 128330 | 127768 | ** does not appear in the index at all, the array entry is set to 0. |
| | @@ -128339,11 +127777,11 @@ |
| 128339 | 127777 | Vdbe *v = pParse->pVdbe; /* Vdbe to generate code within */ |
| 128340 | 127778 | |
| 128341 | 127779 | assert( iIdxCur>0 ); |
| 128342 | 127780 | assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 ); |
| 128343 | 127781 | |
| 128344 | | - sqlite3VdbeAddOp3(v, OP_DeferredSeek, iIdxCur, 0, iCur); |
| 127782 | + sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur); |
| 128345 | 127783 | if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE) |
| 128346 | 127784 | && DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask) |
| 128347 | 127785 | ){ |
| 128348 | 127786 | int i; |
| 128349 | 127787 | Table *pTab = pIdx->pTable; |
| | @@ -128409,11 +127847,11 @@ |
| 128409 | 127847 | ** If pExpr matches, then transform it into a reference to the index column |
| 128410 | 127848 | ** that contains the value of pExpr. |
| 128411 | 127849 | */ |
| 128412 | 127850 | static int whereIndexExprTransNode(Walker *p, Expr *pExpr){ |
| 128413 | 127851 | IdxExprTrans *pX = p->u.pIdxTrans; |
| 128414 | | - if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ |
| 127852 | + if( sqlite3ExprCompare(pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){ |
| 128415 | 127853 | pExpr->op = TK_COLUMN; |
| 128416 | 127854 | pExpr->iTable = pX->iIdxCur; |
| 128417 | 127855 | pExpr->iColumn = pX->iIdxCol; |
| 128418 | 127856 | pExpr->pTab = 0; |
| 128419 | 127857 | return WRC_Prune; |
| | @@ -129703,11 +129141,11 @@ |
| 129703 | 129141 | pList = pExpr->x.pList; |
| 129704 | 129142 | pLeft = pList->a[1].pExpr; |
| 129705 | 129143 | |
| 129706 | 129144 | pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); |
| 129707 | 129145 | op = pRight->op; |
| 129708 | | - if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){ |
| 129146 | + if( op==TK_VARIABLE ){ |
| 129709 | 129147 | Vdbe *pReprepare = pParse->pReprepare; |
| 129710 | 129148 | int iCol = pRight->iColumn; |
| 129711 | 129149 | pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB); |
| 129712 | 129150 | if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ |
| 129713 | 129151 | z = (char *)sqlite3_value_text(pVal); |
| | @@ -129893,12 +129331,12 @@ |
| 129893 | 129331 | if( (pTwo->eOperator & (WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE))==0 ) return; |
| 129894 | 129332 | if( (eOp & (WO_EQ|WO_LT|WO_LE))!=eOp |
| 129895 | 129333 | && (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return; |
| 129896 | 129334 | assert( pOne->pExpr->pLeft!=0 && pOne->pExpr->pRight!=0 ); |
| 129897 | 129335 | assert( pTwo->pExpr->pLeft!=0 && pTwo->pExpr->pRight!=0 ); |
| 129898 | | - if( sqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; |
| 129899 | | - if( sqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return; |
| 129336 | + if( sqlite3ExprCompare(pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return; |
| 129337 | + if( sqlite3ExprCompare(pOne->pExpr->pRight, pTwo->pExpr->pRight, -1) )return; |
| 129900 | 129338 | /* If we reach this point, it means the two subterms can be combined */ |
| 129901 | 129339 | if( (eOp & (eOp-1))!=0 ){ |
| 129902 | 129340 | if( eOp & (WO_LT|WO_LE) ){ |
| 129903 | 129341 | eOp = WO_LE; |
| 129904 | 129342 | }else{ |
| | @@ -130665,13 +130103,10 @@ |
| 130665 | 130103 | prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft); |
| 130666 | 130104 | if( (prereqExpr & prereqColumn)==0 ){ |
| 130667 | 130105 | Expr *pNewExpr; |
| 130668 | 130106 | pNewExpr = sqlite3PExpr(pParse, TK_MATCH, |
| 130669 | 130107 | 0, sqlite3ExprDup(db, pRight, 0)); |
| 130670 | | - if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){ |
| 130671 | | - ExprSetProperty(pNewExpr, EP_FromJoin); |
| 130672 | | - } |
| 130673 | 130108 | idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); |
| 130674 | 130109 | testcase( idxNew==0 ); |
| 130675 | 130110 | pNewTerm = &pWC->a[idxNew]; |
| 130676 | 130111 | pNewTerm->prereqRight = prereqExpr; |
| 130677 | 130112 | pNewTerm->leftCursor = pLeft->iTable; |
| | @@ -132144,11 +131579,11 @@ |
| 132144 | 131579 | iGap = (iGap*2)/3; |
| 132145 | 131580 | }else{ |
| 132146 | 131581 | iGap = iGap/3; |
| 132147 | 131582 | } |
| 132148 | 131583 | aStat[0] = iLower + iGap; |
| 132149 | | - aStat[1] = pIdx->aAvgEq[nField-1]; |
| 131584 | + aStat[1] = pIdx->aAvgEq[iCol]; |
| 132150 | 131585 | } |
| 132151 | 131586 | |
| 132152 | 131587 | /* Restore the pRec->nField value before returning. */ |
| 132153 | 131588 | pRec->nField = nField; |
| 132154 | 131589 | return i; |
| | @@ -132897,21 +132332,20 @@ |
| 132897 | 132332 | } |
| 132898 | 132333 | } |
| 132899 | 132334 | |
| 132900 | 132335 | /* |
| 132901 | 132336 | ** Search the list of WhereLoops in *ppPrev looking for one that can be |
| 132902 | | -** replaced by pTemplate. |
| 132337 | +** supplanted by pTemplate. |
| 132903 | 132338 | ** |
| 132904 | | -** Return NULL if pTemplate does not belong on the WhereLoop list. |
| 132905 | | -** In other words if pTemplate ought to be dropped from further consideration. |
| 132339 | +** Return NULL if the WhereLoop list contains an entry that can supplant |
| 132340 | +** pTemplate, in other words if pTemplate does not belong on the list. |
| 132906 | 132341 | ** |
| 132907 | | -** If pX is a WhereLoop that pTemplate can replace, then return the |
| 132342 | +** If pX is a WhereLoop that pTemplate can supplant, then return the |
| 132908 | 132343 | ** link that points to pX. |
| 132909 | 132344 | ** |
| 132910 | | -** If pTemplate cannot replace any existing element of the list but needs |
| 132911 | | -** to be added to the list as a new entry, then return a pointer to the |
| 132912 | | -** tail of the list. |
| 132345 | +** If pTemplate cannot supplant any existing element of the list but needs |
| 132346 | +** to be added to the list, then return a pointer to the tail of the list. |
| 132913 | 132347 | */ |
| 132914 | 132348 | static WhereLoop **whereLoopFindLesser( |
| 132915 | 132349 | WhereLoop **ppPrev, |
| 132916 | 132350 | const WhereLoop *pTemplate |
| 132917 | 132351 | ){ |
| | @@ -133052,14 +132486,12 @@ |
| 133052 | 132486 | #if WHERETRACE_ENABLED /* 0x8 */ |
| 133053 | 132487 | if( sqlite3WhereTrace & 0x8 ){ |
| 133054 | 132488 | if( p!=0 ){ |
| 133055 | 132489 | sqlite3DebugPrintf("replace: "); |
| 133056 | 132490 | whereLoopPrint(p, pBuilder->pWC); |
| 133057 | | - sqlite3DebugPrintf(" with: "); |
| 133058 | | - }else{ |
| 133059 | | - sqlite3DebugPrintf(" add: "); |
| 133060 | 132491 | } |
| 132492 | + sqlite3DebugPrintf(" add: "); |
| 133061 | 132493 | whereLoopPrint(pTemplate, pBuilder->pWC); |
| 133062 | 132494 | } |
| 133063 | 132495 | #endif |
| 133064 | 132496 | if( p==0 ){ |
| 133065 | 132497 | /* Allocate a new WhereLoop to add to the end of the list */ |
| | @@ -133606,11 +133038,11 @@ |
| 133606 | 133038 | if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1; |
| 133607 | 133039 | } |
| 133608 | 133040 | }else if( (aColExpr = pIndex->aColExpr)!=0 ){ |
| 133609 | 133041 | for(jj=0; jj<pIndex->nKeyCol; jj++){ |
| 133610 | 133042 | if( pIndex->aiColumn[jj]!=XN_EXPR ) continue; |
| 133611 | | - if( sqlite3ExprCompare(0, pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ |
| 133043 | + if( sqlite3ExprCompare(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){ |
| 133612 | 133044 | return 1; |
| 133613 | 133045 | } |
| 133614 | 133046 | } |
| 133615 | 133047 | } |
| 133616 | 133048 | } |
| | @@ -133639,20 +133071,18 @@ |
| 133639 | 133071 | ** in the current query. Return true if it can be and false if not. |
| 133640 | 133072 | */ |
| 133641 | 133073 | static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){ |
| 133642 | 133074 | int i; |
| 133643 | 133075 | WhereTerm *pTerm; |
| 133644 | | - Parse *pParse = pWC->pWInfo->pParse; |
| 133645 | 133076 | while( pWhere->op==TK_AND ){ |
| 133646 | 133077 | if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0; |
| 133647 | 133078 | pWhere = pWhere->pRight; |
| 133648 | 133079 | } |
| 133649 | | - if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0; |
| 133650 | 133080 | for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 133651 | 133081 | Expr *pExpr = pTerm->pExpr; |
| 133652 | | - if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) |
| 133653 | | - && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab) |
| 133082 | + if( sqlite3ExprImpliesExpr(pExpr, pWhere, iTab) |
| 133083 | + && (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab) |
| 133654 | 133084 | ){ |
| 133655 | 133085 | return 1; |
| 133656 | 133086 | } |
| 133657 | 133087 | } |
| 133658 | 133088 | return 0; |
| | @@ -134627,12 +134057,11 @@ |
| 134627 | 134057 | if( iColumn>=(-1) ){ |
| 134628 | 134058 | if( pOBExpr->op!=TK_COLUMN ) continue; |
| 134629 | 134059 | if( pOBExpr->iTable!=iCur ) continue; |
| 134630 | 134060 | if( pOBExpr->iColumn!=iColumn ) continue; |
| 134631 | 134061 | }else{ |
| 134632 | | - if( sqlite3ExprCompare(0, |
| 134633 | | - pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){ |
| 134062 | + if( sqlite3ExprCompare(pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){ |
| 134634 | 134063 | continue; |
| 134635 | 134064 | } |
| 134636 | 134065 | } |
| 134637 | 134066 | if( iColumn>=0 ){ |
| 134638 | 134067 | pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); |
| | @@ -134927,11 +134356,10 @@ |
| 134927 | 134356 | ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n", |
| 134928 | 134357 | aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, |
| 134929 | 134358 | rUnsorted, rCost)); |
| 134930 | 134359 | }else{ |
| 134931 | 134360 | rCost = rUnsorted; |
| 134932 | | - rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */ |
| 134933 | 134361 | } |
| 134934 | 134362 | |
| 134935 | 134363 | /* Check to see if pWLoop should be added to the set of |
| 134936 | 134364 | ** mxChoice best-so-far paths. |
| 134937 | 134365 | ** |
| | @@ -134959,12 +134387,12 @@ |
| 134959 | 134387 | /* The current candidate is no better than any of the mxChoice |
| 134960 | 134388 | ** paths currently in the best-so-far buffer. So discard |
| 134961 | 134389 | ** this candidate as not viable. */ |
| 134962 | 134390 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 134963 | 134391 | if( sqlite3WhereTrace&0x4 ){ |
| 134964 | | - sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n", |
| 134965 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 134392 | + sqlite3DebugPrintf("Skip %s cost=%-3d,%3d order=%c\n", |
| 134393 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, |
| 134966 | 134394 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 134967 | 134395 | } |
| 134968 | 134396 | #endif |
| 134969 | 134397 | continue; |
| 134970 | 134398 | } |
| | @@ -134978,40 +134406,30 @@ |
| 134978 | 134406 | jj = mxI; |
| 134979 | 134407 | } |
| 134980 | 134408 | pTo = &aTo[jj]; |
| 134981 | 134409 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 134982 | 134410 | if( sqlite3WhereTrace&0x4 ){ |
| 134983 | | - sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n", |
| 134984 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 134411 | + sqlite3DebugPrintf("New %s cost=%-3d,%3d order=%c\n", |
| 134412 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, |
| 134985 | 134413 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 134986 | 134414 | } |
| 134987 | 134415 | #endif |
| 134988 | 134416 | }else{ |
| 134989 | 134417 | /* Control reaches here if best-so-far path pTo=aTo[jj] covers the |
| 134990 | | - ** same set of loops and has the same isOrdered setting as the |
| 134418 | + ** same set of loops and has the sam isOrdered setting as the |
| 134991 | 134419 | ** candidate path. Check to see if the candidate should replace |
| 134992 | | - ** pTo or if the candidate should be skipped. |
| 134993 | | - ** |
| 134994 | | - ** The conditional is an expanded vector comparison equivalent to: |
| 134995 | | - ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted) |
| 134996 | | - */ |
| 134997 | | - if( pTo->rCost<rCost |
| 134998 | | - || (pTo->rCost==rCost |
| 134999 | | - && (pTo->nRow<nOut |
| 135000 | | - || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted) |
| 135001 | | - ) |
| 135002 | | - ) |
| 135003 | | - ){ |
| 134420 | + ** pTo or if the candidate should be skipped */ |
| 134421 | + if( pTo->rCost<rCost || (pTo->rCost==rCost && pTo->nRow<=nOut) ){ |
| 135004 | 134422 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 135005 | 134423 | if( sqlite3WhereTrace&0x4 ){ |
| 135006 | 134424 | sqlite3DebugPrintf( |
| 135007 | | - "Skip %s cost=%-3d,%3d,%3d order=%c", |
| 135008 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 134425 | + "Skip %s cost=%-3d,%3d order=%c", |
| 134426 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, |
| 135009 | 134427 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 135010 | | - sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n", |
| 134428 | + sqlite3DebugPrintf(" vs %s cost=%-3d,%d order=%c\n", |
| 135011 | 134429 | wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, |
| 135012 | | - pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 134430 | + pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 135013 | 134431 | } |
| 135014 | 134432 | #endif |
| 135015 | 134433 | /* Discard the candidate path from further consideration */ |
| 135016 | 134434 | testcase( pTo->rCost==rCost ); |
| 135017 | 134435 | continue; |
| | @@ -135020,16 +134438,16 @@ |
| 135020 | 134438 | /* Control reaches here if the candidate path is better than the |
| 135021 | 134439 | ** pTo path. Replace pTo with the candidate. */ |
| 135022 | 134440 | #ifdef WHERETRACE_ENABLED /* 0x4 */ |
| 135023 | 134441 | if( sqlite3WhereTrace&0x4 ){ |
| 135024 | 134442 | sqlite3DebugPrintf( |
| 135025 | | - "Update %s cost=%-3d,%3d,%3d order=%c", |
| 135026 | | - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted, |
| 134443 | + "Update %s cost=%-3d,%3d order=%c", |
| 134444 | + wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, |
| 135027 | 134445 | isOrdered>=0 ? isOrdered+'0' : '?'); |
| 135028 | | - sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n", |
| 134446 | + sqlite3DebugPrintf(" was %s cost=%-3d,%3d order=%c\n", |
| 135029 | 134447 | wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, |
| 135030 | | - pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 134448 | + pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?'); |
| 135031 | 134449 | } |
| 135032 | 134450 | #endif |
| 135033 | 134451 | } |
| 135034 | 134452 | /* pWLoop is a winner. Add it to the set of best so far */ |
| 135035 | 134453 | pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf; |
| | @@ -135250,35 +134668,10 @@ |
| 135250 | 134668 | return 1; |
| 135251 | 134669 | } |
| 135252 | 134670 | return 0; |
| 135253 | 134671 | } |
| 135254 | 134672 | |
| 135255 | | -/* |
| 135256 | | -** Helper function for exprIsDeterministic(). |
| 135257 | | -*/ |
| 135258 | | -static int exprNodeIsDeterministic(Walker *pWalker, Expr *pExpr){ |
| 135259 | | - if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_ConstFunc)==0 ){ |
| 135260 | | - pWalker->eCode = 0; |
| 135261 | | - return WRC_Abort; |
| 135262 | | - } |
| 135263 | | - return WRC_Continue; |
| 135264 | | -} |
| 135265 | | - |
| 135266 | | -/* |
| 135267 | | -** Return true if the expression contains no non-deterministic SQL |
| 135268 | | -** functions. Do not consider non-deterministic SQL functions that are |
| 135269 | | -** part of sub-select statements. |
| 135270 | | -*/ |
| 135271 | | -static int exprIsDeterministic(Expr *p){ |
| 135272 | | - Walker w; |
| 135273 | | - memset(&w, 0, sizeof(w)); |
| 135274 | | - w.eCode = 1; |
| 135275 | | - w.xExprCallback = exprNodeIsDeterministic; |
| 135276 | | - sqlite3WalkExpr(&w, p); |
| 135277 | | - return w.eCode; |
| 135278 | | -} |
| 135279 | | - |
| 135280 | 134673 | /* |
| 135281 | 134674 | ** Generate the beginning of the loop used for WHERE clause processing. |
| 135282 | 134675 | ** The return value is a pointer to an opaque structure that contains |
| 135283 | 134676 | ** information needed to terminate the loop. Later, the calling routine |
| 135284 | 134677 | ** should invoke sqlite3WhereEnd() with the return value of this function |
| | @@ -135473,10 +134866,21 @@ |
| 135473 | 134866 | */ |
| 135474 | 134867 | initMaskSet(pMaskSet); |
| 135475 | 134868 | sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo); |
| 135476 | 134869 | sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND); |
| 135477 | 134870 | |
| 134871 | + /* Special case: a WHERE clause that is constant. Evaluate the |
| 134872 | + ** expression and either jump over all of the code or fall thru. |
| 134873 | + */ |
| 134874 | + for(ii=0; ii<sWLB.pWC->nTerm; ii++){ |
| 134875 | + if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){ |
| 134876 | + sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak, |
| 134877 | + SQLITE_JUMPIFNULL); |
| 134878 | + sWLB.pWC->a[ii].wtFlags |= TERM_CODED; |
| 134879 | + } |
| 134880 | + } |
| 134881 | + |
| 135478 | 134882 | /* Special case: No FROM clause |
| 135479 | 134883 | */ |
| 135480 | 134884 | if( nTabList==0 ){ |
| 135481 | 134885 | if( pOrderBy ) pWInfo->nOBSat = pOrderBy->nExpr; |
| 135482 | 134886 | if( wctrlFlags & WHERE_WANT_DISTINCT ){ |
| | @@ -135511,29 +134915,10 @@ |
| 135511 | 134915 | |
| 135512 | 134916 | /* Analyze all of the subexpressions. */ |
| 135513 | 134917 | sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC); |
| 135514 | 134918 | if( db->mallocFailed ) goto whereBeginError; |
| 135515 | 134919 | |
| 135516 | | - /* Special case: WHERE terms that do not refer to any tables in the join |
| 135517 | | - ** (constant expressions). Evaluate each such term, and jump over all the |
| 135518 | | - ** generated code if the result is not true. |
| 135519 | | - ** |
| 135520 | | - ** Do not do this if the expression contains non-deterministic functions |
| 135521 | | - ** that are not within a sub-select. This is not strictly required, but |
| 135522 | | - ** preserves SQLite's legacy behaviour in the following two cases: |
| 135523 | | - ** |
| 135524 | | - ** FROM ... WHERE random()>0; -- eval random() once per row |
| 135525 | | - ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall |
| 135526 | | - */ |
| 135527 | | - for(ii=0; ii<sWLB.pWC->nTerm; ii++){ |
| 135528 | | - WhereTerm *pT = &sWLB.pWC->a[ii]; |
| 135529 | | - if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){ |
| 135530 | | - sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL); |
| 135531 | | - pT->wtFlags |= TERM_CODED; |
| 135532 | | - } |
| 135533 | | - } |
| 135534 | | - |
| 135535 | 134920 | if( wctrlFlags & WHERE_WANT_DISTINCT ){ |
| 135536 | 134921 | if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ |
| 135537 | 134922 | /* The DISTINCT marking is pointless. Ignore it. */ |
| 135538 | 134923 | pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; |
| 135539 | 134924 | }else if( pOrderBy==0 ){ |
| | @@ -135566,11 +134951,11 @@ |
| 135566 | 134951 | WhereLoop *p; |
| 135567 | 134952 | int i; |
| 135568 | 134953 | static const char zLabel[] = "0123456789abcdefghijklmnopqrstuvwyxz" |
| 135569 | 134954 | "ABCDEFGHIJKLMNOPQRSTUVWYXZ"; |
| 135570 | 134955 | for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){ |
| 135571 | | - p->cId = zLabel[i%(sizeof(zLabel)-1)]; |
| 134956 | + p->cId = zLabel[i%sizeof(zLabel)]; |
| 135572 | 134957 | whereLoopPrint(p, sWLB.pWC); |
| 135573 | 134958 | } |
| 135574 | 134959 | } |
| 135575 | 134960 | #endif |
| 135576 | 134961 | |
| | @@ -136349,19 +135734,19 @@ |
| 136349 | 135734 | #define sqlite3ParserARG_PDECL ,Parse *pParse |
| 136350 | 135735 | #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse |
| 136351 | 135736 | #define sqlite3ParserARG_STORE yypParser->pParse = pParse |
| 136352 | 135737 | #define YYFALLBACK 1 |
| 136353 | 135738 | #define YYNSTATE 456 |
| 136354 | | -#define YYNRULE 331 |
| 135739 | +#define YYNRULE 332 |
| 136355 | 135740 | #define YY_MAX_SHIFT 455 |
| 136356 | | -#define YY_MIN_SHIFTREDUCE 667 |
| 136357 | | -#define YY_MAX_SHIFTREDUCE 997 |
| 136358 | | -#define YY_MIN_REDUCE 998 |
| 136359 | | -#define YY_MAX_REDUCE 1328 |
| 136360 | | -#define YY_ERROR_ACTION 1329 |
| 136361 | | -#define YY_ACCEPT_ACTION 1330 |
| 136362 | | -#define YY_NO_ACTION 1331 |
| 135741 | +#define YY_MIN_SHIFTREDUCE 668 |
| 135742 | +#define YY_MAX_SHIFTREDUCE 999 |
| 135743 | +#define YY_MIN_REDUCE 1000 |
| 135744 | +#define YY_MAX_REDUCE 1331 |
| 135745 | +#define YY_ERROR_ACTION 1332 |
| 135746 | +#define YY_ACCEPT_ACTION 1333 |
| 135747 | +#define YY_NO_ACTION 1334 |
| 136363 | 135748 | /************* End control #defines *******************************************/ |
| 136364 | 135749 | |
| 136365 | 135750 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 136366 | 135751 | ** otherwise. |
| 136367 | 135752 | ** |
| | @@ -136431,167 +135816,167 @@ |
| 136431 | 135816 | ** yy_default[] Default action for each state. |
| 136432 | 135817 | ** |
| 136433 | 135818 | *********** Begin parsing tables **********************************************/ |
| 136434 | 135819 | #define YY_ACTTAB_COUNT (1566) |
| 136435 | 135820 | static const YYACTIONTYPE yy_action[] = { |
| 136436 | | - /* 0 */ 325, 411, 343, 751, 751, 203, 944, 354, 974, 98, |
| 135821 | + /* 0 */ 325, 411, 343, 752, 752, 203, 946, 354, 976, 98, |
| 136437 | 135822 | /* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95, |
| 136438 | | - /* 20 */ 94, 94, 94, 93, 351, 1330, 155, 155, 2, 812, |
| 136439 | | - /* 30 */ 976, 976, 98, 98, 98, 98, 20, 96, 96, 96, |
| 135823 | + /* 20 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 813, |
| 135824 | + /* 30 */ 978, 978, 98, 98, 98, 98, 20, 96, 96, 96, |
| 136440 | 135825 | /* 40 */ 96, 95, 95, 94, 94, 94, 93, 351, 92, 89, |
| 136441 | | - /* 50 */ 178, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 135826 | + /* 50 */ 178, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136442 | 135827 | /* 60 */ 98, 98, 98, 98, 351, 96, 96, 96, 96, 95, |
| 136443 | | - /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 974, 262, |
| 136444 | | - /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 790, |
| 136445 | | - /* 90 */ 242, 412, 21, 955, 379, 280, 93, 351, 791, 95, |
| 136446 | | - /* 100 */ 95, 94, 94, 94, 93, 351, 976, 976, 96, 96, |
| 136447 | | - /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 812, |
| 136448 | | - /* 120 */ 329, 242, 412, 1242, 831, 1242, 132, 99, 100, 90, |
| 136449 | | - /* 130 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98, |
| 135828 | + /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 976, 262, |
| 135829 | + /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 791, |
| 135830 | + /* 90 */ 242, 412, 21, 957, 379, 280, 93, 351, 792, 95, |
| 135831 | + /* 100 */ 95, 94, 94, 94, 93, 351, 978, 978, 96, 96, |
| 135832 | + /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 813, |
| 135833 | + /* 120 */ 329, 242, 412, 913, 832, 913, 132, 99, 100, 90, |
| 135834 | + /* 130 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98, |
| 136450 | 135835 | /* 140 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94, |
| 136451 | | - /* 150 */ 93, 351, 325, 824, 349, 348, 120, 818, 120, 75, |
| 136452 | | - /* 160 */ 52, 52, 955, 956, 957, 1090, 982, 146, 361, 262, |
| 136453 | | - /* 170 */ 370, 261, 955, 980, 959, 981, 92, 89, 178, 371, |
| 136454 | | - /* 180 */ 230, 371, 976, 976, 1147, 361, 360, 101, 823, 823, |
| 136455 | | - /* 190 */ 825, 384, 24, 1293, 381, 428, 413, 369, 983, 380, |
| 136456 | | - /* 200 */ 983, 1038, 325, 99, 100, 90, 852, 855, 844, 844, |
| 135836 | + /* 150 */ 93, 351, 325, 825, 349, 348, 120, 819, 120, 75, |
| 135837 | + /* 160 */ 52, 52, 957, 958, 959, 760, 984, 146, 361, 262, |
| 135838 | + /* 170 */ 370, 261, 957, 982, 961, 983, 92, 89, 178, 371, |
| 135839 | + /* 180 */ 230, 371, 978, 978, 817, 361, 360, 101, 824, 824, |
| 135840 | + /* 190 */ 826, 384, 24, 964, 381, 428, 413, 369, 985, 380, |
| 135841 | + /* 200 */ 985, 708, 325, 99, 100, 90, 853, 856, 845, 845, |
| 136457 | 135842 | /* 210 */ 97, 97, 98, 98, 98, 98, 373, 96, 96, 96, |
| 136458 | | - /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 955, 132, |
| 136459 | | - /* 230 */ 895, 450, 976, 976, 895, 60, 94, 94, 94, 93, |
| 136460 | | - /* 240 */ 351, 955, 956, 957, 959, 103, 361, 955, 385, 334, |
| 136461 | | - /* 250 */ 701, 52, 52, 99, 100, 90, 852, 855, 844, 844, |
| 136462 | | - /* 260 */ 97, 97, 98, 98, 98, 98, 1028, 96, 96, 96, |
| 135843 | + /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 957, 132, |
| 135844 | + /* 230 */ 897, 450, 978, 978, 896, 60, 94, 94, 94, 93, |
| 135845 | + /* 240 */ 351, 957, 958, 959, 961, 103, 361, 957, 385, 334, |
| 135846 | + /* 250 */ 702, 52, 52, 99, 100, 90, 853, 856, 845, 845, |
| 135847 | + /* 260 */ 97, 97, 98, 98, 98, 98, 698, 96, 96, 96, |
| 136463 | 135848 | /* 270 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 455, |
| 136464 | | - /* 280 */ 1000, 450, 227, 61, 157, 243, 344, 114, 1031, 1218, |
| 136465 | | - /* 290 */ 147, 831, 955, 373, 1077, 955, 320, 955, 956, 957, |
| 136466 | | - /* 300 */ 194, 10, 10, 402, 399, 398, 1218, 1220, 976, 976, |
| 136467 | | - /* 310 */ 761, 171, 170, 157, 397, 337, 955, 956, 957, 701, |
| 136468 | | - /* 320 */ 824, 310, 153, 955, 818, 321, 82, 23, 80, 99, |
| 136469 | | - /* 330 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 136470 | | - /* 340 */ 98, 98, 893, 96, 96, 96, 96, 95, 95, 94, |
| 136471 | | - /* 350 */ 94, 94, 93, 351, 325, 823, 823, 825, 277, 231, |
| 136472 | | - /* 360 */ 300, 955, 956, 957, 955, 956, 957, 1218, 194, 25, |
| 136473 | | - /* 370 */ 450, 402, 399, 398, 955, 355, 300, 450, 955, 74, |
| 136474 | | - /* 380 */ 450, 1, 397, 132, 976, 976, 955, 224, 224, 812, |
| 136475 | | - /* 390 */ 10, 10, 955, 956, 957, 1297, 132, 52, 52, 415, |
| 136476 | | - /* 400 */ 52, 52, 1069, 1069, 339, 99, 100, 90, 852, 855, |
| 136477 | | - /* 410 */ 844, 844, 97, 97, 98, 98, 98, 98, 1120, 96, |
| 135849 | + /* 280 */ 670, 450, 227, 61, 157, 243, 344, 114, 701, 888, |
| 135850 | + /* 290 */ 147, 832, 957, 373, 747, 957, 320, 957, 958, 959, |
| 135851 | + /* 300 */ 194, 10, 10, 402, 399, 398, 888, 890, 978, 978, |
| 135852 | + /* 310 */ 762, 171, 170, 157, 397, 337, 957, 958, 959, 702, |
| 135853 | + /* 320 */ 825, 310, 153, 957, 819, 321, 82, 23, 80, 99, |
| 135854 | + /* 330 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 135855 | + /* 340 */ 98, 98, 894, 96, 96, 96, 96, 95, 95, 94, |
| 135856 | + /* 350 */ 94, 94, 93, 351, 325, 824, 824, 826, 277, 231, |
| 135857 | + /* 360 */ 300, 957, 958, 959, 957, 958, 959, 888, 194, 25, |
| 135858 | + /* 370 */ 450, 402, 399, 398, 957, 355, 300, 450, 957, 74, |
| 135859 | + /* 380 */ 450, 1, 397, 132, 978, 978, 957, 224, 224, 813, |
| 135860 | + /* 390 */ 10, 10, 957, 958, 959, 968, 132, 52, 52, 415, |
| 135861 | + /* 400 */ 52, 52, 739, 739, 339, 99, 100, 90, 853, 856, |
| 135862 | + /* 410 */ 845, 845, 97, 97, 98, 98, 98, 98, 790, 96, |
| 136478 | 135863 | /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 136479 | | - /* 430 */ 325, 1119, 428, 418, 705, 428, 427, 1267, 1267, 262, |
| 136480 | | - /* 440 */ 370, 261, 955, 955, 956, 957, 756, 955, 956, 957, |
| 136481 | | - /* 450 */ 450, 755, 450, 1064, 1043, 955, 956, 957, 443, 710, |
| 136482 | | - /* 460 */ 976, 976, 1064, 394, 92, 89, 178, 447, 447, 447, |
| 136483 | | - /* 470 */ 51, 51, 52, 52, 439, 777, 1030, 92, 89, 178, |
| 136484 | | - /* 480 */ 172, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 135864 | + /* 430 */ 325, 789, 428, 418, 706, 428, 427, 1270, 1270, 262, |
| 135865 | + /* 440 */ 370, 261, 957, 957, 958, 959, 757, 957, 958, 959, |
| 135866 | + /* 450 */ 450, 756, 450, 734, 713, 957, 958, 959, 443, 711, |
| 135867 | + /* 460 */ 978, 978, 734, 394, 92, 89, 178, 447, 447, 447, |
| 135868 | + /* 470 */ 51, 51, 52, 52, 439, 778, 700, 92, 89, 178, |
| 135869 | + /* 480 */ 172, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136485 | 135870 | /* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95, |
| 136486 | | - /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 914, |
| 136487 | | - /* 510 */ 698, 955, 956, 957, 92, 89, 178, 224, 224, 157, |
| 136488 | | - /* 520 */ 241, 221, 419, 299, 775, 915, 416, 375, 450, 415, |
| 136489 | | - /* 530 */ 58, 324, 1067, 1067, 1249, 379, 976, 976, 379, 776, |
| 136490 | | - /* 540 */ 449, 916, 363, 739, 296, 685, 9, 9, 52, 52, |
| 136491 | | - /* 550 */ 234, 330, 234, 256, 417, 740, 280, 99, 100, 90, |
| 136492 | | - /* 560 */ 852, 855, 844, 844, 97, 97, 98, 98, 98, 98, |
| 135871 | + /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 916, |
| 135872 | + /* 510 */ 699, 957, 958, 959, 92, 89, 178, 224, 224, 157, |
| 135873 | + /* 520 */ 241, 221, 419, 299, 776, 917, 416, 375, 450, 415, |
| 135874 | + /* 530 */ 58, 324, 737, 737, 920, 379, 978, 978, 379, 777, |
| 135875 | + /* 540 */ 449, 918, 363, 740, 296, 686, 9, 9, 52, 52, |
| 135876 | + /* 550 */ 234, 330, 234, 256, 417, 741, 280, 99, 100, 90, |
| 135877 | + /* 560 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98, |
| 136493 | 135878 | /* 570 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94, |
| 136494 | | - /* 580 */ 93, 351, 325, 423, 72, 450, 832, 120, 368, 450, |
| 136495 | | - /* 590 */ 10, 10, 5, 301, 203, 450, 177, 974, 253, 420, |
| 136496 | | - /* 600 */ 255, 775, 200, 175, 233, 10, 10, 841, 841, 36, |
| 136497 | | - /* 610 */ 36, 1296, 976, 976, 728, 37, 37, 349, 348, 425, |
| 136498 | | - /* 620 */ 203, 260, 775, 974, 232, 935, 1323, 875, 338, 1323, |
| 136499 | | - /* 630 */ 422, 853, 856, 99, 100, 90, 852, 855, 844, 844, |
| 135879 | + /* 580 */ 93, 351, 325, 423, 72, 450, 833, 120, 368, 450, |
| 135880 | + /* 590 */ 10, 10, 5, 301, 203, 450, 177, 976, 253, 420, |
| 135881 | + /* 600 */ 255, 776, 200, 175, 233, 10, 10, 842, 842, 36, |
| 135882 | + /* 610 */ 36, 1299, 978, 978, 729, 37, 37, 349, 348, 425, |
| 135883 | + /* 620 */ 203, 260, 776, 976, 232, 937, 1326, 876, 338, 1326, |
| 135884 | + /* 630 */ 422, 854, 857, 99, 100, 90, 853, 856, 845, 845, |
| 136500 | 135885 | /* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96, |
| 136501 | | - /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 845, |
| 136502 | | - /* 660 */ 450, 983, 817, 983, 1207, 450, 914, 974, 719, 350, |
| 136503 | | - /* 670 */ 350, 350, 933, 177, 450, 935, 1324, 254, 198, 1324, |
| 136504 | | - /* 680 */ 12, 12, 915, 403, 450, 27, 27, 250, 976, 976, |
| 136505 | | - /* 690 */ 118, 720, 162, 974, 38, 38, 268, 176, 916, 775, |
| 136506 | | - /* 700 */ 433, 1272, 944, 354, 39, 39, 317, 996, 325, 99, |
| 136507 | | - /* 710 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 136508 | | - /* 720 */ 98, 98, 933, 96, 96, 96, 96, 95, 95, 94, |
| 136509 | | - /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 976, 976, |
| 136510 | | - /* 740 */ 1047, 317, 934, 341, 898, 898, 387, 672, 673, 674, |
| 136511 | | - /* 750 */ 275, 1325, 318, 997, 40, 40, 41, 41, 268, 99, |
| 136512 | | - /* 760 */ 100, 90, 852, 855, 844, 844, 97, 97, 98, 98, |
| 135886 | + /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 846, |
| 135887 | + /* 660 */ 450, 985, 818, 985, 1209, 450, 916, 976, 720, 350, |
| 135888 | + /* 670 */ 350, 350, 935, 177, 450, 937, 1327, 254, 198, 1327, |
| 135889 | + /* 680 */ 12, 12, 917, 403, 450, 27, 27, 250, 978, 978, |
| 135890 | + /* 690 */ 118, 721, 162, 976, 38, 38, 268, 176, 918, 776, |
| 135891 | + /* 700 */ 433, 1275, 946, 354, 39, 39, 317, 998, 325, 99, |
| 135892 | + /* 710 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 135893 | + /* 720 */ 98, 98, 935, 96, 96, 96, 96, 95, 95, 94, |
| 135894 | + /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 978, 978, |
| 135895 | + /* 740 */ 717, 317, 936, 341, 900, 900, 387, 673, 674, 675, |
| 135896 | + /* 750 */ 275, 996, 318, 999, 40, 40, 41, 41, 268, 99, |
| 135897 | + /* 760 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98, |
| 136513 | 135898 | /* 770 */ 98, 98, 450, 96, 96, 96, 96, 95, 95, 94, |
| 136514 | | - /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 997, 450, |
| 136515 | | - /* 790 */ 1022, 331, 42, 42, 790, 270, 450, 273, 450, 228, |
| 136516 | | - /* 800 */ 450, 298, 450, 791, 450, 28, 28, 29, 29, 31, |
| 136517 | | - /* 810 */ 31, 450, 1147, 450, 976, 976, 43, 43, 44, 44, |
| 136518 | | - /* 820 */ 45, 45, 11, 11, 46, 46, 892, 78, 892, 268, |
| 136519 | | - /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 852, 855, |
| 136520 | | - /* 840 */ 844, 844, 97, 97, 98, 98, 98, 98, 450, 96, |
| 135899 | + /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 999, 450, |
| 135900 | + /* 790 */ 692, 331, 42, 42, 791, 270, 450, 273, 450, 228, |
| 135901 | + /* 800 */ 450, 298, 450, 792, 450, 28, 28, 29, 29, 31, |
| 135902 | + /* 810 */ 31, 450, 817, 450, 978, 978, 43, 43, 44, 44, |
| 135903 | + /* 820 */ 45, 45, 11, 11, 46, 46, 893, 78, 893, 268, |
| 135904 | + /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 853, 856, |
| 135905 | + /* 840 */ 845, 845, 97, 97, 98, 98, 98, 98, 450, 96, |
| 136521 | 135906 | /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 136522 | | - /* 860 */ 325, 450, 117, 450, 1079, 158, 450, 695, 48, 48, |
| 136523 | | - /* 870 */ 229, 1248, 450, 1257, 450, 415, 450, 335, 450, 245, |
| 136524 | | - /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 1147, |
| 136525 | | - /* 890 */ 976, 976, 34, 34, 122, 122, 123, 123, 124, 124, |
| 135907 | + /* 860 */ 325, 450, 117, 450, 749, 158, 450, 696, 48, 48, |
| 135908 | + /* 870 */ 229, 919, 450, 928, 450, 415, 450, 335, 450, 245, |
| 135909 | + /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 817, |
| 135910 | + /* 890 */ 978, 978, 34, 34, 122, 122, 123, 123, 124, 124, |
| 136526 | 135911 | /* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195, |
| 136527 | | - /* 910 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 135912 | + /* 910 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136528 | 135913 | /* 920 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136529 | | - /* 930 */ 95, 94, 94, 94, 93, 351, 450, 695, 450, 1147, |
| 136530 | | - /* 940 */ 976, 976, 973, 1214, 106, 106, 268, 1216, 268, 1273, |
| 136531 | | - /* 950 */ 2, 891, 268, 891, 336, 1046, 53, 53, 107, 107, |
| 136532 | | - /* 960 */ 325, 99, 100, 90, 852, 855, 844, 844, 97, 97, |
| 135914 | + /* 930 */ 95, 94, 94, 94, 93, 351, 450, 696, 450, 817, |
| 135915 | + /* 940 */ 978, 978, 975, 884, 106, 106, 268, 886, 268, 944, |
| 135916 | + /* 950 */ 2, 892, 268, 892, 336, 716, 53, 53, 107, 107, |
| 135917 | + /* 960 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136533 | 135918 | /* 970 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136534 | | - /* 980 */ 95, 94, 94, 94, 93, 351, 450, 1076, 450, 1072, |
| 136535 | | - /* 990 */ 976, 976, 1045, 267, 108, 108, 446, 331, 332, 133, |
| 136536 | | - /* 1000 */ 223, 175, 301, 225, 386, 1262, 104, 104, 121, 121, |
| 136537 | | - /* 1010 */ 325, 99, 88, 90, 852, 855, 844, 844, 97, 97, |
| 136538 | | - /* 1020 */ 98, 98, 98, 98, 1147, 96, 96, 96, 96, 95, |
| 135919 | + /* 980 */ 95, 94, 94, 94, 93, 351, 450, 746, 450, 742, |
| 135920 | + /* 990 */ 978, 978, 715, 267, 108, 108, 446, 331, 332, 133, |
| 135921 | + /* 1000 */ 223, 175, 301, 225, 386, 933, 104, 104, 121, 121, |
| 135922 | + /* 1010 */ 325, 99, 88, 90, 853, 856, 845, 845, 97, 97, |
| 135923 | + /* 1020 */ 98, 98, 98, 98, 817, 96, 96, 96, 96, 95, |
| 136539 | 135924 | /* 1030 */ 95, 94, 94, 94, 93, 351, 450, 347, 450, 167, |
| 136540 | | - /* 1040 */ 976, 976, 930, 814, 372, 319, 202, 202, 374, 263, |
| 136541 | | - /* 1050 */ 395, 202, 74, 208, 725, 726, 119, 119, 112, 112, |
| 136542 | | - /* 1060 */ 325, 407, 100, 90, 852, 855, 844, 844, 97, 97, |
| 135925 | + /* 1040 */ 978, 978, 932, 815, 372, 319, 202, 202, 374, 263, |
| 135926 | + /* 1050 */ 395, 202, 74, 208, 726, 727, 119, 119, 112, 112, |
| 135927 | + /* 1060 */ 325, 407, 100, 90, 853, 856, 845, 845, 97, 97, |
| 136543 | 135928 | /* 1070 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95, |
| 136544 | | - /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 756, 450, 345, |
| 136545 | | - /* 1090 */ 976, 976, 755, 278, 111, 111, 74, 718, 717, 708, |
| 136546 | | - /* 1100 */ 286, 882, 753, 1286, 257, 77, 109, 109, 110, 110, |
| 136547 | | - /* 1110 */ 1237, 285, 1140, 90, 852, 855, 844, 844, 97, 97, |
| 136548 | | - /* 1120 */ 98, 98, 98, 98, 1240, 96, 96, 96, 96, 95, |
| 135929 | + /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 757, 450, 345, |
| 135930 | + /* 1090 */ 978, 978, 756, 278, 111, 111, 74, 719, 718, 709, |
| 135931 | + /* 1100 */ 286, 883, 754, 1289, 257, 77, 109, 109, 110, 110, |
| 135932 | + /* 1110 */ 908, 285, 810, 90, 853, 856, 845, 845, 97, 97, |
| 135933 | + /* 1120 */ 98, 98, 98, 98, 911, 96, 96, 96, 96, 95, |
| 136549 | 135934 | /* 1130 */ 95, 94, 94, 94, 93, 351, 86, 445, 450, 3, |
| 136550 | | - /* 1140 */ 1200, 450, 1075, 132, 352, 120, 1019, 86, 445, 784, |
| 136551 | | - /* 1150 */ 3, 1097, 202, 377, 448, 352, 1236, 120, 55, 55, |
| 136552 | | - /* 1160 */ 450, 57, 57, 827, 878, 448, 450, 208, 450, 708, |
| 136553 | | - /* 1170 */ 450, 882, 237, 434, 436, 120, 440, 429, 362, 120, |
| 136554 | | - /* 1180 */ 54, 54, 132, 450, 434, 831, 52, 52, 26, 26, |
| 136555 | | - /* 1190 */ 30, 30, 382, 132, 409, 444, 831, 693, 264, 390, |
| 135935 | + /* 1140 */ 1202, 450, 745, 132, 352, 120, 689, 86, 445, 785, |
| 135936 | + /* 1150 */ 3, 767, 202, 377, 448, 352, 907, 120, 55, 55, |
| 135937 | + /* 1160 */ 450, 57, 57, 828, 879, 448, 450, 208, 450, 709, |
| 135938 | + /* 1170 */ 450, 883, 237, 434, 436, 120, 440, 429, 362, 120, |
| 135939 | + /* 1180 */ 54, 54, 132, 450, 434, 832, 52, 52, 26, 26, |
| 135940 | + /* 1190 */ 30, 30, 382, 132, 409, 444, 832, 694, 264, 390, |
| 136556 | 135941 | /* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120, |
| 136557 | | - /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 818, 1060, |
| 136558 | | - /* 1220 */ 1044, 428, 430, 85, 352, 452, 451, 120, 120, 818, |
| 136559 | | - /* 1230 */ 378, 218, 281, 827, 1113, 1146, 86, 445, 410, 3, |
| 136560 | | - /* 1240 */ 1093, 1104, 431, 432, 352, 302, 303, 1153, 1027, 823, |
| 136561 | | - /* 1250 */ 823, 825, 826, 19, 448, 1021, 1010, 1009, 1011, 1280, |
| 136562 | | - /* 1260 */ 823, 823, 825, 826, 19, 289, 159, 291, 293, 7, |
| 136563 | | - /* 1270 */ 316, 173, 259, 434, 1135, 364, 252, 1239, 376, 1043, |
| 136564 | | - /* 1280 */ 295, 435, 168, 991, 400, 831, 284, 1211, 1210, 205, |
| 136565 | | - /* 1290 */ 1283, 308, 1256, 86, 445, 988, 3, 1254, 333, 144, |
| 136566 | | - /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 760, 137, 366, |
| 136567 | | - /* 1310 */ 1132, 448, 85, 352, 452, 451, 139, 226, 818, 140, |
| 136568 | | - /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 682, |
| 136569 | | - /* 1330 */ 434, 185, 141, 1241, 142, 160, 148, 1142, 1205, 383, |
| 136570 | | - /* 1340 */ 189, 67, 831, 180, 389, 248, 1225, 1105, 219, 823, |
| 136571 | | - /* 1350 */ 823, 825, 826, 19, 247, 190, 266, 154, 391, 271, |
| 136572 | | - /* 1360 */ 191, 192, 83, 84, 1012, 406, 1063, 182, 322, 85, |
| 136573 | | - /* 1370 */ 352, 452, 451, 1062, 183, 818, 342, 132, 181, 710, |
| 136574 | | - /* 1380 */ 1061, 421, 76, 445, 1035, 3, 323, 1034, 283, 1054, |
| 136575 | | - /* 1390 */ 352, 1101, 1033, 1295, 1053, 71, 204, 6, 288, 290, |
| 136576 | | - /* 1400 */ 448, 1102, 1100, 1099, 79, 292, 823, 823, 825, 826, |
| 136577 | | - /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 1191, 1083, 434, |
| 135942 | + /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 819, 730, |
| 135943 | + /* 1220 */ 714, 428, 430, 85, 352, 452, 451, 120, 120, 819, |
| 135944 | + /* 1230 */ 378, 218, 281, 828, 783, 816, 86, 445, 410, 3, |
| 135945 | + /* 1240 */ 763, 774, 431, 432, 352, 302, 303, 823, 697, 824, |
| 135946 | + /* 1250 */ 824, 826, 827, 19, 448, 691, 680, 679, 681, 951, |
| 135947 | + /* 1260 */ 824, 824, 826, 827, 19, 289, 159, 291, 293, 7, |
| 135948 | + /* 1270 */ 316, 173, 259, 434, 805, 364, 252, 910, 376, 713, |
| 135949 | + /* 1280 */ 295, 435, 168, 993, 400, 832, 284, 881, 880, 205, |
| 135950 | + /* 1290 */ 954, 308, 927, 86, 445, 990, 3, 925, 333, 144, |
| 135951 | + /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 761, 137, 366, |
| 135952 | + /* 1310 */ 802, 448, 85, 352, 452, 451, 139, 226, 819, 140, |
| 135953 | + /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 683, |
| 135954 | + /* 1330 */ 434, 185, 141, 912, 142, 160, 148, 812, 875, 383, |
| 135955 | + /* 1340 */ 189, 67, 832, 180, 389, 248, 895, 775, 219, 824, |
| 135956 | + /* 1350 */ 824, 826, 827, 19, 247, 190, 266, 154, 391, 271, |
| 135957 | + /* 1360 */ 191, 192, 83, 84, 682, 406, 733, 182, 322, 85, |
| 135958 | + /* 1370 */ 352, 452, 451, 732, 183, 819, 342, 132, 181, 711, |
| 135959 | + /* 1380 */ 731, 421, 76, 445, 705, 3, 323, 704, 283, 724, |
| 135960 | + /* 1390 */ 352, 771, 703, 966, 723, 71, 204, 6, 288, 290, |
| 135961 | + /* 1400 */ 448, 772, 770, 769, 79, 292, 824, 824, 826, 827, |
| 135962 | + /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 861, 753, 434, |
| 136578 | 135963 | /* 1420 */ 238, 426, 73, 305, 239, 304, 326, 240, 424, 306, |
| 136579 | | - /* 1430 */ 307, 831, 213, 1018, 22, 950, 453, 214, 216, 217, |
| 136580 | | - /* 1440 */ 454, 1007, 115, 1006, 1001, 125, 126, 235, 127, 668, |
| 135964 | + /* 1430 */ 307, 832, 213, 688, 22, 952, 453, 214, 216, 217, |
| 135965 | + /* 1440 */ 454, 677, 115, 676, 671, 125, 126, 235, 127, 669, |
| 136581 | 135966 | /* 1450 */ 327, 83, 84, 359, 353, 244, 166, 328, 85, 352, |
| 136582 | | - /* 1460 */ 452, 451, 134, 179, 818, 357, 113, 890, 810, 888, |
| 136583 | | - /* 1470 */ 136, 128, 138, 742, 258, 184, 904, 143, 145, 63, |
| 136584 | | - /* 1480 */ 64, 65, 66, 129, 907, 903, 187, 186, 8, 13, |
| 136585 | | - /* 1490 */ 188, 265, 896, 149, 202, 823, 823, 825, 826, 19, |
| 136586 | | - /* 1500 */ 388, 985, 150, 161, 285, 684, 392, 396, 151, 721, |
| 136587 | | - /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 830, 829, |
| 136588 | | - /* 1520 */ 131, 858, 750, 70, 16, 414, 754, 4, 783, 220, |
| 136589 | | - /* 1530 */ 222, 174, 152, 437, 778, 201, 17, 77, 74, 18, |
| 136590 | | - /* 1540 */ 873, 859, 857, 913, 862, 912, 207, 206, 939, 163, |
| 136591 | | - /* 1550 */ 210, 940, 209, 164, 441, 861, 165, 211, 828, 694, |
| 136592 | | - /* 1560 */ 87, 312, 309, 945, 1288, 1287, |
| 135967 | + /* 1460 */ 452, 451, 134, 179, 819, 357, 113, 891, 811, 889, |
| 135968 | + /* 1470 */ 136, 128, 138, 743, 258, 184, 906, 143, 145, 63, |
| 135969 | + /* 1480 */ 64, 65, 66, 129, 909, 905, 187, 186, 8, 13, |
| 135970 | + /* 1490 */ 188, 265, 898, 149, 202, 824, 824, 826, 827, 19, |
| 135971 | + /* 1500 */ 388, 987, 150, 161, 285, 685, 392, 396, 151, 722, |
| 135972 | + /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 831, 830, |
| 135973 | + /* 1520 */ 131, 859, 751, 70, 16, 414, 755, 4, 784, 220, |
| 135974 | + /* 1530 */ 222, 174, 152, 437, 779, 201, 17, 77, 74, 18, |
| 135975 | + /* 1540 */ 874, 860, 858, 915, 863, 914, 207, 206, 941, 163, |
| 135976 | + /* 1550 */ 210, 942, 209, 164, 441, 862, 165, 211, 829, 695, |
| 135977 | + /* 1560 */ 87, 312, 309, 947, 1291, 1290, |
| 136593 | 135978 | }; |
| 136594 | 135979 | static const YYCODETYPE yy_lookahead[] = { |
| 136595 | 135980 | /* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79, |
| 136596 | 135981 | /* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, |
| 136597 | 135982 | /* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58, |
| | @@ -136840,56 +136225,56 @@ |
| 136840 | 136225 | /* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271, |
| 136841 | 136226 | /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1293, 1201, 1208, 1216, |
| 136842 | 136227 | /* 320 */ 1280, 1281, 1264, 1269, 1283, |
| 136843 | 136228 | }; |
| 136844 | 136229 | static const YYACTIONTYPE yy_default[] = { |
| 136845 | | - /* 0 */ 1277, 1267, 1267, 1267, 1200, 1200, 1200, 1200, 1267, 1094, |
| 136846 | | - /* 10 */ 1123, 1123, 1251, 1329, 1329, 1329, 1329, 1329, 1329, 1199, |
| 136847 | | - /* 20 */ 1329, 1329, 1329, 1329, 1267, 1098, 1129, 1329, 1329, 1329, |
| 136848 | | - /* 30 */ 1329, 1201, 1202, 1329, 1329, 1329, 1250, 1252, 1139, 1138, |
| 136849 | | - /* 40 */ 1137, 1136, 1233, 1110, 1134, 1127, 1131, 1201, 1195, 1196, |
| 136850 | | - /* 50 */ 1194, 1198, 1202, 1329, 1130, 1165, 1179, 1164, 1329, 1329, |
| 136851 | | - /* 60 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136852 | | - /* 70 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136853 | | - /* 80 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136854 | | - /* 90 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136855 | | - /* 100 */ 1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1167, |
| 136856 | | - /* 110 */ 1166, 1168, 1169, 1329, 1017, 1065, 1329, 1329, 1329, 1170, |
| 136857 | | - /* 120 */ 1329, 1171, 1182, 1181, 1180, 1258, 1285, 1284, 1329, 1329, |
| 136858 | | - /* 130 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136859 | | - /* 140 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136860 | | - /* 150 */ 1329, 1329, 1329, 1329, 1329, 1277, 1267, 1023, 1023, 1329, |
| 136861 | | - /* 160 */ 1267, 1267, 1267, 1267, 1267, 1267, 1263, 1098, 1089, 1329, |
| 136862 | | - /* 170 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136863 | | - /* 180 */ 1255, 1253, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136864 | | - /* 190 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136865 | | - /* 200 */ 1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329, |
| 136866 | | - /* 210 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1279, 1329, 1228, |
| 136867 | | - /* 220 */ 1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112, |
| 136868 | | - /* 230 */ 1318, 1133, 1318, 1040, 1299, 1037, 1123, 1112, 1197, 1123, |
| 136869 | | - /* 240 */ 1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103, |
| 136870 | | - /* 250 */ 1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133, |
| 136871 | | - /* 260 */ 1144, 1068, 1068, 1133, 1103, 1014, 1232, 1315, 1103, 1103, |
| 136872 | | - /* 270 */ 1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066, |
| 136873 | | - /* 280 */ 1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111, |
| 136874 | | - /* 290 */ 1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329, |
| 136875 | | - /* 300 */ 1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020, |
| 136876 | | - /* 310 */ 1058, 1282, 1282, 1278, 1278, 1278, 1278, 1326, 1326, 1263, |
| 136877 | | - /* 320 */ 1294, 1294, 1042, 1042, 1294, 1329, 1329, 1329, 1329, 1329, |
| 136878 | | - /* 330 */ 1329, 1289, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136879 | | - /* 340 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136880 | | - /* 350 */ 1329, 1329, 1150, 1329, 998, 1260, 1329, 1329, 1259, 1329, |
| 136881 | | - /* 360 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136882 | | - /* 370 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317, |
| 136883 | | - /* 380 */ 1329, 1329, 1329, 1329, 1329, 1329, 1231, 1230, 1329, 1329, |
| 136884 | | - /* 390 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136885 | | - /* 400 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 136886 | | - /* 410 */ 1329, 1080, 1329, 1329, 1329, 1303, 1329, 1329, 1329, 1329, |
| 136887 | | - /* 420 */ 1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329, |
| 136888 | | - /* 430 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1269, |
| 136889 | | - /* 440 */ 1329, 1329, 1329, 1268, 1329, 1329, 1329, 1329, 1329, 1152, |
| 136890 | | - /* 450 */ 1329, 1151, 1155, 1329, 1008, 1329, |
| 136230 | + /* 0 */ 1280, 1270, 1270, 1270, 1202, 1202, 1202, 1202, 1270, 1096, |
| 136231 | + /* 10 */ 1125, 1125, 1254, 1332, 1332, 1332, 1332, 1332, 1332, 1201, |
| 136232 | + /* 20 */ 1332, 1332, 1332, 1332, 1270, 1100, 1131, 1332, 1332, 1332, |
| 136233 | + /* 30 */ 1332, 1203, 1204, 1332, 1332, 1332, 1253, 1255, 1141, 1140, |
| 136234 | + /* 40 */ 1139, 1138, 1236, 1112, 1136, 1129, 1133, 1203, 1197, 1198, |
| 136235 | + /* 50 */ 1196, 1200, 1204, 1332, 1132, 1167, 1181, 1166, 1332, 1332, |
| 136236 | + /* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136237 | + /* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136238 | + /* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136239 | + /* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136240 | + /* 100 */ 1332, 1332, 1332, 1332, 1175, 1180, 1187, 1179, 1176, 1169, |
| 136241 | + /* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172, |
| 136242 | + /* 120 */ 1332, 1173, 1184, 1183, 1182, 1261, 1288, 1287, 1332, 1332, |
| 136243 | + /* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136244 | + /* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136245 | + /* 150 */ 1332, 1332, 1332, 1332, 1332, 1280, 1270, 1025, 1025, 1332, |
| 136246 | + /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1266, 1100, 1091, 1332, |
| 136247 | + /* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136248 | + /* 180 */ 1258, 1256, 1332, 1217, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136249 | + /* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136250 | + /* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332, |
| 136251 | + /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1282, 1332, 1231, |
| 136252 | + /* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114, |
| 136253 | + /* 230 */ 1321, 1135, 1321, 1042, 1302, 1039, 1125, 1114, 1199, 1125, |
| 136254 | + /* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105, |
| 136255 | + /* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135, |
| 136256 | + /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1235, 1318, 1105, 1105, |
| 136257 | + /* 270 */ 1016, 1210, 1105, 1016, 1105, 1016, 1210, 1068, 1068, 1068, |
| 136258 | + /* 280 */ 1057, 1210, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113, |
| 136259 | + /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1205, 1105, 1332, |
| 136260 | + /* 300 */ 1210, 1214, 1214, 1210, 1130, 1119, 1128, 1126, 1135, 1022, |
| 136261 | + /* 310 */ 1060, 1285, 1285, 1281, 1281, 1281, 1281, 1329, 1329, 1266, |
| 136262 | + /* 320 */ 1297, 1297, 1044, 1044, 1297, 1332, 1332, 1332, 1332, 1332, |
| 136263 | + /* 330 */ 1332, 1292, 1332, 1219, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136264 | + /* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136265 | + /* 350 */ 1332, 1332, 1152, 1332, 1000, 1263, 1332, 1332, 1262, 1332, |
| 136266 | + /* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136267 | + /* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320, |
| 136268 | + /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1234, 1233, 1332, 1332, |
| 136269 | + /* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136270 | + /* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, |
| 136271 | + /* 410 */ 1332, 1082, 1332, 1332, 1332, 1306, 1332, 1332, 1332, 1332, |
| 136272 | + /* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332, |
| 136273 | + /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1272, |
| 136274 | + /* 440 */ 1332, 1332, 1332, 1271, 1332, 1332, 1332, 1332, 1332, 1154, |
| 136275 | + /* 450 */ 1332, 1153, 1157, 1332, 1010, 1332, |
| 136891 | 136276 | }; |
| 136892 | 136277 | /********** End of lemon-generated parsing tables *****************************/ |
| 136893 | 136278 | |
| 136894 | 136279 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 136895 | 136280 | ** If a construct like the following: |
| | @@ -137019,11 +136404,10 @@ |
| 137019 | 136404 | int yystksz; /* Current side of the stack */ |
| 137020 | 136405 | yyStackEntry *yystack; /* The parser's stack */ |
| 137021 | 136406 | yyStackEntry yystk0; /* First stack entry */ |
| 137022 | 136407 | #else |
| 137023 | 136408 | yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ |
| 137024 | | - yyStackEntry *yystackEnd; /* Last entry in the stack */ |
| 137025 | 136409 | #endif |
| 137026 | 136410 | }; |
| 137027 | 136411 | typedef struct yyParser yyParser; |
| 137028 | 136412 | |
| 137029 | 136413 | #ifndef NDEBUG |
| | @@ -137358,113 +136742,114 @@ |
| 137358 | 136742 | /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 137359 | 136743 | /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 137360 | 136744 | /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 137361 | 136745 | /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 137362 | 136746 | /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 137363 | | - /* 228 */ "trigger_time ::= BEFORE|AFTER", |
| 137364 | | - /* 229 */ "trigger_time ::= INSTEAD OF", |
| 137365 | | - /* 230 */ "trigger_time ::=", |
| 137366 | | - /* 231 */ "trigger_event ::= DELETE|INSERT", |
| 137367 | | - /* 232 */ "trigger_event ::= UPDATE", |
| 137368 | | - /* 233 */ "trigger_event ::= UPDATE OF idlist", |
| 137369 | | - /* 234 */ "when_clause ::=", |
| 137370 | | - /* 235 */ "when_clause ::= WHEN expr", |
| 137371 | | - /* 236 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 137372 | | - /* 237 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 137373 | | - /* 238 */ "trnm ::= nm DOT nm", |
| 137374 | | - /* 239 */ "tridxby ::= INDEXED BY nm", |
| 137375 | | - /* 240 */ "tridxby ::= NOT INDEXED", |
| 137376 | | - /* 241 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 137377 | | - /* 242 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 137378 | | - /* 243 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 137379 | | - /* 244 */ "trigger_cmd ::= select", |
| 137380 | | - /* 245 */ "expr ::= RAISE LP IGNORE RP", |
| 137381 | | - /* 246 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 137382 | | - /* 247 */ "raisetype ::= ROLLBACK", |
| 137383 | | - /* 248 */ "raisetype ::= ABORT", |
| 137384 | | - /* 249 */ "raisetype ::= FAIL", |
| 137385 | | - /* 250 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 137386 | | - /* 251 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 137387 | | - /* 252 */ "cmd ::= DETACH database_kw_opt expr", |
| 137388 | | - /* 253 */ "key_opt ::=", |
| 137389 | | - /* 254 */ "key_opt ::= KEY expr", |
| 137390 | | - /* 255 */ "cmd ::= REINDEX", |
| 137391 | | - /* 256 */ "cmd ::= REINDEX nm dbnm", |
| 137392 | | - /* 257 */ "cmd ::= ANALYZE", |
| 137393 | | - /* 258 */ "cmd ::= ANALYZE nm dbnm", |
| 137394 | | - /* 259 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 137395 | | - /* 260 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 137396 | | - /* 261 */ "add_column_fullname ::= fullname", |
| 137397 | | - /* 262 */ "cmd ::= create_vtab", |
| 137398 | | - /* 263 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 137399 | | - /* 264 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 137400 | | - /* 265 */ "vtabarg ::=", |
| 137401 | | - /* 266 */ "vtabargtoken ::= ANY", |
| 137402 | | - /* 267 */ "vtabargtoken ::= lp anylist RP", |
| 137403 | | - /* 268 */ "lp ::= LP", |
| 137404 | | - /* 269 */ "with ::=", |
| 137405 | | - /* 270 */ "with ::= WITH wqlist", |
| 137406 | | - /* 271 */ "with ::= WITH RECURSIVE wqlist", |
| 137407 | | - /* 272 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 137408 | | - /* 273 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 137409 | | - /* 274 */ "input ::= cmdlist", |
| 137410 | | - /* 275 */ "cmdlist ::= cmdlist ecmd", |
| 137411 | | - /* 276 */ "cmdlist ::= ecmd", |
| 137412 | | - /* 277 */ "ecmd ::= SEMI", |
| 137413 | | - /* 278 */ "ecmd ::= explain cmdx SEMI", |
| 137414 | | - /* 279 */ "explain ::=", |
| 137415 | | - /* 280 */ "trans_opt ::=", |
| 137416 | | - /* 281 */ "trans_opt ::= TRANSACTION", |
| 137417 | | - /* 282 */ "trans_opt ::= TRANSACTION nm", |
| 137418 | | - /* 283 */ "savepoint_opt ::= SAVEPOINT", |
| 137419 | | - /* 284 */ "savepoint_opt ::=", |
| 137420 | | - /* 285 */ "cmd ::= create_table create_table_args", |
| 137421 | | - /* 286 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 137422 | | - /* 287 */ "columnlist ::= columnname carglist", |
| 137423 | | - /* 288 */ "nm ::= ID|INDEXED", |
| 137424 | | - /* 289 */ "nm ::= STRING", |
| 137425 | | - /* 290 */ "nm ::= JOIN_KW", |
| 137426 | | - /* 291 */ "typetoken ::= typename", |
| 137427 | | - /* 292 */ "typename ::= ID|STRING", |
| 137428 | | - /* 293 */ "signed ::= plus_num", |
| 137429 | | - /* 294 */ "signed ::= minus_num", |
| 137430 | | - /* 295 */ "carglist ::= carglist ccons", |
| 137431 | | - /* 296 */ "carglist ::=", |
| 137432 | | - /* 297 */ "ccons ::= NULL onconf", |
| 137433 | | - /* 298 */ "conslist_opt ::= COMMA conslist", |
| 137434 | | - /* 299 */ "conslist ::= conslist tconscomma tcons", |
| 137435 | | - /* 300 */ "conslist ::= tcons", |
| 137436 | | - /* 301 */ "tconscomma ::=", |
| 137437 | | - /* 302 */ "defer_subclause_opt ::= defer_subclause", |
| 137438 | | - /* 303 */ "resolvetype ::= raisetype", |
| 137439 | | - /* 304 */ "selectnowith ::= oneselect", |
| 137440 | | - /* 305 */ "oneselect ::= values", |
| 137441 | | - /* 306 */ "sclp ::= selcollist COMMA", |
| 137442 | | - /* 307 */ "as ::= ID|STRING", |
| 137443 | | - /* 308 */ "expr ::= term", |
| 137444 | | - /* 309 */ "likeop ::= LIKE_KW|MATCH", |
| 137445 | | - /* 310 */ "exprlist ::= nexprlist", |
| 137446 | | - /* 311 */ "nmnum ::= plus_num", |
| 137447 | | - /* 312 */ "nmnum ::= nm", |
| 137448 | | - /* 313 */ "nmnum ::= ON", |
| 137449 | | - /* 314 */ "nmnum ::= DELETE", |
| 137450 | | - /* 315 */ "nmnum ::= DEFAULT", |
| 137451 | | - /* 316 */ "plus_num ::= INTEGER|FLOAT", |
| 137452 | | - /* 317 */ "foreach_clause ::=", |
| 137453 | | - /* 318 */ "foreach_clause ::= FOR EACH ROW", |
| 137454 | | - /* 319 */ "trnm ::= nm", |
| 137455 | | - /* 320 */ "tridxby ::=", |
| 137456 | | - /* 321 */ "database_kw_opt ::= DATABASE", |
| 137457 | | - /* 322 */ "database_kw_opt ::=", |
| 137458 | | - /* 323 */ "kwcolumn_opt ::=", |
| 137459 | | - /* 324 */ "kwcolumn_opt ::= COLUMNKW", |
| 137460 | | - /* 325 */ "vtabarglist ::= vtabarg", |
| 137461 | | - /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 137462 | | - /* 327 */ "vtabarg ::= vtabarg vtabargtoken", |
| 137463 | | - /* 328 */ "anylist ::=", |
| 137464 | | - /* 329 */ "anylist ::= anylist LP anylist RP", |
| 137465 | | - /* 330 */ "anylist ::= anylist ANY", |
| 136747 | + /* 228 */ "trigger_time ::= BEFORE", |
| 136748 | + /* 229 */ "trigger_time ::= AFTER", |
| 136749 | + /* 230 */ "trigger_time ::= INSTEAD OF", |
| 136750 | + /* 231 */ "trigger_time ::=", |
| 136751 | + /* 232 */ "trigger_event ::= DELETE|INSERT", |
| 136752 | + /* 233 */ "trigger_event ::= UPDATE", |
| 136753 | + /* 234 */ "trigger_event ::= UPDATE OF idlist", |
| 136754 | + /* 235 */ "when_clause ::=", |
| 136755 | + /* 236 */ "when_clause ::= WHEN expr", |
| 136756 | + /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 136757 | + /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 136758 | + /* 239 */ "trnm ::= nm DOT nm", |
| 136759 | + /* 240 */ "tridxby ::= INDEXED BY nm", |
| 136760 | + /* 241 */ "tridxby ::= NOT INDEXED", |
| 136761 | + /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 136762 | + /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 136763 | + /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 136764 | + /* 245 */ "trigger_cmd ::= select", |
| 136765 | + /* 246 */ "expr ::= RAISE LP IGNORE RP", |
| 136766 | + /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 136767 | + /* 248 */ "raisetype ::= ROLLBACK", |
| 136768 | + /* 249 */ "raisetype ::= ABORT", |
| 136769 | + /* 250 */ "raisetype ::= FAIL", |
| 136770 | + /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 136771 | + /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 136772 | + /* 253 */ "cmd ::= DETACH database_kw_opt expr", |
| 136773 | + /* 254 */ "key_opt ::=", |
| 136774 | + /* 255 */ "key_opt ::= KEY expr", |
| 136775 | + /* 256 */ "cmd ::= REINDEX", |
| 136776 | + /* 257 */ "cmd ::= REINDEX nm dbnm", |
| 136777 | + /* 258 */ "cmd ::= ANALYZE", |
| 136778 | + /* 259 */ "cmd ::= ANALYZE nm dbnm", |
| 136779 | + /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 136780 | + /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 136781 | + /* 262 */ "add_column_fullname ::= fullname", |
| 136782 | + /* 263 */ "cmd ::= create_vtab", |
| 136783 | + /* 264 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 136784 | + /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 136785 | + /* 266 */ "vtabarg ::=", |
| 136786 | + /* 267 */ "vtabargtoken ::= ANY", |
| 136787 | + /* 268 */ "vtabargtoken ::= lp anylist RP", |
| 136788 | + /* 269 */ "lp ::= LP", |
| 136789 | + /* 270 */ "with ::=", |
| 136790 | + /* 271 */ "with ::= WITH wqlist", |
| 136791 | + /* 272 */ "with ::= WITH RECURSIVE wqlist", |
| 136792 | + /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 136793 | + /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 136794 | + /* 275 */ "input ::= cmdlist", |
| 136795 | + /* 276 */ "cmdlist ::= cmdlist ecmd", |
| 136796 | + /* 277 */ "cmdlist ::= ecmd", |
| 136797 | + /* 278 */ "ecmd ::= SEMI", |
| 136798 | + /* 279 */ "ecmd ::= explain cmdx SEMI", |
| 136799 | + /* 280 */ "explain ::=", |
| 136800 | + /* 281 */ "trans_opt ::=", |
| 136801 | + /* 282 */ "trans_opt ::= TRANSACTION", |
| 136802 | + /* 283 */ "trans_opt ::= TRANSACTION nm", |
| 136803 | + /* 284 */ "savepoint_opt ::= SAVEPOINT", |
| 136804 | + /* 285 */ "savepoint_opt ::=", |
| 136805 | + /* 286 */ "cmd ::= create_table create_table_args", |
| 136806 | + /* 287 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 136807 | + /* 288 */ "columnlist ::= columnname carglist", |
| 136808 | + /* 289 */ "nm ::= ID|INDEXED", |
| 136809 | + /* 290 */ "nm ::= STRING", |
| 136810 | + /* 291 */ "nm ::= JOIN_KW", |
| 136811 | + /* 292 */ "typetoken ::= typename", |
| 136812 | + /* 293 */ "typename ::= ID|STRING", |
| 136813 | + /* 294 */ "signed ::= plus_num", |
| 136814 | + /* 295 */ "signed ::= minus_num", |
| 136815 | + /* 296 */ "carglist ::= carglist ccons", |
| 136816 | + /* 297 */ "carglist ::=", |
| 136817 | + /* 298 */ "ccons ::= NULL onconf", |
| 136818 | + /* 299 */ "conslist_opt ::= COMMA conslist", |
| 136819 | + /* 300 */ "conslist ::= conslist tconscomma tcons", |
| 136820 | + /* 301 */ "conslist ::= tcons", |
| 136821 | + /* 302 */ "tconscomma ::=", |
| 136822 | + /* 303 */ "defer_subclause_opt ::= defer_subclause", |
| 136823 | + /* 304 */ "resolvetype ::= raisetype", |
| 136824 | + /* 305 */ "selectnowith ::= oneselect", |
| 136825 | + /* 306 */ "oneselect ::= values", |
| 136826 | + /* 307 */ "sclp ::= selcollist COMMA", |
| 136827 | + /* 308 */ "as ::= ID|STRING", |
| 136828 | + /* 309 */ "expr ::= term", |
| 136829 | + /* 310 */ "likeop ::= LIKE_KW|MATCH", |
| 136830 | + /* 311 */ "exprlist ::= nexprlist", |
| 136831 | + /* 312 */ "nmnum ::= plus_num", |
| 136832 | + /* 313 */ "nmnum ::= nm", |
| 136833 | + /* 314 */ "nmnum ::= ON", |
| 136834 | + /* 315 */ "nmnum ::= DELETE", |
| 136835 | + /* 316 */ "nmnum ::= DEFAULT", |
| 136836 | + /* 317 */ "plus_num ::= INTEGER|FLOAT", |
| 136837 | + /* 318 */ "foreach_clause ::=", |
| 136838 | + /* 319 */ "foreach_clause ::= FOR EACH ROW", |
| 136839 | + /* 320 */ "trnm ::= nm", |
| 136840 | + /* 321 */ "tridxby ::=", |
| 136841 | + /* 322 */ "database_kw_opt ::= DATABASE", |
| 136842 | + /* 323 */ "database_kw_opt ::=", |
| 136843 | + /* 324 */ "kwcolumn_opt ::=", |
| 136844 | + /* 325 */ "kwcolumn_opt ::= COLUMNKW", |
| 136845 | + /* 326 */ "vtabarglist ::= vtabarg", |
| 136846 | + /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 136847 | + /* 328 */ "vtabarg ::= vtabarg vtabargtoken", |
| 136848 | + /* 329 */ "anylist ::=", |
| 136849 | + /* 330 */ "anylist ::= anylist LP anylist RP", |
| 136850 | + /* 331 */ "anylist ::= anylist ANY", |
| 137466 | 136851 | }; |
| 137467 | 136852 | #endif /* NDEBUG */ |
| 137468 | 136853 | |
| 137469 | 136854 | |
| 137470 | 136855 | #if YYSTACKDEPTH<=0 |
| | @@ -137529,11 +136914,10 @@ |
| 137529 | 136914 | pParser->yyerrcnt = -1; |
| 137530 | 136915 | #endif |
| 137531 | 136916 | pParser->yytos = pParser->yystack; |
| 137532 | 136917 | pParser->yystack[0].stateno = 0; |
| 137533 | 136918 | pParser->yystack[0].major = 0; |
| 137534 | | - pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1]; |
| 137535 | 136919 | } |
| 137536 | 136920 | |
| 137537 | 136921 | #ifndef sqlite3Parser_ENGINEALWAYSONSTACK |
| 137538 | 136922 | /* |
| 137539 | 136923 | ** This function allocates a new parser. |
| | @@ -137872,11 +137256,11 @@ |
| 137872 | 137256 | yypParser->yyhwm++; |
| 137873 | 137257 | assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack) ); |
| 137874 | 137258 | } |
| 137875 | 137259 | #endif |
| 137876 | 137260 | #if YYSTACKDEPTH>0 |
| 137877 | | - if( yypParser->yytos>yypParser->yystackEnd ){ |
| 137261 | + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){ |
| 137878 | 137262 | yypParser->yytos--; |
| 137879 | 137263 | yyStackOverflow(yypParser); |
| 137880 | 137264 | return; |
| 137881 | 137265 | } |
| 137882 | 137266 | #else |
| | @@ -137900,344 +137284,345 @@ |
| 137900 | 137284 | |
| 137901 | 137285 | /* The following table contains information about every rule that |
| 137902 | 137286 | ** is used during the reduce. |
| 137903 | 137287 | */ |
| 137904 | 137288 | static const struct { |
| 137905 | | - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 137906 | | - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ |
| 137289 | + YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 137290 | + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ |
| 137907 | 137291 | } yyRuleInfo[] = { |
| 137908 | | - { 147, -1 }, |
| 137909 | | - { 147, -3 }, |
| 137910 | | - { 148, -1 }, |
| 137911 | | - { 149, -3 }, |
| 137292 | + { 147, 1 }, |
| 137293 | + { 147, 3 }, |
| 137294 | + { 148, 1 }, |
| 137295 | + { 149, 3 }, |
| 137912 | 137296 | { 150, 0 }, |
| 137913 | | - { 150, -1 }, |
| 137914 | | - { 150, -1 }, |
| 137915 | | - { 150, -1 }, |
| 137916 | | - { 149, -2 }, |
| 137917 | | - { 149, -2 }, |
| 137918 | | - { 149, -2 }, |
| 137919 | | - { 149, -2 }, |
| 137920 | | - { 149, -3 }, |
| 137921 | | - { 149, -5 }, |
| 137922 | | - { 154, -6 }, |
| 137923 | | - { 156, -1 }, |
| 137297 | + { 150, 1 }, |
| 137298 | + { 150, 1 }, |
| 137299 | + { 150, 1 }, |
| 137300 | + { 149, 2 }, |
| 137301 | + { 149, 2 }, |
| 137302 | + { 149, 2 }, |
| 137303 | + { 149, 2 }, |
| 137304 | + { 149, 3 }, |
| 137305 | + { 149, 5 }, |
| 137306 | + { 154, 6 }, |
| 137307 | + { 156, 1 }, |
| 137924 | 137308 | { 158, 0 }, |
| 137925 | | - { 158, -3 }, |
| 137926 | | - { 157, -1 }, |
| 137309 | + { 158, 3 }, |
| 137310 | + { 157, 1 }, |
| 137927 | 137311 | { 157, 0 }, |
| 137928 | | - { 155, -5 }, |
| 137929 | | - { 155, -2 }, |
| 137312 | + { 155, 5 }, |
| 137313 | + { 155, 2 }, |
| 137930 | 137314 | { 162, 0 }, |
| 137931 | | - { 162, -2 }, |
| 137932 | | - { 164, -2 }, |
| 137315 | + { 162, 2 }, |
| 137316 | + { 164, 2 }, |
| 137933 | 137317 | { 166, 0 }, |
| 137934 | | - { 166, -4 }, |
| 137935 | | - { 166, -6 }, |
| 137936 | | - { 167, -2 }, |
| 137937 | | - { 171, -2 }, |
| 137938 | | - { 171, -2 }, |
| 137939 | | - { 171, -4 }, |
| 137940 | | - { 171, -3 }, |
| 137941 | | - { 171, -3 }, |
| 137942 | | - { 171, -2 }, |
| 137943 | | - { 171, -3 }, |
| 137944 | | - { 171, -5 }, |
| 137945 | | - { 171, -2 }, |
| 137946 | | - { 171, -4 }, |
| 137947 | | - { 171, -4 }, |
| 137948 | | - { 171, -1 }, |
| 137949 | | - { 171, -2 }, |
| 137318 | + { 166, 4 }, |
| 137319 | + { 166, 6 }, |
| 137320 | + { 167, 2 }, |
| 137321 | + { 171, 2 }, |
| 137322 | + { 171, 2 }, |
| 137323 | + { 171, 4 }, |
| 137324 | + { 171, 3 }, |
| 137325 | + { 171, 3 }, |
| 137326 | + { 171, 2 }, |
| 137327 | + { 171, 3 }, |
| 137328 | + { 171, 5 }, |
| 137329 | + { 171, 2 }, |
| 137330 | + { 171, 4 }, |
| 137331 | + { 171, 4 }, |
| 137332 | + { 171, 1 }, |
| 137333 | + { 171, 2 }, |
| 137950 | 137334 | { 176, 0 }, |
| 137951 | | - { 176, -1 }, |
| 137335 | + { 176, 1 }, |
| 137952 | 137336 | { 178, 0 }, |
| 137953 | | - { 178, -2 }, |
| 137954 | | - { 180, -2 }, |
| 137955 | | - { 180, -3 }, |
| 137956 | | - { 180, -3 }, |
| 137957 | | - { 180, -3 }, |
| 137958 | | - { 181, -2 }, |
| 137959 | | - { 181, -2 }, |
| 137960 | | - { 181, -1 }, |
| 137961 | | - { 181, -1 }, |
| 137962 | | - { 181, -2 }, |
| 137963 | | - { 179, -3 }, |
| 137964 | | - { 179, -2 }, |
| 137337 | + { 178, 2 }, |
| 137338 | + { 180, 2 }, |
| 137339 | + { 180, 3 }, |
| 137340 | + { 180, 3 }, |
| 137341 | + { 180, 3 }, |
| 137342 | + { 181, 2 }, |
| 137343 | + { 181, 2 }, |
| 137344 | + { 181, 1 }, |
| 137345 | + { 181, 1 }, |
| 137346 | + { 181, 2 }, |
| 137347 | + { 179, 3 }, |
| 137348 | + { 179, 2 }, |
| 137965 | 137349 | { 182, 0 }, |
| 137966 | | - { 182, -2 }, |
| 137967 | | - { 182, -2 }, |
| 137350 | + { 182, 2 }, |
| 137351 | + { 182, 2 }, |
| 137968 | 137352 | { 161, 0 }, |
| 137969 | | - { 184, -1 }, |
| 137970 | | - { 185, -2 }, |
| 137971 | | - { 185, -7 }, |
| 137972 | | - { 185, -5 }, |
| 137973 | | - { 185, -5 }, |
| 137974 | | - { 185, -10 }, |
| 137353 | + { 184, 1 }, |
| 137354 | + { 185, 2 }, |
| 137355 | + { 185, 7 }, |
| 137356 | + { 185, 5 }, |
| 137357 | + { 185, 5 }, |
| 137358 | + { 185, 10 }, |
| 137975 | 137359 | { 188, 0 }, |
| 137976 | 137360 | { 174, 0 }, |
| 137977 | | - { 174, -3 }, |
| 137361 | + { 174, 3 }, |
| 137978 | 137362 | { 189, 0 }, |
| 137979 | | - { 189, -2 }, |
| 137980 | | - { 190, -1 }, |
| 137981 | | - { 190, -1 }, |
| 137982 | | - { 149, -4 }, |
| 137983 | | - { 192, -2 }, |
| 137363 | + { 189, 2 }, |
| 137364 | + { 190, 1 }, |
| 137365 | + { 190, 1 }, |
| 137366 | + { 149, 4 }, |
| 137367 | + { 192, 2 }, |
| 137984 | 137368 | { 192, 0 }, |
| 137985 | | - { 149, -9 }, |
| 137986 | | - { 149, -4 }, |
| 137987 | | - { 149, -1 }, |
| 137988 | | - { 163, -2 }, |
| 137989 | | - { 194, -3 }, |
| 137990 | | - { 197, -1 }, |
| 137991 | | - { 197, -2 }, |
| 137992 | | - { 197, -1 }, |
| 137993 | | - { 195, -9 }, |
| 137994 | | - { 206, -4 }, |
| 137995 | | - { 206, -5 }, |
| 137996 | | - { 198, -1 }, |
| 137997 | | - { 198, -1 }, |
| 137369 | + { 149, 9 }, |
| 137370 | + { 149, 4 }, |
| 137371 | + { 149, 1 }, |
| 137372 | + { 163, 2 }, |
| 137373 | + { 194, 3 }, |
| 137374 | + { 197, 1 }, |
| 137375 | + { 197, 2 }, |
| 137376 | + { 197, 1 }, |
| 137377 | + { 195, 9 }, |
| 137378 | + { 206, 4 }, |
| 137379 | + { 206, 5 }, |
| 137380 | + { 198, 1 }, |
| 137381 | + { 198, 1 }, |
| 137998 | 137382 | { 198, 0 }, |
| 137999 | 137383 | { 209, 0 }, |
| 138000 | | - { 199, -3 }, |
| 138001 | | - { 199, -2 }, |
| 138002 | | - { 199, -4 }, |
| 138003 | | - { 210, -2 }, |
| 137384 | + { 199, 3 }, |
| 137385 | + { 199, 2 }, |
| 137386 | + { 199, 4 }, |
| 137387 | + { 210, 2 }, |
| 138004 | 137388 | { 210, 0 }, |
| 138005 | 137389 | { 200, 0 }, |
| 138006 | | - { 200, -2 }, |
| 138007 | | - { 212, -2 }, |
| 137390 | + { 200, 2 }, |
| 137391 | + { 212, 2 }, |
| 138008 | 137392 | { 212, 0 }, |
| 138009 | | - { 211, -7 }, |
| 138010 | | - { 211, -9 }, |
| 138011 | | - { 211, -7 }, |
| 138012 | | - { 211, -7 }, |
| 137393 | + { 211, 7 }, |
| 137394 | + { 211, 9 }, |
| 137395 | + { 211, 7 }, |
| 137396 | + { 211, 7 }, |
| 138013 | 137397 | { 159, 0 }, |
| 138014 | | - { 159, -2 }, |
| 138015 | | - { 193, -2 }, |
| 138016 | | - { 213, -1 }, |
| 138017 | | - { 213, -2 }, |
| 138018 | | - { 213, -3 }, |
| 138019 | | - { 213, -4 }, |
| 138020 | | - { 215, -2 }, |
| 137398 | + { 159, 2 }, |
| 137399 | + { 193, 2 }, |
| 137400 | + { 213, 1 }, |
| 137401 | + { 213, 2 }, |
| 137402 | + { 213, 3 }, |
| 137403 | + { 213, 4 }, |
| 137404 | + { 215, 2 }, |
| 138021 | 137405 | { 215, 0 }, |
| 138022 | 137406 | { 214, 0 }, |
| 138023 | | - { 214, -3 }, |
| 138024 | | - { 214, -2 }, |
| 138025 | | - { 216, -4 }, |
| 137407 | + { 214, 3 }, |
| 137408 | + { 214, 2 }, |
| 137409 | + { 216, 4 }, |
| 138026 | 137410 | { 216, 0 }, |
| 138027 | 137411 | { 204, 0 }, |
| 138028 | | - { 204, -3 }, |
| 138029 | | - { 186, -4 }, |
| 138030 | | - { 186, -2 }, |
| 138031 | | - { 175, -1 }, |
| 138032 | | - { 175, -1 }, |
| 137412 | + { 204, 3 }, |
| 137413 | + { 186, 4 }, |
| 137414 | + { 186, 2 }, |
| 137415 | + { 175, 1 }, |
| 137416 | + { 175, 1 }, |
| 138033 | 137417 | { 175, 0 }, |
| 138034 | 137418 | { 202, 0 }, |
| 138035 | | - { 202, -3 }, |
| 137419 | + { 202, 3 }, |
| 138036 | 137420 | { 203, 0 }, |
| 138037 | | - { 203, -2 }, |
| 137421 | + { 203, 2 }, |
| 138038 | 137422 | { 205, 0 }, |
| 138039 | | - { 205, -2 }, |
| 138040 | | - { 205, -4 }, |
| 138041 | | - { 205, -4 }, |
| 138042 | | - { 149, -6 }, |
| 137423 | + { 205, 2 }, |
| 137424 | + { 205, 4 }, |
| 137425 | + { 205, 4 }, |
| 137426 | + { 149, 6 }, |
| 138043 | 137427 | { 201, 0 }, |
| 138044 | | - { 201, -2 }, |
| 138045 | | - { 149, -8 }, |
| 138046 | | - { 218, -5 }, |
| 138047 | | - { 218, -7 }, |
| 138048 | | - { 218, -3 }, |
| 138049 | | - { 218, -5 }, |
| 138050 | | - { 149, -6 }, |
| 138051 | | - { 149, -7 }, |
| 138052 | | - { 219, -2 }, |
| 138053 | | - { 219, -1 }, |
| 137428 | + { 201, 2 }, |
| 137429 | + { 149, 8 }, |
| 137430 | + { 218, 5 }, |
| 137431 | + { 218, 7 }, |
| 137432 | + { 218, 3 }, |
| 137433 | + { 218, 5 }, |
| 137434 | + { 149, 6 }, |
| 137435 | + { 149, 7 }, |
| 137436 | + { 219, 2 }, |
| 137437 | + { 219, 1 }, |
| 138054 | 137438 | { 220, 0 }, |
| 138055 | | - { 220, -3 }, |
| 138056 | | - { 217, -3 }, |
| 138057 | | - { 217, -1 }, |
| 138058 | | - { 173, -3 }, |
| 138059 | | - { 172, -1 }, |
| 138060 | | - { 173, -1 }, |
| 138061 | | - { 173, -1 }, |
| 138062 | | - { 173, -3 }, |
| 138063 | | - { 173, -5 }, |
| 138064 | | - { 172, -1 }, |
| 138065 | | - { 172, -1 }, |
| 138066 | | - { 172, -1 }, |
| 138067 | | - { 173, -1 }, |
| 138068 | | - { 173, -3 }, |
| 138069 | | - { 173, -6 }, |
| 138070 | | - { 173, -5 }, |
| 138071 | | - { 173, -4 }, |
| 138072 | | - { 172, -1 }, |
| 138073 | | - { 173, -5 }, |
| 138074 | | - { 173, -3 }, |
| 138075 | | - { 173, -3 }, |
| 138076 | | - { 173, -3 }, |
| 138077 | | - { 173, -3 }, |
| 138078 | | - { 173, -3 }, |
| 138079 | | - { 173, -3 }, |
| 138080 | | - { 173, -3 }, |
| 138081 | | - { 173, -3 }, |
| 138082 | | - { 221, -2 }, |
| 138083 | | - { 173, -3 }, |
| 138084 | | - { 173, -5 }, |
| 138085 | | - { 173, -2 }, |
| 138086 | | - { 173, -3 }, |
| 138087 | | - { 173, -3 }, |
| 138088 | | - { 173, -4 }, |
| 138089 | | - { 173, -2 }, |
| 138090 | | - { 173, -2 }, |
| 138091 | | - { 173, -2 }, |
| 138092 | | - { 173, -2 }, |
| 138093 | | - { 222, -1 }, |
| 138094 | | - { 222, -2 }, |
| 138095 | | - { 173, -5 }, |
| 138096 | | - { 223, -1 }, |
| 138097 | | - { 223, -2 }, |
| 138098 | | - { 173, -5 }, |
| 138099 | | - { 173, -3 }, |
| 138100 | | - { 173, -5 }, |
| 138101 | | - { 173, -5 }, |
| 138102 | | - { 173, -4 }, |
| 138103 | | - { 173, -5 }, |
| 138104 | | - { 226, -5 }, |
| 138105 | | - { 226, -4 }, |
| 138106 | | - { 227, -2 }, |
| 137439 | + { 220, 3 }, |
| 137440 | + { 217, 3 }, |
| 137441 | + { 217, 1 }, |
| 137442 | + { 173, 3 }, |
| 137443 | + { 172, 1 }, |
| 137444 | + { 173, 1 }, |
| 137445 | + { 173, 1 }, |
| 137446 | + { 173, 3 }, |
| 137447 | + { 173, 5 }, |
| 137448 | + { 172, 1 }, |
| 137449 | + { 172, 1 }, |
| 137450 | + { 172, 1 }, |
| 137451 | + { 173, 1 }, |
| 137452 | + { 173, 3 }, |
| 137453 | + { 173, 6 }, |
| 137454 | + { 173, 5 }, |
| 137455 | + { 173, 4 }, |
| 137456 | + { 172, 1 }, |
| 137457 | + { 173, 5 }, |
| 137458 | + { 173, 3 }, |
| 137459 | + { 173, 3 }, |
| 137460 | + { 173, 3 }, |
| 137461 | + { 173, 3 }, |
| 137462 | + { 173, 3 }, |
| 137463 | + { 173, 3 }, |
| 137464 | + { 173, 3 }, |
| 137465 | + { 173, 3 }, |
| 137466 | + { 221, 2 }, |
| 137467 | + { 173, 3 }, |
| 137468 | + { 173, 5 }, |
| 137469 | + { 173, 2 }, |
| 137470 | + { 173, 3 }, |
| 137471 | + { 173, 3 }, |
| 137472 | + { 173, 4 }, |
| 137473 | + { 173, 2 }, |
| 137474 | + { 173, 2 }, |
| 137475 | + { 173, 2 }, |
| 137476 | + { 173, 2 }, |
| 137477 | + { 222, 1 }, |
| 137478 | + { 222, 2 }, |
| 137479 | + { 173, 5 }, |
| 137480 | + { 223, 1 }, |
| 137481 | + { 223, 2 }, |
| 137482 | + { 173, 5 }, |
| 137483 | + { 173, 3 }, |
| 137484 | + { 173, 5 }, |
| 137485 | + { 173, 5 }, |
| 137486 | + { 173, 4 }, |
| 137487 | + { 173, 5 }, |
| 137488 | + { 226, 5 }, |
| 137489 | + { 226, 4 }, |
| 137490 | + { 227, 2 }, |
| 138107 | 137491 | { 227, 0 }, |
| 138108 | | - { 225, -1 }, |
| 137492 | + { 225, 1 }, |
| 138109 | 137493 | { 225, 0 }, |
| 138110 | 137494 | { 208, 0 }, |
| 138111 | | - { 207, -3 }, |
| 138112 | | - { 207, -1 }, |
| 137495 | + { 207, 3 }, |
| 137496 | + { 207, 1 }, |
| 138113 | 137497 | { 224, 0 }, |
| 138114 | | - { 224, -3 }, |
| 138115 | | - { 149, -12 }, |
| 138116 | | - { 228, -1 }, |
| 137498 | + { 224, 3 }, |
| 137499 | + { 149, 12 }, |
| 137500 | + { 228, 1 }, |
| 138117 | 137501 | { 228, 0 }, |
| 138118 | 137502 | { 177, 0 }, |
| 138119 | | - { 177, -3 }, |
| 138120 | | - { 187, -5 }, |
| 138121 | | - { 187, -3 }, |
| 137503 | + { 177, 3 }, |
| 137504 | + { 187, 5 }, |
| 137505 | + { 187, 3 }, |
| 138122 | 137506 | { 229, 0 }, |
| 138123 | | - { 229, -2 }, |
| 138124 | | - { 149, -4 }, |
| 138125 | | - { 149, -1 }, |
| 138126 | | - { 149, -2 }, |
| 138127 | | - { 149, -3 }, |
| 138128 | | - { 149, -5 }, |
| 138129 | | - { 149, -6 }, |
| 138130 | | - { 149, -5 }, |
| 138131 | | - { 149, -6 }, |
| 138132 | | - { 169, -2 }, |
| 138133 | | - { 170, -2 }, |
| 138134 | | - { 149, -5 }, |
| 138135 | | - { 231, -11 }, |
| 138136 | | - { 233, -1 }, |
| 138137 | | - { 233, -2 }, |
| 137507 | + { 229, 2 }, |
| 137508 | + { 149, 4 }, |
| 137509 | + { 149, 1 }, |
| 137510 | + { 149, 2 }, |
| 137511 | + { 149, 3 }, |
| 137512 | + { 149, 5 }, |
| 137513 | + { 149, 6 }, |
| 137514 | + { 149, 5 }, |
| 137515 | + { 149, 6 }, |
| 137516 | + { 169, 2 }, |
| 137517 | + { 170, 2 }, |
| 137518 | + { 149, 5 }, |
| 137519 | + { 231, 11 }, |
| 137520 | + { 233, 1 }, |
| 137521 | + { 233, 1 }, |
| 137522 | + { 233, 2 }, |
| 138138 | 137523 | { 233, 0 }, |
| 138139 | | - { 234, -1 }, |
| 138140 | | - { 234, -1 }, |
| 138141 | | - { 234, -3 }, |
| 137524 | + { 234, 1 }, |
| 137525 | + { 234, 1 }, |
| 137526 | + { 234, 3 }, |
| 138142 | 137527 | { 236, 0 }, |
| 138143 | | - { 236, -2 }, |
| 138144 | | - { 232, -3 }, |
| 138145 | | - { 232, -2 }, |
| 138146 | | - { 238, -3 }, |
| 138147 | | - { 239, -3 }, |
| 138148 | | - { 239, -2 }, |
| 138149 | | - { 237, -7 }, |
| 138150 | | - { 237, -5 }, |
| 138151 | | - { 237, -5 }, |
| 138152 | | - { 237, -1 }, |
| 138153 | | - { 173, -4 }, |
| 138154 | | - { 173, -6 }, |
| 138155 | | - { 191, -1 }, |
| 138156 | | - { 191, -1 }, |
| 138157 | | - { 191, -1 }, |
| 138158 | | - { 149, -4 }, |
| 138159 | | - { 149, -6 }, |
| 138160 | | - { 149, -3 }, |
| 137528 | + { 236, 2 }, |
| 137529 | + { 232, 3 }, |
| 137530 | + { 232, 2 }, |
| 137531 | + { 238, 3 }, |
| 137532 | + { 239, 3 }, |
| 137533 | + { 239, 2 }, |
| 137534 | + { 237, 7 }, |
| 137535 | + { 237, 5 }, |
| 137536 | + { 237, 5 }, |
| 137537 | + { 237, 1 }, |
| 137538 | + { 173, 4 }, |
| 137539 | + { 173, 6 }, |
| 137540 | + { 191, 1 }, |
| 137541 | + { 191, 1 }, |
| 137542 | + { 191, 1 }, |
| 137543 | + { 149, 4 }, |
| 137544 | + { 149, 6 }, |
| 137545 | + { 149, 3 }, |
| 138161 | 137546 | { 241, 0 }, |
| 138162 | | - { 241, -2 }, |
| 138163 | | - { 149, -1 }, |
| 138164 | | - { 149, -3 }, |
| 138165 | | - { 149, -1 }, |
| 138166 | | - { 149, -3 }, |
| 138167 | | - { 149, -6 }, |
| 138168 | | - { 149, -7 }, |
| 138169 | | - { 242, -1 }, |
| 138170 | | - { 149, -1 }, |
| 138171 | | - { 149, -4 }, |
| 138172 | | - { 244, -8 }, |
| 137547 | + { 241, 2 }, |
| 137548 | + { 149, 1 }, |
| 137549 | + { 149, 3 }, |
| 137550 | + { 149, 1 }, |
| 137551 | + { 149, 3 }, |
| 137552 | + { 149, 6 }, |
| 137553 | + { 149, 7 }, |
| 137554 | + { 242, 1 }, |
| 137555 | + { 149, 1 }, |
| 137556 | + { 149, 4 }, |
| 137557 | + { 244, 8 }, |
| 138173 | 137558 | { 246, 0 }, |
| 138174 | | - { 247, -1 }, |
| 138175 | | - { 247, -3 }, |
| 138176 | | - { 248, -1 }, |
| 137559 | + { 247, 1 }, |
| 137560 | + { 247, 3 }, |
| 137561 | + { 248, 1 }, |
| 138177 | 137562 | { 196, 0 }, |
| 138178 | | - { 196, -2 }, |
| 138179 | | - { 196, -3 }, |
| 138180 | | - { 250, -6 }, |
| 138181 | | - { 250, -8 }, |
| 138182 | | - { 144, -1 }, |
| 138183 | | - { 145, -2 }, |
| 138184 | | - { 145, -1 }, |
| 138185 | | - { 146, -1 }, |
| 138186 | | - { 146, -3 }, |
| 137563 | + { 196, 2 }, |
| 137564 | + { 196, 3 }, |
| 137565 | + { 250, 6 }, |
| 137566 | + { 250, 8 }, |
| 137567 | + { 144, 1 }, |
| 137568 | + { 145, 2 }, |
| 137569 | + { 145, 1 }, |
| 137570 | + { 146, 1 }, |
| 137571 | + { 146, 3 }, |
| 138187 | 137572 | { 147, 0 }, |
| 138188 | 137573 | { 151, 0 }, |
| 138189 | | - { 151, -1 }, |
| 138190 | | - { 151, -2 }, |
| 138191 | | - { 153, -1 }, |
| 137574 | + { 151, 1 }, |
| 137575 | + { 151, 2 }, |
| 137576 | + { 153, 1 }, |
| 138192 | 137577 | { 153, 0 }, |
| 138193 | | - { 149, -2 }, |
| 138194 | | - { 160, -4 }, |
| 138195 | | - { 160, -2 }, |
| 138196 | | - { 152, -1 }, |
| 138197 | | - { 152, -1 }, |
| 138198 | | - { 152, -1 }, |
| 138199 | | - { 166, -1 }, |
| 138200 | | - { 167, -1 }, |
| 138201 | | - { 168, -1 }, |
| 138202 | | - { 168, -1 }, |
| 138203 | | - { 165, -2 }, |
| 137578 | + { 149, 2 }, |
| 137579 | + { 160, 4 }, |
| 137580 | + { 160, 2 }, |
| 137581 | + { 152, 1 }, |
| 137582 | + { 152, 1 }, |
| 137583 | + { 152, 1 }, |
| 137584 | + { 166, 1 }, |
| 137585 | + { 167, 1 }, |
| 137586 | + { 168, 1 }, |
| 137587 | + { 168, 1 }, |
| 137588 | + { 165, 2 }, |
| 138204 | 137589 | { 165, 0 }, |
| 138205 | | - { 171, -2 }, |
| 138206 | | - { 161, -2 }, |
| 138207 | | - { 183, -3 }, |
| 138208 | | - { 183, -1 }, |
| 137590 | + { 171, 2 }, |
| 137591 | + { 161, 2 }, |
| 137592 | + { 183, 3 }, |
| 137593 | + { 183, 1 }, |
| 138209 | 137594 | { 184, 0 }, |
| 138210 | | - { 188, -1 }, |
| 138211 | | - { 190, -1 }, |
| 138212 | | - { 194, -1 }, |
| 138213 | | - { 195, -1 }, |
| 138214 | | - { 209, -2 }, |
| 138215 | | - { 210, -1 }, |
| 138216 | | - { 173, -1 }, |
| 138217 | | - { 221, -1 }, |
| 138218 | | - { 208, -1 }, |
| 138219 | | - { 230, -1 }, |
| 138220 | | - { 230, -1 }, |
| 138221 | | - { 230, -1 }, |
| 138222 | | - { 230, -1 }, |
| 138223 | | - { 230, -1 }, |
| 138224 | | - { 169, -1 }, |
| 137595 | + { 188, 1 }, |
| 137596 | + { 190, 1 }, |
| 137597 | + { 194, 1 }, |
| 137598 | + { 195, 1 }, |
| 137599 | + { 209, 2 }, |
| 137600 | + { 210, 1 }, |
| 137601 | + { 173, 1 }, |
| 137602 | + { 221, 1 }, |
| 137603 | + { 208, 1 }, |
| 137604 | + { 230, 1 }, |
| 137605 | + { 230, 1 }, |
| 137606 | + { 230, 1 }, |
| 137607 | + { 230, 1 }, |
| 137608 | + { 230, 1 }, |
| 137609 | + { 169, 1 }, |
| 138225 | 137610 | { 235, 0 }, |
| 138226 | | - { 235, -3 }, |
| 138227 | | - { 238, -1 }, |
| 137611 | + { 235, 3 }, |
| 137612 | + { 238, 1 }, |
| 138228 | 137613 | { 239, 0 }, |
| 138229 | | - { 240, -1 }, |
| 137614 | + { 240, 1 }, |
| 138230 | 137615 | { 240, 0 }, |
| 138231 | 137616 | { 243, 0 }, |
| 138232 | | - { 243, -1 }, |
| 138233 | | - { 245, -1 }, |
| 138234 | | - { 245, -3 }, |
| 138235 | | - { 246, -2 }, |
| 137617 | + { 243, 1 }, |
| 137618 | + { 245, 1 }, |
| 137619 | + { 245, 3 }, |
| 137620 | + { 246, 2 }, |
| 138236 | 137621 | { 249, 0 }, |
| 138237 | | - { 249, -4 }, |
| 138238 | | - { 249, -2 }, |
| 137622 | + { 249, 4 }, |
| 137623 | + { 249, 2 }, |
| 138239 | 137624 | }; |
| 138240 | 137625 | |
| 138241 | 137626 | static void yy_accept(yyParser*); /* Forward Declaration */ |
| 138242 | 137627 | |
| 138243 | 137628 | /* |
| | @@ -138256,11 +137641,11 @@ |
| 138256 | 137641 | yymsp = yypParser->yytos; |
| 138257 | 137642 | #ifndef NDEBUG |
| 138258 | 137643 | if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ |
| 138259 | 137644 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 138260 | 137645 | fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt, |
| 138261 | | - yyRuleName[yyruleno], yymsp[yysize].stateno); |
| 137646 | + yyRuleName[yyruleno], yymsp[-yysize].stateno); |
| 138262 | 137647 | } |
| 138263 | 137648 | #endif /* NDEBUG */ |
| 138264 | 137649 | |
| 138265 | 137650 | /* Check that the stack is large enough to grow by a single entry |
| 138266 | 137651 | ** if the RHS of the rule is empty. This ensures that there is room |
| | @@ -138271,11 +137656,11 @@ |
| 138271 | 137656 | yypParser->yyhwm++; |
| 138272 | 137657 | assert( yypParser->yyhwm == (int)(yypParser->yytos - yypParser->yystack)); |
| 138273 | 137658 | } |
| 138274 | 137659 | #endif |
| 138275 | 137660 | #if YYSTACKDEPTH>0 |
| 138276 | | - if( yypParser->yytos>=yypParser->yystackEnd ){ |
| 137661 | + if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){ |
| 138277 | 137662 | yyStackOverflow(yypParser); |
| 138278 | 137663 | return; |
| 138279 | 137664 | } |
| 138280 | 137665 | #else |
| 138281 | 137666 | if( yypParser->yytos>=&yypParser->yystack[yypParser->yystksz-1] ){ |
| | @@ -139230,11 +138615,11 @@ |
| 139230 | 138615 | sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, |
| 139231 | 138616 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); |
| 139232 | 138617 | } |
| 139233 | 138618 | break; |
| 139234 | 138619 | case 208: /* uniqueflag ::= UNIQUE */ |
| 139235 | | - case 248: /* raisetype ::= ABORT */ yytestcase(yyruleno==248); |
| 138620 | + case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249); |
| 139236 | 138621 | {yymsp[0].minor.yy194 = OE_Abort;} |
| 139237 | 138622 | break; |
| 139238 | 138623 | case 209: /* uniqueflag ::= */ |
| 139239 | 138624 | {yymsp[1].minor.yy194 = OE_None;} |
| 139240 | 138625 | break; |
| | @@ -139284,269 +138669,268 @@ |
| 139284 | 138669 | { |
| 139285 | 138670 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); |
| 139286 | 138671 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 139287 | 138672 | } |
| 139288 | 138673 | break; |
| 139289 | | - case 228: /* trigger_time ::= BEFORE|AFTER */ |
| 139290 | | -{ yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ } |
| 138674 | + case 228: /* trigger_time ::= BEFORE */ |
| 138675 | +{ yymsp[0].minor.yy194 = TK_BEFORE; } |
| 139291 | 138676 | break; |
| 139292 | | - case 229: /* trigger_time ::= INSTEAD OF */ |
| 138677 | + case 229: /* trigger_time ::= AFTER */ |
| 138678 | +{ yymsp[0].minor.yy194 = TK_AFTER; } |
| 138679 | + break; |
| 138680 | + case 230: /* trigger_time ::= INSTEAD OF */ |
| 139293 | 138681 | { yymsp[-1].minor.yy194 = TK_INSTEAD;} |
| 139294 | 138682 | break; |
| 139295 | | - case 230: /* trigger_time ::= */ |
| 138683 | + case 231: /* trigger_time ::= */ |
| 139296 | 138684 | { yymsp[1].minor.yy194 = TK_BEFORE; } |
| 139297 | 138685 | break; |
| 139298 | | - case 231: /* trigger_event ::= DELETE|INSERT */ |
| 139299 | | - case 232: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==232); |
| 138686 | + case 232: /* trigger_event ::= DELETE|INSERT */ |
| 138687 | + case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233); |
| 139300 | 138688 | {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} |
| 139301 | 138689 | break; |
| 139302 | | - case 233: /* trigger_event ::= UPDATE OF idlist */ |
| 138690 | + case 234: /* trigger_event ::= UPDATE OF idlist */ |
| 139303 | 138691 | {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} |
| 139304 | 138692 | break; |
| 139305 | | - case 234: /* when_clause ::= */ |
| 139306 | | - case 253: /* key_opt ::= */ yytestcase(yyruleno==253); |
| 138693 | + case 235: /* when_clause ::= */ |
| 138694 | + case 254: /* key_opt ::= */ yytestcase(yyruleno==254); |
| 139307 | 138695 | { yymsp[1].minor.yy72 = 0; } |
| 139308 | 138696 | break; |
| 139309 | | - case 235: /* when_clause ::= WHEN expr */ |
| 139310 | | - case 254: /* key_opt ::= KEY expr */ yytestcase(yyruleno==254); |
| 138697 | + case 236: /* when_clause ::= WHEN expr */ |
| 138698 | + case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255); |
| 139311 | 138699 | { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } |
| 139312 | 138700 | break; |
| 139313 | | - case 236: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 138701 | + case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 139314 | 138702 | { |
| 139315 | 138703 | assert( yymsp[-2].minor.yy145!=0 ); |
| 139316 | 138704 | yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; |
| 139317 | 138705 | yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 139318 | 138706 | } |
| 139319 | 138707 | break; |
| 139320 | | - case 237: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 138708 | + case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 139321 | 138709 | { |
| 139322 | 138710 | assert( yymsp[-1].minor.yy145!=0 ); |
| 139323 | 138711 | yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 139324 | 138712 | } |
| 139325 | 138713 | break; |
| 139326 | | - case 238: /* trnm ::= nm DOT nm */ |
| 138714 | + case 239: /* trnm ::= nm DOT nm */ |
| 139327 | 138715 | { |
| 139328 | 138716 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 139329 | 138717 | sqlite3ErrorMsg(pParse, |
| 139330 | 138718 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 139331 | 138719 | "statements within triggers"); |
| 139332 | 138720 | } |
| 139333 | 138721 | break; |
| 139334 | | - case 239: /* tridxby ::= INDEXED BY nm */ |
| 138722 | + case 240: /* tridxby ::= INDEXED BY nm */ |
| 139335 | 138723 | { |
| 139336 | 138724 | sqlite3ErrorMsg(pParse, |
| 139337 | 138725 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 139338 | 138726 | "within triggers"); |
| 139339 | 138727 | } |
| 139340 | 138728 | break; |
| 139341 | | - case 240: /* tridxby ::= NOT INDEXED */ |
| 138729 | + case 241: /* tridxby ::= NOT INDEXED */ |
| 139342 | 138730 | { |
| 139343 | 138731 | sqlite3ErrorMsg(pParse, |
| 139344 | 138732 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 139345 | 138733 | "within triggers"); |
| 139346 | 138734 | } |
| 139347 | 138735 | break; |
| 139348 | | - case 241: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 138736 | + case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 139349 | 138737 | {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} |
| 139350 | 138738 | break; |
| 139351 | | - case 242: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 138739 | + case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 139352 | 138740 | {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} |
| 139353 | 138741 | break; |
| 139354 | | - case 243: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 138742 | + case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 139355 | 138743 | {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} |
| 139356 | 138744 | break; |
| 139357 | | - case 244: /* trigger_cmd ::= select */ |
| 138745 | + case 245: /* trigger_cmd ::= select */ |
| 139358 | 138746 | {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} |
| 139359 | 138747 | break; |
| 139360 | | - case 245: /* expr ::= RAISE LP IGNORE RP */ |
| 138748 | + case 246: /* expr ::= RAISE LP IGNORE RP */ |
| 139361 | 138749 | { |
| 139362 | 138750 | spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 139363 | 138751 | yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0); |
| 139364 | 138752 | if( yymsp[-3].minor.yy190.pExpr ){ |
| 139365 | 138753 | yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; |
| 139366 | 138754 | } |
| 139367 | 138755 | } |
| 139368 | 138756 | break; |
| 139369 | | - case 246: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 138757 | + case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 139370 | 138758 | { |
| 139371 | 138759 | spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 139372 | 138760 | yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); |
| 139373 | 138761 | if( yymsp[-5].minor.yy190.pExpr ) { |
| 139374 | 138762 | yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; |
| 139375 | 138763 | } |
| 139376 | 138764 | } |
| 139377 | 138765 | break; |
| 139378 | | - case 247: /* raisetype ::= ROLLBACK */ |
| 138766 | + case 248: /* raisetype ::= ROLLBACK */ |
| 139379 | 138767 | {yymsp[0].minor.yy194 = OE_Rollback;} |
| 139380 | 138768 | break; |
| 139381 | | - case 249: /* raisetype ::= FAIL */ |
| 138769 | + case 250: /* raisetype ::= FAIL */ |
| 139382 | 138770 | {yymsp[0].minor.yy194 = OE_Fail;} |
| 139383 | 138771 | break; |
| 139384 | | - case 250: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 138772 | + case 251: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 139385 | 138773 | { |
| 139386 | 138774 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); |
| 139387 | 138775 | } |
| 139388 | 138776 | break; |
| 139389 | | - case 251: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 138777 | + case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 139390 | 138778 | { |
| 139391 | 138779 | sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); |
| 139392 | 138780 | } |
| 139393 | 138781 | break; |
| 139394 | | - case 252: /* cmd ::= DETACH database_kw_opt expr */ |
| 138782 | + case 253: /* cmd ::= DETACH database_kw_opt expr */ |
| 139395 | 138783 | { |
| 139396 | 138784 | sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); |
| 139397 | 138785 | } |
| 139398 | 138786 | break; |
| 139399 | | - case 255: /* cmd ::= REINDEX */ |
| 138787 | + case 256: /* cmd ::= REINDEX */ |
| 139400 | 138788 | {sqlite3Reindex(pParse, 0, 0);} |
| 139401 | 138789 | break; |
| 139402 | | - case 256: /* cmd ::= REINDEX nm dbnm */ |
| 138790 | + case 257: /* cmd ::= REINDEX nm dbnm */ |
| 139403 | 138791 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 139404 | 138792 | break; |
| 139405 | | - case 257: /* cmd ::= ANALYZE */ |
| 138793 | + case 258: /* cmd ::= ANALYZE */ |
| 139406 | 138794 | {sqlite3Analyze(pParse, 0, 0);} |
| 139407 | 138795 | break; |
| 139408 | | - case 258: /* cmd ::= ANALYZE nm dbnm */ |
| 138796 | + case 259: /* cmd ::= ANALYZE nm dbnm */ |
| 139409 | 138797 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 139410 | 138798 | break; |
| 139411 | | - case 259: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 138799 | + case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 139412 | 138800 | { |
| 139413 | 138801 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); |
| 139414 | 138802 | } |
| 139415 | 138803 | break; |
| 139416 | | - case 260: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 138804 | + case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 139417 | 138805 | { |
| 139418 | 138806 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 139419 | 138807 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 139420 | 138808 | } |
| 139421 | 138809 | break; |
| 139422 | | - case 261: /* add_column_fullname ::= fullname */ |
| 138810 | + case 262: /* add_column_fullname ::= fullname */ |
| 139423 | 138811 | { |
| 139424 | 138812 | disableLookaside(pParse); |
| 139425 | 138813 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); |
| 139426 | 138814 | } |
| 139427 | 138815 | break; |
| 139428 | | - case 262: /* cmd ::= create_vtab */ |
| 138816 | + case 263: /* cmd ::= create_vtab */ |
| 139429 | 138817 | {sqlite3VtabFinishParse(pParse,0);} |
| 139430 | 138818 | break; |
| 139431 | | - case 263: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 138819 | + case 264: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 139432 | 138820 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 139433 | 138821 | break; |
| 139434 | | - case 264: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 138822 | + case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 139435 | 138823 | { |
| 139436 | 138824 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194); |
| 139437 | 138825 | } |
| 139438 | 138826 | break; |
| 139439 | | - case 265: /* vtabarg ::= */ |
| 138827 | + case 266: /* vtabarg ::= */ |
| 139440 | 138828 | {sqlite3VtabArgInit(pParse);} |
| 139441 | 138829 | break; |
| 139442 | | - case 266: /* vtabargtoken ::= ANY */ |
| 139443 | | - case 267: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==267); |
| 139444 | | - case 268: /* lp ::= LP */ yytestcase(yyruleno==268); |
| 138830 | + case 267: /* vtabargtoken ::= ANY */ |
| 138831 | + case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268); |
| 138832 | + case 269: /* lp ::= LP */ yytestcase(yyruleno==269); |
| 139445 | 138833 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 139446 | 138834 | break; |
| 139447 | | - case 269: /* with ::= */ |
| 138835 | + case 270: /* with ::= */ |
| 139448 | 138836 | {yymsp[1].minor.yy285 = 0;} |
| 139449 | 138837 | break; |
| 139450 | | - case 270: /* with ::= WITH wqlist */ |
| 138838 | + case 271: /* with ::= WITH wqlist */ |
| 139451 | 138839 | { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } |
| 139452 | 138840 | break; |
| 139453 | | - case 271: /* with ::= WITH RECURSIVE wqlist */ |
| 138841 | + case 272: /* with ::= WITH RECURSIVE wqlist */ |
| 139454 | 138842 | { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } |
| 139455 | 138843 | break; |
| 139456 | | - case 272: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 138844 | + case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 139457 | 138845 | { |
| 139458 | 138846 | yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ |
| 139459 | 138847 | } |
| 139460 | 138848 | break; |
| 139461 | | - case 273: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 138849 | + case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 139462 | 138850 | { |
| 139463 | 138851 | yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); |
| 139464 | 138852 | } |
| 139465 | 138853 | break; |
| 139466 | 138854 | default: |
| 139467 | | - /* (274) input ::= cmdlist */ yytestcase(yyruleno==274); |
| 139468 | | - /* (275) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==275); |
| 139469 | | - /* (276) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=276); |
| 139470 | | - /* (277) ecmd ::= SEMI */ yytestcase(yyruleno==277); |
| 139471 | | - /* (278) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==278); |
| 139472 | | - /* (279) explain ::= */ yytestcase(yyruleno==279); |
| 139473 | | - /* (280) trans_opt ::= */ yytestcase(yyruleno==280); |
| 139474 | | - /* (281) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==281); |
| 139475 | | - /* (282) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==282); |
| 139476 | | - /* (283) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==283); |
| 139477 | | - /* (284) savepoint_opt ::= */ yytestcase(yyruleno==284); |
| 139478 | | - /* (285) cmd ::= create_table create_table_args */ yytestcase(yyruleno==285); |
| 139479 | | - /* (286) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==286); |
| 139480 | | - /* (287) columnlist ::= columnname carglist */ yytestcase(yyruleno==287); |
| 139481 | | - /* (288) nm ::= ID|INDEXED */ yytestcase(yyruleno==288); |
| 139482 | | - /* (289) nm ::= STRING */ yytestcase(yyruleno==289); |
| 139483 | | - /* (290) nm ::= JOIN_KW */ yytestcase(yyruleno==290); |
| 139484 | | - /* (291) typetoken ::= typename */ yytestcase(yyruleno==291); |
| 139485 | | - /* (292) typename ::= ID|STRING */ yytestcase(yyruleno==292); |
| 139486 | | - /* (293) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=293); |
| 139487 | | - /* (294) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=294); |
| 139488 | | - /* (295) carglist ::= carglist ccons */ yytestcase(yyruleno==295); |
| 139489 | | - /* (296) carglist ::= */ yytestcase(yyruleno==296); |
| 139490 | | - /* (297) ccons ::= NULL onconf */ yytestcase(yyruleno==297); |
| 139491 | | - /* (298) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==298); |
| 139492 | | - /* (299) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==299); |
| 139493 | | - /* (300) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=300); |
| 139494 | | - /* (301) tconscomma ::= */ yytestcase(yyruleno==301); |
| 139495 | | - /* (302) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=302); |
| 139496 | | - /* (303) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=303); |
| 139497 | | - /* (304) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=304); |
| 139498 | | - /* (305) oneselect ::= values */ yytestcase(yyruleno==305); |
| 139499 | | - /* (306) sclp ::= selcollist COMMA */ yytestcase(yyruleno==306); |
| 139500 | | - /* (307) as ::= ID|STRING */ yytestcase(yyruleno==307); |
| 139501 | | - /* (308) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=308); |
| 139502 | | - /* (309) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==309); |
| 139503 | | - /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310); |
| 139504 | | - /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311); |
| 139505 | | - /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312); |
| 139506 | | - /* (313) nmnum ::= ON */ yytestcase(yyruleno==313); |
| 139507 | | - /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314); |
| 139508 | | - /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315); |
| 139509 | | - /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316); |
| 139510 | | - /* (317) foreach_clause ::= */ yytestcase(yyruleno==317); |
| 139511 | | - /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318); |
| 139512 | | - /* (319) trnm ::= nm */ yytestcase(yyruleno==319); |
| 139513 | | - /* (320) tridxby ::= */ yytestcase(yyruleno==320); |
| 139514 | | - /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321); |
| 139515 | | - /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322); |
| 139516 | | - /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323); |
| 139517 | | - /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324); |
| 139518 | | - /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325); |
| 139519 | | - /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326); |
| 139520 | | - /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327); |
| 139521 | | - /* (328) anylist ::= */ yytestcase(yyruleno==328); |
| 139522 | | - /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329); |
| 139523 | | - /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330); |
| 138855 | + /* (275) input ::= cmdlist */ yytestcase(yyruleno==275); |
| 138856 | + /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276); |
| 138857 | + /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277); |
| 138858 | + /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278); |
| 138859 | + /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279); |
| 138860 | + /* (280) explain ::= */ yytestcase(yyruleno==280); |
| 138861 | + /* (281) trans_opt ::= */ yytestcase(yyruleno==281); |
| 138862 | + /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282); |
| 138863 | + /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283); |
| 138864 | + /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284); |
| 138865 | + /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285); |
| 138866 | + /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286); |
| 138867 | + /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287); |
| 138868 | + /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288); |
| 138869 | + /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289); |
| 138870 | + /* (290) nm ::= STRING */ yytestcase(yyruleno==290); |
| 138871 | + /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291); |
| 138872 | + /* (292) typetoken ::= typename */ yytestcase(yyruleno==292); |
| 138873 | + /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293); |
| 138874 | + /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294); |
| 138875 | + /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295); |
| 138876 | + /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296); |
| 138877 | + /* (297) carglist ::= */ yytestcase(yyruleno==297); |
| 138878 | + /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298); |
| 138879 | + /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299); |
| 138880 | + /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300); |
| 138881 | + /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301); |
| 138882 | + /* (302) tconscomma ::= */ yytestcase(yyruleno==302); |
| 138883 | + /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303); |
| 138884 | + /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304); |
| 138885 | + /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305); |
| 138886 | + /* (306) oneselect ::= values */ yytestcase(yyruleno==306); |
| 138887 | + /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307); |
| 138888 | + /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308); |
| 138889 | + /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309); |
| 138890 | + /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310); |
| 138891 | + /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311); |
| 138892 | + /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312); |
| 138893 | + /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313); |
| 138894 | + /* (314) nmnum ::= ON */ yytestcase(yyruleno==314); |
| 138895 | + /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315); |
| 138896 | + /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316); |
| 138897 | + /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317); |
| 138898 | + /* (318) foreach_clause ::= */ yytestcase(yyruleno==318); |
| 138899 | + /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319); |
| 138900 | + /* (320) trnm ::= nm */ yytestcase(yyruleno==320); |
| 138901 | + /* (321) tridxby ::= */ yytestcase(yyruleno==321); |
| 138902 | + /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322); |
| 138903 | + /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323); |
| 138904 | + /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324); |
| 138905 | + /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325); |
| 138906 | + /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326); |
| 138907 | + /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327); |
| 138908 | + /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328); |
| 138909 | + /* (329) anylist ::= */ yytestcase(yyruleno==329); |
| 138910 | + /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330); |
| 138911 | + /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331); |
| 139524 | 138912 | break; |
| 139525 | 138913 | /********** End reduce actions ************************************************/ |
| 139526 | 138914 | }; |
| 139527 | 138915 | assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); |
| 139528 | 138916 | yygoto = yyRuleInfo[yyruleno].lhs; |
| 139529 | 138917 | yysize = yyRuleInfo[yyruleno].nrhs; |
| 139530 | | - yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); |
| 139531 | | - |
| 139532 | | - /* There are no SHIFTREDUCE actions on nonterminals because the table |
| 139533 | | - ** generator has simplified them to pure REDUCE actions. */ |
| 139534 | | - assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) ); |
| 139535 | | - |
| 139536 | | - /* It is not possible for a REDUCE to be followed by an error */ |
| 139537 | | - assert( yyact!=YY_ERROR_ACTION ); |
| 139538 | | - |
| 139539 | | - if( yyact==YY_ACCEPT_ACTION ){ |
| 139540 | | - yypParser->yytos += yysize; |
| 139541 | | - yy_accept(yypParser); |
| 139542 | | - }else{ |
| 139543 | | - yymsp += yysize+1; |
| 138918 | + yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); |
| 138919 | + if( yyact <= YY_MAX_SHIFTREDUCE ){ |
| 138920 | + if( yyact>YY_MAX_SHIFT ){ |
| 138921 | + yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE; |
| 138922 | + } |
| 138923 | + yymsp -= yysize-1; |
| 139544 | 138924 | yypParser->yytos = yymsp; |
| 139545 | 138925 | yymsp->stateno = (YYACTIONTYPE)yyact; |
| 139546 | 138926 | yymsp->major = (YYCODETYPE)yygoto; |
| 139547 | 138927 | yyTraceShift(yypParser, yyact); |
| 138928 | + }else{ |
| 138929 | + assert( yyact == YY_ACCEPT_ACTION ); |
| 138930 | + yypParser->yytos -= yysize; |
| 138931 | + yy_accept(yypParser); |
| 139548 | 138932 | } |
| 139549 | 138933 | } |
| 139550 | 138934 | |
| 139551 | 138935 | /* |
| 139552 | 138936 | ** The following code executes when the parse fails |
| | @@ -141110,13 +140494,10 @@ |
| 141110 | 140494 | /************** Continuing where we left off in main.c ***********************/ |
| 141111 | 140495 | #endif |
| 141112 | 140496 | #ifdef SQLITE_ENABLE_JSON1 |
| 141113 | 140497 | SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*); |
| 141114 | 140498 | #endif |
| 141115 | | -#ifdef SQLITE_ENABLE_STMTVTAB |
| 141116 | | -SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*); |
| 141117 | | -#endif |
| 141118 | 140499 | #ifdef SQLITE_ENABLE_FTS5 |
| 141119 | 140500 | SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*); |
| 141120 | 140501 | #endif |
| 141121 | 140502 | |
| 141122 | 140503 | #ifndef SQLITE_AMALGAMATION |
| | @@ -141896,11 +141277,10 @@ |
| 141896 | 141277 | { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, |
| 141897 | 141278 | { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, |
| 141898 | 141279 | { SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer }, |
| 141899 | 141280 | { SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_LoadExtension }, |
| 141900 | 141281 | { SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose }, |
| 141901 | | - { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG }, |
| 141902 | 141282 | }; |
| 141903 | 141283 | unsigned int i; |
| 141904 | 141284 | rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ |
| 141905 | 141285 | for(i=0; i<ArraySize(aFlagOp); i++){ |
| 141906 | 141286 | if( aFlagOp[i].op==op ){ |
| | @@ -141953,11 +141333,10 @@ |
| 141953 | 141333 | int rc, n; |
| 141954 | 141334 | n = nKey1<nKey2 ? nKey1 : nKey2; |
| 141955 | 141335 | /* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares |
| 141956 | 141336 | ** strings byte by byte using the memcmp() function from the standard C |
| 141957 | 141337 | ** library. */ |
| 141958 | | - assert( pKey1 && pKey2 ); |
| 141959 | 141338 | rc = memcmp(pKey1, pKey2, n); |
| 141960 | 141339 | if( rc==0 ){ |
| 141961 | 141340 | if( padFlag |
| 141962 | 141341 | && allSpaces(((char*)pKey1)+n, nKey1-n) |
| 141963 | 141342 | && allSpaces(((char*)pKey2)+n, nKey2-n) |
| | @@ -144002,13 +143381,10 @@ |
| 144002 | 143381 | | SQLITE_CellSizeCk |
| 144003 | 143382 | #endif |
| 144004 | 143383 | #if defined(SQLITE_ENABLE_FTS3_TOKENIZER) |
| 144005 | 143384 | | SQLITE_Fts3Tokenizer |
| 144006 | 143385 | #endif |
| 144007 | | -#if defined(SQLITE_ENABLE_QPSG) |
| 144008 | | - | SQLITE_EnableQPSG |
| 144009 | | -#endif |
| 144010 | 143386 | ; |
| 144011 | 143387 | sqlite3HashInit(&db->aCollSeq); |
| 144012 | 143388 | #ifndef SQLITE_OMIT_VIRTUALTABLE |
| 144013 | 143389 | sqlite3HashInit(&db->aModule); |
| 144014 | 143390 | #endif |
| | @@ -144141,16 +143517,10 @@ |
| 144141 | 143517 | |
| 144142 | 143518 | #ifdef SQLITE_ENABLE_JSON1 |
| 144143 | 143519 | if( !db->mallocFailed && rc==SQLITE_OK){ |
| 144144 | 143520 | rc = sqlite3Json1Init(db); |
| 144145 | 143521 | } |
| 144146 | | -#endif |
| 144147 | | - |
| 144148 | | -#ifdef SQLITE_ENABLE_STMTVTAB |
| 144149 | | - if( !db->mallocFailed && rc==SQLITE_OK){ |
| 144150 | | - rc = sqlite3StmtVtabInit(db); |
| 144151 | | - } |
| 144152 | 143522 | #endif |
| 144153 | 143523 | |
| 144154 | 143524 | /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking |
| 144155 | 143525 | ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking |
| 144156 | 143526 | ** mode. Doing nothing at all also makes NORMAL the default. |
| | @@ -144433,16 +143803,10 @@ |
| 144433 | 143803 | SQLITE_PRIVATE int sqlite3CantopenError(int lineno){ |
| 144434 | 143804 | testcase( sqlite3GlobalConfig.xLog!=0 ); |
| 144435 | 143805 | return reportError(SQLITE_CANTOPEN, lineno, "cannot open file"); |
| 144436 | 143806 | } |
| 144437 | 143807 | #ifdef SQLITE_DEBUG |
| 144438 | | -SQLITE_PRIVATE int sqlite3CorruptPgnoError(int lineno, Pgno pgno){ |
| 144439 | | - char zMsg[100]; |
| 144440 | | - sqlite3_snprintf(sizeof(zMsg), zMsg, "database corruption page %d", pgno); |
| 144441 | | - testcase( sqlite3GlobalConfig.xLog!=0 ); |
| 144442 | | - return reportError(SQLITE_CORRUPT, lineno, zMsg); |
| 144443 | | -} |
| 144444 | 143808 | SQLITE_PRIVATE int sqlite3NomemError(int lineno){ |
| 144445 | 143809 | testcase( sqlite3GlobalConfig.xLog!=0 ); |
| 144446 | 143810 | return reportError(SQLITE_NOMEM, lineno, "OOM"); |
| 144447 | 143811 | } |
| 144448 | 143812 | SQLITE_PRIVATE int sqlite3IoerrnomemError(int lineno){ |
| | @@ -145198,62 +144562,10 @@ |
| 145198 | 144562 | SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){ |
| 145199 | 144563 | sqlite3_free(pSnapshot); |
| 145200 | 144564 | } |
| 145201 | 144565 | #endif /* SQLITE_ENABLE_SNAPSHOT */ |
| 145202 | 144566 | |
| 145203 | | -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS |
| 145204 | | -/* |
| 145205 | | -** Given the name of a compile-time option, return true if that option |
| 145206 | | -** was used and false if not. |
| 145207 | | -** |
| 145208 | | -** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix |
| 145209 | | -** is not required for a match. |
| 145210 | | -*/ |
| 145211 | | -SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ |
| 145212 | | - int i, n; |
| 145213 | | - int nOpt; |
| 145214 | | - const char **azCompileOpt; |
| 145215 | | - |
| 145216 | | -#if SQLITE_ENABLE_API_ARMOR |
| 145217 | | - if( zOptName==0 ){ |
| 145218 | | - (void)SQLITE_MISUSE_BKPT; |
| 145219 | | - return 0; |
| 145220 | | - } |
| 145221 | | -#endif |
| 145222 | | - |
| 145223 | | - azCompileOpt = sqlite3CompileOptions(&nOpt); |
| 145224 | | - |
| 145225 | | - if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; |
| 145226 | | - n = sqlite3Strlen30(zOptName); |
| 145227 | | - |
| 145228 | | - /* Since nOpt is normally in single digits, a linear search is |
| 145229 | | - ** adequate. No need for a binary search. */ |
| 145230 | | - for(i=0; i<nOpt; i++){ |
| 145231 | | - if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0 |
| 145232 | | - && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0 |
| 145233 | | - ){ |
| 145234 | | - return 1; |
| 145235 | | - } |
| 145236 | | - } |
| 145237 | | - return 0; |
| 145238 | | -} |
| 145239 | | - |
| 145240 | | -/* |
| 145241 | | -** Return the N-th compile-time option string. If N is out of range, |
| 145242 | | -** return a NULL pointer. |
| 145243 | | -*/ |
| 145244 | | -SQLITE_API const char *sqlite3_compileoption_get(int N){ |
| 145245 | | - int nOpt; |
| 145246 | | - const char **azCompileOpt; |
| 145247 | | - azCompileOpt = sqlite3CompileOptions(&nOpt); |
| 145248 | | - if( N>=0 && N<nOpt ){ |
| 145249 | | - return azCompileOpt[N]; |
| 145250 | | - } |
| 145251 | | - return 0; |
| 145252 | | -} |
| 145253 | | -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ |
| 145254 | | - |
| 145255 | 144567 | /************** End of main.c ************************************************/ |
| 145256 | 144568 | /************** Begin file notify.c ******************************************/ |
| 145257 | 144569 | /* |
| 145258 | 144570 | ** 2009 March 3 |
| 145259 | 144571 | ** |
| | @@ -148237,11 +147549,11 @@ |
| 148237 | 147549 | pCsr->pStmt = p->pSeekStmt; |
| 148238 | 147550 | p->pSeekStmt = 0; |
| 148239 | 147551 | }else{ |
| 148240 | 147552 | zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist); |
| 148241 | 147553 | if( !zSql ) return SQLITE_NOMEM; |
| 148242 | | - rc = sqlite3_prepare_v3(p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0); |
| 147554 | + rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); |
| 148243 | 147555 | sqlite3_free(zSql); |
| 148244 | 147556 | } |
| 148245 | 147557 | if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1; |
| 148246 | 147558 | } |
| 148247 | 147559 | return rc; |
| | @@ -149774,11 +149086,11 @@ |
| 149774 | 149086 | zSql = sqlite3_mprintf("SELECT %s ORDER BY rowid %s", |
| 149775 | 149087 | p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC") |
| 149776 | 149088 | ); |
| 149777 | 149089 | } |
| 149778 | 149090 | if( zSql ){ |
| 149779 | | - rc = sqlite3_prepare_v3(p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0); |
| 149091 | + rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); |
| 149780 | 149092 | sqlite3_free(zSql); |
| 149781 | 149093 | }else{ |
| 149782 | 149094 | rc = SQLITE_NOMEM; |
| 149783 | 149095 | } |
| 149784 | 149096 | }else if( eSearch==FTS3_DOCID_SEARCH ){ |
| | @@ -156981,12 +156293,11 @@ |
| 156981 | 156293 | zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName); |
| 156982 | 156294 | } |
| 156983 | 156295 | if( !zSql ){ |
| 156984 | 156296 | rc = SQLITE_NOMEM; |
| 156985 | 156297 | }else{ |
| 156986 | | - rc = sqlite3_prepare_v3(p->db, zSql, -1, SQLITE_PREPARE_PERSISTENT, |
| 156987 | | - &pStmt, NULL); |
| 156298 | + rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL); |
| 156988 | 156299 | sqlite3_free(zSql); |
| 156989 | 156300 | assert( rc==SQLITE_OK || pStmt==0 ); |
| 156990 | 156301 | p->aStmt[eStmt] = pStmt; |
| 156991 | 156302 | } |
| 156992 | 156303 | } |
| | @@ -168092,12 +167403,11 @@ |
| 168092 | 167403 | |
| 168093 | 167404 | rc = rtreeQueryStat1(db, pRtree); |
| 168094 | 167405 | for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){ |
| 168095 | 167406 | char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix); |
| 168096 | 167407 | if( zSql ){ |
| 168097 | | - rc = sqlite3_prepare_v3(db, zSql, -1, SQLITE_PREPARE_PERSISTENT, |
| 168098 | | - appStmt[i], 0); |
| 167408 | + rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0); |
| 168099 | 167409 | }else{ |
| 168100 | 167410 | rc = SQLITE_NOMEM; |
| 168101 | 167411 | } |
| 168102 | 167412 | sqlite3_free(zSql); |
| 168103 | 167413 | } |
| | @@ -169855,14 +169165,14 @@ |
| 169855 | 169165 | ** as fully applied. Otherwise, assuming no error has occurred, save the |
| 169856 | 169166 | ** current state of the RBU update appliation to the RBU database. |
| 169857 | 169167 | ** |
| 169858 | 169168 | ** If an error has already occurred as part of an sqlite3rbu_step() |
| 169859 | 169169 | ** or sqlite3rbu_open() call, or if one occurs within this function, an |
| 169860 | | -** SQLite error code is returned. Additionally, if pzErrmsg is not NULL, |
| 169861 | | -** *pzErrmsg may be set to point to a buffer containing a utf-8 formatted |
| 169862 | | -** English language error message. It is the responsibility of the caller to |
| 169863 | | -** eventually free any such buffer using sqlite3_free(). |
| 169170 | +** SQLite error code is returned. Additionally, *pzErrmsg may be set to |
| 169171 | +** point to a buffer containing a utf-8 formatted English language error |
| 169172 | +** message. It is the responsibility of the caller to eventually free any |
| 169173 | +** such buffer using sqlite3_free(). |
| 169864 | 169174 | ** |
| 169865 | 169175 | ** Otherwise, if no error occurs, this function returns SQLITE_OK if the |
| 169866 | 169176 | ** update has been partially applied, or SQLITE_DONE if it has been |
| 169867 | 169177 | ** completely applied. |
| 169868 | 169178 | */ |
| | @@ -173714,15 +173024,11 @@ |
| 173714 | 173024 | sqlite3_free(p->aBuf); |
| 173715 | 173025 | sqlite3_free(p->aFrame); |
| 173716 | 173026 | |
| 173717 | 173027 | rbuEditErrmsg(p); |
| 173718 | 173028 | rc = p->rc; |
| 173719 | | - if( pzErrmsg ){ |
| 173720 | | - *pzErrmsg = p->zErrmsg; |
| 173721 | | - }else{ |
| 173722 | | - sqlite3_free(p->zErrmsg); |
| 173723 | | - } |
| 173029 | + *pzErrmsg = p->zErrmsg; |
| 173724 | 173030 | sqlite3_free(p->zState); |
| 173725 | 173031 | sqlite3_free(p); |
| 173726 | 173032 | }else{ |
| 173727 | 173033 | rc = SQLITE_NOMEM; |
| 173728 | 173034 | *pzErrmsg = 0; |
| | @@ -178276,16 +177582,15 @@ |
| 178276 | 177582 | |
| 178277 | 177583 | sessionDiscardData(&p->in); |
| 178278 | 177584 | p->in.iCurrent = p->in.iNext; |
| 178279 | 177585 | |
| 178280 | 177586 | op = p->in.aData[p->in.iNext++]; |
| 178281 | | - while( op=='T' || op=='P' ){ |
| 177587 | + if( op=='T' || op=='P' ){ |
| 178282 | 177588 | p->bPatchset = (op=='P'); |
| 178283 | 177589 | if( sessionChangesetReadTblhdr(p) ) return p->rc; |
| 178284 | 177590 | if( (p->rc = sessionInputBuffer(&p->in, 2)) ) return p->rc; |
| 178285 | 177591 | p->in.iCurrent = p->in.iNext; |
| 178286 | | - if( p->in.iNext>=p->in.nData ) return SQLITE_DONE; |
| 178287 | 177592 | op = p->in.aData[p->in.iNext++]; |
| 178288 | 177593 | } |
| 178289 | 177594 | |
| 178290 | 177595 | p->op = op; |
| 178291 | 177596 | p->bIndirect = p->in.aData[p->in.iNext++]; |
| | @@ -184139,16 +183444,16 @@ |
| 184139 | 183444 | ** fts5yy_default[] Default action for each state. |
| 184140 | 183445 | ** |
| 184141 | 183446 | *********** Begin parsing tables **********************************************/ |
| 184142 | 183447 | #define fts5YY_ACTTAB_COUNT (98) |
| 184143 | 183448 | static const fts5YYACTIONTYPE fts5yy_action[] = { |
| 184144 | | - /* 0 */ 105, 19, 90, 6, 26, 93, 92, 24, 24, 17, |
| 184145 | | - /* 10 */ 90, 6, 26, 16, 92, 54, 24, 18, 90, 6, |
| 184146 | | - /* 20 */ 26, 10, 92, 12, 24, 75, 86, 90, 6, 26, |
| 184147 | | - /* 30 */ 13, 92, 75, 24, 20, 90, 6, 26, 101, 92, |
| 184148 | | - /* 40 */ 56, 24, 27, 90, 6, 26, 100, 92, 21, 24, |
| 184149 | | - /* 50 */ 23, 15, 30, 11, 1, 91, 22, 25, 9, 92, |
| 183449 | + /* 0 */ 105, 19, 63, 6, 26, 66, 65, 24, 24, 17, |
| 183450 | + /* 10 */ 63, 6, 26, 16, 65, 54, 24, 18, 63, 6, |
| 183451 | + /* 20 */ 26, 10, 65, 12, 24, 75, 59, 63, 6, 26, |
| 183452 | + /* 30 */ 13, 65, 75, 24, 20, 63, 6, 26, 74, 65, |
| 183453 | + /* 40 */ 56, 24, 27, 63, 6, 26, 73, 65, 21, 24, |
| 183454 | + /* 50 */ 23, 15, 30, 11, 1, 64, 22, 25, 9, 65, |
| 184150 | 183455 | /* 60 */ 7, 24, 3, 4, 5, 3, 4, 5, 3, 77, |
| 184151 | 183456 | /* 70 */ 4, 5, 3, 61, 23, 15, 60, 11, 80, 12, |
| 184152 | 183457 | /* 80 */ 2, 13, 68, 10, 29, 52, 55, 75, 31, 32, |
| 184153 | 183458 | /* 90 */ 8, 28, 5, 3, 51, 55, 72, 14, |
| 184154 | 183459 | }; |
| | @@ -184249,11 +183554,10 @@ |
| 184249 | 183554 | int fts5yystksz; /* Current side of the stack */ |
| 184250 | 183555 | fts5yyStackEntry *fts5yystack; /* The parser's stack */ |
| 184251 | 183556 | fts5yyStackEntry fts5yystk0; /* First stack entry */ |
| 184252 | 183557 | #else |
| 184253 | 183558 | fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */ |
| 184254 | | - fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */ |
| 184255 | 183559 | #endif |
| 184256 | 183560 | }; |
| 184257 | 183561 | typedef struct fts5yyParser fts5yyParser; |
| 184258 | 183562 | |
| 184259 | 183563 | #ifndef NDEBUG |
| | @@ -184399,11 +183703,10 @@ |
| 184399 | 183703 | pParser->fts5yyerrcnt = -1; |
| 184400 | 183704 | #endif |
| 184401 | 183705 | pParser->fts5yytos = pParser->fts5yystack; |
| 184402 | 183706 | pParser->fts5yystack[0].stateno = 0; |
| 184403 | 183707 | pParser->fts5yystack[0].major = 0; |
| 184404 | | - pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1]; |
| 184405 | 183708 | } |
| 184406 | 183709 | |
| 184407 | 183710 | #ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK |
| 184408 | 183711 | /* |
| 184409 | 183712 | ** This function allocates a new parser. |
| | @@ -184698,11 +184001,11 @@ |
| 184698 | 184001 | fts5yypParser->fts5yyhwm++; |
| 184699 | 184002 | assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack) ); |
| 184700 | 184003 | } |
| 184701 | 184004 | #endif |
| 184702 | 184005 | #if fts5YYSTACKDEPTH>0 |
| 184703 | | - if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){ |
| 184006 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){ |
| 184704 | 184007 | fts5yypParser->fts5yytos--; |
| 184705 | 184008 | fts5yyStackOverflow(fts5yypParser); |
| 184706 | 184009 | return; |
| 184707 | 184010 | } |
| 184708 | 184011 | #else |
| | @@ -184726,39 +184029,39 @@ |
| 184726 | 184029 | |
| 184727 | 184030 | /* The following table contains information about every rule that |
| 184728 | 184031 | ** is used during the reduce. |
| 184729 | 184032 | */ |
| 184730 | 184033 | static const struct { |
| 184731 | | - fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 184732 | | - signed char nrhs; /* Negative of the number of RHS symbols in the rule */ |
| 184034 | + fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ |
| 184035 | + unsigned char nrhs; /* Number of right-hand side symbols in the rule */ |
| 184733 | 184036 | } fts5yyRuleInfo[] = { |
| 184734 | | - { 16, -1 }, |
| 184735 | | - { 20, -4 }, |
| 184736 | | - { 20, -3 }, |
| 184737 | | - { 20, -1 }, |
| 184738 | | - { 20, -2 }, |
| 184739 | | - { 21, -2 }, |
| 184740 | | - { 21, -1 }, |
| 184741 | | - { 17, -3 }, |
| 184742 | | - { 17, -3 }, |
| 184743 | | - { 17, -3 }, |
| 184744 | | - { 17, -5 }, |
| 184745 | | - { 17, -3 }, |
| 184746 | | - { 17, -1 }, |
| 184747 | | - { 19, -1 }, |
| 184748 | | - { 19, -2 }, |
| 184749 | | - { 18, -1 }, |
| 184750 | | - { 18, -3 }, |
| 184751 | | - { 22, -1 }, |
| 184752 | | - { 22, -5 }, |
| 184753 | | - { 23, -1 }, |
| 184754 | | - { 23, -2 }, |
| 184037 | + { 16, 1 }, |
| 184038 | + { 20, 4 }, |
| 184039 | + { 20, 3 }, |
| 184040 | + { 20, 1 }, |
| 184041 | + { 20, 2 }, |
| 184042 | + { 21, 2 }, |
| 184043 | + { 21, 1 }, |
| 184044 | + { 17, 3 }, |
| 184045 | + { 17, 3 }, |
| 184046 | + { 17, 3 }, |
| 184047 | + { 17, 5 }, |
| 184048 | + { 17, 3 }, |
| 184049 | + { 17, 1 }, |
| 184050 | + { 19, 1 }, |
| 184051 | + { 19, 2 }, |
| 184052 | + { 18, 1 }, |
| 184053 | + { 18, 3 }, |
| 184054 | + { 22, 1 }, |
| 184055 | + { 22, 5 }, |
| 184056 | + { 23, 1 }, |
| 184057 | + { 23, 2 }, |
| 184755 | 184058 | { 25, 0 }, |
| 184756 | | - { 25, -2 }, |
| 184757 | | - { 24, -4 }, |
| 184758 | | - { 24, -2 }, |
| 184759 | | - { 26, -1 }, |
| 184059 | + { 25, 2 }, |
| 184060 | + { 24, 4 }, |
| 184061 | + { 24, 2 }, |
| 184062 | + { 26, 1 }, |
| 184760 | 184063 | { 26, 0 }, |
| 184761 | 184064 | }; |
| 184762 | 184065 | |
| 184763 | 184066 | static void fts5yy_accept(fts5yyParser*); /* Forward Declaration */ |
| 184764 | 184067 | |
| | @@ -184778,11 +184081,11 @@ |
| 184778 | 184081 | fts5yymsp = fts5yypParser->fts5yytos; |
| 184779 | 184082 | #ifndef NDEBUG |
| 184780 | 184083 | if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){ |
| 184781 | 184084 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 184782 | 184085 | fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt, |
| 184783 | | - fts5yyRuleName[fts5yyruleno], fts5yymsp[fts5yysize].stateno); |
| 184086 | + fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno); |
| 184784 | 184087 | } |
| 184785 | 184088 | #endif /* NDEBUG */ |
| 184786 | 184089 | |
| 184787 | 184090 | /* Check that the stack is large enough to grow by a single entry |
| 184788 | 184091 | ** if the RHS of the rule is empty. This ensures that there is room |
| | @@ -184793,11 +184096,11 @@ |
| 184793 | 184096 | fts5yypParser->fts5yyhwm++; |
| 184794 | 184097 | assert( fts5yypParser->fts5yyhwm == (int)(fts5yypParser->fts5yytos - fts5yypParser->fts5yystack)); |
| 184795 | 184098 | } |
| 184796 | 184099 | #endif |
| 184797 | 184100 | #if fts5YYSTACKDEPTH>0 |
| 184798 | | - if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){ |
| 184101 | + if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){ |
| 184799 | 184102 | fts5yyStackOverflow(fts5yypParser); |
| 184800 | 184103 | return; |
| 184801 | 184104 | } |
| 184802 | 184105 | #else |
| 184803 | 184106 | if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5yypParser->fts5yystksz-1] ){ |
| | @@ -184960,28 +184263,24 @@ |
| 184960 | 184263 | /********** End reduce actions ************************************************/ |
| 184961 | 184264 | }; |
| 184962 | 184265 | assert( fts5yyruleno<sizeof(fts5yyRuleInfo)/sizeof(fts5yyRuleInfo[0]) ); |
| 184963 | 184266 | fts5yygoto = fts5yyRuleInfo[fts5yyruleno].lhs; |
| 184964 | 184267 | fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs; |
| 184965 | | - fts5yyact = fts5yy_find_reduce_action(fts5yymsp[fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); |
| 184966 | | - |
| 184967 | | - /* There are no SHIFTREDUCE actions on nonterminals because the table |
| 184968 | | - ** generator has simplified them to pure REDUCE actions. */ |
| 184969 | | - assert( !(fts5yyact>fts5YY_MAX_SHIFT && fts5yyact<=fts5YY_MAX_SHIFTREDUCE) ); |
| 184970 | | - |
| 184971 | | - /* It is not possible for a REDUCE to be followed by an error */ |
| 184972 | | - assert( fts5yyact!=fts5YY_ERROR_ACTION ); |
| 184973 | | - |
| 184974 | | - if( fts5yyact==fts5YY_ACCEPT_ACTION ){ |
| 184975 | | - fts5yypParser->fts5yytos += fts5yysize; |
| 184976 | | - fts5yy_accept(fts5yypParser); |
| 184977 | | - }else{ |
| 184978 | | - fts5yymsp += fts5yysize+1; |
| 184268 | + fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto); |
| 184269 | + if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){ |
| 184270 | + if( fts5yyact>fts5YY_MAX_SHIFT ){ |
| 184271 | + fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE; |
| 184272 | + } |
| 184273 | + fts5yymsp -= fts5yysize-1; |
| 184979 | 184274 | fts5yypParser->fts5yytos = fts5yymsp; |
| 184980 | 184275 | fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact; |
| 184981 | 184276 | fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto; |
| 184982 | 184277 | fts5yyTraceShift(fts5yypParser, fts5yyact); |
| 184278 | + }else{ |
| 184279 | + assert( fts5yyact == fts5YY_ACCEPT_ACTION ); |
| 184280 | + fts5yypParser->fts5yytos -= fts5yysize; |
| 184281 | + fts5yy_accept(fts5yypParser); |
| 184983 | 184282 | } |
| 184984 | 184283 | } |
| 184985 | 184284 | |
| 184986 | 184285 | /* |
| 184987 | 184286 | ** The following code executes when the parse fails |
| | @@ -190274,15 +189573,14 @@ |
| 190274 | 189573 | if( !apNew ) return SQLITE_NOMEM; |
| 190275 | 189574 | memset(apNew, 0, nNew*sizeof(Fts5HashEntry*)); |
| 190276 | 189575 | |
| 190277 | 189576 | for(i=0; i<pHash->nSlot; i++){ |
| 190278 | 189577 | while( apOld[i] ){ |
| 190279 | | - unsigned int iHash; |
| 189578 | + int iHash; |
| 190280 | 189579 | Fts5HashEntry *p = apOld[i]; |
| 190281 | 189580 | apOld[i] = p->pHashNext; |
| 190282 | | - iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p), |
| 190283 | | - (int)strlen(fts5EntryKey(p))); |
| 189581 | + iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p), strlen(fts5EntryKey(p))); |
| 190284 | 189582 | p->pHashNext = apNew[iHash]; |
| 190285 | 189583 | apNew[iHash] = p; |
| 190286 | 189584 | } |
| 190287 | 189585 | } |
| 190288 | 189586 | |
| | @@ -190581,11 +189879,11 @@ |
| 190581 | 189879 | const char *pTerm, int nTerm, /* Query term */ |
| 190582 | 189880 | const u8 **ppDoclist, /* OUT: Pointer to doclist for pTerm */ |
| 190583 | 189881 | int *pnDoclist /* OUT: Size of doclist in bytes */ |
| 190584 | 189882 | ){ |
| 190585 | 189883 | unsigned int iHash = fts5HashKey(pHash->nSlot, (const u8*)pTerm, nTerm); |
| 190586 | | - char *zKey = 0; |
| 189884 | + char *zKey; |
| 190587 | 189885 | Fts5HashEntry *p; |
| 190588 | 189886 | |
| 190589 | 189887 | for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){ |
| 190590 | 189888 | zKey = fts5EntryKey(p); |
| 190591 | 189889 | if( memcmp(zKey, pTerm, nTerm)==0 && zKey[nTerm]==0 ) break; |
| | @@ -191369,12 +190667,11 @@ |
| 191369 | 190667 | sqlite3_stmt **ppStmt, |
| 191370 | 190668 | char *zSql |
| 191371 | 190669 | ){ |
| 191372 | 190670 | if( p->rc==SQLITE_OK ){ |
| 191373 | 190671 | if( zSql ){ |
| 191374 | | - p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1, |
| 191375 | | - SQLITE_PREPARE_PERSISTENT, ppStmt, 0); |
| 190672 | + p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0); |
| 191376 | 190673 | }else{ |
| 191377 | 190674 | p->rc = SQLITE_NOMEM; |
| 191378 | 190675 | } |
| 191379 | 190676 | } |
| 191380 | 190677 | sqlite3_free(zSql); |
| | @@ -191419,12 +190716,11 @@ |
| 191419 | 190716 | pConfig->zDb, pConfig->zName |
| 191420 | 190717 | ); |
| 191421 | 190718 | if( zSql==0 ){ |
| 191422 | 190719 | rc = SQLITE_NOMEM; |
| 191423 | 190720 | }else{ |
| 191424 | | - rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 191425 | | - SQLITE_PREPARE_PERSISTENT, &p->pDeleter, 0); |
| 190721 | + rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0); |
| 191426 | 190722 | sqlite3_free(zSql); |
| 191427 | 190723 | } |
| 191428 | 190724 | if( rc!=SQLITE_OK ){ |
| 191429 | 190725 | p->rc = rc; |
| 191430 | 190726 | return; |
| | @@ -198019,12 +197315,11 @@ |
| 198019 | 197315 | va_start(ap, zFmt); |
| 198020 | 197316 | zSql = sqlite3_vmprintf(zFmt, ap); |
| 198021 | 197317 | if( zSql==0 ){ |
| 198022 | 197318 | rc = SQLITE_NOMEM; |
| 198023 | 197319 | }else{ |
| 198024 | | - rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 198025 | | - SQLITE_PREPARE_PERSISTENT, &pRet, 0); |
| 197320 | + rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0); |
| 198026 | 197321 | if( rc!=SQLITE_OK ){ |
| 198027 | 197322 | *pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db)); |
| 198028 | 197323 | } |
| 198029 | 197324 | sqlite3_free(zSql); |
| 198030 | 197325 | } |
| | @@ -198156,12 +197451,11 @@ |
| 198156 | 197451 | |
| 198157 | 197452 | if( zRankArgs ){ |
| 198158 | 197453 | char *zSql = sqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs); |
| 198159 | 197454 | if( zSql ){ |
| 198160 | 197455 | sqlite3_stmt *pStmt = 0; |
| 198161 | | - rc = sqlite3_prepare_v3(pConfig->db, zSql, -1, |
| 198162 | | - SQLITE_PREPARE_PERSISTENT, &pStmt, 0); |
| 197456 | + rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pStmt, 0); |
| 198163 | 197457 | sqlite3_free(zSql); |
| 198164 | 197458 | assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 ); |
| 198165 | 197459 | if( rc==SQLITE_OK ){ |
| 198166 | 197460 | if( SQLITE_ROW==sqlite3_step(pStmt) ){ |
| 198167 | 197461 | int nByte; |
| | @@ -199766,11 +199060,11 @@ |
| 199766 | 199060 | int nArg, /* Number of args */ |
| 199767 | 199061 | sqlite3_value **apUnused /* Function arguments */ |
| 199768 | 199062 | ){ |
| 199769 | 199063 | assert( nArg==0 ); |
| 199770 | 199064 | UNUSED_PARAM2(nArg, apUnused); |
| 199771 | | - sqlite3_result_text(pCtx, "fts5: 2017-06-29 17:27:04 284707a7b3514a55cce24292e45632b7033d6edcff5b27deac5118b27c7b2954", -1, SQLITE_TRANSIENT); |
| 199065 | + sqlite3_result_text(pCtx, "fts5: 2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b", -1, SQLITE_TRANSIENT); |
| 199772 | 199066 | } |
| 199773 | 199067 | |
| 199774 | 199068 | static int fts5Init(sqlite3 *db){ |
| 199775 | 199069 | static const sqlite3_module fts5Mod = { |
| 199776 | 199070 | /* iVersion */ 2, |
| | @@ -200020,12 +199314,11 @@ |
| 200020 | 199314 | } |
| 200021 | 199315 | |
| 200022 | 199316 | if( zSql==0 ){ |
| 200023 | 199317 | rc = SQLITE_NOMEM; |
| 200024 | 199318 | }else{ |
| 200025 | | - rc = sqlite3_prepare_v3(pC->db, zSql, -1, |
| 200026 | | - SQLITE_PREPARE_PERSISTENT, &p->aStmt[eStmt], 0); |
| 199319 | + rc = sqlite3_prepare_v2(pC->db, zSql, -1, &p->aStmt[eStmt], 0); |
| 200027 | 199320 | sqlite3_free(zSql); |
| 200028 | 199321 | if( rc!=SQLITE_OK && pzErrMsg ){ |
| 200029 | 199322 | *pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db)); |
| 200030 | 199323 | } |
| 200031 | 199324 | } |
| | @@ -203621,325 +202914,5 @@ |
| 203621 | 202914 | |
| 203622 | 202915 | |
| 203623 | 202916 | #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */ |
| 203624 | 202917 | |
| 203625 | 202918 | /************** End of fts5.c ************************************************/ |
| 203626 | | -/************** Begin file stmt.c ********************************************/ |
| 203627 | | -/* |
| 203628 | | -** 2017-05-31 |
| 203629 | | -** |
| 203630 | | -** The author disclaims copyright to this source code. In place of |
| 203631 | | -** a legal notice, here is a blessing: |
| 203632 | | -** |
| 203633 | | -** May you do good and not evil. |
| 203634 | | -** May you find forgiveness for yourself and forgive others. |
| 203635 | | -** May you share freely, never taking more than you give. |
| 203636 | | -** |
| 203637 | | -************************************************************************* |
| 203638 | | -** |
| 203639 | | -** This file demonstrates an eponymous virtual table that returns information |
| 203640 | | -** about all prepared statements for the database connection. |
| 203641 | | -** |
| 203642 | | -** Usage example: |
| 203643 | | -** |
| 203644 | | -** .load ./stmt |
| 203645 | | -** .mode line |
| 203646 | | -** .header on |
| 203647 | | -** SELECT * FROM stmt; |
| 203648 | | -*/ |
| 203649 | | -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) |
| 203650 | | -#if !defined(SQLITEINT_H) |
| 203651 | | -/* #include "sqlite3ext.h" */ |
| 203652 | | -#endif |
| 203653 | | -SQLITE_EXTENSION_INIT1 |
| 203654 | | -/* #include <assert.h> */ |
| 203655 | | -/* #include <string.h> */ |
| 203656 | | - |
| 203657 | | -#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203658 | | - |
| 203659 | | -/* |
| 203660 | | -** The following macros are used to cast pointers to integers. |
| 203661 | | -** The way you do this varies from one compiler |
| 203662 | | -** to the next, so we have developed the following set of #if statements |
| 203663 | | -** to generate appropriate macros for a wide range of compilers. |
| 203664 | | -*/ |
| 203665 | | -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ |
| 203666 | | -# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(__PTRDIFF_TYPE__)(X)) |
| 203667 | | -#elif !defined(__GNUC__) /* Works for compilers other than LLVM */ |
| 203668 | | -# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(((char*)X)-(char*)0)) |
| 203669 | | -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ |
| 203670 | | -# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(intptr_t)(X)) |
| 203671 | | -#else /* Generates a warning - but it always works */ |
| 203672 | | -# define SQLITE_PTR_TO_INT64(X) ((sqlite3_int64)(X)) |
| 203673 | | -#endif |
| 203674 | | - |
| 203675 | | - |
| 203676 | | -/* stmt_vtab is a subclass of sqlite3_vtab which will |
| 203677 | | -** serve as the underlying representation of a stmt virtual table |
| 203678 | | -*/ |
| 203679 | | -typedef struct stmt_vtab stmt_vtab; |
| 203680 | | -struct stmt_vtab { |
| 203681 | | - sqlite3_vtab base; /* Base class - must be first */ |
| 203682 | | - sqlite3 *db; /* Database connection for this stmt vtab */ |
| 203683 | | -}; |
| 203684 | | - |
| 203685 | | -/* stmt_cursor is a subclass of sqlite3_vtab_cursor which will |
| 203686 | | -** serve as the underlying representation of a cursor that scans |
| 203687 | | -** over rows of the result |
| 203688 | | -*/ |
| 203689 | | -typedef struct stmt_cursor stmt_cursor; |
| 203690 | | -struct stmt_cursor { |
| 203691 | | - sqlite3_vtab_cursor base; /* Base class - must be first */ |
| 203692 | | - sqlite3 *db; /* Database connection for this cursor */ |
| 203693 | | - sqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */ |
| 203694 | | - sqlite3_int64 iRowid; /* The rowid */ |
| 203695 | | -}; |
| 203696 | | - |
| 203697 | | -/* |
| 203698 | | -** The stmtConnect() method is invoked to create a new |
| 203699 | | -** stmt_vtab that describes the generate_stmt virtual table. |
| 203700 | | -** |
| 203701 | | -** Think of this routine as the constructor for stmt_vtab objects. |
| 203702 | | -** |
| 203703 | | -** All this routine needs to do is: |
| 203704 | | -** |
| 203705 | | -** (1) Allocate the stmt_vtab object and initialize all fields. |
| 203706 | | -** |
| 203707 | | -** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the |
| 203708 | | -** result set of queries against generate_stmt will look like. |
| 203709 | | -*/ |
| 203710 | | -static int stmtConnect( |
| 203711 | | - sqlite3 *db, |
| 203712 | | - void *pAux, |
| 203713 | | - int argc, const char *const*argv, |
| 203714 | | - sqlite3_vtab **ppVtab, |
| 203715 | | - char **pzErr |
| 203716 | | -){ |
| 203717 | | - stmt_vtab *pNew; |
| 203718 | | - int rc; |
| 203719 | | - |
| 203720 | | -/* Column numbers */ |
| 203721 | | -#define STMT_COLUMN_PTR 0 /* Numeric value of the statement pointer */ |
| 203722 | | -#define STMT_COLUMN_SQL 1 /* SQL for the statement */ |
| 203723 | | -#define STMT_COLUMN_NCOL 2 /* Number of result columns */ |
| 203724 | | -#define STMT_COLUMN_RO 3 /* True if read-only */ |
| 203725 | | -#define STMT_COLUMN_BUSY 4 /* True if currently busy */ |
| 203726 | | -#define STMT_COLUMN_NSCAN 5 /* SQLITE_STMTSTATUS_FULLSCAN_STEP */ |
| 203727 | | -#define STMT_COLUMN_NSORT 6 /* SQLITE_STMTSTATUS_SORT */ |
| 203728 | | -#define STMT_COLUMN_NAIDX 7 /* SQLITE_STMTSTATUS_AUTOINDEX */ |
| 203729 | | -#define STMT_COLUMN_NSTEP 8 /* SQLITE_STMTSTATUS_VM_STEP */ |
| 203730 | | -#define STMT_COLUMN_REPREP 9 /* SQLITE_STMTSTATUS_REPREPARE */ |
| 203731 | | -#define STMT_COLUMN_RUN 10 /* SQLITE_STMTSTATUS_RUN */ |
| 203732 | | -#define STMT_COLUMN_MEM 11 /* SQLITE_STMTSTATUS_MEMUSED */ |
| 203733 | | - |
| 203734 | | - |
| 203735 | | - rc = sqlite3_declare_vtab(db, |
| 203736 | | - "CREATE TABLE x(ptr,sql,ncol,ro,busy,nscan,nsort,naidx,nstep," |
| 203737 | | - "reprep,run,mem)"); |
| 203738 | | - if( rc==SQLITE_OK ){ |
| 203739 | | - pNew = sqlite3_malloc( sizeof(*pNew) ); |
| 203740 | | - *ppVtab = (sqlite3_vtab*)pNew; |
| 203741 | | - if( pNew==0 ) return SQLITE_NOMEM; |
| 203742 | | - memset(pNew, 0, sizeof(*pNew)); |
| 203743 | | - pNew->db = db; |
| 203744 | | - } |
| 203745 | | - return rc; |
| 203746 | | -} |
| 203747 | | - |
| 203748 | | -/* |
| 203749 | | -** This method is the destructor for stmt_cursor objects. |
| 203750 | | -*/ |
| 203751 | | -static int stmtDisconnect(sqlite3_vtab *pVtab){ |
| 203752 | | - sqlite3_free(pVtab); |
| 203753 | | - return SQLITE_OK; |
| 203754 | | -} |
| 203755 | | - |
| 203756 | | -/* |
| 203757 | | -** Constructor for a new stmt_cursor object. |
| 203758 | | -*/ |
| 203759 | | -static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){ |
| 203760 | | - stmt_cursor *pCur; |
| 203761 | | - pCur = sqlite3_malloc( sizeof(*pCur) ); |
| 203762 | | - if( pCur==0 ) return SQLITE_NOMEM; |
| 203763 | | - memset(pCur, 0, sizeof(*pCur)); |
| 203764 | | - pCur->db = ((stmt_vtab*)p)->db; |
| 203765 | | - *ppCursor = &pCur->base; |
| 203766 | | - return SQLITE_OK; |
| 203767 | | -} |
| 203768 | | - |
| 203769 | | -/* |
| 203770 | | -** Destructor for a stmt_cursor. |
| 203771 | | -*/ |
| 203772 | | -static int stmtClose(sqlite3_vtab_cursor *cur){ |
| 203773 | | - sqlite3_free(cur); |
| 203774 | | - return SQLITE_OK; |
| 203775 | | -} |
| 203776 | | - |
| 203777 | | - |
| 203778 | | -/* |
| 203779 | | -** Advance a stmt_cursor to its next row of output. |
| 203780 | | -*/ |
| 203781 | | -static int stmtNext(sqlite3_vtab_cursor *cur){ |
| 203782 | | - stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203783 | | - pCur->iRowid++; |
| 203784 | | - pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt); |
| 203785 | | - return SQLITE_OK; |
| 203786 | | -} |
| 203787 | | - |
| 203788 | | -/* |
| 203789 | | -** Return values of columns for the row at which the stmt_cursor |
| 203790 | | -** is currently pointing. |
| 203791 | | -*/ |
| 203792 | | -static int stmtColumn( |
| 203793 | | - sqlite3_vtab_cursor *cur, /* The cursor */ |
| 203794 | | - sqlite3_context *ctx, /* First argument to sqlite3_result_...() */ |
| 203795 | | - int i /* Which column to return */ |
| 203796 | | -){ |
| 203797 | | - stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203798 | | - switch( i ){ |
| 203799 | | - case STMT_COLUMN_PTR: { |
| 203800 | | - sqlite3_result_int64(ctx, SQLITE_PTR_TO_INT64(pCur->pStmt)); |
| 203801 | | - break; |
| 203802 | | - } |
| 203803 | | - case STMT_COLUMN_SQL: { |
| 203804 | | - sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT); |
| 203805 | | - break; |
| 203806 | | - } |
| 203807 | | - case STMT_COLUMN_NCOL: { |
| 203808 | | - sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt)); |
| 203809 | | - break; |
| 203810 | | - } |
| 203811 | | - case STMT_COLUMN_RO: { |
| 203812 | | - sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt)); |
| 203813 | | - break; |
| 203814 | | - } |
| 203815 | | - case STMT_COLUMN_BUSY: { |
| 203816 | | - sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt)); |
| 203817 | | - break; |
| 203818 | | - } |
| 203819 | | - case STMT_COLUMN_MEM: { |
| 203820 | | - i = SQLITE_STMTSTATUS_MEMUSED + |
| 203821 | | - STMT_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP; |
| 203822 | | - /* Fall thru */ |
| 203823 | | - } |
| 203824 | | - case STMT_COLUMN_NSCAN: |
| 203825 | | - case STMT_COLUMN_NSORT: |
| 203826 | | - case STMT_COLUMN_NAIDX: |
| 203827 | | - case STMT_COLUMN_NSTEP: |
| 203828 | | - case STMT_COLUMN_REPREP: |
| 203829 | | - case STMT_COLUMN_RUN: { |
| 203830 | | - sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt, |
| 203831 | | - i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0)); |
| 203832 | | - break; |
| 203833 | | - } |
| 203834 | | - } |
| 203835 | | - return SQLITE_OK; |
| 203836 | | -} |
| 203837 | | - |
| 203838 | | -/* |
| 203839 | | -** Return the rowid for the current row. In this implementation, the |
| 203840 | | -** rowid is the same as the output value. |
| 203841 | | -*/ |
| 203842 | | -static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){ |
| 203843 | | - stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203844 | | - *pRowid = pCur->iRowid; |
| 203845 | | - return SQLITE_OK; |
| 203846 | | -} |
| 203847 | | - |
| 203848 | | -/* |
| 203849 | | -** Return TRUE if the cursor has been moved off of the last |
| 203850 | | -** row of output. |
| 203851 | | -*/ |
| 203852 | | -static int stmtEof(sqlite3_vtab_cursor *cur){ |
| 203853 | | - stmt_cursor *pCur = (stmt_cursor*)cur; |
| 203854 | | - return pCur->pStmt==0; |
| 203855 | | -} |
| 203856 | | - |
| 203857 | | -/* |
| 203858 | | -** This method is called to "rewind" the stmt_cursor object back |
| 203859 | | -** to the first row of output. This method is always called at least |
| 203860 | | -** once prior to any call to stmtColumn() or stmtRowid() or |
| 203861 | | -** stmtEof(). |
| 203862 | | -*/ |
| 203863 | | -static int stmtFilter( |
| 203864 | | - sqlite3_vtab_cursor *pVtabCursor, |
| 203865 | | - int idxNum, const char *idxStr, |
| 203866 | | - int argc, sqlite3_value **argv |
| 203867 | | -){ |
| 203868 | | - stmt_cursor *pCur = (stmt_cursor *)pVtabCursor; |
| 203869 | | - pCur->pStmt = 0; |
| 203870 | | - pCur->iRowid = 0; |
| 203871 | | - return stmtNext(pVtabCursor); |
| 203872 | | -} |
| 203873 | | - |
| 203874 | | -/* |
| 203875 | | -** SQLite will invoke this method one or more times while planning a query |
| 203876 | | -** that uses the generate_stmt virtual table. This routine needs to create |
| 203877 | | -** a query plan for each invocation and compute an estimated cost for that |
| 203878 | | -** plan. |
| 203879 | | -*/ |
| 203880 | | -static int stmtBestIndex( |
| 203881 | | - sqlite3_vtab *tab, |
| 203882 | | - sqlite3_index_info *pIdxInfo |
| 203883 | | -){ |
| 203884 | | - pIdxInfo->estimatedCost = (double)500; |
| 203885 | | - pIdxInfo->estimatedRows = 500; |
| 203886 | | - return SQLITE_OK; |
| 203887 | | -} |
| 203888 | | - |
| 203889 | | -/* |
| 203890 | | -** This following structure defines all the methods for the |
| 203891 | | -** generate_stmt virtual table. |
| 203892 | | -*/ |
| 203893 | | -static sqlite3_module stmtModule = { |
| 203894 | | - 0, /* iVersion */ |
| 203895 | | - 0, /* xCreate */ |
| 203896 | | - stmtConnect, /* xConnect */ |
| 203897 | | - stmtBestIndex, /* xBestIndex */ |
| 203898 | | - stmtDisconnect, /* xDisconnect */ |
| 203899 | | - 0, /* xDestroy */ |
| 203900 | | - stmtOpen, /* xOpen - open a cursor */ |
| 203901 | | - stmtClose, /* xClose - close a cursor */ |
| 203902 | | - stmtFilter, /* xFilter - configure scan constraints */ |
| 203903 | | - stmtNext, /* xNext - advance a cursor */ |
| 203904 | | - stmtEof, /* xEof - check for end of scan */ |
| 203905 | | - stmtColumn, /* xColumn - read data */ |
| 203906 | | - stmtRowid, /* xRowid - read data */ |
| 203907 | | - 0, /* xUpdate */ |
| 203908 | | - 0, /* xBegin */ |
| 203909 | | - 0, /* xSync */ |
| 203910 | | - 0, /* xCommit */ |
| 203911 | | - 0, /* xRollback */ |
| 203912 | | - 0, /* xFindMethod */ |
| 203913 | | - 0, /* xRename */ |
| 203914 | | -}; |
| 203915 | | - |
| 203916 | | -#endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 203917 | | - |
| 203918 | | -SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){ |
| 203919 | | - int rc = SQLITE_OK; |
| 203920 | | -#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203921 | | - rc = sqlite3_create_module(db, "stmt", &stmtModule, 0); |
| 203922 | | -#endif |
| 203923 | | - return rc; |
| 203924 | | -} |
| 203925 | | - |
| 203926 | | -#ifndef SQLITE_CORE |
| 203927 | | -#ifdef _WIN32 |
| 203928 | | -__declspec(dllexport) |
| 203929 | | -#endif |
| 203930 | | -SQLITE_API int sqlite3_stmt_init( |
| 203931 | | - sqlite3 *db, |
| 203932 | | - char **pzErrMsg, |
| 203933 | | - const sqlite3_api_routines *pApi |
| 203934 | | -){ |
| 203935 | | - int rc = SQLITE_OK; |
| 203936 | | - SQLITE_EXTENSION_INIT2(pApi); |
| 203937 | | -#ifndef SQLITE_OMIT_VIRTUALTABLE |
| 203938 | | - rc = sqlite3StmtVtabInit(db); |
| 203939 | | -#endif |
| 203940 | | - return rc; |
| 203941 | | -} |
| 203942 | | -#endif /* SQLITE_CORE */ |
| 203943 | | -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ |
| 203944 | | - |
| 203945 | | -/************** End of stmt.c ************************************************/ |
| 203946 | 202919 | |