Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the SQLite core to version 3.6.12. |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c3a3dfe2cb37da2fb64e245d88c6b603 |
User & Date: | drh 2009-03-31 13:02:08.000 |
Context
2009-05-06
| ||
16:58 | Update the SQLite build to version 3.6.14. check-in: e6cd5e74a2 user: drh tags: trunk | |
2009-03-31
| ||
13:02 | Update the SQLite core to version 3.6.12. check-in: c3a3dfe2cb user: drh tags: trunk | |
2009-03-23
| ||
15:27 | Update the SQLite amalgamation to the latest code from CVS. check-in: 73f66663ec user: drh tags: trunk | |
Changes
Changes to src/sqlite3.c.
︙ | ︙ | |||
13 14 15 16 17 18 19 | ** the "sqlite3.h" header file at hand, you will find a copy in the first ** 5487 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. ** | | | 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | ** the "sqlite3.h" header file at hand, you will find a copy in the first ** 5487 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 2009-03-31 13:00:09 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.848 2009/03/25 16:51:43 drh Exp $ */ #ifndef _SQLITEINT_H_ #define _SQLITEINT_H_ /* ** Include the configuration header output by 'configure' if we're using the ** autoconf-based build |
︙ | ︙ | |||
6095 6096 6097 6098 6099 6100 6101 | #define TK_EXCLUSIVE 9 #define TK_COMMIT 10 #define TK_END 11 #define TK_ROLLBACK 12 #define TK_SAVEPOINT 13 #define TK_RELEASE 14 #define TK_TO 15 | < | > | 6095 6096 6097 6098 6099 6100 6101 6102 6103 6104 6105 6106 6107 6108 6109 6110 | #define TK_EXCLUSIVE 9 #define TK_COMMIT 10 #define TK_END 11 #define TK_ROLLBACK 12 #define TK_SAVEPOINT 13 #define TK_RELEASE 14 #define TK_TO 15 #define TK_TABLE 16 #define TK_CREATE 17 #define TK_IF 18 #define TK_NOT 19 #define TK_EXISTS 20 #define TK_TEMP 21 #define TK_LP 22 #define TK_RP 23 #define TK_AS 24 |
︙ | ︙ | |||
6406 6407 6408 6409 6410 6411 6412 | #define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) /* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. */ | | > > > > > | 6406 6407 6408 6409 6410 6411 6412 6413 6414 6415 6416 6417 6418 6419 6420 6421 6422 6423 6424 6425 | #define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) #define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) /* ** Round up a number to the next larger multiple of 8. This is used ** to force 8-byte alignment on 64-bit architectures. */ #define ROUND8(x) (((x)+7)&~7) /* ** Round down to the nearest multiple of 8 */ #define ROUNDDOWN8(x) ((x)&~7) /* ** An instance of the following structure is used to store the busy-handler ** callback for a given sqlite handle. ** ** The sqlite.busyHandler member of the sqlite struct contains the busy ** callback for the database handle. Each pager opened via the sqlite |
︙ | ︙ | |||
7941 7942 7943 7944 7945 7946 7947 7948 7949 7950 | ** (approx 10%) by avoiding numerous malloc/free requests while parsing ** SQL statements. ** ** The Lookaside structure holds configuration information about the ** lookaside malloc subsystem. Each available memory allocation in ** the lookaside subsystem is stored on a linked list of LookasideSlot ** objects. */ struct Lookaside { u16 sz; /* Size of each buffer in bytes */ | > > > > > > > | | 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 | ** (approx 10%) by avoiding numerous malloc/free requests while parsing ** SQL statements. ** ** The Lookaside structure holds configuration information about the ** lookaside malloc subsystem. Each available memory allocation in ** the lookaside subsystem is stored on a linked list of LookasideSlot ** objects. ** ** Lookaside allocations are only allowed for objects that are associated ** with a particular database connection. Hence, schema information cannot ** be stored in lookaside because in shared cache mode the schema information ** is shared by multiple database connections. Therefore, while parsing ** schema information, the Lookaside.bEnabled flag is cleared so that ** lookaside allocations are not used to construct the schema objects. */ struct Lookaside { u16 sz; /* Size of each buffer in bytes */ u8 bEnabled; /* False to disable new lookaside allocations */ u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ int nOut; /* Number of buffers currently checked out */ int mxOut; /* Highwater mark for nOut */ LookasideSlot *pFree; /* List of available buffers */ void *pStart; /* First byte of available memory space */ void *pEnd; /* First byte past end of available space */ }; |
︙ | ︙ | |||
8360 8361 8362 8363 8364 8365 8366 | ** when the VDBE cursor to the table is closed. In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root ** page number. Transient tables are used to hold the results of a ** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement. */ struct Table { | | | 8372 8373 8374 8375 8376 8377 8378 8379 8380 8381 8382 8383 8384 8385 8386 | ** when the VDBE cursor to the table is closed. In this case Table.tnum ** refers VDBE cursor number that holds the table open, not to the root ** page number. Transient tables are used to hold the results of a ** sub-query that appears instead of a real table name in the FROM clause ** of a SELECT statement. */ struct Table { sqlite3 *dbMem; /* DB connection used for lookaside allocations. */ char *zName; /* Name of the table or view */ int iPKey; /* If not negative, use aCol[iPKey] as the primary key */ int nCol; /* Number of columns in this table */ Column *aCol; /* Information about each column */ Index *pIndex; /* List of SQL indexes on this table. */ int tnum; /* Root BTree node for this table (see note above) */ Select *pSelect; /* NULL for tables. Points to definition if a view. */ |
︙ | ︙ | |||
8706 8707 8708 8709 8710 8711 8712 | ** If the EP_TokenOnly flag is set in Expr.flags, then only EXPR_TOKENONLYSIZE ** bytes of space are allocated for the expression structure. This is enough ** space to store all fields up to and including the "Token token;" field. */ struct Expr { u8 op; /* Operation performed by this node */ char affinity; /* The affinity of the column or 0 if not a column */ | > | | 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 | ** If the EP_TokenOnly flag is set in Expr.flags, then only EXPR_TOKENONLYSIZE ** bytes of space are allocated for the expression structure. This is enough ** space to store all fields up to and including the "Token token;" field. */ struct Expr { u8 op; /* Operation performed by this node */ char affinity; /* The affinity of the column or 0 if not a column */ VVA_ONLY(u8 vvaFlags;) /* Flags used for VV&A only. EVVA_* below. */ u16 flags; /* Various flags. EP_* See below */ Token token; /* An operand token */ /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no ** space is allocated for the fields below this point. An attempt to ** access them will result in a segfault or malfunction. *********************************************************************/ |
︙ | ︙ | |||
8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 | #define EP_IntValue 0x0800 /* Integer value contained in iTable */ #define EP_xIsSelect 0x1000 /* x.pSelect is valid (otherwise x.pList is) */ #define EP_Reduced 0x2000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ #define EP_TokenOnly 0x4000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ #define EP_SpanOnly 0x8000 /* Expr struct is EXPR_SPANONLYSIZE bytes only */ /* ** These macros can be used to test, set, or clear bits in the ** Expr.flags field. */ #define ExprHasProperty(E,P) (((E)->flags&(P))==(P)) #define ExprHasAnyProperty(E,P) (((E)->flags&(P))!=0) #define ExprSetProperty(E,P) (E)->flags|=(P) | > > > > > > > > > | 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 8799 8800 8801 | #define EP_IntValue 0x0800 /* Integer value contained in iTable */ #define EP_xIsSelect 0x1000 /* x.pSelect is valid (otherwise x.pList is) */ #define EP_Reduced 0x2000 /* Expr struct is EXPR_REDUCEDSIZE bytes only */ #define EP_TokenOnly 0x4000 /* Expr struct is EXPR_TOKENONLYSIZE bytes only */ #define EP_SpanOnly 0x8000 /* Expr struct is EXPR_SPANONLYSIZE bytes only */ /* ** The following are the meanings of bits in the Expr.vvaFlags field. ** This information is only used when SQLite is compiled with ** SQLITE_DEBUG defined. */ #ifndef NDEBUG #define EVVA_ReadOnlyToken 0x01 /* Expr.token.z is read-only */ #endif /* ** These macros can be used to test, set, or clear bits in the ** Expr.flags field. */ #define ExprHasProperty(E,P) (((E)->flags&(P))==(P)) #define ExprHasAnyProperty(E,P) (((E)->flags&(P))!=0) #define ExprSetProperty(E,P) (E)->flags|=(P) |
︙ | ︙ | |||
9578 9579 9580 9581 9582 9583 9584 | #if defined(SQLITE_TEST) SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*); #endif SQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*, ...); SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ErrorClear(Parse*); SQLITE_PRIVATE void sqlite3Dequote(char*); | | | 9600 9601 9602 9603 9604 9605 9606 9607 9608 9609 9610 9611 9612 9613 9614 | #if defined(SQLITE_TEST) SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*); #endif SQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*, ...); SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...); SQLITE_PRIVATE void sqlite3ErrorClear(Parse*); SQLITE_PRIVATE void sqlite3Dequote(char*); SQLITE_PRIVATE void sqlite3DequoteExpr(Expr*); SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **); SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int); SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int); |
︙ | ︙ | |||
9721 9722 9723 9724 9725 9726 9727 | SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int); SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int, int*,int,int,int,int); SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int); SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, int); SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int); SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int); | | | 9743 9744 9745 9746 9747 9748 9749 9750 9751 9752 9753 9754 9755 9756 9757 | SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int); SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int,int, int*,int,int,int,int); SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*, Table*, int, int, int*, int, int, int); SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, int); SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int); SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int); SQLITE_PRIVATE void sqlite3TokenCopy(sqlite3*,Token*,const Token*); SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,IdList*); SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,Select*,int); SQLITE_PRIVATE void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*); SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,int); SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(sqlite3*); |
︙ | ︙ | |||
11503 11504 11505 11506 11507 11508 11509 | ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. ** | | | 11525 11526 11527 11528 11529 11530 11531 11532 11533 11534 11535 11536 11537 11538 11539 | ** May you share freely, never taking more than you give. ** ****************************************************************************** ** ** This file contains OS interface code that is common to all ** architectures. ** ** $Id: os.c,v 1.126 2009/03/25 14:24:42 drh Exp $ */ #define _SQLITE_OS_C_ 1 #undef _SQLITE_OS_C_ /* ** The default SQLite sqlite3_vfs implementations do not allocate ** memory (actually, os_unix.c allocates a small amount of memory |
︙ | ︙ | |||
11601 11602 11603 11604 11605 11606 11607 11608 | SQLITE_PRIVATE int sqlite3OsOpen( sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile, int flags, int *pFlagsOut ){ DO_OS_MALLOC_TEST; | > | > > | 11623 11624 11625 11626 11627 11628 11629 11630 11631 11632 11633 11634 11635 11636 11637 11638 11639 11640 11641 | SQLITE_PRIVATE int sqlite3OsOpen( sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile, int flags, int *pFlagsOut ){ int rc; DO_OS_MALLOC_TEST; rc = pVfs->xOpen(pVfs, zPath, pFile, flags, pFlagsOut); assert( rc==SQLITE_OK || pFile->pMethods==0 ); return rc; } SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ return pVfs->xDelete(pVfs, zPath, dirSync); } SQLITE_PRIVATE int sqlite3OsAccess( sqlite3_vfs *pVfs, const char *zPath, |
︙ | ︙ | |||
11943 11944 11945 11946 11947 11948 11949 | ** This file contains low-level memory allocation drivers for when ** SQLite will use the standard C-library malloc/realloc/free interface ** to obtain the memory it needs. ** ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. ** | | | | 11968 11969 11970 11971 11972 11973 11974 11975 11976 11977 11978 11979 11980 11981 11982 11983 11984 11985 11986 11987 11988 11989 11990 11991 11992 11993 11994 11995 11996 11997 11998 11999 12000 12001 12002 12003 | ** This file contains low-level memory allocation drivers for when ** SQLite will use the standard C-library malloc/realloc/free interface ** to obtain the memory it needs. ** ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. ** ** $Id: mem1.c,v 1.30 2009/03/23 04:33:33 danielk1977 Exp $ */ /* ** This version of the memory allocator is the default. It is ** used when no other memory allocator is specified using compile-time ** macros. */ #ifdef SQLITE_SYSTEM_MALLOC /* ** Like malloc(), but remember the size of the allocation ** so that we can find it later using sqlite3MemSize(). ** ** For this low-level routine, we are guaranteed that nByte>0 because ** cases of nByte<=0 will be intercepted and dealt with by higher level ** routines. */ static void *sqlite3MemMalloc(int nByte){ sqlite3_int64 *p; assert( nByte>0 ); nByte = ROUND8(nByte); p = malloc( nByte+8 ); if( p ){ p[0] = nByte; p++; } return (void *)p; } |
︙ | ︙ | |||
12001 12002 12003 12004 12005 12006 12007 | ** redirected to xMalloc. Similarly, we know that nByte>0 becauses ** cases where nByte<=0 will have been intercepted by higher-level ** routines and redirected to xFree. */ static void *sqlite3MemRealloc(void *pPrior, int nByte){ sqlite3_int64 *p = (sqlite3_int64*)pPrior; assert( pPrior!=0 && nByte>0 ); | | | 12026 12027 12028 12029 12030 12031 12032 12033 12034 12035 12036 12037 12038 12039 12040 | ** redirected to xMalloc. Similarly, we know that nByte>0 becauses ** cases where nByte<=0 will have been intercepted by higher-level ** routines and redirected to xFree. */ static void *sqlite3MemRealloc(void *pPrior, int nByte){ sqlite3_int64 *p = (sqlite3_int64*)pPrior; assert( pPrior!=0 && nByte>0 ); nByte = ROUND8(nByte); p = (sqlite3_int64*)pPrior; p--; p = realloc(p, nByte+8 ); if( p ){ p[0] = nByte; p++; } |
︙ | ︙ | |||
12028 12029 12030 12031 12032 12033 12034 | return (int)p[0]; } /* ** Round up a request size to the next valid allocation size. */ static int sqlite3MemRoundup(int n){ | | | 12053 12054 12055 12056 12057 12058 12059 12060 12061 12062 12063 12064 12065 12066 12067 | return (int)p[0]; } /* ** Round up a request size to the next valid allocation size. */ static int sqlite3MemRoundup(int n){ return ROUND8(n); } /* ** Initialize this module. */ static int sqlite3MemInit(void *NotUsed){ UNUSED_PARAMETER(NotUsed); |
︙ | ︙ | |||
12092 12093 12094 12095 12096 12097 12098 | ** to obtain the memory it needs while adding lots of additional debugging ** information to each allocation in order to help detect and fix memory ** leaks and memory usage errors. ** ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. ** | | | 12117 12118 12119 12120 12121 12122 12123 12124 12125 12126 12127 12128 12129 12130 12131 | ** to obtain the memory it needs while adding lots of additional debugging ** information to each allocation in order to help detect and fix memory ** leaks and memory usage errors. ** ** This file contains implementations of the low-level memory allocation ** routines specified in the sqlite3_mem_methods object. ** ** $Id: mem2.c,v 1.45 2009/03/23 04:33:33 danielk1977 Exp $ */ /* ** This version of the memory allocator is used only if the ** SQLITE_MEMDEBUG macro is defined */ #ifdef SQLITE_MEMDEBUG |
︙ | ︙ | |||
12199 12200 12201 12202 12203 12204 12205 | } mem; /* ** Adjust memory usage statistics */ static void adjustStats(int iSize, int increment){ | | | 12224 12225 12226 12227 12228 12229 12230 12231 12232 12233 12234 12235 12236 12237 12238 | } mem; /* ** Adjust memory usage statistics */ static void adjustStats(int iSize, int increment){ int i = ROUND8(iSize)/8; if( i>NCSIZE-1 ){ i = NCSIZE - 1; } if( increment>0 ){ mem.nAlloc[i]++; mem.nCurrent[i]++; if( mem.nCurrent[i]>mem.mxCurrent[i] ){ |
︙ | ︙ | |||
12230 12231 12232 12233 12234 12235 12236 | int *pInt; u8 *pU8; int nReserve; p = (struct MemBlockHdr*)pAllocation; p--; assert( p->iForeGuard==(int)FOREGUARD ); | | | 12255 12256 12257 12258 12259 12260 12261 12262 12263 12264 12265 12266 12267 12268 12269 | int *pInt; u8 *pU8; int nReserve; p = (struct MemBlockHdr*)pAllocation; p--; assert( p->iForeGuard==(int)FOREGUARD ); nReserve = ROUND8(p->iSize); pInt = (int*)pAllocation; pU8 = (u8*)pAllocation; assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD ); /* This checks any of the "extra" bytes allocated due ** to rounding up to an 8 byte boundary to ensure ** they haven't been overwritten. */ |
︙ | ︙ | |||
12280 12281 12282 12283 12284 12285 12286 | mem.mutex = 0; } /* ** Round up a request size to the next valid allocation size. */ static int sqlite3MemRoundup(int n){ | | | | 12305 12306 12307 12308 12309 12310 12311 12312 12313 12314 12315 12316 12317 12318 12319 12320 12321 12322 12323 12324 12325 12326 12327 12328 12329 12330 12331 12332 12333 12334 12335 | mem.mutex = 0; } /* ** Round up a request size to the next valid allocation size. */ static int sqlite3MemRoundup(int n){ return ROUND8(n); } /* ** Allocate nByte bytes of memory. */ static void *sqlite3MemMalloc(int nByte){ struct MemBlockHdr *pHdr; void **pBt; char *z; int *pInt; void *p = 0; int totalSize; int nReserve; sqlite3_mutex_enter(mem.mutex); assert( mem.disallow==0 ); nReserve = ROUND8(nByte); totalSize = nReserve + sizeof(*pHdr) + sizeof(int) + mem.nBacktrace*sizeof(void*) + mem.nTitle; p = malloc(totalSize); if( p ){ z = p; pBt = (void**)&z[mem.nTitle]; pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace]; |
︙ | ︙ | |||
12443 12444 12445 12446 12447 12448 12449 | */ SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){ unsigned int n = sqlite3Strlen30(zTitle) + 1; sqlite3_mutex_enter(mem.mutex); if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1; memcpy(mem.zTitle, zTitle, n); mem.zTitle[n] = 0; | | | 12468 12469 12470 12471 12472 12473 12474 12475 12476 12477 12478 12479 12480 12481 12482 | */ SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){ unsigned int n = sqlite3Strlen30(zTitle) + 1; sqlite3_mutex_enter(mem.mutex); if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1; memcpy(mem.zTitle, zTitle, n); mem.zTitle[n] = 0; mem.nTitle = ROUND8(n); sqlite3_mutex_leave(mem.mutex); } SQLITE_PRIVATE void sqlite3MemdebugSync(){ struct MemBlockHdr *pHdr; for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){ void **pBt = (void**)pHdr; |
︙ | ︙ | |||
14912 14913 14914 14915 14916 14917 14918 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** Memory allocation functions used throughout sqlite. ** | | | 14937 14938 14939 14940 14941 14942 14943 14944 14945 14946 14947 14948 14949 14950 14951 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** Memory allocation functions used throughout sqlite. ** ** $Id: malloc.c,v 1.61 2009/03/24 15:08:10 drh Exp $ */ /* ** This routine runs when the memory allocator sees that the ** total memory allocation is about to exceed the soft heap ** limit. */ |
︙ | ︙ | |||
15019 15020 15021 15022 15023 15024 15025 | memset(&mem0, 0, sizeof(mem0)); if( sqlite3GlobalConfig.bCoreMutex ){ mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); } if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100 && sqlite3GlobalConfig.nScratch>=0 ){ int i; | | | | 15044 15045 15046 15047 15048 15049 15050 15051 15052 15053 15054 15055 15056 15057 15058 15059 15060 15061 15062 15063 15064 15065 15066 15067 15068 15069 15070 15071 | memset(&mem0, 0, sizeof(mem0)); if( sqlite3GlobalConfig.bCoreMutex ){ mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); } if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100 && sqlite3GlobalConfig.nScratch>=0 ){ int i; sqlite3GlobalConfig.szScratch = ROUNDDOWN8(sqlite3GlobalConfig.szScratch-4); mem0.aScratchFree = (u32*)&((char*)sqlite3GlobalConfig.pScratch) [sqlite3GlobalConfig.szScratch*sqlite3GlobalConfig.nScratch]; for(i=0; i<sqlite3GlobalConfig.nScratch; i++){ mem0.aScratchFree[i] = i; } mem0.nScratchFree = sqlite3GlobalConfig.nScratch; }else{ sqlite3GlobalConfig.pScratch = 0; sqlite3GlobalConfig.szScratch = 0; } if( sqlite3GlobalConfig.pPage && sqlite3GlobalConfig.szPage>=512 && sqlite3GlobalConfig.nPage>=1 ){ int i; int overhead; int sz = ROUNDDOWN8(sqlite3GlobalConfig.szPage); int n = sqlite3GlobalConfig.nPage; overhead = (4*n + sz - 1)/sz; sqlite3GlobalConfig.nPage -= overhead; mem0.aPageFree = (u32*)&((char*)sqlite3GlobalConfig.pPage) [sqlite3GlobalConfig.szPage*sqlite3GlobalConfig.nPage]; for(i=0; i<sqlite3GlobalConfig.nPage; i++){ mem0.aPageFree[i] = i; } mem0.nPageFree = sqlite3GlobalConfig.nPage; |
︙ | ︙ | |||
15324 15325 15326 15327 15328 15329 15330 15331 15332 15333 15334 15335 15336 15337 | ** Return the size of a memory allocation previously obtained from ** sqlite3Malloc() or sqlite3_malloc(). */ SQLITE_PRIVATE int sqlite3MallocSize(void *p){ return sqlite3GlobalConfig.m.xSize(p); } SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ if( p==0 ){ return 0; }else if( isLookaside(db, p) ){ return db->lookaside.sz; }else{ return sqlite3GlobalConfig.m.xSize(p); } | > | 15349 15350 15351 15352 15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 | ** Return the size of a memory allocation previously obtained from ** sqlite3Malloc() or sqlite3_malloc(). */ SQLITE_PRIVATE int sqlite3MallocSize(void *p){ return sqlite3GlobalConfig.m.xSize(p); } SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ assert( db==0 || sqlite3_mutex_held(db->mutex) ); if( p==0 ){ return 0; }else if( isLookaside(db, p) ){ return db->lookaside.sz; }else{ return sqlite3GlobalConfig.m.xSize(p); } |
︙ | ︙ | |||
15353 15354 15355 15356 15357 15358 15359 15360 15361 15362 15363 15364 15365 15366 | } /* ** Free memory that might be associated with a particular database ** connection. */ SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){ if( isLookaside(db, p) ){ LookasideSlot *pBuf = (LookasideSlot*)p; pBuf->pNext = db->lookaside.pFree; db->lookaside.pFree = pBuf; db->lookaside.nOut--; }else{ sqlite3_free(p); | > | 15379 15380 15381 15382 15383 15384 15385 15386 15387 15388 15389 15390 15391 15392 15393 | } /* ** Free memory that might be associated with a particular database ** connection. */ SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){ assert( db==0 || sqlite3_mutex_held(db->mutex) ); if( isLookaside(db, p) ){ LookasideSlot *pBuf = (LookasideSlot*)p; pBuf->pNext = db->lookaside.pFree; db->lookaside.pFree = pBuf; db->lookaside.nOut--; }else{ sqlite3_free(p); |
︙ | ︙ | |||
15461 15462 15463 15464 15465 15466 15467 15468 15469 15470 15471 15472 15473 15474 | ** if( b ) a[10] = 9; ** ** In other words, if a subsequent malloc (ex: "b") worked, it is assumed ** that all prior mallocs (ex: "a") worked too. */ SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, int n){ void *p; #ifndef SQLITE_OMIT_LOOKASIDE if( db ){ LookasideSlot *pBuf; if( db->mallocFailed ){ return 0; } if( db->lookaside.bEnabled && n<=db->lookaside.sz | > | 15488 15489 15490 15491 15492 15493 15494 15495 15496 15497 15498 15499 15500 15501 15502 | ** if( b ) a[10] = 9; ** ** In other words, if a subsequent malloc (ex: "b") worked, it is assumed ** that all prior mallocs (ex: "a") worked too. */ SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, int n){ void *p; assert( db==0 || sqlite3_mutex_held(db->mutex) ); #ifndef SQLITE_OMIT_LOOKASIDE if( db ){ LookasideSlot *pBuf; if( db->mallocFailed ){ return 0; } if( db->lookaside.bEnabled && n<=db->lookaside.sz |
︙ | ︙ | |||
15495 15496 15497 15498 15499 15500 15501 15502 15503 15504 15505 15506 15507 15508 | /* ** Resize the block of memory pointed to by p to n bytes. If the ** resize fails, set the mallocFailed flag in the connection object. */ SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){ void *pNew = 0; if( db->mallocFailed==0 ){ if( p==0 ){ return sqlite3DbMallocRaw(db, n); } if( isLookaside(db, p) ){ if( n<=db->lookaside.sz ){ return p; | > > | 15523 15524 15525 15526 15527 15528 15529 15530 15531 15532 15533 15534 15535 15536 15537 15538 | /* ** Resize the block of memory pointed to by p to n bytes. If the ** resize fails, set the mallocFailed flag in the connection object. */ SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){ void *pNew = 0; assert( db!=0 ); assert( sqlite3_mutex_held(db->mutex) ); if( db->mallocFailed==0 ){ if( p==0 ){ return sqlite3DbMallocRaw(db, n); } if( isLookaside(db, p) ){ if( n<=db->lookaside.sz ){ return p; |
︙ | ︙ | |||
16713 16714 16715 16716 16717 16718 16719 | ** 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. ** | | | 16743 16744 16745 16746 16747 16748 16749 16750 16751 16752 16753 16754 16755 16756 16757 | ** 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.71 2009/03/31 03:41:57 shane 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 |
︙ | ︙ | |||
17515 17516 17517 17518 17519 17520 17521 | while( zIn[0] ){ c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); if( c!=0xfffd ){ WRITE_UTF8(zOut, c); } } *zOut = 0; | | | 17545 17546 17547 17548 17549 17550 17551 17552 17553 17554 17555 17556 17557 17558 17559 | while( zIn[0] ){ c = sqlite3Utf8Read(zIn, zTerm, (const u8**)&zIn); if( c!=0xfffd ){ WRITE_UTF8(zOut, c); } } *zOut = 0; return (int)(zOut - zStart); } #endif #ifndef SQLITE_OMIT_UTF16 /* ** Convert a UTF-16 string in the native encoding into a UTF-8 string. ** Memory to hold the UTF-8 string is obtained from sqlite3_malloc and must |
︙ | ︙ | |||
20483 20484 20485 20486 20487 20488 20489 | ** * Definitions of sqlite3_io_methods objects for all locking ** methods plus "finder" functions for each locking method. ** * sqlite3_vfs method implementations. ** * Locking primitives for the proxy uber-locking-method. (MacOSX only) ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). ** | | | 20513 20514 20515 20516 20517 20518 20519 20520 20521 20522 20523 20524 20525 20526 20527 | ** * Definitions of sqlite3_io_methods objects for all locking ** methods plus "finder" functions for each locking method. ** * sqlite3_vfs method implementations. ** * Locking primitives for the proxy uber-locking-method. (MacOSX only) ** * Definitions of sqlite3_vfs objects for all locking methods ** plus implementations of sqlite3_os_init() and sqlite3_os_end(). ** ** $Id: os_unix.c,v 1.248 2009/03/30 07:39:35 danielk1977 Exp $ */ #if SQLITE_OS_UNIX /* This file is used on unix only */ /* ** There are various methods for file locking used for concurrency ** control: ** |
︙ | ︙ | |||
22114 22115 22116 22117 22118 22119 22120 | pLock->locktype = SHARED_LOCK; }else{ int tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; } | | > | 22144 22145 22146 22147 22148 22149 22150 22151 22152 22153 22154 22155 22156 22157 22158 22159 22160 22161 22162 22163 | pLock->locktype = SHARED_LOCK; }else{ int tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; } goto end_unlock; } } if( locktype==NO_LOCK ){ struct unixOpenCnt *pOpen; int rc2 = SQLITE_OK; /* Decrement the shared lock counter. Release the lock using an ** OS call only when all threads in this same process have released ** the lock. */ pLock->cnt--; if( pLock->cnt==0 ){ |
︙ | ︙ | |||
22140 22141 22142 22143 22144 22145 22146 | pLock->locktype = NO_LOCK; }else{ int tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; } | | | < | | | | | | | | | | | | | | | | | | | | | | | > > | 22171 22172 22173 22174 22175 22176 22177 22178 22179 22180 22181 22182 22183 22184 22185 22186 22187 22188 22189 22190 22191 22192 22193 22194 22195 22196 22197 22198 22199 22200 22201 22202 22203 22204 22205 22206 22207 22208 22209 22210 22211 22212 22213 22214 22215 22216 22217 22218 | pLock->locktype = NO_LOCK; }else{ int tErrno = errno; rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); if( IS_LOCK_ERROR(rc) ){ pFile->lastErrno = tErrno; } pLock->locktype = NO_LOCK; pFile->locktype = NO_LOCK; } } /* Decrement the count of locks against this same file. When the ** count reaches zero, close any other file descriptors whose close ** was deferred because of outstanding locks. */ pOpen = pFile->pOpen; pOpen->nLock--; assert( pOpen->nLock>=0 ); if( pOpen->nLock==0 && pOpen->nPending>0 ){ int i; for(i=0; i<pOpen->nPending; i++){ /* close pending fds, but if closing fails don't free the array ** assign -1 to the successfully closed descriptors and record the ** error. The next attempt to unlock will try again. */ if( pOpen->aPending[i] < 0 ) continue; if( close(pOpen->aPending[i]) ){ pFile->lastErrno = errno; rc2 = SQLITE_IOERR_CLOSE; }else{ pOpen->aPending[i] = -1; } } if( rc2==SQLITE_OK ){ sqlite3_free(pOpen->aPending); pOpen->nPending = 0; pOpen->aPending = 0; } } if( rc==SQLITE_OK ){ rc = rc2; } } end_unlock: unixLeaveMutex(); if( rc==SQLITE_OK ) pFile->locktype = locktype; return rc; |
︙ | ︙ | |||
23484 23485 23486 23487 23488 23489 23490 | ** that syncs and fullsyncs are occurring at the right times. */ SQLITE_API int sqlite3_sync_count = 0; SQLITE_API int sqlite3_fullsync_count = 0; #endif /* | > > | | | | 23516 23517 23518 23519 23520 23521 23522 23523 23524 23525 23526 23527 23528 23529 23530 23531 23532 23533 23534 23535 | ** that syncs and fullsyncs are occurring at the right times. */ SQLITE_API int sqlite3_sync_count = 0; SQLITE_API int sqlite3_fullsync_count = 0; #endif /* ** We do not trust systems to provide a working fdatasync(). Some do. ** Others do no. To be safe, we will stick with the (slower) fsync(). ** If you know that your system does support fdatasync() correctly, ** then simply compile with -Dfdatasync=fdatasync */ #if !defined(fdatasync) && !defined(__linux__) # define fdatasync fsync #endif /* ** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not ** the F_FULLFSYNC macro is defined. F_FULLFSYNC is currently ** only available on Mac OS X. But that could change. |
︙ | ︙ | |||
25774 25775 25776 25777 25778 25779 25780 | ** 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. ** | | | 25808 25809 25810 25811 25812 25813 25814 25815 25816 25817 25818 25819 25820 25821 25822 | ** 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.153 2009/03/31 03:41:57 shane Exp $ */ #if SQLITE_OS_WIN /* This file is used for windows only */ /* ** A Note About Memory Allocation: ** |
︙ | ︙ | |||
27350 27351 27352 27353 27354 27355 27356 | NULL ); #endif } if( h==INVALID_HANDLE_VALUE ){ free(zConverted); if( flags & SQLITE_OPEN_READWRITE ){ | | | 27384 27385 27386 27387 27388 27389 27390 27391 27392 27393 27394 27395 27396 27397 27398 | NULL ); #endif } if( h==INVALID_HANDLE_VALUE ){ free(zConverted); if( flags & SQLITE_OPEN_READWRITE ){ return winOpen(pVfs, zName, id, ((flags|SQLITE_OPEN_READONLY)&~SQLITE_OPEN_READWRITE), pOutFlags); }else{ return SQLITE_CANTOPEN; } } if( pOutFlags ){ if( flags & SQLITE_OPEN_READWRITE ){ |
︙ | ︙ | |||
27747 27748 27749 27750 27751 27752 27753 | ** return 0. Return 1 if the time and date cannot be found. */ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ FILETIME ft; /* FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). */ | | > > > > > > > > > > > > > > < | | | | | | | | < < < < < < < < < < | 27781 27782 27783 27784 27785 27786 27787 27788 27789 27790 27791 27792 27793 27794 27795 27796 27797 27798 27799 27800 27801 27802 27803 27804 27805 27806 27807 27808 27809 27810 27811 27812 27813 27814 27815 27816 27817 27818 27819 27820 27821 27822 27823 27824 27825 27826 27827 27828 | ** return 0. Return 1 if the time and date cannot be found. */ int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ FILETIME ft; /* FILETIME structure is a 64-bit value representing the number of 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). */ sqlite3_int64 timeW; /* Whole days */ sqlite3_int64 timeF; /* Fractional Days */ /* Number of 100-nanosecond intervals in a single day */ static const sqlite3_int64 ntuPerDay = 10000000*(sqlite3_int64)86400; /* Number of 100-nanosecond intervals in half of a day */ static const sqlite3_int64 ntuPerHalfDay = 10000000*(sqlite3_int64)43200; /* 2^32 - to avoid use of LL and warnings in gcc */ static const sqlite3_int64 max32BitValue = (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 + (sqlite3_int64)294967296; #if SQLITE_OS_WINCE SYSTEMTIME time; GetSystemTime(&time); /* if SystemTimeToFileTime() fails, it returns zero. */ if (!SystemTimeToFileTime(&time,&ft)){ return 1; } #else GetSystemTimeAsFileTime( &ft ); #endif UNUSED_PARAMETER(pVfs); timeW = (((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) + (sqlite3_int64)ft.dwLowDateTime; timeF = timeW % ntuPerDay; /* fractional days (100-nanoseconds) */ timeW = timeW / ntuPerDay; /* whole days */ timeW = timeW + 2305813; /* add whole days (from 2305813.5) */ timeF = timeF + ntuPerHalfDay; /* add half a day (from 2305813.5) */ timeW = timeW + (timeF/ntuPerDay); /* add whole day if half day made one */ timeF = timeF % ntuPerDay; /* compute new fractional days */ *prNow = (double)timeW + ((double)timeF / (double)ntuPerDay); #ifdef SQLITE_TEST if( sqlite3_current_time ){ *prNow = ((double)sqlite3_current_time + (double)43200) / (double)86400 + (double)2440587; } #endif return 0; } |
︙ | ︙ | |||
28266 28267 28268 28269 28270 28271 28272 | ** 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 implements that page cache. ** | | | 28303 28304 28305 28306 28307 28308 28309 28310 28311 28312 28313 28314 28315 28316 28317 | ** 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 implements that page cache. ** ** @(#) $Id: pcache.c,v 1.44 2009/03/31 01:32:18 drh Exp $ */ /* ** A complete page cache is an instance of this structure. */ struct PCache { PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */ |
︙ | ︙ | |||
28590 28591 28592 28593 28594 28595 28596 | } /* ** Make sure the page is marked as dirty. If it isn't dirty already, ** make it so. */ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ | < < | 28627 28628 28629 28630 28631 28632 28633 28634 28635 28636 28637 28638 28639 28640 28641 28642 28643 | } /* ** Make sure the page is marked as dirty. If it isn't dirty already, ** make it so. */ SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ p->flags &= ~PGHDR_DONT_WRITE; assert( p->nRef>0 ); if( 0==(p->flags & PGHDR_DIRTY) ){ p->flags |= PGHDR_DIRTY; pcacheAddToDirtyList( p); } } /* ** Make sure the page is marked as clean. If it isn't clean already, |
︙ | ︙ | |||
28857 28858 28859 28860 28861 28862 28863 | ** ** This file implements the default page cache implementation (the ** sqlite3_pcache interface). It also contains part of the implementation ** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. ** If the default page cache implementation is overriden, then neither of ** these two features are available. ** | | | 28892 28893 28894 28895 28896 28897 28898 28899 28900 28901 28902 28903 28904 28905 28906 | ** ** This file implements the default page cache implementation (the ** sqlite3_pcache interface). It also contains part of the implementation ** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. ** If the default page cache implementation is overriden, then neither of ** these two features are available. ** ** @(#) $Id: pcache1.c,v 1.10 2009/03/23 04:33:33 danielk1977 Exp $ */ typedef struct PCache1 PCache1; typedef struct PgHdr1 PgHdr1; typedef struct PgFreeslot PgFreeslot; |
︙ | ︙ | |||
28969 28970 28971 28972 28973 28974 28975 | ** This function is called during initialization if a static buffer is ** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE ** verb to sqlite3_config(). Parameter pBuf points to an allocation large ** enough to contain 'n' buffers of 'sz' bytes each. */ SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ PgFreeslot *p; | | | 29004 29005 29006 29007 29008 29009 29010 29011 29012 29013 29014 29015 29016 29017 29018 | ** This function is called during initialization if a static buffer is ** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE ** verb to sqlite3_config(). Parameter pBuf points to an allocation large ** enough to contain 'n' buffers of 'sz' bytes each. */ SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ PgFreeslot *p; sz = ROUNDDOWN8(sz); pcache1.szSlot = sz; pcache1.pStart = pBuf; pcache1.pFree = 0; while( n-- ){ p = (PgFreeslot*)pBuf; p->pNext = pcache1.pFree; pcache1.pFree = p; |
︙ | ︙ | |||
29853 29854 29855 29856 29857 29858 29859 | ** 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. ** | | | 29888 29889 29890 29891 29892 29893 29894 29895 29896 29897 29898 29899 29900 29901 29902 | ** 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.576 2009/03/31 02:54:40 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO /* ** Macros for troubleshooting. Normally turned off */ #if 0 |
︙ | ︙ | |||
29933 29934 29935 29936 29937 29938 29939 | */ #define PAGER_UNLOCK 0 #define PAGER_SHARED 1 /* same as SHARED_LOCK */ #define PAGER_RESERVED 2 /* same as RESERVED_LOCK */ #define PAGER_EXCLUSIVE 4 /* same as EXCLUSIVE_LOCK */ #define PAGER_SYNCED 5 | < < < < < < | 29968 29969 29970 29971 29972 29973 29974 29975 29976 29977 29978 29979 29980 29981 | */ #define PAGER_UNLOCK 0 #define PAGER_SHARED 1 /* same as SHARED_LOCK */ #define PAGER_RESERVED 2 /* same as RESERVED_LOCK */ #define PAGER_EXCLUSIVE 4 /* same as EXCLUSIVE_LOCK */ #define PAGER_SYNCED 5 /* ** A macro used for invoking the codec if there is one */ #ifdef SQLITE_HAS_CODEC # define CODEC1(P,D,N,X) if( P->xCodec!=0 ){ P->xCodec(P->pCodecArg,D,N,X); } # define CODEC2(P,D,N,X) ((char*)(P->xCodec!=0?P->xCodec(P->pCodecArg,D,N,X):D)) #else |
︙ | ︙ | |||
31339 31340 31341 31342 31343 31344 31345 31346 31347 31348 31349 31350 31351 31352 | ** the page is marked as needSync==0. ** ** 2008-04-14: When attempting to vacuum a corrupt database file, it ** is possible to fail a statement on a database that does not yet exist. ** Do not attempt to write if database file has never been opened. */ pPg = pager_lookup(pPager, pgno); PAGERTRACE(("PLAYBACK %d page %d hash(%08x) %s\n", PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, aData), (isMainJrnl?"main-journal":"sub-journal") )); if( (pPager->state>=PAGER_EXCLUSIVE) && (pPg==0 || 0==(pPg->flags&PGHDR_NEED_SYNC)) && isOpen(pPager->fd) | > | 31368 31369 31370 31371 31372 31373 31374 31375 31376 31377 31378 31379 31380 31381 31382 | ** the page is marked as needSync==0. ** ** 2008-04-14: When attempting to vacuum a corrupt database file, it ** is possible to fail a statement on a database that does not yet exist. ** Do not attempt to write if database file has never been opened. */ pPg = pager_lookup(pPager, pgno); assert( pPg || !MEMDB ); PAGERTRACE(("PLAYBACK %d page %d hash(%08x) %s\n", PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, aData), (isMainJrnl?"main-journal":"sub-journal") )); if( (pPager->state>=PAGER_EXCLUSIVE) && (pPg==0 || 0==(pPg->flags&PGHDR_NEED_SYNC)) && isOpen(pPager->fd) |
︙ | ︙ | |||
33113 33114 33115 33116 33117 33118 33119 | assert( !pPager->pTmpSpace ); sqlite3OsClose(pPager->fd); sqlite3_free(pPager); return rc; } /* Initialize the PCache object. */ | | | 33143 33144 33145 33146 33147 33148 33149 33150 33151 33152 33153 33154 33155 33156 33157 | assert( !pPager->pTmpSpace ); sqlite3OsClose(pPager->fd); sqlite3_free(pPager); return rc; } /* Initialize the PCache object. */ nExtra = ROUND8(nExtra); sqlite3PcacheOpen(szPageDflt, nExtra, !memDb, !memDb?pagerStress:0, (void *)pPager, pPager->pPCache); PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename)); IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename)) pPager->useJournal = (u8)useJournal; |
︙ | ︙ | |||
33169 33170 33171 33172 33173 33174 33175 | /* ** This function is called after transitioning from PAGER_UNLOCK to ** PAGER_SHARED state. It tests if there is a hot journal present in ** the file-system for the given pager. A hot journal is one that ** needs to be played back. According to this function, a hot-journal | | | > | < | < < | | | > | < > > > > > > > | | > > > > > > > > > > > > > > > | > > | 33199 33200 33201 33202 33203 33204 33205 33206 33207 33208 33209 33210 33211 33212 33213 33214 33215 33216 33217 33218 33219 33220 33221 33222 33223 33224 33225 33226 33227 33228 33229 33230 33231 33232 33233 33234 33235 33236 33237 33238 33239 33240 33241 33242 33243 33244 33245 33246 33247 33248 33249 33250 33251 33252 33253 33254 33255 33256 33257 33258 33259 33260 33261 33262 33263 33264 33265 33266 33267 33268 33269 33270 33271 33272 33273 33274 33275 33276 33277 33278 33279 33280 33281 33282 33283 33284 33285 33286 33287 | /* ** This function is called after transitioning from PAGER_UNLOCK to ** PAGER_SHARED state. It tests if there is a hot journal present in ** the file-system for the given pager. A hot journal is one that ** needs to be played back. According to this function, a hot-journal ** file exists if the following criteria are met: ** ** * The journal file exists in the file system, and ** * No process holds a RESERVED or greater lock on the database file, and ** * The database file itself is greater than 0 bytes in size, and ** * The first byte of the journal file exists and is not 0x00. ** ** If the current size of the database file is 0 but a journal file ** exists, that is probably an old journal left over from a prior ** database with the same name. In this case the journal file is ** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK ** is returned. ** ** This routine does not check if there is a master journal filename ** at the end of the file. If there is, and that master journal file ** does not exist, then the journal file is not really hot. In this ** case this routine will return a false-positive. The pager_playback() ** routine will discover that the journal file is not really hot and ** will not roll it back. ** ** If a hot-journal file is found to exist, *pExists is set to 1 and ** SQLITE_OK returned. If no hot-journal file is present, *pExists is ** set to 0 and SQLITE_OK returned. If an IO error occurs while trying ** to determine whether or not a hot-journal file exists, the IO error ** code is returned and the value of *pExists is undefined. */ static int hasHotJournal(Pager *pPager, int *pExists){ sqlite3_vfs * const pVfs = pPager->pVfs; int rc; /* Return code */ int exists; /* True if a journal file is present */ assert( pPager!=0 ); assert( pPager->useJournal ); assert( isOpen(pPager->fd) ); assert( !isOpen(pPager->jfd) ); *pExists = 0; rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); if( rc==SQLITE_OK && exists ){ int locked; /* True if some process holds a RESERVED lock */ rc = sqlite3OsCheckReservedLock(pPager->fd, &locked); if( rc==SQLITE_OK && !locked ){ int nPage; /* Check the size of the database file. If it consists of 0 pages, ** then delete the journal file. See the header comment above for ** the reasoning here. */ rc = sqlite3PagerPagecount(pPager, &nPage); if( rc==SQLITE_OK ){ if( nPage==0 ){ rc = sqlite3OsDelete(pVfs, pPager->zJournal, 0); }else{ /* The journal file exists and no other connection has a reserved ** or greater lock on the database file. Now check that there is ** at least one non-zero bytes at the start of the journal file. ** If there is, then we consider this journal to be hot. If not, ** it can be ignored. */ int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); if( rc==SQLITE_OK ){ u8 first = 0; rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); if( rc==SQLITE_IOERR_SHORT_READ ){ rc = SQLITE_OK; } sqlite3OsClose(pPager->jfd); *pExists = (first!=0); } } } } } return rc; } /* ** Read the content for page pPg out of the database file and into ** pPg->pData. A shared lock or greater must be held on the database ** file before this function is called. |
︙ | ︙ | |||
33247 33248 33249 33250 33251 33252 33253 | i64 iOffset; /* Byte offset of file to read from */ assert( pPager->state>=PAGER_SHARED && !MEMDB ); if( !isOpen(pPager->fd) ){ assert( pPager->tempFile ); memset(pPg->pData, 0, pPager->pageSize); | | > > > | 33299 33300 33301 33302 33303 33304 33305 33306 33307 33308 33309 33310 33311 33312 33313 33314 33315 33316 33317 33318 33319 | i64 iOffset; /* Byte offset of file to read from */ assert( pPager->state>=PAGER_SHARED && !MEMDB ); if( !isOpen(pPager->fd) ){ assert( pPager->tempFile ); memset(pPg->pData, 0, pPager->pageSize); return SQLITE_OK; } iOffset = (pgno-1)*(i64)pPager->pageSize; rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset); if( rc==SQLITE_IOERR_SHORT_READ ){ rc = SQLITE_OK; } if( pgno==1 ){ u8 *dbFileVers = &((u8*)pPg->pData)[24]; memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers)); } CODEC1(pPager, pPg->pData, pgno, 3); PAGER_INCR(sqlite3_pager_readdb_count); |
︙ | ︙ | |||
33634 33635 33636 33637 33638 33639 33640 | }else{ memset(pPg->pData, 0, pPager->pageSize); } IOTRACE(("ZERO %p %d\n", pPager, pgno)); }else{ assert( pPg->pPager==pPager ); rc = readDbPage(pPg); | | | 33689 33690 33691 33692 33693 33694 33695 33696 33697 33698 33699 33700 33701 33702 33703 | }else{ memset(pPg->pData, 0, pPager->pageSize); } IOTRACE(("ZERO %p %d\n", pPager, pgno)); }else{ assert( pPg->pPager==pPager ); rc = readDbPage(pPg); if( rc!=SQLITE_OK ){ pagerDropPage(pPg); return rc; } } #ifdef SQLITE_CHECK_PAGES pPg->pageHash = pager_pagehash(pPg); #endif |
︙ | ︙ | |||
33767 33768 33769 33770 33771 33772 33773 | /* Open the journal file if it is not already open. */ if( !isOpen(pPager->jfd) ){ if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){ sqlite3MemJournalOpen(pPager->jfd); }else{ const int flags = /* VFS flags to open journal file */ | | | 33822 33823 33824 33825 33826 33827 33828 33829 33830 33831 33832 33833 33834 33835 33836 | /* Open the journal file if it is not already open. */ if( !isOpen(pPager->jfd) ){ if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){ sqlite3MemJournalOpen(pPager->jfd); }else{ const int flags = /* VFS flags to open journal file */ SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE| (pPager->tempFile ? (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL): (SQLITE_OPEN_MAIN_JOURNAL) ); #ifdef SQLITE_ENABLE_ATOMIC_WRITE rc = sqlite3JournalOpen( pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager) |
︙ | ︙ | |||
34831 34832 34833 34834 34835 34836 34837 34838 34839 34840 34841 34842 34843 34844 | ** This function may return SQLITE_NOMEM or an IO error code if an error ** occurs. Otherwise, it returns SQLITE_OK. */ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ PgHdr *pPgOld; /* The page being overwritten. */ Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */ int rc; /* Return code */ assert( pPg->nRef>0 ); /* If the page being moved is dirty and has not been saved by the latest ** savepoint, then save the current contents of the page into the ** sub-journal now. This is required to handle the following scenario: ** | > | 34886 34887 34888 34889 34890 34891 34892 34893 34894 34895 34896 34897 34898 34899 34900 | ** This function may return SQLITE_NOMEM or an IO error code if an error ** occurs. Otherwise, it returns SQLITE_OK. */ SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ PgHdr *pPgOld; /* The page being overwritten. */ Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */ int rc; /* Return code */ Pgno origPgno; /* The original page number */ assert( pPg->nRef>0 ); /* If the page being moved is dirty and has not been saved by the latest ** savepoint, then save the current contents of the page into the ** sub-journal now. This is required to handle the following scenario: ** |
︙ | ︙ | |||
34889 34890 34891 34892 34893 34894 34895 34896 34897 34898 34899 34900 34901 34902 | pPg->flags &= ~PGHDR_NEED_SYNC; pPgOld = pager_lookup(pPager, pgno); assert( !pPgOld || pPgOld->nRef==1 ); if( pPgOld ){ pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC); } sqlite3PcacheMove(pPg, pgno); if( pPgOld ){ sqlite3PcacheDrop(pPgOld); } sqlite3PcacheMakeDirty(pPg); pPager->dbModified = 1; | > | 34945 34946 34947 34948 34949 34950 34951 34952 34953 34954 34955 34956 34957 34958 34959 | pPg->flags &= ~PGHDR_NEED_SYNC; pPgOld = pager_lookup(pPager, pgno); assert( !pPgOld || pPgOld->nRef==1 ); if( pPgOld ){ pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC); } origPgno = pPg->pgno; sqlite3PcacheMove(pPg, pgno); if( pPgOld ){ sqlite3PcacheDrop(pPgOld); } sqlite3PcacheMakeDirty(pPg); pPager->dbModified = 1; |
︙ | ︙ | |||
34930 34931 34932 34933 34934 34935 34936 34937 34938 34939 34940 34941 34942 34943 | } pPager->needSync = 1; assert( pPager->noSync==0 && !MEMDB ); pPgHdr->flags |= PGHDR_NEED_SYNC; sqlite3PcacheMakeDirty(pPgHdr); sqlite3PagerUnref(pPgHdr); } return SQLITE_OK; } #endif /* ** Return a pointer to the data for the specified page. | > > > > > > > > > > > > > | 34987 34988 34989 34990 34991 34992 34993 34994 34995 34996 34997 34998 34999 35000 35001 35002 35003 35004 35005 35006 35007 35008 35009 35010 35011 35012 35013 | } pPager->needSync = 1; assert( pPager->noSync==0 && !MEMDB ); pPgHdr->flags |= PGHDR_NEED_SYNC; sqlite3PcacheMakeDirty(pPgHdr); sqlite3PagerUnref(pPgHdr); } /* ** For an in-memory database, make sure the original page continues ** to exist, in case the transaction needs to roll back. We allocate ** the page now, instead of at rollback, because we can better deal ** with an out-of-memory error now. Ticket #3761. */ if( MEMDB ){ DbPage *pNew; rc = sqlite3PagerAcquire(pPager, origPgno, &pNew, 1); if( rc!=SQLITE_OK ) return rc; sqlite3PagerUnref(pNew); } return SQLITE_OK; } #endif /* ** Return a pointer to the data for the specified page. |
︙ | ︙ | |||
36004 36005 36006 36007 36008 36009 36010 | ** 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. ** ************************************************************************* | | | 36074 36075 36076 36077 36078 36079 36080 36081 36082 36083 36084 36085 36086 36087 36088 | ** 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.582 2009/03/30 18:50:05 danielk1977 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. */ /* |
︙ | ︙ | |||
36850 36851 36852 36853 36854 36855 36856 | ** ** Return the index into pPage->aData[] of the first byte of ** the new allocation. The caller guarantees that there is enough ** space. This routine will never fail. ** ** If the page contains nBytes of free space but does not contain ** nBytes of contiguous free space, then this routine automatically | | | 36920 36921 36922 36923 36924 36925 36926 36927 36928 36929 36930 36931 36932 36933 36934 | ** ** Return the index into pPage->aData[] of the first byte of ** the new allocation. The caller guarantees that there is enough ** space. This routine will never fail. ** ** If the page contains nBytes of free space but does not contain ** nBytes of contiguous free space, then this routine automatically ** calls defragmentPage() to consolidate all free space before ** allocating the new chunk. */ static int allocateSpace(MemPage *pPage, int nByte){ int addr, pc, hdr; int size; int nFrag; int top; |
︙ | ︙ | |||
37299 37300 37301 37302 37303 37304 37305 37306 37307 37308 37309 37310 37311 37312 | static void pageReinit(DbPage *pData){ MemPage *pPage; pPage = (MemPage *)sqlite3PagerGetExtra(pData); if( pPage->isInit ){ assert( sqlite3_mutex_held(pPage->pBt->mutex) ); pPage->isInit = 0; if( sqlite3PagerPageRefcount(pData)>0 ){ sqlite3BtreeInitPage(pPage); } } } /* ** Invoke the busy handler for a btree. | > > > > > > | 37369 37370 37371 37372 37373 37374 37375 37376 37377 37378 37379 37380 37381 37382 37383 37384 37385 37386 37387 37388 | static void pageReinit(DbPage *pData){ MemPage *pPage; pPage = (MemPage *)sqlite3PagerGetExtra(pData); if( pPage->isInit ){ assert( sqlite3_mutex_held(pPage->pBt->mutex) ); pPage->isInit = 0; if( sqlite3PagerPageRefcount(pData)>0 ){ /* pPage might not be a btree page; it might be an overflow page ** or ptrmap page or a free page. In those cases, the following ** call to sqlite3BtreeInitPage() will likely return SQLITE_CORRUPT. ** But no harm is done by this. And it is very important that ** sqlite3BtreeInitPage() be called on every btree page so we make ** the call for every page that comes in for re-initing. */ sqlite3BtreeInitPage(pPage); } } } /* ** Invoke the busy handler for a btree. |
︙ | ︙ | |||
38161 38162 38163 38164 38165 38166 38167 | if( p->inTrans>pBt->inTransaction ){ pBt->inTransaction = p->inTrans; } #ifndef SQLITE_OMIT_SHARED_CACHE if( wrflag ){ assert( !pBt->pWriter ); pBt->pWriter = p; | | | 38237 38238 38239 38240 38241 38242 38243 38244 38245 38246 38247 38248 38249 38250 38251 | if( p->inTrans>pBt->inTransaction ){ pBt->inTransaction = p->inTrans; } #ifndef SQLITE_OMIT_SHARED_CACHE if( wrflag ){ assert( !pBt->pWriter ); pBt->pWriter = p; pBt->isExclusive = (u8)(wrflag>1); } #endif } trans_begun: if( rc==SQLITE_OK && wrflag ){ |
︙ | ︙ | |||
38468 38469 38470 38471 38472 38473 38474 38475 38476 38477 38478 38479 38480 38481 | } } } if( nFin==0 ){ iLastPg--; while( iLastPg==PENDING_BYTE_PAGE(pBt)||PTRMAP_ISPAGE(pBt, iLastPg) ){ iLastPg--; } sqlite3PagerTruncateImage(pBt->pPager, iLastPg); } return SQLITE_OK; } | > > > > > > > > > > > > | 38544 38545 38546 38547 38548 38549 38550 38551 38552 38553 38554 38555 38556 38557 38558 38559 38560 38561 38562 38563 38564 38565 38566 38567 38568 38569 | } } } if( nFin==0 ){ iLastPg--; while( iLastPg==PENDING_BYTE_PAGE(pBt)||PTRMAP_ISPAGE(pBt, iLastPg) ){ if( PTRMAP_ISPAGE(pBt, iLastPg) ){ MemPage *pPg; int rc = sqlite3BtreeGetPage(pBt, iLastPg, &pPg, 0); if( rc!=SQLITE_OK ){ return rc; } rc = sqlite3PagerWrite(pPg->pDbPage); releasePage(pPg); if( rc!=SQLITE_OK ){ return rc; } } iLastPg--; } sqlite3PagerTruncateImage(pBt->pPager, iLastPg); } return SQLITE_OK; } |
︙ | ︙ | |||
40421 40422 40423 40424 40425 40426 40427 40428 40429 40430 40431 40432 40433 40434 40435 40436 | #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, *pPgno) ){ /* If *pPgno refers to a pointer-map page, allocate two new pages ** at the end of the file instead of one. The first allocated page ** becomes a new pointer-map page, the second is used by the caller. */ TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", *pPgno)); assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); (*pPgno)++; if( *pPgno==PENDING_BYTE_PAGE(pBt) ){ (*pPgno)++; } } #endif assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); rc = sqlite3BtreeGetPage(pBt, *pPgno, ppPage, 0); | > > > > > > > | 40509 40510 40511 40512 40513 40514 40515 40516 40517 40518 40519 40520 40521 40522 40523 40524 40525 40526 40527 40528 40529 40530 40531 | #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, *pPgno) ){ /* If *pPgno refers to a pointer-map page, allocate two new pages ** at the end of the file instead of one. The first allocated page ** becomes a new pointer-map page, the second is used by the caller. */ MemPage *pPg = 0; TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", *pPgno)); assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); rc = sqlite3BtreeGetPage(pBt, *pPgno, &pPg, 0); if( rc==SQLITE_OK ){ rc = sqlite3PagerWrite(pPg->pDbPage); releasePage(pPg); } if( rc ) return rc; (*pPgno)++; if( *pPgno==PENDING_BYTE_PAGE(pBt) ){ (*pPgno)++; } } #endif assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); rc = sqlite3BtreeGetPage(pBt, *pPgno, ppPage, 0); |
︙ | ︙ | |||
43094 43095 43096 43097 43098 43099 43100 | sqlite3_snprintf(sizeof(zContext), zContext, "On tree page %d cell %d: ", iPage, i); pCell = findCell(pPage,i); sqlite3BtreeParseCellPtr(pPage, pCell, &info); sz = info.nData; if( !pPage->intKey ) sz += (int)info.nKey; assert( sz==info.nPayload ); | | > > | 43189 43190 43191 43192 43193 43194 43195 43196 43197 43198 43199 43200 43201 43202 43203 43204 43205 | sqlite3_snprintf(sizeof(zContext), zContext, "On tree page %d cell %d: ", iPage, i); pCell = findCell(pPage,i); sqlite3BtreeParseCellPtr(pPage, pCell, &info); sz = info.nData; if( !pPage->intKey ) sz += (int)info.nKey; assert( sz==info.nPayload ); if( (sz>info.nLocal) && (&pCell[info.iOverflow]<=&pPage->aData[pBt->usableSize]) ){ int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4); Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]); #ifndef SQLITE_OMIT_AUTOVACUUM if( pBt->autoVacuum ){ checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage, zContext); } #endif |
︙ | ︙ | |||
44135 44136 44137 44138 44139 44140 44141 | ************************************************************************* ** ** 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 ** | | | 44232 44233 44234 44235 44236 44237 44238 44239 44240 44241 44242 44243 44244 44245 44246 | ************************************************************************* ** ** 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.139 2009/03/29 15:12:10 drh Exp $ */ /* ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*) ** P if required. */ #define expandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) |
︙ | ︙ | |||
44439 44440 44441 44442 44443 44444 44445 44446 44447 44448 44449 44450 44451 44452 44453 44454 44455 44456 44457 | */ static const i64 maxInt = LARGEST_INT64; static const i64 minInt = SMALLEST_INT64; if( r<(double)minInt ){ return minInt; }else if( r>(double)maxInt ){ return minInt; }else{ return (i64)r; } } /* ** Return some kind of integer value which is the best we can do ** at representing the value that *pMem describes as an integer. ** If pMem is an integer, then the value is exact. If pMem is ** a floating-point then the value returned is the integer part. ** If pMem is a string or blob, then we make an attempt to convert | > > > > | > | | 44536 44537 44538 44539 44540 44541 44542 44543 44544 44545 44546 44547 44548 44549 44550 44551 44552 44553 44554 44555 44556 44557 44558 44559 44560 44561 44562 44563 44564 44565 44566 44567 44568 44569 | */ static const i64 maxInt = LARGEST_INT64; static const i64 minInt = SMALLEST_INT64; if( r<(double)minInt ){ return minInt; }else if( r>(double)maxInt ){ /* minInt is correct here - not maxInt. It turns out that assigning ** a very large positive number to an integer results in a very large ** negative integer. This makes no sense, but it is what x86 hardware ** does so for compatibility we will do the same in software. */ return minInt; }else{ return (i64)r; } } /* ** Return some kind of integer value which is the best we can do ** at representing the value that *pMem describes as an integer. ** If pMem is an integer, then the value is exact. If pMem is ** a floating-point then the value returned is the integer part. ** If pMem is a string or blob, then we make an attempt to convert ** it into a integer and return that. If pMem represents an ** an SQL-NULL value, return 0. ** ** If pMem represents a string value, its encoding might be changed. */ SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ int flags; assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); flags = pMem->flags; if( flags & MEM_Int ){ return pMem->u.i; |
︙ | ︙ | |||
45177 45178 45179 45180 45181 45182 45183 | ** ************************************************************************* ** 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. ** | | | 45279 45280 45281 45282 45283 45284 45285 45286 45287 45288 45289 45290 45291 45292 45293 | ** ************************************************************************* ** 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.446 2009/03/25 15:43:09 danielk1977 Exp $ */ /* ** When debugging the code generator in a symbolic debugger, one can ** set the sqlite3VdbeAddopTrace to 1 and all opcodes will be printed |
︙ | ︙ | |||
46064 46065 46066 46067 46068 46069 46070 | pMem->flags = MEM_Int; pMem->u.i = pOp->p3; /* P3 */ pMem->type = SQLITE_INTEGER; pMem++; } if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ | | | | | | 46166 46167 46168 46169 46170 46171 46172 46173 46174 46175 46176 46177 46178 46179 46180 46181 46182 46183 46184 46185 46186 46187 46188 46189 46190 46191 46192 46193 46194 46195 46196 46197 46198 | pMem->flags = MEM_Int; pMem->u.i = pOp->p3; /* P3 */ pMem->type = SQLITE_INTEGER; pMem++; } if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ assert( p->db->mallocFailed ); return SQLITE_ERROR; } pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; z = displayP4(pOp, pMem->z, 32); if( z!=pMem->z ){ sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0); }else{ assert( pMem->z!=0 ); pMem->n = sqlite3Strlen30(pMem->z); pMem->enc = SQLITE_UTF8; } pMem->type = SQLITE_TEXT; pMem++; if( p->explain==1 ){ if( sqlite3VdbeMemGrow(pMem, 4, 0) ){ assert( p->db->mallocFailed ); return SQLITE_ERROR; } pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; pMem->n = 2; sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ pMem->type = SQLITE_TEXT; pMem->enc = SQLITE_UTF8; pMem++; |
︙ | ︙ | |||
46185 46186 46187 46188 46189 46190 46191 | char *pp, /* IN/OUT: Set *pp to point to allocated buffer */ int nByte, /* Number of bytes to allocate */ u8 **ppFrom, /* IN/OUT: Allocate from *ppFrom */ u8 *pEnd, /* Pointer to 1 byte past the end of *ppFrom buffer */ int *pnByte /* If allocation cannot be made, increment *pnByte */ ){ if( (*(void**)pp)==0 ){ | | | 46287 46288 46289 46290 46291 46292 46293 46294 46295 46296 46297 46298 46299 46300 46301 | char *pp, /* IN/OUT: Set *pp to point to allocated buffer */ int nByte, /* Number of bytes to allocate */ u8 **ppFrom, /* IN/OUT: Allocate from *ppFrom */ u8 *pEnd, /* Pointer to 1 byte past the end of *ppFrom buffer */ int *pnByte /* If allocation cannot be made, increment *pnByte */ ){ if( (*(void**)pp)==0 ){ nByte = ROUND8(nByte); if( (pEnd - *ppFrom)>=nByte ){ *(void**)pp = (void *)*ppFrom; *ppFrom += nByte; }else{ *pnByte += nByte; } } |
︙ | ︙ | |||
47816 47817 47818 47819 47820 47821 47822 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code use to implement APIs that are part of the ** VDBE. ** | | | 47918 47919 47920 47921 47922 47923 47924 47925 47926 47927 47928 47929 47930 47931 47932 | ** 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.156 2009/03/25 15:43:09 danielk1977 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 |
︙ | ︙ | |||
48304 48305 48306 48307 48308 48309 48310 | elapseTime = (u64)((rNow - (int)rNow)*3600.0*24.0*1000000000.0); elapseTime -= p->startTime; db->xProfile(db->pProfileArg, p->zSql, elapseTime); } #endif db->errCode = rc; | < | > > > > > > > > > > > > | | | | > > | < < < < < < > | 48406 48407 48408 48409 48410 48411 48412 48413 48414 48415 48416 48417 48418 48419 48420 48421 48422 48423 48424 48425 48426 48427 48428 48429 48430 48431 48432 48433 48434 48435 48436 48437 48438 48439 48440 48441 48442 | elapseTime = (u64)((rNow - (int)rNow)*3600.0*24.0*1000000000.0); elapseTime -= p->startTime; db->xProfile(db->pProfileArg, p->zSql, elapseTime); } #endif db->errCode = rc; if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){ p->rc = SQLITE_NOMEM; } end_of_step: /* At this point local variable rc holds the value that should be ** returned if this statement was compiled using the legacy ** sqlite3_prepare() interface. According to the docs, this can only ** be one of the values in the first assert() below. Variable p->rc ** contains the value that would be returned if sqlite3_finalize() ** were called on statement p. */ assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR || rc==SQLITE_BUSY || rc==SQLITE_MISUSE ); assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE ); if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ /* If this statement was prepared using sqlite3_prepare_v2(), and an ** error has occured, then return the error code in p->rc to the ** caller. Set the error code in the database handle to the same value. */ rc = db->errCode = p->rc; } return (rc&db->errMask); } /* ** This is the top-level implementation of sqlite3_step(). Call ** sqlite3Step() to do most of the work. If a schema error occurs, ** call sqlite3Reprepare() and try again. */ |
︙ | ︙ | |||
49160 49161 49162 49163 49164 49165 49166 | ** ** 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. ** | | | 49270 49271 49272 49273 49274 49275 49276 49277 49278 49279 49280 49281 49282 49283 49284 | ** ** 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.828 2009/03/23 17:11:27 danielk1977 Exp $ */ /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_SeekXX, 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 |
︙ | ︙ | |||
53577 53578 53579 53580 53581 53582 53583 | ** is false, the SQLITE_MASTER table is only parsed if the rest of the ** schema is already loaded into the symbol table. ** ** This opcode invokes the parser to create a new virtual machine, ** then runs the new virtual machine. It is thus a re-entrant opcode. */ case OP_ParseSchema: { | < < < < < < | > > > > > > > > > > > > > > > > > > > > > > > > | > > | | | | | | | > > | | | | | | | | | | > > > | 53687 53688 53689 53690 53691 53692 53693 53694 53695 53696 53697 53698 53699 53700 53701 53702 53703 53704 53705 53706 53707 53708 53709 53710 53711 53712 53713 53714 53715 53716 53717 53718 53719 53720 53721 53722 53723 53724 53725 53726 53727 53728 53729 53730 53731 53732 53733 53734 53735 53736 53737 53738 53739 53740 53741 53742 53743 53744 53745 53746 53747 53748 53749 53750 53751 53752 | ** is false, the SQLITE_MASTER table is only parsed if the rest of the ** schema is already loaded into the symbol table. ** ** This opcode invokes the parser to create a new virtual machine, ** then runs the new virtual machine. It is thus a re-entrant opcode. */ case OP_ParseSchema: { int iDb = pOp->p1; assert( iDb>=0 && iDb<db->nDb ); /* If pOp->p2 is 0, then this opcode is being executed to read a ** single row, for example the row corresponding to a new index ** created by this VDBE, from the sqlite_master table. It only ** does this if the corresponding in-memory schema is currently ** loaded. Otherwise, the new index definition can be loaded along ** with the rest of the schema when it is required. ** ** Although the mutex on the BtShared object that corresponds to ** database iDb (the database containing the sqlite_master table ** read by this instruction) is currently held, it is necessary to ** obtain the mutexes on all attached databases before checking if ** the schema of iDb is loaded. This is because, at the start of ** the sqlite3_exec() call below, SQLite will invoke ** sqlite3BtreeEnterAll(). If all mutexes are not already held, the ** iDb mutex may be temporarily released to avoid deadlock. If ** this happens, then some other thread may delete the in-memory ** schema of database iDb before the SQL statement runs. The schema ** will not be reloaded becuase the db->init.busy flag is set. This ** can result in a "no such table: sqlite_master" or "malformed ** database schema" error being returned to the user. */ assert( sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); sqlite3BtreeEnterAll(db); if( pOp->p2 || DbHasProperty(db, iDb, DB_SchemaLoaded) ){ const char *zMaster = SCHEMA_TABLE(iDb); char *zSql; InitData initData; initData.db = db; initData.iDb = pOp->p1; initData.pzErrMsg = &p->zErrMsg; zSql = sqlite3MPrintf(db, "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s", db->aDb[iDb].zName, zMaster, pOp->p4.z); if( zSql==0 ){ rc = SQLITE_NOMEM; }else{ (void)sqlite3SafetyOff(db); assert( db->init.busy==0 ); db->init.busy = 1; initData.rc = SQLITE_OK; assert( !db->mallocFailed ); rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); if( rc==SQLITE_OK ) rc = initData.rc; sqlite3DbFree(db, zSql); db->init.busy = 0; (void)sqlite3SafetyOn(db); } } sqlite3BtreeLeaveAll(db); if( rc==SQLITE_NOMEM ){ goto no_mem; } break; } #if !defined(SQLITE_OMIT_ANALYZE) && !defined(SQLITE_OMIT_PARSER) |
︙ | ︙ | |||
54610 54611 54612 54613 54614 54615 54616 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement incremental BLOB I/O. ** | | | 54745 54746 54747 54748 54749 54750 54751 54752 54753 54754 54755 54756 54757 54758 54759 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains code used to implement incremental BLOB I/O. ** ** $Id: vdbeblob.c,v 1.31 2009/03/24 15:08:10 drh Exp $ */ #ifndef SQLITE_OMIT_INCRBLOB /* ** Valid sqlite3_blob* handles point to Incrblob structures. |
︙ | ︙ | |||
54860 54861 54862 54863 54864 54865 54866 54867 54868 | /* ** Close a blob handle that was previously created using ** sqlite3_blob_open(). */ SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){ Incrblob *p = (Incrblob *)pBlob; int rc; rc = sqlite3_finalize(p->pStmt); | > > > | > | 54995 54996 54997 54998 54999 55000 55001 55002 55003 55004 55005 55006 55007 55008 55009 55010 55011 55012 55013 55014 55015 | /* ** Close a blob handle that was previously created using ** sqlite3_blob_open(). */ SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){ Incrblob *p = (Incrblob *)pBlob; int rc; sqlite3 *db; db = p->db; sqlite3_mutex_enter(db->mutex); rc = sqlite3_finalize(p->pStmt); sqlite3DbFree(db, p); sqlite3_mutex_leave(db->mutex); return rc; } /* ** Perform a read or write operation on a blob */ static int blobReadWrite( |
︙ | ︙ | |||
56753 56754 56755 56756 56757 56758 56759 | ** 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. ** | | | 56892 56893 56894 56895 56896 56897 56898 56899 56900 56901 56902 56903 56904 56905 56906 | ** 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.424 2009/03/25 16:51:43 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 |
︙ | ︙ | |||
57144 57145 57146 57147 57148 57149 57150 57151 | } pNew->op = (u8)op; pNew->pLeft = pLeft; pNew->pRight = pRight; pNew->iAgg = -1; pNew->span.z = (u8*)""; if( pToken ){ assert( pToken->dyn==0 ); | > > > > > > > > > > > > > | > > > | 57283 57284 57285 57286 57287 57288 57289 57290 57291 57292 57293 57294 57295 57296 57297 57298 57299 57300 57301 57302 57303 57304 57305 57306 57307 57308 57309 57310 57311 57312 57313 57314 | } pNew->op = (u8)op; pNew->pLeft = pLeft; pNew->pRight = pRight; pNew->iAgg = -1; pNew->span.z = (u8*)""; if( pToken ){ int c; assert( pToken->dyn==0 ); pNew->span = *pToken; /* The pToken->z value is read-only. But the new expression ** node created here might be passed to sqlite3DequoteExpr() which ** will attempt to modify pNew->token.z. Hence, if the token ** is quoted, make a copy now so that DequoteExpr() will change ** the copy rather than the original text. */ if( pToken->n>=2 && ((c = pToken->z[0])=='\'' || c=='"' || c=='[' || c=='`') ){ sqlite3TokenCopy(db, &pNew->token, pToken); }else{ pNew->token = *pToken; pNew->flags |= EP_Dequoted; VVA_ONLY( pNew->vvaFlags |= EVVA_ReadOnlyToken; ) } }else if( pLeft ){ if( pRight ){ if( pRight->span.dyn==0 && pLeft->span.dyn==0 ){ sqlite3ExprSpan(pNew, &pLeft->span, &pRight->span); } if( pRight->flags & EP_ExpCollate ){ pNew->flags |= EP_ExpCollate; |
︙ | ︙ | |||
57251 57252 57253 57254 57255 57256 57257 | */ SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){ Expr *pNew; sqlite3 *db = pParse->db; assert( pToken ); pNew = sqlite3DbMallocZero(db, sizeof(Expr) ); if( pNew==0 ){ | | < | | | 57406 57407 57408 57409 57410 57411 57412 57413 57414 57415 57416 57417 57418 57419 57420 57421 57422 57423 57424 57425 57426 57427 57428 | */ SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){ Expr *pNew; sqlite3 *db = pParse->db; assert( pToken ); pNew = sqlite3DbMallocZero(db, sizeof(Expr) ); if( pNew==0 ){ sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ return 0; } pNew->op = TK_FUNCTION; pNew->x.pList = pList; assert( !ExprHasProperty(pNew, EP_xIsSelect) ); assert( pToken->dyn==0 ); pNew->span = *pToken; sqlite3TokenCopy(db, &pNew->token, pToken); sqlite3ExprSetHeight(pParse, pNew); return pNew; } /* ** Assign a variable number to an expression that encodes a wildcard ** in the original SQL statement. |
︙ | ︙ | |||
57384 57385 57386 57387 57388 57389 57390 | sqlite3DbFree(db, p); } /* ** The Expr.token field might be a string literal that is quoted. ** If so, remove the quotation marks. */ | | | < < | | < < < < < < < < < | < < < < < | 57538 57539 57540 57541 57542 57543 57544 57545 57546 57547 57548 57549 57550 57551 57552 57553 57554 57555 57556 57557 | sqlite3DbFree(db, p); } /* ** The Expr.token field might be a string literal that is quoted. ** If so, remove the quotation marks. */ SQLITE_PRIVATE void sqlite3DequoteExpr(Expr *p){ if( !ExprHasAnyProperty(p, EP_Dequoted) ){ ExprSetProperty(p, EP_Dequoted); assert( (p->vvaFlags & EVVA_ReadOnlyToken)==0 ); sqlite3Dequote((char*)p->token.z); } } /* ** Return the number of bytes allocated for the expression structure ** passed as the first argument. This is always one of EXPR_FULLSIZE, ** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. */ |
︙ | ︙ | |||
57454 57455 57456 57457 57458 57459 57460 | static int dupedExprNodeSize(Expr *p, int flags){ int nByte = dupedExprStructSize(p, flags) + (p->token.z ? p->token.n + 1 : 0); if( (flags&EXPRDUP_DISTINCTSPAN) || (flags&EXPRDUP_SPAN && (p->token.z!=p->span.z || p->token.n!=p->span.n)) ){ nByte += p->span.n; } | | | 57592 57593 57594 57595 57596 57597 57598 57599 57600 57601 57602 57603 57604 57605 57606 | static int dupedExprNodeSize(Expr *p, int flags){ int nByte = dupedExprStructSize(p, flags) + (p->token.z ? p->token.n + 1 : 0); if( (flags&EXPRDUP_DISTINCTSPAN) || (flags&EXPRDUP_SPAN && (p->token.z!=p->span.z || p->token.n!=p->span.n)) ){ nByte += p->span.n; } return ROUND8(nByte); } /* ** Return the number of bytes required to create a duplicate of the ** expression passed as the first argument. The second argument is a ** mask containing EXPRDUP_XXX flags. ** |
︙ | ︙ | |||
57616 57617 57618 57619 57620 57621 57622 | ** If the EXPRDUP_REDUCE flag is set, then the structure returned is a ** truncated version of the usual Expr structure that will be stored as ** part of the in-memory representation of the database schema. */ SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){ return exprDup(db, p, flags, 0); } | | | 57754 57755 57756 57757 57758 57759 57760 57761 57762 57763 57764 57765 57766 57767 57768 | ** If the EXPRDUP_REDUCE flag is set, then the structure returned is a ** truncated version of the usual Expr structure that will be stored as ** part of the in-memory representation of the database schema. */ SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){ return exprDup(db, p, flags, 0); } SQLITE_PRIVATE void sqlite3TokenCopy(sqlite3 *db, Token *pTo, const Token *pFrom){ if( pTo->dyn ) sqlite3DbFree(db, (char*)pTo->z); if( pFrom->z ){ pTo->n = pFrom->n; pTo->z = (u8*)sqlite3DbStrNDup(db, (char*)pFrom->z, pFrom->n); pTo->dyn = 1; }else{ pTo->z = 0; |
︙ | ︙ | |||
58736 58737 58738 58739 58740 58741 58742 | break; } case TK_FLOAT: { codeReal(v, (char*)pExpr->token.z, pExpr->token.n, 0, target); break; } case TK_STRING: { | | | 58874 58875 58876 58877 58878 58879 58880 58881 58882 58883 58884 58885 58886 58887 58888 | break; } case TK_FLOAT: { codeReal(v, (char*)pExpr->token.z, pExpr->token.n, 0, target); break; } case TK_STRING: { sqlite3DequoteExpr(pExpr); sqlite3VdbeAddOp4(v,OP_String8, 0, target, 0, (char*)pExpr->token.z, pExpr->token.n); break; } case TK_NULL: { sqlite3VdbeAddOp2(v, OP_Null, 0, target); break; |
︙ | ︙ | |||
59238 59239 59240 59241 59242 59243 59244 | "RAISE() may only be used within a trigger-program"); return 0; } if( pExpr->affinity!=OE_Ignore ){ assert( pExpr->affinity==OE_Rollback || pExpr->affinity == OE_Abort || pExpr->affinity == OE_Fail ); | | | 59376 59377 59378 59379 59380 59381 59382 59383 59384 59385 59386 59387 59388 59389 59390 | "RAISE() may only be used within a trigger-program"); return 0; } if( pExpr->affinity!=OE_Ignore ){ assert( pExpr->affinity==OE_Rollback || pExpr->affinity == OE_Abort || pExpr->affinity == OE_Fail ); sqlite3DequoteExpr(pExpr); sqlite3VdbeAddOp4(v, OP_Halt, SQLITE_CONSTRAINT, pExpr->affinity, 0, (char*)pExpr->token.z, pExpr->token.n); } else { assert( pExpr->affinity == OE_Ignore ); sqlite3VdbeAddOp2(v, OP_ContextPop, 0, 0); sqlite3VdbeAddOp2(v, OP_Goto, 0, pParse->trigStack->ignoreJump); VdbeComment((v, "raise(IGNORE)")); |
︙ | ︙ | |||
60066 60067 60068 60069 60070 60071 60072 | ** 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 used to generate VDBE code ** that implements the ALTER TABLE command. ** | | | 60204 60205 60206 60207 60208 60209 60210 60211 60212 60213 60214 60215 60216 60217 60218 | ** 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 used to generate VDBE code ** that implements the ALTER TABLE command. ** ** $Id: alter.c,v 1.55 2009/03/24 15:08:10 drh Exp $ */ /* ** The code in this file only exists if we are not omitting the ** ALTER TABLE logic from the build. */ #ifndef SQLITE_OMIT_ALTERTABLE |
︙ | ︙ | |||
60646 60647 60648 60649 60650 60651 60652 | ** table because user table are not allowed to have the "sqlite_" ** prefix on their name. */ pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table)); if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; pNew->nRef = 1; | | | 60784 60785 60786 60787 60788 60789 60790 60791 60792 60793 60794 60795 60796 60797 60798 | ** table because user table are not allowed to have the "sqlite_" ** prefix on their name. */ pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table)); if( !pNew ) goto exit_begin_add_column; pParse->pNewTable = pNew; pNew->nRef = 1; pNew->dbMem = pTab->dbMem; pNew->nCol = pTab->nCol; assert( pNew->nCol>0 ); nAlloc = (((pNew->nCol-1)/8)*8)+8; assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc); pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName); if( !pNew->aCol || !pNew->zName ){ |
︙ | ︙ | |||
61917 61918 61919 61920 61921 61922 61923 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** | | | 62055 62056 62057 62058 62059 62060 62061 62062 62063 62064 62065 62066 62067 62068 62069 | ** CREATE INDEX ** DROP INDEX ** creating ID lists ** BEGIN TRANSACTION ** COMMIT ** ROLLBACK ** ** $Id: build.c,v 1.527 2009/03/31 03:41:57 shane 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){ |
︙ | ︙ | |||
62233 62234 62235 62236 62237 62238 62239 | return p; } /* ** Reclaim the memory used by an index */ static void freeIndex(Index *p){ | | | 62371 62372 62373 62374 62375 62376 62377 62378 62379 62380 62381 62382 62383 62384 62385 | return p; } /* ** Reclaim the memory used by an index */ static void freeIndex(Index *p){ sqlite3 *db = p->pTable->dbMem; sqlite3DbFree(db, p->zColAff); sqlite3DbFree(db, p); } /* ** Remove the given index from the index hash table, and free ** its memory structures. |
︙ | ︙ | |||
62361 62362 62363 62364 62365 62366 62367 | /* ** Clear the column names from a table or view. */ static void sqliteResetColumnNames(Table *pTable){ int i; Column *pCol; | | | 62499 62500 62501 62502 62503 62504 62505 62506 62507 62508 62509 62510 62511 62512 62513 | /* ** Clear the column names from a table or view. */ static void sqliteResetColumnNames(Table *pTable){ int i; Column *pCol; sqlite3 *db = pTable->dbMem; assert( pTable!=0 ); if( (pCol = pTable->aCol)!=0 ){ for(i=0; i<pTable->nCol; i++, pCol++){ sqlite3DbFree(db, pCol->zName); sqlite3ExprDelete(db, pCol->pDflt); sqlite3DbFree(db, pCol->zType); sqlite3DbFree(db, pCol->zColl); |
︙ | ︙ | |||
62392 62393 62394 62395 62396 62397 62398 | */ SQLITE_PRIVATE void sqlite3DeleteTable(Table *pTable){ Index *pIndex, *pNext; FKey *pFKey, *pNextFKey; sqlite3 *db; if( pTable==0 ) return; | | | 62530 62531 62532 62533 62534 62535 62536 62537 62538 62539 62540 62541 62542 62543 62544 | */ SQLITE_PRIVATE void sqlite3DeleteTable(Table *pTable){ Index *pIndex, *pNext; FKey *pFKey, *pNextFKey; sqlite3 *db; if( pTable==0 ) return; db = pTable->dbMem; /* Do not delete the table until the reference count reaches zero. */ pTable->nRef--; if( pTable->nRef>0 ){ return; } assert( pTable->nRef==0 ); |
︙ | ︙ | |||
62730 62731 62732 62733 62734 62735 62736 | pParse->nErr++; goto begin_table_error; } pTable->zName = zName; pTable->iPKey = -1; pTable->pSchema = db->aDb[iDb].pSchema; pTable->nRef = 1; | | | 62868 62869 62870 62871 62872 62873 62874 62875 62876 62877 62878 62879 62880 62881 62882 | pParse->nErr++; goto begin_table_error; } pTable->zName = zName; pTable->iPKey = -1; pTable->pSchema = db->aDb[iDb].pSchema; pTable->nRef = 1; pTable->dbMem = db->lookaside.bEnabled ? db : 0; if( pParse->pNewTable ) sqlite3DeleteTable(pParse->pNewTable); pParse->pNewTable = pTable; /* If this is the magic sqlite_sequence table used by autoincrement, ** then record a pointer to this table in the main database structure ** so that INSERT can find the table easily. */ |
︙ | ︙ | |||
63749 63750 63751 63752 63753 63754 63755 63756 63757 63758 63759 63760 63761 63762 63763 63764 63765 63766 63767 63768 63769 63770 63771 63772 63773 | ** to the elements of the FROM clause. But we do not want these changes ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ assert( pTable->pSelect ); pSel = sqlite3SelectDup(db, pTable->pSelect, 0); if( pSel ){ n = pParse->nTab; sqlite3SrcListAssignCursors(pParse, pSel->pSrc); pTable->nCol = -1; #ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; db->xAuth = 0; pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); db->xAuth = xAuth; #else pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); #endif pParse->nTab = n; if( pSelTab ){ assert( pTable->aCol==0 ); pTable->nCol = pSelTab->nCol; pTable->aCol = pSelTab->aCol; pSelTab->nCol = 0; pSelTab->aCol = 0; | > > > | 63887 63888 63889 63890 63891 63892 63893 63894 63895 63896 63897 63898 63899 63900 63901 63902 63903 63904 63905 63906 63907 63908 63909 63910 63911 63912 63913 63914 | ** to the elements of the FROM clause. But we do not want these changes ** to be permanent. So the computation is done on a copy of the SELECT ** statement that defines the view. */ assert( pTable->pSelect ); pSel = sqlite3SelectDup(db, pTable->pSelect, 0); if( pSel ){ u8 enableLookaside = db->lookaside.bEnabled; n = pParse->nTab; sqlite3SrcListAssignCursors(pParse, pSel->pSrc); pTable->nCol = -1; db->lookaside.bEnabled = 0; #ifndef SQLITE_OMIT_AUTHORIZATION xAuth = db->xAuth; db->xAuth = 0; pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); db->xAuth = xAuth; #else pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); #endif db->lookaside.bEnabled = enableLookaside; pParse->nTab = n; if( pSelTab ){ assert( pTable->aCol==0 ); pTable->nCol = pSelTab->nCol; pTable->aCol = pSelTab->aCol; pSelTab->nCol = 0; pSelTab->aCol = 0; |
︙ | ︙ | |||
65589 65590 65591 65592 65593 65594 65595 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** | | | 65730 65731 65732 65733 65734 65735 65736 65737 65738 65739 65740 65741 65742 65743 65744 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains functions used to access the internal hash tables ** of user defined functions and collation sequences. ** ** $Id: callback.c,v 1.37 2009/03/24 15:08:10 drh Exp $ */ /* ** Invoke the 'collation needed' callback to request a collation sequence ** in the database text encoding of name zName, length nName. ** If the collation sequence |
︙ | ︙ | |||
65998 65999 66000 66001 66002 66003 66004 66005 66006 66007 66008 66009 66010 66011 | for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem)); } sqlite3HashClear(&temp2); sqlite3HashInit(&pSchema->tblHash, 0); for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ Table *pTab = sqliteHashData(pElem); sqlite3DeleteTable(pTab); } sqlite3HashClear(&temp1); pSchema->pSeqTab = 0; pSchema->flags &= ~DB_SchemaLoaded; } | > | 66139 66140 66141 66142 66143 66144 66145 66146 66147 66148 66149 66150 66151 66152 66153 | for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem)); } sqlite3HashClear(&temp2); sqlite3HashInit(&pSchema->tblHash, 0); for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ Table *pTab = sqliteHashData(pElem); assert( pTab->dbMem==0 ); sqlite3DeleteTable(pTab); } sqlite3HashClear(&temp1); pSchema->pSeqTab = 0; pSchema->flags &= ~DB_SchemaLoaded; } |
︙ | ︙ | |||
66681 66682 66683 66684 66685 66686 66687 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 66823 66824 66825 66826 66827 66828 66829 66830 66831 66832 66833 66834 66835 66836 66837 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: func.c,v 1.225 2009/03/27 15:26:03 danielk1977 Exp $ */ /* ** Return the collating function associated with a function. */ static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ return context->pColl; |
︙ | ︙ | |||
67966 67967 67968 67969 67970 67971 67972 | SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){ struct compareInfo *pInfo; if( caseSensitive ){ pInfo = (struct compareInfo*)&likeInfoAlt; }else{ pInfo = (struct compareInfo*)&likeInfoNorm; } | | | | | 68108 68109 68110 68111 68112 68113 68114 68115 68116 68117 68118 68119 68120 68121 68122 68123 68124 | SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){ struct compareInfo *pInfo; if( caseSensitive ){ pInfo = (struct compareInfo*)&likeInfoAlt; }else{ pInfo = (struct compareInfo*)&likeInfoNorm; } sqlite3CreateFunc(db, "like", 2, SQLITE_ANY, pInfo, likeFunc, 0, 0); sqlite3CreateFunc(db, "like", 3, SQLITE_ANY, pInfo, likeFunc, 0, 0); sqlite3CreateFunc(db, "glob", 2, SQLITE_ANY, (struct compareInfo*)&globInfo, likeFunc, 0,0); setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE); setLikeOptFlag(db, "like", caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE); } /* |
︙ | ︙ | |||
72428 72429 72430 72431 72432 72433 72434 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** | | | 72570 72571 72572 72573 72574 72575 72576 72577 72578 72579 72580 72581 72582 72583 72584 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains the implementation of the sqlite3_prepare() ** interface, and routines that contribute to loading the database schema ** from disk. ** ** $Id: prepare.c,v 1.114 2009/03/24 15:08:10 drh Exp $ */ /* ** Fill the InitData structure with an error message that indicates ** that the database is corrupt. */ static void corruptSchema( |
︙ | ︙ | |||
72491 72492 72493 72494 72495 72496 72497 | /* Call the parser to process a CREATE TABLE, INDEX or VIEW. ** But because db->init.busy is set to 1, no VDBE code is generated ** or executed. All the parser does is build the internal data ** structures that describe the table, index, or view. */ char *zErr; int rc; | < < < < | | 72633 72634 72635 72636 72637 72638 72639 72640 72641 72642 72643 72644 72645 72646 72647 72648 72649 72650 72651 72652 72653 72654 72655 72656 72657 | /* Call the parser to process a CREATE TABLE, INDEX or VIEW. ** But because db->init.busy is set to 1, no VDBE code is generated ** or executed. All the parser does is build the internal data ** structures that describe the table, index, or view. */ char *zErr; int rc; assert( db->init.busy ); db->init.iDb = iDb; db->init.newTnum = atoi(argv[1]); rc = sqlite3_exec(db, argv[2], 0, 0, &zErr); db->init.iDb = 0; assert( rc!=SQLITE_OK || zErr==0 ); if( SQLITE_OK!=rc ){ pData->rc = rc; if( rc==SQLITE_NOMEM ){ db->mallocFailed = 1; }else if( rc!=SQLITE_INTERRUPT && (rc&0xff)!=SQLITE_LOCKED ){ corruptSchema(pData, argv[0], zErr); } sqlite3DbFree(db, zErr); } }else if( argv[0]==0 ){ corruptSchema(pData, 0, 0); }else{ |
︙ | ︙ | |||
73266 73267 73268 73269 73270 73271 73272 | ** 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 SELECT statements in SQLite. ** | | | 73404 73405 73406 73407 73408 73409 73410 73411 73412 73413 73414 73415 73416 73417 73418 | ** 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 SELECT statements in SQLite. ** ** $Id: select.c,v 1.506 2009/03/31 03:41:57 shane Exp $ */ /* ** Delete all the content of a Select structure but do not deallocate ** the select structure itself. */ |
︙ | ︙ | |||
74482 74483 74484 74485 74486 74487 74488 | ** Add type and collation information to a column list based on ** a SELECT statement. ** ** The column list presumably came from selectColumnNamesFromExprList(). ** The column list has only names, not types or collations. This ** routine goes through and adds the types and collations. ** | | | 74620 74621 74622 74623 74624 74625 74626 74627 74628 74629 74630 74631 74632 74633 74634 | ** Add type and collation information to a column list based on ** a SELECT statement. ** ** The column list presumably came from selectColumnNamesFromExprList(). ** The column list has only names, not types or collations. This ** routine goes through and adds the types and collations. ** ** This routine requires that all identifiers in the SELECT ** statement be resolved. */ static void selectAddColumnTypeAndCollation( Parse *pParse, /* Parsing contexts */ int nCol, /* Number of columns */ Column *aCol, /* List of columns */ Select *pSelect /* SELECT used to determine types and collations */ |
︙ | ︙ | |||
74537 74538 74539 74540 74541 74542 74543 | if( pParse->nErr ) return 0; while( pSelect->pPrior ) pSelect = pSelect->pPrior; db->flags = savedFlags; pTab = sqlite3DbMallocZero(db, sizeof(Table) ); if( pTab==0 ){ return 0; } | | | 74675 74676 74677 74678 74679 74680 74681 74682 74683 74684 74685 74686 74687 74688 74689 | if( pParse->nErr ) return 0; while( pSelect->pPrior ) pSelect = pSelect->pPrior; db->flags = savedFlags; pTab = sqlite3DbMallocZero(db, sizeof(Table) ); if( pTab==0 ){ return 0; } pTab->dbMem = db->lookaside.bEnabled ? db : 0; pTab->nRef = 1; pTab->zName = 0; selectColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol); selectAddColumnTypeAndCollation(pParse, pTab->nCol, pTab->aCol, pSelect); pTab->iPKey = -1; if( db->mallocFailed ){ sqlite3DeleteTable(pTab); |
︙ | ︙ | |||
76333 76334 76335 76336 76337 76338 76339 | Select *pSel = pFrom->pSelect; /* A sub-query in the FROM clause of a SELECT */ assert( pSel!=0 ); assert( pFrom->pTab==0 ); sqlite3WalkSelect(pWalker, pSel); pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return WRC_Abort; | | | 76471 76472 76473 76474 76475 76476 76477 76478 76479 76480 76481 76482 76483 76484 76485 | Select *pSel = pFrom->pSelect; /* A sub-query in the FROM clause of a SELECT */ assert( pSel!=0 ); assert( pFrom->pTab==0 ); sqlite3WalkSelect(pWalker, pSel); pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); if( pTab==0 ) return WRC_Abort; pTab->dbMem = db->lookaside.bEnabled ? db : 0; pTab->nRef = 1; pTab->zName = sqlite3MPrintf(db, "sqlite_subquery_%p_", (void*)pTab); while( pSel->pPrior ){ pSel = pSel->pPrior; } selectColumnsFromExprList(pParse, pSel->pEList, &pTab->nCol, &pTab->aCol); pTab->iPKey = -1; pTab->tabFlags |= TF_Ephemeral; #endif |
︙ | ︙ | |||
79619 79620 79621 79622 79623 79624 79625 | ** 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 used to help implement virtual tables. ** | | | 79757 79758 79759 79760 79761 79762 79763 79764 79765 79766 79767 79768 79769 79770 79771 | ** 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 used to help implement virtual tables. ** ** $Id: vtab.c,v 1.84 2009/03/24 15:08:10 drh Exp $ */ #ifndef SQLITE_OMIT_VIRTUALTABLE static int createModule( sqlite3 *db, /* Database in which module is registered */ const char *zName, /* Name assigned to this module */ const sqlite3_module *pModule, /* The definition of the module */ |
︙ | ︙ | |||
79725 79726 79727 79728 79729 79730 79731 | /* ** Clear any and all virtual-table information from the Table record. ** This routine is called, for example, just before deleting the Table ** record. */ SQLITE_PRIVATE void sqlite3VtabClear(Table *p){ sqlite3_vtab *pVtab = p->pVtab; | > | | 79863 79864 79865 79866 79867 79868 79869 79870 79871 79872 79873 79874 79875 79876 79877 79878 | /* ** Clear any and all virtual-table information from the Table record. ** This routine is called, for example, just before deleting the Table ** record. */ SQLITE_PRIVATE void sqlite3VtabClear(Table *p){ sqlite3_vtab *pVtab = p->pVtab; Schema *pSchema = p->pSchema; sqlite3 *db = pSchema ? pSchema->db : 0; if( pVtab ){ assert( p->pMod && p->pMod->pModule ); sqlite3VtabUnlock(db, pVtab); p->pVtab = 0; } if( p->azModuleArg ){ int i; |
︙ | ︙ | |||
80471 80472 80473 80474 80475 80476 80477 | ** 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". ** | | | 80610 80611 80612 80613 80614 80615 80616 80617 80618 80619 80620 80621 80622 80623 80624 | ** 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.379 2009/03/29 00:15:54 drh Exp $ */ /* ** Trace output macros */ #if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) SQLITE_PRIVATE int sqlite3WhereTrace = 0; |
︙ | ︙ | |||
81110 81111 81112 81113 81114 81115 81116 | /* No collation is defined for the ROWID. Use the default. */ pColl = db->pDfltColl; } if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) && (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){ return 0; } | | | 81249 81250 81251 81252 81253 81254 81255 81256 81257 81258 81259 81260 81261 81262 81263 | /* No collation is defined for the ROWID. Use the default. */ pColl = db->pDfltColl; } if( (pColl->type!=SQLITE_COLL_BINARY || *pnoCase) && (pColl->type!=SQLITE_COLL_NOCASE || !*pnoCase) ){ return 0; } sqlite3DequoteExpr(pRight); z = (char *)pRight->token.z; cnt = 0; if( z ){ while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ cnt++; } } if( cnt==0 || 255==(u8)z[cnt-1] ){ return 0; |
︙ | ︙ | |||
82380 82381 82382 82383 82384 82385 82386 | /* Look at each index. */ if( pSrc->pIndex ){ pProbe = pSrc->pIndex; } for(; pProbe; pProbe=(pSrc->pIndex ? 0 : pProbe->pNext)){ | | > | > > > > > > > > > > > | > > | > | > | > | 82519 82520 82521 82522 82523 82524 82525 82526 82527 82528 82529 82530 82531 82532 82533 82534 82535 82536 82537 82538 82539 82540 82541 82542 82543 82544 82545 82546 82547 82548 82549 82550 82551 82552 82553 82554 82555 82556 82557 82558 82559 82560 82561 82562 82563 82564 82565 82566 82567 82568 82569 82570 82571 82572 82573 82574 82575 82576 82577 82578 82579 82580 82581 82582 82583 82584 82585 82586 82587 82588 82589 82590 82591 82592 82593 82594 82595 82596 82597 82598 82599 | /* Look at each index. */ if( pSrc->pIndex ){ pProbe = pSrc->pIndex; } for(; pProbe; pProbe=(pSrc->pIndex ? 0 : pProbe->pNext)){ double inMultiplier = 1; /* Number of equality look-ups needed */ int inMultIsEst = 0; /* True if inMultiplier is an estimate */ WHERETRACE(("... index %s:\n", pProbe->zName)); /* Count the number of columns in the index that are satisfied ** by x=EXPR constraints or x IN (...) constraints. For a term ** of the form x=EXPR we only have to do a single binary search. ** But for x IN (...) we have to do a number of binary searched ** equal to the number of entries on the RHS of the IN operator. ** The inMultipler variable with try to estimate the number of ** binary searches needed. */ wsFlags = 0; for(i=0; i<pProbe->nColumn; i++){ int j = pProbe->aiColumn[i]; pTerm = findTerm(pWC, iCur, j, notReady, eqTermMask, pProbe); if( pTerm==0 ) break; wsFlags |= WHERE_COLUMN_EQ; if( pTerm->eOperator & WO_IN ){ Expr *pExpr = pTerm->pExpr; wsFlags |= WHERE_COLUMN_IN; if( ExprHasProperty(pExpr, EP_xIsSelect) ){ inMultiplier *= 25; inMultIsEst = 1; }else if( pExpr->x.pList ){ inMultiplier *= pExpr->x.pList->nExpr + 1; } } } nRow = pProbe->aiRowEst[i] * inMultiplier; /* If inMultiplier is an estimate and that estimate results in an ** nRow it that is more than half number of rows in the table, ** then reduce inMultipler */ if( inMultIsEst && nRow*2 > pProbe->aiRowEst[0] ){ nRow = pProbe->aiRowEst[0]/2; inMultiplier = nRow/pProbe->aiRowEst[i]; } cost = nRow + inMultiplier*estLog(pProbe->aiRowEst[0]); nEq = i; if( pProbe->onError!=OE_None && (wsFlags & WHERE_COLUMN_IN)==0 && nEq==pProbe->nColumn ){ wsFlags |= WHERE_UNIQUE; } WHERETRACE(("...... nEq=%d inMult=%.9g nRow=%.9g cost=%.9g\n", nEq, inMultiplier, nRow, cost)); /* Look for range constraints. Assume that each range constraint ** makes the search space 1/3rd smaller. */ if( nEq<pProbe->nColumn ){ int j = pProbe->aiColumn[nEq]; pTerm = findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE|WO_GT|WO_GE, pProbe); if( pTerm ){ wsFlags |= WHERE_COLUMN_RANGE; if( findTerm(pWC, iCur, j, notReady, WO_LT|WO_LE, pProbe) ){ wsFlags |= WHERE_TOP_LIMIT; cost /= 3; nRow /= 3; } if( findTerm(pWC, iCur, j, notReady, WO_GT|WO_GE, pProbe) ){ wsFlags |= WHERE_BTM_LIMIT; cost /= 3; nRow /= 3; } WHERETRACE(("...... range reduces nRow to %.9g and cost to %.9g\n", nRow, cost)); } } /* Add the additional cost of sorting if that is a factor. */ if( pOrderBy ){ if( (wsFlags & WHERE_COLUMN_IN)==0 && |
︙ | ︙ | |||
84015 84016 84017 84018 84019 84020 84021 | ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** YYNSTATE the combined number of states. ** YYNRULE the number of rules in the grammar ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ #define YYCODETYPE unsigned char | | > > > | | < < < | | | | | | | | | 84171 84172 84173 84174 84175 84176 84177 84178 84179 84180 84181 84182 84183 84184 84185 84186 84187 84188 84189 84190 84191 84192 84193 84194 84195 84196 84197 84198 84199 84200 84201 84202 84203 84204 84205 84206 84207 84208 84209 84210 84211 84212 | ** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser ** YYNSTATE the combined number of states. ** YYNRULE the number of rules in the grammar ** YYERRORSYMBOL is the code number of the error symbol. If not ** defined, then do no error processing. */ #define YYCODETYPE unsigned char #define YYNOCODE 239 #define YYACTIONTYPE unsigned short int #define YYWILDCARD 65 #define sqlite3ParserTOKENTYPE Token typedef union { int yyinit; sqlite3ParserTOKENTYPE yy0; int yy60; struct TrigEvent yy62; struct {int value; int mask;} yy243; struct LikeOp yy258; ExprList* yy266; IdList* yy272; Select* yy331; struct LimitVal yy348; SrcList* yy427; Expr* yy454; TriggerStep* yy455; } YYMINORTYPE; #ifndef YYSTACKDEPTH #define YYSTACKDEPTH 100 #endif #define sqlite3ParserARG_SDECL Parse *pParse; #define sqlite3ParserARG_PDECL ,Parse *pParse #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse #define sqlite3ParserARG_STORE yypParser->pParse = pParse #define YYNSTATE 549 #define YYNRULE 284 #define YYFALLBACK 1 #define YY_NO_ACTION (YYNSTATE+YYNRULE+2) #define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) #define YY_ERROR_ACTION (YYNSTATE+YYNRULE) /* The yyzerominor constant is used to initialize instances of ** YYMINORTYPE objects to zero. */ |
︙ | ︙ | |||
84101 84102 84103 84104 84105 84106 84107 | ** 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[] = { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 84257 84258 84259 84260 84261 84262 84263 84264 84265 84266 84267 84268 84269 84270 84271 84272 84273 84274 84275 84276 84277 84278 84279 84280 84281 84282 84283 84284 84285 84286 84287 84288 84289 84290 84291 84292 84293 84294 84295 84296 84297 84298 84299 84300 84301 84302 84303 84304 84305 84306 84307 84308 84309 84310 84311 84312 84313 84314 84315 84316 84317 84318 84319 84320 84321 84322 84323 84324 84325 84326 84327 84328 84329 84330 84331 84332 84333 84334 84335 84336 84337 84338 84339 84340 84341 84342 84343 84344 84345 84346 84347 84348 84349 84350 84351 84352 84353 84354 84355 84356 84357 84358 84359 84360 84361 84362 84363 84364 84365 84366 84367 84368 84369 84370 84371 84372 84373 84374 84375 84376 84377 84378 84379 84380 84381 84382 84383 84384 84385 84386 84387 84388 84389 84390 84391 84392 84393 84394 84395 84396 84397 84398 84399 84400 84401 84402 84403 84404 84405 84406 84407 84408 84409 84410 84411 84412 84413 84414 84415 84416 84417 84418 84419 84420 84421 84422 84423 84424 84425 84426 84427 84428 84429 84430 84431 84432 84433 84434 84435 84436 84437 84438 84439 84440 84441 84442 84443 84444 84445 84446 84447 84448 84449 84450 84451 84452 84453 84454 84455 84456 84457 84458 84459 84460 84461 84462 84463 84464 84465 84466 84467 84468 84469 84470 84471 84472 84473 84474 84475 84476 84477 84478 84479 84480 84481 84482 84483 84484 84485 84486 84487 84488 84489 84490 84491 84492 84493 84494 84495 84496 84497 84498 84499 84500 84501 84502 84503 84504 84505 84506 84507 84508 84509 84510 84511 84512 84513 84514 84515 84516 84517 84518 84519 84520 84521 84522 84523 84524 84525 84526 84527 84528 84529 84530 84531 84532 84533 84534 84535 84536 84537 84538 84539 84540 84541 84542 84543 84544 84545 84546 84547 84548 84549 84550 84551 84552 84553 84554 84555 84556 84557 84558 84559 84560 84561 84562 84563 84564 84565 84566 84567 84568 84569 84570 84571 84572 84573 84574 84575 84576 84577 84578 84579 84580 84581 84582 84583 84584 84585 84586 84587 84588 84589 84590 84591 84592 84593 84594 84595 84596 84597 84598 84599 84600 84601 84602 84603 84604 84605 84606 84607 84608 84609 84610 84611 84612 84613 84614 84615 84616 84617 84618 84619 84620 84621 84622 84623 84624 84625 84626 84627 84628 84629 84630 84631 84632 84633 84634 84635 84636 84637 84638 84639 84640 84641 84642 84643 84644 84645 84646 84647 84648 84649 84650 84651 84652 84653 84654 84655 84656 84657 84658 84659 84660 84661 84662 84663 84664 84665 84666 84667 84668 84669 84670 84671 84672 | ** 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 */ 273, 834, 155, 548, 2, 138, 192, 396, 21, 21, /* 10 */ 21, 21, 143, 23, 23, 23, 23, 24, 24, 25, /* 20 */ 25, 25, 26, 194, 370, 371, 190, 370, 371, 403, /* 30 */ 409, 28, 23, 23, 23, 23, 24, 24, 25, 25, /* 40 */ 25, 26, 194, 27, 440, 29, 122, 20, 19, 277, /* 50 */ 413, 414, 410, 410, 22, 22, 21, 21, 21, 21, /* 60 */ 393, 23, 23, 23, 23, 24, 24, 25, 25, 25, /* 70 */ 26, 194, 273, 334, 280, 396, 425, 196, 42, 23, /* 80 */ 23, 23, 23, 24, 24, 25, 25, 25, 26, 194, /* 90 */ 483, 169, 373, 374, 144, 373, 374, 326, 329, 330, /* 100 */ 280, 403, 409, 142, 27, 18, 29, 122, 331, 24, /* 110 */ 24, 25, 25, 25, 26, 194, 138, 263, 396, 20, /* 120 */ 19, 277, 413, 414, 410, 410, 22, 22, 21, 21, /* 130 */ 21, 21, 142, 23, 23, 23, 23, 24, 24, 25, /* 140 */ 25, 25, 26, 194, 273, 206, 427, 303, 178, 115, /* 150 */ 452, 133, 120, 234, 324, 239, 325, 141, 275, 266, /* 160 */ 297, 264, 144, 243, 243, 326, 329, 330, 55, 529, /* 170 */ 171, 206, 396, 403, 409, 294, 331, 469, 120, 234, /* 180 */ 324, 239, 325, 141, 392, 68, 396, 275, 429, 200, /* 190 */ 243, 20, 19, 277, 413, 414, 410, 410, 22, 22, /* 200 */ 21, 21, 21, 21, 393, 23, 23, 23, 23, 24, /* 210 */ 24, 25, 25, 25, 26, 194, 273, 276, 470, 354, /* 220 */ 260, 259, 398, 297, 396, 361, 311, 194, 290, 367, /* 230 */ 192, 310, 387, 502, 191, 297, 113, 297, 294, 265, /* 240 */ 396, 499, 189, 388, 192, 403, 409, 392, 68, 472, /* 250 */ 294, 499, 294, 400, 400, 400, 360, 452, 389, 392, /* 260 */ 69, 392, 75, 20, 19, 277, 413, 414, 410, 410, /* 270 */ 22, 22, 21, 21, 21, 21, 393, 23, 23, 23, /* 280 */ 23, 24, 24, 25, 25, 25, 26, 194, 273, 311, /* 290 */ 530, 344, 396, 1, 321, 347, 461, 370, 371, 391, /* 300 */ 359, 313, 199, 390, 297, 270, 297, 471, 427, 503, /* 310 */ 178, 225, 456, 27, 170, 29, 122, 403, 409, 294, /* 320 */ 192, 294, 25, 25, 25, 26, 194, 372, 392, 62, /* 330 */ 392, 75, 353, 37, 529, 20, 19, 277, 413, 414, /* 340 */ 410, 410, 22, 22, 21, 21, 21, 21, 393, 23, /* 350 */ 23, 23, 23, 24, 24, 25, 25, 25, 26, 194, /* 360 */ 273, 504, 242, 235, 465, 373, 374, 297, 512, 370, /* 370 */ 371, 198, 386, 54, 236, 279, 372, 372, 297, 278, /* 380 */ 420, 421, 294, 57, 354, 260, 259, 370, 371, 403, /* 390 */ 409, 392, 68, 294, 505, 192, 168, 513, 524, 283, /* 400 */ 365, 362, 392, 83, 14, 40, 162, 20, 19, 277, /* 410 */ 413, 414, 410, 410, 22, 22, 21, 21, 21, 21, /* 420 */ 219, 23, 23, 23, 23, 24, 24, 25, 25, 25, /* 430 */ 26, 194, 273, 315, 504, 297, 468, 373, 374, 319, /* 440 */ 447, 195, 218, 370, 371, 514, 54, 318, 288, 372, /* 450 */ 294, 464, 308, 370, 371, 373, 374, 364, 2, 392, /* 460 */ 83, 403, 409, 448, 144, 26, 194, 326, 329, 330, /* 470 */ 302, 420, 421, 549, 365, 362, 434, 526, 331, 20, /* 480 */ 19, 277, 413, 414, 410, 410, 22, 22, 21, 21, /* 490 */ 21, 21, 435, 23, 23, 23, 23, 24, 24, 25, /* 500 */ 25, 25, 26, 194, 273, 289, 445, 436, 485, 476, /* 510 */ 123, 373, 374, 463, 320, 794, 511, 486, 158, 477, /* 520 */ 447, 373, 374, 510, 446, 417, 456, 404, 405, 294, /* 530 */ 187, 456, 195, 403, 409, 447, 212, 449, 392, 7, /* 540 */ 300, 372, 416, 416, 4, 174, 372, 186, 407, 408, /* 550 */ 426, 20, 19, 277, 413, 414, 410, 410, 22, 22, /* 560 */ 21, 21, 21, 21, 393, 23, 23, 23, 23, 24, /* 570 */ 24, 25, 25, 25, 26, 194, 273, 406, 297, 393, /* 580 */ 246, 242, 300, 297, 416, 416, 297, 488, 352, 342, /* 590 */ 123, 175, 125, 294, 287, 430, 372, 297, 294, 157, /* 600 */ 165, 294, 392, 63, 53, 403, 409, 392, 58, 355, /* 610 */ 392, 66, 294, 493, 300, 447, 416, 416, 207, 474, /* 620 */ 475, 392, 85, 20, 19, 277, 413, 414, 410, 410, /* 630 */ 22, 22, 21, 21, 21, 21, 297, 23, 23, 23, /* 640 */ 23, 24, 24, 25, 25, 25, 26, 194, 273, 297, /* 650 */ 442, 294, 242, 375, 376, 377, 297, 242, 491, 443, /* 660 */ 392, 84, 527, 475, 294, 179, 125, 372, 297, 299, /* 670 */ 226, 294, 372, 392, 89, 193, 338, 403, 409, 492, /* 680 */ 392, 87, 15, 294, 300, 372, 416, 416, 300, 284, /* 690 */ 416, 416, 392, 92, 285, 20, 19, 277, 413, 414, /* 700 */ 410, 410, 22, 22, 21, 21, 21, 21, 297, 23, /* 710 */ 23, 23, 23, 24, 24, 25, 25, 25, 26, 194, /* 720 */ 273, 297, 254, 294, 434, 452, 242, 297, 36, 297, /* 730 */ 38, 282, 392, 93, 423, 423, 294, 372, 480, 481, /* 740 */ 435, 372, 294, 351, 294, 392, 114, 351, 411, 403, /* 750 */ 409, 392, 116, 392, 52, 436, 494, 307, 372, 520, /* 760 */ 341, 520, 372, 286, 230, 255, 384, 20, 30, 277, /* 770 */ 413, 414, 410, 410, 22, 22, 21, 21, 21, 21, /* 780 */ 297, 23, 23, 23, 23, 24, 24, 25, 25, 25, /* 790 */ 26, 194, 273, 297, 164, 294, 254, 124, 522, 322, /* 800 */ 297, 152, 521, 220, 392, 90, 397, 418, 294, 56, /* 810 */ 211, 372, 372, 297, 208, 294, 343, 392, 67, 422, /* 820 */ 316, 403, 409, 228, 392, 88, 391, 424, 294, 454, /* 830 */ 390, 139, 180, 181, 182, 372, 188, 392, 59, 538, /* 840 */ 19, 277, 413, 414, 410, 410, 22, 22, 21, 21, /* 850 */ 21, 21, 297, 23, 23, 23, 23, 24, 24, 25, /* 860 */ 25, 25, 26, 194, 273, 297, 227, 294, 254, 254, /* 870 */ 393, 298, 297, 369, 172, 441, 392, 86, 490, 489, /* 880 */ 294, 372, 305, 372, 372, 297, 372, 294, 372, 392, /* 890 */ 117, 486, 381, 403, 409, 328, 392, 118, 497, 500, /* 900 */ 294, 495, 44, 143, 187, 444, 248, 372, 393, 392, /* 910 */ 119, 540, 541, 277, 413, 414, 410, 410, 22, 22, /* 920 */ 21, 21, 21, 21, 237, 23, 23, 23, 23, 24, /* 930 */ 24, 25, 25, 25, 26, 194, 32, 304, 393, 3, /* 940 */ 297, 254, 297, 293, 371, 183, 382, 245, 252, 143, /* 950 */ 250, 32, 304, 301, 3, 294, 372, 294, 293, 371, /* 960 */ 254, 372, 352, 254, 392, 60, 392, 70, 301, 532, /* 970 */ 297, 306, 333, 297, 143, 372, 496, 254, 372, 393, /* 980 */ 452, 429, 498, 348, 542, 294, 306, 267, 294, 297, /* 990 */ 383, 525, 372, 143, 392, 71, 429, 392, 61, 544, /* 1000 */ 129, 35, 34, 209, 294, 372, 210, 297, 121, 399, /* 1010 */ 33, 295, 296, 392, 72, 398, 35, 34, 462, 232, /* 1020 */ 269, 184, 294, 372, 372, 33, 295, 296, 358, 309, /* 1030 */ 398, 392, 73, 192, 368, 32, 304, 380, 3, 438, /* 1040 */ 6, 451, 293, 371, 372, 455, 400, 400, 400, 401, /* 1050 */ 402, 8, 301, 16, 372, 393, 372, 370, 371, 378, /* 1060 */ 372, 400, 400, 400, 401, 402, 8, 176, 297, 457, /* 1070 */ 306, 240, 213, 214, 215, 131, 217, 379, 291, 537, /* 1080 */ 429, 297, 487, 294, 372, 130, 372, 241, 297, 506, /* 1090 */ 394, 132, 392, 74, 292, 429, 294, 372, 221, 44, /* 1100 */ 35, 34, 372, 294, 372, 392, 76, 297, 247, 33, /* 1110 */ 295, 296, 392, 77, 398, 166, 167, 529, 314, 297, /* 1120 */ 249, 43, 294, 372, 251, 470, 253, 258, 533, 398, /* 1130 */ 139, 392, 78, 222, 294, 372, 312, 346, 349, 372, /* 1140 */ 39, 372, 372, 392, 64, 400, 400, 400, 401, 402, /* 1150 */ 8, 297, 372, 372, 223, 350, 297, 261, 224, 297, /* 1160 */ 400, 400, 400, 534, 395, 51, 294, 357, 268, 259, /* 1170 */ 372, 294, 372, 274, 294, 392, 65, 545, 192, 51, /* 1180 */ 392, 79, 297, 392, 80, 297, 17, 262, 137, 197, /* 1190 */ 439, 156, 45, 229, 317, 453, 231, 294, 323, 233, /* 1200 */ 294, 459, 372, 473, 478, 460, 392, 81, 281, 392, /* 1210 */ 82, 483, 238, 95, 479, 484, 482, 204, 507, 271, /* 1220 */ 508, 203, 509, 335, 272, 501, 205, 515, 146, 147, /* 1230 */ 339, 337, 148, 48, 185, 517, 256, 149, 518, 345, /* 1240 */ 128, 528, 151, 104, 160, 356, 535, 105, 106, 107, /* 1250 */ 108, 110, 91, 543, 366, 202, 216, 385, 177, 99, /* 1260 */ 590, 591, 159, 592, 134, 135, 412, 31, 415, 419, /* 1270 */ 428, 161, 431, 173, 5, 432, 10, 450, 433, 136, /* 1280 */ 437, 41, 94, 9, 140, 126, 458, 466, 467, 201, /* 1290 */ 46, 96, 97, 327, 244, 47, 98, 145, 332, 236, /* 1300 */ 127, 336, 163, 516, 100, 340, 139, 257, 150, 102, /* 1310 */ 13, 531, 49, 11, 103, 153, 154, 536, 101, 539, /* 1320 */ 109, 111, 12, 519, 546, 112, 523, 363, 835, 547, /* 1330 */ 835, 835, 835, 835, 835, 835, 835, 835, 835, 835, /* 1340 */ 835, 835, 835, 835, 835, 835, 50, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 19, 140, 141, 142, 143, 24, 116, 26, 75, 76, /* 10 */ 77, 78, 25, 80, 81, 82, 83, 84, 85, 86, /* 20 */ 87, 88, 89, 90, 26, 27, 158, 26, 27, 48, /* 30 */ 49, 79, 80, 81, 82, 83, 84, 85, 86, 87, /* 40 */ 88, 89, 90, 220, 221, 222, 223, 66, 67, 68, /* 50 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, /* 60 */ 192, 80, 81, 82, 83, 84, 85, 86, 87, 88, /* 70 */ 89, 90, 19, 19, 19, 94, 84, 85, 25, 80, /* 80 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, /* 90 */ 103, 25, 94, 95, 96, 94, 95, 99, 100, 101, /* 100 */ 19, 48, 49, 49, 220, 52, 222, 223, 110, 84, /* 110 */ 85, 86, 87, 88, 89, 90, 24, 16, 26, 66, /* 120 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, /* 130 */ 77, 78, 49, 80, 81, 82, 83, 84, 85, 86, /* 140 */ 87, 88, 89, 90, 19, 90, 164, 165, 166, 24, /* 150 */ 164, 96, 97, 98, 99, 100, 101, 102, 104, 58, /* 160 */ 148, 60, 96, 109, 109, 99, 100, 101, 22, 55, /* 170 */ 158, 90, 26, 48, 49, 163, 110, 172, 97, 98, /* 180 */ 99, 100, 101, 102, 172, 173, 94, 104, 64, 203, /* 190 */ 109, 66, 67, 68, 69, 70, 71, 72, 73, 74, /* 200 */ 75, 76, 77, 78, 192, 80, 81, 82, 83, 84, /* 210 */ 85, 86, 87, 88, 89, 90, 19, 153, 94, 105, /* 220 */ 106, 107, 98, 148, 26, 97, 214, 90, 144, 145, /* 230 */ 116, 219, 170, 171, 150, 148, 152, 148, 163, 138, /* 240 */ 94, 179, 158, 171, 116, 48, 49, 172, 173, 163, /* 250 */ 163, 179, 163, 129, 130, 131, 128, 164, 172, 172, /* 260 */ 173, 172, 173, 66, 67, 68, 69, 70, 71, 72, /* 270 */ 73, 74, 75, 76, 77, 78, 192, 80, 81, 82, /* 280 */ 83, 84, 85, 86, 87, 88, 89, 90, 19, 214, /* 290 */ 11, 227, 94, 22, 219, 231, 203, 26, 27, 113, /* 300 */ 216, 212, 213, 117, 148, 161, 148, 172, 164, 165, /* 310 */ 166, 224, 148, 220, 158, 222, 223, 48, 49, 163, /* 320 */ 116, 163, 86, 87, 88, 89, 90, 163, 172, 173, /* 330 */ 172, 173, 128, 136, 55, 66, 67, 68, 69, 70, /* 340 */ 71, 72, 73, 74, 75, 76, 77, 78, 192, 80, /* 350 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, /* 360 */ 19, 148, 148, 98, 23, 94, 95, 148, 184, 26, /* 370 */ 27, 213, 159, 160, 109, 211, 163, 163, 148, 167, /* 380 */ 168, 169, 163, 22, 105, 106, 107, 26, 27, 48, /* 390 */ 49, 172, 173, 163, 184, 116, 183, 184, 21, 185, /* 400 */ 1, 2, 172, 173, 22, 136, 24, 66, 67, 68, /* 410 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, /* 420 */ 193, 80, 81, 82, 83, 84, 85, 86, 87, 88, /* 430 */ 89, 90, 19, 214, 148, 148, 23, 94, 95, 19, /* 440 */ 25, 229, 156, 26, 27, 159, 160, 27, 218, 163, /* 450 */ 163, 23, 189, 26, 27, 94, 95, 142, 143, 172, /* 460 */ 173, 48, 49, 120, 96, 89, 90, 99, 100, 101, /* 470 */ 167, 168, 169, 0, 1, 2, 12, 100, 110, 66, /* 480 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, /* 490 */ 77, 78, 28, 80, 81, 82, 83, 84, 85, 86, /* 500 */ 87, 88, 89, 90, 19, 218, 25, 43, 23, 45, /* 510 */ 95, 94, 95, 86, 148, 138, 179, 180, 23, 55, /* 520 */ 25, 94, 95, 186, 206, 23, 148, 48, 49, 163, /* 530 */ 158, 148, 229, 48, 49, 120, 146, 120, 172, 173, /* 540 */ 112, 163, 114, 115, 194, 158, 163, 233, 69, 70, /* 550 */ 164, 66, 67, 68, 69, 70, 71, 72, 73, 74, /* 560 */ 75, 76, 77, 78, 192, 80, 81, 82, 83, 84, /* 570 */ 85, 86, 87, 88, 89, 90, 19, 98, 148, 192, /* 580 */ 23, 148, 112, 148, 114, 115, 148, 181, 216, 211, /* 590 */ 95, 204, 205, 163, 211, 23, 163, 148, 163, 23, /* 600 */ 119, 163, 172, 173, 232, 48, 49, 172, 173, 237, /* 610 */ 172, 173, 163, 181, 112, 120, 114, 115, 185, 188, /* 620 */ 189, 172, 173, 66, 67, 68, 69, 70, 71, 72, /* 630 */ 73, 74, 75, 76, 77, 78, 148, 80, 81, 82, /* 640 */ 83, 84, 85, 86, 87, 88, 89, 90, 19, 148, /* 650 */ 31, 163, 148, 7, 8, 9, 148, 148, 35, 40, /* 660 */ 172, 173, 188, 189, 163, 204, 205, 163, 148, 19, /* 670 */ 148, 163, 163, 172, 173, 195, 234, 48, 49, 56, /* 680 */ 172, 173, 202, 163, 112, 163, 114, 115, 112, 185, /* 690 */ 114, 115, 172, 173, 185, 66, 67, 68, 69, 70, /* 700 */ 71, 72, 73, 74, 75, 76, 77, 78, 148, 80, /* 710 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, /* 720 */ 19, 148, 148, 163, 12, 164, 148, 148, 135, 148, /* 730 */ 137, 108, 172, 173, 129, 130, 163, 163, 7, 8, /* 740 */ 28, 163, 163, 148, 163, 172, 173, 148, 98, 48, /* 750 */ 49, 172, 173, 172, 173, 43, 181, 45, 163, 105, /* 760 */ 106, 107, 163, 185, 203, 191, 151, 66, 67, 68, /* 770 */ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, /* 780 */ 148, 80, 81, 82, 83, 84, 85, 86, 87, 88, /* 790 */ 89, 90, 19, 148, 194, 163, 148, 148, 29, 86, /* 800 */ 148, 25, 33, 196, 172, 173, 164, 23, 163, 25, /* 810 */ 215, 163, 163, 148, 215, 163, 47, 172, 173, 230, /* 820 */ 148, 48, 49, 207, 172, 173, 113, 230, 163, 23, /* 830 */ 117, 25, 105, 106, 107, 163, 158, 172, 173, 191, /* 840 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, /* 850 */ 77, 78, 148, 80, 81, 82, 83, 84, 85, 86, /* 860 */ 87, 88, 89, 90, 19, 148, 148, 163, 148, 148, /* 870 */ 192, 148, 148, 148, 158, 175, 172, 173, 97, 98, /* 880 */ 163, 163, 226, 163, 163, 148, 163, 163, 163, 172, /* 890 */ 173, 180, 148, 48, 49, 176, 172, 173, 164, 164, /* 900 */ 163, 23, 126, 25, 158, 175, 16, 163, 192, 172, /* 910 */ 173, 191, 191, 68, 69, 70, 71, 72, 73, 74, /* 920 */ 75, 76, 77, 78, 175, 80, 81, 82, 83, 84, /* 930 */ 85, 86, 87, 88, 89, 90, 19, 20, 192, 22, /* 940 */ 148, 148, 148, 26, 27, 158, 148, 23, 58, 25, /* 950 */ 60, 19, 20, 36, 22, 163, 163, 163, 26, 27, /* 960 */ 148, 163, 216, 148, 172, 173, 172, 173, 36, 197, /* 970 */ 148, 54, 23, 148, 25, 163, 175, 148, 163, 192, /* 980 */ 164, 64, 175, 237, 191, 163, 54, 207, 163, 148, /* 990 */ 148, 23, 163, 25, 172, 173, 64, 172, 173, 197, /* 1000 */ 6, 84, 85, 191, 163, 163, 191, 148, 148, 148, /* 1010 */ 93, 94, 95, 172, 173, 98, 84, 85, 86, 203, /* 1020 */ 191, 158, 163, 163, 163, 93, 94, 95, 207, 148, /* 1030 */ 98, 172, 173, 116, 147, 19, 20, 13, 22, 148, /* 1040 */ 25, 148, 26, 27, 163, 148, 129, 130, 131, 132, /* 1050 */ 133, 134, 36, 22, 163, 192, 163, 26, 27, 147, /* 1060 */ 163, 129, 130, 131, 132, 133, 134, 5, 148, 148, /* 1070 */ 54, 148, 10, 11, 12, 13, 14, 147, 147, 17, /* 1080 */ 64, 148, 148, 163, 163, 149, 163, 148, 148, 148, /* 1090 */ 192, 149, 172, 173, 157, 64, 163, 163, 197, 126, /* 1100 */ 84, 85, 163, 163, 163, 172, 173, 148, 148, 93, /* 1110 */ 94, 95, 172, 173, 98, 84, 85, 55, 123, 148, /* 1120 */ 148, 124, 163, 163, 148, 94, 148, 148, 23, 98, /* 1130 */ 25, 172, 173, 198, 163, 163, 122, 148, 148, 163, /* 1140 */ 135, 163, 163, 172, 173, 129, 130, 131, 132, 133, /* 1150 */ 134, 148, 163, 163, 199, 148, 148, 148, 200, 148, /* 1160 */ 129, 130, 131, 23, 201, 25, 163, 105, 106, 107, /* 1170 */ 163, 163, 163, 111, 163, 172, 173, 23, 116, 25, /* 1180 */ 172, 173, 148, 172, 173, 148, 125, 148, 118, 225, /* 1190 */ 155, 155, 104, 208, 121, 209, 208, 163, 104, 208, /* 1200 */ 163, 209, 163, 174, 174, 209, 172, 173, 46, 172, /* 1210 */ 173, 103, 174, 22, 182, 174, 176, 90, 174, 177, /* 1220 */ 174, 228, 174, 18, 177, 182, 228, 155, 154, 154, /* 1230 */ 44, 155, 154, 135, 155, 155, 235, 154, 236, 155, /* 1240 */ 66, 187, 187, 22, 217, 18, 197, 190, 190, 190, /* 1250 */ 190, 187, 162, 197, 1, 178, 15, 23, 22, 178, /* 1260 */ 118, 118, 217, 118, 118, 118, 98, 22, 113, 23, /* 1270 */ 23, 22, 11, 22, 34, 23, 34, 120, 23, 25, /* 1280 */ 23, 25, 22, 25, 34, 118, 27, 23, 23, 50, /* 1290 */ 22, 22, 22, 50, 23, 22, 22, 102, 50, 109, /* 1300 */ 38, 19, 24, 20, 104, 42, 25, 138, 104, 22, /* 1310 */ 5, 1, 74, 22, 108, 127, 119, 1, 51, 20, /* 1320 */ 119, 108, 22, 57, 128, 127, 51, 3, 238, 4, /* 1330 */ 238, 238, 238, 238, 238, 238, 238, 238, 238, 238, /* 1340 */ 238, 238, 238, 238, 238, 238, 74, }; #define YY_SHIFT_USE_DFLT (-111) #define YY_SHIFT_MAX 363 static const short yy_shift_ofst[] = { /* 0 */ 399, 917, 1062, 917, 1016, 1016, -2, -19, 1016, 1016, /* 10 */ 1016, 1016, 1016, 114, 1, 932, 1016, 1016, 1016, 1016, /* 20 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, /* 30 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, /* 40 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, /* 50 */ 1016, 1016, -48, 279, 198, -8, -8, -110, 53, 125, /* 60 */ 197, 269, 341, 413, 485, 557, 629, 701, 629, 629, /* 70 */ 629, 629, 629, 629, 629, 629, 629, 629, 629, 629, /* 80 */ 629, 629, 629, 629, 773, 845, 845, -67, -67, -1, /* 90 */ -1, 55, 25, 236, 1, 1, 1, 1, 1, 54, /* 100 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 110 */ 1, 1, 1, 377, 376, 198, 137, -111, -111, -111, /* 120 */ 1031, 81, 271, 343, 417, 361, 427, 464, 464, 1, /* 130 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 140 */ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 150 */ 1, 1, 1, 1, 1, 473, 92, 92, 92, 128, /* 160 */ 204, -110, -110, -110, -111, -111, 124, 124, 66, 368, /* 170 */ 428, 502, 572, 712, 576, 495, 646, 713, 146, 415, /* 180 */ 623, 623, 623, 470, 470, 769, 654, 470, 470, 470, /* 190 */ 470, 382, 186, 481, 198, 605, 605, 593, 619, 619, /* 200 */ 420, 619, 83, 619, 198, 619, 198, -13, 776, 420, /* 210 */ 420, 776, 994, 994, 994, 994, 1024, 1024, 1015, -110, /* 220 */ 973, 995, 997, 1014, 1061, 1005, 1070, 1070, 1088, 1073, /* 230 */ 1088, 1073, 1088, 1073, 1094, 1094, 1162, 1094, 1108, 1094, /* 240 */ 1191, 1127, 1127, 1162, 1094, 1094, 1094, 1191, 1205, 1070, /* 250 */ 1205, 1070, 1205, 1070, 1070, 1186, 1098, 1205, 1070, 1174, /* 260 */ 1174, 1221, 973, 1227, 1227, 1227, 1227, 973, 1174, 1221, /* 270 */ -111, -111, -111, 479, 101, 727, 890, 650, 784, 806, /* 280 */ 265, 731, 781, 878, 924, 949, 968, 1105, 1140, 1154, /* 290 */ 1253, 1241, 1234, 1236, 1142, 1143, 1145, 1146, 1147, 1168, /* 300 */ 1155, 1245, 1246, 1247, 1249, 1261, 1251, 1252, 1254, 1255, /* 310 */ 1257, 1256, 1240, 1258, 1242, 1256, 1157, 1260, 1250, 1259, /* 320 */ 1167, 1264, 1265, 1262, 1239, 1268, 1243, 1269, 1271, 1270, /* 330 */ 1273, 1248, 1274, 1195, 1190, 1282, 1283, 1278, 1200, 1263, /* 340 */ 1266, 1267, 1281, 1275, 1169, 1204, 1287, 1305, 1310, 1206, /* 350 */ 1238, 1272, 1188, 1291, 1197, 1316, 1299, 1201, 1213, 1198, /* 360 */ 1300, 1196, 1324, 1325, }; #define YY_REDUCE_USE_DFLT (-178) #define YY_REDUCE_MAX 272 static const short yy_reduce_ofst[] = { /* 0 */ -139, 12, 84, 156, 75, 89, 213, 93, 87, 158, /* 10 */ 219, 230, 287, 372, 286, 366, 430, 435, 438, 449, /* 20 */ 488, 501, 508, 520, 560, 573, 579, 581, 632, 645, /* 30 */ 652, 665, 704, 717, 724, 737, 792, 794, 822, 825, /* 40 */ 841, 859, 920, 933, 940, 959, 971, 1003, 1008, 1011, /* 50 */ 1034, 1037, -177, 746, 144, 212, 303, 387, -116, -116, /* 60 */ -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, /* 70 */ -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, /* 80 */ -116, -116, -116, -116, -116, -116, -116, -116, -116, -116, /* 90 */ -116, 62, -116, -116, 164, 214, 433, 504, 509, 337, /* 100 */ 574, 378, 578, 599, 383, 648, 720, 721, 793, 812, /* 110 */ 815, 595, 829, 64, -116, -18, -116, -116, -116, -116, /* 120 */ 86, 72, 522, 649, 672, 718, 723, 431, 474, 725, /* 130 */ 744, 798, 842, 860, 723, 861, 881, 891, 893, 897, /* 140 */ 921, 923, 934, 939, 941, 960, 972, 976, 978, 979, /* 150 */ 989, 990, 1007, 1009, 1039, 315, -14, 561, 816, -132, /* 160 */ 678, 716, 787, 863, 480, 461, 5, 135, 184, 210, /* 170 */ 227, 227, 227, 263, 227, 318, 390, 350, 386, 318, /* 180 */ 406, 432, 575, 227, 227, 314, 442, 227, 227, 227, /* 190 */ 227, 615, 600, 607, 642, 589, 597, 656, 700, 730, /* 200 */ 616, 749, 711, 801, 734, 807, 735, 719, 772, 780, /* 210 */ 821, 802, 887, 912, 930, 931, 936, 942, 937, 898, /* 220 */ 901, 935, 955, 958, 963, 964, 1035, 1036, 985, 986, /* 230 */ 988, 992, 991, 996, 1029, 1030, 1032, 1038, 1040, 1041, /* 240 */ 1042, 993, 998, 1043, 1044, 1046, 1048, 1047, 1074, 1072, /* 250 */ 1075, 1076, 1078, 1079, 1080, 1001, 1002, 1083, 1084, 1054, /* 260 */ 1055, 1027, 1049, 1057, 1058, 1059, 1060, 1056, 1064, 1045, /* 270 */ 1090, 1077, 1081, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 554, 789, 833, 833, 789, 833, 833, 677, 787, 833, /* 10 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 20 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 30 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 40 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 50 */ 833, 833, 761, 833, 593, 806, 806, 681, 712, 833, /* 60 */ 833, 833, 833, 833, 833, 833, 713, 833, 791, 786, /* 70 */ 782, 784, 783, 790, 714, 703, 710, 717, 692, 819, /* 80 */ 719, 720, 726, 727, 749, 748, 767, 751, 773, 750, /* 90 */ 760, 585, 752, 753, 833, 833, 833, 833, 833, 646, /* 100 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 110 */ 833, 833, 833, 580, 754, 833, 755, 768, 769, 770, /* 120 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 560, /* 130 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 140 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 150 */ 833, 833, 833, 833, 833, 554, 677, 677, 677, 833, /* 160 */ 833, 833, 833, 833, 671, 681, 833, 833, 637, 833, /* 170 */ 833, 833, 833, 833, 833, 833, 562, 669, 595, 679, /* 180 */ 833, 833, 833, 582, 658, 812, 833, 826, 824, 660, /* 190 */ 722, 833, 669, 678, 833, 833, 833, 785, 706, 706, /* 200 */ 694, 706, 616, 706, 833, 706, 833, 619, 716, 694, /* 210 */ 694, 716, 559, 559, 559, 559, 570, 570, 636, 833, /* 220 */ 716, 707, 709, 699, 711, 833, 685, 685, 693, 698, /* 230 */ 693, 698, 693, 698, 648, 648, 633, 648, 619, 648, /* 240 */ 795, 799, 799, 633, 648, 648, 648, 795, 577, 685, /* 250 */ 577, 685, 577, 685, 685, 816, 818, 577, 685, 650, /* 260 */ 650, 728, 716, 657, 657, 657, 657, 716, 650, 728, /* 270 */ 603, 621, 621, 833, 833, 833, 833, 833, 833, 833, /* 280 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 290 */ 833, 568, 833, 587, 735, 740, 736, 833, 737, 833, /* 300 */ 663, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 310 */ 833, 788, 833, 700, 833, 708, 833, 833, 833, 833, /* 320 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 330 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 340 */ 833, 814, 815, 833, 833, 833, 833, 833, 833, 833, /* 350 */ 833, 833, 833, 833, 833, 833, 833, 833, 833, 833, /* 360 */ 833, 833, 555, 833, 550, 552, 553, 557, 558, 561, /* 370 */ 587, 588, 590, 591, 592, 563, 564, 565, 566, 567, /* 380 */ 569, 573, 571, 572, 574, 581, 583, 602, 604, 606, /* 390 */ 667, 668, 732, 661, 662, 666, 589, 743, 734, 738, /* 400 */ 739, 741, 742, 756, 757, 759, 765, 772, 775, 758, /* 410 */ 763, 764, 766, 771, 774, 664, 665, 778, 596, 597, /* 420 */ 600, 601, 802, 804, 803, 805, 599, 598, 744, 747, /* 430 */ 780, 781, 827, 828, 829, 830, 831, 776, 686, 779, /* 440 */ 762, 701, 704, 705, 702, 670, 680, 688, 689, 690, /* 450 */ 691, 675, 676, 682, 697, 730, 731, 695, 696, 683, /* 460 */ 684, 672, 673, 674, 777, 733, 745, 746, 607, 608, /* 470 */ 740, 609, 610, 611, 649, 652, 653, 654, 612, 631, /* 480 */ 634, 635, 613, 620, 614, 615, 622, 623, 624, 627, /* 490 */ 628, 629, 630, 625, 626, 796, 797, 800, 798, 617, /* 500 */ 618, 632, 605, 594, 586, 638, 641, 642, 643, 644, /* 510 */ 645, 647, 639, 640, 584, 575, 578, 687, 808, 817, /* 520 */ 813, 809, 810, 811, 579, 792, 793, 651, 724, 725, /* 530 */ 807, 820, 822, 729, 823, 825, 821, 576, 655, 656, /* 540 */ 659, 801, 832, 715, 718, 721, 723, 556, 551, }; #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. |
︙ | ︙ | |||
84534 84535 84536 84537 84538 84539 84540 | 26, /* EXCLUSIVE => ID */ 0, /* COMMIT => nothing */ 26, /* END => ID */ 26, /* ROLLBACK => ID */ 26, /* SAVEPOINT => ID */ 26, /* RELEASE => ID */ 0, /* TO => nothing */ | < > | 84690 84691 84692 84693 84694 84695 84696 84697 84698 84699 84700 84701 84702 84703 84704 84705 | 26, /* EXCLUSIVE => ID */ 0, /* COMMIT => nothing */ 26, /* END => ID */ 26, /* ROLLBACK => ID */ 26, /* SAVEPOINT => ID */ 26, /* RELEASE => ID */ 0, /* TO => nothing */ 0, /* TABLE => nothing */ 0, /* CREATE => nothing */ 26, /* IF => ID */ 0, /* NOT => nothing */ 0, /* EXISTS => nothing */ 26, /* TEMP => ID */ 0, /* LP => nothing */ 0, /* RP => nothing */ 0, /* AS => nothing */ |
︙ | ︙ | |||
84738 84739 84740 84741 84742 84743 84744 | /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ static const char *const yyTokenName[] = { "$", "SEMI", "EXPLAIN", "QUERY", "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", "ROLLBACK", "SAVEPOINT", "RELEASE", "TO", | | | 84894 84895 84896 84897 84898 84899 84900 84901 84902 84903 84904 84905 84906 84907 84908 | /* For tracing shifts, the names of all terminals and nonterminals ** are required. The following table supplies these names */ static const char *const yyTokenName[] = { "$", "SEMI", "EXPLAIN", "QUERY", "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", "ROLLBACK", "SAVEPOINT", "RELEASE", "TO", "TABLE", "CREATE", "IF", "NOT", "EXISTS", "TEMP", "LP", "RP", "AS", "COMMA", "ID", "INDEXED", "ABORT", "AFTER", "ANALYZE", "ASC", "ATTACH", "BEFORE", "BY", "CASCADE", "CAST", "COLUMNKW", "CONFLICT", "DATABASE", "DESC", "DETACH", "EACH", "FAIL", "FOR", "IGNORE", "INITIALLY", "INSTEAD", |
︙ | ︙ | |||
84772 84773 84774 84775 84776 84777 84778 | "HAVING", "LIMIT", "WHERE", "INTO", "VALUES", "INTEGER", "FLOAT", "BLOB", "REGISTER", "VARIABLE", "CASE", "WHEN", "THEN", "ELSE", "INDEX", "error", "input", "cmdlist", "ecmd", "explain", "cmdx", "cmd", "transtype", "trans_opt", "nm", "savepoint_opt", "create_table", "create_table_args", | | | | | | | | | | | | | | | | | | | | | | | | 84928 84929 84930 84931 84932 84933 84934 84935 84936 84937 84938 84939 84940 84941 84942 84943 84944 84945 84946 84947 84948 84949 84950 84951 84952 84953 84954 84955 84956 84957 84958 84959 84960 84961 84962 84963 | "HAVING", "LIMIT", "WHERE", "INTO", "VALUES", "INTEGER", "FLOAT", "BLOB", "REGISTER", "VARIABLE", "CASE", "WHEN", "THEN", "ELSE", "INDEX", "error", "input", "cmdlist", "ecmd", "explain", "cmdx", "cmd", "transtype", "trans_opt", "nm", "savepoint_opt", "create_table", "create_table_args", "createkw", "temp", "ifnotexists", "dbnm", "columnlist", "conslist_opt", "select", "column", "columnid", "type", "carglist", "id", "ids", "typetoken", "typename", "signed", "plus_num", "minus_num", "carg", "ccons", "term", "expr", "onconf", "sortorder", "autoinc", "idxlist_opt", "refargs", "defer_subclause", "refarg", "refact", "init_deferred_pred_opt", "conslist", "tcons", "idxlist", "defer_subclause_opt", "orconf", "resolvetype", "raisetype", "ifexists", "fullname", "oneselect", "multiselect_op", "distinct", "selcollist", "from", "where_opt", "groupby_opt", "having_opt", "orderby_opt", "limit_opt", "sclp", "as", "seltablist", "stl_prefix", "joinop", "indexed_opt", "on_opt", "using_opt", "joinop2", "inscollist", "sortlist", "sortitem", "nexprlist", "setlist", "insert_cmd", "inscollist_opt", "itemlist", "exprlist", "likeop", "escape", "between_op", "in_op", "case_operand", "case_exprlist", "case_else", "uniqueflag", "collate", "plus_opt", "number", "trigger_decl", "trigger_cmd_list", "trigger_time", "trigger_event", "foreach_clause", "when_clause", "trigger_cmd", }; #endif /* NDEBUG */ #ifndef NDEBUG /* For tracing reduce actions, the names of all rules are required. */ static const char *const yyRuleName[] = { |
︙ | ︙ | |||
84827 84828 84829 84830 84831 84832 84833 | /* 19 */ "cmd ::= ROLLBACK trans_opt", /* 20 */ "savepoint_opt ::= SAVEPOINT", /* 21 */ "savepoint_opt ::=", /* 22 */ "cmd ::= SAVEPOINT nm", /* 23 */ "cmd ::= RELEASE savepoint_opt nm", /* 24 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm", /* 25 */ "cmd ::= create_table create_table_args", | | > | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | > | | | | | | | | < | | | | | | | | > | | | | | | | < | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | < | | | > | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | > | | | | | | | | | | | | | | | | | | 84983 84984 84985 84986 84987 84988 84989 84990 84991 84992 84993 84994 84995 84996 84997 84998 84999 85000 85001 85002 85003 85004 85005 85006 85007 85008 85009 85010 85011 85012 85013 85014 85015 85016 85017 85018 85019 85020 85021 85022 85023 85024 85025 85026 85027 85028 85029 85030 85031 85032 85033 85034 85035 85036 85037 85038 85039 85040 85041 85042 85043 85044 85045 85046 85047 85048 85049 85050 85051 85052 85053 85054 85055 85056 85057 85058 85059 85060 85061 85062 85063 85064 85065 85066 85067 85068 85069 85070 85071 85072 85073 85074 85075 85076 85077 85078 85079 85080 85081 85082 85083 85084 85085 85086 85087 85088 85089 85090 85091 85092 85093 85094 85095 85096 85097 85098 85099 85100 85101 85102 85103 85104 85105 85106 85107 85108 85109 85110 85111 85112 85113 85114 85115 85116 85117 85118 85119 85120 85121 85122 85123 85124 85125 85126 85127 85128 85129 85130 85131 85132 85133 85134 85135 85136 85137 85138 85139 85140 85141 85142 85143 85144 85145 85146 85147 85148 85149 85150 85151 85152 85153 85154 85155 85156 85157 85158 85159 85160 85161 85162 85163 85164 85165 85166 85167 85168 85169 85170 85171 85172 85173 85174 85175 85176 85177 85178 85179 85180 85181 85182 85183 85184 85185 85186 85187 85188 85189 85190 85191 85192 85193 85194 85195 85196 85197 85198 85199 85200 85201 85202 85203 85204 85205 85206 85207 85208 85209 85210 85211 85212 85213 85214 85215 85216 85217 85218 85219 85220 85221 85222 85223 85224 85225 85226 85227 85228 85229 85230 85231 85232 85233 85234 85235 85236 85237 85238 85239 85240 85241 85242 85243 85244 85245 85246 85247 85248 85249 85250 85251 85252 85253 85254 | /* 19 */ "cmd ::= ROLLBACK trans_opt", /* 20 */ "savepoint_opt ::= SAVEPOINT", /* 21 */ "savepoint_opt ::=", /* 22 */ "cmd ::= SAVEPOINT nm", /* 23 */ "cmd ::= RELEASE savepoint_opt nm", /* 24 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm", /* 25 */ "cmd ::= create_table create_table_args", /* 26 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm", /* 27 */ "createkw ::= CREATE", /* 28 */ "ifnotexists ::=", /* 29 */ "ifnotexists ::= IF NOT EXISTS", /* 30 */ "temp ::= TEMP", /* 31 */ "temp ::=", /* 32 */ "create_table_args ::= LP columnlist conslist_opt RP", /* 33 */ "create_table_args ::= AS select", /* 34 */ "columnlist ::= columnlist COMMA column", /* 35 */ "columnlist ::= column", /* 36 */ "column ::= columnid type carglist", /* 37 */ "columnid ::= nm", /* 38 */ "id ::= ID", /* 39 */ "id ::= INDEXED", /* 40 */ "ids ::= ID|STRING", /* 41 */ "nm ::= id", /* 42 */ "nm ::= STRING", /* 43 */ "nm ::= JOIN_KW", /* 44 */ "type ::=", /* 45 */ "type ::= typetoken", /* 46 */ "typetoken ::= typename", /* 47 */ "typetoken ::= typename LP signed RP", /* 48 */ "typetoken ::= typename LP signed COMMA signed RP", /* 49 */ "typename ::= ids", /* 50 */ "typename ::= typename ids", /* 51 */ "signed ::= plus_num", /* 52 */ "signed ::= minus_num", /* 53 */ "carglist ::= carglist carg", /* 54 */ "carglist ::=", /* 55 */ "carg ::= CONSTRAINT nm ccons", /* 56 */ "carg ::= ccons", /* 57 */ "ccons ::= DEFAULT term", /* 58 */ "ccons ::= DEFAULT LP expr RP", /* 59 */ "ccons ::= DEFAULT PLUS term", /* 60 */ "ccons ::= DEFAULT MINUS term", /* 61 */ "ccons ::= DEFAULT id", /* 62 */ "ccons ::= NULL onconf", /* 63 */ "ccons ::= NOT NULL onconf", /* 64 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", /* 65 */ "ccons ::= UNIQUE onconf", /* 66 */ "ccons ::= CHECK LP expr RP", /* 67 */ "ccons ::= REFERENCES nm idxlist_opt refargs", /* 68 */ "ccons ::= defer_subclause", /* 69 */ "ccons ::= COLLATE ids", /* 70 */ "autoinc ::=", /* 71 */ "autoinc ::= AUTOINCR", /* 72 */ "refargs ::=", /* 73 */ "refargs ::= refargs refarg", /* 74 */ "refarg ::= MATCH nm", /* 75 */ "refarg ::= ON DELETE refact", /* 76 */ "refarg ::= ON UPDATE refact", /* 77 */ "refarg ::= ON INSERT refact", /* 78 */ "refact ::= SET NULL", /* 79 */ "refact ::= SET DEFAULT", /* 80 */ "refact ::= CASCADE", /* 81 */ "refact ::= RESTRICT", /* 82 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", /* 83 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", /* 84 */ "init_deferred_pred_opt ::=", /* 85 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", /* 86 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", /* 87 */ "conslist_opt ::=", /* 88 */ "conslist_opt ::= COMMA conslist", /* 89 */ "conslist ::= conslist COMMA tcons", /* 90 */ "conslist ::= conslist tcons", /* 91 */ "conslist ::= tcons", /* 92 */ "tcons ::= CONSTRAINT nm", /* 93 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", /* 94 */ "tcons ::= UNIQUE LP idxlist RP onconf", /* 95 */ "tcons ::= CHECK LP expr RP onconf", /* 96 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", /* 97 */ "defer_subclause_opt ::=", /* 98 */ "defer_subclause_opt ::= defer_subclause", /* 99 */ "onconf ::=", /* 100 */ "onconf ::= ON CONFLICT resolvetype", /* 101 */ "orconf ::=", /* 102 */ "orconf ::= OR resolvetype", /* 103 */ "resolvetype ::= raisetype", /* 104 */ "resolvetype ::= IGNORE", /* 105 */ "resolvetype ::= REPLACE", /* 106 */ "cmd ::= DROP TABLE ifexists fullname", /* 107 */ "ifexists ::= IF EXISTS", /* 108 */ "ifexists ::=", /* 109 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select", /* 110 */ "cmd ::= DROP VIEW ifexists fullname", /* 111 */ "cmd ::= select", /* 112 */ "select ::= oneselect", /* 113 */ "select ::= select multiselect_op oneselect", /* 114 */ "multiselect_op ::= UNION", /* 115 */ "multiselect_op ::= UNION ALL", /* 116 */ "multiselect_op ::= EXCEPT|INTERSECT", /* 117 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", /* 118 */ "distinct ::= DISTINCT", /* 119 */ "distinct ::= ALL", /* 120 */ "distinct ::=", /* 121 */ "sclp ::= selcollist COMMA", /* 122 */ "sclp ::=", /* 123 */ "selcollist ::= sclp expr as", /* 124 */ "selcollist ::= sclp STAR", /* 125 */ "selcollist ::= sclp nm DOT STAR", /* 126 */ "as ::= AS nm", /* 127 */ "as ::= ids", /* 128 */ "as ::=", /* 129 */ "from ::=", /* 130 */ "from ::= FROM seltablist", /* 131 */ "stl_prefix ::= seltablist joinop", /* 132 */ "stl_prefix ::=", /* 133 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", /* 134 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", /* 135 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", /* 136 */ "dbnm ::=", /* 137 */ "dbnm ::= DOT nm", /* 138 */ "fullname ::= nm dbnm", /* 139 */ "joinop ::= COMMA|JOIN", /* 140 */ "joinop ::= JOIN_KW JOIN", /* 141 */ "joinop ::= JOIN_KW nm JOIN", /* 142 */ "joinop ::= JOIN_KW nm nm JOIN", /* 143 */ "on_opt ::= ON expr", /* 144 */ "on_opt ::=", /* 145 */ "indexed_opt ::=", /* 146 */ "indexed_opt ::= INDEXED BY nm", /* 147 */ "indexed_opt ::= NOT INDEXED", /* 148 */ "using_opt ::= USING LP inscollist RP", /* 149 */ "using_opt ::=", /* 150 */ "orderby_opt ::=", /* 151 */ "orderby_opt ::= ORDER BY sortlist", /* 152 */ "sortlist ::= sortlist COMMA sortitem sortorder", /* 153 */ "sortlist ::= sortitem sortorder", /* 154 */ "sortitem ::= expr", /* 155 */ "sortorder ::= ASC", /* 156 */ "sortorder ::= DESC", /* 157 */ "sortorder ::=", /* 158 */ "groupby_opt ::=", /* 159 */ "groupby_opt ::= GROUP BY nexprlist", /* 160 */ "having_opt ::=", /* 161 */ "having_opt ::= HAVING expr", /* 162 */ "limit_opt ::=", /* 163 */ "limit_opt ::= LIMIT expr", /* 164 */ "limit_opt ::= LIMIT expr OFFSET expr", /* 165 */ "limit_opt ::= LIMIT expr COMMA expr", /* 166 */ "cmd ::= DELETE FROM fullname indexed_opt where_opt", /* 167 */ "where_opt ::=", /* 168 */ "where_opt ::= WHERE expr", /* 169 */ "cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt", /* 170 */ "setlist ::= setlist COMMA nm EQ expr", /* 171 */ "setlist ::= nm EQ expr", /* 172 */ "cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP", /* 173 */ "cmd ::= insert_cmd INTO fullname inscollist_opt select", /* 174 */ "cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES", /* 175 */ "insert_cmd ::= INSERT orconf", /* 176 */ "insert_cmd ::= REPLACE", /* 177 */ "itemlist ::= itemlist COMMA expr", /* 178 */ "itemlist ::= expr", /* 179 */ "inscollist_opt ::=", /* 180 */ "inscollist_opt ::= LP inscollist RP", /* 181 */ "inscollist ::= inscollist COMMA nm", /* 182 */ "inscollist ::= nm", /* 183 */ "expr ::= term", /* 184 */ "expr ::= LP expr RP", /* 185 */ "term ::= NULL", /* 186 */ "expr ::= id", /* 187 */ "expr ::= JOIN_KW", /* 188 */ "expr ::= nm DOT nm", /* 189 */ "expr ::= nm DOT nm DOT nm", /* 190 */ "term ::= INTEGER|FLOAT|BLOB", /* 191 */ "term ::= STRING", /* 192 */ "expr ::= REGISTER", /* 193 */ "expr ::= VARIABLE", /* 194 */ "expr ::= expr COLLATE ids", /* 195 */ "expr ::= CAST LP expr AS typetoken RP", /* 196 */ "expr ::= ID LP distinct exprlist RP", /* 197 */ "expr ::= ID LP STAR RP", /* 198 */ "term ::= CTIME_KW", /* 199 */ "expr ::= expr AND expr", /* 200 */ "expr ::= expr OR expr", /* 201 */ "expr ::= expr LT|GT|GE|LE expr", /* 202 */ "expr ::= expr EQ|NE expr", /* 203 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", /* 204 */ "expr ::= expr PLUS|MINUS expr", /* 205 */ "expr ::= expr STAR|SLASH|REM expr", /* 206 */ "expr ::= expr CONCAT expr", /* 207 */ "likeop ::= LIKE_KW", /* 208 */ "likeop ::= NOT LIKE_KW", /* 209 */ "likeop ::= MATCH", /* 210 */ "likeop ::= NOT MATCH", /* 211 */ "escape ::= ESCAPE expr", /* 212 */ "escape ::=", /* 213 */ "expr ::= expr likeop expr escape", /* 214 */ "expr ::= expr ISNULL|NOTNULL", /* 215 */ "expr ::= expr IS NULL", /* 216 */ "expr ::= expr NOT NULL", /* 217 */ "expr ::= expr IS NOT NULL", /* 218 */ "expr ::= NOT expr", /* 219 */ "expr ::= BITNOT expr", /* 220 */ "expr ::= MINUS expr", /* 221 */ "expr ::= PLUS expr", /* 222 */ "between_op ::= BETWEEN", /* 223 */ "between_op ::= NOT BETWEEN", /* 224 */ "expr ::= expr between_op expr AND expr", /* 225 */ "in_op ::= IN", /* 226 */ "in_op ::= NOT IN", /* 227 */ "expr ::= expr in_op LP exprlist RP", /* 228 */ "expr ::= LP select RP", /* 229 */ "expr ::= expr in_op LP select RP", /* 230 */ "expr ::= expr in_op nm dbnm", /* 231 */ "expr ::= EXISTS LP select RP", /* 232 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 233 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", /* 234 */ "case_exprlist ::= WHEN expr THEN expr", /* 235 */ "case_else ::= ELSE expr", /* 236 */ "case_else ::=", /* 237 */ "case_operand ::= expr", /* 238 */ "case_operand ::=", /* 239 */ "exprlist ::= nexprlist", /* 240 */ "exprlist ::=", /* 241 */ "nexprlist ::= nexprlist COMMA expr", /* 242 */ "nexprlist ::= expr", /* 243 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP", /* 244 */ "uniqueflag ::= UNIQUE", /* 245 */ "uniqueflag ::=", /* 246 */ "idxlist_opt ::=", /* 247 */ "idxlist_opt ::= LP idxlist RP", /* 248 */ "idxlist ::= idxlist COMMA nm collate sortorder", /* 249 */ "idxlist ::= nm collate sortorder", /* 250 */ "collate ::=", /* 251 */ "collate ::= COLLATE ids", /* 252 */ "cmd ::= DROP INDEX ifexists fullname", /* 253 */ "plus_num ::= plus_opt number", /* 254 */ "minus_num ::= MINUS number", /* 255 */ "number ::= INTEGER|FLOAT", /* 256 */ "plus_opt ::= PLUS", /* 257 */ "plus_opt ::=", /* 258 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", /* 259 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", /* 260 */ "trigger_time ::= BEFORE", /* 261 */ "trigger_time ::= AFTER", /* 262 */ "trigger_time ::= INSTEAD OF", /* 263 */ "trigger_time ::=", /* 264 */ "trigger_event ::= DELETE|INSERT", /* 265 */ "trigger_event ::= UPDATE", /* 266 */ "trigger_event ::= UPDATE OF inscollist", /* 267 */ "foreach_clause ::=", /* 268 */ "foreach_clause ::= FOR EACH ROW", /* 269 */ "when_clause ::=", /* 270 */ "when_clause ::= WHEN expr", /* 271 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", /* 272 */ "trigger_cmd_list ::= trigger_cmd SEMI", /* 273 */ "trigger_cmd ::= UPDATE orconf nm SET setlist where_opt", /* 274 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP", /* 275 */ "trigger_cmd ::= insert_cmd INTO nm inscollist_opt select", /* 276 */ "trigger_cmd ::= DELETE FROM nm where_opt", /* 277 */ "trigger_cmd ::= select", /* 278 */ "expr ::= RAISE LP IGNORE RP", /* 279 */ "expr ::= RAISE LP raisetype COMMA nm RP", /* 280 */ "raisetype ::= ROLLBACK", /* 281 */ "raisetype ::= ABORT", /* 282 */ "raisetype ::= FAIL", /* 283 */ "cmd ::= DROP TRIGGER ifexists fullname", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. |
︙ | ︙ | |||
85162 85163 85164 85165 85166 85167 85168 | ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are not used ** inside the C code. */ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 85319 85320 85321 85322 85323 85324 85325 85326 85327 85328 85329 85330 85331 85332 85333 85334 85335 85336 85337 85338 85339 85340 85341 85342 85343 85344 85345 85346 85347 85348 85349 85350 85351 85352 85353 85354 85355 85356 85357 85358 85359 85360 85361 85362 85363 85364 85365 85366 85367 85368 85369 85370 85371 85372 85373 85374 85375 85376 85377 85378 85379 85380 85381 85382 85383 85384 85385 85386 85387 85388 85389 85390 85391 85392 | ** reduce or during error processing or when a parser is ** being destroyed before it is finished parsing. ** ** Note: during a reduce, the only symbols destroyed are those ** which appear on the RHS of the rule, but which are not used ** inside the C code. */ case 158: /* select */ case 192: /* oneselect */ { sqlite3SelectDelete(pParse->db, (yypminor->yy331)); } break; case 172: /* term */ case 173: /* expr */ case 197: /* where_opt */ case 199: /* having_opt */ case 208: /* on_opt */ case 213: /* sortitem */ case 221: /* escape */ case 224: /* case_operand */ case 226: /* case_else */ case 236: /* when_clause */ { sqlite3ExprDelete(pParse->db, (yypminor->yy454)); } break; case 177: /* idxlist_opt */ case 185: /* idxlist */ case 195: /* selcollist */ case 198: /* groupby_opt */ case 200: /* orderby_opt */ case 202: /* sclp */ case 212: /* sortlist */ case 214: /* nexprlist */ case 215: /* setlist */ case 218: /* itemlist */ case 219: /* exprlist */ case 225: /* case_exprlist */ { sqlite3ExprListDelete(pParse->db, (yypminor->yy266)); } break; case 191: /* fullname */ case 196: /* from */ case 204: /* seltablist */ case 205: /* stl_prefix */ { sqlite3SrcListDelete(pParse->db, (yypminor->yy427)); } break; case 209: /* using_opt */ case 211: /* inscollist */ case 217: /* inscollist_opt */ { sqlite3IdListDelete(pParse->db, (yypminor->yy272)); } break; case 232: /* trigger_cmd_list */ case 237: /* trigger_cmd */ { sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy455)); } break; case 234: /* trigger_event */ { sqlite3IdListDelete(pParse->db, (yypminor->yy62).b); } break; default: break; /* If no destructor action specified: do nothing */ } } /* |
︙ | ︙ | |||
85481 85482 85483 85484 85485 85486 85487 | { 149, 1 }, { 149, 0 }, { 145, 2 }, { 145, 3 }, { 145, 5 }, { 145, 2 }, { 150, 6 }, | > | | | | | | < | | | > | | | < < | | | | < < | | | < < < < | | | | | | | | | | > > > | | | | | | | | < < | > > | | | > | | | | | | | | | | > > | | | > > | | | | < < < < | | | < | | | < | | < | | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | < < | | | | | | | > > | | | | | | | | | | | | | | | < < < | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < | | | > | > > | | | | | | | | | | | | | 85638 85639 85640 85641 85642 85643 85644 85645 85646 85647 85648 85649 85650 85651 85652 85653 85654 85655 85656 85657 85658 85659 85660 85661 85662 85663 85664 85665 85666 85667 85668 85669 85670 85671 85672 85673 85674 85675 85676 85677 85678 85679 85680 85681 85682 85683 85684 85685 85686 85687 85688 85689 85690 85691 85692 85693 85694 85695 85696 85697 85698 85699 85700 85701 85702 85703 85704 85705 85706 85707 85708 85709 85710 85711 85712 85713 85714 85715 85716 85717 85718 85719 85720 85721 85722 85723 85724 85725 85726 85727 85728 85729 85730 85731 85732 85733 85734 85735 85736 85737 85738 85739 85740 85741 85742 85743 85744 85745 85746 85747 85748 85749 85750 85751 85752 85753 85754 85755 85756 85757 85758 85759 85760 85761 85762 85763 85764 85765 85766 85767 85768 85769 85770 85771 85772 85773 85774 85775 85776 85777 85778 85779 85780 85781 85782 85783 85784 85785 85786 85787 85788 85789 85790 85791 85792 85793 85794 85795 85796 85797 85798 85799 85800 85801 85802 85803 85804 85805 85806 85807 85808 85809 85810 85811 85812 85813 85814 85815 85816 85817 85818 85819 85820 85821 85822 85823 85824 85825 85826 85827 85828 85829 85830 85831 85832 85833 85834 85835 85836 85837 85838 85839 85840 85841 85842 85843 85844 85845 85846 85847 85848 85849 85850 85851 85852 85853 85854 85855 85856 85857 85858 85859 85860 85861 85862 85863 85864 85865 85866 85867 85868 85869 85870 85871 85872 85873 85874 85875 85876 85877 85878 85879 85880 85881 85882 85883 85884 85885 85886 85887 85888 85889 85890 85891 85892 85893 85894 85895 85896 85897 85898 85899 85900 85901 85902 85903 85904 85905 85906 85907 | { 149, 1 }, { 149, 0 }, { 145, 2 }, { 145, 3 }, { 145, 5 }, { 145, 2 }, { 150, 6 }, { 152, 1 }, { 154, 0 }, { 154, 3 }, { 153, 1 }, { 153, 0 }, { 151, 4 }, { 151, 2 }, { 156, 3 }, { 156, 1 }, { 159, 3 }, { 160, 1 }, { 163, 1 }, { 163, 1 }, { 164, 1 }, { 148, 1 }, { 148, 1 }, { 148, 1 }, { 161, 0 }, { 161, 1 }, { 165, 1 }, { 165, 4 }, { 165, 6 }, { 166, 1 }, { 166, 2 }, { 167, 1 }, { 167, 1 }, { 162, 2 }, { 162, 0 }, { 170, 3 }, { 170, 1 }, { 171, 2 }, { 171, 4 }, { 171, 3 }, { 171, 3 }, { 171, 2 }, { 171, 2 }, { 171, 3 }, { 171, 5 }, { 171, 2 }, { 171, 4 }, { 171, 4 }, { 171, 1 }, { 171, 2 }, { 176, 0 }, { 176, 1 }, { 178, 0 }, { 178, 2 }, { 180, 2 }, { 180, 3 }, { 180, 3 }, { 180, 3 }, { 181, 2 }, { 181, 2 }, { 181, 1 }, { 181, 1 }, { 179, 3 }, { 179, 2 }, { 182, 0 }, { 182, 2 }, { 182, 2 }, { 157, 0 }, { 157, 2 }, { 183, 3 }, { 183, 2 }, { 183, 1 }, { 184, 2 }, { 184, 7 }, { 184, 5 }, { 184, 5 }, { 184, 10 }, { 186, 0 }, { 186, 1 }, { 174, 0 }, { 174, 3 }, { 187, 0 }, { 187, 2 }, { 188, 1 }, { 188, 1 }, { 188, 1 }, { 145, 4 }, { 190, 2 }, { 190, 0 }, { 145, 8 }, { 145, 4 }, { 145, 1 }, { 158, 1 }, { 158, 3 }, { 193, 1 }, { 193, 2 }, { 193, 1 }, { 192, 9 }, { 194, 1 }, { 194, 1 }, { 194, 0 }, { 202, 2 }, { 202, 0 }, { 195, 3 }, { 195, 2 }, { 195, 4 }, { 203, 2 }, { 203, 1 }, { 203, 0 }, { 196, 0 }, { 196, 2 }, { 205, 2 }, { 205, 0 }, { 204, 7 }, { 204, 7 }, { 204, 7 }, { 155, 0 }, { 155, 2 }, { 191, 2 }, { 206, 1 }, { 206, 2 }, { 206, 3 }, { 206, 4 }, { 208, 2 }, { 208, 0 }, { 207, 0 }, { 207, 3 }, { 207, 2 }, { 209, 4 }, { 209, 0 }, { 200, 0 }, { 200, 3 }, { 212, 4 }, { 212, 2 }, { 213, 1 }, { 175, 1 }, { 175, 1 }, { 175, 0 }, { 198, 0 }, { 198, 3 }, { 199, 0 }, { 199, 2 }, { 201, 0 }, { 201, 2 }, { 201, 4 }, { 201, 4 }, { 145, 5 }, { 197, 0 }, { 197, 2 }, { 145, 7 }, { 215, 5 }, { 215, 3 }, { 145, 8 }, { 145, 5 }, { 145, 6 }, { 216, 2 }, { 216, 1 }, { 218, 3 }, { 218, 1 }, { 217, 0 }, { 217, 3 }, { 211, 3 }, { 211, 1 }, { 173, 1 }, { 173, 3 }, { 172, 1 }, { 173, 1 }, { 173, 1 }, { 173, 3 }, { 173, 5 }, { 172, 1 }, { 172, 1 }, { 173, 1 }, { 173, 1 }, { 173, 3 }, { 173, 6 }, { 173, 5 }, { 173, 4 }, { 172, 1 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 173, 3 }, { 220, 1 }, { 220, 2 }, { 220, 1 }, { 220, 2 }, { 221, 2 }, { 221, 0 }, { 173, 4 }, { 173, 2 }, { 173, 3 }, { 173, 3 }, { 173, 4 }, { 173, 2 }, { 173, 2 }, { 173, 2 }, { 173, 2 }, { 222, 1 }, { 222, 2 }, { 173, 5 }, { 223, 1 }, { 223, 2 }, { 173, 5 }, { 173, 3 }, { 173, 5 }, { 173, 4 }, { 173, 4 }, { 173, 5 }, { 225, 5 }, { 225, 4 }, { 226, 2 }, { 226, 0 }, { 224, 1 }, { 224, 0 }, { 219, 1 }, { 219, 0 }, { 214, 3 }, { 214, 1 }, { 145, 11 }, { 227, 1 }, { 227, 0 }, { 177, 0 }, { 177, 3 }, { 185, 5 }, { 185, 3 }, { 228, 0 }, { 228, 2 }, { 145, 4 }, { 168, 2 }, { 169, 2 }, { 230, 1 }, { 229, 1 }, { 229, 0 }, { 145, 5 }, { 231, 11 }, { 233, 1 }, { 233, 1 }, { 233, 2 }, { 233, 0 }, { 234, 1 }, { 234, 1 }, { 234, 3 }, { 235, 0 }, { 235, 3 }, { 236, 0 }, { 236, 2 }, { 232, 3 }, { 232, 2 }, { 237, 6 }, { 237, 8 }, { 237, 5 }, { 237, 4 }, { 237, 1 }, { 173, 4 }, { 173, 6 }, { 189, 1 }, { 189, 1 }, { 189, 1 }, { 145, 4 }, }; static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately |
︙ | ︙ | |||
85802 85803 85804 85805 85806 85807 85808 | case 4: /* ecmd ::= explain cmdx SEMI */ case 10: /* trans_opt ::= */ case 11: /* trans_opt ::= TRANSACTION */ case 12: /* trans_opt ::= TRANSACTION nm */ case 20: /* savepoint_opt ::= SAVEPOINT */ case 21: /* savepoint_opt ::= */ case 25: /* cmd ::= create_table create_table_args */ | | | | | | | | | | | | | | | | | | | | | | | | | 85960 85961 85962 85963 85964 85965 85966 85967 85968 85969 85970 85971 85972 85973 85974 85975 85976 85977 85978 85979 85980 85981 85982 85983 85984 85985 85986 85987 85988 85989 85990 85991 85992 85993 85994 85995 85996 85997 85998 85999 86000 86001 86002 86003 86004 86005 86006 86007 86008 86009 86010 86011 86012 86013 86014 86015 86016 86017 86018 | case 4: /* ecmd ::= explain cmdx SEMI */ case 10: /* trans_opt ::= */ case 11: /* trans_opt ::= TRANSACTION */ case 12: /* trans_opt ::= TRANSACTION nm */ case 20: /* savepoint_opt ::= SAVEPOINT */ case 21: /* savepoint_opt ::= */ case 25: /* cmd ::= create_table create_table_args */ case 34: /* columnlist ::= columnlist COMMA column */ case 35: /* columnlist ::= column */ case 44: /* type ::= */ case 51: /* signed ::= plus_num */ case 52: /* signed ::= minus_num */ case 53: /* carglist ::= carglist carg */ case 54: /* carglist ::= */ case 55: /* carg ::= CONSTRAINT nm ccons */ case 56: /* carg ::= ccons */ case 62: /* ccons ::= NULL onconf */ case 89: /* conslist ::= conslist COMMA tcons */ case 90: /* conslist ::= conslist tcons */ case 91: /* conslist ::= tcons */ case 92: /* tcons ::= CONSTRAINT nm */ case 256: /* plus_opt ::= PLUS */ case 257: /* plus_opt ::= */ case 267: /* foreach_clause ::= */ case 268: /* foreach_clause ::= FOR EACH ROW */ { } break; case 5: /* explain ::= */ { sqlite3BeginParse(pParse, 0); } break; case 6: /* explain ::= EXPLAIN */ { sqlite3BeginParse(pParse, 1); } break; case 7: /* explain ::= EXPLAIN QUERY PLAN */ { sqlite3BeginParse(pParse, 2); } break; case 8: /* cmdx ::= cmd */ { sqlite3FinishCoding(pParse); } break; case 9: /* cmd ::= BEGIN transtype trans_opt */ {sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy60);} break; case 13: /* transtype ::= */ {yygotominor.yy60 = TK_DEFERRED;} break; case 14: /* transtype ::= DEFERRED */ case 15: /* transtype ::= IMMEDIATE */ case 16: /* transtype ::= EXCLUSIVE */ case 114: /* multiselect_op ::= UNION */ case 116: /* multiselect_op ::= EXCEPT|INTERSECT */ {yygotominor.yy60 = yymsp[0].major;} break; case 17: /* cmd ::= COMMIT trans_opt */ case 18: /* cmd ::= END trans_opt */ {sqlite3CommitTransaction(pParse);} break; case 19: /* cmd ::= ROLLBACK trans_opt */ {sqlite3RollbackTransaction(pParse);} |
︙ | ︙ | |||
85870 85871 85872 85873 85874 85875 85876 | } break; case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; | | | > > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > > < < < < < < < < < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 86028 86029 86030 86031 86032 86033 86034 86035 86036 86037 86038 86039 86040 86041 86042 86043 86044 86045 86046 86047 86048 86049 86050 86051 86052 86053 86054 86055 86056 86057 86058 86059 86060 86061 86062 86063 86064 86065 86066 86067 86068 86069 86070 86071 86072 86073 86074 86075 86076 86077 86078 86079 86080 86081 86082 86083 86084 86085 86086 86087 86088 86089 86090 86091 86092 86093 86094 86095 86096 86097 86098 86099 86100 86101 86102 86103 86104 86105 86106 86107 86108 86109 86110 86111 86112 86113 86114 86115 86116 86117 86118 86119 86120 86121 86122 86123 86124 86125 86126 86127 86128 86129 86130 86131 86132 86133 86134 86135 86136 86137 86138 86139 86140 86141 86142 86143 86144 86145 86146 86147 86148 86149 86150 86151 86152 86153 86154 86155 86156 86157 86158 86159 86160 86161 86162 86163 86164 86165 86166 86167 86168 86169 86170 86171 86172 86173 86174 86175 86176 86177 86178 86179 86180 86181 86182 86183 86184 86185 86186 86187 86188 86189 86190 86191 86192 86193 86194 86195 86196 86197 86198 86199 86200 86201 86202 86203 86204 86205 86206 86207 86208 86209 86210 86211 86212 86213 86214 86215 86216 86217 86218 86219 86220 86221 86222 86223 86224 86225 86226 86227 86228 86229 86230 86231 86232 86233 86234 86235 86236 86237 86238 86239 86240 86241 86242 86243 86244 86245 86246 86247 86248 86249 86250 86251 86252 86253 86254 86255 86256 86257 86258 86259 86260 86261 86262 86263 86264 86265 86266 86267 86268 86269 86270 86271 86272 86273 86274 86275 86276 86277 86278 86279 86280 86281 86282 86283 86284 86285 86286 86287 86288 86289 86290 86291 86292 86293 86294 86295 86296 86297 86298 86299 86300 86301 86302 86303 86304 86305 86306 86307 86308 86309 86310 86311 86312 86313 86314 86315 86316 86317 86318 86319 86320 86321 86322 86323 86324 86325 86326 86327 86328 86329 86330 86331 86332 86333 86334 86335 86336 86337 86338 86339 86340 86341 86342 86343 86344 86345 86346 86347 86348 86349 86350 86351 86352 86353 86354 86355 86356 86357 86358 86359 86360 86361 86362 86363 86364 86365 86366 86367 86368 86369 86370 86371 86372 86373 86374 86375 86376 86377 86378 86379 86380 86381 86382 86383 86384 86385 86386 86387 86388 86389 86390 86391 86392 86393 86394 86395 86396 86397 86398 86399 86400 86401 86402 86403 86404 86405 86406 86407 86408 86409 86410 86411 86412 86413 86414 86415 86416 86417 86418 86419 86420 86421 86422 86423 86424 86425 86426 86427 86428 86429 86430 86431 86432 86433 86434 86435 86436 86437 86438 86439 86440 86441 86442 86443 86444 86445 86446 86447 86448 86449 86450 86451 86452 86453 86454 86455 86456 86457 86458 86459 86460 86461 86462 86463 86464 86465 86466 86467 86468 86469 86470 86471 86472 86473 86474 86475 86476 86477 86478 86479 86480 86481 86482 86483 86484 86485 86486 86487 86488 86489 86490 86491 86492 86493 86494 86495 86496 86497 86498 86499 86500 86501 86502 86503 86504 86505 86506 86507 86508 86509 86510 86511 86512 86513 86514 86515 86516 86517 86518 86519 86520 86521 86522 86523 86524 86525 86526 86527 86528 86529 86530 86531 86532 86533 86534 86535 86536 86537 86538 86539 86540 86541 86542 86543 86544 86545 86546 86547 86548 86549 86550 86551 86552 86553 86554 86555 86556 86557 86558 86559 86560 86561 86562 86563 86564 86565 86566 86567 86568 86569 86570 86571 86572 86573 86574 86575 86576 86577 86578 86579 86580 86581 86582 86583 86584 86585 86586 86587 86588 86589 86590 86591 86592 86593 86594 86595 86596 86597 86598 86599 86600 86601 86602 86603 86604 86605 86606 86607 86608 86609 86610 86611 86612 86613 86614 86615 86616 86617 86618 86619 86620 86621 86622 86623 86624 86625 86626 86627 86628 86629 86630 86631 86632 86633 86634 86635 86636 86637 86638 86639 86640 86641 86642 86643 86644 86645 86646 86647 86648 86649 86650 86651 86652 86653 86654 86655 86656 86657 86658 86659 86660 86661 86662 86663 86664 86665 86666 86667 86668 86669 86670 86671 86672 86673 86674 86675 86676 86677 86678 86679 86680 86681 86682 86683 86684 86685 86686 86687 86688 86689 86690 86691 86692 86693 86694 86695 86696 86697 86698 86699 86700 86701 86702 86703 86704 86705 86706 86707 86708 86709 86710 86711 86712 86713 86714 86715 86716 86717 86718 86719 86720 86721 86722 86723 86724 86725 86726 86727 86728 86729 86730 86731 86732 86733 86734 86735 86736 86737 86738 86739 86740 86741 86742 86743 86744 86745 86746 86747 86748 86749 86750 86751 86752 86753 86754 86755 86756 86757 86758 86759 86760 86761 86762 86763 86764 86765 86766 86767 86768 86769 86770 86771 86772 86773 86774 86775 86776 86777 86778 86779 86780 86781 86782 86783 86784 86785 86786 86787 86788 86789 86790 86791 86792 86793 86794 86795 86796 86797 86798 86799 86800 86801 86802 86803 86804 86805 86806 86807 86808 86809 86810 86811 86812 86813 86814 86815 86816 86817 86818 86819 86820 86821 86822 86823 86824 86825 86826 86827 86828 86829 86830 86831 86832 86833 86834 86835 86836 86837 86838 86839 86840 86841 86842 86843 86844 86845 86846 86847 86848 86849 86850 86851 86852 86853 86854 86855 86856 86857 86858 86859 86860 86861 86862 86863 86864 86865 86866 86867 86868 86869 86870 86871 86872 86873 86874 86875 86876 86877 86878 86879 86880 86881 86882 86883 86884 86885 86886 86887 86888 86889 86890 86891 86892 86893 86894 86895 | } break; case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ { sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); } break; case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ { sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy60,0,0,yymsp[-2].minor.yy60); } break; case 27: /* createkw ::= CREATE */ { pParse->db->lookaside.bEnabled = 0; yygotominor.yy0 = yymsp[0].minor.yy0; } break; case 28: /* ifnotexists ::= */ case 31: /* temp ::= */ case 70: /* autoinc ::= */ case 84: /* init_deferred_pred_opt ::= */ case 86: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ case 97: /* defer_subclause_opt ::= */ case 108: /* ifexists ::= */ case 119: /* distinct ::= ALL */ case 120: /* distinct ::= */ case 222: /* between_op ::= BETWEEN */ case 225: /* in_op ::= IN */ {yygotominor.yy60 = 0;} break; case 29: /* ifnotexists ::= IF NOT EXISTS */ case 30: /* temp ::= TEMP */ case 71: /* autoinc ::= AUTOINCR */ case 85: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 107: /* ifexists ::= IF EXISTS */ case 118: /* distinct ::= DISTINCT */ case 223: /* between_op ::= NOT BETWEEN */ case 226: /* in_op ::= NOT IN */ {yygotominor.yy60 = 1;} break; case 32: /* create_table_args ::= LP columnlist conslist_opt RP */ { sqlite3EndTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0); } break; case 33: /* create_table_args ::= AS select */ { sqlite3EndTable(pParse,0,0,yymsp[0].minor.yy331); sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy331); } break; case 36: /* column ::= columnid type carglist */ { yygotominor.yy0.z = yymsp[-2].minor.yy0.z; yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n; } break; case 37: /* columnid ::= nm */ { sqlite3AddColumn(pParse,&yymsp[0].minor.yy0); yygotominor.yy0 = yymsp[0].minor.yy0; } break; case 38: /* id ::= ID */ case 39: /* id ::= INDEXED */ case 40: /* ids ::= ID|STRING */ case 41: /* nm ::= id */ case 42: /* nm ::= STRING */ case 43: /* nm ::= JOIN_KW */ case 46: /* typetoken ::= typename */ case 49: /* typename ::= ids */ case 126: /* as ::= AS nm */ case 127: /* as ::= ids */ case 137: /* dbnm ::= DOT nm */ case 146: /* indexed_opt ::= INDEXED BY nm */ case 251: /* collate ::= COLLATE ids */ case 253: /* plus_num ::= plus_opt number */ case 254: /* minus_num ::= MINUS number */ case 255: /* number ::= INTEGER|FLOAT */ {yygotominor.yy0 = yymsp[0].minor.yy0;} break; case 45: /* type ::= typetoken */ {sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);} break; case 47: /* typetoken ::= typename LP signed RP */ { yygotominor.yy0.z = yymsp[-3].minor.yy0.z; yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z); } break; case 48: /* typetoken ::= typename LP signed COMMA signed RP */ { yygotominor.yy0.z = yymsp[-5].minor.yy0.z; yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z); } break; case 50: /* typename ::= typename ids */ {yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} break; case 57: /* ccons ::= DEFAULT term */ case 59: /* ccons ::= DEFAULT PLUS term */ {sqlite3AddDefaultValue(pParse,yymsp[0].minor.yy454);} break; case 58: /* ccons ::= DEFAULT LP expr RP */ {sqlite3AddDefaultValue(pParse,yymsp[-1].minor.yy454);} break; case 60: /* ccons ::= DEFAULT MINUS term */ { Expr *p = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0, 0); sqlite3ExprSpan(p,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy454->span); sqlite3AddDefaultValue(pParse,p); } break; case 61: /* ccons ::= DEFAULT id */ { Expr *p = sqlite3PExpr(pParse, TK_STRING, 0, 0, &yymsp[0].minor.yy0); sqlite3AddDefaultValue(pParse,p); } break; case 63: /* ccons ::= NOT NULL onconf */ {sqlite3AddNotNull(pParse, yymsp[0].minor.yy60);} break; case 64: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ {sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy60,yymsp[0].minor.yy60,yymsp[-2].minor.yy60);} break; case 65: /* ccons ::= UNIQUE onconf */ {sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy60,0,0,0,0);} break; case 66: /* ccons ::= CHECK LP expr RP */ {sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy454);} break; case 67: /* ccons ::= REFERENCES nm idxlist_opt refargs */ {sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy266,yymsp[0].minor.yy60);} break; case 68: /* ccons ::= defer_subclause */ {sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy60);} break; case 69: /* ccons ::= COLLATE ids */ {sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} break; case 72: /* refargs ::= */ { yygotominor.yy60 = OE_Restrict * 0x010101; } break; case 73: /* refargs ::= refargs refarg */ { yygotominor.yy60 = (yymsp[-1].minor.yy60 & ~yymsp[0].minor.yy243.mask) | yymsp[0].minor.yy243.value; } break; case 74: /* refarg ::= MATCH nm */ { yygotominor.yy243.value = 0; yygotominor.yy243.mask = 0x000000; } break; case 75: /* refarg ::= ON DELETE refact */ { yygotominor.yy243.value = yymsp[0].minor.yy60; yygotominor.yy243.mask = 0x0000ff; } break; case 76: /* refarg ::= ON UPDATE refact */ { yygotominor.yy243.value = yymsp[0].minor.yy60<<8; yygotominor.yy243.mask = 0x00ff00; } break; case 77: /* refarg ::= ON INSERT refact */ { yygotominor.yy243.value = yymsp[0].minor.yy60<<16; yygotominor.yy243.mask = 0xff0000; } break; case 78: /* refact ::= SET NULL */ { yygotominor.yy60 = OE_SetNull; } break; case 79: /* refact ::= SET DEFAULT */ { yygotominor.yy60 = OE_SetDflt; } break; case 80: /* refact ::= CASCADE */ { yygotominor.yy60 = OE_Cascade; } break; case 81: /* refact ::= RESTRICT */ { yygotominor.yy60 = OE_Restrict; } break; case 82: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ case 83: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 98: /* defer_subclause_opt ::= defer_subclause */ case 100: /* onconf ::= ON CONFLICT resolvetype */ case 102: /* orconf ::= OR resolvetype */ case 103: /* resolvetype ::= raisetype */ case 175: /* insert_cmd ::= INSERT orconf */ {yygotominor.yy60 = yymsp[0].minor.yy60;} break; case 87: /* conslist_opt ::= */ {yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;} break; case 88: /* conslist_opt ::= COMMA conslist */ {yygotominor.yy0 = yymsp[-1].minor.yy0;} break; case 93: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ {sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy266,yymsp[0].minor.yy60,yymsp[-2].minor.yy60,0);} break; case 94: /* tcons ::= UNIQUE LP idxlist RP onconf */ {sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy266,yymsp[0].minor.yy60,0,0,0,0);} break; case 95: /* tcons ::= CHECK LP expr RP onconf */ {sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy454);} break; case 96: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */ { sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy266, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy266, yymsp[-1].minor.yy60); sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy60); } break; case 99: /* onconf ::= */ case 101: /* orconf ::= */ {yygotominor.yy60 = OE_Default;} break; case 104: /* resolvetype ::= IGNORE */ {yygotominor.yy60 = OE_Ignore;} break; case 105: /* resolvetype ::= REPLACE */ case 176: /* insert_cmd ::= REPLACE */ {yygotominor.yy60 = OE_Replace;} break; case 106: /* cmd ::= DROP TABLE ifexists fullname */ { sqlite3DropTable(pParse, yymsp[0].minor.yy427, 0, yymsp[-1].minor.yy60); } break; case 109: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */ { sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy331, yymsp[-6].minor.yy60, yymsp[-4].minor.yy60); } break; case 110: /* cmd ::= DROP VIEW ifexists fullname */ { sqlite3DropTable(pParse, yymsp[0].minor.yy427, 1, yymsp[-1].minor.yy60); } break; case 111: /* cmd ::= select */ { SelectDest dest = {SRT_Output, 0, 0, 0, 0}; sqlite3Select(pParse, yymsp[0].minor.yy331, &dest); sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy331); } break; case 112: /* select ::= oneselect */ {yygotominor.yy331 = yymsp[0].minor.yy331;} break; case 113: /* select ::= select multiselect_op oneselect */ { if( yymsp[0].minor.yy331 ){ yymsp[0].minor.yy331->op = (u8)yymsp[-1].minor.yy60; yymsp[0].minor.yy331->pPrior = yymsp[-2].minor.yy331; }else{ sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy331); } yygotominor.yy331 = yymsp[0].minor.yy331; } break; case 115: /* multiselect_op ::= UNION ALL */ {yygotominor.yy60 = TK_ALL;} break; case 117: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { yygotominor.yy331 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy266,yymsp[-5].minor.yy427,yymsp[-4].minor.yy454,yymsp[-3].minor.yy266,yymsp[-2].minor.yy454,yymsp[-1].minor.yy266,yymsp[-7].minor.yy60,yymsp[0].minor.yy348.pLimit,yymsp[0].minor.yy348.pOffset); } break; case 121: /* sclp ::= selcollist COMMA */ case 247: /* idxlist_opt ::= LP idxlist RP */ {yygotominor.yy266 = yymsp[-1].minor.yy266;} break; case 122: /* sclp ::= */ case 150: /* orderby_opt ::= */ case 158: /* groupby_opt ::= */ case 240: /* exprlist ::= */ case 246: /* idxlist_opt ::= */ {yygotominor.yy266 = 0;} break; case 123: /* selcollist ::= sclp expr as */ { yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy266,yymsp[-1].minor.yy454,yymsp[0].minor.yy0.n?&yymsp[0].minor.yy0:0); } break; case 124: /* selcollist ::= sclp STAR */ { Expr *p = sqlite3PExpr(pParse, TK_ALL, 0, 0, 0); yygotominor.yy266 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy266, p, 0); } break; case 125: /* selcollist ::= sclp nm DOT STAR */ { Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0); Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy266, pDot, 0); } break; case 128: /* as ::= */ {yygotominor.yy0.n = 0;} break; case 129: /* from ::= */ {yygotominor.yy427 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy427));} break; case 130: /* from ::= FROM seltablist */ { yygotominor.yy427 = yymsp[0].minor.yy427; sqlite3SrcListShiftJoinType(yygotominor.yy427); } break; case 131: /* stl_prefix ::= seltablist joinop */ { yygotominor.yy427 = yymsp[-1].minor.yy427; if( yygotominor.yy427 && yygotominor.yy427->nSrc>0 ) yygotominor.yy427->a[yygotominor.yy427->nSrc-1].jointype = (u8)yymsp[0].minor.yy60; } break; case 132: /* stl_prefix ::= */ {yygotominor.yy427 = 0;} break; case 133: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { yygotominor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy454,yymsp[0].minor.yy272); sqlite3SrcListIndexedBy(pParse, yygotominor.yy427, &yymsp[-2].minor.yy0); } break; case 134: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { yygotominor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy331,yymsp[-1].minor.yy454,yymsp[0].minor.yy272); } break; case 135: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { if( yymsp[-6].minor.yy427==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy454==0 && yymsp[0].minor.yy272==0 ){ yygotominor.yy427 = yymsp[-4].minor.yy427; }else{ Select *pSubquery; sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy427); pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy427,0,0,0,0,0,0,0); yygotominor.yy427 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy427,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy454,yymsp[0].minor.yy272); } } break; case 136: /* dbnm ::= */ case 145: /* indexed_opt ::= */ {yygotominor.yy0.z=0; yygotominor.yy0.n=0;} break; case 138: /* fullname ::= nm dbnm */ {yygotominor.yy427 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} break; case 139: /* joinop ::= COMMA|JOIN */ { yygotominor.yy60 = JT_INNER; } break; case 140: /* joinop ::= JOIN_KW JOIN */ { yygotominor.yy60 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } break; case 141: /* joinop ::= JOIN_KW nm JOIN */ { yygotominor.yy60 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); } break; case 142: /* joinop ::= JOIN_KW nm nm JOIN */ { yygotominor.yy60 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); } break; case 143: /* on_opt ::= ON expr */ case 154: /* sortitem ::= expr */ case 161: /* having_opt ::= HAVING expr */ case 168: /* where_opt ::= WHERE expr */ case 183: /* expr ::= term */ case 211: /* escape ::= ESCAPE expr */ case 235: /* case_else ::= ELSE expr */ case 237: /* case_operand ::= expr */ {yygotominor.yy454 = yymsp[0].minor.yy454;} break; case 144: /* on_opt ::= */ case 160: /* having_opt ::= */ case 167: /* where_opt ::= */ case 212: /* escape ::= */ case 236: /* case_else ::= */ case 238: /* case_operand ::= */ {yygotominor.yy454 = 0;} break; case 147: /* indexed_opt ::= NOT INDEXED */ {yygotominor.yy0.z=0; yygotominor.yy0.n=1;} break; case 148: /* using_opt ::= USING LP inscollist RP */ case 180: /* inscollist_opt ::= LP inscollist RP */ {yygotominor.yy272 = yymsp[-1].minor.yy272;} break; case 149: /* using_opt ::= */ case 179: /* inscollist_opt ::= */ {yygotominor.yy272 = 0;} break; case 151: /* orderby_opt ::= ORDER BY sortlist */ case 159: /* groupby_opt ::= GROUP BY nexprlist */ case 239: /* exprlist ::= nexprlist */ {yygotominor.yy266 = yymsp[0].minor.yy266;} break; case 152: /* sortlist ::= sortlist COMMA sortitem sortorder */ { yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy266,yymsp[-1].minor.yy454,0); if( yygotominor.yy266 ) yygotominor.yy266->a[yygotominor.yy266->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy60; } break; case 153: /* sortlist ::= sortitem sortorder */ { yygotominor.yy266 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy454,0); if( yygotominor.yy266 && yygotominor.yy266->a ) yygotominor.yy266->a[0].sortOrder = (u8)yymsp[0].minor.yy60; } break; case 155: /* sortorder ::= ASC */ case 157: /* sortorder ::= */ {yygotominor.yy60 = SQLITE_SO_ASC;} break; case 156: /* sortorder ::= DESC */ {yygotominor.yy60 = SQLITE_SO_DESC;} break; case 162: /* limit_opt ::= */ {yygotominor.yy348.pLimit = 0; yygotominor.yy348.pOffset = 0;} break; case 163: /* limit_opt ::= LIMIT expr */ {yygotominor.yy348.pLimit = yymsp[0].minor.yy454; yygotominor.yy348.pOffset = 0;} break; case 164: /* limit_opt ::= LIMIT expr OFFSET expr */ {yygotominor.yy348.pLimit = yymsp[-2].minor.yy454; yygotominor.yy348.pOffset = yymsp[0].minor.yy454;} break; case 165: /* limit_opt ::= LIMIT expr COMMA expr */ {yygotominor.yy348.pOffset = yymsp[-2].minor.yy454; yygotominor.yy348.pLimit = yymsp[0].minor.yy454;} break; case 166: /* cmd ::= DELETE FROM fullname indexed_opt where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy427, &yymsp[-1].minor.yy0); sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy427,yymsp[0].minor.yy454); } break; case 169: /* cmd ::= UPDATE orconf fullname indexed_opt SET setlist where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy427, &yymsp[-3].minor.yy0); sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy266,"set list"); sqlite3Update(pParse,yymsp[-4].minor.yy427,yymsp[-1].minor.yy266,yymsp[0].minor.yy454,yymsp[-5].minor.yy60); } break; case 170: /* setlist ::= setlist COMMA nm EQ expr */ {yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy266,yymsp[0].minor.yy454,&yymsp[-2].minor.yy0);} break; case 171: /* setlist ::= nm EQ expr */ {yygotominor.yy266 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454,&yymsp[-2].minor.yy0);} break; case 172: /* cmd ::= insert_cmd INTO fullname inscollist_opt VALUES LP itemlist RP */ {sqlite3Insert(pParse, yymsp[-5].minor.yy427, yymsp[-1].minor.yy266, 0, yymsp[-4].minor.yy272, yymsp[-7].minor.yy60);} break; case 173: /* cmd ::= insert_cmd INTO fullname inscollist_opt select */ {sqlite3Insert(pParse, yymsp[-2].minor.yy427, 0, yymsp[0].minor.yy331, yymsp[-1].minor.yy272, yymsp[-4].minor.yy60);} break; case 174: /* cmd ::= insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */ {sqlite3Insert(pParse, yymsp[-3].minor.yy427, 0, 0, yymsp[-2].minor.yy272, yymsp[-5].minor.yy60);} break; case 177: /* itemlist ::= itemlist COMMA expr */ case 241: /* nexprlist ::= nexprlist COMMA expr */ {yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy266,yymsp[0].minor.yy454,0);} break; case 178: /* itemlist ::= expr */ case 242: /* nexprlist ::= expr */ {yygotominor.yy266 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy454,0);} break; case 181: /* inscollist ::= inscollist COMMA nm */ {yygotominor.yy272 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy272,&yymsp[0].minor.yy0);} break; case 182: /* inscollist ::= nm */ {yygotominor.yy272 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);} break; case 184: /* expr ::= LP expr RP */ {yygotominor.yy454 = yymsp[-1].minor.yy454; sqlite3ExprSpan(yygotominor.yy454,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } break; case 185: /* term ::= NULL */ case 190: /* term ::= INTEGER|FLOAT|BLOB */ case 191: /* term ::= STRING */ {yygotominor.yy454 = sqlite3PExpr(pParse, yymsp[0].major, 0, 0, &yymsp[0].minor.yy0);} break; case 186: /* expr ::= id */ case 187: /* expr ::= JOIN_KW */ {yygotominor.yy454 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0);} break; case 188: /* expr ::= nm DOT nm */ { Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); yygotominor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); } break; case 189: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); yygotominor.yy454 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); } break; case 192: /* expr ::= REGISTER */ {yygotominor.yy454 = sqlite3RegisterExpr(pParse, &yymsp[0].minor.yy0);} break; case 193: /* expr ::= VARIABLE */ { Token *pToken = &yymsp[0].minor.yy0; Expr *pExpr = yygotominor.yy454 = sqlite3PExpr(pParse, TK_VARIABLE, 0, 0, pToken); sqlite3ExprAssignVarNumber(pParse, pExpr); } break; case 194: /* expr ::= expr COLLATE ids */ { yygotominor.yy454 = sqlite3ExprSetColl(pParse, yymsp[-2].minor.yy454, &yymsp[0].minor.yy0); } break; case 195: /* expr ::= CAST LP expr AS typetoken RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy454, 0, &yymsp[-1].minor.yy0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); } break; case 196: /* expr ::= ID LP distinct exprlist RP */ { if( yymsp[-1].minor.yy266 && yymsp[-1].minor.yy266->nExpr>SQLITE_MAX_FUNCTION_ARG ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); } yygotominor.yy454 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy266, &yymsp[-4].minor.yy0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); if( yymsp[-2].minor.yy60 && yygotominor.yy454 ){ yygotominor.yy454->flags |= EP_Distinct; } } break; case 197: /* expr ::= ID LP STAR RP */ { yygotominor.yy454 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); } break; case 198: /* term ::= CTIME_KW */ { /* The CURRENT_TIME, CURRENT_DATE, and CURRENT_TIMESTAMP values are ** treated as functions that return constants */ yygotominor.yy454 = sqlite3ExprFunction(pParse, 0,&yymsp[0].minor.yy0); if( yygotominor.yy454 ){ yygotominor.yy454->op = TK_CONST_FUNC; yygotominor.yy454->span = yymsp[0].minor.yy0; } } break; case 199: /* expr ::= expr AND expr */ case 200: /* expr ::= expr OR expr */ case 201: /* expr ::= expr LT|GT|GE|LE expr */ case 202: /* expr ::= expr EQ|NE expr */ case 203: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ case 204: /* expr ::= expr PLUS|MINUS expr */ case 205: /* expr ::= expr STAR|SLASH|REM expr */ case 206: /* expr ::= expr CONCAT expr */ {yygotominor.yy454 = sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy454,yymsp[0].minor.yy454,0);} break; case 207: /* likeop ::= LIKE_KW */ case 209: /* likeop ::= MATCH */ {yygotominor.yy258.eOperator = yymsp[0].minor.yy0; yygotominor.yy258.not = 0;} break; case 208: /* likeop ::= NOT LIKE_KW */ case 210: /* likeop ::= NOT MATCH */ {yygotominor.yy258.eOperator = yymsp[0].minor.yy0; yygotominor.yy258.not = 1;} break; case 213: /* expr ::= expr likeop expr escape */ { ExprList *pList; pList = sqlite3ExprListAppend(pParse,0, yymsp[-1].minor.yy454, 0); pList = sqlite3ExprListAppend(pParse,pList, yymsp[-3].minor.yy454, 0); if( yymsp[0].minor.yy454 ){ pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454, 0); } yygotominor.yy454 = sqlite3ExprFunction(pParse, pList, &yymsp[-2].minor.yy258.eOperator); if( yymsp[-2].minor.yy258.not ) yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454, &yymsp[-3].minor.yy454->span, &yymsp[-1].minor.yy454->span); if( yygotominor.yy454 ) yygotominor.yy454->flags |= EP_InfixFunc; } break; case 214: /* expr ::= expr ISNULL|NOTNULL */ { yygotominor.yy454 = sqlite3PExpr(pParse, yymsp[0].major, yymsp[-1].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-1].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 215: /* expr ::= expr IS NULL */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_ISNULL, yymsp[-2].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-2].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 216: /* expr ::= expr NOT NULL */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-2].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-2].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 217: /* expr ::= expr IS NOT NULL */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOTNULL, yymsp[-3].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-3].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 218: /* expr ::= NOT expr */ case 219: /* expr ::= BITNOT expr */ { yygotominor.yy454 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy454->span); } break; case 220: /* expr ::= MINUS expr */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy454->span); } break; case 221: /* expr ::= PLUS expr */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_UPLUS, yymsp[0].minor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy454->span); } break; case 224: /* expr ::= expr between_op expr AND expr */ { ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454, 0); pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy454, 0); yygotominor.yy454 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy454, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } if( yymsp[-3].minor.yy60 ) yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-4].minor.yy454->span,&yymsp[0].minor.yy454->span); } break; case 227: /* expr ::= expr in_op LP exprlist RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pList = yymsp[-1].minor.yy266; sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy266); } if( yymsp[-3].minor.yy60 ) yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-4].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 228: /* expr ::= LP select RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pSelect = yymsp[-1].minor.yy331; ExprSetProperty(yygotominor.yy454, EP_xIsSelect); sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy331); } sqlite3ExprSpan(yygotominor.yy454,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); } break; case 229: /* expr ::= expr in_op LP select RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy454, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pSelect = yymsp[-1].minor.yy331; ExprSetProperty(yygotominor.yy454, EP_xIsSelect); sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy331); } if( yymsp[-3].minor.yy60 ) yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-4].minor.yy454->span,&yymsp[0].minor.yy0); } break; case 230: /* expr ::= expr in_op nm dbnm */ { SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); yygotominor.yy454 = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy454, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); ExprSetProperty(yygotominor.yy454, EP_xIsSelect); sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3SrcListDelete(pParse->db, pSrc); } if( yymsp[-2].minor.yy60 ) yygotominor.yy454 = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy454, 0, 0); sqlite3ExprSpan(yygotominor.yy454,&yymsp[-3].minor.yy454->span,yymsp[0].minor.yy0.z?&yymsp[0].minor.yy0:&yymsp[-1].minor.yy0); } break; case 231: /* expr ::= EXISTS LP select RP */ { Expr *p = yygotominor.yy454 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); if( p ){ p->x.pSelect = yymsp[-1].minor.yy331; ExprSetProperty(yygotominor.yy454, EP_xIsSelect); sqlite3ExprSpan(p,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy331); } } break; case 232: /* expr ::= CASE case_operand case_exprlist case_else END */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy454, yymsp[-1].minor.yy454, 0); if( yygotominor.yy454 ){ yygotominor.yy454->x.pList = yymsp[-2].minor.yy266; sqlite3ExprSetHeight(pParse, yygotominor.yy454); }else{ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy266); } sqlite3ExprSpan(yygotominor.yy454, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0); } break; case 233: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy266, yymsp[-2].minor.yy454, 0); yygotominor.yy266 = sqlite3ExprListAppend(pParse,yygotominor.yy266, yymsp[0].minor.yy454, 0); } break; case 234: /* case_exprlist ::= WHEN expr THEN expr */ { yygotominor.yy266 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy454, 0); yygotominor.yy266 = sqlite3ExprListAppend(pParse,yygotominor.yy266, yymsp[0].minor.yy454, 0); } break; case 243: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP */ { sqlite3CreateIndex(pParse, &yymsp[-6].minor.yy0, &yymsp[-5].minor.yy0, sqlite3SrcListAppend(pParse->db,0,&yymsp[-3].minor.yy0,0), yymsp[-1].minor.yy266, yymsp[-9].minor.yy60, &yymsp[-10].minor.yy0, &yymsp[0].minor.yy0, SQLITE_SO_ASC, yymsp[-7].minor.yy60); } break; case 244: /* uniqueflag ::= UNIQUE */ case 281: /* raisetype ::= ABORT */ {yygotominor.yy60 = OE_Abort;} break; case 245: /* uniqueflag ::= */ {yygotominor.yy60 = OE_None;} break; case 248: /* idxlist ::= idxlist COMMA nm collate sortorder */ { Expr *p = 0; if( yymsp[-1].minor.yy0.n>0 ){ p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0); sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy0); } yygotominor.yy266 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy266, p, &yymsp[-2].minor.yy0); sqlite3ExprListCheckLength(pParse, yygotominor.yy266, "index"); if( yygotominor.yy266 ) yygotominor.yy266->a[yygotominor.yy266->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy60; } break; case 249: /* idxlist ::= nm collate sortorder */ { Expr *p = 0; if( yymsp[-1].minor.yy0.n>0 ){ p = sqlite3PExpr(pParse, TK_COLUMN, 0, 0, 0); sqlite3ExprSetColl(pParse, p, &yymsp[-1].minor.yy0); } yygotominor.yy266 = sqlite3ExprListAppend(pParse,0, p, &yymsp[-2].minor.yy0); sqlite3ExprListCheckLength(pParse, yygotominor.yy266, "index"); if( yygotominor.yy266 ) yygotominor.yy266->a[yygotominor.yy266->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy60; } break; case 250: /* collate ::= */ {yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;} break; case 252: /* cmd ::= DROP INDEX ifexists fullname */ {sqlite3DropIndex(pParse, yymsp[0].minor.yy427, yymsp[-1].minor.yy60);} break; case 258: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { Token all; all.z = yymsp[-3].minor.yy0.z; all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy455, &all); } break; case 259: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy60, yymsp[-4].minor.yy62.a, yymsp[-4].minor.yy62.b, yymsp[-2].minor.yy427, yymsp[0].minor.yy454, yymsp[-10].minor.yy60, yymsp[-8].minor.yy60); yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); } break; case 260: /* trigger_time ::= BEFORE */ case 263: /* trigger_time ::= */ { yygotominor.yy60 = TK_BEFORE; } break; case 261: /* trigger_time ::= AFTER */ { yygotominor.yy60 = TK_AFTER; } break; case 262: /* trigger_time ::= INSTEAD OF */ { yygotominor.yy60 = TK_INSTEAD;} break; case 264: /* trigger_event ::= DELETE|INSERT */ case 265: /* trigger_event ::= UPDATE */ {yygotominor.yy62.a = yymsp[0].major; yygotominor.yy62.b = 0;} break; case 266: /* trigger_event ::= UPDATE OF inscollist */ {yygotominor.yy62.a = TK_UPDATE; yygotominor.yy62.b = yymsp[0].minor.yy272;} break; case 269: /* when_clause ::= */ { yygotominor.yy454 = 0; } break; case 270: /* when_clause ::= WHEN expr */ { yygotominor.yy454 = yymsp[0].minor.yy454; } break; case 271: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { /* if( yymsp[-2].minor.yy455 ){ yymsp[-2].minor.yy455->pLast->pNext = yymsp[-1].minor.yy455; }else{ yymsp[-2].minor.yy455 = yymsp[-1].minor.yy455; } */ assert( yymsp[-2].minor.yy455!=0 ); yymsp[-2].minor.yy455->pLast->pNext = yymsp[-1].minor.yy455; yymsp[-2].minor.yy455->pLast = yymsp[-1].minor.yy455; yygotominor.yy455 = yymsp[-2].minor.yy455; } break; case 272: /* trigger_cmd_list ::= trigger_cmd SEMI */ { /* if( yymsp[-1].minor.yy455 ) */ assert( yymsp[-1].minor.yy455!=0 ); yymsp[-1].minor.yy455->pLast = yymsp[-1].minor.yy455; yygotominor.yy455 = yymsp[-1].minor.yy455; } break; case 273: /* trigger_cmd ::= UPDATE orconf nm SET setlist where_opt */ { yygotominor.yy455 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy266, yymsp[0].minor.yy454, yymsp[-4].minor.yy60); } break; case 274: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt VALUES LP itemlist RP */ {yygotominor.yy455 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy272, yymsp[-1].minor.yy266, 0, yymsp[-7].minor.yy60);} break; case 275: /* trigger_cmd ::= insert_cmd INTO nm inscollist_opt select */ {yygotominor.yy455 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy272, 0, yymsp[0].minor.yy331, yymsp[-4].minor.yy60);} break; case 276: /* trigger_cmd ::= DELETE FROM nm where_opt */ {yygotominor.yy455 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-1].minor.yy0, yymsp[0].minor.yy454);} break; case 277: /* trigger_cmd ::= select */ {yygotominor.yy455 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy331); } break; case 278: /* expr ::= RAISE LP IGNORE RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); if( yygotominor.yy454 ){ yygotominor.yy454->affinity = OE_Ignore; sqlite3ExprSpan(yygotominor.yy454, &yymsp[-3].minor.yy0, &yymsp[0].minor.yy0); } } break; case 279: /* expr ::= RAISE LP raisetype COMMA nm RP */ { yygotominor.yy454 = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); if( yygotominor.yy454 ) { yygotominor.yy454->affinity = (char)yymsp[-3].minor.yy60; sqlite3ExprSpan(yygotominor.yy454, &yymsp[-5].minor.yy0, &yymsp[0].minor.yy0); } } break; case 280: /* raisetype ::= ROLLBACK */ {yygotominor.yy60 = OE_Rollback;} break; case 282: /* raisetype ::= FAIL */ {yygotominor.yy60 = OE_Fail;} break; case 283: /* cmd ::= DROP TRIGGER ifexists fullname */ { sqlite3DropTrigger(pParse,yymsp[0].minor.yy427,yymsp[-1].minor.yy60); } break; }; yygoto = yyRuleInfo[yyruleno].lhs; yysize = yyRuleInfo[yyruleno].nrhs; yypParser->yyidx -= yysize; yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); |
︙ | ︙ | |||
86979 86980 86981 86982 86983 86984 86985 | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** | | | 87143 87144 87145 87146 87147 87148 87149 87150 87151 87152 87153 87154 87155 87156 87157 | ************************************************************************* ** An tokenizer for SQL ** ** This file contains C code that splits an SQL input string up into ** individual tokens and sends those tokens one-by-one over to the ** parser for analysis. ** ** $Id: tokenize.c,v 1.155 2009/03/31 03:41:57 shane Exp $ */ /* ** The charMap() macro maps alphabetic characters into their ** lower-case ASCII equivalent. On ASCII machines, this is just ** an upper-to-lower case map. On EBCDIC machines we also need ** to adjust the encoding. Only alphabetic characters and underscores |
︙ | ︙ | |||
87583 87584 87585 87586 87587 87588 87589 | ** Run the parser on the given SQL string. The parser structure is ** passed in. An SQLITE_ status code is returned. If an error occurs ** then an and attempt is made to write an error message into ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that ** error message. */ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ | | | | | | > | > | > > > | 87747 87748 87749 87750 87751 87752 87753 87754 87755 87756 87757 87758 87759 87760 87761 87762 87763 87764 87765 87766 87767 87768 87769 87770 87771 87772 87773 87774 87775 87776 87777 87778 87779 87780 87781 87782 87783 87784 87785 87786 87787 87788 87789 87790 87791 87792 | ** Run the parser on the given SQL string. The parser structure is ** passed in. An SQLITE_ status code is returned. If an error occurs ** then an and attempt is made to write an error message into ** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that ** error message. */ SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ int nErr = 0; /* Number of errors encountered */ int i; /* Loop counter */ void *pEngine; /* The LEMON-generated LALR(1) parser */ int tokenType; /* type of the next token */ int lastTokenParsed = -1; /* type of the previous token */ u8 enableLookaside; /* Saved value of db->lookaside.bEnabled */ sqlite3 *db = pParse->db; /* The database connection */ int mxSqlLen; /* Max length of an SQL string */ mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; if( db->activeVdbeCnt==0 ){ db->u1.isInterrupted = 0; } pParse->rc = SQLITE_OK; pParse->zTail = pParse->zSql = zSql; i = 0; assert( pzErrMsg!=0 ); pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3Malloc); if( pEngine==0 ){ db->mallocFailed = 1; return SQLITE_NOMEM; } assert( pParse->sLastToken.dyn==0 ); assert( pParse->pNewTable==0 ); assert( pParse->pNewTrigger==0 ); assert( pParse->nVar==0 ); assert( pParse->nVarExpr==0 ); assert( pParse->nVarExprAlloc==0 ); assert( pParse->apVarExpr==0 ); enableLookaside = db->lookaside.bEnabled; if( db->lookaside.pStart ) db->lookaside.bEnabled = 1; while( !db->mallocFailed && zSql[i]!=0 ){ assert( i>=0 ); pParse->sLastToken.z = (u8*)&zSql[i]; assert( pParse->sLastToken.dyn==0 ); pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType); i += pParse->sLastToken.n; if( i>mxSqlLen ){ |
︙ | ︙ | |||
87664 87665 87666 87667 87668 87669 87670 87671 87672 87673 87674 87675 87676 87677 | } #ifdef YYTRACKMAXSTACKDEPTH sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK, sqlite3ParserStackPeak(pEngine) ); #endif /* YYDEBUG */ sqlite3ParserFree(pEngine, sqlite3_free); if( db->mallocFailed ){ pParse->rc = SQLITE_NOMEM; } if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); } if( pParse->zErrMsg ){ | > | 87833 87834 87835 87836 87837 87838 87839 87840 87841 87842 87843 87844 87845 87846 87847 | } #ifdef YYTRACKMAXSTACKDEPTH sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK, sqlite3ParserStackPeak(pEngine) ); #endif /* YYDEBUG */ sqlite3ParserFree(pEngine, sqlite3_free); db->lookaside.bEnabled = enableLookaside; if( db->mallocFailed ){ pParse->rc = SQLITE_NOMEM; } if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); } if( pParse->zErrMsg ){ |
︙ | ︙ | |||
88013 88014 88015 88016 88017 88018 88019 | ** ************************************************************************* ** 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. ** | | | 88183 88184 88185 88186 88187 88188 88189 88190 88191 88192 88193 88194 88195 88196 88197 | ** ************************************************************************* ** 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.534 2009/03/23 04:33:32 danielk1977 Exp $ */ #ifdef SQLITE_ENABLE_FTS3 /************** Include fts3.h in the middle of main.c ***********************/ /************** Begin file fts3.h ********************************************/ /* ** 2006 Oct 10 |
︙ | ︙ | |||
88490 88491 88492 88493 88494 88495 88496 | */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; if( cnt<0 ) cnt = 0; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ | | | | 88660 88661 88662 88663 88664 88665 88666 88667 88668 88669 88670 88671 88672 88673 88674 88675 88676 88677 88678 88679 | */ if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; if( cnt<0 ) cnt = 0; if( sz==0 || cnt==0 ){ sz = 0; pStart = 0; }else if( pBuf==0 ){ sz = ROUND8(sz); sqlite3BeginBenignMalloc(); pStart = sqlite3Malloc( sz*cnt ); sqlite3EndBenignMalloc(); }else{ sz = ROUNDDOWN8(sz); pStart = pBuf; } db->lookaside.pStart = pStart; db->lookaside.pFree = 0; db->lookaside.sz = (u16)sz; if( pStart ){ int i; |
︙ | ︙ | |||
90281 90282 90283 90284 90285 90286 90287 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains the implementation of the sqlite3_unlock_notify() ** API method and its associated functionality. ** | | | 90451 90452 90453 90454 90455 90456 90457 90458 90459 90460 90461 90462 90463 90464 90465 | ** May you share freely, never taking more than you give. ** ************************************************************************* ** ** This file contains the implementation of the sqlite3_unlock_notify() ** API method and its associated functionality. ** ** $Id: notify.c,v 1.2 2009/03/25 16:51:43 drh Exp $ */ /* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */ #ifdef SQLITE_ENABLE_UNLOCK_NOTIFY /* ** Public interfaces: |
︙ | ︙ | |||
90496 90497 90498 90499 90500 90501 90502 | if( p->xUnlockNotify!=xUnlockNotify && nArg!=0 ){ xUnlockNotify(aArg, nArg); nArg = 0; } sqlite3BeginBenignMalloc(); assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) ); | | | | | 90666 90667 90668 90669 90670 90671 90672 90673 90674 90675 90676 90677 90678 90679 90680 90681 90682 | if( p->xUnlockNotify!=xUnlockNotify && nArg!=0 ){ xUnlockNotify(aArg, nArg); nArg = 0; } sqlite3BeginBenignMalloc(); assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) ); assert( nArg<=(int)ArraySize(aStatic) || aArg==aDyn ); if( (!aDyn && nArg==(int)ArraySize(aStatic)) || (aDyn && nArg==(int)(sqlite3DbMallocSize(db, aDyn)/sizeof(void*))) ){ /* The aArg[] array needs to grow. */ void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2); if( pNew ){ memcpy(pNew, aArg, nArg*sizeof(void *)); sqlite3_free(aDyn); aDyn = aArg = pNew; |
︙ | ︙ | |||
90573 90574 90575 90576 90577 90578 90579 | sqlite3ConnectionUnlocked(db); enterMutex(); removeFromBlockedList(db); checkListProperties(db); leaveMutex(); } #endif | < | 90743 90744 90745 90746 90747 90748 90749 90750 90751 90752 90753 90754 90755 90756 | sqlite3ConnectionUnlocked(db); enterMutex(); removeFromBlockedList(db); checkListProperties(db); leaveMutex(); } #endif /************** End of notify.c **********************************************/ /************** Begin file fts3.c ********************************************/ /* ** 2006 Oct 10 ** ** The author disclaims copyright to this source code. In place of |
︙ | ︙ |