Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Update to the latest SQLite. Add a Rebuild button on the Shun webpage. Add the test-detach CLI method. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
3f6edbc779e7b604164a1f5ea6efebdd |
| User & Date: | drh 2008-11-10 00:40:10.000 |
Context
|
2008-11-10
| ||
| 01:13 | The "ui" and "server" commands no longer quit if they cannot open TCP port 8080. They keep trying with consecutive ports until they find one that works - up to 100 ports. ... (check-in: d8ceb4ad47 user: drh tags: trunk) | |
| 00:40 | Update to the latest SQLite. Add a Rebuild button on the Shun webpage. Add the test-detach CLI method. ... (check-in: 3f6edbc779 user: drh tags: trunk) | |
|
2008-11-09
| ||
| 22:59 | Tweaks to the formatting of the "stat" webpage. ... (check-in: caa9544f93 user: drh tags: trunk) | |
Changes
Changes to src/rebuild.c.
| ︙ | ︙ | |||
283 284 285 286 287 288 289 |
printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
errCnt);
db_end_transaction(1);
}else{
db_end_transaction(0);
}
}
| > > > > > > > > > > > > > > > > > > > > > | 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
printf("%d errors. Rolling back changes. Use --force to force a commit.\n",
errCnt);
db_end_transaction(1);
}else{
db_end_transaction(0);
}
}
/*
** COMMAND: test-detach
**
** Change the project-code and make other changes in order to prevent
** the repository from ever again pushing or pulling to other
** repositories. Used to create a "test" repository for development
** testing by cloning a working project repository.
*/
void test_detach_cmd(void){
db_find_and_open_repository(1);
db_begin_transaction();
db_multi_exec(
"DELETE FROM config WHERE name='last-sync-url';"
"UPDATE config SET value=lower(hex(randomblob(20)))"
" WHERE name='project-code';"
"UPDATE config SET value='detached-' || value"
" WHERE name='project-name' AND value NOT GLOB 'detached-*';"
);
db_end_transaction(0);
}
|
Changes to src/shun.c.
| ︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
int nUuid;
char zCanonical[UUID_SIZE+1];
login_check_credentials();
if( !g.okAdmin ){
login_needed();
}
if( zUuid ){
nUuid = strlen(zUuid);
if( nUuid!=40 || !validate16(zUuid, nUuid) ){
zUuid = 0;
}else{
memcpy(zCanonical, zUuid, UUID_SIZE+1);
canonical16(zCanonical, UUID_SIZE);
| > > > > > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
int nUuid;
char zCanonical[UUID_SIZE+1];
login_check_credentials();
if( !g.okAdmin ){
login_needed();
}
if( P("rebuild") ){
db_begin_transaction();
rebuild_db(0,0);
db_end_transaction(0);
}
if( zUuid ){
nUuid = strlen(zUuid);
if( nUuid!=40 || !validate16(zUuid, nUuid) ){
zUuid = 0;
}else{
memcpy(zCanonical, zUuid, UUID_SIZE+1);
canonical16(zCanonical, UUID_SIZE);
|
| ︙ | ︙ | |||
143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
@ <blockquote>
@ <form method="POST" action="%s(g.zBaseURL)/%s(g.zPath)">
login_insert_csrf_secret();
@ <input type="text" name="uuid" size="50">
@ <input type="submit" name="sub" value="Accept">
@ </form>
@ </blockquote>
style_footer();
}
/*
** Remove from the BLOB table all artifacts that are in the SHUN table.
*/
void shun_artifacts(void){
| > > > > > > > > > > > | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
@ <blockquote>
@ <form method="POST" action="%s(g.zBaseURL)/%s(g.zPath)">
login_insert_csrf_secret();
@ <input type="text" name="uuid" size="50">
@ <input type="submit" name="sub" value="Accept">
@ </form>
@ </blockquote>
@
@ <p>Press the button below to rebuild the respository. The rebuild
@ may take several seconds, so be patient after pressing the button.</p>
@
@ <blockquote>
@ <form method="POST" action="%s(g.zBaseURL)/%s(g.zPath)">
login_insert_csrf_secret();
@ <input type="submit" name="rebuild" value="Rebuild">
@ </form>
@ </blockquote>
@
style_footer();
}
/*
** Remove from the BLOB table all artifacts that are in the SHUN table.
*/
void shun_artifacts(void){
|
| ︙ | ︙ |
Changes to src/sqlite3.c.
1 2 3 4 5 6 7 8 9 10 11 12 13 | /****************************************************************************** ** This file is an amalgamation of many separate C source files from SQLite ** version 3.6.4. 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 in the first | | | | 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.4. 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 in the first ** 6569 lines past this header comment.) 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 2008-11-10 00:14:36 UTC. */ #define SQLITE_CORE 1 #define SQLITE_AMALGAMATION 1 #ifndef SQLITE_PRIVATE # define SQLITE_PRIVATE static #endif #ifndef SQLITE_API |
| ︙ | ︙ | |||
37 38 39 40 41 42 43 | ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** Internal interface definitions for SQLite. ** ** @(#) $Id: sqliteInt.h,v 1.788 2008/11/05 16:37:35 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* ** Include the configuration header output by 'configure' if we're using the ** autoconf-based build |
| ︙ | ︙ | |||
483 484 485 486 487 488 489 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** | | | 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** ** @(#) $Id: sqlite.h.in,v 1.409 2008/11/07 00:06:18 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include <stdarg.h> /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. |
| ︙ | ︙ | |||
1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 |
** are aligned to an address which is an integer multiple of
** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
int iVersion;
int (*xClose)(sqlite3_file*);
int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
| > > > > > > | 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 |
** are aligned to an address which is an integer multiple of
** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
**
** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
** in the unread portions of the buffer with zeros. A VFS that
** fails to zero-fill short reads might seem to work. However,
** failure to zero-fill short reads will eventually lead to
** database corruption.
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
int iVersion;
int (*xClose)(sqlite3_file*);
int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
|
| ︙ | ︙ | |||
3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 | ** ** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. ** ** INVARIANTS: ** | > > > > > > > > > > | 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 | ** ** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions. ** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. ** When that happens, the second error will be reported since these ** interfaces always report the most recent result. To avoid ** this, each thread can obtain exclusive use of the [database connection] D ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. ** ** INVARIANTS: ** |
| ︙ | ︙ | |||
6712 6713 6714 6715 6716 6717 6718 6719 6720 6721 6722 6723 6724 6725 |
#define SQLITE_MUTEX_STATIC_MASTER 2
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2 4 /* sqlite3_release_memory() */
#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
/*
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
**
** {H11301} The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. {H11302} The
** name of the database is the name assigned to the database by the
| > > > > > > > > > > > | 6728 6729 6730 6731 6732 6733 6734 6735 6736 6737 6738 6739 6740 6741 6742 6743 6744 6745 6746 6747 6748 6749 6750 6751 6752 |
#define SQLITE_MUTEX_STATIC_MASTER 2
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2 4 /* sqlite3_release_memory() */
#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
/*
** CAPI3REF: Retrieve the mutex for a database connection {H17002} <H17000>
**
** This interface returns a pointer the [sqlite3_mutex] object that
** serializes access to the [database connection] given in the argument
** when the [threading mode] is Serialized.
** If the [threading mode] is Single-thread or Multi-thread then this
** routine returns a NULL pointer.
*/
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
/*
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
**
** {H11301} The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. {H11302} The
** name of the database is the name assigned to the database by the
|
| ︙ | ︙ | |||
7907 7908 7909 7910 7911 7912 7913 | ** 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 */ | < | | | < | | | | > | | < | | < | > | > | | | | | | | | < | | | | > | | | | > > < < | < < < < | > | | > | | | | | < < | < < | < | < | > > > | > | | > | > | | < < | | | | | < | | | | < | | | | | | | | | | | | | | | | | | | | | > > > > > > > > < < | | | | > | | | < | | | | | | | | | | < | > > | > > | < | | < | | | | | | 7934 7935 7936 7937 7938 7939 7940 7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 7951 7952 7953 7954 7955 7956 7957 7958 7959 7960 7961 7962 7963 7964 7965 7966 7967 7968 7969 7970 7971 7972 7973 7974 7975 7976 7977 7978 7979 7980 7981 7982 7983 7984 7985 7986 7987 7988 7989 7990 7991 7992 7993 7994 7995 7996 7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 8007 8008 8009 8010 8011 8012 8013 8014 8015 8016 8017 8018 8019 8020 8021 8022 8023 8024 8025 8026 8027 8028 8029 8030 8031 8032 8033 8034 8035 8036 8037 8038 8039 8040 8041 8042 8043 8044 8045 8046 8047 8048 8049 8050 8051 8052 8053 8054 8055 8056 8057 8058 8059 8060 8061 8062 8063 8064 8065 8066 8067 8068 8069 8070 8071 8072 8073 8074 8075 8076 8077 8078 8079 8080 8081 8082 | ** 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_VNext 1 #define OP_Affinity 2 #define OP_Column 3 #define OP_SetCookie 4 #define OP_Real 126 /* same as TK_FLOAT */ #define OP_Sequence 5 #define OP_MoveGt 6 #define OP_Ge 72 /* same as TK_GE */ #define OP_RowKey 7 #define OP_SCopy 8 #define OP_Eq 68 /* same as TK_EQ */ #define OP_OpenWrite 9 #define OP_NotNull 66 /* same as TK_NOTNULL */ #define OP_If 10 #define OP_ToInt 142 /* same as TK_TO_INT */ #define OP_String8 88 /* same as TK_STRING */ #define OP_VRowid 11 #define OP_CollSeq 12 #define OP_OpenRead 13 #define OP_Expire 14 #define OP_AutoCommit 15 #define OP_Gt 69 /* same as TK_GT */ #define OP_Pagecount 17 #define OP_IntegrityCk 18 #define OP_Sort 19 #define OP_Copy 20 #define OP_Trace 21 #define OP_Function 22 #define OP_IfNeg 23 #define OP_And 61 /* same as TK_AND */ #define OP_Subtract 79 /* same as TK_MINUS */ #define OP_Noop 24 #define OP_Return 25 #define OP_Remainder 82 /* same as TK_REM */ #define OP_NewRowid 26 #define OP_Multiply 80 /* same as TK_STAR */ #define OP_Variable 27 #define OP_String 28 #define OP_RealAffinity 29 #define OP_VRename 30 #define OP_ParseSchema 31 #define OP_VOpen 32 #define OP_Close 33 #define OP_CreateIndex 34 #define OP_IsUnique 35 #define OP_NotFound 36 #define OP_Int64 37 #define OP_MustBeInt 38 #define OP_Halt 39 #define OP_Rowid 40 #define OP_IdxLT 41 #define OP_AddImm 42 #define OP_Statement 43 #define OP_RowData 44 #define OP_MemMax 45 #define OP_Or 60 /* same as TK_OR */ #define OP_NotExists 46 #define OP_Gosub 47 #define OP_Divide 81 /* same as TK_SLASH */ #define OP_Integer 48 #define OP_ToNumeric 141 /* same as TK_TO_NUMERIC*/ #define OP_Prev 49 #define OP_Concat 83 /* same as TK_CONCAT */ #define OP_BitAnd 74 /* same as TK_BITAND */ #define OP_VColumn 50 #define OP_CreateTable 51 #define OP_Last 52 #define OP_IsNull 65 /* same as TK_ISNULL */ #define OP_IncrVacuum 53 #define OP_IdxRowid 54 #define OP_ShiftRight 77 /* same as TK_RSHIFT */ #define OP_ResetCount 55 #define OP_FifoWrite 56 #define OP_ContextPush 57 #define OP_Yield 58 #define OP_DropTrigger 59 #define OP_DropIndex 62 #define OP_IdxGE 63 #define OP_IdxDelete 64 #define OP_Vacuum 73 #define OP_MoveLe 84 #define OP_IfNot 85 #define OP_DropTable 86 #define OP_MakeRecord 89 #define OP_ToBlob 140 /* same as TK_TO_BLOB */ #define OP_ResultRow 90 #define OP_Delete 91 #define OP_AggFinal 92 #define OP_Compare 93 #define OP_ShiftLeft 76 /* same as TK_LSHIFT */ #define OP_Goto 94 #define OP_TableLock 95 #define OP_FifoRead 96 #define OP_Clear 97 #define OP_MoveLt 98 #define OP_Le 70 /* same as TK_LE */ #define OP_VerifyCookie 99 #define OP_AggStep 100 #define OP_ToText 139 /* same as TK_TO_TEXT */ #define OP_Not 16 /* same as TK_NOT */ #define OP_ToReal 143 /* same as TK_TO_REAL */ #define OP_SetNumColumns 101 #define OP_Transaction 102 #define OP_VFilter 103 #define OP_Ne 67 /* same as TK_NE */ #define OP_VDestroy 104 #define OP_ContextPop 105 #define OP_BitOr 75 /* same as TK_BITOR */ #define OP_Next 106 #define OP_IdxInsert 107 #define OP_Lt 71 /* same as TK_LT */ #define OP_Insert 108 #define OP_Destroy 109 #define OP_ReadCookie 110 #define OP_ForceInt 111 #define OP_LoadAnalysis 112 #define OP_Explain 113 #define OP_OpenPseudo 114 #define OP_OpenEphemeral 115 #define OP_Null 116 #define OP_Move 117 #define OP_Blob 118 #define OP_Add 78 /* same as TK_PLUS */ #define OP_Rewind 119 #define OP_MoveGe 120 #define OP_VBegin 121 #define OP_VUpdate 122 #define OP_IfZero 123 #define OP_BitNot 87 /* same as TK_BITNOT */ #define OP_VCreate 124 #define OP_Found 125 #define OP_IfPos 127 #define OP_NullRow 128 #define OP_Jump 129 #define OP_Permutation 130 /* The following opcode values are never used */ #define OP_NotUsed_131 131 #define OP_NotUsed_132 132 #define OP_NotUsed_133 133 #define OP_NotUsed_134 134 #define OP_NotUsed_135 135 |
| ︙ | ︙ | |||
8065 8066 8067 8068 8069 8070 8071 |
#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 {\
| | | | | | | | | | | | | | | | | 8092 8093 8094 8095 8096 8097 8098 8099 8100 8101 8102 8103 8104 8105 8106 8107 8108 8109 8110 8111 8112 8113 8114 8115 8116 8117 8118 8119 8120 8121 8122 |
#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, 0x01, 0x00, 0x00, 0x10, 0x02, 0x11, 0x00,\
/* 8 */ 0x00, 0x00, 0x05, 0x02, 0x00, 0x00, 0x00, 0x00,\
/* 16 */ 0x04, 0x02, 0x00, 0x01, 0x00, 0x00, 0x00, 0x05,\
/* 24 */ 0x00, 0x04, 0x02, 0x02, 0x02, 0x04, 0x00, 0x00,\
/* 32 */ 0x00, 0x00, 0x02, 0x11, 0x11, 0x02, 0x05, 0x00,\
/* 40 */ 0x02, 0x11, 0x04, 0x00, 0x00, 0x0c, 0x11, 0x01,\
/* 48 */ 0x02, 0x01, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00,\
/* 56 */ 0x04, 0x00, 0x00, 0x00, 0x2c, 0x2c, 0x00, 0x11,\
/* 64 */ 0x00, 0x05, 0x05, 0x15, 0x15, 0x15, 0x15, 0x15,\
/* 72 */ 0x15, 0x00, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c, 0x2c,\
/* 80 */ 0x2c, 0x2c, 0x2c, 0x2c, 0x11, 0x05, 0x00, 0x04,\
/* 88 */ 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,\
/* 96 */ 0x01, 0x00, 0x11, 0x00, 0x00, 0x00, 0x00, 0x01,\
/* 104 */ 0x00, 0x00, 0x01, 0x08, 0x00, 0x02, 0x02, 0x05,\
/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, 0x01,\
/* 120 */ 0x11, 0x00, 0x00, 0x05, 0x00, 0x11, 0x02, 0x05,\
/* 128 */ 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
/* 136 */ 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04,\
}
/************** End of opcodes.h *********************************************/
/************** Continuing where we left off in vdbe.h ***********************/
/*
|
| ︙ | ︙ | |||
9002 9003 9004 9005 9006 9007 9008 9009 9010 9011 9012 9013 9014 9015 |
int newTnum; /* Rootpage of table being initialized */
u8 busy; /* TRUE if currently initializing */
} init;
int nExtension; /* Number of loaded extensions */
void **aExtension; /* Array of shared libraray handles */
struct Vdbe *pVdbe; /* List of active virtual machines */
int activeVdbeCnt; /* Number of vdbes currently executing */
void (*xTrace)(void*,const char*); /* Trace function */
void *pTraceArg; /* Argument to the trace function */
void (*xProfile)(void*,const char*,u64); /* Profiling function */
void *pProfileArg; /* Argument to profile function */
void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*); /* Invoked at every commit. */
void *pRollbackArg; /* Argument to xRollbackCallback() */
| > | 9029 9030 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 |
int newTnum; /* Rootpage of table being initialized */
u8 busy; /* TRUE if currently initializing */
} init;
int nExtension; /* Number of loaded extensions */
void **aExtension; /* Array of shared libraray handles */
struct Vdbe *pVdbe; /* List of active virtual machines */
int activeVdbeCnt; /* Number of vdbes currently executing */
int writeVdbeCnt; /* Number of active VDBEs that are writing */
void (*xTrace)(void*,const char*); /* Trace function */
void *pTraceArg; /* Argument to the trace function */
void (*xProfile)(void*,const char*,u64); /* Profiling function */
void *pProfileArg; /* Argument to profile function */
void *pCommitArg; /* Argument to xCommitCallback() */
int (*xCommitCallback)(void*); /* Invoked at every commit. */
void *pRollbackArg; /* Argument to xRollbackCallback() */
|
| ︙ | ︙ | |||
17399 17400 17401 17402 17403 17404 17405 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used to translate between UTF-8, ** UTF-16, UTF-16BE, and UTF-16LE. ** | | | 17427 17428 17429 17430 17431 17432 17433 17434 17435 17436 17437 17438 17439 17440 17441 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used to translate between UTF-8, ** UTF-16, UTF-16BE, and UTF-16LE. ** ** $Id: utf.c,v 1.66 2008/11/07 03:29:34 drh Exp $ ** ** Notes on UTF-8: ** ** Byte-0 Byte-1 Byte-2 Byte-3 Value ** 0xxxxxxx 00000000 00000000 0xxxxxxx ** 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx ** 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx |
| ︙ | ︙ | |||
17441 17442 17443 17444 17445 17446 17447 | ************************************************************************* ** This is the header file for information that is private to the ** VDBE. This information used to all be at the top of the single ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. ** | | | 17469 17470 17471 17472 17473 17474 17475 17476 17477 17478 17479 17480 17481 17482 17483 | ************************************************************************* ** This is the header file for information that is private to the ** VDBE. This information used to all be at the top of the single ** source code file "vdbe.c". When that file became too big (over ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. ** ** $Id: vdbeInt.h,v 1.157 2008/11/05 16:37:35 drh Exp $ */ #ifndef _VDBEINT_H_ #define _VDBEINT_H_ /* ** intToKey() and keyToInt() used to transform the rowid. But with ** the latest versions of the design they are no-ops. |
| ︙ | ︙ | |||
17476 17477 17478 17479 17480 17481 17482 | ** loop over all entries of the Btree. You can also insert new BTree ** entries or retrieve the key or data from the entry that the cursor ** is currently pointing to. ** ** Every cursor that the virtual machine has open is represented by an ** instance of the following structure. ** | | | | | | 17504 17505 17506 17507 17508 17509 17510 17511 17512 17513 17514 17515 17516 17517 17518 17519 17520 17521 17522 17523 |
** loop over all entries of the Btree. You can also insert new BTree
** entries or retrieve the key or data from the entry that the cursor
** is currently pointing to.
**
** Every cursor that the virtual machine has open is represented by an
** instance of the following structure.
**
** If the VdbeCursor.isTriggerRow flag is set it means that this cursor is
** really a single row that represents the NEW or OLD pseudo-table of
** a row trigger. The data for the row is stored in VdbeCursor.pData and
** the rowid is in VdbeCursor.iKey.
*/
struct VdbeCursor {
BtCursor *pCursor; /* The cursor structure of the backend */
int iDb; /* Index of cursor database in db->aDb[] (or -1) */
i64 lastRowid; /* Last rowid from a Next or NextIdx operation */
i64 nextRowid; /* Next rowid returned by OP_NewRowid */
Bool zeroed; /* True if zeroed out and ready for reuse */
Bool rowidIsValid; /* True if lastRowid is valid */
Bool atFirst; /* True if pointing to first entry */
|
| ︙ | ︙ | |||
17519 17520 17521 17522 17523 17524 17525 | */ int cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */ int payloadSize; /* Total number of bytes in the record */ u32 *aType; /* Type values for all entries in the record */ u32 *aOffset; /* Cached offsets to the start of each columns data */ u8 *aRow; /* Data for the current row, if all on one page */ }; | | | | 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 17560 17561 17562 17563 17564 | */ int cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */ int payloadSize; /* Total number of bytes in the record */ u32 *aType; /* Type values for all entries in the record */ u32 *aOffset; /* Cached offsets to the start of each columns data */ u8 *aRow; /* Data for the current row, if all on one page */ }; typedef struct VdbeCursor VdbeCursor; /* ** A value for VdbeCursor.cacheValid that means the cache is always invalid. */ #define CACHE_STALE 0 /* ** Internally, the vdbe manipulates nearly all SQL values as Mem ** structures. Each Mem struct may cache multiple representations (string, ** integer etc.) of the same value. A value (and therefore Mem structure) |
| ︙ | ︙ | |||
17717 17718 17719 17720 17721 17722 17723 | Op *aOp; /* Space to hold the virtual machine's program */ int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ Mem **apArg; /* Arguments to currently executing user function */ Mem *aColName; /* Column names to return */ int nCursor; /* Number of slots in apCsr[] */ | | | > > | 17745 17746 17747 17748 17749 17750 17751 17752 17753 17754 17755 17756 17757 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 17781 17782 17783 17784 17785 17786 17787 17788 | Op *aOp; /* Space to hold the virtual machine's program */ int nLabel; /* Number of labels used */ int nLabelAlloc; /* Number of slots allocated in aLabel[] */ int *aLabel; /* Space to hold the labels */ Mem **apArg; /* Arguments to currently executing user function */ Mem *aColName; /* Column names to return */ int nCursor; /* Number of slots in apCsr[] */ VdbeCursor **apCsr; /* One element of this array for each open cursor */ int nVar; /* Number of entries in aVar[] */ Mem *aVar; /* Values for the OP_Variable opcode. */ char **azVar; /* Name of variables */ int okVar; /* True if azVar[] has been initialized */ int magic; /* Magic number for sanity checking */ int nMem; /* Number of memory locations currently allocated */ Mem *aMem; /* The memory locations */ int nCallback; /* Number of callbacks invoked so far */ int cacheCtr; /* VdbeCursor row cache generation counter */ Fifo sFifo; /* A list of ROWIDs */ int contextStackTop; /* Index of top element in the context stack */ int contextStackDepth; /* The size of the "context" stack */ Context *contextStack; /* Stack used by opcodes ContextPush & ContextPop*/ int pc; /* The program counter */ int rc; /* Value to return */ unsigned uniqueCnt; /* Used by OP_MakeRecord when P2!=0 */ int errorAction; /* Recovery action to do in case of an error */ int inTempTrans; /* True if temp database is transactioned */ int nResColumn; /* Number of columns in one row of the result set */ char **azResColumn; /* Values for one row of result */ char *zErrMsg; /* Error message written here */ Mem *pResultSet; /* Pointer to an array of results */ u8 explain; /* True if EXPLAIN present on SQL command */ u8 changeCntOn; /* True to update the change-counter */ u8 expired; /* True if the VM needs to be recompiled */ u8 minWriteFileFormat; /* Minimum file format for writable database files */ u8 inVtabMethod; /* See comments above */ u8 usesStmtJournal; /* True if uses a statement journal */ u8 readOnly; /* True for read-only statements */ int nChange; /* Number of db changes made since last reset */ i64 startTime; /* Time when query started - used for profiling */ int btreeMask; /* Bitmask of db->aDb[] entries referenced */ BtreeMutexArray aMutex; /* An array of Btree used here and needing locks */ int aCounter[2]; /* Counters used by sqlite3_stmt_status() */ int nSql; /* Number of bytes in zSql */ char *zSql; /* Text of the SQL statement that generated this */ |
| ︙ | ︙ | |||
17777 17778 17779 17780 17781 17782 17783 | #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ #define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */ #define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */ /* ** Function prototypes */ | | | | | 17807 17808 17809 17810 17811 17812 17813 17814 17815 17816 17817 17818 17819 17820 17821 17822 17823 17824 17825 17826 17827 17828 17829 17830 17831 17832 17833 17834 | #define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ #define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */ #define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */ /* ** Function prototypes */ SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); void sqliteVdbePopStack(Vdbe*,int); SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor*); #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, Op*); #endif SQLITE_PRIVATE int sqlite3VdbeSerialTypeLen(u32); SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int); SQLITE_PRIVATE int sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int); SQLITE_PRIVATE int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(VdbeFunc*, int); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); SQLITE_PRIVATE int sqlite3VdbeIdxRowid(BtCursor *, i64 *); SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int); SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*); |
| ︙ | ︙ | |||
18038 18039 18040 18041 18042 18043 18044 |
int rc;
rc = sqlite3VdbeMemMakeWriteable(pMem);
if( rc!=SQLITE_OK ){
assert( rc==SQLITE_NOMEM );
return SQLITE_NOMEM;
}
zIn = (u8*)pMem->z;
| | > | 18068 18069 18070 18071 18072 18073 18074 18075 18076 18077 18078 18079 18080 18081 18082 18083 18084 18085 18086 18087 18088 18089 18090 18091 18092 18093 18094 18095 18096 18097 18098 18099 18100 |
int rc;
rc = sqlite3VdbeMemMakeWriteable(pMem);
if( rc!=SQLITE_OK ){
assert( rc==SQLITE_NOMEM );
return SQLITE_NOMEM;
}
zIn = (u8*)pMem->z;
zTerm = &zIn[pMem->n&~1];
while( zIn<zTerm ){
temp = *zIn;
*zIn = *(zIn+1);
zIn++;
*zIn++ = temp;
}
pMem->enc = desiredEnc;
goto translate_out;
}
/* Set len to the maximum number of bytes required in the output buffer. */
if( desiredEnc==SQLITE_UTF8 ){
/* When converting from UTF-16, the maximum growth results from
** translating a 2-byte character to a 4-byte UTF-8 character.
** A single byte is required for the output string
** nul-terminator.
*/
pMem->n &= ~1;
len = pMem->n * 2 + 1;
}else{
/* When converting from UTF-8 to UTF-16 the maximum growth is caused
** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16
** character. Two bytes are required in the output buffer for the
** nul-terminator.
*/
|
| ︙ | ︙ | |||
19604 19605 19606 19607 19608 19609 19610 |
/************** 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[] = { "?",
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 19635 19636 19637 19638 19639 19640 19641 19642 19643 19644 19645 19646 19647 19648 19649 19650 19651 19652 19653 19654 19655 19656 19657 19658 19659 19660 19661 19662 19663 19664 19665 19666 19667 19668 19669 19670 19671 19672 19673 19674 19675 19676 19677 19678 19679 19680 19681 19682 19683 19684 19685 19686 19687 19688 19689 19690 19691 19692 19693 19694 19695 19696 19697 19698 19699 19700 19701 19702 19703 19704 19705 19706 19707 19708 19709 19710 19711 19712 19713 19714 19715 19716 19717 19718 19719 19720 19721 19722 19723 19724 19725 19726 19727 19728 19729 19730 19731 19732 19733 19734 19735 19736 19737 19738 19739 19740 19741 19742 19743 19744 19745 19746 19747 19748 19749 19750 19751 19752 19753 19754 19755 19756 19757 19758 19759 19760 19761 19762 19763 19764 19765 19766 19767 19768 19769 19770 19771 19772 19773 19774 19775 19776 19777 19778 |
/************** 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 */ "VNext",
/* 2 */ "Affinity",
/* 3 */ "Column",
/* 4 */ "SetCookie",
/* 5 */ "Sequence",
/* 6 */ "MoveGt",
/* 7 */ "RowKey",
/* 8 */ "SCopy",
/* 9 */ "OpenWrite",
/* 10 */ "If",
/* 11 */ "VRowid",
/* 12 */ "CollSeq",
/* 13 */ "OpenRead",
/* 14 */ "Expire",
/* 15 */ "AutoCommit",
/* 16 */ "Not",
/* 17 */ "Pagecount",
/* 18 */ "IntegrityCk",
/* 19 */ "Sort",
/* 20 */ "Copy",
/* 21 */ "Trace",
/* 22 */ "Function",
/* 23 */ "IfNeg",
/* 24 */ "Noop",
/* 25 */ "Return",
/* 26 */ "NewRowid",
/* 27 */ "Variable",
/* 28 */ "String",
/* 29 */ "RealAffinity",
/* 30 */ "VRename",
/* 31 */ "ParseSchema",
/* 32 */ "VOpen",
/* 33 */ "Close",
/* 34 */ "CreateIndex",
/* 35 */ "IsUnique",
/* 36 */ "NotFound",
/* 37 */ "Int64",
/* 38 */ "MustBeInt",
/* 39 */ "Halt",
/* 40 */ "Rowid",
/* 41 */ "IdxLT",
/* 42 */ "AddImm",
/* 43 */ "Statement",
/* 44 */ "RowData",
/* 45 */ "MemMax",
/* 46 */ "NotExists",
/* 47 */ "Gosub",
/* 48 */ "Integer",
/* 49 */ "Prev",
/* 50 */ "VColumn",
/* 51 */ "CreateTable",
/* 52 */ "Last",
/* 53 */ "IncrVacuum",
/* 54 */ "IdxRowid",
/* 55 */ "ResetCount",
/* 56 */ "FifoWrite",
/* 57 */ "ContextPush",
/* 58 */ "Yield",
/* 59 */ "DropTrigger",
/* 60 */ "Or",
/* 61 */ "And",
/* 62 */ "DropIndex",
/* 63 */ "IdxGE",
/* 64 */ "IdxDelete",
/* 65 */ "IsNull",
/* 66 */ "NotNull",
/* 67 */ "Ne",
/* 68 */ "Eq",
/* 69 */ "Gt",
/* 70 */ "Le",
/* 71 */ "Lt",
/* 72 */ "Ge",
/* 73 */ "Vacuum",
/* 74 */ "BitAnd",
/* 75 */ "BitOr",
/* 76 */ "ShiftLeft",
/* 77 */ "ShiftRight",
/* 78 */ "Add",
/* 79 */ "Subtract",
/* 80 */ "Multiply",
/* 81 */ "Divide",
/* 82 */ "Remainder",
/* 83 */ "Concat",
/* 84 */ "MoveLe",
/* 85 */ "IfNot",
/* 86 */ "DropTable",
/* 87 */ "BitNot",
/* 88 */ "String8",
/* 89 */ "MakeRecord",
/* 90 */ "ResultRow",
/* 91 */ "Delete",
/* 92 */ "AggFinal",
/* 93 */ "Compare",
/* 94 */ "Goto",
/* 95 */ "TableLock",
/* 96 */ "FifoRead",
/* 97 */ "Clear",
/* 98 */ "MoveLt",
/* 99 */ "VerifyCookie",
/* 100 */ "AggStep",
/* 101 */ "SetNumColumns",
/* 102 */ "Transaction",
/* 103 */ "VFilter",
/* 104 */ "VDestroy",
/* 105 */ "ContextPop",
/* 106 */ "Next",
/* 107 */ "IdxInsert",
/* 108 */ "Insert",
/* 109 */ "Destroy",
/* 110 */ "ReadCookie",
/* 111 */ "ForceInt",
/* 112 */ "LoadAnalysis",
/* 113 */ "Explain",
/* 114 */ "OpenPseudo",
/* 115 */ "OpenEphemeral",
/* 116 */ "Null",
/* 117 */ "Move",
/* 118 */ "Blob",
/* 119 */ "Rewind",
/* 120 */ "MoveGe",
/* 121 */ "VBegin",
/* 122 */ "VUpdate",
/* 123 */ "IfZero",
/* 124 */ "VCreate",
/* 125 */ "Found",
/* 126 */ "Real",
/* 127 */ "IfPos",
/* 128 */ "NullRow",
/* 129 */ "Jump",
/* 130 */ "Permutation",
/* 131 */ "NotUsed_131",
/* 132 */ "NotUsed_132",
/* 133 */ "NotUsed_133",
/* 134 */ "NotUsed_134",
/* 135 */ "NotUsed_135",
/* 136 */ "NotUsed_136",
/* 137 */ "NotUsed_137",
|
| ︙ | ︙ | |||
19768 19769 19770 19771 19772 19773 19774 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to OS/2. ** | | | 19799 19800 19801 19802 19803 19804 19805 19806 19807 19808 19809 19810 19811 19812 19813 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to OS/2. ** ** $Id: os_os2.c,v 1.58 2008/11/07 00:06:18 drh Exp $ */ #if SQLITE_OS_OS2 /* ** A Note About Memory Allocation: |
| ︙ | ︙ | |||
20111 20112 20113 20114 20115 20116 20117 20118 20119 20120 20121 20122 20123 20124 |
}
if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){
return SQLITE_IOERR_READ;
}
if( got == (ULONG)amt )
return SQLITE_OK;
else {
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Write data from a buffer into a file. Return SQLITE_OK on success
| > | 20142 20143 20144 20145 20146 20147 20148 20149 20150 20151 20152 20153 20154 20155 20156 |
}
if( DosRead( pFile->h, pBuf, amt, &got ) != NO_ERROR ){
return SQLITE_IOERR_READ;
}
if( got == (ULONG)amt )
return SQLITE_OK;
else {
/* Unread portions of the input buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Write data from a buffer into a file. Return SQLITE_OK on success
|
| ︙ | ︙ | |||
21115 21116 21117 21118 21119 21120 21121 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to Unix systems. ** | | | 21147 21148 21149 21150 21151 21152 21153 21154 21155 21156 21157 21158 21159 21160 21161 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to Unix systems. ** ** $Id: os_unix.c,v 1.208 2008/11/07 00:06:18 drh Exp $ */ #if SQLITE_OS_UNIX /* This file is used on unix only */ /* ** If SQLITE_ENABLE_LOCKING_STYLE is defined and is non-zero, then several ** alternative locking implementations are provided: ** |
| ︙ | ︙ | |||
22229 22230 22231 22232 22233 22234 22235 22236 22237 22238 22239 22240 22241 22242 |
assert( id );
got = seekAndRead((unixFile*)id, offset, pBuf, amt);
if( got==amt ){
return SQLITE_OK;
}else if( got<0 ){
return SQLITE_IOERR_READ;
}else{
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
| > | 22261 22262 22263 22264 22265 22266 22267 22268 22269 22270 22271 22272 22273 22274 22275 |
assert( id );
got = seekAndRead((unixFile*)id, offset, pBuf, amt);
if( got==amt ){
return SQLITE_OK;
}else if( got<0 ){
return SQLITE_IOERR_READ;
}else{
/* Unread parts of the buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Seek to the offset in id->offset then read cnt bytes into pBuf.
|
| ︙ | ︙ | |||
24338 24339 24340 24341 24342 24343 24344 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to windows. ** | | | 24371 24372 24373 24374 24375 24376 24377 24378 24379 24380 24381 24382 24383 24384 24385 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains code that is specific to windows. ** ** $Id: os_win.c,v 1.137 2008/11/07 00:06:18 drh Exp $ */ #if SQLITE_OS_WIN /* This file is used for windows only */ /* ** A Note About Memory Allocation: ** |
| ︙ | ︙ | |||
25222 25223 25224 25225 25226 25227 25228 25229 25230 25231 25232 25233 25234 25235 |
}
if( !ReadFile(pFile->h, pBuf, amt, &got, 0) ){
return SQLITE_IOERR_READ;
}
if( got==(DWORD)amt ){
return SQLITE_OK;
}else{
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Write data from a buffer into a file. Return SQLITE_OK on success
| > | 25255 25256 25257 25258 25259 25260 25261 25262 25263 25264 25265 25266 25267 25268 25269 |
}
if( !ReadFile(pFile->h, pBuf, amt, &got, 0) ){
return SQLITE_IOERR_READ;
}
if( got==(DWORD)amt ){
return SQLITE_OK;
}else{
/* Unread parts of the buffer must be zero-filled */
memset(&((char*)pBuf)[got], 0, amt-got);
return SQLITE_IOERR_SHORT_READ;
}
}
/*
** Write data from a buffer into a file. Return SQLITE_OK on success
|
| ︙ | ︙ | |||
26258 26259 26260 26261 26262 26263 26264 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file implements an object that represents a fixed-length ** bitmap. Bits are numbered starting with 1. ** | | | > | | > | | | 26292 26293 26294 26295 26296 26297 26298 26299 26300 26301 26302 26303 26304 26305 26306 26307 26308 26309 26310 26311 26312 26313 26314 26315 26316 26317 26318 26319 26320 26321 26322 26323 26324 26325 26326 26327 26328 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file implements an object that represents a fixed-length ** bitmap. Bits are numbered starting with 1. ** ** A bitmap is used to record which pages of a database file have been ** journalled during a transaction, or which pages have the "dont-write" ** property. Usually only a few pages are meet either condition. ** So the bitmap is usually sparse and has low cardinality. ** But sometimes (for example when during a DROP of a large table) most ** or all of the pages in a database can get journalled. In those cases, ** the bitmap becomes dense with high cardinality. The algorithm needs ** to handle both cases well. ** ** The size of the bitmap is fixed when the object is created. ** ** All bits are clear when the bitmap is created. Individual bits ** may be set or cleared one at a time. ** ** Test operations are about 100 times more common that set operations. ** Clear operations are exceedingly rare. There are usually between ** 5 and 500 set operations per Bitvec object, though the number of sets can ** sometimes grow into tens of thousands or larger. The size of the ** Bitvec object is the number of pages in the database file at the ** start of a transaction, and is thus usually less than a few thousand, ** but can be as large as 2 billion for a really big database. ** ** @(#) $Id: bitvec.c,v 1.7 2008/11/03 20:55:07 drh Exp $ */ #define BITVEC_SZ 512 /* Round the union size down to the nearest pointer boundary, since that's how ** it will be aligned within the Bitvec struct. */ #define BITVEC_USIZE (((BITVEC_SZ-12)/sizeof(Bitvec*))*sizeof(Bitvec*)) #define BITVEC_NCHAR BITVEC_USIZE |
| ︙ | ︙ | |||
26370 26371 26372 26373 26374 26375 26376 26377 26378 26379 26380 26381 26382 26383 |
return 0;
}
}
/*
** Set the i-th bit. Return 0 on success and an error code if
** anything goes wrong.
*/
SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){
u32 h;
assert( p!=0 );
assert( i>0 );
assert( i<=p->iSize );
if( p->iSize<=BITVEC_NBIT ){
| > > > > > > > > | 26406 26407 26408 26409 26410 26411 26412 26413 26414 26415 26416 26417 26418 26419 26420 26421 26422 26423 26424 26425 26426 26427 |
return 0;
}
}
/*
** Set the i-th bit. Return 0 on success and an error code if
** anything goes wrong.
**
** This routine might cause sub-bitmaps to be allocated. Failing
** to get the memory needed to hold the sub-bitmap is the only
** that can go wrong with an insert, assuming p and i are valid.
**
** The calling function must ensure that p is a valid Bitvec object
** and that the value for "i" is within range of the Bitvec object.
** Otherwise the behavior is undefined.
*/
SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){
u32 h;
assert( p!=0 );
assert( i>0 );
assert( i<=p->iSize );
if( p->iSize<=BITVEC_NBIT ){
|
| ︙ | ︙ | |||
27802 27803 27804 27805 27806 27807 27808 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** | | | 27846 27847 27848 27849 27850 27851 27852 27853 27854 27855 27856 27857 27858 27859 27860 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** ** @(#) $Id: pager.c,v 1.502 2008/11/07 00:24:54 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO /* ** Macros for troubleshooting. Normally turned off */ #if 0 |
| ︙ | ︙ | |||
27986 27987 27988 27989 27990 27991 27992 | sqlite3_file *stfd; /* File descriptor for the statement subjournal*/ BusyHandler *pBusyHandler; /* Pointer to sqlite.busyHandler */ i64 journalOff; /* Current byte offset in the journal file */ i64 journalHdr; /* Byte offset to previous journal header */ i64 stmtHdrOff; /* First journal header written this statement */ i64 stmtCksum; /* cksumInit when statement was started */ i64 stmtJSize; /* Size of journal at stmt_begin() */ | | | 28030 28031 28032 28033 28034 28035 28036 28037 28038 28039 28040 28041 28042 28043 28044 | sqlite3_file *stfd; /* File descriptor for the statement subjournal*/ BusyHandler *pBusyHandler; /* Pointer to sqlite.busyHandler */ i64 journalOff; /* Current byte offset in the journal file */ i64 journalHdr; /* Byte offset to previous journal header */ i64 stmtHdrOff; /* First journal header written this statement */ i64 stmtCksum; /* cksumInit when statement was started */ i64 stmtJSize; /* Size of journal at stmt_begin() */ u32 sectorSize; /* Assumed sector size during rollback */ #ifdef SQLITE_TEST int nHit, nMiss; /* Cache hits and missing */ int nRead, nWrite; /* Database pages read/written */ #endif void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */ #ifdef SQLITE_HAS_CODEC void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */ |
| ︙ | ︙ | |||
28539 28540 28541 28542 28543 28544 28545 | /* Update the assumed sector-size to match the value used by ** the process that created this journal. If this journal was ** created by a process other than this one, then this routine ** is being called from within pager_playback(). The local value ** of Pager.sectorSize is restored at the end of that routine. */ | | > > > > | 28583 28584 28585 28586 28587 28588 28589 28590 28591 28592 28593 28594 28595 28596 28597 28598 28599 28600 28601 28602 |
/* Update the assumed sector-size to match the value used by
** the process that created this journal. If this journal was
** created by a process other than this one, then this routine
** is being called from within pager_playback(). The local value
** of Pager.sectorSize is restored at the end of that routine.
*/
rc = read32bits(pPager->jfd, jrnlOff+12, &pPager->sectorSize);
if( rc ) return rc;
if( (pPager->sectorSize & (pPager->sectorSize-1))!=0
|| pPager->sectorSize>0x1000000 ){
return SQLITE_DONE;
}
pPager->journalOff += JOURNAL_HDR_SZ(pPager);
return SQLITE_OK;
}
/*
|
| ︙ | ︙ | |||
31184 31185 31186 31187 31188 31189 31190 | return pPg->flags&PGHDR_DIRTY; } #endif /* ** A call to this routine tells the pager that it is not necessary to ** write the information on page pPg back to the disk, even though | | > > | 31232 31233 31234 31235 31236 31237 31238 31239 31240 31241 31242 31243 31244 31245 31246 31247 31248 | return pPg->flags&PGHDR_DIRTY; } #endif /* ** A call to this routine tells the pager that it is not necessary to ** write the information on page pPg back to the disk, even though ** that page might be marked as dirty. This happens, for example, when ** the page has been added as a leaf of the freelist and so its ** content no longer matters. ** ** The overlying software layer calls this routine when all of the data ** on the given page is unused. The pager marks the page as clean so ** that it does not get written to disk. ** ** Tests show that this optimization, together with the ** sqlite3PagerDontRollback() below, more than double the speed |
| ︙ | ︙ | |||
32976 32977 32978 32979 32980 32981 32982 | ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* | | | 33026 33027 33028 33029 33030 33031 33032 33033 33034 33035 33036 33037 33038 33039 33040 | ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** $Id: btree.c,v 1.527 2008/11/03 20:55:07 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. ** Including a description of file format and an overview of operation. */ /* |
| ︙ | ︙ | |||
33372 33373 33374 33375 33376 33377 33378 |
#define restoreCursorPosition(p) \
(p->eState>=CURSOR_REQUIRESEEK ? \
sqlite3BtreeRestoreCursorPosition(p) : \
SQLITE_OK)
/*
** Determine whether or not a cursor has moved from the position it
| | | 33422 33423 33424 33425 33426 33427 33428 33429 33430 33431 33432 33433 33434 33435 33436 |
#define restoreCursorPosition(p) \
(p->eState>=CURSOR_REQUIRESEEK ? \
sqlite3BtreeRestoreCursorPosition(p) : \
SQLITE_OK)
/*
** Determine whether or not a cursor has moved from the position it
** was last placed at. Cursors can move when the row they are pointing
** at is deleted out from under them.
**
** This routine returns an error code if something goes wrong. The
** integer *pHasMoved is set to one if the cursor has moved and 0 if not.
*/
SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){
int rc;
|
| ︙ | ︙ | |||
40499 40500 40501 40502 40503 40504 40505 | ************************************************************************* ** ** This file contains code use to manipulate "Mem" structure. A "Mem" ** stores a single value in the VDBE. Mem is an opaque structure visible ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value ** | | | 40549 40550 40551 40552 40553 40554 40555 40556 40557 40558 40559 40560 40561 40562 40563 | ************************************************************************* ** ** This file contains code use to manipulate "Mem" structure. A "Mem" ** stores a single value in the VDBE. Mem is an opaque structure visible ** only within the VDBE. Interface routines refer to a Mem using the ** name sqlite_value ** ** $Id: vdbemem.c,v 1.125 2008/11/05 17:41:19 drh Exp $ */ /* ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*) ** P if required. */ #define expandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) |
| ︙ | ︙ | |||
41087 41088 41089 41090 41091 41092 41093 |
if( enc==SQLITE_UTF8 ){
for(nByte=0; nByte<=iLimit && z[nByte]; nByte++){}
}else{
for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
}
flags |= MEM_Term;
}
| < < < > > > > > > | 41137 41138 41139 41140 41141 41142 41143 41144 41145 41146 41147 41148 41149 41150 41151 41152 41153 41154 41155 41156 41157 41158 41159 41160 41161 41162 41163 41164 41165 41166 41167 41168 41169 41170 41171 41172 41173 41174 41175 41176 41177 41178 41179 41180 |
if( enc==SQLITE_UTF8 ){
for(nByte=0; nByte<=iLimit && z[nByte]; nByte++){}
}else{
for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
}
flags |= MEM_Term;
}
/* The following block sets the new values of Mem.z and Mem.xDel. It
** also sets a flag in local variable "flags" to indicate the memory
** management (one of MEM_Dyn or MEM_Static).
*/
if( xDel==SQLITE_TRANSIENT ){
int nAlloc = nByte;
if( flags&MEM_Term ){
nAlloc += (enc==SQLITE_UTF8?1:2);
}
if( nByte>iLimit ){
return SQLITE_TOOBIG;
}
if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){
return SQLITE_NOMEM;
}
memcpy(pMem->z, z, nAlloc);
}else if( xDel==SQLITE_DYNAMIC ){
sqlite3VdbeMemRelease(pMem);
pMem->zMalloc = pMem->z = (char *)z;
pMem->xDel = 0;
}else{
sqlite3VdbeMemRelease(pMem);
pMem->z = (char *)z;
pMem->xDel = xDel;
flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn);
}
if( nByte>iLimit ){
return SQLITE_TOOBIG;
}
pMem->n = nByte;
pMem->flags = flags;
pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT);
#ifndef SQLITE_OMIT_UTF16
|
| ︙ | ︙ | |||
41541 41542 41543 41544 41545 41546 41547 | ** ************************************************************************* ** This file contains code used for creating, destroying, and populating ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** | | | 41594 41595 41596 41597 41598 41599 41600 41601 41602 41603 41604 41605 41606 41607 41608 | ** ************************************************************************* ** This file contains code used for creating, destroying, and populating ** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** ** $Id: vdbeaux.c,v 1.418 2008/11/05 17:41:19 drh Exp $ */ /* ** When debugging the code generator in a symbolic debugger, one can ** set the sqlite3VdbeAddopTrace to 1 and all opcodes will be printed |
| ︙ | ︙ | |||
41791 41792 41793 41794 41795 41796 41797 41798 41799 41800 41801 41802 41803 41804 41805 41806 41807 41808 41809 41810 41811 41812 41813 41814 41815 41816 41817 41818 41819 41820 41821 41822 |
static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
int i;
int nMaxArgs = 0;
Op *pOp;
int *aLabel = p->aLabel;
int doesStatementRollback = 0;
int hasStatementBegin = 0;
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
u8 opcode = pOp->opcode;
if( opcode==OP_Function || opcode==OP_AggStep ){
if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
#ifndef SQLITE_OMIT_VIRTUALTABLE
}else if( opcode==OP_VUpdate ){
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
#endif
}
if( opcode==OP_Halt ){
if( pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort ){
doesStatementRollback = 1;
}
}else if( opcode==OP_Statement ){
hasStatementBegin = 1;
}else if( opcode==OP_Destroy ){
doesStatementRollback = 1;
#ifndef SQLITE_OMIT_VIRTUALTABLE
}else if( opcode==OP_VUpdate || opcode==OP_VRename ){
doesStatementRollback = 1;
}else if( opcode==OP_VFilter ){
int n;
assert( p->nOp - i >= 3 );
assert( pOp[-1].opcode==OP_Integer );
| > > > > > | 41844 41845 41846 41847 41848 41849 41850 41851 41852 41853 41854 41855 41856 41857 41858 41859 41860 41861 41862 41863 41864 41865 41866 41867 41868 41869 41870 41871 41872 41873 41874 41875 41876 41877 41878 41879 41880 |
static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
int i;
int nMaxArgs = 0;
Op *pOp;
int *aLabel = p->aLabel;
int doesStatementRollback = 0;
int hasStatementBegin = 0;
p->readOnly = 1;
p->usesStmtJournal = 0;
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
u8 opcode = pOp->opcode;
if( opcode==OP_Function || opcode==OP_AggStep ){
if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5;
#ifndef SQLITE_OMIT_VIRTUALTABLE
}else if( opcode==OP_VUpdate ){
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
#endif
}
if( opcode==OP_Halt ){
if( pOp->p1==SQLITE_CONSTRAINT && pOp->p2==OE_Abort ){
doesStatementRollback = 1;
}
}else if( opcode==OP_Statement ){
hasStatementBegin = 1;
p->usesStmtJournal = 1;
}else if( opcode==OP_Destroy ){
doesStatementRollback = 1;
}else if( opcode==OP_Transaction && pOp->p2!=0 ){
p->readOnly = 0;
#ifndef SQLITE_OMIT_VIRTUALTABLE
}else if( opcode==OP_VUpdate || opcode==OP_VRename ){
doesStatementRollback = 1;
}else if( opcode==OP_VFilter ){
int n;
assert( p->nOp - i >= 3 );
assert( pOp[-1].opcode==OP_Integer );
|
| ︙ | ︙ | |||
41837 41838 41839 41840 41841 41842 41843 41844 41845 41846 41847 41848 41849 41850 |
/* If we never rollback a statement transaction, then statement
** transactions are not needed. So change every OP_Statement
** opcode into an OP_Noop. This avoid a call to sqlite3OsOpenExclusive()
** which can be expensive on some platforms.
*/
if( hasStatementBegin && !doesStatementRollback ){
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
if( pOp->opcode==OP_Statement ){
pOp->opcode = OP_Noop;
}
}
}
}
| > | 41895 41896 41897 41898 41899 41900 41901 41902 41903 41904 41905 41906 41907 41908 41909 |
/* If we never rollback a statement transaction, then statement
** transactions are not needed. So change every OP_Statement
** opcode into an OP_Noop. This avoid a call to sqlite3OsOpenExclusive()
** which can be expensive on some platforms.
*/
if( hasStatementBegin && !doesStatementRollback ){
p->usesStmtJournal = 0;
for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){
if( pOp->opcode==OP_Statement ){
pOp->opcode = OP_Noop;
}
}
}
}
|
| ︙ | ︙ | |||
42545 42546 42547 42548 42549 42550 42551 | * state. */ p->magic = VDBE_MAGIC_RUN; /* For each cursor required, also allocate a memory cell. Memory ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by ** the vdbe program. Instead they are used to allocate space for | | | | | | 42604 42605 42606 42607 42608 42609 42610 42611 42612 42613 42614 42615 42616 42617 42618 42619 42620 42621 42622 42623 42624 42625 42626 42627 42628 42629 42630 42631 42632 42633 42634 42635 42636 42637 42638 42639 42640 42641 42642 42643 42644 42645 42646 42647 42648 42649 42650 42651 42652 |
* state.
*/
p->magic = VDBE_MAGIC_RUN;
/* For each cursor required, also allocate a memory cell. Memory
** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by
** the vdbe program. Instead they are used to allocate space for
** VdbeCursor/BtCursor structures. The blob of memory associated with
** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1)
** stores the blob of memory associated with cursor 1, etc.
**
** See also: allocateCursor().
*/
nMem += nCursor;
/*
** Allocation space for registers.
*/
if( p->aMem==0 ){
int nArg; /* Maximum number of args passed to a user function. */
resolveP2Values(p, &nArg);
/*resizeOpArray(p, p->nOp);*/
assert( nVar>=0 );
if( isExplain && nMem<10 ){
nMem = 10;
}
p->aMem = sqlite3DbMallocZero(db,
nMem*sizeof(Mem) /* aMem */
+ nVar*sizeof(Mem) /* aVar */
+ nArg*sizeof(Mem*) /* apArg */
+ nVar*sizeof(char*) /* azVar */
+ nCursor*sizeof(VdbeCursor*)+1 /* apCsr */
);
if( !db->mallocFailed ){
p->aMem--; /* aMem[] goes from 1..nMem */
p->nMem = nMem; /* not from 0..nMem-1 */
p->aVar = &p->aMem[nMem+1];
p->nVar = nVar;
p->okVar = 0;
p->apArg = (Mem**)&p->aVar[nVar];
p->azVar = (char**)&p->apArg[nArg];
p->apCsr = (VdbeCursor**)&p->azVar[nVar];
p->nCursor = nCursor;
for(n=0; n<nVar; n++){
p->aVar[n].flags = MEM_Null;
p->aVar[n].db = db;
}
for(n=1; n<=nMem; n++){
p->aMem[n].flags = MEM_Null;
|
| ︙ | ︙ | |||
42622 42623 42624 42625 42626 42627 42628 | #endif } /* ** Close a VDBE cursor and release all the resources that cursor ** happens to hold. */ | | | 42681 42682 42683 42684 42685 42686 42687 42688 42689 42690 42691 42692 42693 42694 42695 |
#endif
}
/*
** Close a VDBE cursor and release all the resources that cursor
** happens to hold.
*/
SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
if( pCx==0 ){
return;
}
if( pCx->pBt ){
sqlite3BtreeClose(pCx->pBt);
/* The pCx->pCursor will be close automatically, if it exists, by
** the call above. */
|
| ︙ | ︙ | |||
42657 42658 42659 42660 42661 42662 42663 |
** Close all cursors except for VTab cursors that are currently
** in use.
*/
static void closeAllCursorsExceptActiveVtabs(Vdbe *p){
int i;
if( p->apCsr==0 ) return;
for(i=0; i<p->nCursor; i++){
| | | 42716 42717 42718 42719 42720 42721 42722 42723 42724 42725 42726 42727 42728 42729 42730 |
** Close all cursors except for VTab cursors that are currently
** in use.
*/
static void closeAllCursorsExceptActiveVtabs(Vdbe *p){
int i;
if( p->apCsr==0 ) return;
for(i=0; i<p->nCursor; i++){
VdbeCursor *pC = p->apCsr[i];
if( pC && (!p->inVtabMethod || !pC->pVtabCursor) ){
sqlite3VdbeFreeCursor(p, pC);
p->apCsr[i] = 0;
}
}
}
|
| ︙ | ︙ | |||
42747 42748 42749 42750 42751 42752 42753 |
if( p->db->mallocFailed ){
assert( !zName || xDel!=SQLITE_DYNAMIC );
return SQLITE_NOMEM;
}
assert( p->aColName!=0 );
pColName = &(p->aColName[idx+var*p->nResColumn]);
rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel);
| | | 42806 42807 42808 42809 42810 42811 42812 42813 42814 42815 42816 42817 42818 42819 42820 |
if( p->db->mallocFailed ){
assert( !zName || xDel!=SQLITE_DYNAMIC );
return SQLITE_NOMEM;
}
assert( p->aColName!=0 );
pColName = &(p->aColName[idx+var*p->nResColumn]);
rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel);
assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 );
return rc;
}
/*
** A read or write transaction may or may not be active on database handle
** db. If a transaction is active, commit it. If there is a
** write-transaction spanning more than one database file, this routine
|
| ︙ | ︙ | |||
42978 42979 42980 42981 42982 42983 42984 42985 42986 42987 42988 42989 42990 42991 42992 42993 42994 42995 42996 42997 42998 42999 |
**
** This is a no-op if NDEBUG is defined.
*/
#ifndef NDEBUG
static void checkActiveVdbeCnt(sqlite3 *db){
Vdbe *p;
int cnt = 0;
p = db->pVdbe;
while( p ){
if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){
cnt++;
}
p = p->pNext;
}
assert( cnt==db->activeVdbeCnt );
}
#else
#define checkActiveVdbeCnt(x)
#endif
/*
** For every Btree that in database connection db which
| > > > | 43037 43038 43039 43040 43041 43042 43043 43044 43045 43046 43047 43048 43049 43050 43051 43052 43053 43054 43055 43056 43057 43058 43059 43060 43061 |
**
** This is a no-op if NDEBUG is defined.
*/
#ifndef NDEBUG
static void checkActiveVdbeCnt(sqlite3 *db){
Vdbe *p;
int cnt = 0;
int nWrite = 0;
p = db->pVdbe;
while( p ){
if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){
cnt++;
if( p->readOnly==0 ) nWrite++;
}
p = p->pNext;
}
assert( cnt==db->activeVdbeCnt );
assert( nWrite==db->writeVdbeCnt );
}
#else
#define checkActiveVdbeCnt(x)
#endif
/*
** For every Btree that in database connection db which
|
| ︙ | ︙ | |||
43073 43074 43075 43076 43077 43078 43079 |
sqlite3BtreeMutexArrayEnter(&p->aMutex);
/* Check for one of the special errors */
mrc = p->rc & 0xff;
isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR
|| mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
if( isSpecialError ){
| < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | > | | | 43135 43136 43137 43138 43139 43140 43141 43142 43143 43144 43145 43146 43147 43148 43149 43150 43151 43152 43153 43154 43155 43156 43157 43158 43159 43160 43161 43162 43163 43164 43165 43166 43167 43168 43169 43170 43171 43172 43173 43174 43175 43176 |
sqlite3BtreeMutexArrayEnter(&p->aMutex);
/* Check for one of the special errors */
mrc = p->rc & 0xff;
isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR
|| mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL;
if( isSpecialError ){
/* If the query was read-only, we need do no rollback at all. Otherwise,
** proceed with the special handling.
*/
if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){
if( p->rc==SQLITE_IOERR_BLOCKED && p->usesStmtJournal ){
xFunc = sqlite3BtreeRollbackStmt;
p->rc = SQLITE_BUSY;
}else if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL)
&& p->usesStmtJournal ){
xFunc = sqlite3BtreeRollbackStmt;
}else{
/* We are forced to roll back the active transaction. Before doing
** so, abort any other statements this handle currently has active.
*/
invalidateCursorsOnModifiedBtrees(db);
sqlite3RollbackAll(db);
db->autoCommit = 1;
}
}
}
/* If the auto-commit flag is set and this is the only active vdbe, then
** we do either a commit or rollback of the current transaction.
**
** Note: This block also runs if one of the special errors handled
** above has occurred.
*/
if( db->autoCommit && db->writeVdbeCnt==(p->readOnly==0) ){
if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){
/* The auto-commit flag is true, and the vdbe program was
** successful or hit an 'OR FAIL' constraint. This means a commit
** is required.
*/
int rc = vdbeCommit(db, p);
if( rc==SQLITE_BUSY ){
|
| ︙ | ︙ | |||
43207 43208 43209 43210 43211 43212 43213 43214 43215 43216 43217 43218 43219 43220 |
/* Release the locks */
sqlite3BtreeMutexArrayLeave(&p->aMutex);
}
/* We have successfully halted and closed the VM. Record this fact. */
if( p->pc>=0 ){
db->activeVdbeCnt--;
}
p->magic = VDBE_MAGIC_HALT;
checkActiveVdbeCnt(db);
if( p->db->mallocFailed ){
p->rc = SQLITE_NOMEM;
}
| > > > > | 43242 43243 43244 43245 43246 43247 43248 43249 43250 43251 43252 43253 43254 43255 43256 43257 43258 43259 |
/* Release the locks */
sqlite3BtreeMutexArrayLeave(&p->aMutex);
}
/* We have successfully halted and closed the VM. Record this fact. */
if( p->pc>=0 ){
db->activeVdbeCnt--;
if( !p->readOnly ){
db->writeVdbeCnt--;
}
assert( db->activeVdbeCnt>=db->writeVdbeCnt );
}
p->magic = VDBE_MAGIC_HALT;
checkActiveVdbeCnt(db);
if( p->db->mallocFailed ){
p->rc = SQLITE_NOMEM;
}
|
| ︙ | ︙ | |||
43390 43391 43392 43393 43394 43395 43396 | } /* ** If a MoveTo operation is pending on the given cursor, then do that ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ | | | 43429 43430 43431 43432 43433 43434 43435 43436 43437 43438 43439 43440 43441 43442 43443 |
}
/*
** If a MoveTo operation is pending on the given cursor, then do that
** MoveTo now. Return an error code. If no MoveTo is pending, this
** routine does nothing and returns SQLITE_OK.
*/
SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor *p){
if( p->deferredMoveto ){
int res, rc;
#ifdef SQLITE_TEST
extern int sqlite3_search_count;
#endif
assert( p->isTable );
rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res);
|
| ︙ | ︙ | |||
43493 43494 43495 43496 43497 43498 43499 |
if( u<=2147483647 ) return 4;
if( u<=MAX_6BYTE ) return 5;
return 6;
}
if( flags&MEM_Real ){
return 7;
}
| | | 43532 43533 43534 43535 43536 43537 43538 43539 43540 43541 43542 43543 43544 43545 43546 |
if( u<=2147483647 ) return 4;
if( u<=MAX_6BYTE ) return 5;
return 6;
}
if( flags&MEM_Real ){
return 7;
}
assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
n = pMem->n;
if( flags & MEM_Zero ){
n += pMem->u.i;
}
assert( n>=0 );
return ((n*2) + 12 + ((flags&MEM_Str)!=0));
}
|
| ︙ | ︙ | |||
43957 43958 43959 43960 43961 43962 43963 | ** is ignored as well. Hence, this routine only compares the prefixes ** of the keys prior to the final rowid, not the entire key. ** ** pUnpacked may be an unpacked version of pKey,nKey. If pUnpacked is ** supplied it is used in place of pKey,nKey. */ SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare( | | | 43996 43997 43998 43999 44000 44001 44002 44003 44004 44005 44006 44007 44008 44009 44010 |
** is ignored as well. Hence, this routine only compares the prefixes
** of the keys prior to the final rowid, not the entire key.
**
** pUnpacked may be an unpacked version of pKey,nKey. If pUnpacked is
** supplied it is used in place of pKey,nKey.
*/
SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(
VdbeCursor *pC, /* The cursor to compare against */
UnpackedRecord *pUnpacked, /* Unpacked version of pKey and nKey */
int *res /* Write the comparison result here */
){
i64 nCellKey = 0;
int rc;
BtCursor *pCur = pC->pCursor;
Mem m;
|
| ︙ | ︙ | |||
44043 44044 44045 44046 44047 44048 44049 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code use to implement APIs that are part of the ** VDBE. ** | | | 44082 44083 44084 44085 44086 44087 44088 44089 44090 44091 44092 44093 44094 44095 44096 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code use to implement APIs that are part of the ** VDBE. ** ** $Id: vdbeapi.c,v 1.148 2008/11/05 16:37:35 drh Exp $ */ #if 0 && defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) /* ** The following structure contains pointers to the end points of a ** doubly-linked list of all compiled SQL statements that may be holding ** buffers eligible for release when the sqlite3_release_memory() interface is |
| ︙ | ︙ | |||
44496 44497 44498 44499 44500 44501 44502 44503 44504 44505 44506 44507 44508 44509 |
double rNow;
sqlite3OsCurrentTime(db->pVfs, &rNow);
p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0;
}
#endif
db->activeVdbeCnt++;
p->pc = 0;
stmtLruRemove(p);
}
#ifndef SQLITE_OMIT_EXPLAIN
if( p->explain ){
rc = sqlite3VdbeList(p);
}else
| > | 44535 44536 44537 44538 44539 44540 44541 44542 44543 44544 44545 44546 44547 44548 44549 |
double rNow;
sqlite3OsCurrentTime(db->pVfs, &rNow);
p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0;
}
#endif
db->activeVdbeCnt++;
if( p->readOnly==0 ) db->writeVdbeCnt++;
p->pc = 0;
stmtLruRemove(p);
}
#ifndef SQLITE_OMIT_EXPLAIN
if( p->explain ){
rc = sqlite3VdbeList(p);
}else
|
| ︙ | ︙ | |||
45381 45382 45383 45384 45385 45386 45387 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** | | | 45421 45422 45423 45424 45425 45426 45427 45428 45429 45430 45431 45432 45433 45434 45435 | ** ** Various scripts scan this source file in order to generate HTML ** documentation, headers files, or other derived files. The formatting ** of the code in this file is, therefore, important. See other comments ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** ** $Id: vdbe.c,v 1.786 2008/11/05 16:37:35 drh Exp $ */ /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_MoveXX, OP_Next, or OP_Prev opcodes. The test ** procedures use this information to make sure that indices are ** working correctly. This variable has no function other than to |
| ︙ | ︙ | |||
45517 45518 45519 45520 45521 45522 45523 |
*/
SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int opcode, int mask){
assert( opcode>0 && opcode<sizeof(opcodeProperty) );
return (opcodeProperty[opcode]&mask)!=0;
}
/*
| | | | | | | | | | | | | | | | > | 45557 45558 45559 45560 45561 45562 45563 45564 45565 45566 45567 45568 45569 45570 45571 45572 45573 45574 45575 45576 45577 45578 45579 45580 45581 45582 45583 45584 45585 45586 45587 45588 45589 45590 45591 45592 45593 45594 45595 45596 45597 45598 45599 45600 45601 45602 45603 45604 45605 45606 45607 45608 45609 45610 45611 45612 45613 45614 45615 45616 45617 45618 45619 45620 45621 45622 45623 45624 45625 45626 45627 45628 45629 45630 45631 45632 |
*/
SQLITE_PRIVATE int sqlite3VdbeOpcodeHasProperty(int opcode, int mask){
assert( opcode>0 && opcode<sizeof(opcodeProperty) );
return (opcodeProperty[opcode]&mask)!=0;
}
/*
** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL
** if we run out of memory.
*/
static VdbeCursor *allocateCursor(
Vdbe *p, /* The virtual machine */
int iCur, /* Index of the new VdbeCursor */
Op *pOp, /* */
int iDb, /* */
int isBtreeCursor /* */
){
/* Find the memory cell that will be used to store the blob of memory
** required for this VdbeCursor structure. It is convenient to use a
** vdbe memory cell to manage the memory allocation required for a
** VdbeCursor structure for the following reasons:
**
** * Sometimes cursor numbers are used for a couple of different
** purposes in a vdbe program. The different uses might require
** different sized allocations. Memory cells provide growable
** allocations.
**
** * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can
** be freed lazily via the sqlite3_release_memory() API. This
** minimizes the number of malloc calls made by the system.
**
** Memory cells for cursors are allocated at the top of the address
** space. Memory cell (p->nMem) corresponds to cursor 0. Space for
** cursor 1 is managed by memory cell (p->nMem-1), etc.
*/
Mem *pMem = &p->aMem[p->nMem-iCur];
int nByte;
VdbeCursor *pCx = 0;
/* If the opcode of pOp is OP_SetNumColumns, then pOp->p2 contains
** the number of fields in the records contained in the table or
** index being opened. Use this to reserve space for the
** VdbeCursor.aType[] array.
*/
int nField = 0;
if( pOp->opcode==OP_SetNumColumns || pOp->opcode==OP_OpenEphemeral ){
nField = pOp->p2;
}
nByte =
sizeof(VdbeCursor) +
(isBtreeCursor?sqlite3BtreeCursorSize():0) +
2*nField*sizeof(u32);
assert( iCur<p->nCursor );
if( p->apCsr[iCur] ){
sqlite3VdbeFreeCursor(p, p->apCsr[iCur]);
p->apCsr[iCur] = 0;
}
if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){
p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
memset(pMem->z, 0, nByte);
pCx->iDb = iDb;
pCx->nField = nField;
if( nField ){
pCx->aType = (u32 *)&pMem->z[sizeof(VdbeCursor)];
}
if( isBtreeCursor ){
pCx->pCursor = (BtCursor*)
&pMem->z[sizeof(VdbeCursor)+2*nField*sizeof(u32)];
}
}
return pCx;
}
/*
** Try to convert a value into a numeric representation if we can
|
| ︙ | ︙ | |||
47384 47385 47386 47387 47388 47389 47390 | ** the MakeRecord instruction. (See the MakeRecord opcode for additional ** information about the format of the data.) Extract the P2-th column ** from this record. If there are less that (P2+1) ** values in the record, extract a NULL. ** ** The value extracted is stored in register P3. ** | < < < | | 47425 47426 47427 47428 47429 47430 47431 47432 47433 47434 47435 47436 47437 47438 47439 47440 47441 47442 47443 47444 47445 47446 47447 |
** the MakeRecord instruction. (See the MakeRecord opcode for additional
** information about the format of the data.) Extract the P2-th column
** from this record. If there are less that (P2+1)
** values in the record, extract a NULL.
**
** The value extracted is stored in register P3.
**
** If the column contains fewer than P2 fields, then extract a NULL. Or,
** if the P4 argument is a P4_MEM use the value of the P4 argument as
** the result.
*/
case OP_Column: {
u32 payloadSize; /* Number of bytes in the record */
int p1 = pOp->p1; /* P1 value of the opcode */
int p2 = pOp->p2; /* column number to retrieve */
VdbeCursor *pC = 0;/* The VDBE cursor */
char *zRec; /* Pointer to complete record-data */
BtCursor *pCrsr; /* The BTree cursor */
u32 *aType; /* aType[i] holds the numeric type of the i-th column */
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
u32 nField; /* number of fields in the record */
int len; /* The length of the serialized data for the column */
int i; /* Loop counter */
|
| ︙ | ︙ | |||
47425 47426 47427 47428 47429 47430 47431 | ** zRec is set to be the complete text of the record if it is available. ** The complete record text is always available for pseudo-tables ** If the record is stored in a cursor, the complete record text ** might be available in the pC->aRow cache. Or it might not be. ** If the data is unavailable, zRec is set to NULL. ** ** We also compute the number of columns in the record. For cursors, | | | 47463 47464 47465 47466 47467 47468 47469 47470 47471 47472 47473 47474 47475 47476 47477 |
** zRec is set to be the complete text of the record if it is available.
** The complete record text is always available for pseudo-tables
** If the record is stored in a cursor, the complete record text
** might be available in the pC->aRow cache. Or it might not be.
** If the data is unavailable, zRec is set to NULL.
**
** We also compute the number of columns in the record. For cursors,
** the number of columns is stored in the VdbeCursor.nField element.
*/
pC = p->apCsr[p1];
assert( pC!=0 );
#ifndef SQLITE_OMIT_VIRTUALTABLE
assert( pC->pVtabCursor==0 );
#endif
if( pC->pCursor!=0 ){
|
| ︙ | ︙ | |||
47821 47822 47823 47824 47825 47826 47827 |
** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll
** back any currently active btree transactions. If there are any active
** VMs (apart from this one), then the COMMIT or ROLLBACK statement fails.
**
** This instruction causes the VM to halt.
*/
case OP_AutoCommit: {
| | | > | | | | | | > | > > > > > | | | | | | 47859 47860 47861 47862 47863 47864 47865 47866 47867 47868 47869 47870 47871 47872 47873 47874 47875 47876 47877 47878 47879 47880 47881 47882 47883 47884 47885 47886 47887 47888 47889 47890 47891 47892 47893 47894 47895 47896 47897 47898 47899 47900 47901 47902 47903 47904 47905 47906 47907 47908 47909 47910 47911 47912 47913 47914 47915 47916 47917 47918 47919 |
** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll
** back any currently active btree transactions. If there are any active
** VMs (apart from this one), then the COMMIT or ROLLBACK statement fails.
**
** This instruction causes the VM to halt.
*/
case OP_AutoCommit: {
int desiredAutoCommit = pOp->p1;
int rollback = pOp->p2;
int turnOnAC = desiredAutoCommit && !db->autoCommit;
assert( desiredAutoCommit==1 || desiredAutoCommit==0 );
assert( desiredAutoCommit==1 || rollback==0 );
assert( db->activeVdbeCnt>0 ); /* At least this one VM is active */
if( turnOnAC && rollback && db->activeVdbeCnt>1 ){
/* If this instruction implements a ROLLBACK and other VMs are
** still running, and a transaction is active, return an error indicating
** that the other VMs must complete first.
*/
sqlite3SetString(&p->zErrMsg, db, "cannot rollback transaction - "
"SQL statements in progress");
rc = SQLITE_BUSY;
}else if( turnOnAC && !rollback && db->writeVdbeCnt>1 ){
/* If this instruction implements a COMMIT and other VMs are writing
** return an error indicating that the other VMs must complete first.
*/
sqlite3SetString(&p->zErrMsg, db, "cannot commit transaction - "
"SQL statements in progress");
rc = SQLITE_BUSY;
}else if( desiredAutoCommit!=db->autoCommit ){
if( pOp->p2 ){
assert( desiredAutoCommit==1 );
sqlite3RollbackAll(db);
db->autoCommit = 1;
}else{
db->autoCommit = desiredAutoCommit;
if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){
p->pc = pc;
db->autoCommit = 1-desiredAutoCommit;
p->rc = rc = SQLITE_BUSY;
goto vdbe_return;
}
}
if( p->rc==SQLITE_OK ){
rc = SQLITE_DONE;
}else{
rc = SQLITE_ERROR;
}
goto vdbe_return;
}else{
sqlite3SetString(&p->zErrMsg, db,
(!desiredAutoCommit)?"cannot start a transaction within a transaction":(
(rollback)?"cannot rollback - no transaction is active":
"cannot commit - no transaction is active"));
rc = SQLITE_ERROR;
}
break;
}
|
| ︙ | ︙ | |||
48097 48098 48099 48100 48101 48102 48103 |
case OP_OpenRead:
case OP_OpenWrite: {
int i = pOp->p1;
int p2 = pOp->p2;
int iDb = pOp->p3;
int wrFlag;
Btree *pX;
| | | 48142 48143 48144 48145 48146 48147 48148 48149 48150 48151 48152 48153 48154 48155 48156 |
case OP_OpenRead:
case OP_OpenWrite: {
int i = pOp->p1;
int p2 = pOp->p2;
int iDb = pOp->p3;
int wrFlag;
Btree *pX;
VdbeCursor *pCur;
Db *pDb;
assert( iDb>=0 && iDb<db->nDb );
assert( (p->btreeMask & (1<<iDb))!=0 );
pDb = &db->aDb[iDb];
pX = pDb->pBt;
assert( pX!=0 );
|
| ︙ | ︙ | |||
48197 48198 48199 48200 48201 48202 48203 |
** confusion because the term "temp table", might refer either
** to a TEMP table at the SQL level, or to a table opened by
** this opcode. Then this opcode was call OpenVirtual. But
** that created confusion with the whole virtual-table idea.
*/
case OP_OpenEphemeral: {
int i = pOp->p1;
| | | 48242 48243 48244 48245 48246 48247 48248 48249 48250 48251 48252 48253 48254 48255 48256 |
** confusion because the term "temp table", might refer either
** to a TEMP table at the SQL level, or to a table opened by
** this opcode. Then this opcode was call OpenVirtual. But
** that created confusion with the whole virtual-table idea.
*/
case OP_OpenEphemeral: {
int i = pOp->p1;
VdbeCursor *pCx;
static const int openFlags =
SQLITE_OPEN_READWRITE |
SQLITE_OPEN_CREATE |
SQLITE_OPEN_EXCLUSIVE |
SQLITE_OPEN_DELETEONCLOSE |
SQLITE_OPEN_TRANSIENT_DB;
|
| ︙ | ︙ | |||
48263 48264 48265 48266 48267 48268 48269 |
** original row data. Otherwise, a pointer to the original memory cell
** is stored. In this case, the vdbe program must ensure that the
** memory cell containing the row data is not overwritten until the
** pseudo table is closed (or a new row is inserted into it).
*/
case OP_OpenPseudo: {
int i = pOp->p1;
| | | 48308 48309 48310 48311 48312 48313 48314 48315 48316 48317 48318 48319 48320 48321 48322 |
** original row data. Otherwise, a pointer to the original memory cell
** is stored. In this case, the vdbe program must ensure that the
** memory cell containing the row data is not overwritten until the
** pseudo table is closed (or a new row is inserted into it).
*/
case OP_OpenPseudo: {
int i = pOp->p1;
VdbeCursor *pCx;
assert( i>=0 );
pCx = allocateCursor(p, i, &pOp[-1], -1, 0);
if( pCx==0 ) goto no_mem;
pCx->nullRow = 1;
pCx->pseudoTable = 1;
pCx->ephemPseudoTable = pOp->p2;
pCx->isTable = 1;
|
| ︙ | ︙ | |||
48352 48353 48354 48355 48356 48357 48358 |
** See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLt
*/
case OP_MoveLt: /* jump, in3 */
case OP_MoveLe: /* jump, in3 */
case OP_MoveGe: /* jump, in3 */
case OP_MoveGt: { /* jump, in3 */
int i = pOp->p1;
| | | 48397 48398 48399 48400 48401 48402 48403 48404 48405 48406 48407 48408 48409 48410 48411 |
** See also: Found, NotFound, Distinct, MoveGt, MoveGe, MoveLt
*/
case OP_MoveLt: /* jump, in3 */
case OP_MoveLe: /* jump, in3 */
case OP_MoveGe: /* jump, in3 */
case OP_MoveGt: { /* jump, in3 */
int i = pOp->p1;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
if( pC->pCursor!=0 ){
int res, oc;
oc = pOp->opcode;
|
| ︙ | ︙ | |||
48469 48470 48471 48472 48473 48474 48475 |
**
** See also: Found, NotExists, IsUnique
*/
case OP_NotFound: /* jump, in3 */
case OP_Found: { /* jump, in3 */
int i = pOp->p1;
int alreadyExists = 0;
| | | 48514 48515 48516 48517 48518 48519 48520 48521 48522 48523 48524 48525 48526 48527 48528 |
**
** See also: Found, NotExists, IsUnique
*/
case OP_NotFound: /* jump, in3 */
case OP_Found: { /* jump, in3 */
int i = pOp->p1;
int alreadyExists = 0;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pC = p->apCsr[i])->pCursor!=0 ){
int res;
UnpackedRecord *pIdxKey;
assert( pC->isTable==0 );
|
| ︙ | ︙ | |||
48525 48526 48527 48528 48529 48530 48531 |
** number for that entry is written into P3 and control
** falls through to the next instruction.
**
** See also: NotFound, NotExists, Found
*/
case OP_IsUnique: { /* jump, in3 */
int i = pOp->p1;
| | | 48570 48571 48572 48573 48574 48575 48576 48577 48578 48579 48580 48581 48582 48583 48584 |
** number for that entry is written into P3 and control
** falls through to the next instruction.
**
** See also: NotFound, NotExists, Found
*/
case OP_IsUnique: { /* jump, in3 */
int i = pOp->p1;
VdbeCursor *pCx;
BtCursor *pCrsr;
Mem *pK;
i64 R;
/* Pop the value R off the top of the stack
*/
assert( pOp->p4type==P4_INT32 );
|
| ︙ | ︙ | |||
48622 48623 48624 48625 48626 48627 48628 |
** NotFound assumes key is a blob constructed from MakeRecord and
** P1 is an index.
**
** See also: Found, NotFound, IsUnique
*/
case OP_NotExists: { /* jump, in3 */
int i = pOp->p1;
| | | 48667 48668 48669 48670 48671 48672 48673 48674 48675 48676 48677 48678 48679 48680 48681 |
** NotFound assumes key is a blob constructed from MakeRecord and
** P1 is an index.
**
** See also: Found, NotFound, IsUnique
*/
case OP_NotExists: { /* jump, in3 */
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
int res;
u64 iKey;
assert( pIn3->flags & MEM_Int );
|
| ︙ | ︙ | |||
48691 48692 48693 48694 48695 48696 48697 |
** error is generated. The P3 register is updated with the generated
** record number. This P3 mechanism is used to help implement the
** AUTOINCREMENT feature.
*/
case OP_NewRowid: { /* out2-prerelease */
int i = pOp->p1;
i64 v = 0;
| | | 48736 48737 48738 48739 48740 48741 48742 48743 48744 48745 48746 48747 48748 48749 48750 |
** error is generated. The P3 register is updated with the generated
** record number. This P3 mechanism is used to help implement the
** AUTOINCREMENT feature.
*/
case OP_NewRowid: { /* out2-prerelease */
int i = pOp->p1;
i64 v = 0;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pC = p->apCsr[i])->pCursor==0 ){
/* The zero initialization above is all that is needed */
}else{
/* The next rowid or record number (different terms for the same
** thing) is obtained in a two-step algorithm.
|
| ︙ | ︙ | |||
48859 48860 48861 48862 48863 48864 48865 |
*/
case OP_Insert: {
Mem *pData = &p->aMem[pOp->p2];
Mem *pKey = &p->aMem[pOp->p3];
i64 iKey; /* The integer ROWID or key for the record to be inserted */
int i = pOp->p1;
| | | 48904 48905 48906 48907 48908 48909 48910 48911 48912 48913 48914 48915 48916 48917 48918 |
*/
case OP_Insert: {
Mem *pData = &p->aMem[pOp->p2];
Mem *pKey = &p->aMem[pOp->p3];
i64 iKey; /* The integer ROWID or key for the record to be inserted */
int i = pOp->p1;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
assert( pC->pCursor!=0 || pC->pseudoTable );
assert( pKey->flags & MEM_Int );
assert( pC->isTable );
REGISTER_TRACE(pOp->p2, pData);
|
| ︙ | ︙ | |||
48953 48954 48955 48956 48957 48958 48959 |
** pointing to. The update hook will be invoked, if it exists.
** If P4 is not NULL then the P1 cursor must have been positioned
** using OP_NotFound prior to invoking this opcode.
*/
case OP_Delete: {
int i = pOp->p1;
i64 iKey;
| | | 48998 48999 49000 49001 49002 49003 49004 49005 49006 49007 49008 49009 49010 49011 49012 |
** pointing to. The update hook will be invoked, if it exists.
** If P4 is not NULL then the P1 cursor must have been positioned
** using OP_NotFound prior to invoking this opcode.
*/
case OP_Delete: {
int i = pOp->p1;
i64 iKey;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
assert( pC->pCursor!=0 ); /* Only valid for real tables, no pseudotables */
/* If the update-hook will be invoked, set iKey to the rowid of the
|
| ︙ | ︙ | |||
49024 49025 49026 49027 49028 49029 49030 |
**
** If the P1 cursor must be pointing to a valid row (not a NULL row)
** of a real table, not a pseudo-table.
*/
case OP_RowKey:
case OP_RowData: {
int i = pOp->p1;
| | | 49069 49070 49071 49072 49073 49074 49075 49076 49077 49078 49079 49080 49081 49082 49083 |
**
** If the P1 cursor must be pointing to a valid row (not a NULL row)
** of a real table, not a pseudo-table.
*/
case OP_RowKey:
case OP_RowData: {
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
u32 n;
pOut = &p->aMem[pOp->p2];
/* Note that RowKey and RowData are really exactly the same instruction */
assert( i>=0 && i<p->nCursor );
|
| ︙ | ︙ | |||
49078 49079 49080 49081 49082 49083 49084 |
/* Opcode: Rowid P1 P2 * * *
**
** Store in register P2 an integer which is the key of the table entry that
** P1 is currently point to.
*/
case OP_Rowid: { /* out2-prerelease */
int i = pOp->p1;
| | | 49123 49124 49125 49126 49127 49128 49129 49130 49131 49132 49133 49134 49135 49136 49137 |
/* Opcode: Rowid P1 P2 * * *
**
** Store in register P2 an integer which is the key of the table entry that
** P1 is currently point to.
*/
case OP_Rowid: { /* out2-prerelease */
int i = pOp->p1;
VdbeCursor *pC;
i64 v;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
rc = sqlite3VdbeCursorMoveto(pC);
if( rc ) goto abort_due_to_error;
|
| ︙ | ︙ | |||
49111 49112 49113 49114 49115 49116 49117 |
**
** Move the cursor P1 to a null row. Any OP_Column operations
** that occur while the cursor is on the null row will always
** write a NULL.
*/
case OP_NullRow: {
int i = pOp->p1;
| | | 49156 49157 49158 49159 49160 49161 49162 49163 49164 49165 49166 49167 49168 49169 49170 |
**
** Move the cursor P1 to a null row. Any OP_Column operations
** that occur while the cursor is on the null row will always
** write a NULL.
*/
case OP_NullRow: {
int i = pOp->p1;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
pC->nullRow = 1;
pC->rowidIsValid = 0;
if( pC->pCursor ){
|
| ︙ | ︙ | |||
49134 49135 49136 49137 49138 49139 49140 |
** will refer to the last entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Last: { /* jump */
int i = pOp->p1;
| | | 49179 49180 49181 49182 49183 49184 49185 49186 49187 49188 49189 49190 49191 49192 49193 |
** will refer to the last entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Last: { /* jump */
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
pCrsr = pC->pCursor;
|
| ︙ | ︙ | |||
49184 49185 49186 49187 49188 49189 49190 |
** will refer to the first entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Rewind: { /* jump */
int i = pOp->p1;
| | | 49229 49230 49231 49232 49233 49234 49235 49236 49237 49238 49239 49240 49241 49242 49243 |
** will refer to the first entry in the database table or index.
** If the table or index is empty and P2>0, then jump immediately to P2.
** If P2 is 0 or if the table or index is not empty, fall through
** to the following instruction.
*/
case OP_Rewind: { /* jump */
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
assert( i>=0 && i<p->nCursor );
pC = p->apCsr[i];
assert( pC!=0 );
if( (pCrsr = pC->pCursor)!=0 ){
|
| ︙ | ︙ | |||
49229 49230 49231 49232 49233 49234 49235 |
** to the following instruction. But if the cursor backup was successful,
** jump immediately to P2.
**
** The P1 cursor must be for a real table, not a pseudo-table.
*/
case OP_Prev: /* jump */
case OP_Next: { /* jump */
| | | 49274 49275 49276 49277 49278 49279 49280 49281 49282 49283 49284 49285 49286 49287 49288 |
** to the following instruction. But if the cursor backup was successful,
** jump immediately to P2.
**
** The P1 cursor must be for a real table, not a pseudo-table.
*/
case OP_Prev: /* jump */
case OP_Next: { /* jump */
VdbeCursor *pC;
BtCursor *pCrsr;
int res;
CHECK_FOR_INTERRUPT;
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
if( pC==0 ){
|
| ︙ | ︙ | |||
49272 49273 49274 49275 49276 49277 49278 |
** insert is likely to be an append.
**
** This instruction only works for indices. The equivalent instruction
** for tables is OP_Insert.
*/
case OP_IdxInsert: { /* in2 */
int i = pOp->p1;
| | | 49317 49318 49319 49320 49321 49322 49323 49324 49325 49326 49327 49328 49329 49330 49331 |
** insert is likely to be an append.
**
** This instruction only works for indices. The equivalent instruction
** for tables is OP_Insert.
*/
case OP_IdxInsert: { /* in2 */
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
assert( pIn2->flags & MEM_Blob );
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
assert( pC->isTable==0 );
rc = ExpandBlob(pIn2);
|
| ︙ | ︙ | |||
49299 49300 49301 49302 49303 49304 49305 |
**
** The content of P3 registers starting at register P2 form
** an unpacked index key. This opcode removes that entry from the
** index opened by cursor P1.
*/
case OP_IdxDelete: {
int i = pOp->p1;
| | | 49344 49345 49346 49347 49348 49349 49350 49351 49352 49353 49354 49355 49356 49357 49358 |
**
** The content of P3 registers starting at register P2 form
** an unpacked index key. This opcode removes that entry from the
** index opened by cursor P1.
*/
case OP_IdxDelete: {
int i = pOp->p1;
VdbeCursor *pC;
BtCursor *pCrsr;
assert( pOp->p3>0 );
assert( pOp->p2>0 && pOp->p2+pOp->p3<=p->nMem );
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
int res;
|
| ︙ | ︙ | |||
49333 49334 49335 49336 49337 49338 49339 |
** the rowid of the table entry to which this index entry points.
**
** See also: Rowid, MakeIdxRec.
*/
case OP_IdxRowid: { /* out2-prerelease */
int i = pOp->p1;
BtCursor *pCrsr;
| | | 49378 49379 49380 49381 49382 49383 49384 49385 49386 49387 49388 49389 49390 49391 49392 |
** the rowid of the table entry to which this index entry points.
**
** See also: Rowid, MakeIdxRec.
*/
case OP_IdxRowid: { /* out2-prerelease */
int i = pOp->p1;
BtCursor *pCrsr;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pCrsr = (pC = p->apCsr[i])->pCursor)!=0 ){
i64 rowid;
assert( pC->deferredMoveto==0 );
|
| ︙ | ︙ | |||
49383 49384 49385 49386 49387 49388 49389 |
**
** If P5 is non-zero then the key value is increased by an epsilon prior
** to the comparison. This makes the opcode work like IdxLE.
*/
case OP_IdxLT: /* jump, in3 */
case OP_IdxGE: { /* jump, in3 */
int i= pOp->p1;
| | | 49428 49429 49430 49431 49432 49433 49434 49435 49436 49437 49438 49439 49440 49441 49442 |
**
** If P5 is non-zero then the key value is increased by an epsilon prior
** to the comparison. This makes the opcode work like IdxLE.
*/
case OP_IdxLT: /* jump, in3 */
case OP_IdxGE: { /* jump, in3 */
int i= pOp->p1;
VdbeCursor *pC;
assert( i>=0 && i<p->nCursor );
assert( p->apCsr[i]!=0 );
if( (pC = p->apCsr[i])->pCursor!=0 ){
int res;
UnpackedRecord r;
assert( pC->deferredMoveto==0 );
|
| ︙ | ︙ | |||
50066 50067 50068 50069 50070 50071 50072 |
/* Opcode: VOpen P1 * * P4 *
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** P1 is a cursor number. This opcode opens a cursor to the virtual
** table and stores that cursor in P1.
*/
case OP_VOpen: {
| | | 50111 50112 50113 50114 50115 50116 50117 50118 50119 50120 50121 50122 50123 50124 50125 |
/* Opcode: VOpen P1 * * P4 *
**
** P4 is a pointer to a virtual table object, an sqlite3_vtab structure.
** P1 is a cursor number. This opcode opens a cursor to the virtual
** table and stores that cursor in P1.
*/
case OP_VOpen: {
VdbeCursor *pCur = 0;
sqlite3_vtab_cursor *pVtabCursor = 0;
sqlite3_vtab *pVtab = pOp->p4.pVtab;
sqlite3_module *pModule = (sqlite3_module *)pVtab->pModule;
assert(pVtab && pModule);
if( sqlite3SafetyOff(db) ) goto abort_due_to_misuse;
|
| ︙ | ︙ | |||
50125 50126 50127 50128 50129 50130 50131 | int iQuery; const sqlite3_module *pModule; Mem *pQuery = &p->aMem[pOp->p3]; Mem *pArgc = &pQuery[1]; sqlite3_vtab_cursor *pVtabCursor; sqlite3_vtab *pVtab; | | | 50170 50171 50172 50173 50174 50175 50176 50177 50178 50179 50180 50181 50182 50183 50184 | int iQuery; const sqlite3_module *pModule; Mem *pQuery = &p->aMem[pOp->p3]; Mem *pArgc = &pQuery[1]; sqlite3_vtab_cursor *pVtabCursor; sqlite3_vtab *pVtab; VdbeCursor *pCur = p->apCsr[pOp->p1]; REGISTER_TRACE(pOp->p3, pQuery); assert( pCur->pVtabCursor ); pVtabCursor = pCur->pVtabCursor; pVtab = pVtabCursor->pVtab; pModule = pVtab->pModule; |
| ︙ | ︙ | |||
50182 50183 50184 50185 50186 50187 50188 |
** Store into register P2 the rowid of
** the virtual-table that the P1 cursor is pointing to.
*/
case OP_VRowid: { /* out2-prerelease */
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
sqlite_int64 iRow;
| | | 50227 50228 50229 50230 50231 50232 50233 50234 50235 50236 50237 50238 50239 50240 50241 |
** Store into register P2 the rowid of
** the virtual-table that the P1 cursor is pointing to.
*/
case OP_VRowid: { /* out2-prerelease */
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
sqlite_int64 iRow;
VdbeCursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
if( pCur->nullRow ){
break;
}
pVtab = pCur->pVtabCursor->pVtab;
pModule = pVtab->pModule;
|
| ︙ | ︙ | |||
50216 50217 50218 50219 50220 50221 50222 |
*/
case OP_VColumn: {
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
Mem *pDest;
sqlite3_context sContext;
| | | 50261 50262 50263 50264 50265 50266 50267 50268 50269 50270 50271 50272 50273 50274 50275 |
*/
case OP_VColumn: {
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
Mem *pDest;
sqlite3_context sContext;
VdbeCursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
assert( pOp->p3>0 && pOp->p3<=p->nMem );
pDest = &p->aMem[pOp->p3];
if( pCur->nullRow ){
sqlite3VdbeMemSetNull(pDest);
break;
}
|
| ︙ | ︙ | |||
50274 50275 50276 50277 50278 50279 50280 |
** the end of its result set, then fall through to the next instruction.
*/
case OP_VNext: { /* jump */
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
int res = 0;
| | | 50319 50320 50321 50322 50323 50324 50325 50326 50327 50328 50329 50330 50331 50332 50333 |
** the end of its result set, then fall through to the next instruction.
*/
case OP_VNext: { /* jump */
sqlite3_vtab *pVtab;
const sqlite3_module *pModule;
int res = 0;
VdbeCursor *pCur = p->apCsr[pOp->p1];
assert( pCur->pVtabCursor );
if( pCur->nullRow ){
break;
}
pVtab = pCur->pVtabCursor->pVtab;
pModule = pVtab->pModule;
assert( pModule->xNext );
|
| ︙ | ︙ | |||
51151 51152 51153 51154 51155 51156 51157 | return (pVfs->szOsFile+sizeof(JournalFile)); } #endif /************** End of journal.c *********************************************/ /************** Begin file memjournal.c **************************************/ /* | < < < < | 51196 51197 51198 51199 51200 51201 51202 51203 51204 51205 51206 51207 51208 51209 51210 | return (pVfs->szOsFile+sizeof(JournalFile)); } #endif /************** End of journal.c *********************************************/ /************** Begin file memjournal.c **************************************/ /* ** 2008 October 7 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. |
| ︙ | ︙ | |||
52713 52714 52715 52716 52717 52718 52719 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** | | | 52754 52755 52756 52757 52758 52759 52760 52761 52762 52763 52764 52765 52766 52767 52768 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains routines used for analyzing expressions and ** for generating VDBE code that evaluates expressions in SQLite. ** ** $Id: expr.c,v 1.401 2008/11/06 15:33:04 drh Exp $ */ /* ** Return the 'affinity' of the expression pExpr if any. ** ** If pExpr is a column, a reference to a column via an 'AS' alias, ** or a sub-select with a column as the return value, then the |
| ︙ | ︙ | |||
54563 54564 54565 54566 54567 54568 54569 54570 54571 54572 54573 54574 54575 54576 |
assert( to_op==OP_ToInt || aff!=SQLITE_AFF_INTEGER );
assert( to_op==OP_ToReal || aff!=SQLITE_AFF_REAL );
testcase( to_op==OP_ToText );
testcase( to_op==OP_ToBlob );
testcase( to_op==OP_ToNumeric );
testcase( to_op==OP_ToInt );
testcase( to_op==OP_ToReal );
sqlite3VdbeAddOp1(v, to_op, inReg);
testcase( usedAsColumnCache(pParse, inReg, inReg) );
sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
break;
}
#endif /* SQLITE_OMIT_CAST */
case TK_LT:
| > > > > | 54604 54605 54606 54607 54608 54609 54610 54611 54612 54613 54614 54615 54616 54617 54618 54619 54620 54621 |
assert( to_op==OP_ToInt || aff!=SQLITE_AFF_INTEGER );
assert( to_op==OP_ToReal || aff!=SQLITE_AFF_REAL );
testcase( to_op==OP_ToText );
testcase( to_op==OP_ToBlob );
testcase( to_op==OP_ToNumeric );
testcase( to_op==OP_ToInt );
testcase( to_op==OP_ToReal );
if( inReg!=target ){
sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target);
inReg = target;
}
sqlite3VdbeAddOp1(v, to_op, inReg);
testcase( usedAsColumnCache(pParse, inReg, inReg) );
sqlite3ExprCacheAffinityChange(pParse, inReg, 1);
break;
}
#endif /* SQLITE_OMIT_CAST */
case TK_LT:
|
| ︙ | ︙ | |||
56428 56429 56430 56431 56432 56433 56434 | ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code associated with the ANALYZE command. ** | | | 56473 56474 56475 56476 56477 56478 56479 56480 56481 56482 56483 56484 56485 56486 56487 | ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains code associated with the ANALYZE command. ** ** @(#) $Id: analyze.c,v 1.44 2008/11/03 20:55:07 drh Exp $ */ #ifndef SQLITE_OMIT_ANALYZE /* ** This routine generates code that opens the sqlite_stat1 table on cursor ** iStatCur. ** |
| ︙ | ︙ | |||
56502 56503 56504 56505 56506 56507 56508 | /* ** Generate code to do an analysis of all indices associated with ** a single table. */ static void analyzeOneTable( Parse *pParse, /* Parser context */ Table *pTab, /* Table whose indices are to be analyzed */ | | | | 56547 56548 56549 56550 56551 56552 56553 56554 56555 56556 56557 56558 56559 56560 56561 56562 56563 56564 56565 |
/*
** Generate code to do an analysis of all indices associated with
** a single table.
*/
static void analyzeOneTable(
Parse *pParse, /* Parser context */
Table *pTab, /* Table whose indices are to be analyzed */
int iStatCur, /* Index of VdbeCursor that writes the sqlite_stat1 table */
int iMem /* Available memory locations begin here */
){
Index *pIdx; /* An index to being analyzed */
int iIdxCur; /* Index of VdbeCursor for index being analyzed */
int nCol; /* Number of columns in the index */
Vdbe *v; /* The virtual machine being built up */
int i; /* Loop counter */
int topOfLoop; /* The top of the loop */
int endOfLoop; /* The end of the loop */
int addr; /* The address of an instruction */
int iDb; /* Index of database containing pTab */
|
| ︙ | ︙ | |||
57638 57639 57640 57641 57642 57643 57644 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** | | | 57683 57684 57685 57686 57687 57688 57689 57690 57691 57692 57693 57694 57695 57696 57697 |
** CREATE INDEX
** DROP INDEX
** creating ID lists
** BEGIN TRANSACTION
** COMMIT
** ROLLBACK
**
** $Id: build.c,v 1.500 2008/11/03 20:55:07 drh Exp $
*/
/*
** This routine is called when a new SQL statement is beginning to
** be parsed. Initialize the pParse structure as needed.
*/
SQLITE_PRIVATE void sqlite3BeginParse(Parse *pParse, int explainFlag){
|
| ︙ | ︙ | |||
60671 60672 60673 60674 60675 60676 60677 | pItem->zDatabase = sqlite3NameFromToken(db, pDatabase); pItem->iCursor = -1; pList->nSrc++; return pList; } /* | | | 60716 60717 60718 60719 60720 60721 60722 60723 60724 60725 60726 60727 60728 60729 60730 |
pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);
pItem->iCursor = -1;
pList->nSrc++;
return pList;
}
/*
** Assign VdbeCursor index numbers to all tables in a SrcList
*/
SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){
int i;
struct SrcList_item *pItem;
assert(pList || pParse->db->mallocFailed );
if( pList ){
for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
|
| ︙ | ︙ | |||
63614 63615 63616 63617 63618 63619 63620 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** | | | 63659 63660 63661 63662 63663 63664 63665 63666 63667 63668 63669 63670 63671 63672 63673 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** ** $Id: insert.c,v 1.251 2008/11/03 20:55:07 drh Exp $ */ /* ** Set P4 of the most recently inserted opcode to a column affinity ** string for index pIdx. A column affinity string has one character ** for each column in the table, according to the affinity of the column: ** |
| ︙ | ︙ | |||
64986 64987 64988 64989 64990 64991 64992 | ** for the table. Indices are opened on subsequent cursors. ** ** Return the number of indices on the table. */ SQLITE_PRIVATE int sqlite3OpenTableAndIndices( Parse *pParse, /* Parsing context */ Table *pTab, /* Table to be opened */ | | | 65031 65032 65033 65034 65035 65036 65037 65038 65039 65040 65041 65042 65043 65044 65045 |
** for the table. Indices are opened on subsequent cursors.
**
** Return the number of indices on the table.
*/
SQLITE_PRIVATE int sqlite3OpenTableAndIndices(
Parse *pParse, /* Parsing context */
Table *pTab, /* Table to be opened */
int baseCur, /* Cursor number assigned to the table */
int op /* OP_OpenRead or OP_OpenWrite */
){
int i;
int iDb;
Index *pIdx;
Vdbe *v;
|
| ︙ | ︙ | |||
75665 75666 75667 75668 75669 75670 75671 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is responsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** | | | 75710 75711 75712 75713 75714 75715 75716 75717 75718 75719 75720 75721 75722 75723 75724 | ** This module contains C code that generates VDBE code used to process ** the WHERE clause of SQL statements. This module is responsible for ** generating the code that loops through a table looking for applicable ** rows. Indices are selected and used to speed the search when doing ** so is applicable. Because this module is responsible for selecting ** indices, you might also think of this module as the "query optimizer". ** ** $Id: where.c,v 1.328 2008/11/03 09:06:06 danielk1977 Exp $ */ /* ** The number of bits in a Bitmask. "BMS" means "BitMask Size". */ #define BMS (sizeof(Bitmask)*8) |
| ︙ | ︙ | |||
78120 78121 78122 78123 78124 78125 78126 |
if( bRev ){
pTerm = pStart;
pStart = pEnd;
pEnd = pTerm;
}
if( pStart ){
Expr *pX;
| | > > > > > > > > > | > | | 78165 78166 78167 78168 78169 78170 78171 78172 78173 78174 78175 78176 78177 78178 78179 78180 78181 78182 78183 78184 78185 78186 78187 78188 78189 78190 78191 78192 78193 78194 78195 78196 78197 78198 |
if( bRev ){
pTerm = pStart;
pStart = pEnd;
pEnd = pTerm;
}
if( pStart ){
Expr *pX;
int r1;
pX = pStart->pExpr;
assert( pX!=0 );
assert( pStart->leftCursor==iCur );
/* The ForceInt instruction may modify the register that it operates
** on. For example it may replace a real value with an integer one,
** or if p3 is true it may increment the register value. For this
** reason we need to make sure that register r1 is really a newly
** allocated temporary register, and not part of the column-cache.
** For this reason we cannot use sqlite3ExprCodeTemp() here.
*/
r1 = sqlite3GetTempReg(pParse);
sqlite3ExprCode(pParse, pX->pRight, r1);
sqlite3VdbeAddOp3(v, OP_ForceInt, r1, brk,
pX->op==TK_LE || pX->op==TK_GT);
sqlite3VdbeAddOp3(v, bRev ? OP_MoveLt : OP_MoveGe, iCur, brk, r1);
VdbeComment((v, "pk"));
sqlite3ReleaseTempReg(pParse, r1);
disableTerm(pLevel, pStart);
}else{
sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, brk);
}
if( pEnd ){
Expr *pX;
pX = pEnd->pExpr;
|
| ︙ | ︙ | |||
78762 78763 78764 78765 78766 78767 78768 |
** 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[] = {
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < | | | > > > | | | | > > | | | > | > > | | > > | | < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | > | | | | | | | | | | | | | | > | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 78817 78818 78819 78820 78821 78822 78823 78824 78825 78826 78827 78828 78829 78830 78831 78832 78833 78834 78835 78836 78837 78838 78839 78840 78841 78842 78843 78844 78845 78846 78847 78848 78849 78850 78851 78852 78853 78854 78855 78856 78857 78858 78859 78860 78861 78862 78863 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 78917 78918 78919 78920 78921 78922 78923 78924 78925 78926 78927 78928 78929 78930 78931 78932 78933 78934 78935 78936 78937 78938 78939 78940 78941 78942 78943 78944 78945 78946 78947 78948 78949 78950 78951 78952 78953 78954 78955 78956 78957 78958 78959 78960 78961 78962 78963 78964 78965 78966 78967 78968 78969 78970 78971 78972 78973 78974 78975 78976 78977 78978 78979 78980 78981 78982 78983 78984 78985 78986 78987 78988 78989 78990 78991 78992 78993 78994 78995 78996 78997 78998 78999 79000 79001 79002 79003 79004 79005 79006 79007 79008 79009 79010 79011 79012 79013 79014 79015 79016 79017 79018 79019 79020 79021 79022 79023 79024 79025 79026 79027 79028 79029 79030 79031 79032 79033 79034 79035 79036 79037 79038 79039 79040 79041 79042 79043 79044 79045 79046 79047 79048 79049 79050 79051 79052 79053 79054 79055 79056 79057 79058 79059 79060 79061 79062 79063 79064 79065 79066 79067 79068 79069 79070 79071 79072 79073 79074 79075 79076 79077 79078 79079 79080 79081 79082 79083 79084 79085 79086 79087 79088 79089 79090 79091 79092 79093 79094 79095 79096 79097 79098 79099 79100 79101 79102 79103 79104 79105 79106 79107 79108 79109 79110 79111 79112 79113 79114 79115 79116 79117 79118 79119 79120 79121 79122 79123 79124 79125 79126 79127 79128 79129 79130 79131 79132 79133 79134 79135 79136 79137 79138 79139 79140 79141 79142 79143 79144 79145 79146 79147 79148 79149 79150 79151 79152 79153 79154 79155 79156 79157 79158 79159 79160 79161 79162 79163 79164 79165 79166 79167 79168 79169 79170 79171 79172 79173 79174 79175 79176 79177 79178 79179 79180 79181 79182 79183 79184 79185 79186 79187 79188 79189 79190 79191 79192 79193 79194 79195 79196 79197 79198 79199 79200 79201 79202 79203 79204 79205 79206 79207 79208 79209 79210 79211 79212 79213 79214 79215 79216 79217 79218 79219 79220 79221 79222 79223 79224 79225 79226 79227 79228 79229 79230 79231 79232 79233 79234 79235 79236 79237 79238 79239 79240 79241 79242 79243 79244 |
** 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 */ 296, 914, 120, 597, 2, 172, 425, 425, 62, 62,
/* 10 */ 62, 62, 210, 64, 64, 64, 64, 65, 65, 66,
/* 20 */ 66, 66, 67, 212, 398, 395, 432, 438, 69, 64,
/* 30 */ 64, 64, 64, 65, 65, 66, 66, 66, 67, 212,
/* 40 */ 458, 456, 327, 168, 61, 60, 301, 442, 443, 439,
/* 50 */ 439, 63, 63, 62, 62, 62, 62, 256, 64, 64,
/* 60 */ 64, 64, 65, 65, 66, 66, 66, 67, 212, 296,
/* 70 */ 498, 425, 425, 212, 427, 83, 68, 469, 70, 154,
/* 80 */ 64, 64, 64, 64, 65, 65, 66, 66, 66, 67,
/* 90 */ 212, 68, 307, 70, 154, 432, 438, 454, 214, 59,
/* 100 */ 65, 65, 66, 66, 66, 67, 212, 429, 429, 429,
/* 110 */ 497, 583, 296, 61, 60, 301, 442, 443, 439, 439,
/* 120 */ 63, 63, 62, 62, 62, 62, 321, 64, 64, 64,
/* 130 */ 64, 65, 65, 66, 66, 66, 67, 212, 432, 438,
/* 140 */ 95, 66, 66, 66, 67, 212, 403, 256, 421, 35,
/* 150 */ 57, 67, 212, 175, 417, 499, 61, 60, 301, 442,
/* 160 */ 443, 439, 439, 63, 63, 62, 62, 62, 62, 19,
/* 170 */ 64, 64, 64, 64, 65, 65, 66, 66, 66, 67,
/* 180 */ 212, 296, 225, 532, 299, 581, 109, 422, 242, 458,
/* 190 */ 416, 335, 414, 21, 502, 503, 346, 403, 527, 176,
/* 200 */ 160, 454, 214, 580, 579, 344, 500, 432, 438, 149,
/* 210 */ 150, 404, 405, 539, 514, 418, 151, 541, 8, 498,
/* 220 */ 538, 577, 578, 427, 296, 61, 60, 301, 442, 443,
/* 230 */ 439, 439, 63, 63, 62, 62, 62, 62, 196, 64,
/* 240 */ 64, 64, 64, 65, 65, 66, 66, 66, 67, 212,
/* 250 */ 432, 438, 454, 598, 398, 395, 429, 429, 429, 369,
/* 260 */ 558, 481, 404, 405, 372, 576, 213, 296, 61, 60,
/* 270 */ 301, 442, 443, 439, 439, 63, 63, 62, 62, 62,
/* 280 */ 62, 321, 64, 64, 64, 64, 65, 65, 66, 66,
/* 290 */ 66, 67, 212, 432, 438, 555, 503, 304, 557, 532,
/* 300 */ 218, 557, 552, 421, 36, 234, 397, 2, 542, 21,
/* 310 */ 540, 61, 60, 301, 442, 443, 439, 439, 63, 63,
/* 320 */ 62, 62, 62, 62, 388, 64, 64, 64, 64, 65,
/* 330 */ 65, 66, 66, 66, 67, 212, 415, 530, 85, 381,
/* 340 */ 78, 323, 296, 210, 304, 527, 493, 492, 379, 274,
/* 350 */ 273, 379, 274, 273, 347, 463, 241, 387, 268, 210,
/* 360 */ 533, 581, 210, 403, 20, 224, 144, 464, 432, 438,
/* 370 */ 485, 164, 114, 248, 349, 253, 350, 177, 554, 580,
/* 380 */ 465, 420, 331, 81, 257, 419, 61, 60, 301, 442,
/* 390 */ 443, 439, 439, 63, 63, 62, 62, 62, 62, 391,
/* 400 */ 64, 64, 64, 64, 65, 65, 66, 66, 66, 67,
/* 410 */ 212, 296, 224, 203, 249, 496, 403, 440, 837, 114,
/* 420 */ 248, 349, 253, 350, 177, 250, 321, 152, 404, 405,
/* 430 */ 321, 257, 303, 324, 155, 445, 445, 432, 438, 317,
/* 440 */ 400, 389, 213, 68, 209, 70, 154, 422, 421, 35,
/* 450 */ 393, 202, 421, 42, 481, 61, 60, 301, 442, 443,
/* 460 */ 439, 439, 63, 63, 62, 62, 62, 62, 422, 64,
/* 470 */ 64, 64, 64, 65, 65, 66, 66, 66, 67, 212,
/* 480 */ 296, 404, 405, 183, 513, 422, 351, 354, 355, 403,
/* 490 */ 77, 335, 79, 489, 216, 183, 334, 356, 351, 354,
/* 500 */ 355, 433, 434, 406, 407, 408, 432, 438, 235, 356,
/* 510 */ 386, 68, 291, 70, 154, 456, 531, 168, 198, 302,
/* 520 */ 449, 450, 436, 437, 61, 60, 301, 442, 443, 439,
/* 530 */ 439, 63, 63, 62, 62, 62, 62, 394, 64, 64,
/* 540 */ 64, 64, 65, 65, 66, 66, 66, 67, 212, 296,
/* 550 */ 321, 435, 422, 260, 404, 405, 321, 183, 153, 321,
/* 560 */ 351, 354, 355, 446, 332, 321, 595, 905, 321, 905,
/* 570 */ 1, 356, 421, 28, 403, 432, 438, 376, 421, 42,
/* 580 */ 477, 421, 35, 213, 548, 366, 548, 421, 50, 159,
/* 590 */ 421, 50, 422, 61, 60, 301, 442, 443, 439, 439,
/* 600 */ 63, 63, 62, 62, 62, 62, 592, 64, 64, 64,
/* 610 */ 64, 65, 65, 66, 66, 66, 67, 212, 296, 337,
/* 620 */ 217, 463, 256, 94, 339, 326, 449, 450, 172, 340,
/* 630 */ 425, 345, 532, 464, 312, 595, 904, 313, 904, 404,
/* 640 */ 405, 588, 21, 226, 432, 438, 465, 243, 504, 324,
/* 650 */ 322, 445, 445, 421, 3, 459, 230, 308, 505, 194,
/* 660 */ 278, 296, 61, 60, 301, 442, 443, 439, 439, 63,
/* 670 */ 63, 62, 62, 62, 62, 592, 64, 64, 64, 64,
/* 680 */ 65, 65, 66, 66, 66, 67, 212, 432, 438, 213,
/* 690 */ 179, 180, 181, 422, 324, 425, 445, 445, 281, 262,
/* 700 */ 279, 402, 194, 481, 296, 61, 60, 301, 442, 443,
/* 710 */ 439, 439, 63, 63, 62, 62, 62, 62, 377, 64,
/* 720 */ 64, 64, 64, 65, 65, 66, 66, 66, 67, 212,
/* 730 */ 432, 438, 591, 295, 115, 268, 422, 266, 211, 264,
/* 740 */ 373, 324, 246, 445, 445, 56, 256, 296, 61, 71,
/* 750 */ 301, 442, 443, 439, 439, 63, 63, 62, 62, 62,
/* 760 */ 62, 377, 64, 64, 64, 64, 65, 65, 66, 66,
/* 770 */ 66, 67, 212, 432, 438, 550, 269, 474, 18, 549,
/* 780 */ 280, 309, 343, 380, 171, 160, 256, 268, 5, 268,
/* 790 */ 296, 368, 60, 301, 442, 443, 439, 439, 63, 63,
/* 800 */ 62, 62, 62, 62, 321, 64, 64, 64, 64, 65,
/* 810 */ 65, 66, 66, 66, 67, 212, 432, 438, 403, 10,
/* 820 */ 403, 310, 268, 403, 268, 485, 421, 29, 566, 22,
/* 830 */ 568, 420, 428, 425, 376, 419, 301, 442, 443, 439,
/* 840 */ 439, 63, 63, 62, 62, 62, 62, 321, 64, 64,
/* 850 */ 64, 64, 65, 65, 66, 66, 66, 67, 212, 73,
/* 860 */ 328, 485, 4, 569, 268, 570, 300, 268, 147, 421,
/* 870 */ 24, 321, 359, 321, 325, 73, 328, 491, 4, 455,
/* 880 */ 321, 342, 300, 404, 405, 404, 405, 367, 404, 405,
/* 890 */ 325, 330, 321, 421, 33, 421, 54, 321, 425, 178,
/* 900 */ 229, 458, 421, 53, 321, 227, 321, 330, 228, 478,
/* 910 */ 165, 321, 315, 119, 421, 99, 333, 458, 321, 421,
/* 920 */ 97, 76, 75, 311, 268, 519, 421, 102, 421, 103,
/* 930 */ 74, 319, 320, 421, 108, 427, 467, 76, 75, 490,
/* 940 */ 421, 110, 452, 452, 321, 520, 74, 319, 320, 73,
/* 950 */ 328, 427, 4, 210, 298, 321, 300, 321, 156, 257,
/* 960 */ 321, 210, 185, 182, 325, 284, 421, 17, 429, 429,
/* 970 */ 429, 430, 431, 12, 593, 378, 188, 421, 100, 421,
/* 980 */ 34, 330, 421, 98, 429, 429, 429, 430, 431, 12,
/* 990 */ 475, 458, 422, 162, 480, 321, 422, 306, 231, 232,
/* 1000 */ 233, 105, 484, 632, 476, 321, 486, 447, 321, 23,
/* 1010 */ 422, 76, 75, 594, 207, 178, 286, 421, 25, 254,
/* 1020 */ 74, 319, 320, 287, 321, 427, 321, 421, 55, 321,
/* 1030 */ 421, 111, 321, 471, 321, 205, 515, 557, 511, 363,
/* 1040 */ 472, 204, 321, 516, 206, 321, 421, 112, 421, 113,
/* 1050 */ 321, 421, 26, 321, 421, 37, 421, 38, 429, 429,
/* 1060 */ 429, 430, 431, 12, 421, 27, 521, 421, 39, 321,
/* 1070 */ 298, 158, 421, 40, 255, 421, 41, 321, 483, 321,
/* 1080 */ 173, 523, 321, 182, 321, 522, 321, 384, 283, 273,
/* 1090 */ 321, 421, 43, 297, 534, 321, 476, 321, 210, 421,
/* 1100 */ 44, 421, 45, 321, 421, 30, 421, 31, 421, 46,
/* 1110 */ 508, 509, 421, 47, 259, 321, 182, 421, 48, 421,
/* 1120 */ 49, 321, 358, 390, 182, 421, 32, 321, 261, 518,
/* 1130 */ 517, 553, 561, 182, 173, 412, 191, 421, 11, 562,
/* 1140 */ 573, 92, 92, 421, 51, 590, 263, 294, 265, 421,
/* 1150 */ 52, 267, 272, 371, 146, 374, 375, 275, 276, 277,
/* 1160 */ 565, 575, 285, 288, 289, 587, 470, 451, 236, 453,
/* 1170 */ 329, 244, 473, 514, 251, 524, 560, 163, 401, 572,
/* 1180 */ 426, 525, 282, 528, 409, 7, 410, 411, 385, 318,
/* 1190 */ 85, 237, 338, 526, 84, 336, 353, 58, 80, 215,
/* 1200 */ 170, 468, 121, 86, 341, 348, 305, 501, 506, 124,
/* 1210 */ 511, 222, 360, 423, 252, 186, 512, 510, 221, 223,
/* 1220 */ 238, 507, 239, 535, 240, 292, 424, 529, 536, 537,
/* 1230 */ 293, 543, 187, 189, 245, 362, 482, 488, 247, 190,
/* 1240 */ 364, 89, 545, 192, 117, 370, 132, 556, 563, 195,
/* 1250 */ 382, 383, 314, 133, 134, 571, 138, 135, 136, 584,
/* 1260 */ 589, 585, 142, 399, 101, 413, 220, 586, 270, 104,
/* 1270 */ 141, 633, 634, 166, 167, 441, 444, 72, 460, 448,
/* 1280 */ 457, 546, 143, 157, 6, 461, 14, 479, 169, 462,
/* 1290 */ 93, 466, 82, 122, 13, 174, 487, 96, 123, 161,
/* 1300 */ 494, 495, 87, 125, 126, 116, 258, 88, 127, 184,
/* 1310 */ 250, 361, 219, 107, 544, 145, 128, 193, 365, 118,
/* 1320 */ 352, 357, 173, 271, 130, 9, 316, 559, 197, 90,
/* 1330 */ 547, 131, 129, 15, 199, 551, 564, 200, 567, 201,
/* 1340 */ 139, 137, 582, 91, 16, 106, 140, 208, 574, 392,
/* 1350 */ 396, 290, 148, 596,
};
static const YYCODETYPE yy_lookahead[] = {
/* 0 */ 16, 140, 141, 142, 143, 21, 23, 23, 69, 70,
/* 10 */ 71, 72, 110, 74, 75, 76, 77, 78, 79, 80,
/* 20 */ 81, 82, 83, 84, 1, 2, 42, 43, 73, 74,
/* 30 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
/* 40 */ 58, 162, 163, 164, 60, 61, 62, 63, 64, 65,
/* 50 */ 66, 67, 68, 69, 70, 71, 72, 148, 74, 75,
/* 60 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16,
/* 70 */ 88, 88, 88, 84, 92, 22, 219, 220, 221, 222,
/* 80 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
/* 90 */ 84, 219, 183, 221, 222, 42, 43, 78, 79, 46,
/* 100 */ 78, 79, 80, 81, 82, 83, 84, 125, 126, 127,
/* 110 */ 170, 239, 16, 60, 61, 62, 63, 64, 65, 66,
/* 120 */ 67, 68, 69, 70, 71, 72, 148, 74, 75, 76,
/* 130 */ 77, 78, 79, 80, 81, 82, 83, 84, 42, 43,
/* 140 */ 44, 80, 81, 82, 83, 84, 23, 148, 170, 171,
/* 150 */ 19, 83, 84, 156, 23, 170, 60, 61, 62, 63,
/* 160 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 19,
/* 170 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
/* 180 */ 84, 16, 183, 148, 151, 148, 21, 190, 148, 58,
/* 190 */ 169, 213, 157, 158, 186, 187, 218, 23, 177, 202,
/* 200 */ 203, 78, 79, 166, 167, 208, 161, 42, 43, 78,
/* 210 */ 79, 88, 89, 177, 178, 170, 181, 182, 68, 88,
/* 220 */ 184, 98, 99, 92, 16, 60, 61, 62, 63, 64,
/* 230 */ 65, 66, 67, 68, 69, 70, 71, 72, 22, 74,
/* 240 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
/* 250 */ 42, 43, 78, 0, 1, 2, 125, 126, 127, 226,
/* 260 */ 11, 162, 88, 89, 231, 228, 229, 16, 60, 61,
/* 270 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
/* 280 */ 72, 148, 74, 75, 76, 77, 78, 79, 80, 81,
/* 290 */ 82, 83, 84, 42, 43, 186, 187, 16, 49, 148,
/* 300 */ 201, 49, 18, 170, 171, 154, 142, 143, 157, 158,
/* 310 */ 182, 60, 61, 62, 63, 64, 65, 66, 67, 68,
/* 320 */ 69, 70, 71, 72, 91, 74, 75, 76, 77, 78,
/* 330 */ 79, 80, 81, 82, 83, 84, 168, 169, 122, 55,
/* 340 */ 132, 16, 16, 110, 16, 177, 20, 20, 99, 100,
/* 350 */ 101, 99, 100, 101, 80, 12, 223, 124, 148, 110,
/* 360 */ 182, 148, 110, 23, 19, 84, 21, 24, 42, 43,
/* 370 */ 148, 90, 91, 92, 93, 94, 95, 96, 94, 166,
/* 380 */ 37, 107, 39, 132, 103, 111, 60, 61, 62, 63,
/* 390 */ 64, 65, 66, 67, 68, 69, 70, 71, 72, 189,
/* 400 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
/* 410 */ 84, 16, 84, 156, 92, 20, 23, 92, 134, 91,
/* 420 */ 92, 93, 94, 95, 96, 103, 148, 22, 88, 89,
/* 430 */ 148, 103, 210, 106, 156, 108, 109, 42, 43, 144,
/* 440 */ 145, 228, 229, 219, 149, 221, 222, 190, 170, 171,
/* 450 */ 240, 156, 170, 171, 162, 60, 61, 62, 63, 64,
/* 460 */ 65, 66, 67, 68, 69, 70, 71, 72, 190, 74,
/* 470 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
/* 480 */ 16, 88, 89, 90, 20, 190, 93, 94, 95, 23,
/* 490 */ 131, 213, 133, 201, 212, 90, 218, 104, 93, 94,
/* 500 */ 95, 42, 43, 7, 8, 9, 42, 43, 191, 104,
/* 510 */ 215, 219, 159, 221, 222, 162, 163, 164, 156, 165,
/* 520 */ 166, 167, 63, 64, 60, 61, 62, 63, 64, 65,
/* 530 */ 66, 67, 68, 69, 70, 71, 72, 242, 74, 75,
/* 540 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16,
/* 550 */ 148, 92, 190, 20, 88, 89, 148, 90, 156, 148,
/* 560 */ 93, 94, 95, 20, 187, 148, 19, 20, 148, 22,
/* 570 */ 19, 104, 170, 171, 23, 42, 43, 148, 170, 171,
/* 580 */ 114, 170, 171, 229, 99, 100, 101, 170, 171, 148,
/* 590 */ 170, 171, 190, 60, 61, 62, 63, 64, 65, 66,
/* 600 */ 67, 68, 69, 70, 71, 72, 59, 74, 75, 76,
/* 610 */ 77, 78, 79, 80, 81, 82, 83, 84, 16, 211,
/* 620 */ 212, 12, 148, 21, 213, 165, 166, 167, 21, 148,
/* 630 */ 23, 148, 148, 24, 217, 19, 20, 217, 22, 88,
/* 640 */ 89, 157, 158, 214, 42, 43, 37, 148, 39, 106,
/* 650 */ 148, 108, 109, 170, 171, 20, 146, 183, 49, 156,
/* 660 */ 14, 16, 60, 61, 62, 63, 64, 65, 66, 67,
/* 670 */ 68, 69, 70, 71, 72, 59, 74, 75, 76, 77,
/* 680 */ 78, 79, 80, 81, 82, 83, 84, 42, 43, 229,
/* 690 */ 99, 100, 101, 190, 106, 88, 108, 109, 52, 14,
/* 700 */ 54, 148, 156, 162, 16, 60, 61, 62, 63, 64,
/* 710 */ 65, 66, 67, 68, 69, 70, 71, 72, 215, 74,
/* 720 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
/* 730 */ 42, 43, 245, 246, 148, 148, 190, 52, 193, 54,
/* 740 */ 237, 106, 201, 108, 109, 200, 148, 16, 60, 61,
/* 750 */ 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
/* 760 */ 72, 215, 74, 75, 76, 77, 78, 79, 80, 81,
/* 770 */ 82, 83, 84, 42, 43, 25, 189, 22, 232, 29,
/* 780 */ 134, 183, 16, 237, 202, 203, 148, 148, 192, 148,
/* 790 */ 16, 41, 61, 62, 63, 64, 65, 66, 67, 68,
/* 800 */ 69, 70, 71, 72, 148, 74, 75, 76, 77, 78,
/* 810 */ 79, 80, 81, 82, 83, 84, 42, 43, 23, 19,
/* 820 */ 23, 183, 148, 23, 148, 148, 170, 171, 189, 19,
/* 830 */ 189, 107, 148, 23, 148, 111, 62, 63, 64, 65,
/* 840 */ 66, 67, 68, 69, 70, 71, 72, 148, 74, 75,
/* 850 */ 76, 77, 78, 79, 80, 81, 82, 83, 84, 16,
/* 860 */ 17, 148, 19, 189, 148, 189, 23, 148, 113, 170,
/* 870 */ 171, 148, 16, 148, 31, 16, 17, 80, 19, 162,
/* 880 */ 148, 115, 23, 88, 89, 88, 89, 210, 88, 89,
/* 890 */ 31, 48, 148, 170, 171, 170, 171, 148, 88, 43,
/* 900 */ 214, 58, 170, 171, 148, 189, 148, 48, 189, 114,
/* 910 */ 19, 148, 243, 244, 170, 171, 148, 58, 148, 170,
/* 920 */ 171, 78, 79, 210, 148, 30, 170, 171, 170, 171,
/* 930 */ 87, 88, 89, 170, 171, 92, 148, 78, 79, 80,
/* 940 */ 170, 171, 125, 126, 148, 50, 87, 88, 89, 16,
/* 950 */ 17, 92, 19, 110, 98, 148, 23, 148, 156, 103,
/* 960 */ 148, 110, 156, 22, 31, 189, 170, 171, 125, 126,
/* 970 */ 127, 128, 129, 130, 20, 124, 156, 170, 171, 170,
/* 980 */ 171, 48, 170, 171, 125, 126, 127, 128, 129, 130,
/* 990 */ 204, 58, 190, 5, 148, 148, 190, 102, 10, 11,
/* 1000 */ 12, 13, 148, 112, 22, 148, 148, 20, 148, 22,
/* 1010 */ 190, 78, 79, 59, 26, 43, 28, 170, 171, 148,
/* 1020 */ 87, 88, 89, 35, 148, 92, 148, 170, 171, 148,
/* 1030 */ 170, 171, 148, 27, 148, 47, 148, 49, 97, 234,
/* 1040 */ 34, 53, 148, 179, 56, 148, 170, 171, 170, 171,
/* 1050 */ 148, 170, 171, 148, 170, 171, 170, 171, 125, 126,
/* 1060 */ 127, 128, 129, 130, 170, 171, 179, 170, 171, 148,
/* 1070 */ 98, 89, 170, 171, 148, 170, 171, 148, 20, 148,
/* 1080 */ 22, 20, 148, 22, 148, 179, 148, 99, 100, 101,
/* 1090 */ 148, 170, 171, 105, 148, 148, 114, 148, 110, 170,
/* 1100 */ 171, 170, 171, 148, 170, 171, 170, 171, 170, 171,
/* 1110 */ 7, 8, 170, 171, 20, 148, 22, 170, 171, 170,
/* 1120 */ 171, 148, 20, 135, 22, 170, 171, 148, 148, 91,
/* 1130 */ 92, 20, 20, 22, 22, 150, 233, 170, 171, 20,
/* 1140 */ 20, 22, 22, 170, 171, 20, 148, 22, 148, 170,
/* 1150 */ 171, 148, 148, 148, 192, 148, 148, 148, 148, 148,
/* 1160 */ 148, 148, 148, 148, 148, 148, 173, 230, 194, 230,
/* 1170 */ 225, 205, 173, 178, 173, 173, 195, 6, 147, 195,
/* 1180 */ 162, 162, 205, 162, 147, 22, 147, 147, 205, 155,
/* 1190 */ 122, 195, 119, 173, 120, 118, 174, 121, 131, 224,
/* 1200 */ 112, 153, 153, 98, 117, 98, 40, 172, 172, 19,
/* 1210 */ 97, 84, 15, 190, 172, 152, 172, 174, 227, 227,
/* 1220 */ 196, 180, 197, 172, 198, 175, 199, 180, 172, 172,
/* 1230 */ 175, 153, 152, 152, 206, 153, 207, 207, 206, 153,
/* 1240 */ 38, 131, 153, 152, 60, 153, 19, 185, 195, 185,
/* 1250 */ 153, 15, 153, 188, 188, 195, 185, 188, 188, 33,
/* 1260 */ 138, 153, 216, 1, 160, 20, 176, 153, 235, 176,
/* 1270 */ 216, 112, 112, 112, 112, 92, 107, 19, 11, 20,
/* 1280 */ 20, 236, 19, 19, 116, 20, 116, 114, 22, 20,
/* 1290 */ 238, 20, 22, 19, 22, 116, 115, 238, 20, 112,
/* 1300 */ 20, 20, 19, 19, 19, 32, 20, 19, 19, 96,
/* 1310 */ 103, 16, 44, 241, 17, 21, 98, 98, 36, 244,
/* 1320 */ 44, 44, 22, 134, 19, 5, 247, 1, 123, 68,
/* 1330 */ 51, 102, 45, 19, 113, 45, 1, 14, 17, 117,
/* 1340 */ 102, 113, 20, 68, 19, 14, 123, 136, 124, 57,
/* 1350 */ 3, 137, 19, 4,
};
#define YY_SHIFT_USE_DFLT (-99)
#define YY_SHIFT_MAX 396
static const short yy_shift_ofst[] = {
/* 0 */ 23, 843, 988, -16, 843, 933, 933, 393, 123, 252,
/* 10 */ -98, 96, 933, 933, 933, 933, 933, -45, 249, 174,
/* 20 */ 340, -17, 19, 19, 53, 165, 208, 251, 326, 395,
/* 30 */ 464, 533, 602, 645, 688, 645, 645, 645, 645, 645,
/* 40 */ 645, 645, 645, 645, 645, 645, 645, 645, 645, 645,
/* 50 */ 645, 645, 645, 731, 774, 774, 859, 933, 933, 933,
/* 60 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933,
/* 70 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933,
/* 80 */ 933, 933, 933, 933, 933, 933, 933, 933, 933, 933,
/* 90 */ 933, 933, 933, 933, 933, 933, 933, -61, -61, 6,
/* 100 */ 6, 281, 22, 61, 856, 284, 340, 340, 68, -17,
/* 110 */ -11, -99, -99, -99, 131, 328, 609, 609, 547, 616,
/* 120 */ 253, 607, 340, 607, 340, 340, 340, 340, 340, 340,
/* 130 */ 340, 340, 340, 340, 340, 340, 340, 340, 340, 340,
/* 140 */ 340, 233, 851, -98, -98, -98, -99, -99, -99, -18,
/* 150 */ -18, 405, 467, 327, 551, 543, 635, 343, 466, 795,
/* 160 */ 800, 797, 496, 340, 340, 274, 340, 340, 810, 340,
/* 170 */ 340, 982, 340, 340, 340, 588, 982, 340, 340, 895,
/* 180 */ 895, 895, 340, 340, 340, 588, 340, 340, 588, 340,
/* 190 */ 750, 485, 340, 340, 588, 340, 340, 340, 588, 340,
/* 200 */ 340, 340, 588, 588, 340, 340, 340, 340, 340, 345,
/* 210 */ 724, 755, -17, 817, 817, 359, 1006, 1006, 766, 1006,
/* 220 */ 972, 1006, -17, 1006, -17, 941, 216, 766, 766, 216,
/* 230 */ 1171, 1171, 1171, 1171, 1163, -98, 1068, 1073, 1074, 1077,
/* 240 */ 1076, 1067, 1088, 1088, 1105, 1087, 1105, 1087, 1107, 1107,
/* 250 */ 1166, 1107, 1113, 1107, 1190, 1127, 1127, 1166, 1107, 1107,
/* 260 */ 1107, 1190, 1197, 1088, 1197, 1088, 1197, 1088, 1088, 1202,
/* 270 */ 1110, 1197, 1088, 1184, 1184, 1227, 1068, 1088, 1236, 1236,
/* 280 */ 1236, 1236, 1068, 1184, 1227, 1088, 1226, 1226, 1088, 1088,
/* 290 */ 1122, -99, -99, -99, -99, -99, 459, 646, 591, 685,
/* 300 */ 891, 325, 987, 1058, 322, 1103, 1038, 1061, 1094, 1102,
/* 310 */ 1111, 1112, 1119, 1120, 150, 1125, 954, 1262, 1245, 1159,
/* 320 */ 1160, 1161, 1162, 1183, 1169, 1258, 1259, 1260, 1263, 1267,
/* 330 */ 1264, 1265, 1266, 1269, 1271, 1270, 1168, 1272, 1170, 1270,
/* 340 */ 1173, 1274, 1179, 1181, 1278, 1187, 1280, 1281, 1273, 1268,
/* 350 */ 1283, 1276, 1284, 1286, 1285, 1288, 1277, 1289, 1213, 1207,
/* 360 */ 1295, 1297, 1294, 1218, 1282, 1279, 1287, 1300, 1290, 1189,
/* 370 */ 1219, 1305, 1320, 1326, 1229, 1261, 1275, 1205, 1314, 1221,
/* 380 */ 1335, 1323, 1222, 1321, 1228, 1238, 1223, 1325, 1224, 1322,
/* 390 */ 1331, 1292, 1211, 1214, 1333, 1347, 1349,
};
#define YY_REDUCE_USE_DFLT (-144)
#define YY_REDUCE_MAX 295
static const short yy_reduce_ofst[] = {
/* 0 */ -139, 278, 295, 292, 402, -22, 408, 35, 37, 546,
/* 10 */ -3, -128, 133, 282, 411, 417, 420, -143, 503, 213,
/* 20 */ 151, 353, 354, 460, 224, 224, 224, 224, 224, 224,
/* 30 */ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
/* 40 */ 224, 224, 224, 224, 224, 224, 224, 224, 224, 224,
/* 50 */ 224, 224, 224, 224, 224, 224, 483, 656, 699, 723,
/* 60 */ 725, 732, 744, 749, 756, 758, 763, 770, 796, 807,
/* 70 */ 809, 812, 847, 857, 860, 876, 878, 881, 884, 886,
/* 80 */ 894, 897, 902, 905, 921, 929, 931, 934, 936, 938,
/* 90 */ 942, 947, 949, 955, 967, 973, 979, 224, 224, 224,
/* 100 */ 224, 168, 224, 224, 36, 33, 210, 484, 224, -121,
/* 110 */ 224, 224, 224, 224, 45, 21, 8, 109, 487, 487,
/* 120 */ 164, 99, 222, 541, -91, -1, 474, 598, 587, 677,
/* 130 */ 638, 429, 713, 639, 641, 674, 676, 716, 719, 686,
/* 140 */ 776, 257, 362, 802, 806, 820, 545, 582, 669, -60,
/* 150 */ -15, 128, 178, 317, 40, 317, 317, 377, 441, 481,
/* 160 */ 499, 502, 510, 553, 586, 596, 502, 684, 717, 768,
/* 170 */ 788, 786, 846, 854, 858, 317, 786, 871, 888, 864,
/* 180 */ 887, 906, 926, 946, 980, 317, 998, 1000, 317, 1003,
/* 190 */ 903, 805, 1004, 1005, 317, 1007, 1008, 1009, 317, 1010,
/* 200 */ 1011, 1012, 317, 317, 1013, 1014, 1015, 1016, 1017, 985,
/* 210 */ 962, 974, 1018, 937, 939, 945, 993, 999, 966, 1001,
/* 220 */ 995, 1002, 1019, 1020, 1021, 1022, 981, 977, 983, 984,
/* 230 */ 1031, 1037, 1039, 1040, 1034, 1023, 996, 1024, 1025, 1026,
/* 240 */ 1027, 975, 1048, 1049, 1028, 1029, 1032, 1030, 1035, 1036,
/* 250 */ 1041, 1042, 1043, 1044, 1050, 991, 992, 1047, 1051, 1056,
/* 260 */ 1057, 1055, 1063, 1078, 1080, 1082, 1081, 1086, 1089, 1033,
/* 270 */ 1045, 1091, 1092, 1062, 1064, 1046, 1053, 1097, 1065, 1066,
/* 280 */ 1069, 1070, 1060, 1071, 1054, 1099, 1052, 1059, 1108, 1114,
/* 290 */ 1072, 1104, 1090, 1093, 1075, 1079,
};
static const YYACTIONTYPE yy_default[] = {
/* 0 */ 603, 832, 913, 719, 913, 832, 913, 913, 859, 913,
/* 10 */ 723, 888, 830, 913, 913, 913, 913, 804, 913, 859,
/* 20 */ 913, 635, 859, 859, 755, 913, 913, 913, 913, 913,
/* 30 */ 913, 913, 913, 756, 913, 834, 829, 825, 827, 826,
/* 40 */ 833, 757, 746, 753, 760, 735, 872, 762, 763, 769,
/* 50 */ 770, 889, 887, 792, 791, 810, 913, 913, 913, 913,
/* 60 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 70 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 80 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 90 */ 913, 913, 913, 913, 913, 913, 913, 794, 816, 793,
/* 100 */ 803, 628, 795, 796, 688, 623, 913, 913, 797, 913,
/* 110 */ 798, 811, 812, 813, 913, 913, 913, 913, 913, 913,
/* 120 */ 603, 719, 913, 719, 913, 913, 913, 913, 913, 913,
/* 130 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 140 */ 913, 913, 913, 913, 913, 913, 713, 723, 906, 913,
/* 150 */ 913, 679, 913, 913, 913, 913, 913, 913, 913, 913,
/* 160 */ 913, 913, 611, 609, 913, 711, 913, 913, 637, 913,
/* 170 */ 913, 721, 913, 913, 913, 726, 727, 913, 913, 913,
/* 180 */ 913, 913, 913, 913, 913, 625, 913, 913, 700, 913,
/* 190 */ 865, 913, 913, 913, 879, 913, 913, 913, 877, 913,
/* 200 */ 913, 913, 702, 765, 845, 913, 892, 894, 913, 913,
/* 210 */ 711, 720, 913, 913, 913, 828, 749, 749, 737, 749,
/* 220 */ 658, 749, 913, 749, 913, 661, 759, 737, 737, 759,
/* 230 */ 608, 608, 608, 608, 678, 913, 759, 750, 752, 742,
/* 240 */ 754, 913, 728, 728, 736, 741, 736, 741, 690, 690,
/* 250 */ 675, 690, 661, 690, 838, 842, 842, 675, 690, 690,
/* 260 */ 690, 838, 620, 728, 620, 728, 620, 728, 728, 869,
/* 270 */ 871, 620, 728, 692, 692, 771, 759, 728, 699, 699,
/* 280 */ 699, 699, 759, 692, 771, 728, 891, 891, 728, 728,
/* 290 */ 899, 645, 663, 663, 906, 911, 913, 913, 913, 913,
/* 300 */ 778, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 310 */ 913, 913, 913, 913, 852, 913, 913, 913, 913, 783,
/* 320 */ 779, 913, 780, 913, 705, 913, 913, 913, 913, 913,
/* 330 */ 913, 913, 913, 913, 913, 831, 913, 743, 913, 751,
/* 340 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 350 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 360 */ 913, 913, 913, 913, 913, 913, 867, 868, 913, 913,
/* 370 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 380 */ 913, 913, 913, 913, 913, 913, 913, 913, 913, 913,
/* 390 */ 913, 898, 913, 913, 901, 604, 913, 599, 601, 602,
/* 400 */ 606, 607, 610, 632, 633, 634, 612, 613, 614, 615,
/* 410 */ 616, 617, 618, 624, 626, 644, 646, 630, 648, 709,
/* 420 */ 710, 775, 703, 704, 708, 631, 786, 777, 781, 782,
/* 430 */ 784, 785, 799, 800, 802, 808, 815, 818, 801, 806,
/* 440 */ 807, 809, 814, 817, 706, 707, 821, 638, 639, 642,
/* 450 */ 643, 855, 857, 856, 858, 641, 640, 787, 790, 823,
/* 460 */ 824, 880, 881, 882, 883, 884, 819, 729, 822, 805,
/* 470 */ 744, 747, 748, 745, 712, 722, 731, 732, 733, 734,
/* 480 */ 717, 718, 724, 740, 773, 774, 738, 739, 725, 714,
/* 490 */ 715, 716, 820, 776, 788, 789, 649, 650, 783, 651,
/* 500 */ 652, 653, 691, 694, 695, 696, 654, 673, 676, 677,
/* 510 */ 655, 662, 656, 657, 664, 665, 666, 669, 670, 671,
/* 520 */ 672, 667, 668, 839, 840, 843, 841, 659, 660, 674,
/* 530 */ 647, 636, 629, 680, 683, 684, 685, 686, 687, 689,
/* 540 */ 681, 682, 627, 619, 621, 730, 861, 870, 866, 862,
/* 550 */ 863, 864, 622, 835, 836, 693, 767, 768, 860, 873,
/* 560 */ 875, 772, 876, 878, 874, 903, 697, 698, 701, 844,
/* 570 */ 885, 758, 761, 764, 766, 846, 847, 848, 849, 850,
/* 580 */ 853, 854, 851, 886, 890, 893, 895, 896, 897, 900,
/* 590 */ 902, 907, 908, 909, 912, 910, 605, 600,
};
#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.
|
| ︙ | ︙ | |||
81854 81855 81856 81857 81858 81859 81860 |
"ENAMEBETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATE"
"DETACHIMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMIT"
"WHENWHEREPLACEAFTERESTRICTANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT"
"CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILFROM"
"FULLGLOBYIFINTOFFSETISNULLORDERIGHTOUTEROLLBACKROWUNIONUSINGVACUUM"
"VIEWINITIALLY";
static const unsigned char aHash[127] = {
| | | | | | | | | | | 81909 81910 81911 81912 81913 81914 81915 81916 81917 81918 81919 81920 81921 81922 81923 81924 81925 81926 81927 81928 81929 81930 81931 81932 81933 81934 81935 81936 81937 81938 81939 81940 81941 81942 81943 81944 81945 81946 81947 81948 81949 81950 81951 81952 |
"ENAMEBETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATE"
"DETACHIMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMIT"
"WHENWHEREPLACEAFTERESTRICTANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT"
"CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAILFROM"
"FULLGLOBYIFINTOFFSETISNULLORDERIGHTOUTEROLLBACKROWUNIONUSINGVACUUM"
"VIEWINITIALLY";
static const unsigned char aHash[127] = {
65, 94, 110, 63, 0, 44, 0, 0, 71, 0, 66, 0, 0,
104, 12, 67, 15, 0, 108, 74, 105, 101, 0, 19, 0, 0,
114, 0, 112, 78, 0, 22, 82, 0, 9, 0, 0, 59, 60,
0, 58, 6, 0, 39, 79, 91, 0, 111, 90, 0, 0, 45,
0, 92, 24, 0, 17, 0, 115, 40, 23, 0, 5, 99, 25,
85, 0, 0, 117, 95, 50, 116, 47, 7, 42, 0, 80, 0,
89, 26, 0, 88, 0, 0, 0, 84, 81, 86, 77, 98, 14,
34, 97, 0, 70, 0, 18, 76, 100, 31, 0, 113, 69, 106,
52, 46, 73, 0, 0, 83, 102, 0, 109, 0, 35, 0, 0,
28, 0, 75, 48, 53, 0, 20, 51, 0, 43,
};
static const unsigned char aNext[117] = {
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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 38, 0, 32, 21, 0, 0, 0, 0, 29, 0,
0, 37, 0, 0, 0, 1, 55, 0, 0, 56, 0, 0, 0,
0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 0, 30, 0,
16, 33, 10, 0, 0, 0, 0, 0, 0, 0, 11, 61, 68,
0, 8, 0, 93, 87, 0, 96, 0, 49, 0, 0, 64, 0,
41, 103, 0, 27, 107, 36, 62, 72, 0, 0, 57, 0, 0,
};
static const unsigned char aLen[117] = {
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, 2, 7, 5, 5, 9, 6, 10, 9, 7, 10, 6, 5,
6, 6, 5, 6, 4, 9, 2, 5, 5, 6, 7, 7, 3,
4, 4, 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6,
5, 4, 7, 6, 5, 6, 7, 5, 4, 5, 7, 5, 8,
3, 7, 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7,
8, 8, 2, 4, 4, 4, 4, 4, 2, 2, 4, 6, 2,
3, 6, 5, 5, 5, 8, 3, 5, 5, 6, 4, 9, 3,
};
static const unsigned short int aOffset[117] = {
0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
86, 95, 96, 101, 105, 109, 117, 123, 130, 138, 144, 154, 157,
|
| ︙ | ︙ | |||
81909 81910 81911 81912 81913 81914 81915 |
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
TK_EXCEPT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER,
TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_CONSTRAINT, TK_INTERSECT,
TK_TRIGGER, TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_ATTACH,
TK_HAVING, TK_GROUP, TK_UPDATE, TK_TEMP, TK_TEMP,
TK_OR, TK_BEGIN, TK_JOIN_KW, TK_RENAME, TK_BETWEEN,
| | | 81964 81965 81966 81967 81968 81969 81970 81971 81972 81973 81974 81975 81976 81977 81978 |
TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
TK_EXCEPT, TK_TRANSACTION,TK_ON, TK_JOIN_KW, TK_ALTER,
TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_CONSTRAINT, TK_INTERSECT,
TK_TRIGGER, TK_REFERENCES, TK_UNIQUE, TK_QUERY, TK_ATTACH,
TK_HAVING, TK_GROUP, TK_UPDATE, TK_TEMP, TK_TEMP,
TK_OR, TK_BEGIN, TK_JOIN_KW, TK_RENAME, TK_BETWEEN,
TK_NOTNULL, TK_NOT, 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_REPLACE, TK_AFTER, TK_RESTRICT, TK_AND, TK_DEFAULT,
TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, TK_COLUMNKW,
TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, TK_CTIME_KW,
|
| ︙ | ︙ | |||
82688 82689 82690 82691 82692 82693 82694 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** | | | 82743 82744 82745 82746 82747 82748 82749 82750 82751 82752 82753 82754 82755 82756 82757 | ** ************************************************************************* ** Main file for the SQLite library. The routines in this file ** implement the programmer interface to the library. Routines in ** other files are for internal use by SQLite and should not be ** accessed by users of the library. ** ** $Id: main.c,v 1.510 2008/11/04 13:46:28 drh Exp $ */ #ifdef SQLITE_ENABLE_FTS3 /************** Include fts3.h in the middle of main.c ***********************/ /************** Begin file fts3.h ********************************************/ /* ** 2006 Oct 10 |
| ︙ | ︙ | |||
83174 83175 83176 83177 83178 83179 83180 83181 83182 83183 83184 83185 83186 83187 |
db->lookaside.bEnabled = 1;
}else{
db->lookaside.pEnd = 0;
db->lookaside.bEnabled = 0;
}
return SQLITE_OK;
}
/*
** Configuration settings for an individual database connection
*/
SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
va_list ap;
int rc;
| > > > > > > > | 83229 83230 83231 83232 83233 83234 83235 83236 83237 83238 83239 83240 83241 83242 83243 83244 83245 83246 83247 83248 83249 |
db->lookaside.bEnabled = 1;
}else{
db->lookaside.pEnd = 0;
db->lookaside.bEnabled = 0;
}
return SQLITE_OK;
}
/*
** Return the mutex associated with a database connection.
*/
SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){
return db->mutex;
}
/*
** Configuration settings for an individual database connection
*/
SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
va_list ap;
int rc;
|
| ︙ | ︙ |
Changes to src/sqlite3.h.
| ︙ | ︙ | |||
26 27 28 29 30 31 32 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** on how SQLite interfaces are suppose to operate. ** ** The name of this file under configuration management is "sqlite.h.in". ** The makefile makes some minor changes to this file (such as inserting ** the version number) and changes its name to "sqlite3.h" as ** part of the build process. ** ** @(#) $Id: sqlite.h.in,v 1.409 2008/11/07 00:06:18 drh Exp $ */ #ifndef _SQLITE3_H_ #define _SQLITE3_H_ #include <stdarg.h> /* Needed for the definition of va_list */ /* ** Make sure we can call this stuff from C++. |
| ︙ | ︙ | |||
678 679 680 681 682 683 684 685 686 687 688 689 690 691 |
** are aligned to an address which is an integer multiple of
** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
int iVersion;
int (*xClose)(sqlite3_file*);
int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
| > > > > > > | 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 |
** are aligned to an address which is an integer multiple of
** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means
** that when data is appended to a file, the data is appended
** first then the size of the file is extended, never the other
** way around. The SQLITE_IOCAP_SEQUENTIAL property means that
** information is written to disk in the same order as calls
** to xWrite().
**
** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill
** in the unread portions of the buffer with zeros. A VFS that
** fails to zero-fill short reads might seem to work. However,
** failure to zero-fill short reads will eventually lead to
** database corruption.
*/
typedef struct sqlite3_io_methods sqlite3_io_methods;
struct sqlite3_io_methods {
int iVersion;
int (*xClose)(sqlite3_file*);
int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst);
int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst);
|
| ︙ | ︙ | |||
2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 | ** ** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. ** ** INVARIANTS: ** | > > > > > > > > > > | 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 | ** ** The sqlite3_errmsg() and sqlite3_errmsg16() return English-language ** text that describes the error, as either UTF-8 or UTF-16 respectively. ** Memory to hold the error message string is managed internally. ** The application does not need to worry about freeing the result. ** However, the error string might be overwritten or deallocated by ** subsequent calls to other SQLite interface functions. ** ** When the serialized [threading mode] is in use, it might be the ** case that a second error occurs on a separate thread in between ** the time of the first error and the call to these interfaces. ** When that happens, the second error will be reported since these ** interfaces always report the most recent result. To avoid ** this, each thread can obtain exclusive use of the [database connection] D ** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning ** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after ** all calls to the interfaces listed here are completed. ** ** If an interface fails with SQLITE_MISUSE, that means the interface ** was invoked incorrectly by the application. In that case, the ** error code and message may or may not be set. ** ** INVARIANTS: ** |
| ︙ | ︙ | |||
6255 6256 6257 6258 6259 6260 6261 6262 6263 6264 6265 6266 6267 6268 |
#define SQLITE_MUTEX_STATIC_MASTER 2
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2 4 /* sqlite3_release_memory() */
#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
/*
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
**
** {H11301} The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. {H11302} The
** name of the database is the name assigned to the database by the
| > > > > > > > > > > > | 6271 6272 6273 6274 6275 6276 6277 6278 6279 6280 6281 6282 6283 6284 6285 6286 6287 6288 6289 6290 6291 6292 6293 6294 6295 |
#define SQLITE_MUTEX_STATIC_MASTER 2
#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */
#define SQLITE_MUTEX_STATIC_MEM2 4 /* sqlite3_release_memory() */
#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */
#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */
#define SQLITE_MUTEX_STATIC_LRU2 7 /* lru page list */
/*
** CAPI3REF: Retrieve the mutex for a database connection {H17002} <H17000>
**
** This interface returns a pointer the [sqlite3_mutex] object that
** serializes access to the [database connection] given in the argument
** when the [threading mode] is Serialized.
** If the [threading mode] is Single-thread or Multi-thread then this
** routine returns a NULL pointer.
*/
sqlite3_mutex *sqlite3_db_mutex(sqlite3*);
/*
** CAPI3REF: Low-Level Control Of Database Files {H11300} <S30800>
**
** {H11301} The [sqlite3_file_control()] interface makes a direct call to the
** xFileControl method for the [sqlite3_io_methods] object associated
** with a particular database identified by the second argument. {H11302} The
** name of the database is the name assigned to the database by the
|
| ︙ | ︙ |