Differences From Artifact [1222ebdab0]:
- File src/sqlite3.c — part of check-in [232d10b736] at 2009-10-18 18:21:37 on branch trunk — Begin adding a search capability; the code is not yet connected up. Also update to the latest version of SQLite. (user: drh size: 3848039)
To Artifact [eb3a6cb924]:
- File src/sqlite3.c — part of check-in [dffe11c29c] at 2009-11-01 19:25:47 on branch trunk — Update to the latest version of SQLite (3.6.20rc1) and fix some compiler warnings. (user: drh size: 3856516)
1 2 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.6.20. By combining all the individual C code files into this ** single large file, the entire code can be compiled as a one translation ** unit. This allows many compilers to do optimizations that would not be ** possible if the files were compiled separately. Performance improvements ** of 5% are more are commonly seen when SQLite is compiled as a single ** translation unit. ** ** This file is all you need to compile SQLite. To use SQLite in other ** programs, you need this file and the "sqlite3.h" header file that defines ** the programming interface to the SQLite library. (If you do not have ** the "sqlite3.h" header file at hand, you will find a copy embedded within ** the text of this file. Search for "Begin file sqlite3.h" to find the start ** of the embedded sqlite3.h header file.) Additional code files may be needed ** if you want a wrapper to interface SQLite with your choice of programming ** language. The code for the "sqlite3" command-line shell is also in a ** separate file. This file contains only code for the core SQLite library. ** ** This amalgamation was generated on 2009-11-01 19:22:03 UTC. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE # define SQLITE_PRIVATE static #endif #ifndef SQLITE_API |
| ︙ | ︙ | |||
647 648 649 650 651 652 653 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. ** ** Requirements: [H10011] [H10014] */ | | | | | 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 |
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
**
** Requirements: [H10011] [H10014]
*/
#define SQLITE_VERSION "3.6.20"
#define SQLITE_VERSION_NUMBER 3006020
#define SQLITE_SOURCE_ID "2009-10-30 14:27:15 612952743da28e651512547fc0d3925f4c698eb4"
/*
** CAPI3REF: Run-Time Library Version Numbers {H10020} <S60100>
** KEYWORDS: sqlite3_version
**
** These interfaces provide the same information as the [SQLITE_VERSION],
** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] #defines in the header,
|
| ︙ | ︙ | |||
773 774 775 776 777 778 779 |
#endif
/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
| | < < < < < < < < < < | 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 |
#endif
/*
** CAPI3REF: Closing A Database Connection {H12010} <S30100><S40200>
**
** This routine is the destructor for the [sqlite3] object.
**
** Applications must [sqlite3_finalize | finalize] all [prepared statements]
** and [sqlite3_blob_close | close] all [BLOB handles] associated with
** the [sqlite3] object prior to attempting to close the object.
**
** If [sqlite3_close()] is invoked while a transaction is open,
** the transaction is automatically rolled back.
**
** The C parameter to [sqlite3_close(C)] must be either a NULL
** pointer or an [sqlite3] object pointer obtained
** from [sqlite3_open()], [sqlite3_open16()], or
|
| ︙ | ︙ | |||
1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 |
/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library. The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().
**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown(). Only an effective call
** of sqlite3_initialize() does any initialization. All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize(). Only
** an effective call to sqlite3_shutdown() does any deinitialization.
| > > > | > > > > > > | | | 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
/*
** CAPI3REF: Initialize The SQLite Library {H10130} <S20000><S30100>
**
** The sqlite3_initialize() routine initializes the
** SQLite library. The sqlite3_shutdown() routine
** deallocates any resources that were allocated by sqlite3_initialize().
** This routines are designed to aid in process initialization and
** shutdown on embedded systems. Workstation applications using
** SQLite normally do not need to invoke either of these routines.
**
** A call to sqlite3_initialize() is an "effective" call if it is
** the first time sqlite3_initialize() is invoked during the lifetime of
** the process, or if it is the first time sqlite3_initialize() is invoked
** following a call to sqlite3_shutdown(). Only an effective call
** of sqlite3_initialize() does any initialization. All other calls
** are harmless no-ops.
**
** A call to sqlite3_shutdown() is an "effective" call if it is the first
** call to sqlite3_shutdown() since the last sqlite3_initialize(). Only
** an effective call to sqlite3_shutdown() does any deinitialization.
** All other valid calls to sqlite3_shutdown() are harmless no-ops.
**
** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown()
** is not. The sqlite3_shutdown() interface must only be called from a
** single thread. All open [database connections] must be closed and all
** other SQLite resources must be deallocated prior to invoking
** sqlite3_shutdown().
**
** Among other things, sqlite3_initialize() will invoke
** sqlite3_os_init(). Similarly, sqlite3_shutdown()
** will invoke sqlite3_os_end().
**
** The sqlite3_initialize() routine returns [SQLITE_OK] on success.
** If for some reason, sqlite3_initialize() is unable to initialize
** the library (perhaps it is unable to allocate a needed resource such
** as a mutex) it returns an [error code] other than [SQLITE_OK].
**
** The sqlite3_initialize() routine is called internally by many other
|
| ︙ | ︙ | |||
2924 2925 2926 2927 2928 2929 2930 | ** ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are ** recommended for all new programs. The two older interfaces are retained ** for backwards compatibility, but their use is discouraged. ** In the "v2" interfaces, the prepared statement ** that is returned (the [sqlite3_stmt] object) contains a copy of the ** original SQL text. This causes the [sqlite3_step()] interface to | | | 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 | ** ** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are ** recommended for all new programs. The two older interfaces are retained ** for backwards compatibility, but their use is discouraged. ** In the "v2" interfaces, the prepared statement ** that is returned (the [sqlite3_stmt] object) contains a copy of the ** original SQL text. This causes the [sqlite3_step()] interface to ** behave a differently in three ways: ** ** <ol> ** <li> ** If the database schema changes, instead of returning [SQLITE_SCHEMA] as it ** always used to do, [sqlite3_step()] will automatically recompile the SQL ** statement and try to run it again. If the schema has changed in ** a way that makes the statement no longer valid, [sqlite3_step()] will still |
| ︙ | ︙ | |||
2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 | ** When an error occurs, [sqlite3_step()] will return one of the detailed ** [error codes] or [extended error codes]. The legacy behavior was that ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and you would have to make a second call to [sqlite3_reset()] in order ** to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. ** </li> ** </ol> ** ** Requirements: ** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021] ** */ SQLITE_API int sqlite3_prepare( | > > > > > > > > | 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 | ** When an error occurs, [sqlite3_step()] will return one of the detailed ** [error codes] or [extended error codes]. The legacy behavior was that ** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code ** and you would have to make a second call to [sqlite3_reset()] in order ** to find the underlying cause of the problem. With the "v2" prepare ** interfaces, the underlying reason for the error is returned immediately. ** </li> ** ** <li> ** ^If the value of a [parameter | host parameter] in the WHERE clause might ** change the query plan for a statement, then the statement may be ** automatically recompiled (as if there had been a schema change) on the first ** [sqlite3_step()] call following any change to the ** [sqlite3_bind_text | bindings] of the [parameter]. ** </li> ** </ol> ** ** Requirements: ** [H13011] [H13012] [H13013] [H13014] [H13015] [H13016] [H13019] [H13021] ** */ SQLITE_API int sqlite3_prepare( |
| ︙ | ︙ | |||
3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 | ** ** These routines return information about a single column of the current ** result row of a query. In every case the first argument is a pointer ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] ** that was returned from [sqlite3_prepare_v2()] or one of its variants) ** and the second argument is the index of the column for which information ** should be returned. The leftmost column of the result set has the index 0. ** ** If the SQL statement does not currently point to a valid row, or if the ** column index is out of range, the result is undefined. ** These routines may only be called when the most recent call to ** [sqlite3_step()] has returned [SQLITE_ROW] and neither ** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. ** If any of these routines are called after [sqlite3_reset()] or | > > | 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 | ** ** These routines return information about a single column of the current ** result row of a query. In every case the first argument is a pointer ** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] ** that was returned from [sqlite3_prepare_v2()] or one of its variants) ** and the second argument is the index of the column for which information ** should be returned. The leftmost column of the result set has the index 0. ** The number of columns in the result can be determined using ** [sqlite3_column_count()]. ** ** If the SQL statement does not currently point to a valid row, or if the ** column index is out of range, the result is undefined. ** These routines may only be called when the most recent call to ** [sqlite3_step()] has returned [SQLITE_ROW] and neither ** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. ** If any of these routines are called after [sqlite3_reset()] or |
| ︙ | ︙ | |||
7309 7310 7311 7312 7313 7314 7315 | ** The makefile scans the vdbe.c source file and creates the "opcodes.h" ** header file that defines a number for each opcode used by the VDBE. */ /************** Include opcodes.h in the middle of vdbe.h ********************/ /************** Begin file opcodes.h *****************************************/ /* Automatically generated. Do not edit */ /* See the mkopcodeh.awk script for details */ | > > > > > > > > | | | | | | | | | | | | | | | < | | < < < | | | < | | < | | < < | < < > > | | > > > | < | | < | | | | | | > > > > > | > | > | | < | < | | | | < | < | | > > | > > | > > > > > | | > | | | | > | > | > > | | > | | | | > | | > | | | < < < | | | | < < | < < | | < | < < < < < | | | | < < < | | | | < | | | | | | | | < | | | | < < < | | | | | | | | | | | | | | | | 7318 7319 7320 7321 7322 7323 7324 7325 7326 7327 7328 7329 7330 7331 7332 7333 7334 7335 7336 7337 7338 7339 7340 7341 7342 7343 7344 7345 7346 7347 7348 7349 7350 7351 7352 7353 7354 7355 7356 7357 7358 7359 7360 7361 7362 7363 7364 7365 7366 7367 7368 7369 7370 7371 7372 7373 7374 7375 7376 7377 7378 7379 7380 7381 7382 7383 7384 7385 7386 7387 7388 7389 7390 7391 7392 7393 7394 7395 7396 7397 7398 7399 7400 7401 7402 7403 7404 7405 7406 7407 7408 7409 7410 7411 7412 7413 7414 7415 7416 7417 7418 7419 7420 7421 7422 7423 7424 7425 7426 7427 7428 7429 7430 7431 7432 7433 7434 7435 7436 7437 7438 7439 7440 7441 7442 7443 7444 7445 7446 7447 7448 7449 7450 7451 7452 7453 7454 7455 7456 7457 7458 7459 7460 7461 7462 7463 7464 7465 7466 7467 7468 7469 7470 7471 7472 7473 7474 7475 7476 7477 7478 7479 7480 7481 7482 7483 7484 7485 7486 7487 7488 7489 7490 7491 7492 7493 7494 7495 7496 7497 7498 7499 7500 7501 7502 7503 7504 7505 7506 7507 7508 |
** The makefile scans the vdbe.c source file and creates the "opcodes.h"
** header file that defines a number for each opcode used by the VDBE.
*/
/************** Include opcodes.h in the middle of vdbe.h ********************/
/************** Begin file opcodes.h *****************************************/
/* Automatically generated. Do not edit */
/* See the mkopcodeh.awk script for details */
#define OP_ReadCookie 1
#define OP_AutoCommit 2
#define OP_Found 3
#define OP_NullRow 4
#define OP_Lt 79 /* same as TK_LT */
#define OP_RowSetTest 5
#define OP_Variable 6
#define OP_RealAffinity 7
#define OP_Sort 8
#define OP_Affinity 9
#define OP_IfNot 10
#define OP_Gosub 11
#define OP_Add 86 /* same as TK_PLUS */
#define OP_NotFound 12
#define OP_ResultRow 13
#define OP_IsNull 73 /* same as TK_ISNULL */
#define OP_SeekLe 14
#define OP_Rowid 15
#define OP_CreateIndex 16
#define OP_Explain 17
#define OP_DropIndex 18
#define OP_Null 20
#define OP_Program 21
#define OP_ToInt 144 /* same as TK_TO_INT */
#define OP_Int64 22
#define OP_LoadAnalysis 23
#define OP_IdxInsert 24
#define OP_VUpdate 25
#define OP_Next 26
#define OP_ToNumeric 143 /* same as TK_TO_NUMERIC*/
#define OP_Ge 80 /* same as TK_GE */
#define OP_BitNot 93 /* same as TK_BITNOT */
#define OP_SeekLt 27
#define OP_Rewind 28
#define OP_Multiply 88 /* same as TK_STAR */
#define OP_ToReal 145 /* same as TK_TO_REAL */
#define OP_Gt 77 /* same as TK_GT */
#define OP_RowSetRead 29
#define OP_Last 30
#define OP_MustBeInt 31
#define OP_Ne 75 /* same as TK_NE */
#define OP_IncrVacuum 32
#define OP_String 33
#define OP_VFilter 34
#define OP_Count 35
#define OP_Close 36
#define OP_AggFinal 37
#define OP_RowData 38
#define OP_IdxRowid 39
#define OP_Param 40
#define OP_Pagecount 41
#define OP_BitOr 83 /* same as TK_BITOR */
#define OP_NotNull 74 /* same as TK_NOTNULL */
#define OP_SeekGe 42
#define OP_Not 19 /* same as TK_NOT */
#define OP_OpenPseudo 43
#define OP_Halt 44
#define OP_Compare 45
#define OP_NewRowid 46
#define OP_Real 130 /* same as TK_FLOAT */
#define OP_IdxLT 47
#define OP_SeekGt 48
#define OP_MemMax 49
#define OP_Function 50
#define OP_IntegrityCk 51
#define OP_Remainder 90 /* same as TK_REM */
#define OP_FkCounter 52
#define OP_SCopy 53
#define OP_ShiftLeft 84 /* same as TK_LSHIFT */
#define OP_IfNeg 54
#define OP_BitAnd 82 /* same as TK_BITAND */
#define OP_Or 68 /* same as TK_OR */
#define OP_NotExists 55
#define OP_VDestroy 56
#define OP_IdxDelete 57
#define OP_Vacuum 58
#define OP_Copy 59
#define OP_If 60
#define OP_Jump 61
#define OP_Destroy 62
#define OP_AggStep 63
#define OP_Clear 64
#define OP_Insert 65
#define OP_Permutation 66
#define OP_VBegin 67
#define OP_OpenEphemeral 70
#define OP_IdxGE 71
#define OP_Trace 72
#define OP_Divide 89 /* same as TK_SLASH */
#define OP_String8 94 /* same as TK_STRING */
#define OP_Concat 91 /* same as TK_CONCAT */
#define OP_MakeRecord 81
#define OP_Yield 92
#define OP_SetCookie 95
#define OP_Prev 96
#define OP_DropTrigger 97
#define OP_FkIfZero 98
#define OP_And 69 /* same as TK_AND */
#define OP_VColumn 99
#define OP_Return 100
#define OP_OpenWrite 101
#define OP_Integer 102
#define OP_Transaction 103
#define OP_IfPos 104
#define OP_RowSetAdd 105
#define OP_CollSeq 106
#define OP_Savepoint 107
#define OP_VRename 108
#define OP_ToBlob 142 /* same as TK_TO_BLOB */
#define OP_Sequence 109
#define OP_ShiftRight 85 /* same as TK_RSHIFT */
#define OP_HaltIfNull 110
#define OP_VCreate 111
#define OP_CreateTable 112
#define OP_AddImm 113
#define OP_ToText 141 /* same as TK_TO_TEXT */
#define OP_DropTable 114
#define OP_IsUnique 115
#define OP_VOpen 116
#define OP_IfZero 117
#define OP_Noop 118
#define OP_InsertInt 119
#define OP_RowKey 120
#define OP_Expire 121
#define OP_Delete 122
#define OP_Subtract 87 /* same as TK_MINUS */
#define OP_Blob 123
#define OP_Move 124
#define OP_Goto 125
#define OP_ParseSchema 126
#define OP_Eq 76 /* same as TK_EQ */
#define OP_VNext 127
#define OP_Seek 128
#define OP_Le 78 /* same as TK_LE */
#define OP_TableLock 129
#define OP_VerifyCookie 131
#define OP_Column 132
#define OP_OpenRead 133
#define OP_ResetCount 134
/* The following opcode values are never used */
#define OP_NotUsed_135 135
#define OP_NotUsed_136 136
#define OP_NotUsed_137 137
#define OP_NotUsed_138 138
#define OP_NotUsed_139 139
#define OP_NotUsed_140 140
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
** are encoded into bitvectors as follows:
*/
#define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */
#define OPFLG_OUT2_PRERELEASE 0x0002 /* out2-prerelease: */
#define OPFLG_IN1 0x0004 /* in1: P1 is an input */
#define OPFLG_IN2 0x0008 /* in2: P2 is an input */
#define OPFLG_IN3 0x0010 /* in3: P3 is an input */
#define OPFLG_OUT3 0x0020 /* out3: P3 is an output */
#define OPFLG_INITIALIZER {\
/* 0 */ 0x00, 0x02, 0x00, 0x11, 0x00, 0x15, 0x00, 0x04,\
/* 8 */ 0x01, 0x00, 0x05, 0x01, 0x11, 0x00, 0x11, 0x02,\
/* 16 */ 0x02, 0x00, 0x00, 0x04, 0x02, 0x01, 0x02, 0x00,\
/* 24 */ 0x08, 0x00, 0x01, 0x11, 0x01, 0x21, 0x01, 0x05,\
/* 32 */ 0x01, 0x02, 0x01, 0x02, 0x00, 0x00, 0x00, 0x02,\
/* 40 */ 0x02, 0x02, 0x11, 0x00, 0x00, 0x00, 0x02, 0x11,\
/* 48 */ 0x11, 0x08, 0x00, 0x00, 0x00, 0x04, 0x05, 0x11,\
/* 56 */ 0x00, 0x00, 0x00, 0x04, 0x05, 0x01, 0x02, 0x00,\
/* 64 */ 0x00, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x00, 0x11,\
/* 72 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
/* 80 */ 0x15, 0x00, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,\
/* 88 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x04, 0x04, 0x02, 0x10,\
/* 96 */ 0x01, 0x00, 0x01, 0x00, 0x04, 0x00, 0x02, 0x00,\
/* 104 */ 0x05, 0x08, 0x00, 0x00, 0x00, 0x02, 0x10, 0x00,\
/* 112 */ 0x02, 0x04, 0x00, 0x11, 0x00, 0x05, 0x00, 0x00,\
/* 120 */ 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00, 0x01,\
/* 128 */ 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04,\
/* 144 */ 0x04, 0x04,}
/************** End of opcodes.h *********************************************/
/************** Continuing where we left off in vdbe.h ***********************/
/*
|
| ︙ | ︙ | |||
7532 7533 7534 7535 7536 7537 7538 7539 | SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); SQLITE_PRIVATE void sqlite3VdbeProgramDelete(sqlite3 *, SubProgram *, int); | > > < < < | 7541 7542 7543 7544 7545 7546 7547 7548 7549 7550 7551 7552 7553 7554 7555 7556 7557 | SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); SQLITE_PRIVATE void sqlite3VdbeProgramDelete(sqlite3 *, SubProgram *, int); SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe*, int, u8); SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,char*,int); SQLITE_PRIVATE void sqlite3VdbeDeleteUnpackedRecord(UnpackedRecord*); SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); #ifndef NDEBUG SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...); |
| ︙ | ︙ | |||
9199 9200 9201 9202 9203 9204 9205 |
** space is allocated for the fields below this point. An attempt to
** access them will result in a segfault or malfunction.
*********************************************************************/
int iTable; /* TK_COLUMN: cursor number of table holding column
** TK_REGISTER: register number
** TK_TRIGGER: 1 -> new, 0 -> old */
| | > | 9207 9208 9209 9210 9211 9212 9213 9214 9215 9216 9217 9218 9219 9220 9221 9222 |
** space is allocated for the fields below this point. An attempt to
** access them will result in a segfault or malfunction.
*********************************************************************/
int iTable; /* TK_COLUMN: cursor number of table holding column
** TK_REGISTER: register number
** TK_TRIGGER: 1 -> new, 0 -> old */
i16 iColumn; /* TK_COLUMN: column index. -1 for rowid.
** TK_VARIABLE: variable number (always >= 1). */
i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */
i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */
u8 flags2; /* Second set of flags. EP2_... */
u8 op2; /* If a TK_REGISTER, the original value of Expr.op */
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
Table *pTab; /* Table for TK_COLUMN expressions. */
#if SQLITE_MAX_EXPR_DEPTH>0
|
| ︙ | ︙ | |||
9741 9742 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 | /* Above is constant between recursions. Below is reset before and after ** each recursion */ int nVar; /* Number of '?' variables seen in the SQL so far */ int nVarExpr; /* Number of used slots in apVarExpr[] */ int nVarExprAlloc; /* Number of allocated slots in apVarExpr[] */ Expr **apVarExpr; /* Pointers to :aaa and $aaaa wildcard expressions */ int nAlias; /* Number of aliased result set columns */ int nAliasAlloc; /* Number of allocated slots for aAlias[] */ int *aAlias; /* Register used to hold aliased result */ u8 explain; /* True if the EXPLAIN flag is found on the query */ Token sNameToken; /* Token with unqualified schema object name */ Token sLastToken; /* The last token parsed */ const char *zTail; /* All SQL text past the last semicolon parsed */ | > | 9750 9751 9752 9753 9754 9755 9756 9757 9758 9759 9760 9761 9762 9763 9764 | /* Above is constant between recursions. Below is reset before and after ** each recursion */ int nVar; /* Number of '?' variables seen in the SQL so far */ int nVarExpr; /* Number of used slots in apVarExpr[] */ int nVarExprAlloc; /* Number of allocated slots in apVarExpr[] */ Expr **apVarExpr; /* Pointers to :aaa and $aaaa wildcard expressions */ Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ int nAlias; /* Number of aliased result set columns */ int nAliasAlloc; /* Number of allocated slots for aAlias[] */ int *aAlias; /* Register used to hold aliased result */ u8 explain; /* True if the EXPLAIN flag is found on the query */ Token sNameToken; /* Token with unqualified schema object name */ Token sLastToken; /* The last token parsed */ const char *zTail; /* All SQL text past the last semicolon parsed */ |
| ︙ | ︙ | |||
10250 10251 10252 10253 10254 10255 10256 | SQLITE_PRIVATE void sqlite3Vacuum(Parse*); SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*); SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); | < | 10260 10261 10262 10263 10264 10265 10266 10267 10268 10269 10270 10271 10272 10273 | SQLITE_PRIVATE void sqlite3Vacuum(Parse*); SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*); SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); SQLITE_PRIVATE void sqlite3PrngSaveState(void); SQLITE_PRIVATE void sqlite3PrngRestoreState(void); SQLITE_PRIVATE void sqlite3PrngResetState(void); SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*); SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int); SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int); SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*); |
| ︙ | ︙ | |||
10449 10450 10451 10452 10453 10454 10455 | SQLITE_PRIVATE void sqlite3RootPageMoved(Db*, int, int); SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); SQLITE_PRIVATE void sqlite3AlterFunctions(sqlite3*); SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*); | | | 10458 10459 10460 10461 10462 10463 10464 10465 10466 10467 10468 10469 10470 10471 10472 | SQLITE_PRIVATE void sqlite3RootPageMoved(Db*, int, int); SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); SQLITE_PRIVATE void sqlite3AlterFunctions(sqlite3*); SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*); SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int); SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); |
| ︙ | ︙ | |||
10484 10485 10486 10487 10488 10489 10490 10491 10492 10493 10494 10495 10496 10497 | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int); SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int); SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*); SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); /* ** The interface to the LEMON-generated parser */ | > | 10493 10494 10495 10496 10497 10498 10499 10500 10501 10502 10503 10504 10505 10506 10507 | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int); SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int); SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*); SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); /* ** The interface to the LEMON-generated parser */ |
| ︙ | ︙ | |||
15702 15703 15704 15705 15706 15707 15708 |
** Attempt to release up to n bytes of non-essential memory currently
** held by SQLite. An example of non-essential memory is memory used to
** cache database pages that are not currently in use.
*/
SQLITE_API int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
int nRet = 0;
| < < < | 15712 15713 15714 15715 15716 15717 15718 15719 15720 15721 15722 15723 15724 15725 |
** Attempt to release up to n bytes of non-essential memory currently
** held by SQLite. An example of non-essential memory is memory used to
** cache database pages that are not currently in use.
*/
SQLITE_API int sqlite3_release_memory(int n){
#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
int nRet = 0;
nRet += sqlite3PcacheReleaseMemory(n-nRet);
return nRet;
#else
UNUSED_PARAMETER(n);
return SQLITE_OK;
#endif
}
|
| ︙ | ︙ | |||
17826 17827 17828 17829 17830 17831 17832 17833 17834 17835 17836 17837 17838 17839 | i64 nStmtDefCons; /* Number of def. constraints when stmt started */ int iStatement; /* Statement number (or 0 if has not opened stmt) */ #ifdef SQLITE_DEBUG FILE *trace; /* Write an execution trace here, if not NULL */ #endif VdbeFrame *pFrame; /* Parent frame */ int nFrame; /* Number of frames in pFrame list */ }; /* ** The following are allowed values for Vdbe.magic */ #define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */ #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ | > | 17833 17834 17835 17836 17837 17838 17839 17840 17841 17842 17843 17844 17845 17846 17847 | i64 nStmtDefCons; /* Number of def. constraints when stmt started */ int iStatement; /* Statement number (or 0 if has not opened stmt) */ #ifdef SQLITE_DEBUG FILE *trace; /* Write an execution trace here, if not NULL */ #endif VdbeFrame *pFrame; /* Parent frame */ int nFrame; /* Number of frames in pFrame list */ u32 expmask; /* Binding to these vars invalidates VM */ }; /* ** The following are allowed values for Vdbe.magic */ #define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */ #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ |
| ︙ | ︙ | |||
17888 17889 17890 17891 17892 17893 17894 | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); SQLITE_PRIVATE const char *sqlite3OpcodeName(int); SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int, int); SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); | < | < | 17896 17897 17898 17899 17900 17901 17902 17903 17904 17905 17906 17907 17908 17909 17910 | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); SQLITE_PRIVATE const char *sqlite3OpcodeName(int); SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int, int); SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); #ifndef SQLITE_OMIT_FOREIGN_KEY SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int); #else # define sqlite3VdbeCheckFk(p,i) 0 #endif |
| ︙ | ︙ | |||
17990 17991 17992 17993 17994 17995 17996 |
*zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \
*zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \
*zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \
*zOut++ = (u8)(c&0x00FF); \
} \
}
| | | | | | 17996 17997 17998 17999 18000 18001 18002 18003 18004 18005 18006 18007 18008 18009 18010 18011 18012 18013 18014 18015 18016 18017 18018 18019 18020 18021 18022 18023 |
*zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \
*zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \
*zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \
*zOut++ = (u8)(c&0x00FF); \
} \
}
#define READ_UTF16LE(zIn, TERM, c){ \
c = (*zIn++); \
c += ((*zIn++)<<8); \
if( c>=0xD800 && c<0xE000 && TERM ){ \
int c2 = (*zIn++); \
c2 += ((*zIn++)<<8); \
c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \
} \
}
#define READ_UTF16BE(zIn, TERM, c){ \
c = ((*zIn++)<<8); \
c += (*zIn++); \
if( c>=0xD800 && c<0xE000 && TERM ){ \
int c2 = ((*zIn++)<<8); \
c2 += (*zIn++); \
c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \
} \
}
/*
|
| ︙ | ︙ | |||
18188 18189 18190 18191 18192 18193 18194 |
pMem->n = (int)(z - zOut);
*z++ = 0;
}else{
assert( desiredEnc==SQLITE_UTF8 );
if( pMem->enc==SQLITE_UTF16LE ){
/* UTF-16 Little-endian -> UTF-8 */
while( zIn<zTerm ){
| | | | 18194 18195 18196 18197 18198 18199 18200 18201 18202 18203 18204 18205 18206 18207 18208 18209 18210 18211 18212 18213 18214 |
pMem->n = (int)(z - zOut);
*z++ = 0;
}else{
assert( desiredEnc==SQLITE_UTF8 );
if( pMem->enc==SQLITE_UTF16LE ){
/* UTF-16 Little-endian -> UTF-8 */
while( zIn<zTerm ){
READ_UTF16LE(zIn, zIn<zTerm, c);
WRITE_UTF8(z, c);
}
}else{
/* UTF-16 Big-endian -> UTF-8 */
while( zIn<zTerm ){
READ_UTF16BE(zIn, zIn<zTerm, c);
WRITE_UTF8(z, c);
}
}
pMem->n = (int)(z - zOut);
}
*z = 0;
assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
|
| ︙ | ︙ | |||
18364 18365 18366 18367 18368 18369 18370 | assert( m.z==m.zMalloc ); *pnOut = m.n; return m.z; } #endif /* | | > < < < < < < < < < | | | 18370 18371 18372 18373 18374 18375 18376 18377 18378 18379 18380 18381 18382 18383 18384 18385 18386 18387 18388 18389 18390 18391 18392 18393 18394 18395 18396 18397 18398 18399 18400 |
assert( m.z==m.zMalloc );
*pnOut = m.n;
return m.z;
}
#endif
/*
** zIn is a UTF-16 encoded unicode string at least nChar characters long.
** Return the number of bytes in the first nChar unicode characters
** in pZ. nChar must be non-negative.
*/
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
int c;
unsigned char const *z = zIn;
int n = 0;
if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){
while( n<nChar ){
READ_UTF16BE(z, 1, c);
n++;
}
}else{
while( n<nChar ){
READ_UTF16LE(z, 1, c);
n++;
}
}
return (int)(z-(unsigned char const *)zIn);
}
#if defined(SQLITE_TEST)
|
| ︙ | ︙ | |||
18430 18431 18432 18433 18434 18435 18436 |
if( i>=0xD800 && i<0xE000 ) continue;
z = zBuf;
WRITE_UTF16LE(z, i);
n = (int)(z-zBuf);
assert( n>0 && n<=4 );
z[0] = 0;
z = zBuf;
| | | | 18428 18429 18430 18431 18432 18433 18434 18435 18436 18437 18438 18439 18440 18441 18442 18443 18444 18445 18446 18447 18448 18449 18450 18451 18452 18453 18454 |
if( i>=0xD800 && i<0xE000 ) continue;
z = zBuf;
WRITE_UTF16LE(z, i);
n = (int)(z-zBuf);
assert( n>0 && n<=4 );
z[0] = 0;
z = zBuf;
READ_UTF16LE(z, 1, c);
assert( c==i );
assert( (z-zBuf)==n );
}
for(i=0; i<0x00110000; i++){
if( i>=0xD800 && i<0xE000 ) continue;
z = zBuf;
WRITE_UTF16BE(z, i);
n = (int)(z-zBuf);
assert( n>0 && n<=4 );
z[0] = 0;
z = zBuf;
READ_UTF16BE(z, 1, c);
assert( c==i );
assert( (z-zBuf)==n );
}
}
#endif /* SQLITE_TEST */
#endif /* SQLITE_OMIT_UTF16 */
|
| ︙ | ︙ | |||
19832 19833 19834 19835 19836 19837 19838 |
/************** End of hash.c ************************************************/
/************** Begin file opcodes.c *****************************************/
/* Automatically generated. Do not edit */
/* See the mkopcodec.awk script for details. */
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
static const char *const azName[] = { "?",
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 19830 19831 19832 19833 19834 19835 19836 19837 19838 19839 19840 19841 19842 19843 19844 19845 19846 19847 19848 19849 19850 19851 19852 19853 19854 19855 19856 19857 19858 19859 19860 19861 19862 19863 19864 19865 19866 19867 19868 19869 19870 19871 19872 19873 19874 19875 19876 19877 19878 19879 19880 19881 19882 19883 19884 19885 19886 19887 19888 19889 19890 19891 19892 19893 19894 19895 19896 19897 19898 19899 19900 19901 19902 19903 19904 19905 19906 19907 19908 19909 19910 19911 19912 19913 19914 19915 19916 19917 19918 19919 19920 19921 19922 19923 19924 19925 19926 19927 19928 19929 19930 19931 19932 19933 19934 19935 19936 19937 19938 19939 19940 19941 19942 19943 19944 19945 19946 19947 19948 19949 19950 19951 19952 19953 19954 19955 19956 19957 19958 19959 19960 19961 19962 19963 19964 19965 19966 19967 19968 19969 19970 19971 19972 19973 19974 19975 19976 19977 |
/************** End of hash.c ************************************************/
/************** Begin file opcodes.c *****************************************/
/* Automatically generated. Do not edit */
/* See the mkopcodec.awk script for details. */
#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG)
SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
static const char *const azName[] = { "?",
/* 1 */ "ReadCookie",
/* 2 */ "AutoCommit",
/* 3 */ "Found",
/* 4 */ "NullRow",
/* 5 */ "RowSetTest",
/* 6 */ "Variable",
/* 7 */ "RealAffinity",
/* 8 */ "Sort",
/* 9 */ "Affinity",
/* 10 */ "IfNot",
/* 11 */ "Gosub",
/* 12 */ "NotFound",
/* 13 */ "ResultRow",
/* 14 */ "SeekLe",
/* 15 */ "Rowid",
/* 16 */ "CreateIndex",
/* 17 */ "Explain",
/* 18 */ "DropIndex",
/* 19 */ "Not",
/* 20 */ "Null",
/* 21 */ "Program",
/* 22 */ "Int64",
/* 23 */ "LoadAnalysis",
/* 24 */ "IdxInsert",
/* 25 */ "VUpdate",
/* 26 */ "Next",
/* 27 */ "SeekLt",
/* 28 */ "Rewind",
/* 29 */ "RowSetRead",
/* 30 */ "Last",
/* 31 */ "MustBeInt",
/* 32 */ "IncrVacuum",
/* 33 */ "String",
/* 34 */ "VFilter",
/* 35 */ "Count",
/* 36 */ "Close",
/* 37 */ "AggFinal",
/* 38 */ "RowData",
/* 39 */ "IdxRowid",
/* 40 */ "Param",
/* 41 */ "Pagecount",
/* 42 */ "SeekGe",
/* 43 */ "OpenPseudo",
/* 44 */ "Halt",
/* 45 */ "Compare",
/* 46 */ "NewRowid",
/* 47 */ "IdxLT",
/* 48 */ "SeekGt",
/* 49 */ "MemMax",
/* 50 */ "Function",
/* 51 */ "IntegrityCk",
/* 52 */ "FkCounter",
/* 53 */ "SCopy",
/* 54 */ "IfNeg",
/* 55 */ "NotExists",
/* 56 */ "VDestroy",
/* 57 */ "IdxDelete",
/* 58 */ "Vacuum",
/* 59 */ "Copy",
/* 60 */ "If",
/* 61 */ "Jump",
/* 62 */ "Destroy",
/* 63 */ "AggStep",
/* 64 */ "Clear",
/* 65 */ "Insert",
/* 66 */ "Permutation",
/* 67 */ "VBegin",
/* 68 */ "Or",
/* 69 */ "And",
/* 70 */ "OpenEphemeral",
/* 71 */ "IdxGE",
/* 72 */ "Trace",
/* 73 */ "IsNull",
/* 74 */ "NotNull",
/* 75 */ "Ne",
/* 76 */ "Eq",
/* 77 */ "Gt",
/* 78 */ "Le",
/* 79 */ "Lt",
/* 80 */ "Ge",
/* 81 */ "MakeRecord",
/* 82 */ "BitAnd",
/* 83 */ "BitOr",
/* 84 */ "ShiftLeft",
/* 85 */ "ShiftRight",
/* 86 */ "Add",
/* 87 */ "Subtract",
/* 88 */ "Multiply",
/* 89 */ "Divide",
/* 90 */ "Remainder",
/* 91 */ "Concat",
/* 92 */ "Yield",
/* 93 */ "BitNot",
/* 94 */ "String8",
/* 95 */ "SetCookie",
/* 96 */ "Prev",
/* 97 */ "DropTrigger",
/* 98 */ "FkIfZero",
/* 99 */ "VColumn",
/* 100 */ "Return",
/* 101 */ "OpenWrite",
/* 102 */ "Integer",
/* 103 */ "Transaction",
/* 104 */ "IfPos",
/* 105 */ "RowSetAdd",
/* 106 */ "CollSeq",
/* 107 */ "Savepoint",
/* 108 */ "VRename",
/* 109 */ "Sequence",
/* 110 */ "HaltIfNull",
/* 111 */ "VCreate",
/* 112 */ "CreateTable",
/* 113 */ "AddImm",
/* 114 */ "DropTable",
/* 115 */ "IsUnique",
/* 116 */ "VOpen",
/* 117 */ "IfZero",
/* 118 */ "Noop",
/* 119 */ "InsertInt",
/* 120 */ "RowKey",
/* 121 */ "Expire",
/* 122 */ "Delete",
/* 123 */ "Blob",
/* 124 */ "Move",
/* 125 */ "Goto",
/* 126 */ "ParseSchema",
/* 127 */ "VNext",
/* 128 */ "Seek",
/* 129 */ "TableLock",
/* 130 */ "Real",
/* 131 */ "VerifyCookie",
/* 132 */ "Column",
/* 133 */ "OpenRead",
/* 134 */ "ResetCount",
/* 135 */ "NotUsed_135",
/* 136 */ "NotUsed_136",
/* 137 */ "NotUsed_137",
/* 138 */ "NotUsed_138",
/* 139 */ "NotUsed_139",
/* 140 */ "NotUsed_140",
/* 141 */ "ToText",
|
| ︙ | ︙ | |||
24100 24101 24102 24103 24104 24105 24106 |
}
}
/* If control gets to this point, then actually go ahead and make
** operating system calls for the specified lock.
*/
if( locktype==SHARED_LOCK ){
| | > | 24098 24099 24100 24101 24102 24103 24104 24105 24106 24107 24108 24109 24110 24111 24112 24113 |
}
}
/* If control gets to this point, then actually go ahead and make
** operating system calls for the specified lock.
*/
if( locktype==SHARED_LOCK ){
int lk, lrc1, lrc2;
int lrc1Errno = 0;
/* Now get the read-lock SHARED_LOCK */
/* note that the quality of the randomness doesn't matter that much */
lk = random();
context->sharedByte = (lk & 0x7fffffff)%(SHARED_SIZE - 1);
lrc1 = afpSetLock(context->dbPath, pFile,
SHARED_FIRST+context->sharedByte, 1, 1);
|
| ︙ | ︙ | |||
27245 27246 27247 27248 27249 27250 27251 | /* ** Determine if we are dealing with WindowsCE - which has a much ** reduced API. */ #if SQLITE_OS_WINCE # define AreFileApisANSI() 1 | | | 27244 27245 27246 27247 27248 27249 27250 27251 27252 27253 27254 27255 27256 27257 27258 | /* ** Determine if we are dealing with WindowsCE - which has a much ** reduced API. */ #if SQLITE_OS_WINCE # define AreFileApisANSI() 1 # define FormatMessageW(a,b,c,d,e,f,g) 0 #endif /* ** WinCE lacks native support for file locking so we have to fake it ** with some code of our own. */ #if SQLITE_OS_WINCE |
| ︙ | ︙ | |||
28419 28420 28421 28422 28423 28424 28425 |
/*
** The return value of getLastErrorMsg
** is zero if the error message fits in the buffer, or non-zero
** otherwise (if the message was truncated).
*/
static int getLastErrorMsg(int nBuf, char *zBuf){
| < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | < > | < > > | > > | | > > > > > > > > | 28418 28419 28420 28421 28422 28423 28424 28425 28426 28427 28428 28429 28430 28431 28432 28433 28434 28435 28436 28437 28438 28439 28440 28441 28442 28443 28444 28445 28446 28447 28448 28449 28450 28451 28452 28453 28454 28455 28456 28457 28458 28459 28460 28461 28462 28463 28464 28465 28466 28467 28468 28469 28470 28471 28472 28473 28474 28475 28476 28477 28478 28479 28480 28481 28482 28483 28484 |
/*
** The return value of getLastErrorMsg
** is zero if the error message fits in the buffer, or non-zero
** otherwise (if the message was truncated).
*/
static int getLastErrorMsg(int nBuf, char *zBuf){
/* FormatMessage returns 0 on failure. Otherwise it
** returns the number of TCHARs written to the output
** buffer, excluding the terminating null char.
*/
DWORD error = GetLastError();
DWORD dwLen = 0;
char *zOut;
if( isNT() ){
WCHAR *zTempWide = NULL;
dwLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
0,
(LPWSTR) &zTempWide,
0,
0);
if( dwLen > 0 ){
/* allocate a buffer and convert to UTF8 */
zOut = unicodeToUtf8(zTempWide);
/* free the system buffer allocated by FormatMessage */
LocalFree(zTempWide);
}
/* isNT() is 1 if SQLITE_OS_WINCE==1, so this else is never executed.
** Since the ASCII version of these Windows API do not exist for WINCE,
** it's important to not reference them for WINCE builds.
*/
#if SQLITE_OS_WINCE==0
}else{
char *zTemp = NULL;
dwLen = FormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
error,
0,
(LPSTR) &zTemp,
0,
0);
if( dwLen > 0 ){
/* allocate a buffer and convert to UTF8 */
zOut = sqlite3_win32_mbcs_to_utf8(zTemp);
/* free the system buffer allocated by FormatMessage */
LocalFree(zTemp);
}
#endif
}
if( 0 == dwLen ){
sqlite3_snprintf(nBuf, zBuf, "OsError 0x%x (%u)", error, error);
}else{
/* copy a maximum of nBuf chars to output buffer */
sqlite3_snprintf(nBuf, zBuf, "%s", zOut);
/* free the UTF8 buffer */
free(zOut);
}
return 0;
}
/*
** Open a file.
*/
static int winOpen(
|
| ︙ | ︙ | |||
28807 28808 28809 28810 28811 28812 28813 |
dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,
&dwDummy,
&bytesPerSector,
&dwDummy,
&dwDummy);
}else{
/* trim path to just drive reference */
| | | | 28838 28839 28840 28841 28842 28843 28844 28845 28846 28847 28848 28849 28850 28851 28852 28853 28854 28855 28856 28857 28858 28859 |
dwRet = GetDiskFreeSpaceW((WCHAR*)zConverted,
&dwDummy,
&bytesPerSector,
&dwDummy,
&dwDummy);
}else{
/* trim path to just drive reference */
char *p = (char *)zConverted;
for(;*p;p++){
if( *p == '\\' ){
*p = '\0';
break;
}
}
dwRet = GetDiskFreeSpaceA((char*)zConverted,
&dwDummy,
&bytesPerSector,
&dwDummy,
&dwDummy);
}
free(zConverted);
}
|
| ︙ | ︙ | |||
36673 36674 36675 36676 36677 36678 36679 | ** page has a small header which contains the Ptr(N) pointer and other ** information such as the size of key and data. ** ** FORMAT DETAILS ** ** The file is divided into pages. The first page is called page 1, ** the second is page 2, and so forth. A page number of zero indicates | | | | | 36704 36705 36706 36707 36708 36709 36710 36711 36712 36713 36714 36715 36716 36717 36718 36719 36720 | ** page has a small header which contains the Ptr(N) pointer and other ** information such as the size of key and data. ** ** FORMAT DETAILS ** ** The file is divided into pages. The first page is called page 1, ** the second is page 2, and so forth. A page number of zero indicates ** "no such page". The page size can be any power of 2 between 512 and 32768. ** Each page can be either a btree page, a freelist page, an overflow ** page, or a pointer-map page. ** ** The first page is always a btree page. The first 100 bytes of the first ** page contain a special header (the "file header") that describes the file. ** The format of the file header is as follows: ** ** OFFSET SIZE DESCRIPTION ** 0 16 Header string: "SQLite format 3\000" |
| ︙ | ︙ | |||
36953 36954 36955 36956 36957 36958 36959 | ** A database connection contains a pointer to an instance of ** this object for every database file that it has open. This structure ** is opaque to the database connection. The database connection cannot ** see the internals of this structure and only deals with pointers to ** this structure. ** ** For some database files, the same underlying database cache might be | | | | 36984 36985 36986 36987 36988 36989 36990 36991 36992 36993 36994 36995 36996 36997 36998 36999 | ** A database connection contains a pointer to an instance of ** this object for every database file that it has open. This structure ** is opaque to the database connection. The database connection cannot ** see the internals of this structure and only deals with pointers to ** this structure. ** ** For some database files, the same underlying database cache might be ** shared between multiple connections. In that case, each connection ** has it own instance of this object. But each instance of this object ** points to the same BtShared object. The database cache and the ** schema associated with the database file are all contained within ** the BtShared object. ** ** All fields in this structure are accessed under sqlite3.mutex. ** The pBt pointer itself may not be changed while there exists cursors ** in the referenced BtShared that point back to this Btree since those |
| ︙ | ︙ | |||
37095 37096 37097 37098 37099 37100 37101 | /* ** A cursor is a pointer to a particular entry within a particular ** b-tree within a database file. ** ** The entry is identified by its MemPage and the index in ** MemPage.aCell[] of the entry. ** | | | 37126 37127 37128 37129 37130 37131 37132 37133 37134 37135 37136 37137 37138 37139 37140 |
/*
** A cursor is a pointer to a particular entry within a particular
** b-tree within a database file.
**
** The entry is identified by its MemPage and the index in
** MemPage.aCell[] of the entry.
**
** A single database file can shared by two more database connections,
** but cursors cannot be shared. Each cursor is associated with a
** particular database connection identified BtCursor.pBtree.db.
**
** Fields in this structure are accessed under the BtShared.mutex
** found at self->pBt->mutex.
*/
struct BtCursor {
|
| ︙ | ︙ | |||
37699 37700 37701 37702 37703 37704 37705 | #define hasReadConflicts(a, b) 0 #endif #ifndef SQLITE_OMIT_SHARED_CACHE #ifdef SQLITE_DEBUG /* | | > | | > | | | | | | | | < < < | < > > > > > > > > > | 37730 37731 37732 37733 37734 37735 37736 37737 37738 37739 37740 37741 37742 37743 37744 37745 37746 37747 37748 37749 37750 37751 37752 37753 37754 37755 37756 37757 37758 37759 37760 37761 37762 37763 37764 37765 37766 37767 37768 37769 37770 37771 37772 37773 37774 37775 37776 37777 37778 37779 37780 37781 37782 37783 37784 37785 37786 37787 37788 37789 37790 37791 37792 |
#define hasReadConflicts(a, b) 0
#endif
#ifndef SQLITE_OMIT_SHARED_CACHE
#ifdef SQLITE_DEBUG
/*
**** This function is only used as part of an assert() statement. ***
**
** Check to see if pBtree holds the required locks to read or write to the
** table with root page iRoot. Return 1 if it does and 0 if not.
**
** For example, when writing to a table with root-page iRoot via
** Btree connection pBtree:
**
** assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) );
**
** When writing to an index that resides in a sharable database, the
** caller should have first obtained a lock specifying the root page of
** the corresponding table. This makes things a bit more complicated,
** as this module treats each table as a separate structure. To determine
** the table corresponding to the index being written, this
** function has to search through the database schema.
**
** Instead of a lock on the table/index rooted at page iRoot, the caller may
** hold a write-lock on the schema table (root page 1). This is also
** acceptable.
*/
static int hasSharedCacheTableLock(
Btree *pBtree, /* Handle that must hold lock */
Pgno iRoot, /* Root page of b-tree */
int isIndex, /* True if iRoot is the root of an index b-tree */
int eLockType /* Required lock type (READ_LOCK or WRITE_LOCK) */
){
Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
Pgno iTab = 0;
BtLock *pLock;
/* If this database is not shareable, or if the client is reading
** and has the read-uncommitted flag set, then no lock is required.
** Return true immediately.
*/
if( (pBtree->sharable==0)
|| (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))
){
return 1;
}
/* If the client is reading or writing an index and the schema is
** not loaded, then it is too difficult to actually check to see if
** the correct locks are held. So do not bother - just return true.
** This case does not come up very often anyhow.
*/
if( isIndex && (!pSchema || (pSchema->flags&DB_SchemaLoaded)==0) ){
return 1;
}
/* Figure out the root-page that the lock should be held on. For table
** b-trees, this is just the root page of the b-tree being read or
** written. For index b-trees, it is the root page of the associated
** table. */
if( isIndex ){
HashElem *p;
|
| ︙ | ︙ | |||
37773 37774 37775 37776 37777 37778 37779 37780 37781 |
return 1;
}
}
/* Failed to find the required lock. */
return 0;
}
/*
| > > | < > > > > > > > | | > | > | | | 37811 37812 37813 37814 37815 37816 37817 37818 37819 37820 37821 37822 37823 37824 37825 37826 37827 37828 37829 37830 37831 37832 37833 37834 37835 37836 37837 37838 37839 37840 37841 37842 37843 37844 37845 37846 37847 37848 37849 37850 37851 37852 37853 37854 37855 37856 37857 37858 37859 37860 37861 37862 37863 37864 37865 37866 37867 37868 37869 37870 37871 37872 37873 37874 37875 37876 37877 37878 37879 37880 37881 37882 |
return 1;
}
}
/* Failed to find the required lock. */
return 0;
}
#endif /* SQLITE_DEBUG */
#ifdef SQLITE_DEBUG
/*
**** This function may be used as part of assert() statements only. ****
**
** Return true if it would be illegal for pBtree to write into the
** table or index rooted at iRoot because other shared connections are
** simultaneously reading that same table or index.
**
** It is illegal for pBtree to write if some other Btree object that
** shares the same BtShared object is currently reading or writing
** the iRoot table. Except, if the other Btree object has the
** read-uncommitted flag set, then it is OK for the other object to
** have a read cursor.
**
** For example, before writing to any part of the table or index
** rooted at page iRoot, one should call:
**
** assert( !hasReadConflicts(pBtree, iRoot) );
*/
static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
BtCursor *p;
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
if( p->pgnoRoot==iRoot
&& p->pBtree!=pBtree
&& 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted)
){
return 1;
}
}
return 0;
}
#endif /* #ifdef SQLITE_DEBUG */
/*
** Query to see if Btree handle p may obtain a lock of type eLock
** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return
** SQLITE_OK if the lock may be obtained (by calling
** setSharedCacheTableLock()), or SQLITE_LOCKED if not.
*/
static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
BtShared *pBt = p->pBt;
BtLock *pIter;
assert( sqlite3BtreeHoldsMutex(p) );
assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
assert( p->db!=0 );
assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 );
/* If requesting a write-lock, then the Btree must have an open write
** transaction on this file. And, obviously, for this to be so there
** must be an open write transaction on the file itself.
*/
assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) );
assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE );
/* This routine is a no-op if the shared-cache is not enabled */
if( !p->sharable ){
return SQLITE_OK;
}
/* If some other connection is holding an exclusive lock, the
** requested lock may not be obtained.
*/
|
| ︙ | ︙ | |||
37866 37867 37868 37869 37870 37871 37872 | /* ** Add a lock on the table with root-page iTable to the shared-btree used ** by Btree handle p. Parameter eLock must be either READ_LOCK or ** WRITE_LOCK. ** ** This function assumes the following: ** | | | | | 37914 37915 37916 37917 37918 37919 37920 37921 37922 37923 37924 37925 37926 37927 37928 37929 37930 37931 |
/*
** Add a lock on the table with root-page iTable to the shared-btree used
** by Btree handle p. Parameter eLock must be either READ_LOCK or
** WRITE_LOCK.
**
** This function assumes the following:
**
** (a) The specified Btree object p is connected to a sharable
** database (one with the BtShared.sharable flag set), and
**
** (b) No other Btree objects hold a lock that conflicts
** with the requested lock (i.e. querySharedCacheTableLock() has
** already been called and returned SQLITE_OK).
**
** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM
** is returned if a malloc attempt fails.
*/
static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
|
| ︙ | ︙ | |||
37934 37935 37936 37937 37938 37939 37940 | return SQLITE_OK; } #endif /* !SQLITE_OMIT_SHARED_CACHE */ #ifndef SQLITE_OMIT_SHARED_CACHE /* ** Release all the table locks (locks obtained via calls to | | | | 37982 37983 37984 37985 37986 37987 37988 37989 37990 37991 37992 37993 37994 37995 37996 37997 37998 |
return SQLITE_OK;
}
#endif /* !SQLITE_OMIT_SHARED_CACHE */
#ifndef SQLITE_OMIT_SHARED_CACHE
/*
** Release all the table locks (locks obtained via calls to
** the setSharedCacheTableLock() procedure) held by Btree object p.
**
** This function assumes that Btree p has an open read or write
** transaction. If it does not, then the BtShared.isPending variable
** may be incorrectly cleared.
*/
static void clearAllSharedCacheTableLocks(Btree *p){
BtShared *pBt = p->pBt;
BtLock **ppIter = &pBt->pLock;
|
| ︙ | ︙ | |||
37969 37970 37971 37972 37973 37974 37975 |
assert( pBt->isPending==0 || pBt->pWriter );
if( pBt->pWriter==p ){
pBt->pWriter = 0;
pBt->isExclusive = 0;
pBt->isPending = 0;
}else if( pBt->nTransaction==2 ){
| | | > > | | | 38017 38018 38019 38020 38021 38022 38023 38024 38025 38026 38027 38028 38029 38030 38031 38032 38033 38034 38035 38036 38037 38038 38039 38040 38041 38042 38043 38044 38045 38046 38047 38048 38049 38050 38051 38052 38053 38054 38055 38056 38057 38058 38059 38060 38061 38062 38063 38064 38065 38066 38067 38068 38069 38070 |
assert( pBt->isPending==0 || pBt->pWriter );
if( pBt->pWriter==p ){
pBt->pWriter = 0;
pBt->isExclusive = 0;
pBt->isPending = 0;
}else if( pBt->nTransaction==2 ){
/* This function is called when Btree p is concluding its
** transaction. If there currently exists a writer, and p is not
** that writer, then the number of locks held by connections other
** than the writer must be about to drop to zero. In this case
** set the isPending flag to 0.
**
** If there is not currently a writer, then BtShared.isPending must
** be zero already. So this next line is harmless in that case.
*/
pBt->isPending = 0;
}
}
/*
** This function changes all write-locks held by Btree p into read-locks.
*/
static void downgradeAllSharedCacheTableLocks(Btree *p){
BtShared *pBt = p->pBt;
if( pBt->pWriter==p ){
BtLock *pLock;
pBt->pWriter = 0;
pBt->isExclusive = 0;
pBt->isPending = 0;
for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){
assert( pLock->eLock==READ_LOCK || pLock->pBtree==p );
pLock->eLock = READ_LOCK;
}
}
}
#endif /* SQLITE_OMIT_SHARED_CACHE */
static void releasePage(MemPage *pPage); /* Forward reference */
/*
***** This routine is used inside of assert() only ****
**
** Verify that the cursor holds the mutex on its BtShared
*/
#ifdef SQLITE_DEBUG
static int cursorHoldsMutex(BtCursor *p){
return sqlite3_mutex_held(p->pBt->mutex);
}
#endif
#ifndef SQLITE_OMIT_INCRBLOB
|
| ︙ | ︙ | |||
38037 38038 38039 38040 38041 38042 38043 |
for(p=pBt->pCursor; p; p=p->pNext){
invalidateOverflowCache(p);
}
}
/*
** This function is called before modifying the contents of a table
| | | > | | 38087 38088 38089 38090 38091 38092 38093 38094 38095 38096 38097 38098 38099 38100 38101 38102 38103 38104 38105 38106 38107 38108 38109 38110 38111 38112 38113 38114 38115 38116 38117 38118 38119 38120 38121 38122 38123 38124 38125 38126 38127 38128 38129 38130 38131 38132 |
for(p=pBt->pCursor; p; p=p->pNext){
invalidateOverflowCache(p);
}
}
/*
** This function is called before modifying the contents of a table
** to invalidate any incrblob cursors that are open on the
** row or one of the rows being modified.
**
** If argument isClearTable is true, then the entire contents of the
** table is about to be deleted. In this case invalidate all incrblob
** cursors open on any row within the table with root-page pgnoRoot.
**
** Otherwise, if argument isClearTable is false, then the row with
** rowid iRow is being replaced or deleted. In this case invalidate
** only those incrblob cursors open on that specific row.
*/
static void invalidateIncrblobCursors(
Btree *pBtree, /* The database file to check */
i64 iRow, /* The rowid that might be changing */
int isClearTable /* True if all rows are being deleted */
){
BtCursor *p;
BtShared *pBt = pBtree->pBt;
assert( sqlite3BtreeHoldsMutex(pBtree) );
for(p=pBt->pCursor; p; p=p->pNext){
if( p->isIncrblobHandle && (isClearTable || p->info.nKey==iRow) ){
p->eState = CURSOR_INVALID;
}
}
}
#else
/* Stub functions when INCRBLOB is omitted */
#define invalidateOverflowCache(x)
#define invalidateAllOverflowCache(x)
#define invalidateIncrblobCursors(x,y,z)
#endif /* SQLITE_OMIT_INCRBLOB */
/*
** Set bit pgno of the BtShared.pHasContent bitvec. This is called
** when a page that previously contained data becomes a free-list leaf
** page.
**
** The BtShared.pHasContent bitvec exists to work around an obscure
|
| ︙ | ︙ | |||
38100 38101 38102 38103 38104 38105 38106 | ** is extracted from the free-list and reused, then the original data ** may be lost. In the event of a rollback, it may not be possible ** to restore the database to its original configuration. ** ** The solution is the BtShared.pHasContent bitvec. Whenever a page is ** moved to become a free-list leaf page, the corresponding bit is ** set in the bitvec. Whenever a leaf page is extracted from the free-list, | | | 38151 38152 38153 38154 38155 38156 38157 38158 38159 38160 38161 38162 38163 38164 38165 |
** is extracted from the free-list and reused, then the original data
** may be lost. In the event of a rollback, it may not be possible
** to restore the database to its original configuration.
**
** The solution is the BtShared.pHasContent bitvec. Whenever a page is
** moved to become a free-list leaf page, the corresponding bit is
** set in the bitvec. Whenever a leaf page is extracted from the free-list,
** optimization 2 above is omitted if the corresponding bit is already
** set in BtShared.pHasContent. The contents of the bitvec are cleared
** at the end of every transaction.
*/
static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
int rc = SQLITE_OK;
if( !pBt->pHasContent ){
int nPage = 100;
|
| ︙ | ︙ | |||
38196 38197 38198 38199 38200 38201 38202 | } invalidateOverflowCache(pCur); return rc; } /* | | | | 38247 38248 38249 38250 38251 38252 38253 38254 38255 38256 38257 38258 38259 38260 38261 38262 |
}
invalidateOverflowCache(pCur);
return rc;
}
/*
** Save the positions of all cursors (except pExcept) that are open on
** the table with root-page iRoot. Usually, this is called just before cursor
** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()).
*/
static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
BtCursor *p;
assert( sqlite3_mutex_held(pBt->mutex) );
assert( pExcept==0 || pExcept->pBt==pBt );
for(p=pBt->pCursor; p; p=p->pNext){
|
| ︙ | ︙ | |||
38602 38603 38604 38605 38606 38607 38608 |
if( nSize<4 ){
nSize = 4;
}
assert( nSize==debuginfo.nSize );
return (u16)nSize;
}
| | > > > | 38653 38654 38655 38656 38657 38658 38659 38660 38661 38662 38663 38664 38665 38666 38667 38668 38669 38670 |
if( nSize<4 ){
nSize = 4;
}
assert( nSize==debuginfo.nSize );
return (u16)nSize;
}
#ifdef SQLITE_DEBUG
/* This variation on cellSizePtr() is used inside of assert() statements
** only. */
static u16 cellSize(MemPage *pPage, int iCell){
return cellSizePtr(pPage, findCell(pPage, iCell));
}
#endif
#ifndef SQLITE_OMIT_AUTOVACUUM
/*
|
| ︙ | ︙ | |||
40574 40575 40576 40577 40578 40579 40580 |
/*
** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
** at the conclusion of a transaction.
*/
static void btreeEndTransaction(Btree *p){
BtShared *pBt = p->pBt;
| < < < < < < < < | > > > | 40628 40629 40630 40631 40632 40633 40634 40635 40636 40637 40638 40639 40640 40641 40642 40643 40644 40645 40646 40647 40648 |
/*
** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback()
** at the conclusion of a transaction.
*/
static void btreeEndTransaction(Btree *p){
BtShared *pBt = p->pBt;
assert( sqlite3BtreeHoldsMutex(p) );
btreeClearHasContent(pBt);
if( p->inTrans>TRANS_NONE && p->db->activeVdbeCnt>1 ){
/* If there are other active statements that belong to this database
** handle, downgrade to a read-only transaction. The other statements
** may still be reading from the database. */
downgradeAllSharedCacheTableLocks(p);
p->inTrans = TRANS_READ;
}else{
/* If the handle had any kind of transaction open, decrement the
** transaction count of the shared btree. If the transaction count
** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused()
** call below will unlock the pager. */
|
| ︙ | ︙ | |||
44045 44046 44047 44048 44049 44050 44051 |
const void *pData, int nData, /* The data of the new record */
int nZero, /* Number of extra 0 bytes to append to data */
int appendBias, /* True if this is likely an append */
int seekResult /* Result of prior MovetoUnpacked() call */
){
int rc;
int loc = seekResult; /* -1: before desired location +1: after */
| | | 44094 44095 44096 44097 44098 44099 44100 44101 44102 44103 44104 44105 44106 44107 44108 |
const void *pData, int nData, /* The data of the new record */
int nZero, /* Number of extra 0 bytes to append to data */
int appendBias, /* True if this is likely an append */
int seekResult /* Result of prior MovetoUnpacked() call */
){
int rc;
int loc = seekResult; /* -1: before desired location +1: after */
int szNew = 0;
int idx;
MemPage *pPage;
Btree *p = pCur->pBtree;
BtShared *pBt = p->pBt;
unsigned char *oldCell;
unsigned char *newCell = 0;
|
| ︙ | ︙ | |||
47101 47102 47103 47104 47105 47106 47107 47108 47109 47110 47111 47112 47113 47114 |
nVal = sqlite3Strlen30(zVal)-1;
assert( zVal[nVal]=='\'' );
sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
0, SQLITE_DYNAMIC);
}
#endif
*ppVal = pVal;
return SQLITE_OK;
no_mem:
db->mallocFailed = 1;
sqlite3DbFree(db, zVal);
sqlite3ValueFree(pVal);
| > > > | 47150 47151 47152 47153 47154 47155 47156 47157 47158 47159 47160 47161 47162 47163 47164 47165 47166 |
nVal = sqlite3Strlen30(zVal)-1;
assert( zVal[nVal]=='\'' );
sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2,
0, SQLITE_DYNAMIC);
}
#endif
if( pVal ){
sqlite3VdbeMemStoreType(pVal);
}
*ppVal = pVal;
return SQLITE_OK;
no_mem:
db->mallocFailed = 1;
sqlite3DbFree(db, zVal);
sqlite3ValueFree(pVal);
|
| ︙ | ︙ | |||
47205 47206 47207 47208 47209 47210 47211 47212 47213 47214 47215 47216 47217 |
return p;
}
/*
** Remember the SQL string for a prepared statement.
*/
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){
if( p==0 ) return;
#ifdef SQLITE_OMIT_TRACE
if( !isPrepareV2 ) return;
#endif
assert( p->zSql==0 );
p->zSql = sqlite3DbStrNDup(p->db, z, n);
| > | | 47257 47258 47259 47260 47261 47262 47263 47264 47265 47266 47267 47268 47269 47270 47271 47272 47273 47274 47275 47276 47277 47278 |
return p;
}
/*
** Remember the SQL string for a prepared statement.
*/
SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){
assert( isPrepareV2==1 || isPrepareV2==0 );
if( p==0 ) return;
#ifdef SQLITE_OMIT_TRACE
if( !isPrepareV2 ) return;
#endif
assert( p->zSql==0 );
p->zSql = sqlite3DbStrNDup(p->db, z, n);
p->isPrepareV2 = isPrepareV2;
}
/*
** Return the SQL associated with a prepared statement
*/
SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){
Vdbe *p = (Vdbe *)pStmt;
|
| ︙ | ︙ | |||
48165 48166 48167 48168 48169 48170 48171 |
for(i=0; i<p->nChildCsr; i++){
sqlite3VdbeFreeCursor(p->v, apCsr[i]);
}
releaseMemArray(aMem, p->nChildMem);
sqlite3DbFree(p->v->db, p);
}
| < < < < < < < < < < < < < < < < < < < < < | 48218 48219 48220 48221 48222 48223 48224 48225 48226 48227 48228 48229 48230 48231 |
for(i=0; i<p->nChildCsr; i++){
sqlite3VdbeFreeCursor(p->v, apCsr[i]);
}
releaseMemArray(aMem, p->nChildMem);
sqlite3DbFree(p->v->db, p);
}
#ifndef SQLITE_OMIT_EXPLAIN
/*
** Give a listing of the program in the virtual machine.
**
** The interface is the same as sqlite3VdbeExec(). But instead of
** running the code, it invokes the callback once for each instruction.
** This feature is used to implement "EXPLAIN".
|
| ︙ | ︙ | |||
50174 50175 50176 50177 50178 50179 50180 50181 50182 50183 50184 50185 50186 50187 |
/*
** Return the database associated with the Vdbe.
*/
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
return v->db;
}
/************** End of vdbeaux.c *********************************************/
/************** Begin file vdbeapi.c *****************************************/
/*
** 2004 May 26
**
** The author disclaims copyright to this source code. In place of
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 50206 50207 50208 50209 50210 50211 50212 50213 50214 50215 50216 50217 50218 50219 50220 50221 50222 50223 50224 50225 50226 50227 50228 50229 50230 50231 50232 50233 50234 50235 50236 50237 50238 50239 50240 50241 50242 50243 50244 50245 50246 50247 50248 50249 50250 50251 50252 50253 50254 50255 50256 50257 50258 |
/*
** Return the database associated with the Vdbe.
*/
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
return v->db;
}
/*
** Return a pointer to an sqlite3_value structure containing the value bound
** parameter iVar of VM v. Except, if the value is an SQL NULL, return
** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*
** constants) to the value before returning it.
**
** The returned value must be freed by the caller using sqlite3ValueFree().
*/
SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetValue(Vdbe *v, int iVar, u8 aff){
assert( iVar>0 );
if( v ){
Mem *pMem = &v->aVar[iVar-1];
if( 0==(pMem->flags & MEM_Null) ){
sqlite3_value *pRet = sqlite3ValueNew(v->db);
if( pRet ){
sqlite3VdbeMemCopy((Mem *)pRet, pMem);
sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8);
sqlite3VdbeMemStoreType((Mem *)pRet);
}
return pRet;
}
}
return 0;
}
/*
** Configure SQL variable iVar so that binding a new value to it signals
** to sqlite3_reoptimize() that re-preparing the statement may result
** in a better query plan.
*/
SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
assert( iVar>0 );
if( iVar>32 ){
v->expmask = 0xffffffff;
}else{
v->expmask |= ((u32)1 << (iVar-1));
}
}
/************** End of vdbeaux.c *********************************************/
/************** Begin file vdbeapi.c *****************************************/
/*
** 2004 May 26
**
** The author disclaims copyright to this source code. In place of
|
| ︙ | ︙ | |||
50275 50276 50277 50278 50279 50280 50281 50282 50283 50284 50285 50286 50287 50288 |
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
#endif
sqlite3_mutex_enter(mutex);
for(i=0; i<p->nVar; i++){
sqlite3VdbeMemRelease(&p->aVar[i]);
p->aVar[i].flags = MEM_Null;
}
sqlite3_mutex_leave(mutex);
return rc;
}
/**************************** sqlite3_value_ *******************************
| > > > | 50346 50347 50348 50349 50350 50351 50352 50353 50354 50355 50356 50357 50358 50359 50360 50361 50362 |
#if SQLITE_THREADSAFE
sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex;
#endif
sqlite3_mutex_enter(mutex);
for(i=0; i<p->nVar; i++){
sqlite3VdbeMemRelease(&p->aVar[i]);
p->aVar[i].flags = MEM_Null;
}
if( p->isPrepareV2 && p->expmask ){
p->expired = 1;
}
sqlite3_mutex_leave(mutex);
return rc;
}
/**************************** sqlite3_value_ *******************************
|
| ︙ | ︙ | |||
50481 50482 50483 50484 50485 50486 50487 |
/* Assert that malloc() has not failed */
db = p->db;
if( db->mallocFailed ){
return SQLITE_NOMEM;
}
if( p->pc<=0 && p->expired ){
| | | 50555 50556 50557 50558 50559 50560 50561 50562 50563 50564 50565 50566 50567 50568 50569 |
/* Assert that malloc() has not failed */
db = p->db;
if( db->mallocFailed ){
return SQLITE_NOMEM;
}
if( p->pc<=0 && p->expired ){
if( ALWAYS(p->rc==SQLITE_OK || p->rc==SQLITE_SCHEMA) ){
p->rc = SQLITE_SCHEMA;
}
rc = SQLITE_ERROR;
goto end_of_step;
}
if( sqlite3SafetyOn(db) ){
p->rc = SQLITE_MISUSE;
|
| ︙ | ︙ | |||
51091 51092 51093 51094 51095 51096 51097 51098 51099 51100 51101 51102 51103 51104 |
return SQLITE_RANGE;
}
i--;
pVar = &p->aVar[i];
sqlite3VdbeMemRelease(pVar);
pVar->flags = MEM_Null;
sqlite3Error(p->db, SQLITE_OK, 0);
return SQLITE_OK;
}
/*
** Bind a text or BLOB value.
*/
static int bindText(
| > > > > > > > > > | 51165 51166 51167 51168 51169 51170 51171 51172 51173 51174 51175 51176 51177 51178 51179 51180 51181 51182 51183 51184 51185 51186 51187 |
return SQLITE_RANGE;
}
i--;
pVar = &p->aVar[i];
sqlite3VdbeMemRelease(pVar);
pVar->flags = MEM_Null;
sqlite3Error(p->db, SQLITE_OK, 0);
/* If the bit corresponding to this variable in Vdbe.expmask is set, then
** binding a new value to this variable invalidates the current query plan.
*/
if( p->isPrepareV2 &&
((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff)
){
p->expired = 1;
}
return SQLITE_OK;
}
/*
** Bind a text or BLOB value.
*/
static int bindText(
|
| ︙ | ︙ | |||
51340 51341 51342 51343 51344 51345 51346 51347 51348 51349 51350 51351 51352 51353 |
** SQLITE_OK is returned.
*/
SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
Vdbe *pFrom = (Vdbe*)pFromStmt;
Vdbe *pTo = (Vdbe*)pToStmt;
if( pFrom->nVar!=pTo->nVar ){
return SQLITE_ERROR;
}
return sqlite3TransferBindings(pFromStmt, pToStmt);
}
#endif
/*
** Return the sqlite3* database handle to which the prepared statement given
| > > > > > > | 51423 51424 51425 51426 51427 51428 51429 51430 51431 51432 51433 51434 51435 51436 51437 51438 51439 51440 51441 51442 |
** SQLITE_OK is returned.
*/
SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){
Vdbe *pFrom = (Vdbe*)pFromStmt;
Vdbe *pTo = (Vdbe*)pToStmt;
if( pFrom->nVar!=pTo->nVar ){
return SQLITE_ERROR;
}
if( pTo->isPrepareV2 && pTo->expmask ){
pTo->expired = 1;
}
if( pFrom->isPrepareV2 && pFrom->expmask ){
pFrom->expired = 1;
}
return sqlite3TransferBindings(pFromStmt, pToStmt);
}
#endif
/*
** Return the sqlite3* database handle to which the prepared statement given
|
| ︙ | ︙ | |||
51536 51537 51538 51539 51540 51541 51542 | ** P if required. */ #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) /* ** Argument pMem points at a register that will be passed to a ** user-defined function or returned to the user as the result of a query. | < | | < | | 51625 51626 51627 51628 51629 51630 51631 51632 51633 51634 51635 51636 51637 51638 51639 51640 51641 51642 |
** P if required.
*/
#define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0)
/*
** Argument pMem points at a register that will be passed to a
** user-defined function or returned to the user as the result of a query.
** This routine sets the pMem->type variable used by the sqlite3_value_*()
** routines.
*/
SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){
int flags = pMem->flags;
if( flags & MEM_Null ){
pMem->type = SQLITE_NULL;
}
else if( flags & MEM_Int ){
pMem->type = SQLITE_INTEGER;
}
|
| ︙ | ︙ | |||
51712 51713 51714 51715 51716 51717 51718 |
** loss of information and return the revised type of the argument.
**
** This is an EXPERIMENTAL api and is subject to change or removal.
*/
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
Mem *pMem = (Mem*)pVal;
applyNumericAffinity(pMem);
| | | 51799 51800 51801 51802 51803 51804 51805 51806 51807 51808 51809 51810 51811 51812 51813 |
** loss of information and return the revised type of the argument.
**
** This is an EXPERIMENTAL api and is subject to change or removal.
*/
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){
Mem *pMem = (Mem*)pVal;
applyNumericAffinity(pMem);
sqlite3VdbeMemStoreType(pMem);
return pMem->type;
}
/*
** Exported version of applyAffinity(). This one works on sqlite3_value*,
** not the internal Mem* type.
*/
|
| ︙ | ︙ | |||
52261 52262 52263 52264 52265 52266 52267 |
i64 v; /* The new rowid */
VdbeCursor *pC; /* Cursor of table to get the new rowid */
int res; /* Result of an sqlite3BtreeLast() */
int cnt; /* Counter to limit the number of searches */
Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
VdbeFrame *pFrame; /* Root frame of VDBE */
} be;
| | | 52348 52349 52350 52351 52352 52353 52354 52355 52356 52357 52358 52359 52360 52361 52362 |
i64 v; /* The new rowid */
VdbeCursor *pC; /* Cursor of table to get the new rowid */
int res; /* Result of an sqlite3BtreeLast() */
int cnt; /* Counter to limit the number of searches */
Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
VdbeFrame *pFrame; /* Root frame of VDBE */
} be;
struct OP_InsertInt_stack_vars {
Mem *pData; /* MEM cell holding data for the record to be inserted */
Mem *pKey; /* MEM cell holding key for the record */
i64 iKey; /* The integer ROWID or key for the record to be inserted */
VdbeCursor *pC; /* Cursor to table into which insert is written */
int nZero; /* Number of zero-bytes to append */
int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */
const char *zDb; /* database name - used by the update hook */
|
| ︙ | ︙ | |||
52905 52906 52907 52908 52909 52910 52911 | #endif /* local variables moved into u.ab */ u.ab.p1 = pOp->p1 - 1; u.ab.p2 = pOp->p2; u.ab.n = pOp->p3; assert( u.ab.p1>=0 && u.ab.p1+u.ab.n<=p->nVar ); assert( u.ab.p2>=1 && u.ab.p2+u.ab.n-1<=p->nMem ); | | | 52992 52993 52994 52995 52996 52997 52998 52999 53000 53001 53002 53003 53004 53005 53006 |
#endif /* local variables moved into u.ab */
u.ab.p1 = pOp->p1 - 1;
u.ab.p2 = pOp->p2;
u.ab.n = pOp->p3;
assert( u.ab.p1>=0 && u.ab.p1+u.ab.n<=p->nVar );
assert( u.ab.p2>=1 && u.ab.p2+u.ab.n-1<=p->nMem );
assert( pOp->p4.z==0 || pOp->p3==1 || pOp->p3==0 );
while( u.ab.n-- > 0 ){
u.ab.pVar = &p->aVar[u.ab.p1++];
if( sqlite3VdbeMemTooBig(u.ab.pVar) ){
goto too_big;
}
pOut = &p->aMem[u.ab.p2++];
|
| ︙ | ︙ | |||
53056 53057 53058 53059 53060 53061 53062 |
/* Make sure the results of the current row are \000 terminated
** and have an assigned type. The results are de-ephemeralized as
** as side effect.
*/
u.ad.pMem = p->pResultSet = &p->aMem[pOp->p1];
for(u.ad.i=0; u.ad.i<pOp->p2; u.ad.i++){
sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
| | | 53143 53144 53145 53146 53147 53148 53149 53150 53151 53152 53153 53154 53155 53156 53157 |
/* Make sure the results of the current row are \000 terminated
** and have an assigned type. The results are de-ephemeralized as
** as side effect.
*/
u.ad.pMem = p->pResultSet = &p->aMem[pOp->p1];
for(u.ad.i=0; u.ad.i<pOp->p2; u.ad.i++){
sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
sqlite3VdbeMemStoreType(&u.ad.pMem[u.ad.i]);
REGISTER_TRACE(pOp->p1+u.ad.i, &u.ad.pMem[u.ad.i]);
}
if( db->mallocFailed ) goto no_mem;
/* Return SQLITE_ROW
*/
p->pc = pc + 1;
|
| ︙ | ︙ | |||
53281 53282 53283 53284 53285 53286 53287 |
assert( u.ag.apVal || u.ag.n==0 );
assert( u.ag.n==0 || (pOp->p2>0 && pOp->p2+u.ag.n<=p->nMem+1) );
assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+u.ag.n );
u.ag.pArg = &p->aMem[pOp->p2];
for(u.ag.i=0; u.ag.i<u.ag.n; u.ag.i++, u.ag.pArg++){
u.ag.apVal[u.ag.i] = u.ag.pArg;
| | | 53368 53369 53370 53371 53372 53373 53374 53375 53376 53377 53378 53379 53380 53381 53382 |
assert( u.ag.apVal || u.ag.n==0 );
assert( u.ag.n==0 || (pOp->p2>0 && pOp->p2+u.ag.n<=p->nMem+1) );
assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+u.ag.n );
u.ag.pArg = &p->aMem[pOp->p2];
for(u.ag.i=0; u.ag.i<u.ag.n; u.ag.i++, u.ag.pArg++){
u.ag.apVal[u.ag.i] = u.ag.pArg;
sqlite3VdbeMemStoreType(u.ag.pArg);
REGISTER_TRACE(pOp->p2, u.ag.pArg);
}
assert( pOp->p4type==P4_FUNCDEF || pOp->p4type==P4_VDBEFUNC );
if( pOp->p4type==P4_FUNCDEF ){
u.ag.ctx.pFunc = pOp->p4.pFunc;
u.ag.ctx.pVdbeFunc = 0;
|
| ︙ | ︙ | |||
54777 54778 54779 54780 54781 54782 54783 54784 54785 54786 54787 54788 54789 54790 |
/* Record changes in the file format */
u.au.pDb->pSchema->file_format = (u8)pIn3->u.i;
}
if( pOp->p1==1 ){
/* Invalidate all prepared statements whenever the TEMP database
** schema is changed. Ticket #1644 */
sqlite3ExpirePreparedStatements(db);
}
break;
}
/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
| > | 54864 54865 54866 54867 54868 54869 54870 54871 54872 54873 54874 54875 54876 54877 54878 |
/* Record changes in the file format */
u.au.pDb->pSchema->file_format = (u8)pIn3->u.i;
}
if( pOp->p1==1 ){
/* Invalidate all prepared statements whenever the TEMP database
** schema is changed. Ticket #1644 */
sqlite3ExpirePreparedStatements(db);
p->expired = 0;
}
break;
}
/* Opcode: VerifyCookie P1 P2 *
**
** Check the value of global database parameter number 0 (the
|
| ︙ | ︙ | |||
54897 54898 54899 54900 54901 54902 54903 54904 54905 54906 54907 54908 54909 54910 | int p2; int iDb; int wrFlag; Btree *pX; VdbeCursor *pCur; Db *pDb; #endif /* local variables moved into u.aw */ u.aw.nField = 0; u.aw.pKeyInfo = 0; u.aw.p2 = pOp->p2; u.aw.iDb = pOp->p3; assert( u.aw.iDb>=0 && u.aw.iDb<db->nDb ); assert( (p->btreeMask & (1<<u.aw.iDb))!=0 ); | > > > > > | 54985 54986 54987 54988 54989 54990 54991 54992 54993 54994 54995 54996 54997 54998 54999 55000 55001 55002 55003 |
int p2;
int iDb;
int wrFlag;
Btree *pX;
VdbeCursor *pCur;
Db *pDb;
#endif /* local variables moved into u.aw */
if( p->expired ){
rc = SQLITE_ABORT;
break;
}
u.aw.nField = 0;
u.aw.pKeyInfo = 0;
u.aw.p2 = pOp->p2;
u.aw.iDb = pOp->p3;
assert( u.aw.iDb>=0 && u.aw.iDb<db->nDb );
assert( (p->btreeMask & (1<<u.aw.iDb))!=0 );
|
| ︙ | ︙ | |||
55696 55697 55698 55699 55700 55701 55702 | ** and register P2 becomes ephemeral. If the cursor is changed, the ** value of register P2 will then change. Make sure this does not ** cause any problems.) ** ** This instruction only works on tables. The equivalent instruction ** for indices is OP_IdxInsert. */ | > > > > > > | < < > > > > | > > > > | | | | 55789 55790 55791 55792 55793 55794 55795 55796 55797 55798 55799 55800 55801 55802 55803 55804 55805 55806 55807 55808 55809 55810 55811 55812 55813 55814 55815 55816 55817 55818 55819 55820 55821 55822 55823 55824 55825 55826 55827 55828 55829 55830 55831 55832 55833 55834 55835 55836 55837 55838 55839 55840 55841 55842 |
** and register P2 becomes ephemeral. If the cursor is changed, the
** value of register P2 will then change. Make sure this does not
** cause any problems.)
**
** This instruction only works on tables. The equivalent instruction
** for indices is OP_IdxInsert.
*/
/* Opcode: InsertInt P1 P2 P3 P4 P5
**
** This works exactly like OP_Insert except that the key is the
** integer value P3, not the value of the integer stored in register P3.
*/
case OP_Insert:
case OP_InsertInt: {
#if 0 /* local variables moved into u.bf */
Mem *pData; /* MEM cell holding data for the record to be inserted */
Mem *pKey; /* MEM cell holding key for the record */
i64 iKey; /* The integer ROWID or key for the record to be inserted */
VdbeCursor *pC; /* Cursor to table into which insert is written */
int nZero; /* Number of zero-bytes to append */
int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */
const char *zDb; /* database name - used by the update hook */
const char *zTbl; /* Table name - used by the opdate hook */
int op; /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */
#endif /* local variables moved into u.bf */
u.bf.pData = &p->aMem[pOp->p2];
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
u.bf.pC = p->apCsr[pOp->p1];
assert( u.bf.pC!=0 );
assert( u.bf.pC->pCursor!=0 );
assert( u.bf.pC->pseudoTableReg==0 );
assert( u.bf.pC->isTable );
REGISTER_TRACE(pOp->p2, u.bf.pData);
if( pOp->opcode==OP_Insert ){
u.bf.pKey = &p->aMem[pOp->p3];
assert( u.bf.pKey->flags & MEM_Int );
REGISTER_TRACE(pOp->p3, u.bf.pKey);
u.bf.iKey = u.bf.pKey->u.i;
}else{
assert( pOp->opcode==OP_InsertInt );
u.bf.iKey = pOp->p3;
}
if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = u.bf.iKey;
if( u.bf.pData->flags & MEM_Null ){
u.bf.pData->z = 0;
u.bf.pData->n = 0;
}else{
assert( u.bf.pData->flags & (MEM_Blob|MEM_Str) );
}
u.bf.seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? u.bf.pC->seekResult : 0);
|
| ︙ | ︙ | |||
57041 57042 57043 57044 57045 57046 57047 |
u.cc.n = pOp->p5;
assert( u.cc.n>=0 );
u.cc.pRec = &p->aMem[pOp->p2];
u.cc.apVal = p->apArg;
assert( u.cc.apVal || u.cc.n==0 );
for(u.cc.i=0; u.cc.i<u.cc.n; u.cc.i++, u.cc.pRec++){
u.cc.apVal[u.cc.i] = u.cc.pRec;
| | | 57146 57147 57148 57149 57150 57151 57152 57153 57154 57155 57156 57157 57158 57159 57160 |
u.cc.n = pOp->p5;
assert( u.cc.n>=0 );
u.cc.pRec = &p->aMem[pOp->p2];
u.cc.apVal = p->apArg;
assert( u.cc.apVal || u.cc.n==0 );
for(u.cc.i=0; u.cc.i<u.cc.n; u.cc.i++, u.cc.pRec++){
u.cc.apVal[u.cc.i] = u.cc.pRec;
sqlite3VdbeMemStoreType(u.cc.pRec);
}
u.cc.ctx.pFunc = pOp->p4.pFunc;
assert( pOp->p3>0 && pOp->p3<=p->nMem );
u.cc.ctx.pMem = u.cc.pMem = &p->aMem[pOp->p3];
u.cc.pMem->n++;
u.cc.ctx.s.flags = MEM_Null;
u.cc.ctx.s.z = 0;
|
| ︙ | ︙ | |||
57339 57340 57341 57342 57343 57344 57345 |
/* Invoke the xFilter method */
{
u.ch.res = 0;
u.ch.apArg = p->apArg;
for(u.ch.i = 0; u.ch.i<u.ch.nArg; u.ch.i++){
u.ch.apArg[u.ch.i] = &u.ch.pArgc[u.ch.i+1];
| | | 57444 57445 57446 57447 57448 57449 57450 57451 57452 57453 57454 57455 57456 57457 57458 |
/* Invoke the xFilter method */
{
u.ch.res = 0;
u.ch.apArg = p->apArg;
for(u.ch.i = 0; u.ch.i<u.ch.nArg; u.ch.i++){
u.ch.apArg[u.ch.i] = &u.ch.pArgc[u.ch.i+1];
sqlite3VdbeMemStoreType(u.ch.apArg[u.ch.i]);
}
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
p->inVtabMethod = 1;
rc = u.ch.pModule->xFilter(u.ch.pVtabCursor, u.ch.iQuery, pOp->p4.z, u.ch.nArg, u.ch.apArg);
p->inVtabMethod = 0;
sqlite3DbFree(db, p->zErrMsg);
|
| ︙ | ︙ | |||
57551 57552 57553 57554 57555 57556 57557 |
u.cl.pModule = (sqlite3_module *)u.cl.pVtab->pModule;
u.cl.nArg = pOp->p2;
assert( pOp->p4type==P4_VTAB );
if( ALWAYS(u.cl.pModule->xUpdate) ){
u.cl.apArg = p->apArg;
u.cl.pX = &p->aMem[pOp->p3];
for(u.cl.i=0; u.cl.i<u.cl.nArg; u.cl.i++){
| | | 57656 57657 57658 57659 57660 57661 57662 57663 57664 57665 57666 57667 57668 57669 57670 |
u.cl.pModule = (sqlite3_module *)u.cl.pVtab->pModule;
u.cl.nArg = pOp->p2;
assert( pOp->p4type==P4_VTAB );
if( ALWAYS(u.cl.pModule->xUpdate) ){
u.cl.apArg = p->apArg;
u.cl.pX = &p->aMem[pOp->p3];
for(u.cl.i=0; u.cl.i<u.cl.nArg; u.cl.i++){
sqlite3VdbeMemStoreType(u.cl.pX);
u.cl.apArg[u.cl.i] = u.cl.pX;
u.cl.pX++;
}
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
rc = u.cl.pModule->xUpdate(u.cl.pVtab, u.cl.nArg, u.cl.apArg, &u.cl.rowid);
sqlite3DbFree(db, p->zErrMsg);
p->zErrMsg = u.cl.pVtab->zErrMsg;
|
| ︙ | ︙ | |||
59172 59173 59174 59175 59176 59177 59178 59179 59180 59181 59182 59183 59184 59185 |
pTopNC = pTopNC->pNext;
}
return WRC_Prune;
} else {
return WRC_Abort;
}
}
/*
** This routine is callback for sqlite3WalkExpr().
**
** Resolve symbolic names into TK_COLUMN operators for the current
** node in the expression tree. Return 0 to continue the search down
** the tree or 2 to abort the tree walk.
| > > > > > > > > > > > > > > > > > > > > > | 59277 59278 59279 59280 59281 59282 59283 59284 59285 59286 59287 59288 59289 59290 59291 59292 59293 59294 59295 59296 59297 59298 59299 59300 59301 59302 59303 59304 59305 59306 59307 59308 59309 59310 59311 |
pTopNC = pTopNC->pNext;
}
return WRC_Prune;
} else {
return WRC_Abort;
}
}
/*
** Allocate and return a pointer to an expression to load the column iCol
** from datasource iSrc datasource in SrcList pSrc.
*/
SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){
Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0);
if( p ){
struct SrcList_item *pItem = &pSrc->a[iSrc];
p->pTab = pItem->pTab;
p->iTable = pItem->iCursor;
if( p->pTab->iPKey==iCol ){
p->iColumn = -1;
}else{
p->iColumn = iCol;
pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
}
ExprSetProperty(p, EP_Resolved);
}
return p;
}
/*
** This routine is callback for sqlite3WalkExpr().
**
** Resolve symbolic names into TK_COLUMN operators for the current
** node in the expression tree. Return 0 to continue the search down
** the tree or 2 to abort the tree walk.
|
| ︙ | ︙ | |||
60520 60521 60522 60523 60524 60525 60526 |
assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
z = pExpr->u.zToken;
assert( z!=0 );
assert( z[0]!=0 );
if( z[1]==0 ){
/* Wildcard of the form "?". Assign the next variable number */
assert( z[0]=='?' );
| | | | 60646 60647 60648 60649 60650 60651 60652 60653 60654 60655 60656 60657 60658 60659 60660 60661 60662 60663 60664 60665 |
assert( !ExprHasAnyProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) );
z = pExpr->u.zToken;
assert( z!=0 );
assert( z[0]!=0 );
if( z[1]==0 ){
/* Wildcard of the form "?". Assign the next variable number */
assert( z[0]=='?' );
pExpr->iColumn = ++pParse->nVar;
}else if( z[0]=='?' ){
/* Wildcard of the form "?nnn". Convert "nnn" to an integer and
** use it as the variable number */
int i;
pExpr->iColumn = i = atoi((char*)&z[1]);
testcase( i==0 );
testcase( i==1 );
testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 );
testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] );
if( i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){
sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d",
db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]);
|
| ︙ | ︙ | |||
60549 60550 60551 60552 60553 60554 60555 |
int i;
u32 n;
n = sqlite3Strlen30(z);
for(i=0; i<pParse->nVarExpr; i++){
Expr *pE = pParse->apVarExpr[i];
assert( pE!=0 );
if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){
| | | | 60675 60676 60677 60678 60679 60680 60681 60682 60683 60684 60685 60686 60687 60688 60689 60690 60691 60692 60693 60694 |
int i;
u32 n;
n = sqlite3Strlen30(z);
for(i=0; i<pParse->nVarExpr; i++){
Expr *pE = pParse->apVarExpr[i];
assert( pE!=0 );
if( memcmp(pE->u.zToken, z, n)==0 && pE->u.zToken[n]==0 ){
pExpr->iColumn = pE->iColumn;
break;
}
}
if( i>=pParse->nVarExpr ){
pExpr->iColumn = ++pParse->nVar;
if( pParse->nVarExpr>=pParse->nVarExprAlloc-1 ){
pParse->nVarExprAlloc += pParse->nVarExprAlloc + 10;
pParse->apVarExpr =
sqlite3DbReallocOrFree(
db,
pParse->apVarExpr,
pParse->nVarExprAlloc*sizeof(pParse->apVarExpr[0])
|
| ︙ | ︙ | |||
61320 61321 61322 61323 61324 61325 61326 61327 61328 61329 61330 61331 61332 61333 |
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
Select *p; /* SELECT to the right of IN operator */
int eType = 0; /* Type of RHS table. IN_INDEX_* */
int iTab = pParse->nTab++; /* Cursor of the RHS table */
int mustBeUnique = (prNotFound==0); /* True if RHS must be unique */
/* Check to see if an existing table or index can be used to
** satisfy the query. This is preferable to generating a new
** ephemeral table.
*/
p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0);
if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){
| > > | 61446 61447 61448 61449 61450 61451 61452 61453 61454 61455 61456 61457 61458 61459 61460 61461 |
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){
Select *p; /* SELECT to the right of IN operator */
int eType = 0; /* Type of RHS table. IN_INDEX_* */
int iTab = pParse->nTab++; /* Cursor of the RHS table */
int mustBeUnique = (prNotFound==0); /* True if RHS must be unique */
assert( pX->op==TK_IN );
/* Check to see if an existing table or index can be used to
** satisfy the query. This is preferable to generating a new
** ephemeral table.
*/
p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0);
if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){
|
| ︙ | ︙ | |||
61398 61399 61400 61401 61402 61403 61404 |
}
}
}
}
}
if( eType==0 ){
| | | 61526 61527 61528 61529 61530 61531 61532 61533 61534 61535 61536 61537 61538 61539 61540 |
}
}
}
}
}
if( eType==0 ){
/* Could not found an existing table or index to use as the RHS b-tree.
** We will have to generate an ephemeral table to do the job.
*/
int rMayHaveNull = 0;
eType = IN_INDEX_EPH;
if( prNotFound ){
*prNotFound = rMayHaveNull = ++pParse->nMem;
}else if( pX->pLeft->iColumn<0 && !ExprHasAnyProperty(pX, EP_xIsSelect) ){
|
| ︙ | ︙ | |||
61445 61446 61447 61448 61449 61450 61451 61452 61453 | ** all corresponding LHS elements. All this routine does is initialize ** the register given by rMayHaveNull to NULL. Calling routines will take ** care of changing this register value to non-NULL if the RHS is NULL-free. ** ** If rMayHaveNull is zero, that means that the subquery is being used ** for membership testing only. There is no need to initialize any ** registers to indicate the presense or absence of NULLs on the RHS. */ #ifndef SQLITE_OMIT_SUBQUERY | > > > | > | | 61573 61574 61575 61576 61577 61578 61579 61580 61581 61582 61583 61584 61585 61586 61587 61588 61589 61590 61591 61592 61593 61594 61595 61596 61597 61598 61599 61600 61601 |
** all corresponding LHS elements. All this routine does is initialize
** the register given by rMayHaveNull to NULL. Calling routines will take
** care of changing this register value to non-NULL if the RHS is NULL-free.
**
** If rMayHaveNull is zero, that means that the subquery is being used
** for membership testing only. There is no need to initialize any
** registers to indicate the presense or absence of NULLs on the RHS.
**
** For a SELECT or EXISTS operator, return the register that holds the
** result. For IN operators or if an error occurs, the return value is 0.
*/
#ifndef SQLITE_OMIT_SUBQUERY
SQLITE_PRIVATE int sqlite3CodeSubselect(
Parse *pParse, /* Parsing context */
Expr *pExpr, /* The IN, SELECT, or EXISTS operator */
int rMayHaveNull, /* Register that records whether NULLs exist in RHS */
int isRowid /* If true, LHS of IN operator is a rowid */
){
int testAddr = 0; /* One-time test address */
int rReg = 0; /* Register storing resulting */
Vdbe *v = sqlite3GetVdbe(pParse);
if( NEVER(v==0) ) return 0;
sqlite3ExprCachePush(pParse);
/* This code must be run in its entirety every time it is encountered
** if any of the following is true:
**
** * The right-hand side is a correlated subquery
** * The right-hand side is an expression list containing variables
|
| ︙ | ︙ | |||
61520 61521 61522 61523 61524 61525 61526 |
ExprList *pEList;
assert( !isRowid );
sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
dest.affinity = (u8)affinity;
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){
| | | 61652 61653 61654 61655 61656 61657 61658 61659 61660 61661 61662 61663 61664 61665 61666 |
ExprList *pEList;
assert( !isRowid );
sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable);
dest.affinity = (u8)affinity;
assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable );
if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){
return 0;
}
pEList = pExpr->x.pSelect->pEList;
if( ALWAYS(pEList!=0 && pEList->nExpr>0) ){
keyInfo.aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft,
pEList->a[0].pExpr);
}
}else if( pExpr->x.pList!=0 ){
|
| ︙ | ︙ | |||
61551 61552 61553 61554 61555 61556 61557 61558 61559 61560 61561 61562 61563 61564 61565 61566 61567 61568 61569 |
/* Loop through each expression in <exprlist>. */
r1 = sqlite3GetTempReg(pParse);
r2 = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
Expr *pE2 = pItem->pExpr;
/* If the expression is not constant then we will need to
** disable the test that was generated above that makes sure
** this code only executes once. Because for a non-constant
** expression we need to rerun this code each time.
*/
if( testAddr && !sqlite3ExprIsConstant(pE2) ){
sqlite3VdbeChangeToNoop(v, testAddr-1, 2);
testAddr = 0;
}
/* Evaluate the expression and insert it into the temp table */
| > > > > | | | > | | | | | > | 61683 61684 61685 61686 61687 61688 61689 61690 61691 61692 61693 61694 61695 61696 61697 61698 61699 61700 61701 61702 61703 61704 61705 61706 61707 61708 61709 61710 61711 61712 61713 61714 61715 61716 61717 61718 61719 61720 61721 61722 |
/* Loop through each expression in <exprlist>. */
r1 = sqlite3GetTempReg(pParse);
r2 = sqlite3GetTempReg(pParse);
sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
Expr *pE2 = pItem->pExpr;
int iValToIns;
/* If the expression is not constant then we will need to
** disable the test that was generated above that makes sure
** this code only executes once. Because for a non-constant
** expression we need to rerun this code each time.
*/
if( testAddr && !sqlite3ExprIsConstant(pE2) ){
sqlite3VdbeChangeToNoop(v, testAddr-1, 2);
testAddr = 0;
}
/* Evaluate the expression and insert it into the temp table */
if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){
sqlite3VdbeAddOp3(v, OP_InsertInt, pExpr->iTable, r2, iValToIns);
}else{
r3 = sqlite3ExprCodeTarget(pParse, pE2, r1);
if( isRowid ){
sqlite3VdbeAddOp2(v, OP_MustBeInt, r3,
sqlite3VdbeCurrentAddr(v)+2);
sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3);
}else{
sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1);
sqlite3ExprCacheAffinityChange(pParse, r3, 1);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2);
}
}
}
sqlite3ReleaseTempReg(pParse, r1);
sqlite3ReleaseTempReg(pParse, r2);
}
if( !isRowid ){
sqlite3VdbeChangeP4(v, addr, (void *)&keyInfo, P4_KEYINFO);
|
| ︙ | ︙ | |||
61614 61615 61616 61617 61618 61619 61620 |
dest.eDest = SRT_Exists;
sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iParm);
VdbeComment((v, "Init EXISTS result"));
}
sqlite3ExprDelete(pParse->db, pSel->pLimit);
pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &one);
if( sqlite3Select(pParse, pSel, &dest) ){
| | | | | 61752 61753 61754 61755 61756 61757 61758 61759 61760 61761 61762 61763 61764 61765 61766 61767 61768 61769 61770 61771 61772 61773 61774 61775 61776 61777 61778 61779 |
dest.eDest = SRT_Exists;
sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iParm);
VdbeComment((v, "Init EXISTS result"));
}
sqlite3ExprDelete(pParse->db, pSel->pLimit);
pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &one);
if( sqlite3Select(pParse, pSel, &dest) ){
return 0;
}
rReg = dest.iParm;
ExprSetIrreducible(pExpr);
break;
}
}
if( testAddr ){
sqlite3VdbeJumpHere(v, testAddr-1);
}
sqlite3ExprCachePop(pParse, 1);
return rReg;
}
#endif /* SQLITE_OMIT_SUBQUERY */
/*
** Duplicate an 8-byte value
*/
static char *dup8bytes(Vdbe *v, const char *in){
|
| ︙ | ︙ | |||
62113 62114 62115 62116 62117 62118 62119 |
case TK_VARIABLE: {
VdbeOp *pOp;
assert( !ExprHasProperty(pExpr, EP_IntValue) );
assert( pExpr->u.zToken!=0 );
assert( pExpr->u.zToken[0]!=0 );
if( pExpr->u.zToken[1]==0
&& (pOp = sqlite3VdbeGetOp(v, -1))->opcode==OP_Variable
| | | | 62251 62252 62253 62254 62255 62256 62257 62258 62259 62260 62261 62262 62263 62264 62265 62266 62267 62268 62269 62270 62271 62272 62273 62274 62275 62276 |
case TK_VARIABLE: {
VdbeOp *pOp;
assert( !ExprHasProperty(pExpr, EP_IntValue) );
assert( pExpr->u.zToken!=0 );
assert( pExpr->u.zToken[0]!=0 );
if( pExpr->u.zToken[1]==0
&& (pOp = sqlite3VdbeGetOp(v, -1))->opcode==OP_Variable
&& pOp->p1+pOp->p3==pExpr->iColumn
&& pOp->p2+pOp->p3==target
&& pOp->p4.z==0
){
/* If the previous instruction was a copy of the previous unnamed
** parameter into the previous register, then simply increment the
** repeat count on the prior instruction rather than making a new
** instruction.
*/
pOp->p3++;
}else{
sqlite3VdbeAddOp3(v, OP_Variable, pExpr->iColumn, target, 1);
if( pExpr->u.zToken[1]!=0 ){
sqlite3VdbeChangeP4(v, -1, pExpr->u.zToken, 0);
}
}
break;
}
case TK_REGISTER: {
|
| ︙ | ︙ | |||
62384 62385 62386 62387 62388 62389 62390 |
break;
}
#ifndef SQLITE_OMIT_SUBQUERY
case TK_EXISTS:
case TK_SELECT: {
testcase( op==TK_EXISTS );
testcase( op==TK_SELECT );
| | < | 62522 62523 62524 62525 62526 62527 62528 62529 62530 62531 62532 62533 62534 62535 62536 |
break;
}
#ifndef SQLITE_OMIT_SUBQUERY
case TK_EXISTS:
case TK_SELECT: {
testcase( op==TK_EXISTS );
testcase( op==TK_SELECT );
inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0);
break;
}
case TK_IN: {
int rNotFound = 0;
int rMayHaveNull = 0;
int j2, j3, j4, j5;
char affinity;
|
| ︙ | ︙ | |||
62750 62751 62752 62753 62754 62755 62756 62757 62758 62759 62760 62761 62762 62763 |
** keep the ALWAYS() in case the conditions above change with future
** modifications or enhancements. */
if( ALWAYS(pExpr->op!=TK_REGISTER) ){
int iMem;
iMem = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
pExpr->iTable = iMem;
pExpr->op = TK_REGISTER;
}
return inReg;
}
/*
** Return TRUE if pExpr is an constant expression that is appropriate
| > | 62887 62888 62889 62890 62891 62892 62893 62894 62895 62896 62897 62898 62899 62900 62901 |
** keep the ALWAYS() in case the conditions above change with future
** modifications or enhancements. */
if( ALWAYS(pExpr->op!=TK_REGISTER) ){
int iMem;
iMem = ++pParse->nMem;
sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem);
pExpr->iTable = iMem;
pExpr->op2 = pExpr->op;
pExpr->op = TK_REGISTER;
}
return inReg;
}
/*
** Return TRUE if pExpr is an constant expression that is appropriate
|
| ︙ | ︙ | |||
62823 62824 62825 62826 62827 62828 62829 62830 62831 62832 62833 62834 62835 62836 |
** factoring out of a loop, then evaluate the expression
** into a register and convert the expression into a TK_REGISTER
** expression.
*/
static int evalConstExpr(Walker *pWalker, Expr *pExpr){
Parse *pParse = pWalker->pParse;
switch( pExpr->op ){
case TK_REGISTER: {
return WRC_Prune;
}
case TK_FUNCTION:
case TK_AGG_FUNCTION:
case TK_CONST_FUNC: {
/* The arguments to a function have a fixed destination.
| > | 62961 62962 62963 62964 62965 62966 62967 62968 62969 62970 62971 62972 62973 62974 62975 |
** factoring out of a loop, then evaluate the expression
** into a register and convert the expression into a TK_REGISTER
** expression.
*/
static int evalConstExpr(Walker *pWalker, Expr *pExpr){
Parse *pParse = pWalker->pParse;
switch( pExpr->op ){
case TK_IN:
case TK_REGISTER: {
return WRC_Prune;
}
case TK_FUNCTION:
case TK_AGG_FUNCTION:
case TK_CONST_FUNC: {
/* The arguments to a function have a fixed destination.
|
| ︙ | ︙ | |||
78183 78184 78185 78186 78187 78188 78189 78190 78191 78192 78193 78194 78195 78196 78197 78198 78199 78200 78201 78202 78203 78204 78205 78206 78207 78208 78209 78210 |
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
Parse *pParse; /* Parsing context */
char *zErrMsg = 0; /* Error message */
int rc = SQLITE_OK; /* Result code */
int i; /* Loop counter */
/* Allocate the parsing context */
pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
if( pParse==0 ){
rc = SQLITE_NOMEM;
goto end_prepare;
}
if( sqlite3SafetyOn(db) ){
rc = SQLITE_MISUSE;
goto end_prepare;
}
assert( ppStmt && *ppStmt==0 );
assert( !db->mallocFailed );
| > > | 78322 78323 78324 78325 78326 78327 78328 78329 78330 78331 78332 78333 78334 78335 78336 78337 78338 78339 78340 78341 78342 78343 78344 78345 78346 78347 78348 78349 78350 78351 |
** Compile the UTF-8 encoded SQL statement zSql into a statement handle.
*/
static int sqlite3Prepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
Vdbe *pReprepare, /* VM being reprepared */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
Parse *pParse; /* Parsing context */
char *zErrMsg = 0; /* Error message */
int rc = SQLITE_OK; /* Result code */
int i; /* Loop counter */
/* Allocate the parsing context */
pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
if( pParse==0 ){
rc = SQLITE_NOMEM;
goto end_prepare;
}
pParse->pReprepare = pReprepare;
if( sqlite3SafetyOn(db) ){
rc = SQLITE_MISUSE;
goto end_prepare;
}
assert( ppStmt && *ppStmt==0 );
assert( !db->mallocFailed );
|
| ︙ | ︙ | |||
78354 78355 78356 78357 78358 78359 78360 78361 78362 78363 78364 78365 78366 78367 78368 78369 78370 78371 |
return rc;
}
static int sqlite3LockAndPrepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
int rc;
assert( ppStmt!=0 );
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
sqlite3BtreeEnterAll(db);
| > | | | 78495 78496 78497 78498 78499 78500 78501 78502 78503 78504 78505 78506 78507 78508 78509 78510 78511 78512 78513 78514 78515 78516 78517 78518 78519 78520 78521 78522 78523 78524 |
return rc;
}
static int sqlite3LockAndPrepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
Vdbe *pOld, /* VM being reprepared */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
int rc;
assert( ppStmt!=0 );
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
sqlite3BtreeEnterAll(db);
rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
if( rc==SQLITE_SCHEMA ){
sqlite3_finalize(*ppStmt);
rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
}
sqlite3BtreeLeaveAll(db);
sqlite3_mutex_leave(db->mutex);
return rc;
}
/*
|
| ︙ | ︙ | |||
78394 78395 78396 78397 78398 78399 78400 | sqlite3 *db; assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) ); zSql = sqlite3_sql((sqlite3_stmt *)p); assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */ db = sqlite3VdbeDb(p); assert( sqlite3_mutex_held(db->mutex) ); | | | 78536 78537 78538 78539 78540 78541 78542 78543 78544 78545 78546 78547 78548 78549 78550 |
sqlite3 *db;
assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
zSql = sqlite3_sql((sqlite3_stmt *)p);
assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */
db = sqlite3VdbeDb(p);
assert( sqlite3_mutex_held(db->mutex) );
rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);
if( rc ){
if( rc==SQLITE_NOMEM ){
db->mallocFailed = 1;
}
assert( pNew==0 );
return (rc==SQLITE_LOCKED) ? SQLITE_LOCKED : SQLITE_SCHEMA;
}else{
|
| ︙ | ︙ | |||
78428 78429 78430 78431 78432 78433 78434 |
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
int rc;
| | | | 78570 78571 78572 78573 78574 78575 78576 78577 78578 78579 78580 78581 78582 78583 78584 78585 78586 78587 78588 78589 78590 78591 78592 78593 78594 78595 78596 |
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
int rc;
rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail);
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
return rc;
}
SQLITE_API int sqlite3_prepare_v2(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
){
int rc;
rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
return rc;
}
#ifndef SQLITE_OMIT_UTF16
/*
|
| ︙ | ︙ | |||
78474 78475 78476 78477 78478 78479 78480 |
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
if( zSql8 ){
| | | 78616 78617 78618 78619 78620 78621 78622 78623 78624 78625 78626 78627 78628 78629 78630 |
*ppStmt = 0;
if( !sqlite3SafetyCheckOk(db) ){
return SQLITE_MISUSE;
}
sqlite3_mutex_enter(db->mutex);
zSql8 = sqlite3Utf16to8(db, zSql, nBytes);
if( zSql8 ){
rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
}
if( zTail8 && pzTail ){
/* If sqlite3_prepare returns a tail pointer, we calculate the
** equivalent pointer into the UTF-16 string by counting the unicode
** characters between zSql8 and zTail8, and then returning a pointer
** the same number of characters into the UTF-16 string.
|
| ︙ | ︙ | |||
78722 78723 78724 78725 78726 78727 78728 |
for(i=0; i<pTab->nCol; i++){
if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
}
return -1;
}
/*
| > | > | < < < | | > | | | | | | < | < < | > > | | | < | | | | | < | | < < < | | | | | | | | 78864 78865 78866 78867 78868 78869 78870 78871 78872 78873 78874 78875 78876 78877 78878 78879 78880 78881 78882 78883 78884 78885 78886 78887 78888 78889 78890 78891 78892 78893 78894 78895 78896 78897 78898 78899 78900 78901 78902 78903 78904 78905 78906 78907 78908 78909 78910 78911 78912 78913 78914 78915 78916 |
for(i=0; i<pTab->nCol; i++){
if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i;
}
return -1;
}
/*
** This function is used to add terms implied by JOIN syntax to the
** WHERE clause expression of a SELECT statement. The new term, which
** is ANDed with the existing WHERE clause, is of the form:
**
** (tab1.col1 = tab2.col2)
**
** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the
** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is
** column iColRight of tab2.
*/
static void addWhereTerm(
Parse *pParse, /* Parsing context */
SrcList *pSrc, /* List of tables in FROM clause */
int iSrc, /* Index of first table to join in pSrc */
int iColLeft, /* Index of column in first table */
int iColRight, /* Index of column in second table */
int isOuterJoin, /* True if this is an OUTER join */
Expr **ppWhere /* IN/OUT: The WHERE clause to add to */
){
sqlite3 *db = pParse->db;
Expr *pE1;
Expr *pE2;
Expr *pEq;
assert( pSrc->nSrc>(iSrc+1) );
assert( pSrc->a[iSrc].pTab );
assert( pSrc->a[iSrc+1].pTab );
pE1 = sqlite3CreateColumnExpr(db, pSrc, iSrc, iColLeft);
pE2 = sqlite3CreateColumnExpr(db, pSrc, iSrc+1, iColRight);
pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2, 0);
if( pEq && isOuterJoin ){
ExprSetProperty(pEq, EP_FromJoin);
assert( !ExprHasAnyProperty(pEq, EP_TokenOnly|EP_Reduced) );
ExprSetIrreducible(pEq);
pEq->iRightJoinTable = (i16)pE2->iTable;
}
*ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq);
}
/*
** Set the EP_FromJoin property on all terms of the given expression.
** And set the Expr.iRightJoinTable to iTable for every term in the
** expression.
**
|
| ︙ | ︙ | |||
78848 78849 78850 78851 78852 78853 78854 |
if( pRight->pOn || pRight->pUsing ){
sqlite3ErrorMsg(pParse, "a NATURAL join may not have "
"an ON or USING clause", 0);
return 1;
}
for(j=0; j<pLeftTab->nCol; j++){
char *zName = pLeftTab->aCol[j].zName;
| | < | < | | 78984 78985 78986 78987 78988 78989 78990 78991 78992 78993 78994 78995 78996 78997 78998 78999 79000 |
if( pRight->pOn || pRight->pUsing ){
sqlite3ErrorMsg(pParse, "a NATURAL join may not have "
"an ON or USING clause", 0);
return 1;
}
for(j=0; j<pLeftTab->nCol; j++){
char *zName = pLeftTab->aCol[j].zName;
int iRightCol = columnIndex(pRightTab, zName);
if( iRightCol>=0 ){
addWhereTerm(pParse, pSrc, i, j, iRightCol, isOuter, &p->pWhere);
}
}
}
/* Disallow both ON and USING clauses in the same join
*/
if( pRight->pOn && pRight->pUsing ){
|
| ︙ | ︙ | |||
78885 78886 78887 78888 78889 78890 78891 |
** Report an error if any column mentioned in the USING clause is
** not contained in both tables to be joined.
*/
if( pRight->pUsing ){
IdList *pList = pRight->pUsing;
for(j=0; j<pList->nId; j++){
char *zName = pList->a[j].zName;
| | > > | < < | 79019 79020 79021 79022 79023 79024 79025 79026 79027 79028 79029 79030 79031 79032 79033 79034 79035 79036 79037 79038 79039 79040 |
** Report an error if any column mentioned in the USING clause is
** not contained in both tables to be joined.
*/
if( pRight->pUsing ){
IdList *pList = pRight->pUsing;
for(j=0; j<pList->nId; j++){
char *zName = pList->a[j].zName;
int iLeftCol = columnIndex(pLeftTab, zName);
int iRightCol = columnIndex(pRightTab, zName);
if( iLeftCol<0 || iRightCol<0 ){
sqlite3ErrorMsg(pParse, "cannot join using column %s - column "
"not present in both tables", zName);
return 1;
}
addWhereTerm(pParse, pSrc, i, iLeftCol, iRightCol, isOuter, &p->pWhere);
}
}
}
return 0;
}
/*
|
| ︙ | ︙ | |||
84633 84634 84635 84636 84637 84638 84639 | sqlite3 *db = pParse->db; /* Database connection */ const char *pVTab = (const char*)sqlite3GetVTable(db, pTab); SelectDest dest; /* Construct the SELECT statement that will find the new values for ** all updated rows. */ | | < | | 84767 84768 84769 84770 84771 84772 84773 84774 84775 84776 84777 84778 84779 84780 84781 84782 84783 84784 84785 84786 84787 84788 84789 84790 84791 |
sqlite3 *db = pParse->db; /* Database connection */
const char *pVTab = (const char*)sqlite3GetVTable(db, pTab);
SelectDest dest;
/* Construct the SELECT statement that will find the new values for
** all updated rows.
*/
pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, "_rowid_"));
if( pRowid ){
pEList = sqlite3ExprListAppend(pParse, pEList,
sqlite3ExprDup(db, pRowid, 0));
}
assert( pTab->iPKey<0 );
for(i=0; i<pTab->nCol; i++){
if( aXRef[i]>=0 ){
pExpr = sqlite3ExprDup(db, pChanges->a[aXRef[i]].pExpr, 0);
}else{
pExpr = sqlite3Expr(db, TK_ID, pTab->aCol[i].zName);
}
pEList = sqlite3ExprListAppend(pParse, pEList, pExpr);
}
pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0);
/* Create the ephemeral table into which the update results will
** be stored.
|
| ︙ | ︙ | |||
84814 84815 84816 84817 84818 84819 84820 84821 84822 84823 84824 84825 84826 84827 |
*/
zSql = "ATTACH '' AS vacuum_db;";
rc = execSql(db, zSql);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
pDb = &db->aDb[db->nDb-1];
assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
pTemp = db->aDb[db->nDb-1].pBt;
nRes = sqlite3BtreeGetReserve(pMain);
/* A VACUUM cannot change the pagesize of an encrypted database. */
#ifdef SQLITE_HAS_CODEC
if( db->nextPagesize ){
extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
| > > > > > > | 84947 84948 84949 84950 84951 84952 84953 84954 84955 84956 84957 84958 84959 84960 84961 84962 84963 84964 84965 84966 |
*/
zSql = "ATTACH '' AS vacuum_db;";
rc = execSql(db, zSql);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
pDb = &db->aDb[db->nDb-1];
assert( strcmp(db->aDb[db->nDb-1].zName,"vacuum_db")==0 );
pTemp = db->aDb[db->nDb-1].pBt;
/* The call to execSql() to attach the temp database has left the file
** locked (as there was more than one active statement when the transaction
** to read the schema was concluded. Unlock it here so that this doesn't
** cause problems for the call to BtreeSetPageSize() below. */
sqlite3BtreeCommit(pTemp);
nRes = sqlite3BtreeGetReserve(pMain);
/* A VACUUM cannot change the pagesize of an encrypted database. */
#ifdef SQLITE_HAS_CODEC
if( db->nextPagesize ){
extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
|
| ︙ | ︙ | |||
84868 84869 84870 84871 84872 84873 84874 |
if( rc!=SQLITE_OK ) goto end_of_vacuum;
rc = execExecSql(db,
"SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) "
" FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
if( rc!=SQLITE_OK ) goto end_of_vacuum;
/* Loop through the tables in the main database. For each, do
| | | | | | | 85007 85008 85009 85010 85011 85012 85013 85014 85015 85016 85017 85018 85019 85020 85021 85022 85023 85024 85025 85026 85027 85028 85029 85030 85031 85032 85033 85034 85035 85036 85037 85038 85039 85040 85041 85042 85043 85044 85045 85046 85047 85048 85049 85050 85051 85052 85053 85054 85055 85056 85057 |
if( rc!=SQLITE_OK ) goto end_of_vacuum;
rc = execExecSql(db,
"SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) "
" FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'");
if( rc!=SQLITE_OK ) goto end_of_vacuum;
/* Loop through the tables in the main database. For each, do
** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy
** the contents to the temporary database.
*/
rc = execExecSql(db,
"SELECT 'INSERT INTO vacuum_db.' || quote(name) "
"|| ' SELECT * FROM main.' || quote(name) || ';'"
"FROM main.sqlite_master "
"WHERE type = 'table' AND name!='sqlite_sequence' "
" AND rootpage>0"
);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
/* Copy over the sequence table
*/
rc = execExecSql(db,
"SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' "
"FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' "
);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
rc = execExecSql(db,
"SELECT 'INSERT INTO vacuum_db.' || quote(name) "
"|| ' SELECT * FROM main.' || quote(name) || ';' "
"FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';"
);
if( rc!=SQLITE_OK ) goto end_of_vacuum;
/* Copy the triggers, views, and virtual tables from the main database
** over to the temporary database. None of these objects has any
** associated storage, so all we have to do is copy their entries
** from the SQLITE_MASTER table.
*/
rc = execSql(db,
"INSERT INTO vacuum_db.sqlite_master "
" SELECT type, name, tbl_name, rootpage, sql"
" FROM main.sqlite_master"
" WHERE type='view' OR type='trigger'"
" OR (type='table' AND rootpage=0)"
);
if( rc ) goto end_of_vacuum;
/* At this point, unless the main db was completely empty, there is now a
** transaction open on the vacuum database, but not on the main database.
|
| ︙ | ︙ | |||
86578 86579 86580 86581 86582 86583 86584 | ** ** In order for the operator to be optimizible, the RHS must be a string ** literal that does not begin with a wildcard. */ static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ | | | > > < < < < | > > > | < > > > > > > > | > > > > > > > > > > > > > > | > | > > > | > > > > > > > > > > > > > > > > | > > > | | 86717 86718 86719 86720 86721 86722 86723 86724 86725 86726 86727 86728 86729 86730 86731 86732 86733 86734 86735 86736 86737 86738 86739 86740 86741 86742 86743 86744 86745 86746 86747 86748 86749 86750 86751 86752 86753 86754 86755 86756 86757 86758 86759 86760 86761 86762 86763 86764 86765 86766 86767 86768 86769 86770 86771 86772 86773 86774 86775 86776 86777 86778 86779 86780 86781 86782 86783 86784 86785 86786 86787 86788 86789 86790 86791 86792 86793 86794 86795 86796 86797 86798 86799 86800 86801 86802 86803 86804 86805 86806 86807 86808 86809 86810 86811 86812 86813 86814 86815 86816 86817 86818 86819 86820 86821 86822 86823 |
**
** In order for the operator to be optimizible, the RHS must be a string
** literal that does not begin with a wildcard.
*/
static int isLikeOrGlob(
Parse *pParse, /* Parsing and code generating context */
Expr *pExpr, /* Test this expression */
Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */
int *pisComplete, /* True if the only wildcard is % in the last character */
int *pnoCase /* True if uppercase is equivalent to lowercase */
){
const char *z = 0; /* String on RHS of LIKE operator */
Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
ExprList *pList; /* List of operands to the LIKE operator */
int c; /* One character in z[] */
int cnt; /* Number of non-wildcard prefix characters */
char wc[3]; /* Wildcard characters */
CollSeq *pColl; /* Collating sequence for LHS */
sqlite3 *db = pParse->db; /* Database connection */
sqlite3_value *pVal = 0;
int op; /* Opcode of pRight */
if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){
return 0;
}
#ifdef SQLITE_EBCDIC
if( *pnoCase ) return 0;
#endif
pList = pExpr->x.pList;
pLeft = pList->a[1].pExpr;
if( pLeft->op!=TK_COLUMN || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT ){
/* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must
** be the name of an indexed column with TEXT affinity. */
return 0;
}
assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */
pColl = sqlite3ExprCollSeq(pParse, pLeft);
assert( pColl!=0 ); /* Every non-IPK column has a collating sequence */
if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) &&
(pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){
/* IMP: R-09003-32046 For the GLOB operator, the column must use the
** default BINARY collating sequence.
** IMP: R-41408-28306 For the LIKE operator, if case_sensitive_like mode
** is enabled then the column must use the default BINARY collating
** sequence, or if case_sensitive_like mode is disabled then the column
** must use the built-in NOCASE collating sequence.
*/
return 0;
}
pRight = pList->a[0].pExpr;
op = pRight->op;
if( op==TK_REGISTER ){
op = pRight->op2;
}
if( op==TK_VARIABLE ){
Vdbe *pReprepare = pParse->pReprepare;
pVal = sqlite3VdbeGetValue(pReprepare, pRight->iColumn, SQLITE_AFF_NONE);
if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
z = (char *)sqlite3_value_text(pVal);
}
sqlite3VdbeSetVarmask(pParse->pVdbe, pRight->iColumn);
assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
}else if( op==TK_STRING ){
z = pRight->u.zToken;
}
if( z ){
cnt = 0;
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
cnt++;
}
if( cnt!=0 && c!=0 && 255!=(u8)z[cnt-1] ){
Expr *pPrefix;
*pisComplete = z[cnt]==wc[0] && z[cnt+1]==0;
pPrefix = sqlite3Expr(db, TK_STRING, z);
if( pPrefix ) pPrefix->u.zToken[cnt] = 0;
*ppPrefix = pPrefix;
if( op==TK_VARIABLE ){
Vdbe *v = pParse->pVdbe;
sqlite3VdbeSetVarmask(v, pRight->iColumn);
if( *pisComplete && pRight->u.zToken[1] ){
/* If the rhs of the LIKE expression is a variable, and the current
** value of the variable means there is no need to invoke the LIKE
** function, then no OP_Variable will be added to the program.
** This causes problems for the sqlite3_bind_parameter_name()
** API. To workaround them, add a dummy OP_Variable here.
*/
int r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCodeTarget(pParse, pRight, r1);
sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0);
sqlite3ReleaseTempReg(pParse, r1);
}
}
}else{
z = 0;
}
}
sqlite3ValueFree(pVal);
return (z!=0);
}
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Check to see if the given expression is of the form
|
| ︙ | ︙ | |||
87007 87008 87009 87010 87011 87012 87013 |
int idxTerm /* Index of the term to be analyzed */
){
WhereTerm *pTerm; /* The term to be analyzed */
WhereMaskSet *pMaskSet; /* Set of table index masks */
Expr *pExpr; /* The expression to be analyzed */
Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */
Bitmask prereqAll; /* Prerequesites of pExpr */
| | | | | | 87190 87191 87192 87193 87194 87195 87196 87197 87198 87199 87200 87201 87202 87203 87204 87205 87206 87207 |
int idxTerm /* Index of the term to be analyzed */
){
WhereTerm *pTerm; /* The term to be analyzed */
WhereMaskSet *pMaskSet; /* Set of table index masks */
Expr *pExpr; /* The expression to be analyzed */
Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */
Bitmask prereqAll; /* Prerequesites of pExpr */
Bitmask extraRight = 0; /* */
Expr *pStr1 = 0; /* RHS of LIKE/GLOB operator */
int isComplete = 0; /* RHS of LIKE/GLOB ends with wildcard */
int noCase = 0; /* LIKE/GLOB distinguishes case */
int op; /* Top-level operator. pExpr->op */
Parse *pParse = pWC->pParse; /* Parsing context */
sqlite3 *db = pParse->db; /* Database connection */
if( db->mallocFailed ){
return;
}
|
| ︙ | ︙ | |||
87145 87146 87147 87148 87149 87150 87151 | ** A like pattern of the form "x LIKE 'abc%'" is changed into constraints ** ** x>='abc' AND x<'abd' AND x LIKE 'abc%' ** ** The last character of the prefix "abc" is incremented to form the ** termination condition "abd". */ | < | > > | > | | | > < < < | | 87328 87329 87330 87331 87332 87333 87334 87335 87336 87337 87338 87339 87340 87341 87342 87343 87344 87345 87346 87347 87348 87349 87350 87351 87352 87353 87354 87355 87356 |
** A like pattern of the form "x LIKE 'abc%'" is changed into constraints
**
** x>='abc' AND x<'abd' AND x LIKE 'abc%'
**
** The last character of the prefix "abc" is incremented to form the
** termination condition "abd".
*/
if( pWC->op==TK_AND
&& isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase)
){
Expr *pLeft; /* LHS of LIKE/GLOB operator */
Expr *pStr2; /* Copy of pStr1 - RHS of LIKE/GLOB operator */
Expr *pNewExpr1;
Expr *pNewExpr2;
int idxNew1;
int idxNew2;
pLeft = pExpr->x.pList->a[1].pExpr;
pStr2 = sqlite3ExprDup(db, pStr1, 0);
if( !db->mallocFailed ){
u8 c, *pC; /* Last character before the first wildcard */
pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1];
c = *pC;
if( noCase ){
/* The point is to increment the last character before the first
** wildcard. But if we increment '@', that will push it into the
** alphabetic range where case conversions will mess up the
** inequality. To avoid this, make sure to also run the full
** LIKE on all candidate expressions by clearing the isComplete flag
|
| ︙ | ︙ | |||
87937 87938 87939 87940 87941 87942 87943 87944 87945 87946 87947 87948 87949 87950 |
assert( i>=0 && i<=SQLITE_INDEX_SAMPLES );
*piRegion = i;
}
return SQLITE_OK;
}
#endif /* #ifdef SQLITE_ENABLE_STAT2 */
/*
** This function is used to estimate the number of rows that will be visited
** by scanning an index for a range of values. The range may have an upper
** bound, a lower bound, or both. The WHERE clause terms that set the upper
** and lower bounds are represented by pLower and pUpper respectively. For
** example, assuming that index p is on t1(a):
**
| > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 88120 88121 88122 88123 88124 88125 88126 88127 88128 88129 88130 88131 88132 88133 88134 88135 88136 88137 88138 88139 88140 88141 88142 88143 88144 88145 88146 88147 88148 88149 88150 88151 88152 88153 88154 88155 88156 88157 88158 88159 88160 88161 88162 88163 88164 88165 88166 88167 88168 88169 |
assert( i>=0 && i<=SQLITE_INDEX_SAMPLES );
*piRegion = i;
}
return SQLITE_OK;
}
#endif /* #ifdef SQLITE_ENABLE_STAT2 */
/*
** If expression pExpr represents a literal value, set *pp to point to
** an sqlite3_value structure containing the same value, with affinity
** aff applied to it, before returning. It is the responsibility of the
** caller to eventually release this structure by passing it to
** sqlite3ValueFree().
**
** If the current parse is a recompile (sqlite3Reprepare()) and pExpr
** is an SQL variable that currently has a non-NULL value bound to it,
** create an sqlite3_value structure containing this value, again with
** affinity aff applied to it, instead.
**
** If neither of the above apply, set *pp to NULL.
**
** If an error occurs, return an error code. Otherwise, SQLITE_OK.
*/
#ifdef SQLITE_ENABLE_STAT2
static int valueFromExpr(
Parse *pParse,
Expr *pExpr,
u8 aff,
sqlite3_value **pp
){
/* The evalConstExpr() function will have already converted any TK_VARIABLE
** expression involved in an comparison into a TK_REGISTER. */
assert( pExpr->op!=TK_VARIABLE );
if( pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE ){
int iVar = pExpr->iColumn;
sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
*pp = sqlite3VdbeGetValue(pParse->pReprepare, iVar, aff);
return SQLITE_OK;
}
return sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, aff, pp);
}
#endif
/*
** This function is used to estimate the number of rows that will be visited
** by scanning an index for a range of values. The range may have an upper
** bound, a lower bound, or both. The WHERE clause terms that set the upper
** and lower bounds are represented by pLower and pUpper respectively. For
** example, assuming that index p is on t1(a):
**
|
| ︙ | ︙ | |||
87989 87990 87991 87992 87993 87994 87995 |
WhereTerm *pLower, /* Lower bound on the range. ex: "x>123" Might be NULL */
WhereTerm *pUpper, /* Upper bound on the range. ex: "x<455" Might be NULL */
int *piEst /* OUT: Return value */
){
int rc = SQLITE_OK;
#ifdef SQLITE_ENABLE_STAT2
| | > | | < < | | | | 88208 88209 88210 88211 88212 88213 88214 88215 88216 88217 88218 88219 88220 88221 88222 88223 88224 88225 88226 88227 88228 88229 88230 88231 88232 88233 88234 88235 88236 88237 |
WhereTerm *pLower, /* Lower bound on the range. ex: "x>123" Might be NULL */
WhereTerm *pUpper, /* Upper bound on the range. ex: "x<455" Might be NULL */
int *piEst /* OUT: Return value */
){
int rc = SQLITE_OK;
#ifdef SQLITE_ENABLE_STAT2
if( nEq==0 && p->aSample ){
sqlite3_value *pLowerVal = 0;
sqlite3_value *pUpperVal = 0;
int iEst;
int iLower = 0;
int iUpper = SQLITE_INDEX_SAMPLES;
u8 aff = p->pTable->aCol[p->aiColumn[0]].affinity;
if( pLower ){
Expr *pExpr = pLower->pExpr->pRight;
rc = valueFromExpr(pParse, pExpr, aff, &pLowerVal);
}
if( rc==SQLITE_OK && pUpper ){
Expr *pExpr = pUpper->pExpr->pRight;
rc = valueFromExpr(pParse, pExpr, aff, &pUpperVal);
}
if( rc!=SQLITE_OK || (pLowerVal==0 && pUpperVal==0) ){
sqlite3ValueFree(pLowerVal);
sqlite3ValueFree(pUpperVal);
goto range_est_fallback;
}else if( pLowerVal==0 ){
|
| ︙ | ︙ | |||
90175 90176 90177 90178 90179 90180 90181 |
** yy_shift_ofst[] For each state, the offset into yy_action for
** shifting terminals.
** yy_reduce_ofst[] For each state, the offset into yy_action for
** shifting non-terminals after a reduce.
** yy_default[] Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 90393 90394 90395 90396 90397 90398 90399 90400 90401 90402 90403 90404 90405 90406 90407 90408 90409 90410 90411 90412 90413 90414 90415 90416 90417 90418 90419 90420 90421 90422 90423 90424 90425 90426 90427 90428 90429 90430 90431 90432 90433 90434 90435 90436 90437 90438 90439 90440 90441 90442 90443 90444 90445 90446 90447 90448 90449 90450 90451 90452 90453 90454 90455 90456 90457 90458 90459 90460 90461 90462 90463 90464 90465 90466 90467 90468 90469 90470 90471 90472 90473 90474 90475 90476 90477 90478 90479 90480 90481 90482 90483 90484 90485 90486 90487 90488 90489 90490 90491 90492 90493 90494 90495 90496 90497 90498 90499 90500 90501 90502 90503 90504 90505 90506 90507 90508 90509 90510 90511 90512 90513 90514 90515 90516 90517 90518 90519 90520 90521 90522 90523 90524 90525 90526 90527 90528 90529 90530 90531 90532 90533 90534 90535 90536 90537 90538 90539 90540 90541 90542 90543 90544 90545 90546 90547 90548 90549 90550 90551 90552 90553 90554 90555 90556 90557 90558 90559 90560 90561 90562 90563 90564 90565 90566 90567 90568 90569 90570 90571 90572 90573 90574 90575 90576 90577 90578 90579 90580 90581 90582 90583 90584 90585 90586 90587 90588 90589 90590 90591 90592 90593 90594 90595 90596 90597 90598 90599 90600 90601 90602 90603 90604 90605 90606 90607 90608 90609 90610 90611 90612 90613 90614 90615 90616 90617 90618 90619 90620 90621 90622 90623 90624 90625 90626 90627 90628 90629 90630 90631 90632 90633 90634 90635 90636 90637 90638 90639 90640 90641 90642 90643 90644 90645 90646 90647 90648 90649 90650 90651 90652 90653 90654 90655 90656 90657 90658 90659 90660 90661 90662 90663 90664 90665 90666 90667 90668 90669 90670 90671 90672 90673 90674 90675 90676 90677 90678 90679 90680 90681 90682 90683 90684 90685 90686 90687 90688 90689 90690 90691 90692 90693 90694 90695 90696 90697 90698 90699 90700 90701 90702 90703 90704 90705 90706 90707 90708 90709 90710 90711 90712 90713 90714 90715 90716 90717 90718 90719 90720 90721 90722 90723 90724 90725 90726 90727 90728 90729 90730 90731 90732 90733 90734 90735 90736 90737 90738 90739 90740 90741 90742 90743 90744 90745 90746 90747 90748 90749 90750 90751 90752 90753 90754 90755 90756 90757 90758 90759 90760 90761 90762 90763 90764 90765 90766 90767 90768 90769 90770 90771 90772 90773 90774 90775 90776 90777 90778 90779 90780 90781 90782 90783 90784 90785 90786 90787 90788 90789 90790 90791 90792 90793 90794 90795 90796 90797 90798 90799 90800 90801 90802 90803 90804 90805 90806 90807 90808 90809 90810 90811 90812 90813 90814 90815 90816 90817 90818 90819 90820 90821 90822 90823 90824 90825 90826 90827 90828 90829 90830 90831 90832 90833 90834 90835 90836 90837 90838 90839 90840 90841 90842 90843 90844 90845 90846 90847 90848 90849 90850 90851 90852 90853 90854 90855 90856 90857 90858 90859 90860 90861 90862 90863 90864 90865 |
** yy_shift_ofst[] For each state, the offset into yy_action for
** shifting terminals.
** yy_reduce_ofst[] For each state, the offset into yy_action for
** shifting non-terminals after a reduce.
** yy_default[] Default action for each state.
*/
static const YYACTIONTYPE yy_action[] = {
/* 0 */ 312, 53, 494, 56, 143, 177, 181, 561, 44, 44,
/* 10 */ 44, 44, 224, 46, 46, 46, 46, 47, 47, 48,
/* 20 */ 48, 48, 49, 226, 511, 345, 209, 513, 501, 226,
/* 30 */ 550, 541, 54, 46, 46, 46, 46, 47, 47, 48,
/* 40 */ 48, 48, 49, 226, 48, 48, 48, 49, 226, 43,
/* 50 */ 41, 55, 539, 537, 540, 540, 45, 45, 44, 44,
/* 60 */ 44, 44, 252, 46, 46, 46, 46, 47, 47, 48,
/* 70 */ 48, 48, 49, 226, 312, 561, 321, 493, 429, 246,
/* 80 */ 60, 46, 46, 46, 46, 47, 47, 48, 48, 48,
/* 90 */ 49, 226, 613, 321, 493, 480, 477, 155, 426, 326,
/* 100 */ 369, 372, 373, 581, 550, 541, 311, 555, 155, 40,
/* 110 */ 374, 369, 372, 373, 47, 47, 48, 48, 48, 49,
/* 120 */ 226, 374, 536, 43, 41, 55, 539, 537, 540, 540,
/* 130 */ 45, 45, 44, 44, 44, 44, 301, 46, 46, 46,
/* 140 */ 46, 47, 47, 48, 48, 48, 49, 226, 312, 222,
/* 150 */ 210, 445, 431, 156, 139, 250, 366, 267, 367, 154,
/* 160 */ 509, 350, 513, 501, 561, 248, 222, 484, 513, 501,
/* 170 */ 340, 139, 250, 366, 267, 367, 154, 316, 550, 541,
/* 180 */ 609, 281, 248, 197, 565, 337, 309, 471, 428, 511,
/* 190 */ 582, 209, 556, 599, 566, 81, 493, 43, 41, 55,
/* 200 */ 539, 537, 540, 540, 45, 45, 44, 44, 44, 44,
/* 210 */ 471, 46, 46, 46, 46, 47, 47, 48, 48, 48,
/* 220 */ 49, 226, 312, 553, 553, 553, 287, 133, 517, 231,
/* 230 */ 480, 477, 561, 580, 355, 235, 480, 477, 483, 573,
/* 240 */ 340, 513, 501, 183, 591, 66, 571, 572, 493, 238,
/* 250 */ 205, 387, 550, 541, 155, 337, 390, 369, 372, 373,
/* 260 */ 959, 186, 490, 2, 566, 94, 466, 374, 195, 614,
/* 270 */ 198, 43, 41, 55, 539, 537, 540, 540, 45, 45,
/* 280 */ 44, 44, 44, 44, 565, 46, 46, 46, 46, 47,
/* 290 */ 47, 48, 48, 48, 49, 226, 312, 340, 570, 53,
/* 300 */ 618, 56, 143, 449, 565, 340, 353, 201, 141, 480,
/* 310 */ 477, 352, 337, 493, 400, 273, 200, 146, 569, 568,
/* 320 */ 337, 566, 71, 570, 224, 292, 550, 541, 361, 566,
/* 330 */ 94, 342, 483, 534, 534, 68, 360, 280, 493, 513,
/* 340 */ 501, 565, 381, 569, 410, 43, 41, 55, 539, 537,
/* 350 */ 540, 540, 45, 45, 44, 44, 44, 44, 462, 46,
/* 360 */ 46, 46, 46, 47, 47, 48, 48, 48, 49, 226,
/* 370 */ 312, 353, 468, 493, 246, 208, 363, 1, 340, 567,
/* 380 */ 230, 513, 501, 149, 333, 546, 4, 612, 617, 493,
/* 390 */ 240, 340, 112, 337, 611, 513, 501, 224, 212, 580,
/* 400 */ 550, 541, 566, 95, 409, 230, 337, 480, 477, 399,
/* 410 */ 482, 66, 471, 516, 493, 566, 94, 412, 466, 43,
/* 420 */ 41, 55, 539, 537, 540, 540, 45, 45, 44, 44,
/* 430 */ 44, 44, 565, 46, 46, 46, 46, 47, 47, 48,
/* 440 */ 48, 48, 49, 226, 312, 502, 585, 580, 329, 480,
/* 450 */ 477, 451, 513, 501, 592, 247, 332, 357, 615, 66,
/* 460 */ 150, 500, 493, 480, 477, 151, 400, 273, 53, 414,
/* 470 */ 56, 143, 215, 146, 550, 541, 224, 499, 617, 421,
/* 480 */ 317, 528, 524, 42, 282, 415, 594, 34, 476, 280,
/* 490 */ 420, 397, 203, 43, 41, 55, 539, 537, 540, 540,
/* 500 */ 45, 45, 44, 44, 44, 44, 493, 46, 46, 46,
/* 510 */ 46, 47, 47, 48, 48, 48, 49, 226, 312, 324,
/* 520 */ 480, 477, 435, 447, 439, 384, 565, 340, 284, 340,
/* 530 */ 241, 344, 528, 524, 53, 340, 56, 143, 620, 185,
/* 540 */ 461, 483, 337, 230, 337, 478, 217, 439, 550, 541,
/* 550 */ 337, 566, 95, 566, 89, 493, 596, 425, 227, 566,
/* 560 */ 81, 52, 459, 448, 440, 402, 584, 43, 41, 55,
/* 570 */ 539, 537, 540, 540, 45, 45, 44, 44, 44, 44,
/* 580 */ 565, 46, 46, 46, 46, 47, 47, 48, 48, 48,
/* 590 */ 49, 226, 312, 362, 230, 340, 259, 323, 491, 377,
/* 600 */ 234, 257, 458, 385, 398, 278, 283, 488, 337, 340,
/* 610 */ 337, 141, 340, 461, 340, 597, 493, 566, 9, 566,
/* 620 */ 96, 62, 550, 541, 337, 593, 401, 337, 493, 337,
/* 630 */ 151, 328, 157, 566, 85, 483, 566, 77, 566, 86,
/* 640 */ 874, 43, 41, 55, 539, 537, 540, 540, 45, 45,
/* 650 */ 44, 44, 44, 44, 340, 46, 46, 46, 46, 47,
/* 660 */ 47, 48, 48, 48, 49, 226, 312, 340, 444, 337,
/* 670 */ 364, 30, 443, 457, 502, 150, 327, 65, 566, 99,
/* 680 */ 340, 561, 337, 408, 324, 340, 386, 340, 248, 589,
/* 690 */ 500, 566, 137, 256, 574, 337, 550, 541, 579, 246,
/* 700 */ 337, 224, 337, 258, 566, 136, 499, 371, 349, 566,
/* 710 */ 138, 566, 101, 407, 493, 43, 41, 55, 539, 537,
/* 720 */ 540, 540, 45, 45, 44, 44, 44, 44, 340, 46,
/* 730 */ 46, 46, 46, 47, 47, 48, 48, 48, 49, 226,
/* 740 */ 312, 340, 229, 337, 340, 342, 252, 534, 534, 561,
/* 750 */ 522, 522, 566, 91, 574, 177, 337, 561, 579, 337,
/* 760 */ 340, 493, 58, 340, 38, 566, 88, 441, 566, 17,
/* 770 */ 550, 541, 508, 29, 306, 337, 452, 948, 337, 948,
/* 780 */ 629, 575, 416, 318, 566, 92, 192, 566, 73, 43,
/* 790 */ 41, 55, 539, 537, 540, 540, 45, 45, 44, 44,
/* 800 */ 44, 44, 340, 46, 46, 46, 46, 47, 47, 48,
/* 810 */ 48, 48, 49, 226, 312, 340, 246, 337, 340, 246,
/* 820 */ 270, 526, 340, 469, 299, 561, 566, 70, 202, 204,
/* 830 */ 337, 493, 507, 337, 493, 493, 340, 337, 493, 566,
/* 840 */ 90, 532, 566, 82, 550, 541, 566, 72, 557, 452,
/* 850 */ 949, 337, 949, 266, 598, 342, 150, 534, 534, 228,
/* 860 */ 566, 79, 533, 43, 41, 55, 539, 537, 540, 540,
/* 870 */ 45, 45, 44, 44, 44, 44, 340, 46, 46, 46,
/* 880 */ 46, 47, 47, 48, 48, 48, 49, 226, 312, 340,
/* 890 */ 246, 337, 340, 252, 526, 49, 226, 254, 549, 260,
/* 900 */ 566, 83, 588, 586, 337, 493, 606, 337, 493, 485,
/* 910 */ 340, 592, 392, 566, 69, 406, 566, 80, 550, 541,
/* 920 */ 342, 368, 534, 534, 253, 337, 150, 493, 604, 342,
/* 930 */ 223, 534, 534, 525, 566, 100, 285, 43, 57, 55,
/* 940 */ 539, 537, 540, 540, 45, 45, 44, 44, 44, 44,
/* 950 */ 340, 46, 46, 46, 46, 47, 47, 48, 48, 48,
/* 960 */ 49, 226, 312, 392, 246, 337, 340, 252, 575, 416,
/* 970 */ 351, 472, 276, 347, 566, 87, 279, 330, 493, 493,
/* 980 */ 496, 337, 493, 461, 340, 493, 493, 493, 548, 547,
/* 990 */ 566, 98, 550, 541, 498, 493, 172, 523, 493, 337,
/* 1000 */ 311, 577, 191, 243, 319, 423, 422, 530, 566, 105,
/* 1010 */ 544, 543, 41, 55, 539, 537, 540, 540, 45, 45,
/* 1020 */ 44, 44, 44, 44, 340, 46, 46, 46, 46, 47,
/* 1030 */ 47, 48, 48, 48, 49, 226, 312, 545, 340, 337,
/* 1040 */ 340, 246, 392, 207, 252, 445, 320, 489, 566, 103,
/* 1050 */ 627, 622, 519, 337, 232, 337, 493, 493, 340, 493,
/* 1060 */ 479, 340, 566, 108, 566, 109, 550, 541, 6, 607,
/* 1070 */ 608, 454, 2, 337, 492, 493, 337, 565, 517, 231,
/* 1080 */ 471, 322, 566, 134, 289, 566, 135, 55, 539, 537,
/* 1090 */ 540, 540, 45, 45, 44, 44, 44, 44, 487, 46,
/* 1100 */ 46, 46, 46, 47, 47, 48, 48, 48, 49, 226,
/* 1110 */ 23, 346, 340, 3, 397, 464, 422, 336, 501, 290,
/* 1120 */ 147, 214, 7, 23, 346, 340, 3, 337, 343, 493,
/* 1130 */ 336, 501, 463, 237, 172, 493, 566, 84, 475, 340,
/* 1140 */ 337, 343, 211, 340, 246, 225, 244, 348, 394, 566,
/* 1150 */ 75, 341, 18, 493, 337, 565, 393, 509, 337, 493,
/* 1160 */ 348, 493, 395, 566, 97, 245, 493, 566, 61, 274,
/* 1170 */ 509, 217, 16, 358, 189, 264, 565, 26, 25, 340,
/* 1180 */ 493, 236, 518, 310, 24, 338, 339, 304, 493, 556,
/* 1190 */ 26, 25, 450, 602, 337, 404, 120, 24, 338, 339,
/* 1200 */ 419, 169, 556, 566, 106, 565, 224, 117, 495, 27,
/* 1210 */ 346, 562, 3, 396, 187, 340, 336, 501, 179, 184,
/* 1220 */ 553, 553, 553, 552, 551, 11, 493, 343, 493, 398,
/* 1230 */ 337, 430, 8, 553, 553, 553, 552, 551, 11, 566,
/* 1240 */ 104, 335, 340, 255, 340, 616, 348, 340, 251, 331,
/* 1250 */ 340, 391, 558, 587, 50, 340, 509, 337, 493, 337,
/* 1260 */ 493, 365, 337, 493, 590, 337, 566, 78, 566, 102,
/* 1270 */ 337, 566, 76, 213, 566, 74, 26, 25, 610, 566,
/* 1280 */ 93, 378, 424, 24, 338, 339, 263, 583, 556, 220,
/* 1290 */ 140, 624, 294, 493, 300, 389, 23, 346, 376, 3,
/* 1300 */ 150, 493, 493, 336, 501, 493, 493, 493, 221, 493,
/* 1310 */ 493, 554, 268, 219, 343, 261, 515, 460, 418, 553,
/* 1320 */ 553, 553, 552, 551, 11, 595, 493, 493, 152, 206,
/* 1330 */ 493, 493, 493, 348, 272, 271, 269, 158, 302, 625,
/* 1340 */ 531, 521, 67, 509, 506, 520, 50, 628, 380, 600,
/* 1350 */ 173, 605, 123, 623, 493, 178, 37, 305, 308, 265,
/* 1360 */ 493, 620, 621, 26, 25, 165, 262, 307, 619, 166,
/* 1370 */ 24, 338, 339, 334, 436, 556, 427, 437, 33, 160,
/* 1380 */ 145, 466, 513, 501, 20, 148, 275, 122, 174, 359,
/* 1390 */ 442, 467, 486, 63, 36, 233, 42, 465, 512, 403,
/* 1400 */ 542, 182, 119, 113, 128, 132, 553, 553, 553, 552,
/* 1410 */ 551, 11, 39, 288, 538, 455, 291, 563, 388, 354,
/* 1420 */ 293, 295, 509, 31, 453, 356, 296, 325, 159, 405,
/* 1430 */ 286, 297, 564, 153, 313, 382, 35, 129, 303, 224,
/* 1440 */ 218, 121, 194, 196, 433, 107, 559, 242, 601, 216,
/* 1450 */ 428, 670, 280, 671, 556, 672, 162, 163, 32, 535,
/* 1460 */ 59, 505, 529, 411, 510, 190, 199, 176, 167, 504,
/* 1470 */ 503, 497, 5, 315, 314, 13, 19, 12, 474, 131,
/* 1480 */ 456, 144, 434, 432, 168, 553, 553, 553, 239, 51,
/* 1490 */ 603, 118, 111, 142, 249, 21, 124, 164, 379, 258,
/* 1500 */ 626, 188, 126, 172, 298, 383, 161, 370, 375, 114,
/* 1510 */ 15, 470, 481, 180, 125, 115, 127, 438, 446, 10,
/* 1520 */ 514, 110, 171, 527, 170, 116, 130, 560, 64, 14,
/* 1530 */ 175, 576, 578, 413, 277, 193, 417, 960, 473, 960,
/* 1540 */ 28, 960, 22,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 19, 222, 223, 224, 225, 24, 35, 26, 77, 78,
/* 10 */ 79, 80, 115, 82, 83, 84, 85, 86, 87, 88,
/* 20 */ 89, 90, 91, 92, 166, 167, 168, 26, 27, 92,
/* 30 */ 49, 50, 81, 82, 83, 84, 85, 86, 87, 88,
/* 40 */ 89, 90, 91, 92, 88, 89, 90, 91, 92, 68,
/* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
/* 60 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88,
/* 70 */ 89, 90, 91, 92, 19, 94, 19, 165, 174, 150,
/* 80 */ 25, 82, 83, 84, 85, 86, 87, 88, 89, 90,
/* 90 */ 91, 92, 186, 19, 165, 94, 95, 96, 174, 187,
/* 100 */ 99, 100, 101, 186, 49, 50, 22, 23, 96, 54,
/* 110 */ 109, 99, 100, 101, 86, 87, 88, 89, 90, 91,
/* 120 */ 92, 109, 193, 68, 69, 70, 71, 72, 73, 74,
/* 130 */ 75, 76, 77, 78, 79, 80, 195, 82, 83, 84,
/* 140 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 92,
/* 150 */ 160, 67, 23, 96, 97, 98, 99, 100, 101, 102,
/* 160 */ 66, 191, 26, 27, 26, 108, 92, 208, 26, 27,
/* 170 */ 150, 97, 98, 99, 100, 101, 102, 155, 49, 50,
/* 180 */ 183, 150, 108, 25, 194, 165, 163, 166, 94, 166,
/* 190 */ 167, 168, 98, 183, 174, 175, 165, 68, 69, 70,
/* 200 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
/* 210 */ 166, 82, 83, 84, 85, 86, 87, 88, 89, 90,
/* 220 */ 91, 92, 19, 129, 130, 131, 205, 24, 86, 87,
/* 230 */ 94, 95, 94, 150, 214, 215, 94, 95, 25, 97,
/* 240 */ 150, 26, 27, 23, 161, 162, 104, 105, 165, 205,
/* 250 */ 160, 229, 49, 50, 96, 165, 234, 99, 100, 101,
/* 260 */ 142, 143, 144, 145, 174, 175, 57, 109, 185, 186,
/* 270 */ 160, 68, 69, 70, 71, 72, 73, 74, 75, 76,
/* 280 */ 77, 78, 79, 80, 194, 82, 83, 84, 85, 86,
/* 290 */ 87, 88, 89, 90, 91, 92, 19, 150, 150, 222,
/* 300 */ 23, 224, 225, 88, 194, 150, 216, 160, 95, 94,
/* 310 */ 95, 221, 165, 165, 105, 106, 206, 207, 170, 171,
/* 320 */ 165, 174, 175, 150, 115, 148, 49, 50, 19, 174,
/* 330 */ 175, 111, 119, 113, 114, 22, 27, 128, 165, 26,
/* 340 */ 27, 194, 237, 170, 171, 68, 69, 70, 71, 72,
/* 350 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
/* 360 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
/* 370 */ 19, 216, 11, 165, 150, 236, 221, 22, 150, 231,
/* 380 */ 232, 26, 27, 25, 146, 147, 196, 181, 182, 165,
/* 390 */ 152, 150, 154, 165, 188, 26, 27, 115, 160, 150,
/* 400 */ 49, 50, 174, 175, 231, 232, 165, 94, 95, 127,
/* 410 */ 161, 162, 166, 166, 165, 174, 175, 193, 57, 68,
/* 420 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
/* 430 */ 79, 80, 194, 82, 83, 84, 85, 86, 87, 88,
/* 440 */ 89, 90, 91, 92, 19, 12, 173, 150, 220, 94,
/* 450 */ 95, 205, 26, 27, 181, 158, 218, 216, 161, 162,
/* 460 */ 25, 28, 165, 94, 95, 50, 105, 106, 222, 245,
/* 470 */ 224, 225, 206, 207, 49, 50, 115, 44, 182, 46,
/* 480 */ 169, 170, 171, 125, 16, 247, 166, 136, 119, 128,
/* 490 */ 57, 150, 160, 68, 69, 70, 71, 72, 73, 74,
/* 500 */ 75, 76, 77, 78, 79, 80, 165, 82, 83, 84,
/* 510 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 104,
/* 520 */ 94, 95, 23, 21, 105, 106, 194, 150, 60, 150,
/* 530 */ 62, 169, 170, 171, 222, 150, 224, 225, 103, 23,
/* 540 */ 150, 25, 165, 232, 165, 119, 160, 128, 49, 50,
/* 550 */ 165, 174, 175, 174, 175, 165, 244, 165, 217, 174,
/* 560 */ 175, 136, 7, 8, 9, 63, 174, 68, 69, 70,
/* 570 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
/* 580 */ 194, 82, 83, 84, 85, 86, 87, 88, 89, 90,
/* 590 */ 91, 92, 19, 150, 232, 150, 23, 220, 32, 19,
/* 600 */ 215, 150, 100, 213, 218, 226, 138, 41, 165, 150,
/* 610 */ 165, 95, 150, 150, 150, 177, 165, 174, 175, 174,
/* 620 */ 175, 235, 49, 50, 165, 177, 240, 165, 165, 165,
/* 630 */ 50, 248, 249, 174, 175, 119, 174, 175, 174, 175,
/* 640 */ 138, 68, 69, 70, 71, 72, 73, 74, 75, 76,
/* 650 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
/* 660 */ 87, 88, 89, 90, 91, 92, 19, 150, 30, 165,
/* 670 */ 88, 24, 34, 23, 12, 25, 213, 22, 174, 175,
/* 680 */ 150, 26, 165, 97, 104, 150, 48, 150, 108, 166,
/* 690 */ 28, 174, 175, 98, 112, 165, 49, 50, 116, 150,
/* 700 */ 165, 115, 165, 108, 174, 175, 44, 178, 46, 174,
/* 710 */ 175, 174, 175, 127, 165, 68, 69, 70, 71, 72,
/* 720 */ 73, 74, 75, 76, 77, 78, 79, 80, 150, 82,
/* 730 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
/* 740 */ 19, 150, 193, 165, 150, 111, 150, 113, 114, 94,
/* 750 */ 129, 130, 174, 175, 112, 24, 165, 26, 116, 165,
/* 760 */ 150, 165, 135, 150, 137, 174, 175, 23, 174, 175,
/* 770 */ 49, 50, 23, 52, 25, 165, 22, 23, 165, 25,
/* 780 */ 0, 1, 2, 187, 174, 175, 196, 174, 175, 68,
/* 790 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
/* 800 */ 79, 80, 150, 82, 83, 84, 85, 86, 87, 88,
/* 810 */ 89, 90, 91, 92, 19, 150, 150, 165, 150, 150,
/* 820 */ 150, 67, 150, 150, 198, 94, 174, 175, 105, 106,
/* 830 */ 165, 165, 23, 165, 165, 165, 150, 165, 165, 174,
/* 840 */ 175, 23, 174, 175, 49, 50, 174, 175, 166, 22,
/* 850 */ 23, 165, 25, 16, 23, 111, 25, 113, 114, 193,
/* 860 */ 174, 175, 193, 68, 69, 70, 71, 72, 73, 74,
/* 870 */ 75, 76, 77, 78, 79, 80, 150, 82, 83, 84,
/* 880 */ 85, 86, 87, 88, 89, 90, 91, 92, 19, 150,
/* 890 */ 150, 165, 150, 150, 67, 91, 92, 60, 199, 62,
/* 900 */ 174, 175, 172, 173, 165, 165, 36, 165, 165, 25,
/* 910 */ 150, 181, 150, 174, 175, 209, 174, 175, 49, 50,
/* 920 */ 111, 51, 113, 114, 23, 165, 25, 165, 58, 111,
/* 930 */ 187, 113, 114, 193, 174, 175, 209, 68, 69, 70,
/* 940 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
/* 950 */ 150, 82, 83, 84, 85, 86, 87, 88, 89, 90,
/* 960 */ 91, 92, 19, 150, 150, 165, 150, 150, 1, 2,
/* 970 */ 150, 150, 150, 228, 174, 175, 242, 107, 165, 165,
/* 980 */ 150, 165, 165, 150, 150, 165, 165, 165, 49, 50,
/* 990 */ 174, 175, 49, 50, 23, 165, 25, 233, 165, 165,
/* 1000 */ 22, 23, 118, 241, 187, 190, 191, 193, 174, 175,
/* 1010 */ 71, 72, 69, 70, 71, 72, 73, 74, 75, 76,
/* 1020 */ 77, 78, 79, 80, 150, 82, 83, 84, 85, 86,
/* 1030 */ 87, 88, 89, 90, 91, 92, 19, 98, 150, 165,
/* 1040 */ 150, 150, 150, 160, 150, 67, 213, 199, 174, 175,
/* 1050 */ 7, 8, 233, 165, 241, 165, 165, 165, 150, 165,
/* 1060 */ 150, 150, 174, 175, 174, 175, 49, 50, 22, 97,
/* 1070 */ 98, 144, 145, 165, 177, 165, 165, 194, 86, 87,
/* 1080 */ 166, 187, 174, 175, 193, 174, 175, 70, 71, 72,
/* 1090 */ 73, 74, 75, 76, 77, 78, 79, 80, 177, 82,
/* 1100 */ 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
/* 1110 */ 19, 20, 150, 22, 150, 190, 191, 26, 27, 205,
/* 1120 */ 150, 160, 76, 19, 20, 150, 22, 165, 37, 165,
/* 1130 */ 26, 27, 23, 241, 25, 165, 174, 175, 150, 150,
/* 1140 */ 165, 37, 160, 150, 150, 197, 150, 56, 19, 174,
/* 1150 */ 175, 150, 204, 165, 165, 194, 27, 66, 165, 165,
/* 1160 */ 56, 165, 242, 174, 175, 150, 165, 174, 175, 209,
/* 1170 */ 66, 160, 22, 150, 24, 177, 194, 86, 87, 150,
/* 1180 */ 165, 217, 250, 251, 93, 94, 95, 193, 165, 98,
/* 1190 */ 86, 87, 88, 153, 165, 18, 192, 93, 94, 95,
/* 1200 */ 13, 151, 98, 174, 175, 194, 115, 22, 157, 19,
/* 1210 */ 20, 150, 22, 150, 219, 150, 26, 27, 117, 157,
/* 1220 */ 129, 130, 131, 132, 133, 134, 165, 37, 165, 218,
/* 1230 */ 165, 157, 25, 129, 130, 131, 132, 133, 134, 174,
/* 1240 */ 175, 159, 150, 150, 150, 150, 56, 150, 150, 47,
/* 1250 */ 150, 240, 23, 184, 25, 150, 66, 165, 165, 165,
/* 1260 */ 165, 104, 165, 165, 176, 165, 174, 175, 174, 175,
/* 1270 */ 165, 174, 175, 157, 174, 175, 86, 87, 150, 174,
/* 1280 */ 175, 18, 176, 93, 94, 95, 150, 150, 98, 92,
/* 1290 */ 150, 150, 150, 165, 150, 150, 19, 20, 23, 22,
/* 1300 */ 25, 165, 165, 26, 27, 165, 165, 165, 230, 165,
/* 1310 */ 165, 150, 150, 230, 37, 150, 150, 150, 184, 129,
/* 1320 */ 130, 131, 132, 133, 134, 176, 165, 165, 156, 5,
/* 1330 */ 165, 165, 165, 56, 10, 11, 12, 13, 14, 150,
/* 1340 */ 23, 17, 25, 66, 23, 150, 25, 176, 157, 176,
/* 1350 */ 156, 40, 22, 157, 165, 31, 243, 33, 179, 176,
/* 1360 */ 165, 103, 178, 86, 87, 156, 42, 179, 176, 6,
/* 1370 */ 93, 94, 95, 149, 157, 98, 149, 149, 22, 55,
/* 1380 */ 68, 57, 26, 27, 104, 61, 210, 189, 64, 120,
/* 1390 */ 157, 211, 38, 246, 135, 227, 125, 189, 199, 157,
/* 1400 */ 199, 219, 192, 192, 192, 189, 129, 130, 131, 132,
/* 1410 */ 133, 134, 124, 210, 149, 211, 210, 203, 157, 121,
/* 1420 */ 202, 201, 66, 123, 211, 122, 200, 157, 156, 105,
/* 1430 */ 106, 199, 194, 151, 110, 45, 135, 180, 238, 115,
/* 1440 */ 180, 126, 86, 87, 239, 164, 1, 15, 23, 22,
/* 1450 */ 94, 117, 128, 117, 98, 117, 117, 117, 243, 112,
/* 1460 */ 22, 11, 23, 139, 23, 22, 22, 25, 249, 23,
/* 1470 */ 23, 23, 35, 252, 252, 35, 25, 25, 119, 22,
/* 1480 */ 27, 117, 23, 23, 35, 129, 130, 131, 52, 22,
/* 1490 */ 29, 22, 22, 39, 23, 22, 22, 102, 19, 108,
/* 1500 */ 20, 24, 104, 25, 138, 43, 104, 52, 52, 22,
/* 1510 */ 5, 1, 27, 117, 107, 126, 53, 59, 53, 22,
/* 1520 */ 1, 118, 16, 20, 120, 107, 118, 127, 16, 22,
/* 1530 */ 15, 23, 23, 65, 140, 22, 3, 253, 4, 253,
/* 1540 */ 76, 253, 76,
};
#define YY_SHIFT_USE_DFLT (-104)
#define YY_SHIFT_MAX 417
static const short yy_shift_ofst[] = {
/* 0 */ 967, 1091, 1324, 1091, 1277, 1277, 142, 142, 1, -19,
/* 10 */ 1277, 1277, 1277, 1277, 1277, 209, 136, 721, 1104, 1277,
/* 20 */ 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
/* 30 */ 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
/* 40 */ 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277, 1277,
/* 50 */ 1277, 1277, 1277, 1277, 1277, 1190, 1277, 1277, 1277, 1277,
/* 60 */ 1277, -49, 361, 136, 136, 992, 138, 992, -103, 55,
/* 70 */ 129, 499, 351, 647, 203, 277, 425, 573, 869, 795,
/* 80 */ 795, 795, 795, 795, 795, 795, 795, 795, 795, 795,
/* 90 */ 795, 795, 795, 795, 795, 795, 795, 795, 943, 1017,
/* 100 */ 1017, -69, -69, -69, -69, -1, -1, 57, 28, -44,
/* 110 */ 136, 136, 502, 136, 136, 136, 136, 136, 136, 136,
/* 120 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 580,
/* 130 */ 136, 136, 136, 138, 804, -63, -104, -104, -104, 1356,
/* 140 */ 74, 426, 433, 355, 215, 433, 313, 369, 136, 136,
/* 150 */ 136, 136, 136, 136, 136, 136, 136, 754, 136, 136,
/* 160 */ 136, 136, 136, 136, 136, 136, 136, 827, 136, 136,
/* 170 */ 136, 136, 136, 136, 136, 136, 136, 136, 136, 136,
/* 180 */ 136, 136, 586, 731, 731, 731, 780, 282, -103, -103,
/* 190 */ -103, -104, -104, -104, 94, 158, 94, 12, 220, 662,
/* 200 */ 516, 744, 870, 809, 870, 818, 555, 634, 419, 655,
/* 210 */ 634, 634, 634, 638, 634, 213, 582, 634, 415, 566,
/* 220 */ 138, 566, 138, 435, 642, 884, 138, 358, 309, 309,
/* 230 */ 621, 621, 1129, 627, 566, 566, 358, 1129, 309, 566,
/* 240 */ 1150, 1177, 1187, 1185, 1101, 1101, 1101, 1207, 1202, 1157,
/* 250 */ 1157, 1101, 1197, 1157, 1263, 1197, 1157, 1101, 1202, 1157,
/* 260 */ 1263, 1101, 1311, 1330, 1157, 1258, 1263, 1157, 1330, 1363,
/* 270 */ 1101, 1363, 1363, 1312, 1280, 1269, 1101, 1354, 1259, 1271,
/* 280 */ 1312, 1101, 1177, 1177, 1177, 1271, 1312, 1280, 1269, 1185,
/* 290 */ 1280, 1269, 1363, 1288, 1101, 1298, 1300, 1303, 1263, 1271,
/* 300 */ 1101, -103, 1187, 1301, 1390, 1311, -104, -104, -104, -104,
/* 310 */ -104, -104, 939, 468, 978, 84, 837, 1317, 650, 831,
/* 320 */ 971, 595, 1275, 1321, 723, 1046, 901, 1109, 749, 1229,
/* 330 */ 972, 1043, 1315, 1445, 1432, 1425, 1427, 1334, 1336, 1338,
/* 340 */ 1339, 1340, 1347, 1438, 1439, 1441, 1443, 1450, 1444, 1446,
/* 350 */ 1442, 1447, 1448, 1451, 1437, 1452, 1440, 1451, 1359, 1457,
/* 360 */ 1449, 1453, 1364, 1459, 1460, 1454, 1436, 1467, 1461, 1455,
/* 370 */ 1469, 1471, 1470, 1473, 1456, 1474, 1395, 1391, 1479, 1480,
/* 380 */ 1477, 1398, 1462, 1458, 1463, 1478, 1465, 1366, 1402, 1487,
/* 390 */ 1505, 1510, 1396, -29, 1485, 1407, 1464, 1466, 1389, 1497,
/* 400 */ 1403, 1519, 1506, 1404, 1503, 1408, 1418, 1507, 1400, 1508,
/* 410 */ 1509, 1512, 1468, 1515, 1394, 1513, 1533, 1534,
};
#define YY_REDUCE_USE_DFLT (-222)
#define YY_REDUCE_MAX 311
static const short yy_reduce_ofst[] = {
/* 0 */ 118, 90, 238, 147, 155, 20, 173, 148, 83, 246,
/* 10 */ 377, 379, 385, 241, 228, 386, 297, 312, 443, 445,
/* 20 */ 459, 462, 464, 504, 517, 530, 535, 537, 578, 591,
/* 30 */ 594, 610, 613, 652, 665, 668, 672, 686, 726, 739,
/* 40 */ 742, 760, 800, 816, 834, 874, 888, 890, 908, 911,
/* 50 */ 962, 975, 989, 993, 1029, 1065, 1092, 1094, 1097, 1100,
/* 60 */ 1105, -221, 1011, 249, 224, 311, 23, 362, 110, 77,
/* 70 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
/* 80 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
/* 90 */ 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
/* 100 */ 77, 77, 77, 77, 77, 77, 77, 730, 77, 77,
/* 110 */ 813, -88, 22, 669, 596, 762, 341, 833, 743, 740,
/* 120 */ 814, 891, 892, 817, 894, 964, 994, 390, -71, 206,
/* 130 */ 549, 463, 666, -142, 77, 77, 77, 77, 77, 392,
/* 140 */ 273, 970, 815, 996, 1001, 925, 1015, 1023, 1061, 1063,
/* 150 */ 1093, 1095, 1098, 1128, 1136, 1137, 1140, 932, 1141, 1142,
/* 160 */ 1144, 1145, 1001, 1161, 1162, 1165, 1166, 932, 1167, 1189,
/* 170 */ 1195, 31, 208, 451, 670, 673, 820, 821, 822, 830,
/* 180 */ 988, 910, -10, 21, 44, 914, 927, 883, 961, 982,
/* 190 */ 332, 266, 948, 383, -96, -94, -76, -83, -59, -30,
/* 200 */ -41, -59, -3, -59, 10, -59, 177, -59, 105, 247,
/* 210 */ -59, -59, -59, 139, -59, -41, 190, -59, 296, 438,
/* 220 */ 320, 448, 523, 529, 590, 626, 682, 699, 706, 727,
/* 230 */ 764, 819, 734, 745, 897, 921, 848, 920, 960, 998,
/* 240 */ 1040, 1004, 1050, 995, 1051, 1062, 1074, 1082, 1069, 1088,
/* 250 */ 1106, 1116, 1078, 1149, 1172, 1083, 1171, 1191, 1134, 1173,
/* 260 */ 1194, 1196, 1113, 1179, 1183, 1184, 1209, 1192, 1188, 1224,
/* 270 */ 1217, 1227, 1228, 1198, 1176, 1180, 1233, 1147, 1168, 1199,
/* 280 */ 1208, 1242, 1210, 1211, 1212, 1201, 1216, 1203, 1204, 1182,
/* 290 */ 1206, 1213, 1265, 1214, 1261, 1218, 1220, 1226, 1272, 1232,
/* 300 */ 1270, 1238, 1282, 1205, 1200, 1215, 1219, 1257, 1260, 1281,
/* 310 */ 1221, 1222,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 634, 869, 958, 958, 869, 958, 898, 898, 958, 757,
/* 10 */ 958, 867, 958, 958, 958, 958, 958, 932, 958, 958,
/* 20 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 30 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 40 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 50 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 60 */ 958, 841, 958, 958, 958, 898, 673, 898, 761, 792,
/* 70 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 931,
/* 80 */ 793, 783, 911, 864, 806, 772, 800, 797, 933, 866,
/* 90 */ 863, 799, 790, 794, 871, 807, 870, 862, 829, 847,
/* 100 */ 828, 846, 853, 831, 845, 830, 840, 665, 832, 833,
/* 110 */ 958, 958, 660, 958, 958, 958, 958, 958, 958, 958,
/* 120 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 726,
/* 130 */ 958, 958, 958, 958, 834, 835, 849, 848, 850, 958,
/* 140 */ 958, 958, 958, 958, 958, 958, 958, 958, 882, 958,
/* 150 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 160 */ 958, 958, 958, 958, 958, 958, 640, 958, 958, 958,
/* 170 */ 958, 958, 958, 958, 936, 958, 958, 958, 938, 958,
/* 180 */ 958, 958, 958, 757, 757, 757, 634, 958, 958, 958,
/* 190 */ 958, 761, 751, 950, 958, 717, 958, 958, 958, 958,
/* 200 */ 958, 958, 958, 958, 958, 958, 642, 921, 958, 675,
/* 210 */ 802, 662, 740, 904, 738, 759, 749, 923, 696, 786,
/* 220 */ 958, 786, 958, 699, 749, 758, 958, 796, 774, 774,
/* 230 */ 958, 958, 916, 865, 786, 786, 796, 916, 774, 786,
/* 240 */ 958, 737, 650, 808, 765, 765, 765, 716, 713, 728,
/* 250 */ 728, 765, 879, 728, 657, 879, 728, 765, 713, 728,
/* 260 */ 657, 765, 935, 875, 728, 699, 657, 728, 875, 639,
/* 270 */ 765, 639, 639, 730, 773, 778, 765, 943, 958, 796,
/* 280 */ 730, 765, 737, 737, 737, 796, 730, 773, 778, 808,
/* 290 */ 773, 778, 639, 791, 765, 779, 789, 787, 657, 796,
/* 300 */ 765, 958, 650, 910, 908, 935, 950, 701, 701, 683,
/* 310 */ 955, 955, 958, 958, 958, 958, 958, 958, 958, 958,
/* 320 */ 958, 958, 958, 958, 958, 884, 958, 958, 958, 958,
/* 330 */ 958, 958, 958, 958, 648, 958, 667, 815, 820, 816,
/* 340 */ 958, 817, 743, 958, 958, 958, 958, 958, 958, 958,
/* 350 */ 958, 958, 958, 868, 958, 780, 958, 788, 958, 958,
/* 360 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 370 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 380 */ 958, 958, 958, 958, 906, 907, 958, 958, 958, 958,
/* 390 */ 958, 958, 914, 958, 958, 958, 958, 958, 958, 958,
/* 400 */ 958, 958, 958, 958, 958, 958, 958, 958, 958, 958,
/* 410 */ 958, 958, 942, 958, 958, 945, 635, 958, 711, 649,
/* 420 */ 734, 733, 732, 729, 691, 690, 689, 647, 820, 688,
/* 430 */ 767, 687, 826, 900, 825, 813, 937, 646, 909, 905,
/* 440 */ 645, 857, 939, 901, 902, 957, 903, 659, 644, 754,
/* 450 */ 753, 752, 954, 764, 630, 763, 776, 872, 873, 643,
/* 460 */ 775, 811, 810, 777, 731, 804, 805, 762, 899, 940,
/* 470 */ 912, 756, 755, 636, 771, 915, 770, 672, 769, 917,
/* 480 */ 671, 918, 941, 768, 760, 750, 944, 782, 785, 919,
/* 490 */ 631, 784, 781, 670, 842, 859, 766, 856, 809, 928,
/* 500 */ 927, 668, 926, 925, 924, 861, 920, 860, 946, 827,
/* 510 */ 824, 678, 922, 667, 913, 641, 679, 897, 951, 895,
/* 520 */ 947, 656, 896, 894, 681, 735, 952, 736, 680, 677,
/* 530 */ 739, 676, 858, 881, 745, 744, 929, 854, 638, 851,
/* 540 */ 843, 838, 795, 855, 852, 844, 637, 839, 837, 798,
/* 550 */ 836, 822, 821, 819, 818, 953, 814, 823, 801, 633,
/* 560 */ 803, 669, 883, 746, 742, 741, 812, 885, 887, 889,
/* 570 */ 890, 891, 892, 893, 748, 632, 886, 956, 888, 747,
/* 580 */ 666, 718, 674, 721, 686, 684, 685, 712, 682, 698,
/* 590 */ 722, 663, 697, 878, 880, 723, 930, 877, 876, 705,
/* 600 */ 724, 661, 654, 710, 709, 934, 708, 707, 706, 704,
/* 610 */ 652, 725, 727, 719, 720, 664, 703, 702, 695, 694,
/* 620 */ 700, 693, 715, 655, 651, 653, 658, 714, 692,
};
#define YY_SZ_ACTTAB (int)(sizeof(yy_action)/sizeof(yy_action[0]))
/* The next table maps tokens into fallback tokens. If a construct
** like the following:
**
** %fallback ID X Y Z.
|
| ︙ | ︙ | |||
92149 92150 92151 92152 92153 92154 92155 |
case 68: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy328);}
break;
case 69: /* ccons ::= COLLATE ids */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
break;
case 72: /* refargs ::= */
| | | | | | | | 92367 92368 92369 92370 92371 92372 92373 92374 92375 92376 92377 92378 92379 92380 92381 92382 92383 92384 92385 92386 92387 92388 92389 92390 92391 92392 92393 92394 92395 92396 92397 92398 92399 92400 92401 92402 92403 92404 92405 92406 92407 92408 |
case 68: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy328);}
break;
case 69: /* ccons ::= COLLATE ids */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
break;
case 72: /* refargs ::= */
{ yygotominor.yy328 = OE_None*0x0101; /* EV: R-19803-45884 */}
break;
case 73: /* refargs ::= refargs refarg */
{ yygotominor.yy328 = (yymsp[-1].minor.yy328 & ~yymsp[0].minor.yy429.mask) | yymsp[0].minor.yy429.value; }
break;
case 74: /* refarg ::= MATCH nm */
{ yygotominor.yy429.value = 0; yygotominor.yy429.mask = 0x000000; }
break;
case 75: /* refarg ::= ON DELETE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328; yygotominor.yy429.mask = 0x0000ff; }
break;
case 76: /* refarg ::= ON UPDATE refact */
{ yygotominor.yy429.value = yymsp[0].minor.yy328<<8; yygotominor.yy429.mask = 0x00ff00; }
break;
case 77: /* refact ::= SET NULL */
{ yygotominor.yy328 = OE_SetNull; /* EV: R-33326-45252 */}
break;
case 78: /* refact ::= SET DEFAULT */
{ yygotominor.yy328 = OE_SetDflt; /* EV: R-33326-45252 */}
break;
case 79: /* refact ::= CASCADE */
{ yygotominor.yy328 = OE_Cascade; /* EV: R-33326-45252 */}
break;
case 80: /* refact ::= RESTRICT */
{ yygotominor.yy328 = OE_Restrict; /* EV: R-33326-45252 */}
break;
case 81: /* refact ::= NO ACTION */
{ yygotominor.yy328 = OE_None; /* EV: R-33326-45252 */}
break;
case 83: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
case 98: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==98);
case 100: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==100);
case 103: /* resolvetype ::= raisetype */ yytestcase(yyruleno==103);
{yygotominor.yy328 = yymsp[0].minor.yy328;}
break;
|
| ︙ | ︙ | |||
93429 93430 93431 93432 93433 93434 93435 |
42, 12, 74, 15, 0, 113, 81, 50, 108, 0, 19, 0, 0,
118, 0, 116, 111, 0, 22, 89, 0, 9, 0, 0, 66, 67,
0, 65, 6, 0, 48, 86, 98, 0, 115, 97, 0, 0, 45,
0, 99, 24, 0, 17, 0, 119, 49, 23, 0, 5, 106, 25,
92, 0, 0, 121, 102, 56, 120, 53, 28, 51, 0, 87, 0,
96, 26, 0, 95, 0, 0, 0, 91, 88, 93, 84, 105, 14,
39, 104, 0, 77, 0, 18, 85, 107, 32, 0, 117, 76, 109,
| | | | | | 93647 93648 93649 93650 93651 93652 93653 93654 93655 93656 93657 93658 93659 93660 93661 93662 93663 93664 93665 93666 93667 93668 93669 93670 93671 93672 93673 93674 93675 93676 93677 93678 93679 93680 93681 |
42, 12, 74, 15, 0, 113, 81, 50, 108, 0, 19, 0, 0,
118, 0, 116, 111, 0, 22, 89, 0, 9, 0, 0, 66, 67,
0, 65, 6, 0, 48, 86, 98, 0, 115, 97, 0, 0, 45,
0, 99, 24, 0, 17, 0, 119, 49, 23, 0, 5, 106, 25,
92, 0, 0, 121, 102, 56, 120, 53, 28, 51, 0, 87, 0,
96, 26, 0, 95, 0, 0, 0, 91, 88, 93, 84, 105, 14,
39, 104, 0, 77, 0, 18, 85, 107, 32, 0, 117, 76, 109,
57, 46, 80, 0, 0, 90, 40, 0, 112, 0, 36, 0, 0,
29, 0, 82, 59, 60, 0, 20, 58, 0, 52,
};
static const unsigned char aNext[121] = {
0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 33, 21, 0, 0, 0, 43, 3, 47,
0, 0, 0, 0, 0, 30, 54, 0, 38, 0, 0, 0, 1,
62, 0, 0, 63, 0, 41, 0, 0, 0, 0, 0, 0, 0,
61, 0, 0, 0, 0, 31, 55, 16, 34, 10, 0, 0, 0,
0, 0, 0, 0, 11, 68, 75, 0, 8, 0, 100, 94, 0,
103, 0, 83, 0, 71, 0, 0, 110, 27, 37, 69, 79, 0,
35, 64, 0, 0,
};
static const unsigned char aLen[121] = {
7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
4, 6, 2, 3, 4, 9, 2, 6, 5, 6, 6, 5, 6,
5, 5, 7, 7, 3, 7, 2, 4, 4, 7, 3, 6, 4,
7, 6, 12, 6, 9, 4, 6, 5, 4, 7, 6, 5, 6,
7, 5, 4, 5, 6, 5, 7, 3, 7, 13, 2, 2, 4,
6, 6, 8, 5, 17, 12, 7, 8, 8, 2, 4, 4, 4,
4, 4, 2, 2, 6, 5, 8, 5, 5, 8, 3, 5, 5,
6, 4, 9, 3,
};
static const unsigned short int aOffset[121] = {
|
| ︙ | ︙ | |||
93480 93481 93482 93483 93484 93485 93486 |
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
TK_OR, TK_UNIQUE, TK_QUERY, TK_ATTACH, TK_HAVING,
TK_GROUP, TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RELEASE,
| | | 93698 93699 93700 93701 93702 93703 93704 93705 93706 93707 93708 93709 93710 93711 93712 |
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
TK_OR, TK_UNIQUE, TK_QUERY, TK_ATTACH, TK_HAVING,
TK_GROUP, TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RELEASE,
TK_BETWEEN, TK_NOT, TK_NOTNULL, TK_NO, TK_NULL,
TK_LIKE_KW, TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE,
TK_COLLATE, TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE,
TK_JOIN, TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE,
TK_PRAGMA, TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT,
TK_WHEN, TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE,
TK_AND, TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN,
TK_CAST, TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW,
|
| ︙ | ︙ | |||
93558 93559 93560 93561 93562 93563 93564 |
testcase( i==49 ); /* HAVING */
testcase( i==50 ); /* GROUP */
testcase( i==51 ); /* UPDATE */
testcase( i==52 ); /* BEGIN */
testcase( i==53 ); /* INNER */
testcase( i==54 ); /* RELEASE */
testcase( i==55 ); /* BETWEEN */
| | | | | 93776 93777 93778 93779 93780 93781 93782 93783 93784 93785 93786 93787 93788 93789 93790 93791 93792 |
testcase( i==49 ); /* HAVING */
testcase( i==50 ); /* GROUP */
testcase( i==51 ); /* UPDATE */
testcase( i==52 ); /* BEGIN */
testcase( i==53 ); /* INNER */
testcase( i==54 ); /* RELEASE */
testcase( i==55 ); /* BETWEEN */
testcase( i==56 ); /* NOT */
testcase( i==57 ); /* NOTNULL */
testcase( i==58 ); /* NO */
testcase( i==59 ); /* NULL */
testcase( i==60 ); /* LIKE */
testcase( i==61 ); /* CASCADE */
testcase( i==62 ); /* ASC */
testcase( i==63 ); /* DELETE */
testcase( i==64 ); /* CASE */
testcase( i==65 ); /* COLLATE */
|
| ︙ | ︙ | |||
95954 95955 95956 95957 95958 95959 95960 | #endif #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30 # error SQLITE_MAX_ATTACHED must be between 0 and 30 #endif #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 # error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1 #endif | | | | 96172 96173 96174 96175 96176 96177 96178 96179 96180 96181 96182 96183 96184 96185 96186 96187 | #endif #if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>30 # error SQLITE_MAX_ATTACHED must be between 0 and 30 #endif #if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 # error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1 #endif #if SQLITE_MAX_VARIABLE_NUMBER<1 || SQLITE_MAX_VARIABLE_NUMBER>32767 # error SQLITE_MAX_VARIABLE_NUMBER must be between 1 and 32767 #endif #if SQLITE_MAX_COLUMN>32767 # error SQLITE_MAX_COLUMN must not exceed 32767 #endif #if SQLITE_MAX_TRIGGER_DEPTH<1 # error SQLITE_MAX_TRIGGER_DEPTH must be at least 1 #endif |
| ︙ | ︙ |