Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Update the built-in SQLite to the latest trunk version which includes the fix for EXPLAIN QUERY PLAN for the query that runs the /forum page. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
f8994f8975d86d224965b89d5a616fef |
User & Date: | drh 2018-08-16 16:26:05.579 |
Context
2018-08-16
| ||
16:45 | Do not show posts that are awaiting moderation to users without moderator privilege unless they are the same user that generated the post in the first place. ... (check-in: 16c42a08 user: drh tags: trunk) | |
16:26 | Update the built-in SQLite to the latest trunk version which includes the fix for EXPLAIN QUERY PLAN for the query that runs the /forum page. ... (check-in: f8994f89 user: drh tags: trunk) | |
16:13 | Adjust the /forum page so that it for users without forum moderator privilege, it pretends that unmoderated posts do not exist, and for user with moderator privilege it paints an "Awaiting Moderator Approval" message on posts that need moderation. ... (check-in: ef7f85ee user: drh tags: trunk) | |
Changes
Changes to src/shell.c.
︙ | ︙ | |||
582 583 584 585 586 587 588 | int nLine = zLine==0 ? 0 : 100; int n = 0; while( 1 ){ if( n+100>nLine ){ nLine = nLine*2 + 100; zLine = realloc(zLine, nLine); | | | 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 | int nLine = zLine==0 ? 0 : 100; int n = 0; while( 1 ){ if( n+100>nLine ){ nLine = nLine*2 + 100; zLine = realloc(zLine, nLine); if( zLine==0 ) shell_out_of_memory(); } if( fgets(&zLine[n], nLine - n, in)==0 ){ if( n==0 ){ free(zLine); return 0; } zLine[n] = 0; |
︙ | ︙ | |||
609 610 611 612 613 614 615 | ** multi-byte characterset characters into UTF-8. */ if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; if( nTrans>nLine ){ zLine = realloc(zLine, nTrans); | | < < < | 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 | ** multi-byte characterset characters into UTF-8. */ if( stdin_is_interactive && in==stdin ){ char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0); if( zTrans ){ int nTrans = strlen30(zTrans)+1; if( nTrans>nLine ){ zLine = realloc(zLine, nTrans); if( zLine==0 ) shell_out_of_memory(); } memcpy(zLine, zTrans, nTrans); sqlite3_free(zTrans); } } #endif /* defined(_WIN32) || defined(WIN32) */ return zLine; |
︙ | ︙ | |||
759 760 761 762 763 764 765 | if( zAppend[i]==quote ) len++; } } if( p->n+len>=p->nAlloc ){ p->nAlloc = p->nAlloc*2 + len + 20; p->z = realloc(p->z, p->nAlloc); | | < < < | 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 | if( zAppend[i]==quote ) len++; } } if( p->n+len>=p->nAlloc ){ p->nAlloc = p->nAlloc*2 + len + 20; p->z = realloc(p->z, p->nAlloc); if( p->z==0 ) shell_out_of_memory(); } if( quote ){ char *zCsr = p->z+p->n; *zCsr++ = quote; for(i=0; i<nAppend; i++){ *zCsr++ = zAppend[i]; |
︙ | ︙ | |||
8688 8689 8690 8691 8692 8693 8694 8695 8696 8697 8698 8699 8700 8701 | ){ const char *zEditor; char *zTempFile = 0; sqlite3 *db; char *zCmd = 0; int bBin; int rc; FILE *f = 0; sqlite3_int64 sz; sqlite3_int64 x; unsigned char *p = 0; if( argc==2 ){ zEditor = (const char*)sqlite3_value_text(argv[1]); | > | 8682 8683 8684 8685 8686 8687 8688 8689 8690 8691 8692 8693 8694 8695 8696 | ){ const char *zEditor; char *zTempFile = 0; sqlite3 *db; char *zCmd = 0; int bBin; int rc; int hasCRNL = 0; FILE *f = 0; sqlite3_int64 sz; sqlite3_int64 x; unsigned char *p = 0; if( argc==2 ){ zEditor = (const char*)sqlite3_value_text(argv[1]); |
︙ | ︙ | |||
8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 | zTempFile = sqlite3_mprintf("temp%llx", r); if( zTempFile==0 ){ sqlite3_result_error_nomem(context); return; } } bBin = sqlite3_value_type(argv[0])==SQLITE_BLOB; f = fopen(zTempFile, bBin ? "wb" : "w"); if( f==0 ){ sqlite3_result_error(context, "edit() cannot open temp file", -1); goto edit_func_end; } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); }else{ x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); } fclose(f); f = 0; if( x!=sz ){ sqlite3_result_error(context, "edit() could not write the whole file", -1); goto edit_func_end; } zCmd = sqlite3_mprintf("%s \"%s\"", zEditor, zTempFile); if( zCmd==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } rc = system(zCmd); sqlite3_free(zCmd); if( rc ){ sqlite3_result_error(context, "EDITOR returned non-zero", -1); goto edit_func_end; } | > > > > > | < | < < < < > > > > > > > > > > > > > > | 8714 8715 8716 8717 8718 8719 8720 8721 8722 8723 8724 8725 8726 8727 8728 8729 8730 8731 8732 8733 8734 8735 8736 8737 8738 8739 8740 8741 8742 8743 8744 8745 8746 8747 8748 8749 8750 8751 8752 8753 8754 8755 8756 8757 8758 8759 8760 8761 8762 8763 8764 8765 8766 8767 8768 8769 8770 8771 8772 8773 8774 8775 8776 8777 8778 8779 8780 8781 8782 8783 8784 8785 8786 8787 8788 8789 8790 8791 8792 8793 8794 8795 8796 8797 8798 | zTempFile = sqlite3_mprintf("temp%llx", r); if( zTempFile==0 ){ sqlite3_result_error_nomem(context); return; } } bBin = sqlite3_value_type(argv[0])==SQLITE_BLOB; /* When writing the file to be edited, do \n to \r\n conversions on systems ** that want \r\n line endings */ f = fopen(zTempFile, bBin ? "wb" : "w"); if( f==0 ){ sqlite3_result_error(context, "edit() cannot open temp file", -1); goto edit_func_end; } sz = sqlite3_value_bytes(argv[0]); if( bBin ){ x = fwrite(sqlite3_value_blob(argv[0]), 1, sz, f); }else{ const char *z = (const char*)sqlite3_value_text(argv[0]); /* Remember whether or not the value originally contained \r\n */ if( z && strstr(z,"\r\n")!=0 ) hasCRNL = 1; x = fwrite(sqlite3_value_text(argv[0]), 1, sz, f); } fclose(f); f = 0; if( x!=sz ){ sqlite3_result_error(context, "edit() could not write the whole file", -1); goto edit_func_end; } zCmd = sqlite3_mprintf("%s \"%s\"", zEditor, zTempFile); if( zCmd==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } rc = system(zCmd); sqlite3_free(zCmd); if( rc ){ sqlite3_result_error(context, "EDITOR returned non-zero", -1); goto edit_func_end; } f = fopen(zTempFile, "rb"); if( f==0 ){ sqlite3_result_error(context, "edit() cannot reopen temp file after edit", -1); goto edit_func_end; } fseek(f, 0, SEEK_END); sz = ftell(f); rewind(f); p = sqlite3_malloc64( sz+(bBin==0) ); if( p==0 ){ sqlite3_result_error_nomem(context); goto edit_func_end; } x = fread(p, 1, sz, f); fclose(f); f = 0; if( x!=sz ){ sqlite3_result_error(context, "could not read back the whole file", -1); goto edit_func_end; } if( bBin ){ sqlite3_result_blob64(context, p, sz, sqlite3_free); }else{ int i, j; if( hasCRNL ){ /* If the original contains \r\n then do no conversions back to \n */ j = sz; }else{ /* If the file did not originally contain \r\n then convert any new ** \r\n back into \n */ for(i=j=0; i<sz; i++){ if( p[i]=='\r' && p[i+1]=='\n' ) i++; p[j++] = p[i]; } sz = j; p[sz] = 0; } sqlite3_result_text64(context, (const char*)p, sz, sqlite3_free, SQLITE_UTF8); } p = 0; edit_func_end: if( f ) fclose(f); |
︙ | ︙ | |||
10126 10127 10128 10129 10130 10131 10132 10133 10134 10135 10136 10137 10138 10139 10140 | sqlite3_reset(pSql); return; } } } nAlloc += 100; p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int)); abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int)); } abYield[iOp] = str_in_array(zOp, azYield); p->aiIndent[iOp] = 0; p->nIndent = iOp+1; if( str_in_array(zOp, azNext) ){ for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; | > > | 10135 10136 10137 10138 10139 10140 10141 10142 10143 10144 10145 10146 10147 10148 10149 10150 10151 | sqlite3_reset(pSql); return; } } } nAlloc += 100; p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int)); if( p->aiIndent==0 ) shell_out_of_memory(); abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int)); if( abYield==0 ) shell_out_of_memory(); } abYield[iOp] = str_in_array(zOp, azYield); p->aiIndent[iOp] = 0; p->nIndent = iOp+1; if( str_in_array(zOp, azNext) ){ for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2; |
︙ | ︙ |
Changes to src/sqlite3.c.
︙ | ︙ | |||
1154 1155 1156 1157 1158 1159 1160 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 | | | 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
10029 10030 10031 10032 10033 10034 10035 | ** ** The following must be true for this function to succeed. If any of ** the following statements are false when sqlite3_snapshot_get() is ** called, SQLITE_ERROR is returned. The final value of *P is undefined ** in this case. ** ** <ul> | | | 10029 10030 10031 10032 10033 10034 10035 10036 10037 10038 10039 10040 10041 10042 10043 | ** ** The following must be true for this function to succeed. If any of ** the following statements are false when sqlite3_snapshot_get() is ** called, SQLITE_ERROR is returned. The final value of *P is undefined ** in this case. ** ** <ul> ** <li> The database handle must not be in [autocommit mode]. ** ** <li> Schema S of [database connection] D must be a [WAL mode] database. ** ** <li> There must not be a write transaction open on schema S of database ** connection D. ** ** <li> One or more transactions must have been written to the current wal |
︙ | ︙ | |||
10064 10065 10066 10067 10068 10069 10070 | sqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot ** METHOD: sqlite3_snapshot ** | | | | | < | | | < | > > > > | > | < | > | > > > > > > > > | 10064 10065 10066 10067 10068 10069 10070 10071 10072 10073 10074 10075 10076 10077 10078 10079 10080 10081 10082 10083 10084 10085 10086 10087 10088 10089 10090 10091 10092 10093 10094 10095 10096 10097 10098 10099 10100 10101 10102 10103 10104 | sqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot ** METHOD: sqlite3_snapshot ** ** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read ** transaction or upgrades an existing one for schema S of ** [database connection] D such that the read transaction refers to ** historical [snapshot] P, rather than the most recent change to the ** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK ** on success or an appropriate [error code] if it fails. ** ** ^In order to succeed, the database connection must not be in ** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there ** is already a read transaction open on schema S, then the database handle ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case ** SQLITE_BUSY_SNAPSHOT is returned. ** ** If there is already a read transaction open when this function is ** invoked, then the same read transaction remains open (on the same ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT ** is returned. If another error code - for example SQLITE_PROTOCOL or an ** SQLITE_IOERR error code - is returned, then the final state of the ** read transaction is undefined. If SQLITE_OK is returned, then the ** read transaction is now open on database snapshot P. ** ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the ** database connection D does not know that the database file for ** schema S is in [WAL mode]. A database connection might not know ** that the database file is in [WAL mode] if there has been no prior ** I/O on that database connection, or if the database entered [WAL mode] ** after the most recent I/O on the database connection.)^ ** (Hint: Run "[PRAGMA application_id]" against a newly opened |
︙ | ︙ | |||
13006 13007 13008 13009 13010 13011 13012 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) # define NDEBUG 1 #endif #if defined(NDEBUG) && defined(SQLITE_DEBUG) # undef NDEBUG #endif | < < < < < < < < < < < | 13017 13018 13019 13020 13021 13022 13023 13024 13025 13026 13027 13028 13029 13030 | #if !defined(NDEBUG) && !defined(SQLITE_DEBUG) # define NDEBUG 1 #endif #if defined(NDEBUG) && defined(SQLITE_DEBUG) # undef NDEBUG #endif /* ** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. */ #if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG) # define SQLITE_ENABLE_EXPLAIN_COMMENTS 1 #endif |
︙ | ︙ | |||
14718 14719 14720 14721 14722 14723 14724 | #define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */ #define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */ #define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */ #define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */ #define OP_IncrVacuum 59 /* jump */ #define OP_VNext 60 /* jump */ #define OP_Init 61 /* jump, synopsis: Start at P2 */ | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < > > > > | | | | | | | | | | | | | | | | | | | | | | | < < < < < < | | | | | | | | | | > | | | | < | | < | 14718 14719 14720 14721 14722 14723 14724 14725 14726 14727 14728 14729 14730 14731 14732 14733 14734 14735 14736 14737 14738 14739 14740 14741 14742 14743 14744 14745 14746 14747 14748 14749 14750 14751 14752 14753 14754 14755 14756 14757 14758 14759 14760 14761 14762 14763 14764 14765 14766 14767 14768 14769 14770 14771 14772 14773 14774 14775 14776 14777 14778 14779 14780 14781 14782 14783 14784 14785 14786 14787 14788 14789 14790 14791 14792 14793 14794 14795 14796 14797 14798 14799 14800 14801 14802 14803 14804 14805 14806 14807 14808 14809 14810 14811 14812 14813 14814 14815 14816 14817 14818 14819 14820 14821 14822 14823 14824 14825 14826 14827 14828 14829 14830 14831 14832 14833 14834 14835 14836 14837 14838 14839 14840 14841 14842 14843 14844 14845 14846 14847 14848 14849 14850 14851 14852 14853 14854 14855 14856 14857 14858 14859 14860 14861 14862 14863 14864 14865 14866 14867 14868 14869 14870 14871 14872 14873 14874 14875 14876 14877 | #define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */ #define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */ #define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */ #define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */ #define OP_IncrVacuum 59 /* jump */ #define OP_VNext 60 /* jump */ #define OP_Init 61 /* jump, synopsis: Start at P2 */ #define OP_PureFunc0 62 #define OP_Function0 63 /* synopsis: r[P3]=func(r[P2@P5]) */ #define OP_PureFunc 64 #define OP_Function 65 /* synopsis: r[P3]=func(r[P2@P5]) */ #define OP_Return 66 #define OP_EndCoroutine 67 #define OP_HaltIfNull 68 /* synopsis: if r[P3]=null halt */ #define OP_Halt 69 #define OP_Integer 70 /* synopsis: r[P2]=P1 */ #define OP_Int64 71 /* synopsis: r[P2]=P4 */ #define OP_String 72 /* synopsis: r[P2]='P4' (len=P1) */ #define OP_Null 73 /* synopsis: r[P2..P3]=NULL */ #define OP_SoftNull 74 /* synopsis: r[P1]=NULL */ #define OP_Blob 75 /* synopsis: r[P2]=P4 (len=P1) */ #define OP_Variable 76 /* synopsis: r[P2]=parameter(P1,P4) */ #define OP_Move 77 /* synopsis: r[P2@P3]=r[P1@P3] */ #define OP_Copy 78 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ #define OP_SCopy 79 /* synopsis: r[P2]=r[P1] */ #define OP_IntCopy 80 /* synopsis: r[P2]=r[P1] */ #define OP_ResultRow 81 /* synopsis: output=r[P1@P2] */ #define OP_CollSeq 82 #define OP_AddImm 83 /* synopsis: r[P1]=r[P1]+P2 */ #define OP_RealAffinity 84 #define OP_Cast 85 /* synopsis: affinity(r[P1]) */ #define OP_Permutation 86 #define OP_Compare 87 /* synopsis: r[P1@P3] <-> r[P2@P3] */ #define OP_IsTrue 88 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ #define OP_Offset 89 /* synopsis: r[P3] = sqlite_offset(P1) */ #define OP_Column 90 /* synopsis: r[P3]=PX */ #define OP_Affinity 91 /* synopsis: affinity(r[P1@P2]) */ #define OP_BitAnd 92 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ #define OP_BitOr 93 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ #define OP_ShiftLeft 94 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ #define OP_ShiftRight 95 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ #define OP_Add 96 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ #define OP_Subtract 97 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ #define OP_Multiply 98 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ #define OP_Divide 99 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ #define OP_Remainder 100 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ #define OP_Concat 101 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ #define OP_MakeRecord 102 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ #define OP_BitNot 103 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ #define OP_Count 104 /* synopsis: r[P2]=count() */ #define OP_ReadCookie 105 #define OP_String8 106 /* same as TK_STRING, synopsis: r[P2]='P4' */ #define OP_SetCookie 107 #define OP_ReopenIdx 108 /* synopsis: root=P2 iDb=P3 */ #define OP_OpenRead 109 /* synopsis: root=P2 iDb=P3 */ #define OP_OpenWrite 110 /* synopsis: root=P2 iDb=P3 */ #define OP_OpenDup 111 #define OP_OpenAutoindex 112 /* synopsis: nColumn=P2 */ #define OP_OpenEphemeral 113 /* synopsis: nColumn=P2 */ #define OP_SorterOpen 114 #define OP_SequenceTest 115 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ #define OP_OpenPseudo 116 /* synopsis: P3 columns in r[P2] */ #define OP_Close 117 #define OP_ColumnsUsed 118 #define OP_SeekHit 119 /* synopsis: seekHit=P2 */ #define OP_Sequence 120 /* synopsis: r[P2]=cursor[P1].ctr++ */ #define OP_NewRowid 121 /* synopsis: r[P2]=rowid */ #define OP_Insert 122 /* synopsis: intkey=r[P3] data=r[P2] */ #define OP_InsertInt 123 /* synopsis: intkey=P3 data=r[P2] */ #define OP_Delete 124 #define OP_ResetCount 125 #define OP_SorterCompare 126 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ #define OP_SorterData 127 /* synopsis: r[P2]=data */ #define OP_RowData 128 /* synopsis: r[P2]=data */ #define OP_Rowid 129 /* synopsis: r[P2]=rowid */ #define OP_NullRow 130 #define OP_SeekEnd 131 #define OP_SorterInsert 132 /* synopsis: key=r[P2] */ #define OP_IdxInsert 133 /* synopsis: key=r[P2] */ #define OP_IdxDelete 134 /* synopsis: key=r[P2@P3] */ #define OP_DeferredSeek 135 /* synopsis: Move P3 to P1.rowid if needed */ #define OP_IdxRowid 136 /* synopsis: r[P2]=rowid */ #define OP_Destroy 137 #define OP_Clear 138 #define OP_ResetSorter 139 #define OP_CreateBtree 140 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ #define OP_Real 141 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ #define OP_SqlExec 142 #define OP_ParseSchema 143 #define OP_LoadAnalysis 144 #define OP_DropTable 145 #define OP_DropIndex 146 #define OP_DropTrigger 147 #define OP_IntegrityCk 148 #define OP_RowSetAdd 149 /* synopsis: rowset(P1)=r[P2] */ #define OP_Param 150 #define OP_FkCounter 151 /* synopsis: fkctr[P1]+=P2 */ #define OP_MemMax 152 /* synopsis: r[P1]=max(r[P1],r[P2]) */ #define OP_OffsetLimit 153 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ #define OP_AggInverse 154 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ #define OP_AggStep 155 /* synopsis: accum=r[P3] step(r[P2@P5]) */ #define OP_AggStep1 156 /* synopsis: accum=r[P3] step(r[P2@P5]) */ #define OP_AggValue 157 /* synopsis: r[P3]=value N=P2 */ #define OP_AggFinal 158 /* synopsis: accum=r[P1] N=P2 */ #define OP_Expire 159 #define OP_TableLock 160 /* synopsis: iDb=P1 root=P2 write=P3 */ #define OP_VBegin 161 #define OP_VCreate 162 #define OP_VDestroy 163 #define OP_VOpen 164 #define OP_VColumn 165 /* synopsis: r[P3]=vcolumn(P2) */ #define OP_VRename 166 #define OP_Pagecount 167 #define OP_MaxPgcnt 168 #define OP_Trace 169 #define OP_CursorHint 170 #define OP_Noop 171 #define OP_Explain 172 #define OP_Abortable 173 /* Properties such as "out2" or "jump" that are specified in ** comments following the "case" for each opcode in the vdbe.c ** are encoded into bitvectors as follows: */ #define OPFLG_JUMP 0x01 /* jump: P2 holds jmp target */ #define OPFLG_IN1 0x02 /* in1: P1 is an input */ #define OPFLG_IN2 0x04 /* in2: P2 is an input */ #define OPFLG_IN3 0x08 /* in3: P3 is an input */ #define OPFLG_OUT2 0x10 /* out2: P2 is an output */ #define OPFLG_OUT3 0x20 /* out3: P3 is an output */ #define OPFLG_INITIALIZER {\ /* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00, 0x10,\ /* 8 */ 0x00, 0x01, 0x00, 0x01, 0x01, 0x01, 0x03, 0x03,\ /* 16 */ 0x01, 0x01, 0x03, 0x12, 0x03, 0x01, 0x09, 0x09,\ /* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\ /* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ /* 40 */ 0x01, 0x23, 0x0b, 0x26, 0x26, 0x01, 0x01, 0x03,\ /* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ /* 56 */ 0x0b, 0x0b, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,\ /* 64 */ 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10, 0x10,\ /* 72 */ 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x10,\ /* 80 */ 0x10, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\ /* 88 */ 0x12, 0x20, 0x00, 0x00, 0x26, 0x26, 0x26, 0x26,\ /* 96 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\ /* 104 */ 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 112 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 120 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 128 */ 0x00, 0x10, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00,\ /* 136 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ /* 144 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ /* 152 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ /* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ /* 168 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,} /* The sqlite3P2Values() routine is able to run faster if it knows ** the value of the largest JUMP opcode. The smaller the maximum ** JUMP opcode the better, so the mkopcodeh.tcl script that ** generated this include file strives to group all JUMP opcodes ** together near the beginning of the list. */ |
︙ | ︙ | |||
14948 14949 14950 14951 14952 14953 14954 | SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); | < < < | 14945 14946 14947 14948 14949 14950 14951 14952 14953 14954 14955 14956 14957 14958 | SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); #ifdef SQLITE_DEBUG SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); #endif SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*); SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); |
︙ | ︙ | |||
15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 15291 15292 15293 15294 | # ifdef SQLITE_DIRECT_OVERFLOW_READ SQLITE_PRIVATE int sqlite3PagerUseWal(Pager *pPager, Pgno); # endif # ifdef SQLITE_ENABLE_SNAPSHOT SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot); SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager); # endif #else # define sqlite3PagerUseWal(x,y) 0 #endif #ifdef SQLITE_ENABLE_ZIPVFS SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager); | > > | 15275 15276 15277 15278 15279 15280 15281 15282 15283 15284 15285 15286 15287 15288 15289 15290 | # ifdef SQLITE_DIRECT_OVERFLOW_READ SQLITE_PRIVATE int sqlite3PagerUseWal(Pager *pPager, Pgno); # endif # ifdef SQLITE_ENABLE_SNAPSHOT SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapshot **ppSnapshot); SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE int sqlite3PagerSnapshotRecover(Pager *pPager); SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager); # endif #else # define sqlite3PagerUseWal(x,y) 0 #endif #ifdef SQLITE_ENABLE_ZIPVFS SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager); |
︙ | ︙ | |||
16288 16289 16290 16291 16292 16293 16294 | /* ** Bits of the sqlite3.dbOptFlags field that are used by the ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to ** selectively disable various optimizations. */ #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ | | > | 16284 16285 16286 16287 16288 16289 16290 16291 16292 16293 16294 16295 16296 16297 16298 16299 16300 16301 16302 16303 16304 16305 16306 16307 16308 16309 16310 16311 16312 16313 | /* ** Bits of the sqlite3.dbOptFlags field that are used by the ** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to ** selectively disable various optimizations. */ #define SQLITE_QueryFlattener 0x0001 /* Query flattening */ /* 0x0002 available for reuse */ #define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */ #define SQLITE_FactorOutConst 0x0008 /* Constant factoring */ #define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */ #define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */ #define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */ #define SQLITE_Transitive 0x0080 /* Transitive constraints */ #define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */ #define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */ #define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */ #define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */ /* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */ #define SQLITE_PushDown 0x1000 /* The push-down optimization */ #define SQLITE_SimplifyJoin 0x2000 /* Convert LEFT JOIN to JOIN */ #define SQLITE_SkipScan 0x4000 /* Skip-scans */ #define SQLITE_PropagateConst 0x8000 /* The constant propagation opt */ #define SQLITE_AllOpts 0xffff /* All optimizations */ /* ** Macros for testing whether or not optimizations are enabled or disabled. */ #define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0) #define OptimizationEnabled(db, mask) (((db)->dbOptFlags&(mask))==0) |
︙ | ︙ | |||
17197 17198 17199 17200 17201 17202 17203 | /* ** The following are the meanings of bits in the Expr.flags field. */ #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */ #define EP_Agg 0x000002 /* Contains one or more aggregate functions */ #define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */ | | | 17194 17195 17196 17197 17198 17199 17200 17201 17202 17203 17204 17205 17206 17207 17208 | /* ** The following are the meanings of bits in the Expr.flags field. */ #define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */ #define EP_Agg 0x000002 /* Contains one or more aggregate functions */ #define EP_HasFunc 0x000004 /* Contains one or more functions of any kind */ #define EP_FixedCol 0x000008 /* TK_Column with a known fixed value */ #define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */ #define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ #define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ #define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ #define EP_Collate 0x000100 /* Tree contains a TK_COLLATE operator */ #define EP_Generic 0x000200 /* Ignore COLLATE or affinity on this tree */ #define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ |
︙ | ︙ | |||
17686 17687 17688 17689 17690 17691 17692 | struct AutoincInfo { AutoincInfo *pNext; /* Next info block in a list of them all */ Table *pTab; /* Table this info block refers to */ int iDb; /* Index in sqlite3.aDb[] of database holding pTab */ int regCtr; /* Memory register holding the rowid counter */ }; | < < < < < < < | 17683 17684 17685 17686 17687 17688 17689 17690 17691 17692 17693 17694 17695 17696 | struct AutoincInfo { AutoincInfo *pNext; /* Next info block in a list of them all */ Table *pTab; /* Table this info block refers to */ int iDb; /* Index in sqlite3.aDb[] of database holding pTab */ int regCtr; /* Memory register holding the rowid counter */ }; /* ** At least one instance of the following structure is created for each ** trigger that may be fired while parsing an INSERT, UPDATE or DELETE ** statement. All such objects are stored in the linked list headed at ** Parse.pTriggerPrg and deleted once statement compilation has been ** completed. ** |
︙ | ︙ | |||
17768 17769 17770 17771 17772 17773 17774 | u8 nested; /* Number of nested calls to the parser/code generator */ u8 nTempReg; /* Number of temporary registers in aTempReg[] */ u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ u8 mayAbort; /* True if statement may throw an ABORT exception */ u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ u8 okConstFactor; /* OK to factor out constants */ u8 disableLookaside; /* Number of times lookaside has been disabled */ | < < < | 17758 17759 17760 17761 17762 17763 17764 17765 17766 17767 17768 17769 17770 17771 17772 17773 17774 17775 17776 17777 17778 17779 17780 | u8 nested; /* Number of nested calls to the parser/code generator */ u8 nTempReg; /* Number of temporary registers in aTempReg[] */ u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ u8 mayAbort; /* True if statement may throw an ABORT exception */ u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ u8 okConstFactor; /* OK to factor out constants */ u8 disableLookaside; /* Number of times lookaside has been disabled */ int nRangeReg; /* Size of the temporary register block */ int iRangeReg; /* First register in temporary register block */ int nErr; /* Number of errors seen */ int nTab; /* Number of previously allocated VDBE cursors */ int nMem; /* Number of memory cells used so far */ int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */ int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */ int iSelfTab; /* Table associated with an index on expr, or negative ** of the base register during check-constraint eval */ int nLabel; /* Number of labels used */ int *aLabel; /* Space to hold the labels */ ExprList *pConstExpr;/* Constant expressions */ Token constraintName;/* Name of the constraint currently being parsed */ yDbMask writeMask; /* Start a write transaction on these databases */ yDbMask cookieMask; /* Bitmask of schema verified databases */ int regRowid; /* Register holding rowid of CREATE TABLE entry */ |
︙ | ︙ | |||
17809 17810 17811 17812 17813 17814 17815 | u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ u8 disableTriggers; /* True to disable triggers */ /************************************************************************** ** Fields above must be initialized to zero. The fields that follow, ** down to the beginning of the recursive section, do not need to be ** initialized as they will be set before being used. The boundary is | | < < < < < < < < | 17796 17797 17798 17799 17800 17801 17802 17803 17804 17805 17806 17807 17808 17809 17810 17811 17812 | u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ u8 disableTriggers; /* True to disable triggers */ /************************************************************************** ** Fields above must be initialized to zero. The fields that follow, ** down to the beginning of the recursive section, do not need to be ** initialized as they will be set before being used. The boundary is ** determined by offsetof(Parse,aTempReg). **************************************************************************/ int aTempReg[8]; /* Holding area for temporary registers */ Token sNameToken; /* Token with unqualified schema object name */ /************************************************************************ ** Above is constant between recursions. Below is reset before and after ** each recursion. The boundary between these two regions is determined ** using offsetof(Parse,sLastToken) so the sLastToken field must be the |
︙ | ︙ | |||
17861 17862 17863 17864 17865 17866 17867 | With *pWith; /* Current WITH clause, or NULL */ With *pWithToFree; /* Free this WITH object at the end of the parse */ }; /* ** Sizes and pointers of various parts of the Parse object. */ | | | 17840 17841 17842 17843 17844 17845 17846 17847 17848 17849 17850 17851 17852 17853 17854 | With *pWith; /* Current WITH clause, or NULL */ With *pWithToFree; /* Free this WITH object at the end of the parse */ }; /* ** Sizes and pointers of various parts of the Parse object. */ #define PARSE_HDR_SZ offsetof(Parse,aTempReg) /* Recursive part w/o aColCache*/ #define PARSE_RECURSE_SZ offsetof(Parse,sLastToken) /* Recursive part */ #define PARSE_TAIL_SZ (sizeof(Parse)-PARSE_RECURSE_SZ) /* Non-recursive part */ #define PARSE_TAIL(X) (((char*)(X))+PARSE_RECURSE_SZ) /* Pointer to tail */ /* ** Return true if currently inside an sqlite3_declare_vtab() call. */ |
︙ | ︙ | |||
18155 18156 18157 18158 18159 18160 18161 18162 18163 18164 18165 18166 18167 18168 | struct CCurHint *pCCurHint; /* Used by codeCursorHint() */ int *aiCol; /* array of column indexes */ struct IdxCover *pIdxCover; /* Check for index coverage */ struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ ExprList *pGroupBy; /* GROUP BY clause */ Select *pSelect; /* HAVING to WHERE clause ctx */ struct WindowRewrite *pRewrite; /* Window rewrite context */ } u; }; /* Forward declarations */ SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); | > | 18134 18135 18136 18137 18138 18139 18140 18141 18142 18143 18144 18145 18146 18147 18148 | struct CCurHint *pCCurHint; /* Used by codeCursorHint() */ int *aiCol; /* array of column indexes */ struct IdxCover *pIdxCover; /* Check for index coverage */ struct IdxExprTrans *pIdxTrans; /* Convert idxed expr to column */ ExprList *pGroupBy; /* GROUP BY clause */ Select *pSelect; /* HAVING to WHERE clause ctx */ struct WindowRewrite *pRewrite; /* Window rewrite context */ struct WhereConst *pConst; /* WHERE clause constants */ } u; }; /* Forward declarations */ SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); |
︙ | ︙ | |||
18509 18510 18511 18512 18513 18514 18515 | #endif SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); | | | 18489 18490 18491 18492 18493 18494 18495 18496 18497 18498 18499 18500 18501 18502 18503 | #endif SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*); SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse*, Expr*, Select*); SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*, int); SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*, u32); SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int); SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,const char*,const char*); |
︙ | ︙ | |||
18644 18645 18646 18647 18648 18649 18650 | SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */ #define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */ #define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int); SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); | < < < < < < < | 18624 18625 18626 18627 18628 18629 18630 18631 18632 18633 18634 18635 18636 18637 18638 18639 | SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); #define ONEPASS_OFF 0 /* Use of ONEPASS not allowed */ #define ONEPASS_SINGLE 1 /* ONEPASS valid for a single row update */ #define ONEPASS_MULTI 2 /* ONEPASS is valid for multiple rows */ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(Parse*, Index*, int, int, int); SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); SQLITE_PRIVATE void sqlite3ExprCode(Parse*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse*, Expr*, int); SQLITE_PRIVATE int sqlite3ExprCodeAtInit(Parse*, Expr*, int); SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse*, Expr*, int); |
︙ | ︙ | |||
18888 18889 18890 18891 18892 18893 18894 18895 18896 18897 18898 18899 18900 18901 | #ifdef SQLITE_ENABLE_DESERIALIZE SQLITE_PRIVATE int sqlite3MemdbInit(void); #endif SQLITE_PRIVATE const char *sqlite3ErrStr(int); SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse); SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr); SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*); SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int); SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*); SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*); | > | 18861 18862 18863 18864 18865 18866 18867 18868 18869 18870 18871 18872 18873 18874 18875 | #ifdef SQLITE_ENABLE_DESERIALIZE SQLITE_PRIVATE int sqlite3MemdbInit(void); #endif SQLITE_PRIVATE const char *sqlite3ErrStr(int); SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse); SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq*); SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr); SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*); SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int); SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*); SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*); |
︙ | ︙ | |||
19851 19852 19853 19854 19855 19856 19857 | u32 uTemp; /* Transient storage for serial_type in OP_MakeRecord */ sqlite3 *db; /* The associated database connection */ void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */ #ifdef SQLITE_DEBUG Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ u16 mScopyFlags; /* flags value immediately after the shallow copy */ #endif | < < < < | 19825 19826 19827 19828 19829 19830 19831 19832 19833 19834 19835 19836 19837 19838 | u32 uTemp; /* Transient storage for serial_type in OP_MakeRecord */ sqlite3 *db; /* The associated database connection */ void (*xDel)(void*);/* Destructor for Mem.z - only valid if MEM_Dyn */ #ifdef SQLITE_DEBUG Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ u16 mScopyFlags; /* flags value immediately after the shallow copy */ #endif }; /* ** Size of struct Mem not including the Mem.zMalloc member or anything that ** follows. */ #define MEMCELLSIZE offsetof(Mem,zMalloc) |
︙ | ︙ | |||
28511 28512 28513 28514 28515 28516 28517 28518 28519 28520 28521 28522 28523 28524 | if( pExpr->iTable<0 ){ /* This only happens when coding check constraints */ sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs); }else{ sqlite3TreeViewLine(pView, "{%d:%d}%s", pExpr->iTable, pExpr->iColumn, zFlgs); } break; } case TK_INTEGER: { if( pExpr->flags & EP_IntValue ){ sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue); }else{ sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken); | > > > | 28481 28482 28483 28484 28485 28486 28487 28488 28489 28490 28491 28492 28493 28494 28495 28496 28497 | if( pExpr->iTable<0 ){ /* This only happens when coding check constraints */ sqlite3TreeViewLine(pView, "COLUMN(%d)%s", pExpr->iColumn, zFlgs); }else{ sqlite3TreeViewLine(pView, "{%d:%d}%s", pExpr->iTable, pExpr->iColumn, zFlgs); } if( ExprHasProperty(pExpr, EP_FixedCol) ){ sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); } break; } case TK_INTEGER: { if( pExpr->flags & EP_IntValue ){ sqlite3TreeViewLine(pView, "%d", pExpr->u.iValue); }else{ sqlite3TreeViewLine(pView, "%s", pExpr->u.zToken); |
︙ | ︙ | |||
31739 31740 31741 31742 31743 31744 31745 | /* 55 */ "Le" OpHelp("IF r[P3]<=r[P1]"), /* 56 */ "Lt" OpHelp("IF r[P3]<r[P1]"), /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"), /* 58 */ "ElseNotEq" OpHelp(""), /* 59 */ "IncrVacuum" OpHelp(""), /* 60 */ "VNext" OpHelp(""), /* 61 */ "Init" OpHelp("Start at P2"), | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < | | | > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < > > > > | | | | | | | | | | | | | | | | | | | | | | | < < < < < < | | | | 31712 31713 31714 31715 31716 31717 31718 31719 31720 31721 31722 31723 31724 31725 31726 31727 31728 31729 31730 31731 31732 31733 31734 31735 31736 31737 31738 31739 31740 31741 31742 31743 31744 31745 31746 31747 31748 31749 31750 31751 31752 31753 31754 31755 31756 31757 31758 31759 31760 31761 31762 31763 31764 31765 31766 31767 31768 31769 31770 31771 31772 31773 31774 31775 31776 31777 31778 31779 31780 31781 31782 31783 31784 31785 31786 31787 31788 31789 31790 31791 31792 31793 31794 31795 31796 31797 31798 31799 31800 31801 31802 31803 31804 31805 31806 31807 31808 31809 31810 31811 31812 31813 31814 31815 31816 31817 31818 31819 31820 31821 31822 31823 31824 31825 31826 31827 31828 31829 31830 31831 31832 31833 31834 31835 31836 31837 | /* 55 */ "Le" OpHelp("IF r[P3]<=r[P1]"), /* 56 */ "Lt" OpHelp("IF r[P3]<r[P1]"), /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"), /* 58 */ "ElseNotEq" OpHelp(""), /* 59 */ "IncrVacuum" OpHelp(""), /* 60 */ "VNext" OpHelp(""), /* 61 */ "Init" OpHelp("Start at P2"), /* 62 */ "PureFunc0" OpHelp(""), /* 63 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), /* 64 */ "PureFunc" OpHelp(""), /* 65 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), /* 66 */ "Return" OpHelp(""), /* 67 */ "EndCoroutine" OpHelp(""), /* 68 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), /* 69 */ "Halt" OpHelp(""), /* 70 */ "Integer" OpHelp("r[P2]=P1"), /* 71 */ "Int64" OpHelp("r[P2]=P4"), /* 72 */ "String" OpHelp("r[P2]='P4' (len=P1)"), /* 73 */ "Null" OpHelp("r[P2..P3]=NULL"), /* 74 */ "SoftNull" OpHelp("r[P1]=NULL"), /* 75 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), /* 76 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), /* 77 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), /* 78 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), /* 79 */ "SCopy" OpHelp("r[P2]=r[P1]"), /* 80 */ "IntCopy" OpHelp("r[P2]=r[P1]"), /* 81 */ "ResultRow" OpHelp("output=r[P1@P2]"), /* 82 */ "CollSeq" OpHelp(""), /* 83 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), /* 84 */ "RealAffinity" OpHelp(""), /* 85 */ "Cast" OpHelp("affinity(r[P1])"), /* 86 */ "Permutation" OpHelp(""), /* 87 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), /* 88 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), /* 89 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), /* 90 */ "Column" OpHelp("r[P3]=PX"), /* 91 */ "Affinity" OpHelp("affinity(r[P1@P2])"), /* 92 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), /* 93 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), /* 94 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), /* 95 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), /* 96 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), /* 97 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), /* 98 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), /* 99 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), /* 100 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), /* 101 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), /* 102 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), /* 103 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), /* 104 */ "Count" OpHelp("r[P2]=count()"), /* 105 */ "ReadCookie" OpHelp(""), /* 106 */ "String8" OpHelp("r[P2]='P4'"), /* 107 */ "SetCookie" OpHelp(""), /* 108 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), /* 109 */ "OpenRead" OpHelp("root=P2 iDb=P3"), /* 110 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), /* 111 */ "OpenDup" OpHelp(""), /* 112 */ "OpenAutoindex" OpHelp("nColumn=P2"), /* 113 */ "OpenEphemeral" OpHelp("nColumn=P2"), /* 114 */ "SorterOpen" OpHelp(""), /* 115 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), /* 116 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), /* 117 */ "Close" OpHelp(""), /* 118 */ "ColumnsUsed" OpHelp(""), /* 119 */ "SeekHit" OpHelp("seekHit=P2"), /* 120 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), /* 121 */ "NewRowid" OpHelp("r[P2]=rowid"), /* 122 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), /* 123 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), /* 124 */ "Delete" OpHelp(""), /* 125 */ "ResetCount" OpHelp(""), /* 126 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), /* 127 */ "SorterData" OpHelp("r[P2]=data"), /* 128 */ "RowData" OpHelp("r[P2]=data"), /* 129 */ "Rowid" OpHelp("r[P2]=rowid"), /* 130 */ "NullRow" OpHelp(""), /* 131 */ "SeekEnd" OpHelp(""), /* 132 */ "SorterInsert" OpHelp("key=r[P2]"), /* 133 */ "IdxInsert" OpHelp("key=r[P2]"), /* 134 */ "IdxDelete" OpHelp("key=r[P2@P3]"), /* 135 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), /* 136 */ "IdxRowid" OpHelp("r[P2]=rowid"), /* 137 */ "Destroy" OpHelp(""), /* 138 */ "Clear" OpHelp(""), /* 139 */ "ResetSorter" OpHelp(""), /* 140 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), /* 141 */ "Real" OpHelp("r[P2]=P4"), /* 142 */ "SqlExec" OpHelp(""), /* 143 */ "ParseSchema" OpHelp(""), /* 144 */ "LoadAnalysis" OpHelp(""), /* 145 */ "DropTable" OpHelp(""), /* 146 */ "DropIndex" OpHelp(""), /* 147 */ "DropTrigger" OpHelp(""), /* 148 */ "IntegrityCk" OpHelp(""), /* 149 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), /* 150 */ "Param" OpHelp(""), /* 151 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), /* 152 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), /* 153 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), /* 154 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), /* 155 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), /* 156 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), /* 157 */ "AggValue" OpHelp("r[P3]=value N=P2"), /* 158 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), /* 159 */ "Expire" OpHelp(""), /* 160 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), /* 161 */ "VBegin" OpHelp(""), /* 162 */ "VCreate" OpHelp(""), /* 163 */ "VDestroy" OpHelp(""), /* 164 */ "VOpen" OpHelp(""), /* 165 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), /* 166 */ "VRename" OpHelp(""), /* 167 */ "Pagecount" OpHelp(""), /* 168 */ "MaxPgcnt" OpHelp(""), /* 169 */ "Trace" OpHelp(""), /* 170 */ "CursorHint" OpHelp(""), /* 171 */ "Noop" OpHelp(""), /* 172 */ "Explain" OpHelp(""), /* 173 */ "Abortable" OpHelp(""), }; return azName[i]; } #endif /************** End of opcodes.c *********************************************/ /************** Begin file os_unix.c *****************************************/ |
︙ | ︙ | |||
32762 32763 32764 32765 32766 32767 32768 32769 32770 32771 32772 32773 32774 32775 32776 32777 32778 32779 32780 32781 | ** Function unixMutexHeld() is used to assert() that the global mutex ** is held when required. This function is only used as part of assert() ** statements. e.g. ** ** unixEnterMutex() ** assert( unixMutexHeld() ); ** unixEnterLeave() */ static sqlite3_mutex *unixBigLock = 0; static void unixEnterMutex(void){ sqlite3_mutex_enter(unixBigLock); } static void unixLeaveMutex(void){ sqlite3_mutex_leave(unixBigLock); } #ifdef SQLITE_DEBUG static int unixMutexHeld(void) { return sqlite3_mutex_held(unixBigLock); } #endif | > > > > > > > > > > > > > | 32733 32734 32735 32736 32737 32738 32739 32740 32741 32742 32743 32744 32745 32746 32747 32748 32749 32750 32751 32752 32753 32754 32755 32756 32757 32758 32759 32760 32761 32762 32763 32764 32765 | ** Function unixMutexHeld() is used to assert() that the global mutex ** is held when required. This function is only used as part of assert() ** statements. e.g. ** ** unixEnterMutex() ** assert( unixMutexHeld() ); ** unixEnterLeave() ** ** To prevent deadlock, the global unixBigLock must must be acquired ** before the unixInodeInfo.pLockMutex mutex, if both are held. It is ** OK to get the pLockMutex without holding unixBigLock first, but if ** that happens, the unixBigLock mutex must not be acquired until after ** pLockMutex is released. ** ** OK: enter(unixBigLock), enter(pLockInfo) ** OK: enter(unixBigLock) ** OK: enter(pLockInfo) ** ERROR: enter(pLockInfo), enter(unixBigLock) */ static sqlite3_mutex *unixBigLock = 0; static void unixEnterMutex(void){ assert( sqlite3_mutex_notheld(unixBigLock) ); /* Not a recursive mutex */ sqlite3_mutex_enter(unixBigLock); } static void unixLeaveMutex(void){ assert( sqlite3_mutex_held(unixBigLock) ); sqlite3_mutex_leave(unixBigLock); } #ifdef SQLITE_DEBUG static int unixMutexHeld(void) { return sqlite3_mutex_held(unixBigLock); } #endif |
︙ | ︙ | |||
33168 33169 33170 33171 33172 33173 33174 33175 33176 33177 | ** An instance of the following structure is allocated for each open ** inode. Or, on LinuxThreads, there is one of these structures for ** each inode opened by each thread. ** ** A single inode can have multiple file descriptors, so each unixFile ** structure contains a pointer to an instance of this object and this ** object keeps a count of the number of unixFile pointing to it. */ struct unixInodeInfo { struct unixFileId fileId; /* The lookup key */ | > > > > > > > > > > > > > > > > > > | > | | > < < | > > > > > > > > > > > > > > | 33152 33153 33154 33155 33156 33157 33158 33159 33160 33161 33162 33163 33164 33165 33166 33167 33168 33169 33170 33171 33172 33173 33174 33175 33176 33177 33178 33179 33180 33181 33182 33183 33184 33185 33186 33187 33188 33189 33190 33191 33192 33193 33194 33195 33196 33197 33198 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 | ** An instance of the following structure is allocated for each open ** inode. Or, on LinuxThreads, there is one of these structures for ** each inode opened by each thread. ** ** A single inode can have multiple file descriptors, so each unixFile ** structure contains a pointer to an instance of this object and this ** object keeps a count of the number of unixFile pointing to it. ** ** Mutex rules: ** ** (1) Only the pLockMutex mutex must be held in order to read or write ** any of the locking fields: ** nShared, nLock, eFileLock, bProcessLock, pUnused ** ** (2) When nRef>0, then the following fields are unchanging and can ** be read (but not written) without holding any mutex: ** fileId, pLockMutex ** ** (3) With the exceptions above, all the fields may only be read ** or written while holding the global unixBigLock mutex. ** ** Deadlock prevention: The global unixBigLock mutex may not ** be acquired while holding the pLockMutex mutex. If both unixBigLock ** and pLockMutex are needed, then unixBigLock must be acquired first. */ struct unixInodeInfo { struct unixFileId fileId; /* The lookup key */ sqlite3_mutex *pLockMutex; /* Hold this mutex for... */ int nShared; /* Number of SHARED locks held */ int nLock; /* Number of outstanding file locks */ unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */ unsigned char bProcessLock; /* An exclusive process lock is held */ UnixUnusedFd *pUnused; /* Unused file descriptors to close */ int nRef; /* Number of pointers to this structure */ unixShmNode *pShmNode; /* Shared memory associated with this inode */ unixInodeInfo *pNext; /* List of all unixInodeInfo objects */ unixInodeInfo *pPrev; /* .... doubly linked */ #if SQLITE_ENABLE_LOCKING_STYLE unsigned long long sharedByte; /* for AFP simulated shared lock */ #endif #if OS_VXWORKS sem_t *pSem; /* Named POSIX semaphore */ char aSemName[MAX_PATHNAME+2]; /* Name of that semaphore */ #endif }; /* ** A lists of all unixInodeInfo objects. */ static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */ #ifdef SQLITE_DEBUG /* ** True if the inode mutex is held, or not. Used only within assert() ** to help verify correct mutex usage. */ int unixFileMutexHeld(unixFile *pFile){ assert( pFile->pInode ); return sqlite3_mutex_held(pFile->pInode->pLockMutex); } int unixFileMutexNotheld(unixFile *pFile){ assert( pFile->pInode ); return sqlite3_mutex_notheld(pFile->pInode->pLockMutex); } #endif /* ** ** This function - unixLogErrorAtLine(), is only ever called via the macro ** unixLogError(). ** ** It is invoked after an error occurs in an OS function and errno has been |
︙ | ︙ | |||
33299 33300 33301 33302 33303 33304 33305 33306 33307 33308 33309 | /* ** Close all file descriptors accumuated in the unixInodeInfo->pUnused list. */ static void closePendingFds(unixFile *pFile){ unixInodeInfo *pInode = pFile->pInode; UnixUnusedFd *p; UnixUnusedFd *pNext; for(p=pInode->pUnused; p; p=pNext){ pNext = p->pNext; robust_close(pFile, p->fd, __LINE__); sqlite3_free(p); | > < > > > > < | 33315 33316 33317 33318 33319 33320 33321 33322 33323 33324 33325 33326 33327 33328 33329 33330 33331 33332 33333 33334 33335 33336 33337 33338 33339 33340 33341 33342 33343 33344 33345 33346 33347 33348 33349 33350 33351 33352 33353 33354 33355 33356 33357 33358 33359 33360 33361 33362 33363 33364 33365 33366 33367 33368 33369 | /* ** Close all file descriptors accumuated in the unixInodeInfo->pUnused list. */ static void closePendingFds(unixFile *pFile){ unixInodeInfo *pInode = pFile->pInode; UnixUnusedFd *p; UnixUnusedFd *pNext; assert( unixFileMutexHeld(pFile) ); for(p=pInode->pUnused; p; p=pNext){ pNext = p->pNext; robust_close(pFile, p->fd, __LINE__); sqlite3_free(p); } pInode->pUnused = 0; } /* ** Release a unixInodeInfo structure previously allocated by findInodeInfo(). ** ** The mutex entered using the unixEnterMutex() function must be held ** when this function is called. */ static void releaseInodeInfo(unixFile *pFile){ unixInodeInfo *pInode = pFile->pInode; assert( unixMutexHeld() ); assert( unixFileMutexNotheld(pFile) ); if( ALWAYS(pInode) ){ pInode->nRef--; if( pInode->nRef==0 ){ assert( pInode->pShmNode==0 ); sqlite3_mutex_enter(pInode->pLockMutex); closePendingFds(pFile); sqlite3_mutex_leave(pInode->pLockMutex); if( pInode->pPrev ){ assert( pInode->pPrev->pNext==pInode ); pInode->pPrev->pNext = pInode->pNext; }else{ assert( inodeList==pInode ); inodeList = pInode->pNext; } if( pInode->pNext ){ assert( pInode->pNext->pPrev==pInode ); pInode->pNext->pPrev = pInode->pPrev; } sqlite3_mutex_free(pInode->pLockMutex); sqlite3_free(pInode); } } } /* ** Given a file descriptor, locate the unixInodeInfo object that ** describes that file descriptor. Create a new one if necessary. The ** return value might be uninitialized if an error occurs. ** |
︙ | ︙ | |||
33406 33407 33408 33409 33410 33411 33412 | memset(&fileId, 0, sizeof(fileId)); fileId.dev = statbuf.st_dev; #if OS_VXWORKS fileId.pId = pFile->pId; #else fileId.ino = (u64)statbuf.st_ino; #endif | < > > > > > > > | 33425 33426 33427 33428 33429 33430 33431 33432 33433 33434 33435 33436 33437 33438 33439 33440 33441 33442 33443 33444 33445 33446 33447 33448 33449 33450 33451 33452 33453 33454 33455 33456 | memset(&fileId, 0, sizeof(fileId)); fileId.dev = statbuf.st_dev; #if OS_VXWORKS fileId.pId = pFile->pId; #else fileId.ino = (u64)statbuf.st_ino; #endif pInode = inodeList; while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){ pInode = pInode->pNext; } if( pInode==0 ){ pInode = sqlite3_malloc64( sizeof(*pInode) ); if( pInode==0 ){ return SQLITE_NOMEM_BKPT; } memset(pInode, 0, sizeof(*pInode)); memcpy(&pInode->fileId, &fileId, sizeof(fileId)); if( sqlite3GlobalConfig.bCoreMutex ){ pInode->pLockMutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); if( pInode->pLockMutex==0 ){ sqlite3_free(pInode); return SQLITE_NOMEM_BKPT; } } pInode->nRef = 1; pInode->pNext = inodeList; pInode->pPrev = 0; if( inodeList ) inodeList->pPrev = pInode; inodeList = pInode; }else{ pInode->nRef++; |
︙ | ︙ | |||
33496 33497 33498 33499 33500 33501 33502 | int reserved = 0; unixFile *pFile = (unixFile*)id; SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); assert( pFile ); assert( pFile->eFileLock<=SHARED_LOCK ); | | | 33521 33522 33523 33524 33525 33526 33527 33528 33529 33530 33531 33532 33533 33534 33535 | int reserved = 0; unixFile *pFile = (unixFile*)id; SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); assert( pFile ); assert( pFile->eFileLock<=SHARED_LOCK ); sqlite3_mutex_enter(pFile->pInode->pLockMutex); /* Check if a thread in this process holds such a lock */ if( pFile->pInode->eFileLock>SHARED_LOCK ){ reserved = 1; } /* Otherwise see if some other process holds it. |
︙ | ︙ | |||
33521 33522 33523 33524 33525 33526 33527 | storeLastErrno(pFile, errno); } else if( lock.l_type!=F_UNLCK ){ reserved = 1; } } #endif | | | 33546 33547 33548 33549 33550 33551 33552 33553 33554 33555 33556 33557 33558 33559 33560 | storeLastErrno(pFile, errno); } else if( lock.l_type!=F_UNLCK ){ reserved = 1; } } #endif sqlite3_mutex_leave(pFile->pInode->pLockMutex); OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved)); *pResOut = reserved; return rc; } /* |
︙ | ︙ | |||
33587 33588 33589 33590 33591 33592 33593 | ** ** Zero is returned if the call completes successfully, or -1 if a call ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()). */ static int unixFileLock(unixFile *pFile, struct flock *pLock){ int rc; unixInodeInfo *pInode = pFile->pInode; | < > | 33612 33613 33614 33615 33616 33617 33618 33619 33620 33621 33622 33623 33624 33625 33626 33627 | ** ** Zero is returned if the call completes successfully, or -1 if a call ** to fcntl() fails. In this case, errno is set appropriately (by fcntl()). */ static int unixFileLock(unixFile *pFile, struct flock *pLock){ int rc; unixInodeInfo *pInode = pFile->pInode; assert( pInode!=0 ); assert( sqlite3_mutex_held(pInode->pLockMutex) ); if( (pFile->ctrlFlags & (UNIXFILE_EXCL|UNIXFILE_RDONLY))==UNIXFILE_EXCL ){ if( pInode->bProcessLock==0 ){ struct flock lock; assert( pInode->nLock==0 ); lock.l_whence = SEEK_SET; lock.l_start = SHARED_FIRST; lock.l_len = SHARED_SIZE; |
︙ | ︙ | |||
33707 33708 33709 33710 33711 33712 33713 | */ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); assert( eFileLock!=PENDING_LOCK ); assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); /* This mutex is needed because pFile->pInode is shared across threads */ | < > | 33732 33733 33734 33735 33736 33737 33738 33739 33740 33741 33742 33743 33744 33745 33746 33747 | */ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); assert( eFileLock!=PENDING_LOCK ); assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); /* This mutex is needed because pFile->pInode is shared across threads */ pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); /* If some thread using this PID has a lock via a different unixFile* ** handle that precludes the requested lock, return BUSY. */ if( (pFile->eFileLock!=pInode->eFileLock && (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK)) ){ |
︙ | ︙ | |||
33851 33852 33853 33854 33855 33856 33857 | pInode->eFileLock = eFileLock; }else if( eFileLock==EXCLUSIVE_LOCK ){ pFile->eFileLock = PENDING_LOCK; pInode->eFileLock = PENDING_LOCK; } end_lock: | | > < | 33876 33877 33878 33879 33880 33881 33882 33883 33884 33885 33886 33887 33888 33889 33890 33891 33892 33893 33894 33895 33896 33897 33898 33899 33900 33901 33902 33903 33904 33905 33906 33907 | pInode->eFileLock = eFileLock; }else if( eFileLock==EXCLUSIVE_LOCK ){ pFile->eFileLock = PENDING_LOCK; pInode->eFileLock = PENDING_LOCK; } end_lock: sqlite3_mutex_leave(pInode->pLockMutex); OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock), rc==SQLITE_OK ? "ok" : "failed")); return rc; } /* ** Add the file descriptor used by file handle pFile to the corresponding ** pUnused list. */ static void setPendingFd(unixFile *pFile){ unixInodeInfo *pInode = pFile->pInode; UnixUnusedFd *p = pFile->pPreallocatedUnused; assert( unixFileMutexHeld(pFile) ); p->pNext = pInode->pUnused; pInode->pUnused = p; pFile->h = -1; pFile->pPreallocatedUnused = 0; } /* ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock ** must be either NO_LOCK or SHARED_LOCK. ** ** If the locking level of the file descriptor is already at or below |
︙ | ︙ | |||
33899 33900 33901 33902 33903 33904 33905 | pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, osGetpid(0))); assert( eFileLock<=SHARED_LOCK ); if( pFile->eFileLock<=eFileLock ){ return SQLITE_OK; } | < > | 33924 33925 33926 33927 33928 33929 33930 33931 33932 33933 33934 33935 33936 33937 33938 33939 | pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, osGetpid(0))); assert( eFileLock<=SHARED_LOCK ); if( pFile->eFileLock<=eFileLock ){ return SQLITE_OK; } pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); #ifdef SQLITE_DEBUG /* When reducing a lock such that other processes can start ** reading the database file again, make sure that the |
︙ | ︙ | |||
34026 34027 34028 34029 34030 34031 34032 | /* 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. */ pInode->nLock--; assert( pInode->nLock>=0 ); | | < < | | > > | 34051 34052 34053 34054 34055 34056 34057 34058 34059 34060 34061 34062 34063 34064 34065 34066 34067 34068 34069 34070 34071 34072 | /* 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. */ pInode->nLock--; assert( pInode->nLock>=0 ); if( pInode->nLock==0 ) closePendingFds(pFile); } end_unlock: sqlite3_mutex_leave(pInode->pLockMutex); if( rc==SQLITE_OK ){ pFile->eFileLock = eFileLock; } return rc; } /* ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock ** must be either NO_LOCK or SHARED_LOCK. ** |
︙ | ︙ | |||
34104 34105 34106 34107 34108 34109 34110 34111 34112 34113 34114 34115 34116 34117 34118 | /* ** Close a file. */ static int unixClose(sqlite3_file *id){ int rc = SQLITE_OK; unixFile *pFile = (unixFile *)id; verifyDbFile(pFile); unixUnlock(id, NO_LOCK); unixEnterMutex(); /* unixFile.pInode is always valid here. Otherwise, a different close ** routine (e.g. nolockClose()) would be called instead. */ assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 ); | > > > > > | > | 34129 34130 34131 34132 34133 34134 34135 34136 34137 34138 34139 34140 34141 34142 34143 34144 34145 34146 34147 34148 34149 34150 34151 34152 34153 34154 34155 34156 34157 34158 34159 34160 34161 34162 34163 34164 | /* ** Close a file. */ static int unixClose(sqlite3_file *id){ int rc = SQLITE_OK; unixFile *pFile = (unixFile *)id; unixInodeInfo *pInode = pFile->pInode; assert( pInode!=0 ); verifyDbFile(pFile); unixUnlock(id, NO_LOCK); assert( unixFileMutexNotheld(pFile) ); unixEnterMutex(); /* unixFile.pInode is always valid here. Otherwise, a different close ** routine (e.g. nolockClose()) would be called instead. */ assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 ); sqlite3_mutex_enter(pInode->pLockMutex); if( pInode->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file ** descriptor to pInode->pUnused list. It will be automatically closed ** when the last lock is cleared. */ setPendingFd(pFile); } sqlite3_mutex_leave(pInode->pLockMutex); releaseInodeInfo(pFile); rc = closeUnixFile(id); unixLeaveMutex(); return rc; } /************** End of the posix advisory lock implementation ***************** |
︙ | ︙ | |||
34717 34718 34719 34720 34721 34722 34723 34724 34725 34726 34727 34728 34729 34730 | ** Close a file. */ static int semXClose(sqlite3_file *id) { if( id ){ unixFile *pFile = (unixFile*)id; semXUnlock(id, NO_LOCK); assert( pFile ); unixEnterMutex(); releaseInodeInfo(pFile); unixLeaveMutex(); closeUnixFile(id); } return SQLITE_OK; } | > | 34748 34749 34750 34751 34752 34753 34754 34755 34756 34757 34758 34759 34760 34761 34762 | ** Close a file. */ static int semXClose(sqlite3_file *id) { if( id ){ unixFile *pFile = (unixFile*)id; semXUnlock(id, NO_LOCK); assert( pFile ); assert( unixFileMutexNotheld(pFile) ); unixEnterMutex(); releaseInodeInfo(pFile); unixLeaveMutex(); closeUnixFile(id); } return SQLITE_OK; } |
︙ | ︙ | |||
34831 34832 34833 34834 34835 34836 34837 | assert( pFile ); context = (afpLockingContext *) pFile->lockingContext; if( context->reserved ){ *pResOut = 1; return SQLITE_OK; } | < | | 34863 34864 34865 34866 34867 34868 34869 34870 34871 34872 34873 34874 34875 34876 34877 | assert( pFile ); context = (afpLockingContext *) pFile->lockingContext; if( context->reserved ){ *pResOut = 1; return SQLITE_OK; } sqlite3_mutex_enter(pFile->pInode->pLockMutex); /* Check if a thread in this process holds such a lock */ if( pFile->pInode->eFileLock>SHARED_LOCK ){ reserved = 1; } /* Otherwise see if some other process holds it. */ |
︙ | ︙ | |||
34856 34857 34858 34859 34860 34861 34862 | reserved = 1; } if( IS_LOCK_ERROR(lrc) ){ rc=lrc; } } | | | 34887 34888 34889 34890 34891 34892 34893 34894 34895 34896 34897 34898 34899 34900 34901 | reserved = 1; } if( IS_LOCK_ERROR(lrc) ){ rc=lrc; } } sqlite3_mutex_leave(pFile->pInode->pLockMutex); OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved)); *pResOut = reserved; return rc; } /* |
︙ | ︙ | |||
34919 34920 34921 34922 34923 34924 34925 | */ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); assert( eFileLock!=PENDING_LOCK ); assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); /* This mutex is needed because pFile->pInode is shared across threads */ | < > | 34950 34951 34952 34953 34954 34955 34956 34957 34958 34959 34960 34961 34962 34963 34964 34965 | */ assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); assert( eFileLock!=PENDING_LOCK ); assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); /* This mutex is needed because pFile->pInode is shared across threads */ pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); /* If some thread using this PID has a lock via a different unixFile* ** handle that precludes the requested lock, return BUSY. */ if( (pFile->eFileLock!=pInode->eFileLock && (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK)) ){ |
︙ | ︙ | |||
35056 35057 35058 35059 35060 35061 35062 | pInode->eFileLock = eFileLock; }else if( eFileLock==EXCLUSIVE_LOCK ){ pFile->eFileLock = PENDING_LOCK; pInode->eFileLock = PENDING_LOCK; } afp_end_lock: | | | 35087 35088 35089 35090 35091 35092 35093 35094 35095 35096 35097 35098 35099 35100 35101 | pInode->eFileLock = eFileLock; }else if( eFileLock==EXCLUSIVE_LOCK ){ pFile->eFileLock = PENDING_LOCK; pInode->eFileLock = PENDING_LOCK; } afp_end_lock: sqlite3_mutex_leave(pInode->pLockMutex); OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock), rc==SQLITE_OK ? "ok" : "failed")); return rc; } /* ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock |
︙ | ︙ | |||
35088 35089 35090 35091 35092 35093 35094 | pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, osGetpid(0))); assert( eFileLock<=SHARED_LOCK ); if( pFile->eFileLock<=eFileLock ){ return SQLITE_OK; } | < > | 35119 35120 35121 35122 35123 35124 35125 35126 35127 35128 35129 35130 35131 35132 35133 35134 | pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, osGetpid(0))); assert( eFileLock<=SHARED_LOCK ); if( pFile->eFileLock<=eFileLock ){ return SQLITE_OK; } pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); assert( pInode->nShared!=0 ); if( pFile->eFileLock>SHARED_LOCK ){ assert( pInode->eFileLock==pFile->eFileLock ); SimulateIOErrorBenign(1); SimulateIOError( h=(-1) ) SimulateIOErrorBenign(0); |
︙ | ︙ | |||
35158 35159 35160 35161 35162 35163 35164 | pInode->eFileLock = NO_LOCK; pFile->eFileLock = NO_LOCK; } } if( rc==SQLITE_OK ){ pInode->nLock--; assert( pInode->nLock>=0 ); | | < < | | > > > | > > > | | | | | | > > | 35189 35190 35191 35192 35193 35194 35195 35196 35197 35198 35199 35200 35201 35202 35203 35204 35205 35206 35207 35208 35209 35210 35211 35212 35213 35214 35215 35216 35217 35218 35219 35220 35221 35222 35223 35224 35225 35226 35227 35228 35229 35230 35231 35232 35233 35234 35235 | pInode->eFileLock = NO_LOCK; pFile->eFileLock = NO_LOCK; } } if( rc==SQLITE_OK ){ pInode->nLock--; assert( pInode->nLock>=0 ); if( pInode->nLock==0 ) closePendingFds(pFile); } } sqlite3_mutex_leave(pInode->pLockMutex); if( rc==SQLITE_OK ){ pFile->eFileLock = eFileLock; } return rc; } /* ** Close a file & cleanup AFP specific locking context */ static int afpClose(sqlite3_file *id) { int rc = SQLITE_OK; unixFile *pFile = (unixFile*)id; assert( id!=0 ); afpUnlock(id, NO_LOCK); assert( unixFileMutexNotheld(pFile) ); unixEnterMutex(); if( pFile->pInode ){ unixInodeInfo *pInode = pFile->pInode; sqlite3_mutex_enter(pInode->pLockMutex); if( pFile->pInode->nLock ){ /* If there are outstanding locks, do not actually close the file just ** yet because that would clear those locks. Instead, add the file ** descriptor to pInode->aPending. It will be automatically closed when ** the last lock is cleared. */ setPendingFd(pFile); } sqlite3_mutex_leave(pInode->pLockMutex); } releaseInodeInfo(pFile); sqlite3_free(pFile->lockingContext); rc = closeUnixFile(id); unixLeaveMutex(); return rc; } |
︙ | ︙ | |||
36490 36491 36492 36493 36494 36495 36496 36497 36498 36499 36500 36501 36502 36503 | if( p==0 ) return SQLITE_NOMEM_BKPT; memset(p, 0, sizeof(*p)); assert( pDbFd->pShm==0 ); /* Check to see if a unixShmNode object already exists. Reuse an existing ** one if present. Create a new one if necessary. */ unixEnterMutex(); pInode = pDbFd->pInode; pShmNode = pInode->pShmNode; if( pShmNode==0 ){ struct stat sStat; /* fstat() info for database file */ #ifndef SQLITE_SHM_DIRECTORY const char *zBasePath = pDbFd->zPath; | > | 36527 36528 36529 36530 36531 36532 36533 36534 36535 36536 36537 36538 36539 36540 36541 | if( p==0 ) return SQLITE_NOMEM_BKPT; memset(p, 0, sizeof(*p)); assert( pDbFd->pShm==0 ); /* Check to see if a unixShmNode object already exists. Reuse an existing ** one if present. Create a new one if necessary. */ assert( unixFileMutexNotheld(pDbFd) ); unixEnterMutex(); pInode = pDbFd->pInode; pShmNode = pInode->pShmNode; if( pShmNode==0 ){ struct stat sStat; /* fstat() info for database file */ #ifndef SQLITE_SHM_DIRECTORY const char *zBasePath = pDbFd->zPath; |
︙ | ︙ | |||
36872 36873 36874 36875 36876 36877 36878 36879 36880 36881 36882 36883 36884 36885 | ** any load or store begun after the barrier. */ static void unixShmBarrier( sqlite3_file *fd /* Database file holding the shared memory */ ){ UNUSED_PARAMETER(fd); sqlite3MemoryBarrier(); /* compiler-defined memory barrier */ unixEnterMutex(); /* Also mutex, for redundancy */ unixLeaveMutex(); } /* ** Close a connection to shared-memory. Delete the underlying ** storage if deleteFlag is true. | > | 36910 36911 36912 36913 36914 36915 36916 36917 36918 36919 36920 36921 36922 36923 36924 | ** any load or store begun after the barrier. */ static void unixShmBarrier( sqlite3_file *fd /* Database file holding the shared memory */ ){ UNUSED_PARAMETER(fd); sqlite3MemoryBarrier(); /* compiler-defined memory barrier */ assert( unixFileMutexNotheld((unixFile*)fd) ); unixEnterMutex(); /* Also mutex, for redundancy */ unixLeaveMutex(); } /* ** Close a connection to shared-memory. Delete the underlying ** storage if deleteFlag is true. |
︙ | ︙ | |||
36913 36914 36915 36916 36917 36918 36919 36920 36921 36922 36923 36924 36925 36926 | /* Free the connection p */ sqlite3_free(p); pDbFd->pShm = 0; sqlite3_mutex_leave(pShmNode->mutex); /* If pShmNode->nRef has reached 0, then close the underlying ** shared-memory file, too */ unixEnterMutex(); assert( pShmNode->nRef>0 ); pShmNode->nRef--; if( pShmNode->nRef==0 ){ if( deleteFlag && pShmNode->h>=0 ){ osUnlink(pShmNode->zFilename); } | > | 36952 36953 36954 36955 36956 36957 36958 36959 36960 36961 36962 36963 36964 36965 36966 | /* Free the connection p */ sqlite3_free(p); pDbFd->pShm = 0; sqlite3_mutex_leave(pShmNode->mutex); /* If pShmNode->nRef has reached 0, then close the underlying ** shared-memory file, too */ assert( unixFileMutexNotheld(pDbFd) ); unixEnterMutex(); assert( pShmNode->nRef>0 ); pShmNode->nRef--; if( pShmNode->nRef==0 ){ if( deleteFlag && pShmNode->h>=0 ){ osUnlink(pShmNode->zFilename); } |
︙ | ︙ | |||
37239 37240 37241 37242 37243 37244 37245 | unixUnlock, /* xUnlock method */ unixCheckReservedLock, /* xCheckReservedLock method */ unixShmMap /* xShmMap method */ ) IOMETHODS( nolockIoFinder, /* Finder function name */ nolockIoMethods, /* sqlite3_io_methods object name */ | | | 37279 37280 37281 37282 37283 37284 37285 37286 37287 37288 37289 37290 37291 37292 37293 | unixUnlock, /* xUnlock method */ unixCheckReservedLock, /* xCheckReservedLock method */ unixShmMap /* xShmMap method */ ) IOMETHODS( nolockIoFinder, /* Finder function name */ nolockIoMethods, /* sqlite3_io_methods object name */ 3, /* shared memory and mmap are enabled */ nolockClose, /* xClose method */ nolockLock, /* xLock method */ nolockUnlock, /* xUnlock method */ nolockCheckReservedLock, /* xCheckReservedLock method */ 0 /* xShmMap method */ ) IOMETHODS( |
︙ | ︙ | |||
37735 37736 37737 37738 37739 37740 37741 | ** almost certain that an open() call on the same path will also fail. ** For this reason, if an error occurs in the stat() call here, it is ** ignored and -1 is returned. The caller will try to open a new file ** descriptor on the same path, fail, and return an error to SQLite. ** ** Even if a subsequent open() call does succeed, the consequences of ** not searching for a reusable file descriptor are not dire. */ | | > > < > | 37775 37776 37777 37778 37779 37780 37781 37782 37783 37784 37785 37786 37787 37788 37789 37790 37791 37792 37793 37794 37795 37796 37797 37798 37799 37800 37801 37802 37803 37804 37805 37806 | ** almost certain that an open() call on the same path will also fail. ** For this reason, if an error occurs in the stat() call here, it is ** ignored and -1 is returned. The caller will try to open a new file ** descriptor on the same path, fail, and return an error to SQLite. ** ** Even if a subsequent open() call does succeed, the consequences of ** not searching for a reusable file descriptor are not dire. */ if( inodeList!=0 && 0==osStat(zPath, &sStat) ){ unixInodeInfo *pInode; pInode = inodeList; while( pInode && (pInode->fileId.dev!=sStat.st_dev || pInode->fileId.ino!=(u64)sStat.st_ino) ){ pInode = pInode->pNext; } if( pInode ){ UnixUnusedFd **pp; assert( sqlite3_mutex_notheld(pInode->pLockMutex) ); sqlite3_mutex_enter(pInode->pLockMutex); for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext)); pUnused = *pp; if( pUnused ){ *pp = pUnused->pNext; } sqlite3_mutex_leave(pInode->pLockMutex); } } unixLeaveMutex(); #endif /* if !OS_VXWORKS */ return pUnused; } |
︙ | ︙ | |||
49967 49968 49969 49970 49971 49972 49973 49974 49975 49976 49977 49978 49979 49980 | */ SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal); #ifdef SQLITE_ENABLE_SNAPSHOT SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot); SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal); #endif #ifdef SQLITE_ENABLE_ZIPVFS /* If the WAL file is not empty, return the number of bytes of content ** stored in each frame (i.e. the db page-size when the WAL was created). */ SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal); | > > | 50009 50010 50011 50012 50013 50014 50015 50016 50017 50018 50019 50020 50021 50022 50023 50024 | */ SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal); #ifdef SQLITE_ENABLE_SNAPSHOT SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **ppSnapshot); SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE int sqlite3WalSnapshotRecover(Wal *pWal); SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot); SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal); #endif #ifdef SQLITE_ENABLE_ZIPVFS /* If the WAL file is not empty, return the number of bytes of content ** stored in each frame (i.e. the db page-size when the WAL was created). */ SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal); |
︙ | ︙ | |||
57616 57617 57618 57619 57620 57621 57622 57623 57624 57625 57626 57627 57628 57629 | if( pPager->pWal ){ rc = sqlite3WalSnapshotRecover(pPager->pWal); }else{ rc = SQLITE_ERROR; } return rc; } #endif /* SQLITE_ENABLE_SNAPSHOT */ #endif /* !SQLITE_OMIT_WAL */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** A read-lock must be held on the pager when this function is called. If ** the pager is in WAL mode and the WAL file currently contains one or more | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 57660 57661 57662 57663 57664 57665 57666 57667 57668 57669 57670 57671 57672 57673 57674 57675 57676 57677 57678 57679 57680 57681 57682 57683 57684 57685 57686 57687 57688 57689 57690 57691 57692 57693 57694 57695 57696 57697 57698 57699 57700 57701 57702 57703 57704 57705 | if( pPager->pWal ){ rc = sqlite3WalSnapshotRecover(pPager->pWal); }else{ rc = SQLITE_ERROR; } return rc; } /* ** The caller currently has a read transaction open on the database. ** If this is not a WAL database, SQLITE_ERROR is returned. Otherwise, ** this function takes a SHARED lock on the CHECKPOINTER slot and then ** checks if the snapshot passed as the second argument is still ** available. If so, SQLITE_OK is returned. ** ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ SQLITE_PRIVATE int sqlite3PagerSnapshotCheck(Pager *pPager, sqlite3_snapshot *pSnapshot){ int rc; if( pPager->pWal ){ rc = sqlite3WalSnapshotCheck(pPager->pWal, pSnapshot); }else{ rc = SQLITE_ERROR; } return rc; } /* ** Release a lock obtained by an earlier successful call to ** sqlite3PagerSnapshotCheck(). */ SQLITE_PRIVATE void sqlite3PagerSnapshotUnlock(Pager *pPager){ assert( pPager->pWal ); return sqlite3WalSnapshotUnlock(pPager->pWal); } #endif /* SQLITE_ENABLE_SNAPSHOT */ #endif /* !SQLITE_OMIT_WAL */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** A read-lock must be held on the pager when this function is called. If ** the pager is in WAL mode and the WAL file currently contains one or more |
︙ | ︙ | |||
59474 59475 59476 59477 59478 59479 59480 | rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter); assert( rc==SQLITE_OK || pIter==0 ); } if( pIter && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK ){ | < > | 59550 59551 59552 59553 59554 59555 59556 59557 59558 59559 59560 59561 59562 59563 59564 59565 59566 59567 59568 59569 59570 59571 59572 59573 59574 59575 59576 | rc = walIteratorInit(pWal, pInfo->nBackfill, &pIter); assert( rc==SQLITE_OK || pIter==0 ); } if( pIter && (rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(0),1))==SQLITE_OK ){ u32 nBackfill = pInfo->nBackfill; pInfo->nBackfillAttempted = mxSafeFrame; /* Sync the WAL to disk */ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags)); /* If the database may grow as a result of this checkpoint, hint ** about the eventual size of the db file to the VFS layer. */ if( rc==SQLITE_OK ){ i64 nReq = ((i64)mxPage * szPage); i64 nSize; /* Current size of database file */ rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); if( rc==SQLITE_OK && nSize<nReq ){ sqlite3OsFileControlHint(pWal->pDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); } } |
︙ | ︙ | |||
61408 61409 61410 61411 61412 61413 61414 61415 61416 61417 61418 61419 61420 61421 | ** is incremented each time the wal file is restarted. */ if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1; if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1; if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1; if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1; return 0; } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** If the argument is not NULL, it points to a Wal object that holds a ** read-lock. This function returns the database page-size if it is known, ** or zero if it is not (or if pWal is NULL). | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 61484 61485 61486 61487 61488 61489 61490 61491 61492 61493 61494 61495 61496 61497 61498 61499 61500 61501 61502 61503 61504 61505 61506 61507 61508 61509 61510 61511 61512 61513 61514 61515 61516 61517 61518 61519 61520 61521 61522 61523 61524 61525 61526 61527 61528 61529 61530 61531 61532 61533 61534 | ** is incremented each time the wal file is restarted. */ if( pHdr1->aSalt[0]<pHdr2->aSalt[0] ) return -1; if( pHdr1->aSalt[0]>pHdr2->aSalt[0] ) return +1; if( pHdr1->mxFrame<pHdr2->mxFrame ) return -1; if( pHdr1->mxFrame>pHdr2->mxFrame ) return +1; return 0; } /* ** The caller currently has a read transaction open on the database. ** This function takes a SHARED lock on the CHECKPOINTER slot and then ** checks if the snapshot passed as the second argument is still ** available. If so, SQLITE_OK is returned. ** ** If the snapshot is not available, SQLITE_ERROR is returned. Or, if ** the CHECKPOINTER lock cannot be obtained, SQLITE_BUSY. If any error ** occurs (any value other than SQLITE_OK is returned), the CHECKPOINTER ** lock is released before returning. */ SQLITE_PRIVATE int sqlite3WalSnapshotCheck(Wal *pWal, sqlite3_snapshot *pSnapshot){ int rc; rc = walLockShared(pWal, WAL_CKPT_LOCK); if( rc==SQLITE_OK ){ WalIndexHdr *pNew = (WalIndexHdr*)pSnapshot; if( memcmp(pNew->aSalt, pWal->hdr.aSalt, sizeof(pWal->hdr.aSalt)) || pNew->mxFrame<walCkptInfo(pWal)->nBackfillAttempted ){ rc = SQLITE_BUSY_SNAPSHOT; walUnlockShared(pWal, WAL_CKPT_LOCK); } } return rc; } /* ** Release a lock obtained by an earlier successful call to ** sqlite3WalSnapshotCheck(). */ SQLITE_PRIVATE void sqlite3WalSnapshotUnlock(Wal *pWal){ assert( pWal ); walUnlockShared(pWal, WAL_CKPT_LOCK); } #endif /* SQLITE_ENABLE_SNAPSHOT */ #ifdef SQLITE_ENABLE_ZIPVFS /* ** If the argument is not NULL, it points to a Wal object that holds a ** read-lock. This function returns the database page-size if it is known, ** or zero if it is not (or if pWal is NULL). |
︙ | ︙ | |||
74391 74392 74393 74394 74395 74396 74397 | /* pMem is the register that is changing. But also mark pX as ** undefined so that we can quickly detect the shallow-copy error */ pX->flags = MEM_Undefined; pX->pScopyFrom = 0; } } pMem->pScopyFrom = 0; | < < < < < < < < < | 74504 74505 74506 74507 74508 74509 74510 74511 74512 74513 74514 74515 74516 74517 74518 74519 74520 74521 74522 74523 74524 74525 74526 74527 74528 74529 74530 74531 74532 74533 74534 74535 74536 74537 74538 74539 74540 74541 74542 74543 74544 74545 74546 74547 74548 74549 74550 74551 74552 74553 74554 | /* pMem is the register that is changing. But also mark pX as ** undefined so that we can quickly detect the shallow-copy error */ pX->flags = MEM_Undefined; pX->pScopyFrom = 0; } } pMem->pScopyFrom = 0; } #endif /* SQLITE_DEBUG */ /* ** Make an shallow copy of pFrom into pTo. Prior contents of ** pTo are freed. The pFrom->z field is not duplicated. If ** pFrom->z is used, then pTo->z points to the same thing as pFrom->z ** and flags gets srcType (either MEM_Ephem or MEM_Static). */ static SQLITE_NOINLINE void vdbeClrCopy(Mem *pTo, const Mem *pFrom, int eType){ vdbeMemClearExternAndSetNull(pTo); assert( !VdbeMemDynamic(pTo) ); sqlite3VdbeMemShallowCopy(pTo, pFrom, eType); } SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){ assert( (pFrom->flags & MEM_RowSet)==0 ); assert( pTo->db==pFrom->db ); if( VdbeMemDynamic(pTo) ){ vdbeClrCopy(pTo,pFrom,srcType); return; } memcpy(pTo, pFrom, MEMCELLSIZE); if( (pFrom->flags&MEM_Static)==0 ){ pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem); assert( srcType==MEM_Ephem || srcType==MEM_Static ); pTo->flags |= srcType; } } /* ** Make a full copy of pFrom into pTo. Prior contents of pTo are ** freed before the copy is made. */ SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ int rc = SQLITE_OK; assert( (pFrom->flags & MEM_RowSet)==0 ); if( VdbeMemDynamic(pTo) ) vdbeMemClearExternAndSetNull(pTo); memcpy(pTo, pFrom, MEMCELLSIZE); pTo->flags &= ~MEM_Dyn; if( pTo->flags&(MEM_Str|MEM_Blob) ){ if( 0==(pFrom->flags&MEM_Static) ){ pTo->flags |= MEM_Ephem; rc = sqlite3VdbeMemMakeWriteable(pTo); } } |
︙ | ︙ | |||
75545 75546 75547 75548 75549 75550 75551 | pOp->p4.p = 0; pOp->p4type = P4_NOTUSED; #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS pOp->zComment = 0; #endif #ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ | < < < < < < < < | 75649 75650 75651 75652 75653 75654 75655 75656 75657 75658 75659 75660 75661 75662 | pOp->p4.p = 0; pOp->p4type = P4_NOTUSED; #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS pOp->zComment = 0; #endif #ifdef SQLITE_DEBUG if( p->db->flags & SQLITE_VdbeAddopTrace ){ sqlite3VdbePrintOp(0, i, &p->aOp[i]); test_addop_breakpoint(); } #endif #ifdef VDBE_PROFILE pOp->cycles = 0; pOp->cnt = 0; |
︙ | ︙ | |||
75797 75798 75799 75800 75801 75802 75803 | } #endif assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */ p->aLabel[j] = v->nOp; } } | < < < < < < < < < < < < < | 75893 75894 75895 75896 75897 75898 75899 75900 75901 75902 75903 75904 75905 75906 | } #endif assert( p->aLabel[j]==(-1) ); /* Labels may only be resolved once */ p->aLabel[j] = v->nOp; } } /* ** Mark the VDBE as one that can only be run one time. */ SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){ p->runOnlyOnce = 1; } |
︙ | ︙ | |||
76999 77000 77001 77002 77003 77004 77005 | while( (N--)>0 ){ p->db = db; p->flags = flags; p->szMalloc = 0; #ifdef SQLITE_DEBUG p->pScopyFrom = 0; #endif | < < < | 77082 77083 77084 77085 77086 77087 77088 77089 77090 77091 77092 77093 77094 77095 | while( (N--)>0 ){ p->db = db; p->flags = flags; p->szMalloc = 0; #ifdef SQLITE_DEBUG p->pScopyFrom = 0; #endif p++; } } /* ** Release an array of N Mem elements */ |
︙ | ︙ | |||
81185 81186 81187 81188 81189 81190 81191 | /* .uTemp = */ (u32)0, /* .db = */ (sqlite3*)0, /* .xDel = */ (void(*)(void*))0, #ifdef SQLITE_DEBUG /* .pScopyFrom = */ (Mem*)0, /* .mScopyFlags= */ 0, #endif | < < < | 81265 81266 81267 81268 81269 81270 81271 81272 81273 81274 81275 81276 81277 81278 | /* .uTemp = */ (u32)0, /* .db = */ (sqlite3*)0, /* .xDel = */ (void(*)(void*))0, #ifdef SQLITE_DEBUG /* .pScopyFrom = */ (Mem*)0, /* .mScopyFlags= */ 0, #endif }; return &nullMem; } /* ** Check to see if column iCol of the given statement is valid. If ** it is, return a pointer to the Mem for the value of that column. |
︙ | ︙ | |||
82410 82411 82412 82413 82414 82415 82416 | */ #ifdef SQLITE_DEBUG # define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M) #else # define memAboutToChange(P,M) #endif | < < < < < < < < < < < < | 82487 82488 82489 82490 82491 82492 82493 82494 82495 82496 82497 82498 82499 82500 | */ #ifdef SQLITE_DEBUG # define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M) #else # define memAboutToChange(P,M) #endif /* ** 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 ** help verify the correct operation of the library. */ |
︙ | ︙ | |||
83771 83772 83773 83774 83775 83776 83777 | assert( pOut!=pIn1 ); while( 1 ){ memAboutToChange(p, pOut); sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); Deephemeralize(pOut); #ifdef SQLITE_DEBUG pOut->pScopyFrom = 0; | < | 83836 83837 83838 83839 83840 83841 83842 83843 83844 83845 83846 83847 83848 83849 | assert( pOut!=pIn1 ); while( 1 ){ memAboutToChange(p, pOut); sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); Deephemeralize(pOut); #ifdef SQLITE_DEBUG pOut->pScopyFrom = 0; #endif REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut); if( (n--)==0 ) break; pOut++; pIn1++; } break; |
︙ | ︙ | |||
84435 84436 84437 84438 84439 84440 84441 | }else{ /* Neither operand is NULL. Do a comparison. */ affinity = pOp->p5 & SQLITE_AFF_MASK; if( affinity>=SQLITE_AFF_NUMERIC ){ if( (flags1 | flags3)&MEM_Str ){ if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn1,0); | > | > > > > | 84499 84500 84501 84502 84503 84504 84505 84506 84507 84508 84509 84510 84511 84512 84513 84514 84515 84516 84517 84518 | }else{ /* Neither operand is NULL. Do a comparison. */ affinity = pOp->p5 & SQLITE_AFF_MASK; if( affinity>=SQLITE_AFF_NUMERIC ){ if( (flags1 | flags3)&MEM_Str ){ if( (flags1 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn1,0); assert( flags3==pIn3->flags ); /* testcase( flags3!=pIn3->flags ); ** this used to be possible with pIn1==pIn3, but not since ** the column cache was removed. The following assignment ** is essentially a no-op. But, it provides defense-in-depth ** in case our analysis is incorrect, so it is left in. */ flags3 = pIn3->flags; } if( (flags3 & (MEM_Int|MEM_Real|MEM_Str))==MEM_Str ){ applyNumericAffinity(pIn3,0); } } /* Handle the common case of integer comparison here, as an |
︙ | ︙ | |||
86355 86356 86357 86358 86359 86360 86361 | ** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this ** opcode must be followed by an IdxGE opcode with the same arguments. ** The IdxGE opcode will be skipped if this opcode succeeds, but the ** IdxGE opcode will be used on subsequent loop iterations. ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ | | | | | | 86424 86425 86426 86427 86428 86429 86430 86431 86432 86433 86434 86435 86436 86437 86438 86439 86440 86441 | ** else jump immediately to P2. When the cursor is OPFLAG_SEEKEQ, this ** opcode must be followed by an IdxGE opcode with the same arguments. ** The IdxGE opcode will be skipped if this opcode succeeds, but the ** IdxGE opcode will be used on subsequent loop iterations. ** ** See also: Found, NotFound, SeekGt, SeekGe, SeekLt */ case OP_SeekLT: /* jump, in3, group */ case OP_SeekLE: /* jump, in3, group */ case OP_SeekGE: /* jump, in3, group */ case OP_SeekGT: { /* jump, in3, group */ int res; /* Comparison result */ int oc; /* Opcode */ VdbeCursor *pC; /* The cursor to seek */ UnpackedRecord r; /* The key to seek for */ int nField; /* Number of columns or fields in the key */ i64 iKey; /* The rowid we are to seek to */ int eqOnly; /* Only interested in == results */ |
︙ | ︙ | |||
86786 86787 86788 86789 86790 86791 86792 86793 | VdbeCursor *pC; BtCursor *pCrsr; int res; u64 iKey; pIn3 = &aMem[pOp->p3]; if( (pIn3->flags & MEM_Int)==0 ){ applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); | > > > > > > | > > | | 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 | VdbeCursor *pC; BtCursor *pCrsr; int res; u64 iKey; pIn3 = &aMem[pOp->p3]; if( (pIn3->flags & MEM_Int)==0 ){ /* Make sure pIn3->u.i contains a valid integer representation of ** the key value, but do not change the datatype of the register, as ** other parts of the perpared statement might be depending on the ** current datatype. */ u16 origFlags = pIn3->flags; int isNotInt; applyAffinity(pIn3, SQLITE_AFF_NUMERIC, encoding); isNotInt = (pIn3->flags & MEM_Int)==0; pIn3->flags = origFlags; if( isNotInt ) goto jump_to_p2; } /* Fall through into OP_NotExists */ case OP_NotExists: /* jump, in3 */ pIn3 = &aMem[pOp->p3]; assert( (pIn3->flags & MEM_Int)!=0 || pOp->opcode==OP_SeekRowid ); assert( pOp->p1>=0 && pOp->p1<p->nCursor ); pC = p->apCsr[pOp->p1]; assert( pC!=0 ); #ifdef SQLITE_DEBUG pC->seekOp = OP_SeekRowid; #endif assert( pC->isTable ); |
︙ | ︙ | |||
87992 87993 87994 87995 87996 87997 87998 | r.default_rc = -1; }else{ assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT ); r.default_rc = 0; } r.aMem = &aMem[pOp->p3]; #ifdef SQLITE_DEBUG | > > > | > > > | 88069 88070 88071 88072 88073 88074 88075 88076 88077 88078 88079 88080 88081 88082 88083 88084 88085 88086 88087 88088 88089 | r.default_rc = -1; }else{ assert( pOp->opcode==OP_IdxGE || pOp->opcode==OP_IdxLT ); r.default_rc = 0; } r.aMem = &aMem[pOp->p3]; #ifdef SQLITE_DEBUG { int i; for(i=0; i<r.nField; i++){ assert( memIsValid(&r.aMem[i]) ); REGISTER_TRACE(pOp->p3+i, &aMem[pOp->p3+i]); } } #endif res = 0; /* Not needed. Only used to silence a warning. */ rc = sqlite3VdbeIdxKeyCompare(db, pC, &r, &res); assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) ); if( (pOp->opcode&1)==(OP_IdxLT&1) ){ assert( pOp->opcode==OP_IdxLE || pOp->opcode==OP_IdxLT ); res = -res; |
︙ | ︙ | |||
89682 89683 89684 89685 89686 89687 89688 | ** automatically converted into an sqlite3_context object and the operation ** changed to this OP_Function opcode. In this way, the initialization of ** the sqlite3_context object occurs only once, rather than once for each ** evaluation of the function. ** ** See also: Function0, AggStep, AggFinal */ | | | | 89765 89766 89767 89768 89769 89770 89771 89772 89773 89774 89775 89776 89777 89778 89779 89780 | ** automatically converted into an sqlite3_context object and the operation ** changed to this OP_Function opcode. In this way, the initialization of ** the sqlite3_context object occurs only once, rather than once for each ** evaluation of the function. ** ** See also: Function0, AggStep, AggFinal */ case OP_PureFunc0: /* group */ case OP_Function0: { /* group */ int n; sqlite3_context *pCtx; assert( pOp->p4type==P4_FUNCDEF ); n = pOp->p5; assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) ); assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) ); |
︙ | ︙ | |||
89707 89708 89709 89710 89711 89712 89713 | pOp->p4type = P4_FUNCCTX; pOp->p4.pCtx = pCtx; assert( OP_PureFunc == OP_PureFunc0+2 ); assert( OP_Function == OP_Function0+2 ); pOp->opcode += 2; /* Fall through into OP_Function */ } | | | | 89790 89791 89792 89793 89794 89795 89796 89797 89798 89799 89800 89801 89802 89803 89804 89805 | pOp->p4type = P4_FUNCCTX; pOp->p4.pCtx = pCtx; assert( OP_PureFunc == OP_PureFunc0+2 ); assert( OP_Function == OP_Function0+2 ); pOp->opcode += 2; /* Fall through into OP_Function */ } case OP_PureFunc: /* group */ case OP_Function: { /* group */ int i; sqlite3_context *pCtx; assert( pOp->p4type==P4_FUNCCTX ); pCtx = pOp->p4.pCtx; /* If this function is inside of a trigger, the register array in aMem[] |
︙ | ︙ | |||
89893 89894 89895 89896 89897 89898 89899 | ** An Abort is safe if either there have been no writes, or if there is ** an active statement journal. */ case OP_Abortable: { sqlite3VdbeAssertAbortable(p); break; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 89976 89977 89978 89979 89980 89981 89982 89983 89984 89985 89986 89987 89988 89989 | ** An Abort is safe if either there have been no writes, or if there is ** an active statement journal. */ case OP_Abortable: { sqlite3VdbeAssertAbortable(p); break; } #endif /* Opcode: Noop * * * * * ** ** Do nothing. This instruction is often useful as a jump ** destination. */ |
︙ | ︙ | |||
95710 95711 95712 95713 95714 95715 95716 | SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ sqlite3 *db = pParse->db; CollSeq *pColl = 0; Expr *p = pExpr; while( p ){ int op = p->op; if( p->flags & EP_Generic ) break; | < < < < < < < < > > > > > > > > | 95765 95766 95767 95768 95769 95770 95771 95772 95773 95774 95775 95776 95777 95778 95779 95780 95781 95782 95783 95784 95785 95786 95787 95788 95789 95790 95791 95792 95793 95794 95795 95796 95797 95798 | SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ sqlite3 *db = pParse->db; CollSeq *pColl = 0; Expr *p = pExpr; while( p ){ int op = p->op; if( p->flags & EP_Generic ) break; if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER || op==TK_TRIGGER) && p->pTab!=0 ){ /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally ** a TK_COLUMN but was previously evaluated and cached in a register */ int j = p->iColumn; if( j>=0 ){ const char *zColl = p->pTab->aCol[j].zColl; pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); } break; } if( op==TK_CAST || op==TK_UPLUS ){ p = p->pLeft; continue; } if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){ pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); break; } if( p->flags & EP_Collate ){ if( p->pLeft && (p->pLeft->flags & EP_Collate)!=0 ){ p = p->pLeft; }else{ Expr *pNext = p->pRight; /* The Expr.x union is never used at the same time as Expr.pRight */ |
︙ | ︙ | |||
96150 96151 96152 96153 96154 96155 96156 | regRight = exprCodeSubselect(pParse, pRight); for(i=0; 1 /*Loop exits by "break"*/; i++){ int regFree1 = 0, regFree2 = 0; Expr *pL, *pR; int r1, r2; assert( i>=0 && i<nLeft ); | < < | 96205 96206 96207 96208 96209 96210 96211 96212 96213 96214 96215 96216 96217 96218 96219 96220 96221 96222 96223 96224 96225 96226 96227 96228 96229 | regRight = exprCodeSubselect(pParse, pRight); for(i=0; 1 /*Loop exits by "break"*/; i++){ int regFree1 = 0, regFree2 = 0; Expr *pL, *pR; int r1, r2; assert( i>=0 && i<nLeft ); r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, ®Free1); r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, ®Free2); codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); sqlite3ReleaseTempReg(pParse, regFree1); sqlite3ReleaseTempReg(pParse, regFree2); if( i==nLeft-1 ){ break; } if( opx==TK_EQ ){ sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v); p5 |= SQLITE_KEEPNULL; }else if( opx==TK_NE ){ |
︙ | ︙ | |||
96510 96511 96512 96513 96514 96515 96516 | } } /* ** Construct a new expression node for a function with multiple ** arguments. */ | | > > > > > > > > > | 96563 96564 96565 96566 96567 96568 96569 96570 96571 96572 96573 96574 96575 96576 96577 96578 96579 96580 96581 96582 96583 96584 96585 96586 96587 96588 96589 96590 96591 96592 96593 96594 96595 96596 96597 96598 | } } /* ** Construct a new expression node for a function with multiple ** arguments. */ SQLITE_PRIVATE Expr *sqlite3ExprFunction( Parse *pParse, /* Parsing context */ ExprList *pList, /* Argument list */ Token *pToken, /* Name of the function */ int eDistinct /* SF_Distinct or SF_ALL or 0 */ ){ Expr *pNew; sqlite3 *db = pParse->db; assert( pToken ); pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1); if( pNew==0 ){ sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ return 0; } if( pList && pList->nExpr > pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ sqlite3ErrorMsg(pParse, "too many arguments on function %T", pToken); } pNew->x.pList = pList; ExprSetProperty(pNew, EP_HasFunc); assert( !ExprHasProperty(pNew, EP_xIsSelect) ); sqlite3ExprSetHeightAndFlags(pParse, pNew); if( eDistinct==SF_Distinct ) ExprSetProperty(pNew, EP_Distinct); return pNew; } /* ** Assign a variable number to an expression that encodes a wildcard ** in the original SQL statement. ** |
︙ | ︙ | |||
97408 97409 97410 97411 97412 97413 97414 97415 97416 97417 97418 97419 97420 97421 | case TK_COLUMN: case TK_AGG_FUNCTION: case TK_AGG_COLUMN: testcase( pExpr->op==TK_ID ); testcase( pExpr->op==TK_COLUMN ); testcase( pExpr->op==TK_AGG_FUNCTION ); testcase( pExpr->op==TK_AGG_COLUMN ); if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){ return WRC_Continue; } /* Fall through */ case TK_IF_NULL_ROW: case TK_REGISTER: testcase( pExpr->op==TK_REGISTER ); | > > > | 97470 97471 97472 97473 97474 97475 97476 97477 97478 97479 97480 97481 97482 97483 97484 97485 97486 | case TK_COLUMN: case TK_AGG_FUNCTION: case TK_AGG_COLUMN: testcase( pExpr->op==TK_ID ); testcase( pExpr->op==TK_COLUMN ); testcase( pExpr->op==TK_AGG_FUNCTION ); testcase( pExpr->op==TK_AGG_COLUMN ); if( ExprHasProperty(pExpr, EP_FixedCol) && pWalker->eCode!=2 ){ return WRC_Continue; } if( pWalker->eCode==3 && pExpr->iTable==pWalker->u.iCur ){ return WRC_Continue; } /* Fall through */ case TK_IF_NULL_ROW: case TK_REGISTER: testcase( pExpr->op==TK_REGISTER ); |
︙ | ︙ | |||
97463 97464 97465 97466 97467 97468 97469 | ** a constant. */ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ return exprIsConst(p, 1, 0); } /* | | | | | > > > > > > > | 97528 97529 97530 97531 97532 97533 97534 97535 97536 97537 97538 97539 97540 97541 97542 97543 97544 97545 97546 97547 97548 97549 97550 97551 97552 | ** a constant. */ SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ return exprIsConst(p, 1, 0); } /* ** Walk an expression tree. Return non-zero if ** ** (1) the expression is constant, and ** (2) the expression does originate in the ON or USING clause ** of a LEFT JOIN, and ** (3) the expression does not contain any EP_FixedCol TK_COLUMN ** operands created by the constant propagation optimization. ** ** When this routine returns true, it indicates that the expression ** can be added to the pParse->pConstExpr list and evaluated once when ** the prepared statement starts up. See sqlite3ExprCodeAtInit(). */ SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ return exprIsConst(p, 2, 0); } /* ** Walk an expression tree. Return non-zero if the expression is constant |
︙ | ︙ | |||
97496 97497 97498 97499 97500 97501 97502 | /* Check if pExpr is identical to any GROUP BY term. If so, consider ** it constant. */ for(i=0; i<pGroupBy->nExpr; i++){ Expr *p = pGroupBy->a[i].pExpr; if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){ CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p); | | | 97568 97569 97570 97571 97572 97573 97574 97575 97576 97577 97578 97579 97580 97581 97582 | /* Check if pExpr is identical to any GROUP BY term. If so, consider ** it constant. */ for(i=0; i<pGroupBy->nExpr; i++){ Expr *p = pGroupBy->a[i].pExpr; if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){ CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p); if( sqlite3IsBinary(pColl) ){ return WRC_Prune; } } } /* Check if pExpr is a sub-select. If so, consider it variable. */ if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
︙ | ︙ | |||
97918 97919 97920 97921 97922 97923 97924 | if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){ /* The "x IN (SELECT rowid FROM table)" case */ int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); eType = IN_INDEX_ROWID; | | > | 97990 97991 97992 97993 97994 97995 97996 97997 97998 97999 98000 98001 98002 98003 98004 98005 | if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){ /* The "x IN (SELECT rowid FROM table)" case */ int iAddr = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); eType = IN_INDEX_ROWID; ExplainQueryPlan((pParse, 0, "USING ROWID SEARCH ON TABLE %s FOR IN-OPERATOR",pTab->zName)); sqlite3VdbeJumpHere(v, iAddr); }else{ Index *pIdx; /* Iterator variable */ int affinity_ok = 1; int i; /* Check that the affinity that will be used to perform each |
︙ | ︙ | |||
98177 98178 98179 98180 98181 98182 98183 | int rHasNullFlag, /* Register that records whether NULLs exist in RHS */ int isRowid /* If true, LHS of IN operator is a rowid */ ){ int jmpIfDynamic = -1; /* One-time test address */ int rReg = 0; /* Register storing resulting */ Vdbe *v = sqlite3GetVdbe(pParse); if( NEVER(v==0) ) return 0; | < | 98250 98251 98252 98253 98254 98255 98256 98257 98258 98259 98260 98261 98262 98263 | int rHasNullFlag, /* Register that records whether NULLs exist in RHS */ int isRowid /* If true, LHS of IN operator is a rowid */ ){ int jmpIfDynamic = -1; /* One-time test address */ int rReg = 0; /* Register storing resulting */ Vdbe *v = sqlite3GetVdbe(pParse); if( NEVER(v==0) ) return 0; /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it ** is encountered if any of the following is true: ** ** * The right-hand side is a correlated subquery ** * The right-hand side is an expression list containing variables ** * We are inside a trigger |
︙ | ︙ | |||
98313 98314 98315 98316 98317 98318 98319 | if( isRowid ){ sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, sqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3); }else{ sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); | < | 98385 98386 98387 98388 98389 98390 98391 98392 98393 98394 98395 98396 98397 98398 | if( isRowid ){ sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, sqlite3VdbeCurrentAddr(v)+2); VdbeCoverage(v); sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3); }else{ sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pExpr->iTable, r2, r3, 1); } } } sqlite3ReleaseTempReg(pParse, r1); sqlite3ReleaseTempReg(pParse, r2); } |
︙ | ︙ | |||
98394 98395 98396 98397 98398 98399 98400 | if( rHasNullFlag ){ sqlite3SetHasNullFlag(v, pExpr->iTable, rHasNullFlag); } if( jmpIfDynamic>=0 ){ sqlite3VdbeJumpHere(v, jmpIfDynamic); } | < | 98465 98466 98467 98468 98469 98470 98471 98472 98473 98474 98475 98476 98477 98478 | if( rHasNullFlag ){ sqlite3SetHasNullFlag(v, pExpr->iTable, rHasNullFlag); } if( jmpIfDynamic>=0 ){ sqlite3VdbeJumpHere(v, jmpIfDynamic); } return rReg; } #endif /* SQLITE_OMIT_SUBQUERY */ #ifndef SQLITE_OMIT_SUBQUERY /* |
︙ | ︙ | |||
98513 98514 98515 98516 98517 98518 98519 | ** at r1. ** ** sqlite3FindInIndex() might have reordered the fields of the LHS vector ** so that the fields are in the same order as an existing index. The ** aiMap[] array contains a mapping from the original LHS field order to ** the field order that matches the RHS index. */ | < | 98583 98584 98585 98586 98587 98588 98589 98590 98591 98592 98593 98594 98595 98596 | ** at r1. ** ** sqlite3FindInIndex() might have reordered the fields of the LHS vector ** so that the fields are in the same order as an existing index. The ** aiMap[] array contains a mapping from the original LHS field order to ** the field order that matches the RHS index. */ rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy); for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */ if( i==nVector ){ /* LHS fields are not reordered */ rLhs = rLhsOrig; }else{ /* Need to reorder the LHS fields according to aiMap */ |
︙ | ︙ | |||
98672 98673 98674 98675 98676 98677 98678 | } /* Jumps here in order to return true. */ sqlite3VdbeJumpHere(v, addrTruthOp); sqlite3ExprCodeIN_finished: if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs); | < | 98741 98742 98743 98744 98745 98746 98747 98748 98749 98750 98751 98752 98753 98754 | } /* Jumps here in order to return true. */ sqlite3VdbeJumpHere(v, addrTruthOp); sqlite3ExprCodeIN_finished: if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs); VdbeComment((v, "end IN expr")); sqlite3ExprCodeIN_oom_error: sqlite3DbFree(pParse->db, aiMap); sqlite3DbFree(pParse->db, zAff); } #endif /* SQLITE_OMIT_SUBQUERY */ |
︙ | ︙ | |||
98740 98741 98742 98743 98744 98745 98746 | }else{ if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; } sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64); } } } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 98808 98809 98810 98811 98812 98813 98814 98815 98816 98817 98818 98819 98820 98821 | }else{ if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; } sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64); } } } /* Generate code that will load into register regOut a value that is ** appropriate for the iIdxCol-th column of index pIdx. */ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn( Parse *pParse, /* The parsing context */ Index *pIdx, /* The index whose column is to be loaded */ |
︙ | ︙ | |||
98941 98942 98943 98944 98945 98946 98947 | if( iCol>=0 ){ sqlite3ColumnDefault(v, pTab, iCol, regOut); } } /* ** Generate code that will extract the iColumn-th column from | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < < < < < | 98863 98864 98865 98866 98867 98868 98869 98870 98871 98872 98873 98874 98875 98876 98877 98878 98879 98880 98881 98882 98883 98884 98885 98886 98887 98888 98889 98890 98891 98892 98893 98894 98895 98896 98897 98898 98899 98900 98901 98902 98903 98904 98905 98906 | if( iCol>=0 ){ sqlite3ColumnDefault(v, pTab, iCol, regOut); } } /* ** Generate code that will extract the iColumn-th column from ** table pTab and store the column value in register iReg. ** ** There must be an open cursor to pTab in iTable when this routine ** is called. If iColumn<0 then code is generated that extracts the rowid. */ SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( Parse *pParse, /* Parsing and code generating context */ Table *pTab, /* Description of the table we are reading from */ int iColumn, /* Index of the table column */ int iTable, /* The cursor pointing to the table */ int iReg, /* Store results here */ u8 p5 /* P5 value for OP_Column + FLAGS */ ){ Vdbe *v = pParse->pVdbe; assert( v!=0 ); sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); if( p5 ){ sqlite3VdbeChangeP5(v, p5); } return iReg; } /* ** Generate code to move content from registers iFrom...iFrom+nReg-1 ** over to iTo..iTo+nReg-1. */ SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){ assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo ); sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg); } /* ** Convert a scalar expression node to a TK_REGISTER referencing ** register iReg. The caller must ensure that iReg already contains ** the correct value for the expression. */ static void exprToRegister(Expr *p, int iReg){ |
︙ | ︙ | |||
99150 99151 99152 99153 99154 99155 99156 99157 99158 99159 99160 99161 99162 99163 | pCol->iSorterColumn, target); return target; } /* Otherwise, fall thru into the TK_COLUMN case */ } case TK_COLUMN: { int iTab = pExpr->iTable; if( iTab<0 ){ if( pParse->iSelfTab<0 ){ /* Generating CHECK constraints or inserting into partial index */ return pExpr->iColumn - pParse->iSelfTab; }else{ /* Coding an expression that is part of an index where column names ** in the index refer to the table to which the index belongs */ | > > > > > > > > > > > > > > > > > > > > > > | 98991 98992 98993 98994 98995 98996 98997 98998 98999 99000 99001 99002 99003 99004 99005 99006 99007 99008 99009 99010 99011 99012 99013 99014 99015 99016 99017 99018 99019 99020 99021 99022 99023 99024 99025 99026 | pCol->iSorterColumn, target); return target; } /* Otherwise, fall thru into the TK_COLUMN case */ } case TK_COLUMN: { int iTab = pExpr->iTable; if( ExprHasProperty(pExpr, EP_FixedCol) ){ /* This COLUMN expression is really a constant due to WHERE clause ** constraints, and that constant is coded by the pExpr->pLeft ** expresssion. However, make sure the constant has the correct ** datatype by applying the Affinity of the table column to the ** constant. */ int iReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft,target); int aff = sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn); if( aff!=SQLITE_AFF_BLOB ){ static const char zAff[] = "B\000C\000D\000E"; assert( SQLITE_AFF_BLOB=='A' ); assert( SQLITE_AFF_TEXT=='B' ); if( iReg!=target ){ sqlite3VdbeAddOp2(v, OP_SCopy, iReg, target); iReg = target; } sqlite3VdbeAddOp4(v, OP_Affinity, iReg, 1, 0, &zAff[(aff-'B')*2], P4_STATIC); } return iReg; } if( iTab<0 ){ if( pParse->iSelfTab<0 ){ /* Generating CHECK constraints or inserting into partial index */ return pExpr->iColumn - pParse->iSelfTab; }else{ /* Coding an expression that is part of an index where column names ** in the index refer to the table to which the index belongs */ |
︙ | ︙ | |||
99230 99231 99232 99233 99234 99235 99236 | inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); if( inReg!=target ){ sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); inReg = target; } sqlite3VdbeAddOp2(v, OP_Cast, target, sqlite3AffinityType(pExpr->u.zToken, 0)); | < < | 99093 99094 99095 99096 99097 99098 99099 99100 99101 99102 99103 99104 99105 99106 | inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); if( inReg!=target ){ sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); inReg = target; } sqlite3VdbeAddOp2(v, OP_Cast, target, sqlite3AffinityType(pExpr->u.zToken, 0)); return inReg; } #endif /* SQLITE_OMIT_CAST */ case TK_IS: case TK_ISNOT: op = (op==TK_IS) ? TK_EQ : TK_NE; p5 = SQLITE_NULLEQ; |
︙ | ︙ | |||
99417 99418 99419 99420 99421 99422 99423 | if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){ int endCoalesce = sqlite3VdbeMakeLabel(v); assert( nFarg>=2 ); sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); for(i=1; i<nFarg; i++){ sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce); VdbeCoverage(v); | < < < | 99278 99279 99280 99281 99282 99283 99284 99285 99286 99287 99288 99289 99290 99291 99292 | if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){ int endCoalesce = sqlite3VdbeMakeLabel(v); assert( nFarg>=2 ); sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); for(i=1; i<nFarg; i++){ sqlite3VdbeAddOp2(v, OP_NotNull, target, endCoalesce); VdbeCoverage(v); sqlite3ExprCode(pParse, pFarg->a[i].pExpr, target); } sqlite3VdbeResolveLabel(v, endCoalesce); break; } /* The UNLIKELY() function is a no-op. The result is the value ** of the first argument. |
︙ | ︙ | |||
99486 99487 99488 99489 99490 99491 99492 | assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG ); testcase( pDef->funcFlags & OPFLAG_LENGTHARG ); pFarg->a[0].pExpr->op2 = pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG); } } | < < | 99344 99345 99346 99347 99348 99349 99350 99351 99352 99353 99354 99355 99356 99357 99358 99359 | assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG ); testcase( pDef->funcFlags & OPFLAG_LENGTHARG ); pFarg->a[0].pExpr->op2 = pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG); } } sqlite3ExprCodeExprList(pParse, pFarg, r1, 0, SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR); }else{ r1 = 0; } #ifndef SQLITE_OMIT_VIRTUALTABLE /* Possibly overload the function if the first argument is ** a virtual table column. ** |
︙ | ︙ | |||
99662 99663 99664 99665 99666 99667 99668 | sqlite3ErrorMsg(pParse, "row value misused"); break; } case TK_IF_NULL_ROW: { int addrINR; addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable); | < < | 99518 99519 99520 99521 99522 99523 99524 99525 99526 99527 99528 99529 99530 99531 99532 | sqlite3ErrorMsg(pParse, "row value misused"); break; } case TK_IF_NULL_ROW: { int addrINR; addrINR = sqlite3VdbeAddOp1(v, OP_IfNullRow, pExpr->iTable); inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); sqlite3VdbeJumpHere(v, addrINR); sqlite3VdbeChangeP3(v, addrINR, inReg); break; } /* ** Form A: |
︙ | ︙ | |||
99701 99702 99703 99704 99705 99706 99707 | int nExpr; /* 2x number of WHEN terms */ int i; /* Loop counter */ ExprList *pEList; /* List of WHEN terms */ struct ExprList_item *aListelem; /* Array of WHEN terms */ Expr opCompare; /* The X==Ei expression */ Expr *pX; /* The X expression */ Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */ | < | 99555 99556 99557 99558 99559 99560 99561 99562 99563 99564 99565 99566 99567 99568 | int nExpr; /* 2x number of WHEN terms */ int i; /* Loop counter */ ExprList *pEList; /* List of WHEN terms */ struct ExprList_item *aListelem; /* Array of WHEN terms */ Expr opCompare; /* The X==Ei expression */ Expr *pX; /* The X expression */ Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */ assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList ); assert(pExpr->x.pList->nExpr > 0); pEList = pExpr->x.pList; aListelem = pEList->a; nExpr = pEList->nExpr; endLabel = sqlite3VdbeMakeLabel(v); |
︙ | ︙ | |||
99725 99726 99727 99728 99729 99730 99731 | /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: ** The value in regFree1 might get SCopy-ed into the file result. ** So make sure that the regFree1 register is not reused for other ** purposes and possibly overwritten. */ regFree1 = 0; } for(i=0; i<nExpr-1; i=i+2){ | < < < < < < | 99578 99579 99580 99581 99582 99583 99584 99585 99586 99587 99588 99589 99590 99591 99592 99593 99594 99595 99596 99597 99598 99599 99600 99601 99602 99603 99604 99605 99606 99607 99608 99609 99610 | /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: ** The value in regFree1 might get SCopy-ed into the file result. ** So make sure that the regFree1 register is not reused for other ** purposes and possibly overwritten. */ regFree1 = 0; } for(i=0; i<nExpr-1; i=i+2){ if( pX ){ assert( pTest!=0 ); opCompare.pRight = aListelem[i].pExpr; }else{ pTest = aListelem[i].pExpr; } nextCase = sqlite3VdbeMakeLabel(v); testcase( pTest->op==TK_COLUMN ); sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL); testcase( aListelem[i+1].pExpr->op==TK_COLUMN ); sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target); sqlite3VdbeGoto(v, endLabel); sqlite3VdbeResolveLabel(v, nextCase); } if( (nExpr&1)!=0 ){ sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target); }else{ sqlite3VdbeAddOp2(v, OP_Null, 0, target); } sqlite3VdbeResolveLabel(v, endLabel); break; } #ifndef SQLITE_OMIT_TRIGGER case TK_RAISE: { assert( pExpr->affinity==OE_Rollback || pExpr->affinity==OE_Abort |
︙ | ︙ | |||
99899 99900 99901 99902 99903 99904 99905 | /* ** Generate code that will evaluate expression pExpr and store the ** results in register target. The results are guaranteed to appear ** in register target. If the expression is constant, then this routine ** might choose to code the expression at initialization time. */ SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ | | | 99746 99747 99748 99749 99750 99751 99752 99753 99754 99755 99756 99757 99758 99759 99760 | /* ** Generate code that will evaluate expression pExpr and store the ** results in register target. The results are guaranteed to appear ** in register target. If the expression is constant, then this routine ** might choose to code the expression at initialization time. */ SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr, int target){ if( pParse->okConstFactor && sqlite3ExprIsConstantNotJoin(pExpr) ){ sqlite3ExprCodeAtInit(pParse, pExpr, target); }else{ sqlite3ExprCode(pParse, pExpr, target); } } /* |
︙ | ︙ | |||
99981 99982 99983 99984 99985 99986 99987 | if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ if( flags & SQLITE_ECEL_OMITREF ){ i--; n--; }else{ sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } | | > > | 99828 99829 99830 99831 99832 99833 99834 99835 99836 99837 99838 99839 99840 99841 99842 99843 99844 | if( (flags & SQLITE_ECEL_REF)!=0 && (j = pItem->u.x.iOrderByCol)>0 ){ if( flags & SQLITE_ECEL_OMITREF ){ i--; n--; }else{ sqlite3VdbeAddOp2(v, copyOp, j+srcReg-1, target+i); } }else if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstantNotJoin(pExpr) ){ sqlite3ExprCodeAtInit(pParse, pExpr, target+i); }else{ int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i); if( inReg!=target+i ){ VdbeOp *pOp; if( copyOp==OP_Copy && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy |
︙ | ︙ | |||
100107 100108 100109 100110 100111 100112 100113 | if( NEVER(pExpr==0) ) return; /* No way this can happen */ op = pExpr->op; switch( op ){ case TK_AND: { int d2 = sqlite3VdbeMakeLabel(v); testcase( jumpIfNull==0 ); sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL); | < < < < | 99956 99957 99958 99959 99960 99961 99962 99963 99964 99965 99966 99967 99968 99969 99970 99971 99972 99973 99974 99975 99976 99977 | if( NEVER(pExpr==0) ) return; /* No way this can happen */ op = pExpr->op; switch( op ){ case TK_AND: { int d2 = sqlite3VdbeMakeLabel(v); testcase( jumpIfNull==0 ); sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL); sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3VdbeResolveLabel(v, d2); break; } case TK_OR: { testcase( jumpIfNull==0 ); sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); break; } case TK_NOT: { testcase( jumpIfNull==0 ); sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); break; } |
︙ | ︙ | |||
100277 100278 100279 100280 100281 100282 100283 | assert( pExpr->op!=TK_GT || op==OP_Le ); assert( pExpr->op!=TK_GE || op==OP_Lt ); switch( pExpr->op ){ case TK_AND: { testcase( jumpIfNull==0 ); sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); | < < < < | 100122 100123 100124 100125 100126 100127 100128 100129 100130 100131 100132 100133 100134 100135 100136 100137 100138 100139 100140 100141 100142 100143 100144 | assert( pExpr->op!=TK_GT || op==OP_Le ); assert( pExpr->op!=TK_GE || op==OP_Lt ); switch( pExpr->op ){ case TK_AND: { testcase( jumpIfNull==0 ); sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); break; } case TK_OR: { int d2 = sqlite3VdbeMakeLabel(v); testcase( jumpIfNull==0 ); sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL); sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); sqlite3VdbeResolveLabel(v, d2); break; } case TK_NOT: { testcase( jumpIfNull==0 ); sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); break; } |
︙ | ︙ | |||
100511 100512 100513 100514 100515 100516 100517 | }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ return 2; } } if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ if( combinedFlags & EP_xIsSelect ) return 2; | > | | 100352 100353 100354 100355 100356 100357 100358 100359 100360 100361 100362 100363 100364 100365 100366 100367 | }else if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ return 2; } } if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ if( combinedFlags & EP_xIsSelect ) return 2; if( (combinedFlags & EP_FixedCol)==0 && sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2; if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2; if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; assert( (combinedFlags & EP_Reduced)==0 ); if( pA->op!=TK_STRING && pA->op!=TK_TRUEFALSE ){ if( pA->iColumn!=pB->iColumn ) return 2; if( pA->iTable!=pB->iTable && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; |
︙ | ︙ | |||
101056 101057 101058 101059 101060 101061 101062 | } return pParse->aTempReg[--pParse->nTempReg]; } /* ** Deallocate a register, making available for reuse for some other ** purpose. | < < < < < < < < < < < < < < | 100898 100899 100900 100901 100902 100903 100904 100905 100906 100907 100908 100909 100910 100911 100912 100913 100914 100915 100916 100917 100918 100919 100920 100921 100922 100923 100924 100925 100926 100927 100928 100929 100930 100931 100932 100933 100934 100935 100936 100937 100938 100939 100940 | } return pParse->aTempReg[--pParse->nTempReg]; } /* ** Deallocate a register, making available for reuse for some other ** purpose. */ SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){ if( iReg && pParse->nTempReg<ArraySize(pParse->aTempReg) ){ pParse->aTempReg[pParse->nTempReg++] = iReg; } } /* ** Allocate or deallocate a block of nReg consecutive registers. */ SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){ int i, n; if( nReg==1 ) return sqlite3GetTempReg(pParse); i = pParse->iRangeReg; n = pParse->nRangeReg; if( nReg<=n ){ pParse->iRangeReg += nReg; pParse->nRangeReg -= nReg; }else{ i = pParse->nMem+1; pParse->nMem += nReg; } return i; } SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ if( nReg==1 ){ sqlite3ReleaseTempReg(pParse, iReg); return; } if( nReg>pParse->nRangeReg ){ pParse->nRangeReg = nReg; pParse->iRangeReg = iReg; } } /* |
︙ | ︙ | |||
105018 105019 105020 105021 105022 105023 105024 | } } /* Get the VDBE program ready for execution */ if( v && pParse->nErr==0 && !db->mallocFailed ){ | < | 104846 104847 104848 104849 104850 104851 104852 104853 104854 104855 104856 104857 104858 104859 | } } /* Get the VDBE program ready for execution */ if( v && pParse->nErr==0 && !db->mallocFailed ){ /* A minimum of one cursor is required if autoincrement is used * See ticket [a696379c1f08866] */ if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1; sqlite3VdbeMakeReady(v, pParse); pParse->rc = SQLITE_DONE; }else{ pParse->rc = SQLITE_ERROR; |
︙ | ︙ | |||
107455 107456 107457 107458 107459 107460 107461 | /* Generate code to remove the table from the master table ** on disk. */ v = sqlite3GetVdbe(pParse); if( v ){ sqlite3BeginWriteOperation(pParse, 1, iDb); | > | | > | 107282 107283 107284 107285 107286 107287 107288 107289 107290 107291 107292 107293 107294 107295 107296 107297 107298 107299 | /* Generate code to remove the table from the master table ** on disk. */ v = sqlite3GetVdbe(pParse); if( v ){ sqlite3BeginWriteOperation(pParse, 1, iDb); if( !isView ){ sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName); sqlite3FkDropTable(pParse, pName, pTab); } sqlite3CodeDropTable(pParse, pTab, iDb, isView); } exit_drop_table: sqlite3SrcListDelete(db, pName); } |
︙ | ︙ | |||
110277 110278 110279 110280 110281 110282 110283 | for(i=0; i<nPk; i++){ assert( pPk->aiColumn[i]>=0 ); sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pPk->aiColumn[i], iPk+i); } iKey = iPk; }else{ | | | < | 110106 110107 110108 110109 110110 110111 110112 110113 110114 110115 110116 110117 110118 110119 110120 110121 | for(i=0; i<nPk; i++){ assert( pPk->aiColumn[i]>=0 ); sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, pPk->aiColumn[i], iPk+i); } iKey = iPk; }else{ iKey = ++pParse->nMem; sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, -1, iKey); } if( eOnePass!=ONEPASS_OFF ){ /* For ONEPASS, no need to store the rowid/primary-key. There is only ** one, so just keep it in its register(s) and fall through to the ** delete code. */ nKey = nPk; /* OP_Found will use an unpacked key */ |
︙ | ︙ | |||
110712 110713 110714 110715 110716 110717 110718 | int regBase; int nCol; if( piPartIdxLabel ){ if( pIdx->pPartIdxWhere ){ *piPartIdxLabel = sqlite3VdbeMakeLabel(v); pParse->iSelfTab = iDataCur + 1; | < | 110540 110541 110542 110543 110544 110545 110546 110547 110548 110549 110550 110551 110552 110553 | int regBase; int nCol; if( piPartIdxLabel ){ if( pIdx->pPartIdxWhere ){ *piPartIdxLabel = sqlite3VdbeMakeLabel(v); pParse->iSelfTab = iDataCur + 1; sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, SQLITE_JUMPIFNULL); pParse->iSelfTab = 0; }else{ *piPartIdxLabel = 0; } } |
︙ | ︙ | |||
110759 110760 110761 110762 110763 110764 110765 | ** If a prior call to sqlite3GenerateIndexKey() generated a jump-over label ** because it was a partial index, then this routine should be called to ** resolve that label. */ SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ if( iLabel ){ sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel); | < | 110586 110587 110588 110589 110590 110591 110592 110593 110594 110595 110596 110597 110598 110599 | ** If a prior call to sqlite3GenerateIndexKey() generated a jump-over label ** because it was a partial index, then this routine should be called to ** resolve that label. */ SQLITE_PRIVATE void sqlite3ResolvePartIdxLabel(Parse *pParse, int iLabel){ if( iLabel ){ sqlite3VdbeResolveLabel(pParse->pVdbe, iLabel); } } /************** End of delete.c **********************************************/ /************** Begin file func.c ********************************************/ /* ** 2002 February 23 |
︙ | ︙ | |||
113498 113499 113500 113501 113502 113503 113504 | ** ** then the equivalent of "DELETE FROM <tbl>" is executed before dropping ** the table from the database. Triggers are disabled while running this ** DELETE, but foreign key actions are not. */ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ sqlite3 *db = pParse->db; | | > | 113324 113325 113326 113327 113328 113329 113330 113331 113332 113333 113334 113335 113336 113337 113338 113339 113340 113341 113342 113343 | ** ** then the equivalent of "DELETE FROM <tbl>" is executed before dropping ** the table from the database. Triggers are disabled while running this ** DELETE, but foreign key actions are not. */ SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ sqlite3 *db = pParse->db; if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) ){ int iSkip = 0; Vdbe *v = sqlite3GetVdbe(pParse); assert( v ); /* VDBE has already been allocated */ assert( pTab->pSelect==0 ); /* Not a view */ if( sqlite3FkReferences(pTab)==0 ){ /* Search for a deferred foreign key constraint for which this table ** is the child table. If one cannot be found, return without ** generating any VDBE code. If one can be found, then jump over ** the entire DELETE if there are no outstanding deferred constraints ** when this statement is run. */ FKey *p; |
︙ | ︙ | |||
115397 115398 115399 115400 115401 115402 115403 | testcase( w.eCode==0 ); testcase( w.eCode==CKCNSTRNT_COLUMN ); testcase( w.eCode==CKCNSTRNT_ROWID ); testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) ); return !w.eCode; } | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 115224 115225 115226 115227 115228 115229 115230 115231 115232 115233 115234 115235 115236 115237 | testcase( w.eCode==0 ); testcase( w.eCode==CKCNSTRNT_COLUMN ); testcase( w.eCode==CKCNSTRNT_ROWID ); testcase( w.eCode==(CKCNSTRNT_ROWID|CKCNSTRNT_COLUMN) ); return !w.eCode; } /* ** Generate code to do constraint checks prior to an INSERT or an UPDATE ** on table pTab. ** ** The regNewData parameter is the first register in a range that contains ** the data to be inserted or the data after the update. There will be ** pTab->nCol+1 registers in this range. The first register (the one |
︙ | ︙ | |||
115544 115545 115546 115547 115548 115549 115550 | int i; /* loop counter */ int ix; /* Index loop counter */ int nCol; /* Number of columns */ int onError; /* Conflict resolution strategy */ int addr1; /* Address of jump instruction */ int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */ int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */ | < > > > < | 115333 115334 115335 115336 115337 115338 115339 115340 115341 115342 115343 115344 115345 115346 115347 115348 115349 115350 115351 115352 115353 115354 115355 115356 115357 115358 115359 115360 | int i; /* loop counter */ int ix; /* Index loop counter */ int nCol; /* Number of columns */ int onError; /* Conflict resolution strategy */ int addr1; /* Address of jump instruction */ int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */ int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */ Index *pUpIdx = 0; /* Index to which to apply the upsert */ u8 isUpdate; /* True if this is an UPDATE operation */ u8 bAffinityDone = 0; /* True if the OP_Affinity operation has been run */ int upsertBypass = 0; /* Address of Goto to bypass upsert subroutine */ int upsertJump = 0; /* Address of Goto that jumps into upsert subroutine */ int ipkTop = 0; /* Top of the IPK uniqueness check */ int ipkBottom = 0; /* OP_Goto at the end of the IPK uniqueness check */ isUpdate = regOldData!=0; db = pParse->db; v = sqlite3GetVdbe(pParse); assert( v!=0 ); assert( pTab->pSelect==0 ); /* This table is not a VIEW */ nCol = pTab->nCol; /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for ** normal rowid tables. nPkField is the number of key fields in the ** pPk index or 1 for a rowid table. In other words, nPkField is the ** number of fields in the true primary key of the table. */ if( HasRowid(pTab) ){ pPk = 0; |
︙ | ︙ | |||
115660 115661 115662 115663 115664 115665 115666 | pParse->iSelfTab = 0; } #endif /* !defined(SQLITE_OMIT_CHECK) */ /* UNIQUE and PRIMARY KEY constraints should be handled in the following ** order: ** | | | > > > > > | < | < | > | 115450 115451 115452 115453 115454 115455 115456 115457 115458 115459 115460 115461 115462 115463 115464 115465 115466 115467 115468 115469 115470 115471 115472 115473 115474 115475 115476 115477 115478 115479 115480 115481 115482 115483 115484 115485 115486 115487 115488 115489 115490 115491 115492 115493 115494 115495 115496 115497 115498 115499 115500 115501 | pParse->iSelfTab = 0; } #endif /* !defined(SQLITE_OMIT_CHECK) */ /* UNIQUE and PRIMARY KEY constraints should be handled in the following ** order: ** ** (1) OE_Update ** (2) OE_Abort, OE_Fail, OE_Rollback, OE_Ignore ** (3) OE_Replace ** ** OE_Fail and OE_Ignore must happen before any changes are made. ** OE_Update guarantees that only a single row will change, so it ** must happen before OE_Replace. Technically, OE_Abort and OE_Rollback ** could happen in any order, but they are grouped up front for ** convenience. ** ** 2018-08-14: Ticket https://www.sqlite.org/src/info/908f001483982c43 ** The order of constraints used to have OE_Update as (2) and OE_Abort ** and so forth as (1). But apparently PostgreSQL checks the OE_Update ** constraint before any others, so it had to be moved. ** ** Constraint checking code is generated in this order: ** (A) The rowid constraint ** (B) Unique index constraints that do not have OE_Replace as their ** default conflict resolution strategy ** (C) Unique index that do use OE_Replace by default. ** ** The ordering of (2) and (3) is accomplished by making sure the linked ** list of indexes attached to a table puts all OE_Replace indexes last ** in the list. See sqlite3CreateIndex() for where that happens. */ if( pUpsert ){ if( pUpsert->pUpsertTarget==0 ){ /* An ON CONFLICT DO NOTHING clause, without a constraint-target. ** Make all unique constraint resolution be OE_Ignore */ assert( pUpsert->pUpsertSet==0 ); overrideError = OE_Ignore; pUpsert = 0; }else if( (pUpIdx = pUpsert->pUpsertIdx)!=0 ){ /* If the constraint-target uniqueness check must be run first. ** Jump to that uniqueness check now */ upsertJump = sqlite3VdbeAddOp0(v, OP_Goto); VdbeComment((v, "UPSERT constraint goes first")); } } /* If rowid is changing, make sure the new rowid does not previously ** exist in the table. */ if( pkChng && pPk==0 ){ |
︙ | ︙ | |||
115725 115726 115727 115728 115729 115730 115731 | } /* If the response to a rowid conflict is REPLACE but the response ** to some other UNIQUE constraint is FAIL or IGNORE, then we need ** to defer the running of the rowid conflict checking until after ** the UNIQUE constraints have run. */ | < < < < < | | | | > < | 115519 115520 115521 115522 115523 115524 115525 115526 115527 115528 115529 115530 115531 115532 115533 115534 115535 115536 115537 115538 115539 115540 115541 115542 115543 115544 115545 115546 115547 115548 115549 115550 115551 115552 115553 115554 115555 | } /* If the response to a rowid conflict is REPLACE but the response ** to some other UNIQUE constraint is FAIL or IGNORE, then we need ** to defer the running of the rowid conflict checking until after ** the UNIQUE constraints have run. */ if( onError==OE_Replace /* IPK rule is REPLACE */ && onError!=overrideError /* Rules for other contraints are different */ && pTab->pIndex /* There exist other constraints */ ){ ipkTop = sqlite3VdbeAddOp0(v, OP_Goto)+1; VdbeComment((v, "defer IPK REPLACE until last")); } if( isUpdate ){ /* pkChng!=0 does not mean that the rowid has changed, only that ** it might have changed. Skip the conflict logic below if the rowid ** is unchanged. */ sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); sqlite3VdbeChangeP5(v, SQLITE_NOTNULL); VdbeCoverage(v); } /* Check to see if the new rowid already exists in the table. Skip ** the following conflict logic if it does not. */ VdbeNoopComment((v, "uniqueness check for ROWID")); sqlite3VdbeVerifyAbortable(v, onError); sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); VdbeCoverage(v); switch( onError ){ default: { onError = OE_Abort; /* Fall thru into the next case */ } case OE_Rollback: |
︙ | ︙ | |||
115829 115830 115831 115832 115833 115834 115835 | #endif case OE_Ignore: { testcase( onError==OE_Ignore ); sqlite3VdbeGoto(v, ignoreDest); break; } } | < | | | < < < < | | > > > > | 115618 115619 115620 115621 115622 115623 115624 115625 115626 115627 115628 115629 115630 115631 115632 115633 115634 115635 115636 115637 115638 115639 115640 115641 115642 115643 115644 115645 115646 115647 115648 115649 115650 115651 115652 115653 115654 115655 115656 115657 115658 115659 115660 115661 115662 115663 | #endif case OE_Ignore: { testcase( onError==OE_Ignore ); sqlite3VdbeGoto(v, ignoreDest); break; } } sqlite3VdbeResolveLabel(v, addrRowidOk); if( ipkTop ){ ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto); sqlite3VdbeJumpHere(v, ipkTop-1); } } /* Test all UNIQUE constraints by creating entries for each UNIQUE ** index and making sure that duplicate entries do not already exist. ** Compute the revised record entries for indices as we go. ** ** This loop also handles the case of the PRIMARY KEY index for a ** WITHOUT ROWID table. */ for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){ int regIdx; /* Range of registers hold conent for pIdx */ int regR; /* Range of registers holding conflicting PK */ int iThisCur; /* Cursor for this UNIQUE index */ int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */ if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ if( pUpIdx==pIdx ){ addrUniqueOk = upsertJump+1; upsertBypass = sqlite3VdbeGoto(v, 0); VdbeComment((v, "Skip upsert subroutine")); sqlite3VdbeJumpHere(v, upsertJump); }else{ addrUniqueOk = sqlite3VdbeMakeLabel(v); } if( bAffinityDone==0 && (pUpIdx==0 || pUpIdx==pIdx) ){ sqlite3TableAffinity(v, pTab, regNewData+1); bAffinityDone = 1; } VdbeNoopComment((v, "uniqueness check for %s", pIdx->zName)); iThisCur = iIdxCur+ix; /* Skip partial indices for which the WHERE clause is not true */ if( pIdx->pPartIdxWhere ){ |
︙ | ︙ | |||
115934 115935 115936 115937 115938 115939 115940 | if( pUpsert->pUpsertSet==0 ){ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */ }else{ onError = OE_Update; /* DO UPDATE */ } } | < < < < < < < < < < | 115722 115723 115724 115725 115726 115727 115728 115729 115730 115731 115732 115733 115734 115735 115736 115737 115738 115739 115740 115741 115742 115743 115744 115745 115746 115747 115748 115749 115750 115751 115752 115753 115754 115755 | if( pUpsert->pUpsertSet==0 ){ onError = OE_Ignore; /* DO NOTHING is the same as INSERT OR IGNORE */ }else{ onError = OE_Update; /* DO UPDATE */ } } /* Collision detection may be omitted if all of the following are true: ** (1) The conflict resolution algorithm is REPLACE ** (2) The table is a WITHOUT ROWID table ** (3) There are no secondary indexes on the table ** (4) No delete triggers need to be fired if there is a conflict ** (5) No FK constraint counters need to be updated if a conflict occurs. */ if( (ix==0 && pIdx->pNext==0) /* Condition 3 */ && pPk==pIdx /* Condition 2 */ && onError==OE_Replace /* Condition 1 */ && ( 0==(db->flags&SQLITE_RecTriggers) || /* Condition 4 */ 0==sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0)) && ( 0==(db->flags&SQLITE_ForeignKeys) || /* Condition 5 */ (0==pTab->pFKey && 0==sqlite3FkReferences(pTab))) ){ sqlite3VdbeResolveLabel(v, addrUniqueOk); continue; } /* Check to see if the new index entry will be unique */ sqlite3VdbeVerifyAbortable(v, onError); sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, regIdx, pIdx->nKeyCol); VdbeCoverage(v); /* Generate code to handle collisions */ regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField); if( isUpdate || onError==OE_Replace ){ |
︙ | ︙ | |||
116065 116066 116067 116068 116069 116070 116071 116072 116073 116074 116075 | regR, nPkField, 0, OE_Replace, (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); seenReplace = 1; break; } } if( pUpIdx==pIdx ){ sqlite3VdbeJumpHere(v, upsertBypass); }else{ sqlite3VdbeResolveLabel(v, addrUniqueOk); } | > < | | > | < | > | | > | 115843 115844 115845 115846 115847 115848 115849 115850 115851 115852 115853 115854 115855 115856 115857 115858 115859 115860 115861 115862 115863 115864 115865 115866 115867 115868 115869 115870 115871 | regR, nPkField, 0, OE_Replace, (pIdx==pPk ? ONEPASS_SINGLE : ONEPASS_OFF), iThisCur); seenReplace = 1; break; } } if( pUpIdx==pIdx ){ sqlite3VdbeGoto(v, upsertJump+1); sqlite3VdbeJumpHere(v, upsertBypass); }else{ sqlite3VdbeResolveLabel(v, addrUniqueOk); } if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField); } /* If the IPK constraint is a REPLACE, run it last */ if( ipkTop ){ sqlite3VdbeGoto(v, ipkTop+1); VdbeComment((v, "Do IPK REPLACE")); sqlite3VdbeJumpHere(v, ipkBottom); } *pbMayReplace = seenReplace; VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace)); } #ifdef SQLITE_ENABLE_NULL_TRIM /* ** Change the P5 operand on the last opcode (which should be an OP_MakeRecord) |
︙ | ︙ | |||
116173 116174 116175 116176 116177 116178 116179 | if( !HasRowid(pTab) ) return; regData = regNewData + 1; regRec = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec); sqlite3SetMakeRecordP5(v, pTab); if( !bAffinityDone ){ sqlite3TableAffinity(v, pTab, 0); | < | 115953 115954 115955 115956 115957 115958 115959 115960 115961 115962 115963 115964 115965 115966 | if( !HasRowid(pTab) ) return; regData = regNewData + 1; regRec = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec); sqlite3SetMakeRecordP5(v, pTab); if( !bAffinityDone ){ sqlite3TableAffinity(v, pTab, 0); } if( pParse->nested ){ pik_flags = 0; }else{ pik_flags = OPFLAG_NCHANGE; pik_flags |= (update_flags?update_flags:OPFLAG_LASTROWID); } |
︙ | ︙ | |||
120460 120461 120462 120463 120464 120465 120466 | Index *pPrior = 0; int loopTop; int iDataCur, iIdxCur; int r1 = -1; if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */ pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); | < | 120239 120240 120241 120242 120243 120244 120245 120246 120247 120248 120249 120250 120251 120252 | Index *pPrior = 0; int loopTop; int iDataCur, iIdxCur; int r1 = -1; if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */ pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0, 1, 0, &iDataCur, &iIdxCur); /* reg[7] counts the number of entries in the table. ** reg[8+i] counts the number of entries in the i-th index */ sqlite3VdbeAddOp2(v, OP_Integer, 0, 7); for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ |
︙ | ︙ | |||
120503 120504 120505 120506 120507 120508 120509 | ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0); if( db->mallocFailed==0 ){ int addrCkFault = sqlite3VdbeMakeLabel(v); int addrCkOk = sqlite3VdbeMakeLabel(v); char *zErr; int k; pParse->iSelfTab = iDataCur + 1; | < < | 120281 120282 120283 120284 120285 120286 120287 120288 120289 120290 120291 120292 120293 120294 120295 120296 120297 120298 120299 120300 120301 120302 120303 120304 120305 120306 | ExprList *pCheck = sqlite3ExprListDup(db, pTab->pCheck, 0); if( db->mallocFailed==0 ){ int addrCkFault = sqlite3VdbeMakeLabel(v); int addrCkOk = sqlite3VdbeMakeLabel(v); char *zErr; int k; pParse->iSelfTab = iDataCur + 1; for(k=pCheck->nExpr-1; k>0; k--){ sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0); } sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk, SQLITE_JUMPIFNULL); sqlite3VdbeResolveLabel(v, addrCkFault); pParse->iSelfTab = 0; zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s", pTab->zName); sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC); integrityCheckResultRow(v); sqlite3VdbeResolveLabel(v, addrCkOk); } sqlite3ExprListDelete(db, pCheck); } if( !isQuick ){ /* Omit the remaining tests for quick_check */ /* Validate index entries for the current row */ for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ int jmp2, jmp3, jmp4, jmp5; |
︙ | ︙ | |||
123461 123462 123463 123464 123465 123466 123467 | pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else{ int r1 = sqlite3GetTempReg(pParse); assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, r1, pDest->zAffSdst, nResultCol); | < | 123237 123238 123239 123240 123241 123242 123243 123244 123245 123246 123247 123248 123249 123250 | pushOntoSorter( pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else{ int r1 = sqlite3GetTempReg(pParse); assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, r1, pDest->zAffSdst, nResultCol); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, r1, regResult, nResultCol); sqlite3ReleaseTempReg(pParse, r1); } break; } /* If any row exist in the result set, record that fact and abort. |
︙ | ︙ | |||
123505 123506 123507 123508 123509 123510 123511 | if( pSort ){ pushOntoSorter(pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else if( eDest==SRT_Coroutine ){ sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); }else{ sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); | < | 123280 123281 123282 123283 123284 123285 123286 123287 123288 123289 123290 123291 123292 123293 | if( pSort ){ pushOntoSorter(pParse, pSort, p, regResult, regOrig, nResultCol, nPrefixReg); }else if( eDest==SRT_Coroutine ){ sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); }else{ sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); } break; } #ifndef SQLITE_OMIT_CTE /* Write the results into a priority queue that is order according to ** pDest->pOrderBy (in pSO). pDest->iSDParm (in iParm) is the cursor for an |
︙ | ︙ | |||
123862 123863 123864 123865 123866 123867 123868 | break; } #ifndef SQLITE_OMIT_SUBQUERY case SRT_Set: { assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid, pDest->zAffSdst, nColumn); | < < | 123636 123637 123638 123639 123640 123641 123642 123643 123644 123645 123646 123647 123648 123649 123650 123651 123652 123653 123654 123655 123656 123657 123658 123659 123660 123661 123662 123663 | break; } #ifndef SQLITE_OMIT_SUBQUERY case SRT_Set: { assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid, pDest->zAffSdst, nColumn); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iParm, regRowid, regRow, nColumn); break; } case SRT_Mem: { /* The LIMIT clause will terminate the loop for us */ break; } #endif default: { assert( eDest==SRT_Output || eDest==SRT_Coroutine ); testcase( eDest==SRT_Output ); testcase( eDest==SRT_Coroutine ); if( eDest==SRT_Output ){ sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn); }else{ sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); } break; } } if( regRowid ){ |
︙ | ︙ | |||
124478 124479 124480 124481 124482 124483 124484 | /* ** "LIMIT -1" always shows all rows. There is some ** controversy about what the correct behavior should be. ** The current implementation interprets "LIMIT 0" to mean ** no rows. */ | < | 124250 124251 124252 124253 124254 124255 124256 124257 124258 124259 124260 124261 124262 124263 | /* ** "LIMIT -1" always shows all rows. There is some ** controversy about what the correct behavior should be. ** The current implementation interprets "LIMIT 0" to mean ** no rows. */ if( pLimit ){ assert( pLimit->op==TK_LIMIT ); assert( pLimit->pLeft!=0 ); p->iLimit = iLimit = ++pParse->nMem; v = sqlite3GetVdbe(pParse); assert( v!=0 ); if( sqlite3ExprIsInteger(pLimit->pLeft, &n) ){ |
︙ | ︙ | |||
125264 125265 125266 125267 125268 125269 125270 | */ case SRT_Set: { int r1; testcase( pIn->nSdst>1 ); r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1, pDest->zAffSdst, pIn->nSdst); | < | 125035 125036 125037 125038 125039 125040 125041 125042 125043 125044 125045 125046 125047 125048 | */ case SRT_Set: { int r1; testcase( pIn->nSdst>1 ); r1 = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1, pDest->zAffSdst, pIn->nSdst); sqlite3VdbeAddOp4Int(v, OP_IdxInsert, pDest->iSDParm, r1, pIn->iSdst, pIn->nSdst); sqlite3ReleaseTempReg(pParse, r1); break; } /* If this is a scalar select that is part of an expression, then |
︙ | ︙ | |||
125307 125308 125309 125310 125311 125312 125313 | ** For SRT_Output, results are stored in a sequence of registers. ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to ** return the next row of result. */ default: { assert( pDest->eDest==SRT_Output ); sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst); | < | 125077 125078 125079 125080 125081 125082 125083 125084 125085 125086 125087 125088 125089 125090 | ** For SRT_Output, results are stored in a sequence of registers. ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to ** return the next row of result. */ default: { assert( pDest->eDest==SRT_Output ); sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst); break; } } /* Jump to the end of the loop if the LIMIT is reached. */ if( p->iLimit ){ |
︙ | ︙ | |||
125762 125763 125764 125765 125766 125767 125768 | if( pExpr->iColumn<0 ){ pExpr->op = TK_NULL; }else{ Expr *pNew; Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr; Expr ifNullRow; assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr ); | | | 125531 125532 125533 125534 125535 125536 125537 125538 125539 125540 125541 125542 125543 125544 125545 | if( pExpr->iColumn<0 ){ pExpr->op = TK_NULL; }else{ Expr *pNew; Expr *pCopy = pSubst->pEList->a[pExpr->iColumn].pExpr; Expr ifNullRow; assert( pSubst->pEList!=0 && pExpr->iColumn<pSubst->pEList->nExpr ); assert( pExpr->pRight==0 ); if( sqlite3ExprIsVector(pCopy) ){ sqlite3VectorErrorMsg(pSubst->pParse, pCopy); }else{ sqlite3 *db = pSubst->pParse->db; if( pSubst->isLeftJoin && pCopy->op!=TK_COLUMN ){ memset(&ifNullRow, 0, sizeof(ifNullRow)); ifNullRow.op = TK_IF_NULL_ROW; |
︙ | ︙ | |||
126386 126387 126388 126389 126390 126391 126392 126393 126394 126395 126396 126397 126398 126399 126400 | } #endif return 1; } #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) /* ** Make copies of relevant WHERE clause terms of the outer query into ** the WHERE clause of subquery. Example: ** ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 126155 126156 126157 126158 126159 126160 126161 126162 126163 126164 126165 126166 126167 126168 126169 126170 126171 126172 126173 126174 126175 126176 126177 126178 126179 126180 126181 126182 126183 126184 126185 126186 126187 126188 126189 126190 126191 126192 126193 126194 126195 126196 126197 126198 126199 126200 126201 126202 126203 126204 126205 126206 126207 126208 126209 126210 126211 126212 126213 126214 126215 126216 126217 126218 126219 126220 126221 126222 126223 126224 126225 126226 126227 126228 126229 126230 126231 126232 126233 126234 126235 126236 126237 126238 126239 126240 126241 126242 126243 126244 126245 126246 126247 126248 126249 126250 126251 126252 126253 126254 126255 126256 126257 126258 126259 126260 126261 126262 126263 126264 126265 126266 126267 126268 126269 126270 126271 126272 126273 126274 126275 126276 126277 126278 126279 126280 126281 126282 126283 126284 126285 126286 126287 126288 126289 126290 126291 126292 126293 126294 126295 126296 126297 126298 126299 126300 126301 126302 126303 126304 126305 126306 126307 126308 126309 126310 126311 126312 126313 126314 126315 126316 126317 126318 126319 126320 126321 126322 126323 126324 126325 126326 126327 126328 126329 126330 | } #endif return 1; } #endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ /* ** A structure to keep track of all of the column values that fixed to ** a known value due to WHERE clause constraints of the form COLUMN=VALUE. */ typedef struct WhereConst WhereConst; struct WhereConst { Parse *pParse; /* Parsing context */ int nConst; /* Number for COLUMN=CONSTANT terms */ int nChng; /* Number of times a constant is propagated */ Expr **apExpr; /* [i*2] is COLUMN and [i*2+1] is VALUE */ }; /* ** Add a new entry to the pConst object */ static void constInsert( WhereConst *pConst, Expr *pColumn, Expr *pValue ){ pConst->nConst++; pConst->apExpr = sqlite3DbReallocOrFree(pConst->pParse->db, pConst->apExpr, pConst->nConst*2*sizeof(Expr*)); if( pConst->apExpr==0 ){ pConst->nConst = 0; }else{ if( ExprHasProperty(pValue, EP_FixedCol) ) pValue = pValue->pLeft; pConst->apExpr[pConst->nConst*2-2] = pColumn; pConst->apExpr[pConst->nConst*2-1] = pValue; } } /* ** Find all terms of COLUMN=VALUE or VALUE=COLUMN in pExpr where VALUE ** is a constant expression and where the term must be true because it ** is part of the AND-connected terms of the expression. For each term ** found, add it to the pConst structure. */ static void findConstInWhere(WhereConst *pConst, Expr *pExpr){ Expr *pRight, *pLeft; if( pExpr==0 ) return; if( ExprHasProperty(pExpr, EP_FromJoin) ) return; if( pExpr->op==TK_AND ){ findConstInWhere(pConst, pExpr->pRight); findConstInWhere(pConst, pExpr->pLeft); return; } if( pExpr->op!=TK_EQ ) return; pRight = pExpr->pRight; pLeft = pExpr->pLeft; assert( pRight!=0 ); assert( pLeft!=0 ); if( pRight->op==TK_COLUMN && !ExprHasProperty(pRight, EP_FixedCol) && sqlite3ExprIsConstant(pLeft) && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight)) ){ constInsert(pConst, pRight, pLeft); }else if( pLeft->op==TK_COLUMN && !ExprHasProperty(pLeft, EP_FixedCol) && sqlite3ExprIsConstant(pRight) && sqlite3IsBinary(sqlite3BinaryCompareCollSeq(pConst->pParse,pLeft,pRight)) ){ constInsert(pConst, pLeft, pRight); } } /* ** This is a Walker expression callback. pExpr is a candidate expression ** to be replaced by a value. If pExpr is equivalent to one of the ** columns named in pWalker->u.pConst, then overwrite it with its ** corresponding value. */ static int propagateConstantExprRewrite(Walker *pWalker, Expr *pExpr){ int i; WhereConst *pConst; if( pExpr->op!=TK_COLUMN ) return WRC_Continue; if( ExprHasProperty(pExpr, EP_FixedCol) ) return WRC_Continue; pConst = pWalker->u.pConst; for(i=0; i<pConst->nConst; i++){ Expr *pColumn = pConst->apExpr[i*2]; if( pColumn==pExpr ) continue; if( pColumn->iTable!=pExpr->iTable ) continue; if( pColumn->iColumn!=pExpr->iColumn ) continue; /* A match is found. Add the EP_FixedCol property */ pConst->nChng++; ExprClearProperty(pExpr, EP_Leaf); ExprSetProperty(pExpr, EP_FixedCol); assert( pExpr->pLeft==0 ); pExpr->pLeft = sqlite3ExprDup(pConst->pParse->db, pConst->apExpr[i*2+1], 0); break; } return WRC_Prune; } /* ** The WHERE-clause constant propagation optimization. ** ** If the WHERE clause contains terms of the form COLUMN=CONSTANT or ** CONSTANT=COLUMN that must be tree (in other words, if the terms top-level ** AND-connected terms that are not part of a ON clause from a LEFT JOIN) ** then throughout the query replace all other occurrences of COLUMN ** with CONSTANT within the WHERE clause. ** ** For example, the query: ** ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=t1.a AND t3.c=t2.b ** ** Is transformed into ** ** SELECT * FROM t1, t2, t3 WHERE t1.a=39 AND t2.b=39 AND t3.c=39 ** ** Return true if any transformations where made and false if not. ** ** Implementation note: Constant propagation is tricky due to affinity ** and collating sequence interactions. Consider this example: ** ** CREATE TABLE t1(a INT,b TEXT); ** INSERT INTO t1 VALUES(123,'0123'); ** SELECT * FROM t1 WHERE a=123 AND b=a; ** SELECT * FROM t1 WHERE a=123 AND b=123; ** ** The two SELECT statements above should return different answers. b=a ** is alway true because the comparison uses numeric affinity, but b=123 ** is false because it uses text affinity and '0123' is not the same as '123'. ** To work around this, the expression tree is not actually changed from ** "b=a" to "b=123" but rather the "a" in "b=a" is tagged with EP_FixedCol ** and the "123" value is hung off of the pLeft pointer. Code generator ** routines know to generate the constant "123" instead of looking up the ** column value. Also, to avoid collation problems, this optimization is ** only attempted if the "a=123" term uses the default BINARY collation. */ static int propagateConstants( Parse *pParse, /* The parsing context */ Select *p /* The query in which to propagate constants */ ){ WhereConst x; Walker w; int nChng = 0; x.pParse = pParse; do{ x.nConst = 0; x.nChng = 0; x.apExpr = 0; findConstInWhere(&x, p->pWhere); if( x.nConst ){ memset(&w, 0, sizeof(w)); w.pParse = pParse; w.xExprCallback = propagateConstantExprRewrite; w.xSelectCallback = sqlite3SelectWalkNoop; w.xSelectCallback2 = 0; w.walkerDepth = 0; w.u.pConst = &x; sqlite3WalkExpr(&w, p->pWhere); sqlite3DbFree(x.pParse->db, x.apExpr); nChng += x.nChng; } }while( x.nChng ); return nChng; } #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) /* ** Make copies of relevant WHERE clause terms of the outer query into ** the WHERE clause of subquery. Example: ** ** SELECT * FROM (SELECT a AS x, c-d AS y FROM t1) WHERE x=5 AND y=10; |
︙ | ︙ | |||
127487 127488 127489 127490 127491 127492 127493 | } if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); } sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); sqlite3VdbeChangeP5(v, (u8)nArg); | < < < < < < < < < < < < < < < | 127417 127418 127419 127420 127421 127422 127423 127424 127425 127426 127427 127428 127429 127430 127431 127432 127433 127434 127435 127436 127437 127438 127439 127440 127441 127442 127443 127444 127445 | } if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); } sqlite3VdbeAddOp3(v, OP_AggStep, 0, regAgg, pF->iMem); sqlite3VdbeAppendP4(v, pF->pFunc, P4_FUNCDEF); sqlite3VdbeChangeP5(v, (u8)nArg); sqlite3ReleaseTempRange(pParse, regAgg, nArg); if( addrNext ){ sqlite3VdbeResolveLabel(v, addrNext); } } if( regHit==0 && pAggInfo->nAccumulator ){ regHit = regAcc; } if( regHit ){ addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); VdbeCoverage(v); } for(i=0, pC=pAggInfo->aCol; i<pAggInfo->nAccumulator; i++, pC++){ sqlite3ExprCode(pParse, pC->pExpr, pC->iMem); } pAggInfo->directMode = 0; if( addrHitTest ){ sqlite3VdbeJumpHere(v, addrHitTest); } } /* ** Add a single OP_Explain instruction to the VDBE to explain a simple |
︙ | ︙ | |||
127646 127647 127648 127649 127650 127651 127652 127653 127654 127655 127656 127657 127658 127659 | ** Into this: ** ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) ** ** The transformation only works if all of the following are true: ** ** * The subquery is a UNION ALL of two or more terms ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries ** * The outer query is a simple count(*) ** ** Return TRUE if the optimization is undertaken. */ static int countOfViewOptimization(Parse *pParse, Select *p){ Select *pSub, *pPrior; | > | 127561 127562 127563 127564 127565 127566 127567 127568 127569 127570 127571 127572 127573 127574 127575 | ** Into this: ** ** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2) ** ** The transformation only works if all of the following are true: ** ** * The subquery is a UNION ALL of two or more terms ** * The subquery does not have a LIMIT clause ** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries ** * The outer query is a simple count(*) ** ** Return TRUE if the optimization is undertaken. */ static int countOfViewOptimization(Parse *pParse, Select *p){ Select *pSub, *pPrior; |
︙ | ︙ | |||
127669 127670 127671 127672 127673 127674 127675 127676 127677 127678 127679 127680 127681 127682 | if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */ pSub = p->pSrc->a[0].pSelect; if( pSub==0 ) return 0; /* The FROM is a subquery */ if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */ do{ if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */ if( pSub->pWhere ) return 0; /* No WHERE clause */ if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */ pSub = pSub->pPrior; /* Repeat over compound */ }while( pSub ); /* If we reach this point then it is OK to perform the transformation */ db = pParse->db; | > | 127585 127586 127587 127588 127589 127590 127591 127592 127593 127594 127595 127596 127597 127598 127599 | if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */ pSub = p->pSrc->a[0].pSelect; if( pSub==0 ) return 0; /* The FROM is a subquery */ if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */ do{ if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */ if( pSub->pWhere ) return 0; /* No WHERE clause */ if( pSub->pLimit ) return 0; /* No LIMIT clause */ if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */ pSub = pSub->pPrior; /* Repeat over compound */ }while( pSub ); /* If we reach this point then it is OK to perform the transformation */ db = pParse->db; |
︙ | ︙ | |||
127910 127911 127912 127913 127914 127915 127916 127917 127918 127919 127920 127921 127922 127923 | sqlite3TreeViewSelect(0, p, 0); } #endif if( p->pNext==0 ) ExplainQueryPlanPop(pParse); return rc; } #endif /* For each term in the FROM clause, do two things: ** (1) Authorized unreferenced tables ** (2) Generate code for all sub-queries */ for(i=0; i<pTabList->nSrc; i++){ struct SrcList_item *pItem = &pTabList->a[i]; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 127827 127828 127829 127830 127831 127832 127833 127834 127835 127836 127837 127838 127839 127840 127841 127842 127843 127844 127845 127846 127847 127848 127849 127850 127851 127852 127853 127854 127855 127856 127857 127858 127859 127860 127861 127862 127863 127864 127865 127866 127867 127868 127869 | sqlite3TreeViewSelect(0, p, 0); } #endif if( p->pNext==0 ) ExplainQueryPlanPop(pParse); return rc; } #endif /* Do the WHERE-clause constant propagation optimization if this is ** a join. No need to speed time on this operation for non-join queries ** as the equivalent optimization will be handled by query planner in ** sqlite3WhereBegin(). */ if( pTabList->nSrc>1 && OptimizationEnabled(db, SQLITE_PropagateConst) && propagateConstants(pParse, p) ){ #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p,("After constant propagation:\n")); sqlite3TreeViewSelect(0, p, 0); } #endif }else{ SELECTTRACE(0x100,pParse,p,("Constant propagation not helpful\n")); } #ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView) && countOfViewOptimization(pParse, p) ){ if( db->mallocFailed ) goto select_end; pEList = p->pEList; pTabList = p->pSrc; } #endif /* For each term in the FROM clause, do two things: ** (1) Authorized unreferenced tables ** (2) Generate code for all sub-queries */ for(i=0; i<pTabList->nSrc; i++){ struct SrcList_item *pItem = &pTabList->a[i]; |
︙ | ︙ | |||
127984 127985 127986 127987 127988 127989 127990 | */ if( OptimizationEnabled(db, SQLITE_PushDown) && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor, (pItem->fg.jointype & JT_OUTER)!=0) ){ #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ | | > | 127930 127931 127932 127933 127934 127935 127936 127937 127938 127939 127940 127941 127942 127943 127944 127945 | */ if( OptimizationEnabled(db, SQLITE_PushDown) && pushDownWhereTerms(pParse, pSub, p->pWhere, pItem->iCursor, (pItem->fg.jointype & JT_OUTER)!=0) ){ #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x100 ){ SELECTTRACE(0x100,pParse,p, ("After WHERE-clause push-down into subquery %d:\n", pSub->selId)); sqlite3TreeViewSelect(0, p, 0); } #endif }else{ SELECTTRACE(0x100,pParse,p,("Push-down not possible\n")); } |
︙ | ︙ | |||
128086 128087 128088 128089 128090 128091 128092 | sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0; #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x400 ){ SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n")); sqlite3TreeViewSelect(0, p, 0); } | < < < < < < < < < < | 128033 128034 128035 128036 128037 128038 128039 128040 128041 128042 128043 128044 128045 128046 | sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0; #if SELECTTRACE_ENABLED if( sqlite3SelectTrace & 0x400 ){ SELECTTRACE(0x400,pParse,p,("After all FROM-clause analysis:\n")); sqlite3TreeViewSelect(0, p, 0); } #endif /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and ** if the select-list is the same as the ORDER BY list, then this query ** can be rewritten as a GROUP BY. In other words, this: ** ** SELECT DISTINCT xyz FROM ... ORDER BY xyz |
︙ | ︙ | |||
128447 128448 128449 128450 128451 128452 128453 | for(i=0; i<sAggInfo.nColumn; i++){ if( sAggInfo.aCol[i].iSorterColumn>=j ){ nCol++; j++; } } regBase = sqlite3GetTempRange(pParse, nCol); | < | | < < | 128384 128385 128386 128387 128388 128389 128390 128391 128392 128393 128394 128395 128396 128397 128398 128399 128400 128401 128402 128403 128404 128405 128406 128407 128408 128409 128410 128411 128412 128413 128414 128415 128416 128417 128418 128419 128420 | for(i=0; i<sAggInfo.nColumn; i++){ if( sAggInfo.aCol[i].iSorterColumn>=j ){ nCol++; j++; } } regBase = sqlite3GetTempRange(pParse, nCol); sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0, 0); j = nGroupBy; for(i=0; i<sAggInfo.nColumn; i++){ struct AggInfo_col *pCol = &sAggInfo.aCol[i]; if( pCol->iSorterColumn>=j ){ int r1 = j + regBase; sqlite3ExprCodeGetColumnOfTable(v, pCol->pTab, pCol->iTable, pCol->iColumn, r1); j++; } } regRecord = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord); sqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord); sqlite3ReleaseTempReg(pParse, regRecord); sqlite3ReleaseTempRange(pParse, regBase, nCol); sqlite3WhereEnd(pWInfo); sAggInfo.sortingIdxPTab = sortPTab = pParse->nTab++; sortOut = sqlite3GetTempReg(pParse); sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol); sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd); VdbeComment((v, "GROUP BY sort")); VdbeCoverage(v); sAggInfo.useSortingIdx = 1; } /* If the index or temporary table used by the GROUP BY sort ** will naturally deliver rows in the order required by the ORDER BY ** clause, cancel the ephemeral table open coded earlier. ** ** This is an optimization - the correct answer should result regardless. |
︙ | ︙ | |||
128495 128496 128497 128498 128499 128500 128501 | /* Evaluate the current GROUP BY terms and store in b0, b1, b2... ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) ** Then compare the current GROUP BY terms against the GROUP BY terms ** from the previous row currently stored in a0, a1, a2... */ addrTopOfLoop = sqlite3VdbeCurrentAddr(v); | < | 128429 128430 128431 128432 128433 128434 128435 128436 128437 128438 128439 128440 128441 128442 | /* Evaluate the current GROUP BY terms and store in b0, b1, b2... ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) ** Then compare the current GROUP BY terms against the GROUP BY terms ** from the previous row currently stored in a0, a1, a2... */ addrTopOfLoop = sqlite3VdbeCurrentAddr(v); if( groupBySort ){ sqlite3VdbeAddOp3(v, OP_SorterData, sAggInfo.sortingIdx, sortOut, sortPTab); } for(j=0; j<pGroupBy->nExpr; j++){ if( groupBySort ){ sqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j); |
︙ | ︙ | |||
130712 130713 130714 130715 130716 130717 130718 | /* This branch loads the value of a column that will not be changed ** into a register. This is done if there are no BEFORE triggers, or ** if there are one or more BEFORE triggers that use this value via ** a new.* reference in a trigger program. */ testcase( i==31 ); testcase( i==32 ); | | < < < < < < | 130645 130646 130647 130648 130649 130650 130651 130652 130653 130654 130655 130656 130657 130658 130659 | /* This branch loads the value of a column that will not be changed ** into a register. This is done if there are no BEFORE triggers, or ** if there are one or more BEFORE triggers that use this value via ** a new.* reference in a trigger program. */ testcase( i==31 ); testcase( i==32 ); sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); }else{ sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i); } } } /* Fire any BEFORE UPDATE triggers. This happens before constraints are |
︙ | ︙ | |||
133846 133847 133848 133849 133850 133851 133852 | while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){ n--; } /* Code the OP_Affinity opcode if there is anything left to do. */ if( n>0 ){ sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n); | < | 133773 133774 133775 133776 133777 133778 133779 133780 133781 133782 133783 133784 133785 133786 | while( n>1 && zAff[n-1]==SQLITE_AFF_BLOB ){ n--; } /* Code the OP_Affinity opcode if there is anything left to do. */ if( n>0 ){ sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n); } } /* ** Expression pRight, which is the RHS of a comparison operation, is ** either a vector of n elements or, if n==1, a scalar expression. ** Before the comparison operation, affinity zAff is to be applied |
︙ | ︙ | |||
134382 134383 134384 134385 134386 134387 134388 | ** by pCCurHint.iTabCur, and an index is being used (which we will ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into ** an access of the index rather than the original table. */ static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ int rc = WRC_Continue; struct CCurHint *pHint = pWalker->u.pCCurHint; | | | 134308 134309 134310 134311 134312 134313 134314 134315 134316 134317 134318 134319 134320 134321 134322 | ** by pCCurHint.iTabCur, and an index is being used (which we will ** know because CCurHint.pIdx!=0) then transform the TK_COLUMN into ** an access of the index rather than the original table. */ static int codeCursorHintFixExpr(Walker *pWalker, Expr *pExpr){ int rc = WRC_Continue; struct CCurHint *pHint = pWalker->u.pCCurHint; if( pExpr->op==TK_COLUMN && !ExprHasProperty(pExpr, EP_FixedCol) ){ if( pExpr->iTable!=pHint->iTabCur ){ Vdbe *v = pWalker->pParse->pVdbe; int reg = ++pWalker->pParse->nMem; /* Register for column value */ sqlite3ExprCodeGetColumnOfTable( v, pExpr->pTab, pExpr->iTable, pExpr->iColumn, reg ); pExpr->op = TK_REGISTER; |
︙ | ︙ | |||
134755 134756 134757 134758 134759 134760 134761 | ** to access the data. */ int iReg; /* P3 Value for OP_VFilter */ int addrNotFound; int nConstraint = pLoop->nLTerm; int iIn; /* Counter for IN constraints */ | < | 134681 134682 134683 134684 134685 134686 134687 134688 134689 134690 134691 134692 134693 134694 | ** to access the data. */ int iReg; /* P3 Value for OP_VFilter */ int addrNotFound; int nConstraint = pLoop->nLTerm; int iIn; /* Counter for IN constraints */ iReg = sqlite3GetTempRange(pParse, nConstraint+2); addrNotFound = pLevel->addrBrk; for(j=0; j<nConstraint; j++){ int iTarget = iReg+j+2; pTerm = pLoop->aLTerm[j]; if( NEVER(pTerm==0) ) continue; if( pTerm->eOperator & WO_IN ){ |
︙ | ︙ | |||
134828 134829 134830 134831 134832 134833 134834 | /* These registers need to be preserved in case there is an IN operator ** loop. So we could deallocate the registers here (and potentially ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems ** simpler and safer to simply not reuse the registers. ** ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); */ | < | 134753 134754 134755 134756 134757 134758 134759 134760 134761 134762 134763 134764 134765 134766 | /* These registers need to be preserved in case there is an IN operator ** loop. So we could deallocate the registers here (and potentially ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems ** simpler and safer to simply not reuse the registers. ** ** sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); */ }else #endif /* SQLITE_OMIT_VIRTUALTABLE */ if( (pLoop->wsFlags & WHERE_IPK)!=0 && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0 ){ /* Case 2: We can directly reference a single row using an |
︙ | ︙ | |||
134852 134853 134854 134855 134856 134857 134858 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); | < < < | 134776 134777 134778 134779 134780 134781 134782 134783 134784 134785 134786 134787 134788 134789 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); iReleaseReg = ++pParse->nMem; iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); if( iRowidReg!=iReleaseReg ) sqlite3ReleaseTempReg(pParse, iReleaseReg); addrNxt = pLevel->addrNxt; sqlite3VdbeAddOp3(v, OP_SeekRowid, iCur, addrNxt, iRowidReg); VdbeCoverage(v); pLevel->op = OP_Noop; }else if( (pLoop->wsFlags & WHERE_IPK)!=0 && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 ){ /* Case 3: We have an inequality comparison against the ROWID field. */ int testOp = OP_Noop; |
︙ | ︙ | |||
134924 134925 134926 134927 134928 134929 134930 | } sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); VdbeComment((v, "pk")); VdbeCoverageIf(v, pX->op==TK_GT); VdbeCoverageIf(v, pX->op==TK_LE); VdbeCoverageIf(v, pX->op==TK_LT); VdbeCoverageIf(v, pX->op==TK_GE); | < | 134845 134846 134847 134848 134849 134850 134851 134852 134853 134854 134855 134856 134857 134858 | } sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); VdbeComment((v, "pk")); VdbeCoverageIf(v, pX->op==TK_GT); VdbeCoverageIf(v, pX->op==TK_LE); VdbeCoverageIf(v, pX->op==TK_LT); VdbeCoverageIf(v, pX->op==TK_GE); sqlite3ReleaseTempReg(pParse, rTemp); }else{ sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrHalt); VdbeCoverageIf(v, bRev==0); VdbeCoverageIf(v, bRev!=0); } if( pEnd ){ |
︙ | ︙ | |||
134959 134960 134961 134962 134963 134964 134965 | pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; assert( pLevel->p5==0 ); if( testOp!=OP_Noop ){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg); | < | 134879 134880 134881 134882 134883 134884 134885 134886 134887 134888 134889 134890 134891 134892 | pLevel->op = bRev ? OP_Prev : OP_Next; pLevel->p1 = iCur; pLevel->p2 = start; assert( pLevel->p5==0 ); if( testOp!=OP_Noop ){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg); sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); VdbeCoverageIf(v, testOp==OP_Le); VdbeCoverageIf(v, testOp==OP_Lt); VdbeCoverageIf(v, testOp==OP_Ge); VdbeCoverageIf(v, testOp==OP_Gt); sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL); } |
︙ | ︙ | |||
135185 135186 135187 135188 135189 135190 135191 | /* Load the value for the inequality constraint at the end of the ** range (if any). */ nConstraint = nEq; if( pRangeEnd ){ Expr *pRight = pRangeEnd->pExpr->pRight; | < | 135104 135105 135106 135107 135108 135109 135110 135111 135112 135113 135114 135115 135116 135117 | /* Load the value for the inequality constraint at the end of the ** range (if any). */ nConstraint = nEq; if( pRangeEnd ){ Expr *pRight = pRangeEnd->pExpr->pRight; codeExprOrVector(pParse, pRight, regBase+nEq, nTop); whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); if( (pRangeEnd->wtFlags & TERM_VNULL)==0 && sqlite3ExprCanBeNull(pRight) ){ sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); VdbeCoverage(v); |
︙ | ︙ | |||
135210 135211 135212 135213 135214 135215 135216 | if( sqlite3ExprIsVector(pRight)==0 ){ disableTerm(pLevel, pRangeEnd); }else{ endEq = 1; } }else if( bStopAtNull ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); | < | 135128 135129 135130 135131 135132 135133 135134 135135 135136 135137 135138 135139 135140 135141 | if( sqlite3ExprIsVector(pRight)==0 ){ disableTerm(pLevel, pRangeEnd); }else{ endEq = 1; } }else if( bStopAtNull ){ sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); endEq = 0; nConstraint++; } sqlite3DbFree(db, zStartAff); sqlite3DbFree(db, zEndAff); /* Top of the loop body */ |
︙ | ︙ | |||
135244 135245 135246 135247 135248 135249 135250 | }else if( HasRowid(pIdx->pTable) ){ if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE) || ( (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE) && (pWInfo->eOnePass==ONEPASS_SINGLE) )){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); | < | 135161 135162 135163 135164 135165 135166 135167 135168 135169 135170 135171 135172 135173 135174 | }else if( HasRowid(pIdx->pTable) ){ if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE) || ( (pWInfo->wctrlFlags & WHERE_SEEK_UNIQ_TABLE) && (pWInfo->eOnePass==ONEPASS_SINGLE) )){ iRowidReg = ++pParse->nMem; sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, iRowidReg); VdbeCoverage(v); }else{ codeDeferredSeek(pWInfo, pIdx, iCur, iIdxCur); } }else if( iCur!=iIdxCur ){ Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); |
︙ | ︙ | |||
135479 135480 135481 135482 135483 135484 135485 | /* This is the sub-WHERE clause body. First skip over ** duplicate rows from prior sub-WHERE clauses, and record the ** rowid (or PRIMARY KEY) for the current row so that the same ** row will be skipped in subsequent sub-WHERE clauses. */ if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ | < | | > | | 135395 135396 135397 135398 135399 135400 135401 135402 135403 135404 135405 135406 135407 135408 135409 135410 135411 135412 135413 135414 135415 135416 135417 135418 135419 135420 135421 135422 135423 135424 135425 | /* This is the sub-WHERE clause body. First skip over ** duplicate rows from prior sub-WHERE clauses, and record the ** rowid (or PRIMARY KEY) for the current row so that the same ** row will be skipped in subsequent sub-WHERE clauses. */ if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ int iSet = ((ii==pOrWc->nTerm-1)?-1:ii); if( HasRowid(pTab) ){ sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, -1, regRowid); jmp1 = sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, 0, regRowid, iSet); VdbeCoverage(v); }else{ Index *pPk = sqlite3PrimaryKeyIndex(pTab); int nPk = pPk->nKeyCol; int iPk; int r; /* Read the PK into an array of temp registers. */ r = sqlite3GetTempRange(pParse, nPk); for(iPk=0; iPk<nPk; iPk++){ int iCol = pPk->aiColumn[iPk]; sqlite3ExprCodeGetColumnOfTable(v, pTab, iCur, iCol, r+iPk); } /* Check if the temp table already contains this key. If so, ** the row has already been included in the result set and ** can be ignored (by jumping past the Gosub below). Otherwise, ** insert the key into the temp table and proceed with processing ** the row. |
︙ | ︙ | |||
135728 135729 135730 135731 135732 135733 135734 | /* For a LEFT OUTER JOIN, generate code that will record the fact that ** at least one row of the right table has matched the left table. */ if( pLevel->iLeftJoin ){ pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); VdbeComment((v, "record LEFT JOIN hit")); | < | 135644 135645 135646 135647 135648 135649 135650 135651 135652 135653 135654 135655 135656 135657 | /* For a LEFT OUTER JOIN, generate code that will record the fact that ** at least one row of the right table has matched the left table. */ if( pLevel->iLeftJoin ){ pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); VdbeComment((v, "record LEFT JOIN hit")); for(pTerm=pWC->a, j=0; j<pWC->nTerm; j++, pTerm++){ testcase( pTerm->wtFlags & TERM_VIRTUAL ); testcase( pTerm->wtFlags & TERM_CODED ); if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ assert( pWInfo->untestedTerms ); continue; |
︙ | ︙ | |||
135944 135945 135946 135947 135948 135949 135950 | static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ | | | | | | 135859 135860 135861 135862 135863 135864 135865 135866 135867 135868 135869 135870 135871 135872 135873 135874 135875 135876 135877 135878 135879 135880 135881 135882 135883 135884 | static int isLikeOrGlob( Parse *pParse, /* Parsing and code generating context */ Expr *pExpr, /* Test this expression */ Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ int *pisComplete, /* True if the only wildcard is % in the last character */ int *pnoCase /* True if uppercase is equivalent to lowercase */ ){ const u8 *z = 0; /* String on RHS of LIKE operator */ Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ ExprList *pList; /* List of operands to the LIKE operator */ u8 c; /* One character in z[] */ int cnt; /* Number of non-wildcard prefix characters */ u8 wc[4]; /* Wildcard characters */ sqlite3 *db = pParse->db; /* Database connection */ sqlite3_value *pVal = 0; int op; /* Opcode of pRight */ int rc; /* Result code to return */ if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, (char*)wc) ){ return 0; } #ifdef SQLITE_EBCDIC if( *pnoCase ) return 0; #endif pList = pExpr->x.pList; pLeft = pList->a[1].pExpr; |
︙ | ︙ | |||
136609 136610 136611 136612 136613 136614 136615 | aff2 = sqlite3ExprAffinity(pExpr->pRight); if( aff1!=aff2 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2)) ){ return 0; } pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); | | | 136524 136525 136526 136527 136528 136529 136530 136531 136532 136533 136534 136535 136536 136537 136538 | aff2 = sqlite3ExprAffinity(pExpr->pRight); if( aff1!=aff2 && (!sqlite3IsNumericAffinity(aff1) || !sqlite3IsNumericAffinity(aff2)) ){ return 0; } pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight); if( sqlite3IsBinary(pColl) ) return 1; return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight); } /* ** Recursively walk the expressions of a SELECT statement and generate ** a bitmask indicating which tables are used in that expression ** tree. |
︙ | ︙ | |||
136950 136951 136952 136953 136954 136955 136956 | ** LIKE on all candidate expressions by clearing the isComplete flag */ if( c=='A'-1 ) isComplete = 0; c = sqlite3UpperToLower[c]; } *pC = c + 1; } | | | 136865 136866 136867 136868 136869 136870 136871 136872 136873 136874 136875 136876 136877 136878 136879 | ** LIKE on all candidate expressions by clearing the isComplete flag */ if( c=='A'-1 ) isComplete = 0; c = sqlite3UpperToLower[c]; } *pC = c + 1; } zCollSeqName = noCase ? "NOCASE" : sqlite3StrBINARY; pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); pNewExpr1 = sqlite3PExpr(pParse, TK_GE, sqlite3ExprAddCollateString(pParse,pNewExpr1,zCollSeqName), pStr1); transferJoinMarkings(pNewExpr1, pExpr); idxNew1 = whereClauseInsert(pWC, pNewExpr1, wtFlags); testcase( idxNew1==0 ); |
︙ | ︙ | |||
137200 137201 137202 137203 137204 137205 137206 | /* ** These routines walk (recursively) an expression tree and generate ** a bitmask indicating which tables are used in that expression ** tree. */ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ Bitmask mask; | | | 137115 137116 137117 137118 137119 137120 137121 137122 137123 137124 137125 137126 137127 137128 137129 | /* ** These routines walk (recursively) an expression tree and generate ** a bitmask indicating which tables are used in that expression ** tree. */ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsageNN(WhereMaskSet *pMaskSet, Expr *p){ Bitmask mask; if( p->op==TK_COLUMN && !ExprHasProperty(p, EP_FixedCol) ){ return sqlite3WhereGetMask(pMaskSet, p->iTable); }else if( ExprHasProperty(p, EP_TokenOnly|EP_Leaf) ){ assert( p->op!=TK_IF_NULL_ROW ); return 0; } mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0; if( p->pLeft ) mask |= sqlite3WhereExprUsageNN(pMaskSet, p->pLeft); |
︙ | ︙ | |||
138098 138099 138100 138101 138102 138103 138104 | assert( pLevel->iIdxCur>=0 ); pLevel->iIdxCur = pParse->nTab++; sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); /* Fill the automatic index with content */ | < | 138013 138014 138015 138016 138017 138018 138019 138020 138021 138022 138023 138024 138025 138026 | assert( pLevel->iIdxCur>=0 ); pLevel->iIdxCur = pParse->nTab++; sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, "for %s", pTable->zName)); /* Fill the automatic index with content */ pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom]; if( pTabItem->fg.viaCoroutine ){ int regYield = pTabItem->regReturn; addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0); sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub); addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield); VdbeCoverage(v); |
︙ | ︙ | |||
138135 138136 138137 138138 138139 138140 138141 | pTabItem->fg.viaCoroutine = 0; }else{ sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); } sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); sqlite3VdbeJumpHere(v, addrTop); sqlite3ReleaseTempReg(pParse, regRecord); | < | 138049 138050 138051 138052 138053 138054 138055 138056 138057 138058 138059 138060 138061 138062 | pTabItem->fg.viaCoroutine = 0; }else{ sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v); } sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); sqlite3VdbeJumpHere(v, addrTop); sqlite3ReleaseTempReg(pParse, regRecord); /* Jump here when skipping the initialization */ sqlite3VdbeJumpHere(v, addrInit); end_auto_index_create: sqlite3ExprDelete(pParse->db, pPartial); } |
︙ | ︙ | |||
140501 140502 140503 140504 140505 140506 140507 | if( iCons>=0 && iCons<pIdxInfo->nConstraint ){ CollSeq *pC = 0; int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset; Expr *pX = pHidden->pWC->a[iTerm].pExpr; if( pX->pLeft ){ pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight); } | | | 140414 140415 140416 140417 140418 140419 140420 140421 140422 140423 140424 140425 140426 140427 140428 | if( iCons>=0 && iCons<pIdxInfo->nConstraint ){ CollSeq *pC = 0; int iTerm = pIdxInfo->aConstraint[iCons].iTermOffset; Expr *pX = pHidden->pWC->a[iTerm].pExpr; if( pX->pLeft ){ pC = sqlite3BinaryCompareCollSeq(pHidden->pParse, pX->pLeft, pX->pRight); } zRet = (pC ? pC->zName : sqlite3StrBINARY); } return zRet; } /* ** Add all WhereLoop objects for a table of the join identified by ** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. |
︙ | ︙ | |||
141352 141353 141354 141355 141356 141357 141358 | } if( isOrdered>=0 && isOrdered<nOrderBy ){ if( aSortCost[isOrdered]==0 ){ aSortCost[isOrdered] = whereSortingCost( pWInfo, nRowEst, nOrderBy, isOrdered ); } | > > > > | | 141265 141266 141267 141268 141269 141270 141271 141272 141273 141274 141275 141276 141277 141278 141279 141280 141281 141282 141283 | } if( isOrdered>=0 && isOrdered<nOrderBy ){ if( aSortCost[isOrdered]==0 ){ aSortCost[isOrdered] = whereSortingCost( pWInfo, nRowEst, nOrderBy, isOrdered ); } /* TUNING: Add a small extra penalty (5) to sorting as an ** extra encouragment to the query planner to select a plan ** where the rows emerge in the correct order without any sorting ** required. */ rCost = sqlite3LogEstAdd(rUnsorted, aSortCost[isOrdered]) + 5; WHERETRACE(0x002, ("---- sort cost=%-3d (%d/%d) increases cost %3d to %-3d\n", aSortCost[isOrdered], (nOrderBy-isOrdered), nOrderBy, rUnsorted, rCost)); }else{ rCost = rUnsorted; |
︙ | ︙ | |||
142369 142370 142371 142372 142373 142374 142375 | WhereLoop *pLoop; SrcList *pTabList = pWInfo->pTabList; sqlite3 *db = pParse->db; /* Generate loop termination code. */ VdbeModuleComment((v, "End WHERE-core")); | < | 142286 142287 142288 142289 142290 142291 142292 142293 142294 142295 142296 142297 142298 142299 | WhereLoop *pLoop; SrcList *pTabList = pWInfo->pTabList; sqlite3 *db = pParse->db; /* Generate loop termination code. */ VdbeModuleComment((v, "End WHERE-core")); for(i=pWInfo->nLevel-1; i>=0; i--){ int addr; pLevel = &pWInfo->a[i]; pLoop = pLevel->pWLoop; if( pLevel->op!=OP_Noop ){ #ifndef SQLITE_DISABLE_SKIPAHEAD_DISTINCT int addrSeek = 0; |
︙ | ︙ | |||
143534 143535 143536 143537 143538 143539 143540 | } /* ** Attach window object pWin to expression p. */ SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ if( p ){ | > > > | | 143450 143451 143452 143453 143454 143455 143456 143457 143458 143459 143460 143461 143462 143463 143464 143465 143466 143467 | } /* ** Attach window object pWin to expression p. */ SQLITE_PRIVATE void sqlite3WindowAttach(Parse *pParse, Expr *p, Window *pWin){ if( p ){ /* This routine is only called for the parser. If pWin was not ** allocated due to an OOM, then the parser would fail before ever ** invoking this routine */ if( ALWAYS(pWin) ){ p->pWin = pWin; pWin->pOwner = p; if( p->flags & EP_Distinct ){ sqlite3ErrorMsg(pParse, "DISTINCT is not supported for window functions"); } } |
︙ | ︙ | |||
145093 145094 145095 145096 145097 145098 145099 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 | | | | | | | | | | | | 145012 145013 145014 145015 145016 145017 145018 145019 145020 145021 145022 145023 145024 145025 145026 145027 145028 145029 145030 145031 145032 145033 145034 145035 145036 | #define sqlite3ParserARG_STORE #define sqlite3ParserCTX_SDECL Parse *pParse; #define sqlite3ParserCTX_PDECL ,Parse *pParse #define sqlite3ParserCTX_PARAM ,pParse #define sqlite3ParserCTX_FETCH Parse *pParse=yypParser->pParse; #define sqlite3ParserCTX_STORE yypParser->pParse=pParse; #define YYFALLBACK 1 #define YYNSTATE 518 #define YYNRULE 366 #define YYNTOKEN 155 #define YY_MAX_SHIFT 517 #define YY_MIN_SHIFTREDUCE 752 #define YY_MAX_SHIFTREDUCE 1117 #define YY_ERROR_ACTION 1118 #define YY_ACCEPT_ACTION 1119 #define YY_NO_ACTION 1120 #define YY_MIN_REDUCE 1121 #define YY_MAX_REDUCE 1486 /************* End control #defines *******************************************/ #define YY_NLOOKAHEAD ((int)(sizeof(yy_lookahead)/sizeof(yy_lookahead[0]))) /* Define the yytestcase() macro to be a no-op if is not already defined ** otherwise. ** ** Applications can choose to define yytestcase() in the %include section |
︙ | ︙ | |||
145172 145173 145174 145175 145176 145177 145178 | ** 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. ** *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2009) static const YYACTIONTYPE yy_action[] = { | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 145091 145092 145093 145094 145095 145096 145097 145098 145099 145100 145101 145102 145103 145104 145105 145106 145107 145108 145109 145110 145111 145112 145113 145114 145115 145116 145117 145118 145119 145120 145121 145122 145123 145124 145125 145126 145127 145128 145129 145130 145131 145132 145133 145134 145135 145136 145137 145138 145139 145140 145141 145142 145143 145144 145145 145146 145147 145148 145149 145150 145151 145152 145153 145154 145155 145156 145157 145158 145159 145160 145161 145162 145163 145164 145165 145166 145167 145168 145169 145170 145171 145172 145173 145174 145175 145176 145177 145178 145179 145180 145181 145182 145183 145184 145185 145186 145187 145188 145189 145190 145191 145192 145193 145194 145195 145196 145197 145198 145199 145200 145201 145202 145203 145204 145205 145206 145207 145208 145209 145210 145211 145212 145213 145214 145215 145216 145217 145218 145219 145220 145221 145222 145223 145224 145225 145226 145227 145228 145229 145230 145231 145232 145233 145234 145235 145236 145237 145238 145239 145240 145241 145242 145243 145244 145245 145246 145247 145248 145249 145250 145251 145252 145253 145254 145255 145256 145257 145258 145259 145260 145261 145262 145263 145264 145265 145266 145267 145268 145269 145270 145271 145272 145273 145274 145275 145276 145277 145278 145279 145280 145281 145282 145283 145284 145285 145286 145287 145288 145289 145290 145291 145292 145293 145294 145295 145296 145297 145298 145299 145300 145301 145302 145303 145304 145305 145306 145307 145308 145309 145310 145311 145312 145313 145314 145315 145316 145317 145318 145319 145320 145321 145322 145323 145324 145325 145326 145327 145328 145329 145330 145331 145332 145333 145334 145335 145336 145337 145338 145339 145340 145341 145342 145343 145344 145345 145346 145347 145348 145349 145350 145351 145352 145353 145354 145355 145356 145357 145358 145359 145360 145361 145362 145363 145364 145365 145366 145367 145368 145369 145370 145371 145372 145373 145374 145375 145376 145377 145378 145379 145380 145381 145382 145383 145384 145385 145386 145387 145388 145389 145390 145391 145392 145393 145394 145395 145396 145397 145398 145399 145400 145401 145402 145403 145404 145405 145406 145407 145408 145409 145410 145411 145412 145413 145414 145415 145416 145417 145418 145419 145420 145421 145422 145423 145424 145425 145426 145427 145428 145429 145430 145431 145432 145433 145434 145435 145436 145437 145438 145439 145440 145441 145442 145443 145444 145445 145446 145447 145448 145449 145450 145451 145452 145453 145454 145455 145456 145457 145458 145459 145460 145461 145462 145463 145464 145465 145466 145467 145468 145469 145470 145471 145472 145473 145474 145475 145476 145477 145478 145479 145480 145481 145482 145483 145484 145485 | ** 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. ** *********** Begin parsing tables **********************************************/ #define YY_ACTTAB_COUNT (2009) static const YYACTIONTYPE yy_action[] = { /* 0 */ 365, 105, 102, 197, 105, 102, 197, 512, 1119, 1, /* 10 */ 1, 517, 2, 1123, 512, 1187, 1166, 1450, 272, 367, /* 20 */ 127, 1384, 1192, 1192, 1187, 1161, 178, 1200, 64, 64, /* 30 */ 474, 883, 319, 425, 345, 37, 37, 804, 359, 884, /* 40 */ 506, 506, 506, 112, 113, 103, 1095, 1095, 949, 952, /* 50 */ 942, 942, 110, 110, 111, 111, 111, 111, 362, 250, /* 60 */ 250, 512, 250, 250, 494, 512, 306, 512, 456, 512, /* 70 */ 1074, 488, 509, 475, 6, 509, 805, 134, 495, 226, /* 80 */ 194, 425, 37, 37, 512, 206, 64, 64, 64, 64, /* 90 */ 13, 13, 109, 109, 109, 109, 108, 108, 107, 107, /* 100 */ 107, 106, 398, 255, 378, 13, 13, 395, 394, 425, /* 110 */ 250, 250, 367, 473, 402, 1099, 1074, 1075, 1076, 383, /* 120 */ 1101, 387, 494, 509, 494, 1417, 1413, 301, 1100, 304, /* 130 */ 1251, 493, 367, 496, 16, 16, 112, 113, 103, 1095, /* 140 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, /* 150 */ 111, 259, 1102, 492, 1102, 398, 112, 113, 103, 1095, /* 160 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, /* 170 */ 111, 129, 1419, 340, 1414, 336, 1054, 489, 1052, 260, /* 180 */ 73, 105, 102, 197, 990, 109, 109, 109, 109, 108, /* 190 */ 108, 107, 107, 107, 106, 398, 367, 111, 111, 111, /* 200 */ 111, 104, 489, 89, 1426, 109, 109, 109, 109, 108, /* 210 */ 108, 107, 107, 107, 106, 398, 111, 111, 111, 111, /* 220 */ 112, 113, 103, 1095, 1095, 949, 952, 942, 942, 110, /* 230 */ 110, 111, 111, 111, 111, 109, 109, 109, 109, 108, /* 240 */ 108, 107, 107, 107, 106, 398, 114, 108, 108, 107, /* 250 */ 107, 107, 106, 398, 109, 109, 109, 109, 108, 108, /* 260 */ 107, 107, 107, 106, 398, 152, 396, 396, 396, 109, /* 270 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, /* 280 */ 178, 490, 1406, 431, 1032, 1480, 1074, 512, 1480, 367, /* 290 */ 418, 294, 354, 409, 74, 1074, 109, 109, 109, 109, /* 300 */ 108, 108, 107, 107, 107, 106, 398, 1407, 37, 37, /* 310 */ 1425, 271, 503, 112, 113, 103, 1095, 1095, 949, 952, /* 320 */ 942, 942, 110, 110, 111, 111, 111, 111, 1430, 517, /* 330 */ 2, 1123, 1074, 1075, 1076, 427, 272, 1074, 127, 363, /* 340 */ 929, 1074, 1075, 1076, 218, 1200, 909, 455, 452, 451, /* 350 */ 389, 167, 512, 1030, 152, 442, 920, 450, 152, 870, /* 360 */ 919, 286, 109, 109, 109, 109, 108, 108, 107, 107, /* 370 */ 107, 106, 398, 13, 13, 258, 849, 250, 250, 225, /* 380 */ 106, 398, 367, 1074, 1075, 1076, 308, 385, 1074, 293, /* 390 */ 509, 919, 919, 921, 229, 320, 1250, 1383, 1417, 487, /* 400 */ 271, 503, 12, 206, 271, 503, 112, 113, 103, 1095, /* 410 */ 1095, 949, 952, 942, 942, 110, 110, 111, 111, 111, /* 420 */ 111, 1434, 283, 1123, 285, 1074, 1092, 245, 272, 1093, /* 430 */ 127, 384, 402, 386, 1074, 1075, 1076, 1200, 159, 236, /* 440 */ 253, 318, 458, 313, 457, 223, 786, 105, 102, 197, /* 450 */ 510, 311, 838, 838, 442, 109, 109, 109, 109, 108, /* 460 */ 108, 107, 107, 107, 106, 398, 512, 511, 512, 250, /* 470 */ 250, 1074, 1075, 1076, 432, 367, 1093, 929, 1454, 790, /* 480 */ 271, 503, 509, 105, 102, 197, 333, 63, 63, 64, /* 490 */ 64, 27, 786, 920, 284, 206, 1349, 919, 512, 112, /* 500 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, /* 510 */ 111, 111, 111, 111, 107, 107, 107, 106, 398, 49, /* 520 */ 49, 512, 28, 1074, 402, 494, 418, 294, 919, 919, /* 530 */ 921, 186, 465, 1074, 464, 995, 995, 439, 512, 1074, /* 540 */ 331, 512, 45, 45, 1078, 339, 173, 168, 109, 109, /* 550 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 13, /* 560 */ 13, 203, 13, 13, 250, 250, 1190, 1190, 367, 1074, /* 570 */ 1075, 1076, 783, 262, 5, 356, 491, 509, 466, 1074, /* 580 */ 1075, 1076, 395, 394, 1074, 1074, 1075, 1076, 3, 279, /* 590 */ 1074, 1078, 112, 113, 103, 1095, 1095, 949, 952, 942, /* 600 */ 942, 110, 110, 111, 111, 111, 111, 250, 250, 1011, /* 610 */ 218, 1074, 869, 455, 452, 451, 939, 939, 950, 953, /* 620 */ 509, 250, 250, 450, 1012, 1074, 442, 1102, 1204, 1102, /* 630 */ 1074, 1075, 1076, 512, 509, 423, 1074, 1075, 1076, 1013, /* 640 */ 509, 109, 109, 109, 109, 108, 108, 107, 107, 107, /* 650 */ 106, 398, 1047, 512, 50, 50, 512, 1074, 1075, 1076, /* 660 */ 824, 367, 1046, 376, 408, 1059, 1353, 205, 405, 769, /* 670 */ 825, 1074, 1075, 1076, 64, 64, 319, 64, 64, 1297, /* 680 */ 943, 408, 407, 1353, 1355, 112, 113, 103, 1095, 1095, /* 690 */ 949, 952, 942, 942, 110, 110, 111, 111, 111, 111, /* 700 */ 291, 479, 512, 1032, 1481, 512, 431, 1481, 351, 1115, /* 710 */ 480, 992, 909, 482, 463, 992, 132, 178, 33, 447, /* 720 */ 1198, 136, 403, 64, 64, 476, 64, 64, 416, 366, /* 730 */ 280, 1141, 250, 250, 109, 109, 109, 109, 108, 108, /* 740 */ 107, 107, 107, 106, 398, 509, 222, 437, 408, 263, /* 750 */ 1353, 263, 250, 250, 367, 293, 413, 281, 930, 393, /* 760 */ 972, 467, 397, 250, 250, 509, 9, 470, 229, 497, /* 770 */ 351, 1031, 1030, 1482, 352, 371, 509, 1116, 112, 113, /* 780 */ 103, 1095, 1095, 949, 952, 942, 942, 110, 110, 111, /* 790 */ 111, 111, 111, 250, 250, 1011, 512, 1342, 292, 250, /* 800 */ 250, 250, 250, 1093, 372, 247, 509, 442, 868, 319, /* 810 */ 1012, 477, 509, 195, 509, 431, 270, 15, 15, 512, /* 820 */ 311, 512, 95, 512, 93, 1013, 364, 109, 109, 109, /* 830 */ 109, 108, 108, 107, 107, 107, 106, 398, 512, 1116, /* 840 */ 39, 39, 51, 51, 52, 52, 500, 367, 512, 1199, /* 850 */ 1093, 914, 436, 338, 133, 433, 221, 220, 219, 53, /* 860 */ 53, 319, 1392, 757, 758, 759, 512, 367, 88, 54, /* 870 */ 54, 112, 113, 103, 1095, 1095, 949, 952, 942, 942, /* 880 */ 110, 110, 111, 111, 111, 111, 274, 55, 55, 196, /* 890 */ 512, 112, 113, 103, 1095, 1095, 949, 952, 942, 942, /* 900 */ 110, 110, 111, 111, 111, 111, 135, 261, 1144, 373, /* 910 */ 512, 40, 40, 512, 868, 512, 989, 512, 989, 116, /* 920 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, /* 930 */ 398, 41, 41, 512, 43, 43, 44, 44, 56, 56, /* 940 */ 109, 109, 109, 109, 108, 108, 107, 107, 107, 106, /* 950 */ 398, 512, 376, 512, 57, 57, 512, 795, 512, 376, /* 960 */ 512, 442, 793, 512, 320, 512, 275, 512, 1453, 512, /* 970 */ 1282, 813, 58, 58, 14, 14, 512, 59, 59, 118, /* 980 */ 118, 60, 60, 512, 46, 46, 61, 61, 62, 62, /* 990 */ 47, 47, 512, 190, 189, 91, 512, 140, 140, 512, /* 1000 */ 391, 512, 844, 1195, 141, 141, 512, 843, 512, 793, /* 1010 */ 512, 410, 512, 69, 69, 367, 278, 48, 48, 256, /* 1020 */ 65, 65, 119, 119, 244, 244, 257, 66, 66, 120, /* 1030 */ 120, 121, 121, 117, 117, 367, 512, 509, 380, 112, /* 1040 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, /* 1050 */ 111, 111, 111, 111, 512, 868, 512, 139, 139, 112, /* 1060 */ 113, 103, 1095, 1095, 949, 952, 942, 942, 110, 110, /* 1070 */ 111, 111, 111, 111, 1282, 138, 138, 125, 125, 512, /* 1080 */ 12, 512, 1351, 1282, 512, 442, 131, 1282, 109, 109, /* 1090 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512, /* 1100 */ 124, 124, 122, 122, 512, 123, 123, 512, 109, 109, /* 1110 */ 109, 109, 108, 108, 107, 107, 107, 106, 398, 512, /* 1120 */ 68, 68, 460, 779, 512, 70, 70, 299, 67, 67, /* 1130 */ 1027, 251, 251, 353, 1282, 191, 196, 1427, 462, 1296, /* 1140 */ 38, 38, 381, 94, 509, 42, 42, 177, 844, 271, /* 1150 */ 503, 382, 417, 843, 420, 438, 505, 373, 374, 153, /* 1160 */ 252, 868, 429, 367, 222, 249, 194, 883, 182, 290, /* 1170 */ 779, 988, 88, 988, 463, 884, 906, 911, 424, 426, /* 1180 */ 228, 228, 228, 367, 17, 803, 802, 112, 113, 103, /* 1190 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111, /* 1200 */ 111, 111, 392, 295, 810, 811, 88, 112, 101, 103, /* 1210 */ 1095, 1095, 949, 952, 942, 942, 110, 110, 111, 111, /* 1220 */ 111, 111, 372, 419, 448, 309, 979, 224, 88, 975, /* 1230 */ 877, 841, 224, 228, 100, 923, 109, 109, 109, 109, /* 1240 */ 108, 108, 107, 107, 107, 106, 398, 86, 430, 777, /* 1250 */ 842, 1236, 130, 100, 1235, 412, 109, 109, 109, 109, /* 1260 */ 108, 108, 107, 107, 107, 106, 398, 317, 1443, 1397, /* 1270 */ 1170, 287, 1169, 979, 1372, 1371, 367, 316, 434, 296, /* 1280 */ 1232, 1223, 923, 300, 303, 305, 307, 1183, 1168, 1167, /* 1290 */ 312, 321, 322, 1244, 1281, 1219, 367, 268, 1230, 499, /* 1300 */ 498, 113, 103, 1095, 1095, 949, 952, 942, 942, 110, /* 1310 */ 110, 111, 111, 111, 111, 1287, 1150, 443, 242, 184, /* 1320 */ 1216, 1143, 103, 1095, 1095, 949, 952, 942, 942, 110, /* 1330 */ 110, 111, 111, 111, 111, 1132, 1131, 1133, 1437, 350, /* 1340 */ 411, 324, 188, 98, 504, 289, 4, 326, 315, 109, /* 1350 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, /* 1360 */ 507, 328, 1266, 1274, 358, 453, 282, 192, 1346, 109, /* 1370 */ 109, 109, 109, 108, 108, 107, 107, 107, 106, 398, /* 1380 */ 11, 1166, 1345, 399, 1440, 330, 502, 1110, 231, 428, /* 1390 */ 1391, 343, 187, 98, 504, 501, 4, 1107, 1389, 375, /* 1400 */ 422, 155, 72, 165, 75, 152, 149, 86, 414, 1263, /* 1410 */ 507, 157, 415, 160, 929, 161, 162, 163, 446, 1271, /* 1420 */ 96, 96, 8, 30, 208, 1277, 357, 97, 355, 399, /* 1430 */ 514, 513, 421, 399, 919, 31, 169, 435, 1340, 212, /* 1440 */ 80, 441, 243, 214, 1360, 501, 298, 174, 444, 302, /* 1450 */ 215, 271, 503, 1134, 216, 360, 485, 459, 388, 1186, /* 1460 */ 361, 484, 1185, 795, 929, 919, 919, 921, 922, 24, /* 1470 */ 96, 96, 1184, 1158, 1177, 314, 1157, 97, 1176, 399, /* 1480 */ 514, 513, 469, 1156, 919, 1452, 390, 266, 98, 504, /* 1490 */ 267, 4, 472, 478, 483, 85, 1227, 333, 230, 492, /* 1500 */ 1408, 332, 323, 115, 10, 507, 1228, 181, 335, 98, /* 1510 */ 504, 337, 4, 92, 87, 919, 919, 921, 922, 24, /* 1520 */ 1429, 1063, 401, 1226, 481, 254, 507, 325, 399, 327, /* 1530 */ 349, 349, 348, 239, 346, 1225, 329, 766, 1209, 1326, /* 1540 */ 501, 183, 1208, 341, 269, 342, 237, 1069, 1140, 399, /* 1550 */ 199, 485, 277, 29, 515, 241, 486, 238, 516, 929, /* 1560 */ 276, 501, 240, 1129, 1124, 96, 96, 1376, 142, 154, /* 1570 */ 369, 370, 97, 143, 399, 514, 513, 1377, 128, 919, /* 1580 */ 929, 1375, 144, 753, 400, 1374, 96, 96, 848, 1154, /* 1590 */ 201, 1153, 185, 97, 264, 399, 514, 513, 202, 71, /* 1600 */ 919, 146, 1151, 273, 198, 404, 126, 987, 200, 985, /* 1610 */ 919, 919, 921, 922, 24, 903, 156, 145, 204, 158, /* 1620 */ 827, 98, 504, 288, 4, 207, 1001, 164, 147, 907, /* 1630 */ 377, 919, 919, 921, 922, 24, 379, 148, 507, 166, /* 1640 */ 76, 77, 368, 1004, 78, 79, 209, 271, 503, 210, /* 1650 */ 1000, 137, 18, 297, 211, 228, 440, 1104, 213, 171, /* 1660 */ 32, 399, 768, 993, 170, 316, 445, 217, 449, 806, /* 1670 */ 406, 310, 172, 501, 81, 19, 20, 454, 82, 83, /* 1680 */ 265, 150, 179, 461, 485, 151, 180, 955, 84, 484, /* 1690 */ 1035, 34, 929, 35, 468, 1036, 193, 471, 96, 96, /* 1700 */ 246, 248, 876, 175, 871, 97, 100, 399, 514, 513, /* 1710 */ 1063, 401, 919, 227, 254, 1053, 21, 22, 1049, 349, /* 1720 */ 349, 348, 239, 346, 1040, 176, 766, 334, 1051, 7, /* 1730 */ 88, 98, 504, 970, 4, 233, 23, 956, 954, 199, /* 1740 */ 958, 277, 1010, 919, 919, 921, 922, 24, 507, 276, /* 1750 */ 232, 1009, 959, 25, 36, 508, 924, 778, 99, 26, /* 1760 */ 347, 90, 504, 837, 4, 234, 344, 235, 1445, 1064, /* 1770 */ 1120, 399, 1120, 1444, 1120, 1120, 1120, 1120, 507, 201, /* 1780 */ 1120, 1120, 1120, 501, 1120, 1120, 1120, 202, 1120, 1120, /* 1790 */ 146, 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, /* 1800 */ 1120, 399, 929, 1120, 1120, 1120, 1120, 1120, 96, 96, /* 1810 */ 1120, 1120, 1120, 501, 1120, 97, 1120, 399, 514, 513, /* 1820 */ 1120, 1120, 919, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1830 */ 1120, 368, 929, 1120, 1120, 1120, 271, 503, 96, 96, /* 1840 */ 1120, 1120, 1120, 1120, 1120, 97, 1120, 399, 514, 513, /* 1850 */ 1120, 1120, 919, 919, 919, 921, 922, 24, 1120, 406, /* 1860 */ 1120, 1120, 1120, 254, 1120, 1120, 1120, 1120, 349, 349, /* 1870 */ 348, 239, 346, 1120, 1120, 766, 1120, 1120, 1120, 1120, /* 1880 */ 1120, 1120, 1120, 919, 919, 921, 922, 24, 199, 1120, /* 1890 */ 277, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 276, 1120, /* 1900 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1910 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1920 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 201, 1120, /* 1930 */ 1120, 1120, 1120, 1120, 1120, 1120, 202, 1120, 1120, 146, /* 1940 */ 1120, 1120, 1120, 1120, 1120, 1120, 200, 1120, 1120, 1120, /* 1950 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1960 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1970 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 1980 */ 368, 1120, 1120, 1120, 1120, 271, 503, 1120, 1120, 1120, /* 1990 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, /* 2000 */ 1120, 1120, 1120, 1120, 1120, 1120, 1120, 1120, 406, }; static const YYCODETYPE yy_lookahead[] = { /* 0 */ 184, 238, 239, 240, 238, 239, 240, 163, 155, 156, /* 10 */ 157, 158, 159, 160, 163, 191, 192, 183, 165, 19, /* 20 */ 167, 258, 202, 203, 200, 191, 163, 174, 184, 185, /* 30 */ 174, 31, 163, 163, 171, 184, 185, 35, 175, 39, /* 40 */ 179, 180, 181, 43, 44, 45, 46, 47, 48, 49, /* 50 */ 50, 51, 52, 53, 54, 55, 56, 57, 184, 206, /* 60 */ 207, 163, 206, 207, 220, 163, 16, 163, 66, 163, /* 70 */ 59, 270, 219, 229, 273, 219, 74, 208, 174, 223, /* 80 */ 224, 163, 184, 185, 163, 232, 184, 185, 184, 185, /* 90 */ 184, 185, 92, 93, 94, 95, 96, 97, 98, 99, /* 100 */ 100, 101, 102, 233, 198, 184, 185, 96, 97, 163, /* 110 */ 206, 207, 19, 163, 261, 104, 105, 106, 107, 198, /* 120 */ 109, 119, 220, 219, 220, 274, 275, 77, 117, 79, /* 130 */ 187, 229, 19, 229, 184, 185, 43, 44, 45, 46, /* 140 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, /* 150 */ 57, 233, 141, 134, 143, 102, 43, 44, 45, 46, /* 160 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, /* 170 */ 57, 152, 274, 216, 276, 218, 83, 163, 85, 233, /* 180 */ 67, 238, 239, 240, 11, 92, 93, 94, 95, 96, /* 190 */ 97, 98, 99, 100, 101, 102, 19, 54, 55, 56, /* 200 */ 57, 58, 163, 26, 163, 92, 93, 94, 95, 96, /* 210 */ 97, 98, 99, 100, 101, 102, 54, 55, 56, 57, /* 220 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 230 */ 53, 54, 55, 56, 57, 92, 93, 94, 95, 96, /* 240 */ 97, 98, 99, 100, 101, 102, 69, 96, 97, 98, /* 250 */ 99, 100, 101, 102, 92, 93, 94, 95, 96, 97, /* 260 */ 98, 99, 100, 101, 102, 81, 179, 180, 181, 92, /* 270 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, /* 280 */ 163, 267, 268, 163, 22, 23, 59, 163, 26, 19, /* 290 */ 117, 118, 175, 109, 24, 59, 92, 93, 94, 95, /* 300 */ 96, 97, 98, 99, 100, 101, 102, 268, 184, 185, /* 310 */ 269, 127, 128, 43, 44, 45, 46, 47, 48, 49, /* 320 */ 50, 51, 52, 53, 54, 55, 56, 57, 157, 158, /* 330 */ 159, 160, 105, 106, 107, 163, 165, 59, 167, 184, /* 340 */ 90, 105, 106, 107, 108, 174, 73, 111, 112, 113, /* 350 */ 19, 22, 163, 91, 81, 163, 106, 121, 81, 132, /* 360 */ 110, 16, 92, 93, 94, 95, 96, 97, 98, 99, /* 370 */ 100, 101, 102, 184, 185, 255, 98, 206, 207, 26, /* 380 */ 101, 102, 19, 105, 106, 107, 23, 198, 59, 116, /* 390 */ 219, 141, 142, 143, 24, 163, 187, 205, 274, 275, /* 400 */ 127, 128, 182, 232, 127, 128, 43, 44, 45, 46, /* 410 */ 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, /* 420 */ 57, 158, 77, 160, 79, 59, 26, 182, 165, 59, /* 430 */ 167, 199, 261, 102, 105, 106, 107, 174, 72, 108, /* 440 */ 109, 110, 111, 112, 113, 114, 59, 238, 239, 240, /* 450 */ 123, 120, 125, 126, 163, 92, 93, 94, 95, 96, /* 460 */ 97, 98, 99, 100, 101, 102, 163, 163, 163, 206, /* 470 */ 207, 105, 106, 107, 254, 19, 106, 90, 197, 23, /* 480 */ 127, 128, 219, 238, 239, 240, 22, 184, 185, 184, /* 490 */ 185, 22, 105, 106, 149, 232, 205, 110, 163, 43, /* 500 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 510 */ 54, 55, 56, 57, 98, 99, 100, 101, 102, 184, /* 520 */ 185, 163, 53, 59, 261, 220, 117, 118, 141, 142, /* 530 */ 143, 131, 174, 59, 229, 116, 117, 118, 163, 59, /* 540 */ 163, 163, 184, 185, 59, 242, 72, 22, 92, 93, /* 550 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 184, /* 560 */ 185, 24, 184, 185, 206, 207, 202, 203, 19, 105, /* 570 */ 106, 107, 23, 198, 22, 174, 198, 219, 220, 105, /* 580 */ 106, 107, 96, 97, 59, 105, 106, 107, 22, 174, /* 590 */ 59, 106, 43, 44, 45, 46, 47, 48, 49, 50, /* 600 */ 51, 52, 53, 54, 55, 56, 57, 206, 207, 12, /* 610 */ 108, 59, 132, 111, 112, 113, 46, 47, 48, 49, /* 620 */ 219, 206, 207, 121, 27, 59, 163, 141, 207, 143, /* 630 */ 105, 106, 107, 163, 219, 234, 105, 106, 107, 42, /* 640 */ 219, 92, 93, 94, 95, 96, 97, 98, 99, 100, /* 650 */ 101, 102, 76, 163, 184, 185, 163, 105, 106, 107, /* 660 */ 63, 19, 86, 163, 163, 23, 163, 130, 205, 21, /* 670 */ 73, 105, 106, 107, 184, 185, 163, 184, 185, 237, /* 680 */ 110, 180, 181, 180, 181, 43, 44, 45, 46, 47, /* 690 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, /* 700 */ 174, 163, 163, 22, 23, 163, 163, 26, 22, 23, /* 710 */ 220, 29, 73, 220, 272, 33, 22, 163, 24, 19, /* 720 */ 174, 208, 259, 184, 185, 19, 184, 185, 80, 175, /* 730 */ 230, 174, 206, 207, 92, 93, 94, 95, 96, 97, /* 740 */ 98, 99, 100, 101, 102, 219, 46, 65, 247, 195, /* 750 */ 247, 197, 206, 207, 19, 116, 117, 118, 23, 220, /* 760 */ 112, 174, 220, 206, 207, 219, 22, 174, 24, 174, /* 770 */ 22, 23, 91, 264, 265, 168, 219, 91, 43, 44, /* 780 */ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, /* 790 */ 55, 56, 57, 206, 207, 12, 163, 149, 255, 206, /* 800 */ 207, 206, 207, 59, 104, 23, 219, 163, 26, 163, /* 810 */ 27, 105, 219, 163, 219, 163, 211, 184, 185, 163, /* 820 */ 120, 163, 146, 163, 148, 42, 221, 92, 93, 94, /* 830 */ 95, 96, 97, 98, 99, 100, 101, 102, 163, 91, /* 840 */ 184, 185, 184, 185, 184, 185, 63, 19, 163, 205, /* 850 */ 106, 23, 245, 163, 208, 248, 116, 117, 118, 184, /* 860 */ 185, 163, 163, 7, 8, 9, 163, 19, 26, 184, /* 870 */ 185, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 880 */ 52, 53, 54, 55, 56, 57, 163, 184, 185, 107, /* 890 */ 163, 43, 44, 45, 46, 47, 48, 49, 50, 51, /* 900 */ 52, 53, 54, 55, 56, 57, 208, 255, 177, 178, /* 910 */ 163, 184, 185, 163, 132, 163, 141, 163, 143, 22, /* 920 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 930 */ 102, 184, 185, 163, 184, 185, 184, 185, 184, 185, /* 940 */ 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, /* 950 */ 102, 163, 163, 163, 184, 185, 163, 115, 163, 163, /* 960 */ 163, 163, 59, 163, 163, 163, 163, 163, 23, 163, /* 970 */ 163, 26, 184, 185, 184, 185, 163, 184, 185, 184, /* 980 */ 185, 184, 185, 163, 184, 185, 184, 185, 184, 185, /* 990 */ 184, 185, 163, 96, 97, 147, 163, 184, 185, 163, /* 1000 */ 199, 163, 124, 205, 184, 185, 163, 129, 163, 106, /* 1010 */ 163, 234, 163, 184, 185, 19, 163, 184, 185, 230, /* 1020 */ 184, 185, 184, 185, 206, 207, 230, 184, 185, 184, /* 1030 */ 185, 184, 185, 184, 185, 19, 163, 219, 231, 43, /* 1040 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 1050 */ 54, 55, 56, 57, 163, 26, 163, 184, 185, 43, /* 1060 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, /* 1070 */ 54, 55, 56, 57, 163, 184, 185, 184, 185, 163, /* 1080 */ 182, 163, 163, 163, 163, 163, 22, 163, 92, 93, /* 1090 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, /* 1100 */ 184, 185, 184, 185, 163, 184, 185, 163, 92, 93, /* 1110 */ 94, 95, 96, 97, 98, 99, 100, 101, 102, 163, /* 1120 */ 184, 185, 98, 59, 163, 184, 185, 205, 184, 185, /* 1130 */ 23, 206, 207, 26, 163, 26, 107, 153, 154, 237, /* 1140 */ 184, 185, 231, 147, 219, 184, 185, 249, 124, 127, /* 1150 */ 128, 231, 254, 129, 118, 231, 177, 178, 262, 263, /* 1160 */ 22, 132, 19, 19, 46, 223, 224, 31, 24, 23, /* 1170 */ 106, 141, 26, 143, 272, 39, 140, 23, 23, 23, /* 1180 */ 26, 26, 26, 19, 22, 109, 110, 43, 44, 45, /* 1190 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, /* 1200 */ 56, 57, 231, 23, 7, 8, 26, 43, 44, 45, /* 1210 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, /* 1220 */ 56, 57, 104, 61, 23, 23, 59, 26, 26, 23, /* 1230 */ 23, 23, 26, 26, 26, 59, 92, 93, 94, 95, /* 1240 */ 96, 97, 98, 99, 100, 101, 102, 138, 105, 23, /* 1250 */ 23, 163, 26, 26, 163, 163, 92, 93, 94, 95, /* 1260 */ 96, 97, 98, 99, 100, 101, 102, 110, 130, 163, /* 1270 */ 193, 163, 193, 106, 163, 163, 19, 120, 163, 163, /* 1280 */ 163, 225, 106, 163, 163, 163, 163, 163, 193, 163, /* 1290 */ 163, 163, 163, 163, 163, 163, 19, 222, 163, 203, /* 1300 */ 163, 44, 45, 46, 47, 48, 49, 50, 51, 52, /* 1310 */ 53, 54, 55, 56, 57, 163, 163, 251, 250, 209, /* 1320 */ 222, 163, 45, 46, 47, 48, 49, 50, 51, 52, /* 1330 */ 53, 54, 55, 56, 57, 163, 163, 163, 163, 161, /* 1340 */ 226, 222, 182, 19, 20, 256, 22, 222, 187, 92, /* 1350 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, /* 1360 */ 36, 222, 213, 213, 213, 188, 226, 196, 187, 92, /* 1370 */ 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, /* 1380 */ 210, 192, 187, 59, 166, 226, 244, 60, 130, 256, /* 1390 */ 170, 212, 210, 19, 20, 71, 22, 38, 170, 170, /* 1400 */ 104, 260, 257, 22, 257, 81, 43, 138, 18, 213, /* 1410 */ 36, 201, 170, 204, 90, 204, 204, 204, 18, 236, /* 1420 */ 96, 97, 48, 235, 169, 201, 236, 103, 213, 105, /* 1430 */ 106, 107, 213, 59, 110, 235, 201, 170, 213, 169, /* 1440 */ 146, 62, 170, 169, 253, 71, 252, 22, 189, 170, /* 1450 */ 169, 127, 128, 170, 169, 189, 82, 104, 64, 186, /* 1460 */ 189, 87, 186, 115, 90, 141, 142, 143, 144, 145, /* 1470 */ 96, 97, 186, 186, 194, 186, 188, 103, 194, 105, /* 1480 */ 106, 107, 189, 186, 110, 186, 102, 246, 19, 20, /* 1490 */ 246, 22, 189, 133, 84, 104, 228, 22, 170, 134, /* 1500 */ 269, 271, 227, 137, 22, 36, 228, 216, 216, 19, /* 1510 */ 20, 170, 22, 146, 136, 141, 142, 143, 144, 145, /* 1520 */ 0, 1, 2, 228, 135, 5, 36, 227, 59, 227, /* 1530 */ 10, 11, 12, 13, 14, 228, 227, 17, 217, 241, /* 1540 */ 71, 215, 217, 214, 243, 213, 25, 13, 173, 59, /* 1550 */ 30, 82, 32, 26, 172, 6, 87, 164, 162, 90, /* 1560 */ 40, 71, 164, 162, 162, 96, 97, 182, 176, 263, /* 1570 */ 266, 266, 103, 176, 105, 106, 107, 182, 190, 110, /* 1580 */ 90, 182, 176, 4, 3, 182, 96, 97, 98, 182, /* 1590 */ 70, 182, 22, 103, 190, 105, 106, 107, 78, 182, /* 1600 */ 110, 81, 182, 151, 15, 89, 16, 23, 88, 23, /* 1610 */ 141, 142, 143, 144, 145, 128, 139, 119, 24, 131, /* 1620 */ 20, 19, 20, 16, 22, 133, 1, 131, 119, 140, /* 1630 */ 61, 141, 142, 143, 144, 145, 37, 119, 36, 139, /* 1640 */ 53, 53, 122, 105, 53, 53, 34, 127, 128, 130, /* 1650 */ 1, 5, 22, 149, 104, 26, 41, 75, 130, 104, /* 1660 */ 24, 59, 20, 68, 68, 120, 19, 114, 67, 28, /* 1670 */ 150, 23, 22, 71, 22, 22, 22, 67, 22, 138, /* 1680 */ 67, 37, 23, 22, 82, 153, 23, 23, 26, 87, /* 1690 */ 23, 22, 90, 22, 24, 23, 130, 24, 96, 97, /* 1700 */ 23, 23, 105, 22, 132, 103, 26, 105, 106, 107, /* 1710 */ 1, 2, 110, 34, 5, 75, 34, 34, 85, 10, /* 1720 */ 11, 12, 13, 14, 23, 26, 17, 24, 83, 44, /* 1730 */ 26, 19, 20, 23, 22, 22, 34, 23, 23, 30, /* 1740 */ 23, 32, 23, 141, 142, 143, 144, 145, 36, 40, /* 1750 */ 26, 23, 11, 22, 22, 26, 23, 23, 22, 22, /* 1760 */ 15, 19, 20, 124, 22, 130, 23, 130, 130, 1, /* 1770 */ 277, 59, 277, 130, 277, 277, 277, 277, 36, 70, /* 1780 */ 277, 277, 277, 71, 277, 277, 277, 78, 277, 277, /* 1790 */ 81, 277, 277, 277, 277, 277, 277, 88, 277, 277, /* 1800 */ 277, 59, 90, 277, 277, 277, 277, 277, 96, 97, /* 1810 */ 277, 277, 277, 71, 277, 103, 277, 105, 106, 107, /* 1820 */ 277, 277, 110, 277, 277, 277, 277, 277, 277, 277, /* 1830 */ 277, 122, 90, 277, 277, 277, 127, 128, 96, 97, /* 1840 */ 277, 277, 277, 277, 277, 103, 277, 105, 106, 107, |
︙ | ︙ | |||
145578 145579 145580 145581 145582 145583 145584 | /* 1960 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1970 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277, /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277, /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, }; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 145497 145498 145499 145500 145501 145502 145503 145504 145505 145506 145507 145508 145509 145510 145511 145512 145513 145514 145515 145516 145517 145518 145519 145520 145521 145522 145523 145524 145525 145526 145527 145528 145529 145530 145531 145532 145533 145534 145535 145536 145537 145538 145539 145540 145541 145542 145543 145544 145545 145546 145547 145548 145549 145550 145551 145552 145553 145554 145555 145556 145557 145558 145559 145560 145561 145562 145563 145564 145565 145566 145567 145568 145569 145570 145571 145572 145573 145574 145575 145576 145577 145578 145579 145580 145581 145582 145583 145584 145585 145586 145587 145588 145589 145590 145591 145592 145593 145594 145595 145596 145597 145598 145599 145600 145601 145602 145603 145604 145605 145606 145607 145608 145609 145610 145611 145612 145613 145614 145615 145616 145617 145618 145619 145620 145621 145622 145623 145624 145625 145626 145627 145628 145629 145630 145631 145632 145633 145634 145635 145636 145637 145638 145639 145640 145641 145642 145643 145644 145645 145646 145647 145648 145649 145650 145651 145652 145653 145654 145655 145656 145657 145658 145659 145660 145661 145662 | /* 1960 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1970 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 1980 */ 122, 277, 277, 277, 277, 127, 128, 277, 277, 277, /* 1990 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, /* 2000 */ 277, 277, 277, 277, 277, 277, 277, 277, 150, 277, /* 2010 */ 277, 277, 277, 277, 277, 277, 277, 277, 277, }; #define YY_SHIFT_COUNT (517) #define YY_SHIFT_MIN (0) #define YY_SHIFT_MAX (1858) static const unsigned short int yy_shift_ofst[] = { /* 0 */ 1709, 1520, 1858, 1324, 1324, 277, 1374, 1469, 1602, 1712, /* 10 */ 1712, 1712, 273, 0, 0, 113, 1016, 1712, 1712, 1712, /* 20 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 11, 11, 236, /* 30 */ 184, 277, 277, 277, 277, 277, 277, 93, 177, 270, /* 40 */ 363, 456, 549, 642, 735, 828, 848, 996, 1144, 1016, /* 50 */ 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, 1016, /* 60 */ 1016, 1016, 1016, 1016, 1016, 1016, 1164, 1016, 1257, 1277, /* 70 */ 1277, 1490, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, /* 80 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, /* 90 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, 1712, /* 100 */ 1712, 1712, 1712, 1742, 1712, 1712, 1712, 1712, 1712, 1712, /* 110 */ 1712, 1712, 1712, 1712, 1712, 1712, 1712, 143, 162, 162, /* 120 */ 162, 162, 162, 204, 151, 416, 531, 648, 700, 531, /* 130 */ 486, 486, 531, 353, 353, 353, 353, 409, 279, 53, /* 140 */ 2009, 2009, 331, 331, 331, 329, 366, 329, 329, 597, /* 150 */ 597, 464, 474, 262, 681, 531, 531, 531, 531, 531, /* 160 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 531, /* 170 */ 531, 531, 531, 531, 531, 531, 531, 173, 485, 984, /* 180 */ 984, 576, 485, 19, 1022, 2009, 2009, 2009, 387, 250, /* 190 */ 250, 525, 502, 278, 552, 227, 480, 566, 531, 531, /* 200 */ 531, 531, 531, 531, 531, 531, 639, 531, 531, 531, /* 210 */ 531, 531, 531, 531, 531, 531, 531, 531, 531, 2, /* 220 */ 2, 2, 531, 531, 531, 531, 782, 531, 531, 531, /* 230 */ 744, 531, 531, 783, 531, 531, 531, 531, 531, 531, /* 240 */ 531, 531, 419, 682, 327, 370, 370, 370, 370, 1029, /* 250 */ 327, 327, 1024, 897, 856, 1109, 706, 706, 1143, 1109, /* 260 */ 1109, 1143, 842, 945, 1118, 1136, 1136, 1136, 706, 676, /* 270 */ 400, 878, 694, 1327, 1258, 1258, 1359, 1359, 1258, 1296, /* 280 */ 1381, 1363, 1269, 1390, 1390, 1390, 1390, 1258, 1400, 1269, /* 290 */ 1269, 1296, 1381, 1363, 1363, 1269, 1258, 1400, 1294, 1379, /* 300 */ 1258, 1400, 1425, 1258, 1400, 1258, 1400, 1425, 1353, 1353, /* 310 */ 1353, 1394, 1425, 1353, 1348, 1353, 1394, 1353, 1353, 1425, /* 320 */ 1384, 1384, 1425, 1360, 1391, 1360, 1391, 1360, 1391, 1360, /* 330 */ 1391, 1258, 1365, 1410, 1475, 1366, 1365, 1482, 1258, 1367, /* 340 */ 1366, 1378, 1389, 1269, 1521, 1527, 1534, 1534, 1549, 1549, /* 350 */ 1549, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, 2009, /* 360 */ 2009, 2009, 2009, 2009, 2009, 2009, 2009, 570, 345, 686, /* 370 */ 748, 50, 740, 1064, 1107, 469, 537, 1036, 1146, 1162, /* 380 */ 1154, 1155, 1156, 1180, 1201, 1202, 903, 1076, 1197, 1157, /* 390 */ 1167, 1206, 1207, 1208, 775, 1030, 1226, 1227, 1176, 1138, /* 400 */ 1579, 1581, 1570, 1452, 1589, 1516, 1590, 1584, 1586, 1487, /* 410 */ 1477, 1498, 1594, 1488, 1600, 1492, 1607, 1625, 1496, 1489, /* 420 */ 1509, 1569, 1599, 1500, 1587, 1588, 1591, 1592, 1518, 1538, /* 430 */ 1612, 1519, 1649, 1646, 1630, 1550, 1504, 1595, 1629, 1596, /* 440 */ 1582, 1615, 1528, 1555, 1636, 1642, 1647, 1545, 1553, 1650, /* 450 */ 1601, 1652, 1653, 1648, 1654, 1610, 1641, 1656, 1613, 1644, /* 460 */ 1659, 1541, 1661, 1532, 1663, 1664, 1662, 1667, 1669, 1670, /* 470 */ 1672, 1671, 1673, 1566, 1677, 1678, 1597, 1679, 1681, 1572, /* 480 */ 1680, 1682, 1680, 1683, 1633, 1640, 1645, 1685, 1701, 1703, /* 490 */ 1699, 1704, 1702, 1710, 1680, 1714, 1715, 1717, 1719, 1724, /* 500 */ 1728, 1713, 1741, 1731, 1732, 1733, 1734, 1736, 1737, 1729, /* 510 */ 1639, 1635, 1637, 1638, 1643, 1743, 1745, 1768, }; #define YY_REDUCE_COUNT (366) #define YY_REDUCE_MIN (-237) #define YY_REDUCE_MAX (1420) static const short yy_reduce_ofst[] = { /* 0 */ -147, 171, 263, -96, 358, -144, -149, -102, 124, -156, /* 10 */ -98, 305, 401, -57, 209, -237, 245, -94, -79, 189, /* 20 */ 375, 490, 493, 378, 303, 539, 542, 501, 503, 554, /* 30 */ 415, 526, 546, 557, 587, 593, 595, -234, -234, -234, /* 40 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, /* 50 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, /* 60 */ -234, -234, -234, -234, -234, -234, -234, -234, -234, -234, /* 70 */ -234, -50, 335, 470, 633, 656, 658, 660, 675, 685, /* 80 */ 703, 727, 747, 750, 752, 754, 770, 788, 790, 793, /* 90 */ 795, 797, 800, 802, 804, 806, 813, 820, 829, 833, /* 100 */ 836, 838, 843, 845, 847, 849, 873, 891, 893, 916, /* 110 */ 918, 921, 936, 941, 944, 956, 961, -234, -234, -234, /* 120 */ -234, -234, -234, -234, -234, -234, 463, 607, -176, 14, /* 130 */ -139, 87, -137, 818, 925, 818, 925, 898, -234, -234, /* 140 */ -234, -234, -166, -166, -166, -130, -131, -82, -54, -180, /* 150 */ 364, 41, 513, 509, 509, 117, 500, 789, 796, 646, /* 160 */ 192, 291, 644, 798, 120, 807, 543, 911, 920, 652, /* 170 */ 924, 922, 232, 698, 801, 971, 39, 220, 731, 442, /* 180 */ 902, -199, 979, -43, 421, 896, 942, 605, -184, -126, /* 190 */ 155, 172, 281, 304, 377, 538, 650, 690, 699, 723, /* 200 */ 803, 853, 919, 1088, 1091, 1092, 777, 1106, 1108, 1111, /* 210 */ 1112, 1115, 1116, 1117, 1120, 1121, 1122, 1123, 1124, 1077, /* 220 */ 1079, 1095, 1126, 1127, 1128, 1129, 1056, 1130, 1131, 1132, /* 230 */ 1075, 1135, 1137, 1096, 1152, 304, 1153, 1158, 1172, 1173, /* 240 */ 1174, 1175, 1066, 1068, 1110, 1098, 1119, 1125, 1139, 1056, /* 250 */ 1110, 1110, 1170, 1160, 1178, 1149, 1114, 1140, 1089, 1150, /* 260 */ 1151, 1133, 1177, 1171, 1189, 1161, 1181, 1195, 1159, 1142, /* 270 */ 1179, 1182, 1218, 1141, 1220, 1228, 1145, 1147, 1229, 1183, /* 280 */ 1188, 1210, 1196, 1209, 1211, 1212, 1213, 1242, 1255, 1215, /* 290 */ 1219, 1190, 1200, 1224, 1235, 1225, 1267, 1270, 1191, 1194, /* 300 */ 1272, 1274, 1259, 1279, 1281, 1283, 1285, 1266, 1273, 1276, /* 310 */ 1286, 1280, 1271, 1287, 1288, 1289, 1284, 1297, 1299, 1293, /* 320 */ 1241, 1244, 1303, 1268, 1275, 1278, 1300, 1295, 1302, 1307, /* 330 */ 1309, 1328, 1291, 1230, 1231, 1321, 1292, 1298, 1341, 1301, /* 340 */ 1325, 1326, 1329, 1332, 1375, 1382, 1393, 1398, 1396, 1401, /* 350 */ 1402, 1304, 1305, 1306, 1392, 1385, 1395, 1399, 1403, 1397, /* 360 */ 1388, 1404, 1407, 1409, 1417, 1420, 1406, }; static const YYACTIONTYPE yy_default[] = { /* 0 */ 1486, 1486, 1486, 1335, 1118, 1224, 1118, 1118, 1118, 1335, /* 10 */ 1335, 1335, 1118, 1254, 1254, 1386, 1149, 1118, 1118, 1118, /* 20 */ 1118, 1118, 1118, 1118, 1334, 1118, 1118, 1118, 1118, 1118, /* 30 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1260, 1118, /* 40 */ 1118, 1118, 1118, 1118, 1336, 1337, 1118, 1118, 1118, 1385, /* 50 */ 1387, 1270, 1269, 1268, 1267, 1368, 1241, 1265, 1258, 1262, /* 60 */ 1330, 1331, 1329, 1333, 1337, 1336, 1118, 1261, 1301, 1315, /* 70 */ 1300, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 80 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 90 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 100 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 110 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1309, 1314, 1320, /* 120 */ 1313, 1310, 1303, 1302, 1304, 1305, 1118, 1139, 1188, 1118, /* 130 */ 1118, 1118, 1118, 1403, 1402, 1118, 1118, 1149, 1306, 1307, /* 140 */ 1317, 1316, 1393, 1442, 1441, 1118, 1118, 1118, 1118, 1118, /* 150 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 160 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 170 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1149, 1145, 1295, /* 180 */ 1294, 1412, 1145, 1248, 1118, 1398, 1224, 1215, 1118, 1118, /* 190 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1390, /* 200 */ 1388, 1118, 1350, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 210 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 220 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 230 */ 1220, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 240 */ 1118, 1436, 1118, 1363, 1202, 1220, 1220, 1220, 1220, 1222, /* 250 */ 1203, 1201, 1214, 1149, 1125, 1264, 1243, 1243, 1475, 1264, /* 260 */ 1264, 1475, 1163, 1456, 1160, 1254, 1254, 1254, 1243, 1332, /* 270 */ 1221, 1214, 1118, 1478, 1229, 1229, 1477, 1477, 1229, 1273, /* 280 */ 1279, 1191, 1264, 1197, 1197, 1197, 1197, 1229, 1136, 1264, /* 290 */ 1264, 1273, 1279, 1191, 1191, 1264, 1229, 1136, 1367, 1472, /* 300 */ 1229, 1136, 1343, 1229, 1136, 1229, 1136, 1343, 1189, 1189, /* 310 */ 1189, 1178, 1343, 1189, 1163, 1189, 1178, 1189, 1189, 1343, /* 320 */ 1347, 1347, 1343, 1247, 1242, 1247, 1242, 1247, 1242, 1247, /* 330 */ 1242, 1229, 1248, 1411, 1118, 1259, 1248, 1338, 1229, 1118, /* 340 */ 1259, 1257, 1255, 1264, 1142, 1181, 1439, 1439, 1435, 1435, /* 350 */ 1435, 1483, 1483, 1398, 1451, 1149, 1149, 1149, 1149, 1451, /* 360 */ 1165, 1165, 1149, 1149, 1149, 1149, 1451, 1118, 1118, 1118, /* 370 */ 1118, 1118, 1118, 1446, 1118, 1352, 1233, 1118, 1118, 1118, /* 380 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 390 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1284, /* 400 */ 1118, 1121, 1395, 1118, 1118, 1394, 1118, 1118, 1118, 1118, /* 410 */ 1118, 1118, 1234, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 420 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 430 */ 1118, 1474, 1118, 1118, 1118, 1118, 1118, 1118, 1366, 1365, /* 440 */ 1118, 1118, 1231, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 450 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 460 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 470 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 480 */ 1256, 1118, 1410, 1118, 1118, 1118, 1118, 1118, 1118, 1118, /* 490 */ 1424, 1249, 1118, 1118, 1465, 1118, 1118, 1118, 1118, 1118, /* 500 */ 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1118, 1460, /* 510 */ 1205, 1286, 1118, 1285, 1289, 1118, 1130, 1118, }; /********** End of lemon-generated parsing tables *****************************/ /* The next table maps tokens (terminal symbols) into fallback tokens. ** If a construct like the following: ** ** %fallback ID X Y Z. |
︙ | ︙ | |||
146143 146144 146145 146146 146147 146148 146149 | /* 209 */ "multiselect_op", /* 210 */ "distinct", /* 211 */ "selcollist", /* 212 */ "from", /* 213 */ "where_opt", /* 214 */ "groupby_opt", /* 215 */ "having_opt", | | | | | | | | | | | | | | | 146062 146063 146064 146065 146066 146067 146068 146069 146070 146071 146072 146073 146074 146075 146076 146077 146078 146079 146080 146081 146082 146083 146084 146085 146086 146087 146088 146089 146090 146091 146092 146093 146094 146095 146096 146097 | /* 209 */ "multiselect_op", /* 210 */ "distinct", /* 211 */ "selcollist", /* 212 */ "from", /* 213 */ "where_opt", /* 214 */ "groupby_opt", /* 215 */ "having_opt", /* 216 */ "orderby_opt", /* 217 */ "limit_opt", /* 218 */ "window_clause", /* 219 */ "values", /* 220 */ "nexprlist", /* 221 */ "sclp", /* 222 */ "as", /* 223 */ "seltablist", /* 224 */ "stl_prefix", /* 225 */ "joinop", /* 226 */ "indexed_opt", /* 227 */ "on_opt", /* 228 */ "using_opt", /* 229 */ "exprlist", /* 230 */ "xfullname", /* 231 */ "idlist", /* 232 */ "with", /* 233 */ "setlist", /* 234 */ "insert_cmd", /* 235 */ "idlist_opt", /* 236 */ "upsert", /* 237 */ "over_clause", /* 238 */ "likeop", /* 239 */ "between_op", /* 240 */ "in_op", /* 241 */ "paren_exprlist", /* 242 */ "case_operand", /* 243 */ "case_exprlist", /* 244 */ "case_else", |
︙ | ︙ | |||
146298 146299 146300 146301 146302 146303 146304 | /* 80 */ "select ::= WITH wqlist selectnowith", /* 81 */ "select ::= WITH RECURSIVE wqlist selectnowith", /* 82 */ "select ::= selectnowith", /* 83 */ "selectnowith ::= selectnowith multiselect_op oneselect", /* 84 */ "multiselect_op ::= UNION", /* 85 */ "multiselect_op ::= UNION ALL", /* 86 */ "multiselect_op ::= EXCEPT|INTERSECT", | | > | | < | | | | | | | | | | > | | | | | | < | | | | | | | | | | | > | | | | | | | | | | | < | | | | | | | | | | > | | | | | | | | | | | | | | < | | | | | | | | | | | | | > | | | | | < | | | | | | | | | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | < | | | | | | | < | | | | | > | | | | | | | | | | | | < | > | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 146217 146218 146219 146220 146221 146222 146223 146224 146225 146226 146227 146228 146229 146230 146231 146232 146233 146234 146235 146236 146237 146238 146239 146240 146241 146242 146243 146244 146245 146246 146247 146248 146249 146250 146251 146252 146253 146254 146255 146256 146257 146258 146259 146260 146261 146262 146263 146264 146265 146266 146267 146268 146269 146270 146271 146272 146273 146274 146275 146276 146277 146278 146279 146280 146281 146282 146283 146284 146285 146286 146287 146288 146289 146290 146291 146292 146293 146294 146295 146296 146297 146298 146299 146300 146301 146302 146303 146304 146305 146306 146307 146308 146309 146310 146311 146312 146313 146314 146315 146316 146317 146318 146319 146320 146321 146322 146323 146324 146325 146326 146327 146328 146329 146330 146331 146332 146333 146334 146335 146336 146337 146338 146339 146340 146341 146342 146343 146344 146345 146346 146347 146348 146349 146350 146351 146352 146353 146354 146355 146356 146357 146358 146359 146360 146361 146362 146363 146364 146365 146366 146367 146368 146369 146370 146371 146372 146373 146374 146375 146376 146377 146378 146379 146380 146381 146382 146383 146384 146385 146386 146387 146388 146389 146390 146391 146392 146393 146394 146395 146396 146397 146398 146399 146400 146401 146402 146403 146404 146405 146406 146407 146408 146409 146410 146411 146412 146413 146414 146415 146416 146417 146418 146419 146420 146421 146422 146423 146424 146425 146426 146427 146428 146429 146430 146431 146432 146433 146434 146435 146436 146437 146438 146439 146440 146441 146442 146443 146444 146445 146446 146447 146448 146449 146450 146451 146452 146453 146454 146455 146456 146457 146458 146459 146460 146461 146462 146463 146464 146465 146466 146467 146468 146469 146470 146471 146472 146473 146474 146475 146476 146477 146478 146479 146480 146481 146482 146483 146484 146485 146486 146487 146488 146489 146490 146491 146492 146493 146494 146495 146496 146497 146498 146499 146500 146501 146502 146503 146504 146505 146506 146507 146508 146509 | /* 80 */ "select ::= WITH wqlist selectnowith", /* 81 */ "select ::= WITH RECURSIVE wqlist selectnowith", /* 82 */ "select ::= selectnowith", /* 83 */ "selectnowith ::= selectnowith multiselect_op oneselect", /* 84 */ "multiselect_op ::= UNION", /* 85 */ "multiselect_op ::= UNION ALL", /* 86 */ "multiselect_op ::= EXCEPT|INTERSECT", /* 87 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", /* 88 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt", /* 89 */ "values ::= VALUES LP nexprlist RP", /* 90 */ "values ::= values COMMA LP nexprlist RP", /* 91 */ "distinct ::= DISTINCT", /* 92 */ "distinct ::= ALL", /* 93 */ "distinct ::=", /* 94 */ "sclp ::=", /* 95 */ "selcollist ::= sclp scanpt expr scanpt as", /* 96 */ "selcollist ::= sclp scanpt STAR", /* 97 */ "selcollist ::= sclp scanpt nm DOT STAR", /* 98 */ "as ::= AS nm", /* 99 */ "as ::=", /* 100 */ "from ::=", /* 101 */ "from ::= FROM seltablist", /* 102 */ "stl_prefix ::= seltablist joinop", /* 103 */ "stl_prefix ::=", /* 104 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", /* 105 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt", /* 106 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", /* 107 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", /* 108 */ "dbnm ::=", /* 109 */ "dbnm ::= DOT nm", /* 110 */ "fullname ::= nm", /* 111 */ "fullname ::= nm DOT nm", /* 112 */ "xfullname ::= nm", /* 113 */ "xfullname ::= nm DOT nm", /* 114 */ "xfullname ::= nm DOT nm AS nm", /* 115 */ "xfullname ::= nm AS nm", /* 116 */ "joinop ::= COMMA|JOIN", /* 117 */ "joinop ::= JOIN_KW JOIN", /* 118 */ "joinop ::= JOIN_KW nm JOIN", /* 119 */ "joinop ::= JOIN_KW nm nm JOIN", /* 120 */ "on_opt ::= ON expr", /* 121 */ "on_opt ::=", /* 122 */ "indexed_opt ::=", /* 123 */ "indexed_opt ::= INDEXED BY nm", /* 124 */ "indexed_opt ::= NOT INDEXED", /* 125 */ "using_opt ::= USING LP idlist RP", /* 126 */ "using_opt ::=", /* 127 */ "orderby_opt ::=", /* 128 */ "orderby_opt ::= ORDER BY sortlist", /* 129 */ "sortlist ::= sortlist COMMA expr sortorder", /* 130 */ "sortlist ::= expr sortorder", /* 131 */ "sortorder ::= ASC", /* 132 */ "sortorder ::= DESC", /* 133 */ "sortorder ::=", /* 134 */ "groupby_opt ::=", /* 135 */ "groupby_opt ::= GROUP BY nexprlist", /* 136 */ "having_opt ::=", /* 137 */ "having_opt ::= HAVING expr", /* 138 */ "limit_opt ::=", /* 139 */ "limit_opt ::= LIMIT expr", /* 140 */ "limit_opt ::= LIMIT expr OFFSET expr", /* 141 */ "limit_opt ::= LIMIT expr COMMA expr", /* 142 */ "cmd ::= with DELETE FROM xfullname indexed_opt where_opt", /* 143 */ "where_opt ::=", /* 144 */ "where_opt ::= WHERE expr", /* 145 */ "cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt", /* 146 */ "setlist ::= setlist COMMA nm EQ expr", /* 147 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", /* 148 */ "setlist ::= nm EQ expr", /* 149 */ "setlist ::= LP idlist RP EQ expr", /* 150 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert", /* 151 */ "cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES", /* 152 */ "upsert ::=", /* 153 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt", /* 154 */ "upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING", /* 155 */ "upsert ::= ON CONFLICT DO NOTHING", /* 156 */ "insert_cmd ::= INSERT orconf", /* 157 */ "insert_cmd ::= REPLACE", /* 158 */ "idlist_opt ::=", /* 159 */ "idlist_opt ::= LP idlist RP", /* 160 */ "idlist ::= idlist COMMA nm", /* 161 */ "idlist ::= nm", /* 162 */ "expr ::= LP expr RP", /* 163 */ "expr ::= ID|INDEXED", /* 164 */ "expr ::= JOIN_KW", /* 165 */ "expr ::= nm DOT nm", /* 166 */ "expr ::= nm DOT nm DOT nm", /* 167 */ "term ::= NULL|FLOAT|BLOB", /* 168 */ "term ::= STRING", /* 169 */ "term ::= INTEGER", /* 170 */ "expr ::= VARIABLE", /* 171 */ "expr ::= expr COLLATE ID|STRING", /* 172 */ "expr ::= CAST LP expr AS typetoken RP", /* 173 */ "expr ::= ID|INDEXED LP distinct exprlist RP", /* 174 */ "expr ::= ID|INDEXED LP STAR RP", /* 175 */ "expr ::= ID|INDEXED LP distinct exprlist RP over_clause", /* 176 */ "expr ::= ID|INDEXED LP STAR RP over_clause", /* 177 */ "term ::= CTIME_KW", /* 178 */ "expr ::= LP nexprlist COMMA expr RP", /* 179 */ "expr ::= expr AND expr", /* 180 */ "expr ::= expr OR expr", /* 181 */ "expr ::= expr LT|GT|GE|LE expr", /* 182 */ "expr ::= expr EQ|NE expr", /* 183 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", /* 184 */ "expr ::= expr PLUS|MINUS expr", /* 185 */ "expr ::= expr STAR|SLASH|REM expr", /* 186 */ "expr ::= expr CONCAT expr", /* 187 */ "likeop ::= NOT LIKE_KW|MATCH", /* 188 */ "expr ::= expr likeop expr", /* 189 */ "expr ::= expr likeop expr ESCAPE expr", /* 190 */ "expr ::= expr ISNULL|NOTNULL", /* 191 */ "expr ::= expr NOT NULL", /* 192 */ "expr ::= expr IS expr", /* 193 */ "expr ::= expr IS NOT expr", /* 194 */ "expr ::= NOT expr", /* 195 */ "expr ::= BITNOT expr", /* 196 */ "expr ::= PLUS|MINUS expr", /* 197 */ "between_op ::= BETWEEN", /* 198 */ "between_op ::= NOT BETWEEN", /* 199 */ "expr ::= expr between_op expr AND expr", /* 200 */ "in_op ::= IN", /* 201 */ "in_op ::= NOT IN", /* 202 */ "expr ::= expr in_op LP exprlist RP", /* 203 */ "expr ::= LP select RP", /* 204 */ "expr ::= expr in_op LP select RP", /* 205 */ "expr ::= expr in_op nm dbnm paren_exprlist", /* 206 */ "expr ::= EXISTS LP select RP", /* 207 */ "expr ::= CASE case_operand case_exprlist case_else END", /* 208 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", /* 209 */ "case_exprlist ::= WHEN expr THEN expr", /* 210 */ "case_else ::= ELSE expr", /* 211 */ "case_else ::=", /* 212 */ "case_operand ::= expr", /* 213 */ "case_operand ::=", /* 214 */ "exprlist ::=", /* 215 */ "nexprlist ::= nexprlist COMMA expr", /* 216 */ "nexprlist ::= expr", /* 217 */ "paren_exprlist ::=", /* 218 */ "paren_exprlist ::= LP exprlist RP", /* 219 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", /* 220 */ "uniqueflag ::= UNIQUE", /* 221 */ "uniqueflag ::=", /* 222 */ "eidlist_opt ::=", /* 223 */ "eidlist_opt ::= LP eidlist RP", /* 224 */ "eidlist ::= eidlist COMMA nm collate sortorder", /* 225 */ "eidlist ::= nm collate sortorder", /* 226 */ "collate ::=", /* 227 */ "collate ::= COLLATE ID|STRING", /* 228 */ "cmd ::= DROP INDEX ifexists fullname", /* 229 */ "cmd ::= VACUUM", /* 230 */ "cmd ::= VACUUM nm", /* 231 */ "cmd ::= PRAGMA nm dbnm", /* 232 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", /* 233 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", /* 234 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", /* 235 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", /* 236 */ "plus_num ::= PLUS INTEGER|FLOAT", /* 237 */ "minus_num ::= MINUS INTEGER|FLOAT", /* 238 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", /* 239 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", /* 240 */ "trigger_time ::= BEFORE|AFTER", /* 241 */ "trigger_time ::= INSTEAD OF", /* 242 */ "trigger_time ::=", /* 243 */ "trigger_event ::= DELETE|INSERT", /* 244 */ "trigger_event ::= UPDATE", /* 245 */ "trigger_event ::= UPDATE OF idlist", /* 246 */ "when_clause ::=", /* 247 */ "when_clause ::= WHEN expr", /* 248 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", /* 249 */ "trigger_cmd_list ::= trigger_cmd SEMI", /* 250 */ "trnm ::= nm DOT nm", /* 251 */ "tridxby ::= INDEXED BY nm", /* 252 */ "tridxby ::= NOT INDEXED", /* 253 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt", /* 254 */ "trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt", /* 255 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt", /* 256 */ "trigger_cmd ::= scanpt select scanpt", /* 257 */ "expr ::= RAISE LP IGNORE RP", /* 258 */ "expr ::= RAISE LP raisetype COMMA nm RP", /* 259 */ "raisetype ::= ROLLBACK", /* 260 */ "raisetype ::= ABORT", /* 261 */ "raisetype ::= FAIL", /* 262 */ "cmd ::= DROP TRIGGER ifexists fullname", /* 263 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", /* 264 */ "cmd ::= DETACH database_kw_opt expr", /* 265 */ "key_opt ::=", /* 266 */ "key_opt ::= KEY expr", /* 267 */ "cmd ::= REINDEX", /* 268 */ "cmd ::= REINDEX nm dbnm", /* 269 */ "cmd ::= ANALYZE", /* 270 */ "cmd ::= ANALYZE nm dbnm", /* 271 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", /* 272 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", /* 273 */ "add_column_fullname ::= fullname", /* 274 */ "cmd ::= create_vtab", /* 275 */ "cmd ::= create_vtab LP vtabarglist RP", /* 276 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", /* 277 */ "vtabarg ::=", /* 278 */ "vtabargtoken ::= ANY", /* 279 */ "vtabargtoken ::= lp anylist RP", /* 280 */ "lp ::= LP", /* 281 */ "with ::= WITH wqlist", /* 282 */ "with ::= WITH RECURSIVE wqlist", /* 283 */ "wqlist ::= nm eidlist_opt AS LP select RP", /* 284 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", /* 285 */ "windowdefn_list ::= windowdefn", /* 286 */ "windowdefn_list ::= windowdefn_list COMMA windowdefn", /* 287 */ "windowdefn ::= nm AS window", /* 288 */ "window ::= LP part_opt orderby_opt frame_opt RP", /* 289 */ "part_opt ::= PARTITION BY nexprlist", /* 290 */ "part_opt ::=", /* 291 */ "frame_opt ::=", /* 292 */ "frame_opt ::= range_or_rows frame_bound_s", /* 293 */ "frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e", /* 294 */ "range_or_rows ::= RANGE", /* 295 */ "range_or_rows ::= ROWS", /* 296 */ "frame_bound_s ::= frame_bound", /* 297 */ "frame_bound_s ::= UNBOUNDED PRECEDING", /* 298 */ "frame_bound_e ::= frame_bound", /* 299 */ "frame_bound_e ::= UNBOUNDED FOLLOWING", /* 300 */ "frame_bound ::= expr PRECEDING", /* 301 */ "frame_bound ::= CURRENT ROW", /* 302 */ "frame_bound ::= expr FOLLOWING", /* 303 */ "window_clause ::= WINDOW windowdefn_list", /* 304 */ "over_clause ::= filter_opt OVER window", /* 305 */ "over_clause ::= filter_opt OVER nm", /* 306 */ "filter_opt ::=", /* 307 */ "filter_opt ::= FILTER LP WHERE expr RP", /* 308 */ "input ::= cmdlist", /* 309 */ "cmdlist ::= cmdlist ecmd", /* 310 */ "cmdlist ::= ecmd", /* 311 */ "ecmd ::= SEMI", /* 312 */ "ecmd ::= cmdx SEMI", /* 313 */ "ecmd ::= explain cmdx", /* 314 */ "trans_opt ::=", /* 315 */ "trans_opt ::= TRANSACTION", /* 316 */ "trans_opt ::= TRANSACTION nm", /* 317 */ "savepoint_opt ::= SAVEPOINT", /* 318 */ "savepoint_opt ::=", /* 319 */ "cmd ::= create_table create_table_args", /* 320 */ "columnlist ::= columnlist COMMA columnname carglist", /* 321 */ "columnlist ::= columnname carglist", /* 322 */ "nm ::= ID|INDEXED", /* 323 */ "nm ::= STRING", /* 324 */ "nm ::= JOIN_KW", /* 325 */ "typetoken ::= typename", /* 326 */ "typename ::= ID|STRING", /* 327 */ "signed ::= plus_num", /* 328 */ "signed ::= minus_num", /* 329 */ "carglist ::= carglist ccons", /* 330 */ "carglist ::=", /* 331 */ "ccons ::= NULL onconf", /* 332 */ "conslist_opt ::= COMMA conslist", /* 333 */ "conslist ::= conslist tconscomma tcons", /* 334 */ "conslist ::= tcons", /* 335 */ "tconscomma ::=", /* 336 */ "defer_subclause_opt ::= defer_subclause", /* 337 */ "resolvetype ::= raisetype", /* 338 */ "selectnowith ::= oneselect", /* 339 */ "oneselect ::= values", /* 340 */ "sclp ::= selcollist COMMA", /* 341 */ "as ::= ID|STRING", /* 342 */ "expr ::= term", /* 343 */ "likeop ::= LIKE_KW|MATCH", /* 344 */ "exprlist ::= nexprlist", /* 345 */ "nmnum ::= plus_num", /* 346 */ "nmnum ::= nm", /* 347 */ "nmnum ::= ON", /* 348 */ "nmnum ::= DELETE", /* 349 */ "nmnum ::= DEFAULT", /* 350 */ "plus_num ::= INTEGER|FLOAT", /* 351 */ "foreach_clause ::=", /* 352 */ "foreach_clause ::= FOR EACH ROW", /* 353 */ "trnm ::= nm", /* 354 */ "tridxby ::=", /* 355 */ "database_kw_opt ::= DATABASE", /* 356 */ "database_kw_opt ::=", /* 357 */ "kwcolumn_opt ::=", /* 358 */ "kwcolumn_opt ::= COLUMNKW", /* 359 */ "vtabarglist ::= vtabarg", /* 360 */ "vtabarglist ::= vtabarglist COMMA vtabarg", /* 361 */ "vtabarg ::= vtabarg vtabargtoken", /* 362 */ "anylist ::=", /* 363 */ "anylist ::= anylist LP anylist RP", /* 364 */ "anylist ::= anylist ANY", /* 365 */ "with ::=", }; #endif /* NDEBUG */ #if YYSTACKDEPTH<=0 /* ** Try to increase the size of the parser stack. Return the number |
︙ | ︙ | |||
146713 146714 146715 146716 146717 146718 146719 | sqlite3SelectDelete(pParse->db, (yypminor->yy489)); } break; case 184: /* term */ case 185: /* expr */ case 213: /* where_opt */ case 215: /* having_opt */ | | | | | | | | | | | 146633 146634 146635 146636 146637 146638 146639 146640 146641 146642 146643 146644 146645 146646 146647 146648 146649 146650 146651 146652 146653 146654 146655 146656 146657 146658 146659 146660 146661 146662 146663 146664 146665 146666 146667 146668 146669 146670 146671 146672 146673 146674 146675 146676 146677 146678 146679 146680 146681 146682 146683 146684 146685 146686 146687 146688 146689 146690 146691 146692 146693 146694 146695 146696 146697 146698 146699 146700 146701 | sqlite3SelectDelete(pParse->db, (yypminor->yy489)); } break; case 184: /* term */ case 185: /* expr */ case 213: /* where_opt */ case 215: /* having_opt */ case 227: /* on_opt */ case 242: /* case_operand */ case 244: /* case_else */ case 253: /* when_clause */ case 258: /* key_opt */ case 272: /* filter_opt */ { sqlite3ExprDelete(pParse->db, (yypminor->yy18)); } break; case 189: /* eidlist_opt */ case 198: /* sortlist */ case 199: /* eidlist */ case 211: /* selcollist */ case 214: /* groupby_opt */ case 216: /* orderby_opt */ case 220: /* nexprlist */ case 221: /* sclp */ case 229: /* exprlist */ case 233: /* setlist */ case 241: /* paren_exprlist */ case 243: /* case_exprlist */ case 271: /* part_opt */ { sqlite3ExprListDelete(pParse->db, (yypminor->yy420)); } break; case 205: /* fullname */ case 212: /* from */ case 223: /* seltablist */ case 224: /* stl_prefix */ case 230: /* xfullname */ { sqlite3SrcListDelete(pParse->db, (yypminor->yy135)); } break; case 208: /* wqlist */ { sqlite3WithDelete(pParse->db, (yypminor->yy449)); } break; case 218: /* window_clause */ case 267: /* windowdefn_list */ { sqlite3WindowListDelete(pParse->db, (yypminor->yy327)); } break; case 228: /* using_opt */ case 231: /* idlist */ case 235: /* idlist_opt */ { sqlite3IdListDelete(pParse->db, (yypminor->yy48)); } break; case 237: /* over_clause */ case 268: /* windowdefn */ case 269: /* window */ case 270: /* frame_opt */ { sqlite3WindowDelete(pParse->db, (yypminor->yy327)); } break; |
︙ | ︙ | |||
147176 147177 147178 147179 147180 147181 147182 | { 174, -3 }, /* (80) select ::= WITH wqlist selectnowith */ { 174, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */ { 174, -1 }, /* (82) select ::= selectnowith */ { 206, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */ { 209, -1 }, /* (84) multiselect_op ::= UNION */ { 209, -2 }, /* (85) multiselect_op ::= UNION ALL */ { 209, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */ | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | | | | | | | | | | | | | | | | | | | | > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < | | | | > | | | | | | | | | | | | | | | | | 147096 147097 147098 147099 147100 147101 147102 147103 147104 147105 147106 147107 147108 147109 147110 147111 147112 147113 147114 147115 147116 147117 147118 147119 147120 147121 147122 147123 147124 147125 147126 147127 147128 147129 147130 147131 147132 147133 147134 147135 147136 147137 147138 147139 147140 147141 147142 147143 147144 147145 147146 147147 147148 147149 147150 147151 147152 147153 147154 147155 147156 147157 147158 147159 147160 147161 147162 147163 147164 147165 147166 147167 147168 147169 147170 147171 147172 147173 147174 147175 147176 147177 147178 147179 147180 147181 147182 147183 147184 147185 147186 147187 147188 147189 147190 147191 147192 147193 147194 147195 147196 147197 147198 147199 147200 147201 147202 147203 147204 147205 147206 147207 147208 147209 147210 147211 147212 147213 147214 147215 147216 147217 147218 147219 147220 147221 147222 147223 147224 147225 147226 147227 147228 147229 147230 147231 147232 147233 147234 147235 147236 147237 147238 147239 147240 147241 147242 147243 147244 147245 147246 147247 147248 147249 147250 147251 147252 147253 147254 147255 147256 147257 147258 147259 147260 147261 147262 147263 147264 147265 147266 147267 147268 147269 147270 147271 147272 147273 147274 147275 147276 147277 147278 147279 147280 147281 147282 147283 147284 147285 147286 147287 147288 147289 147290 147291 147292 147293 147294 147295 147296 147297 147298 147299 147300 147301 147302 147303 147304 147305 147306 147307 147308 147309 147310 147311 147312 147313 147314 147315 147316 147317 147318 147319 147320 147321 147322 147323 147324 147325 147326 147327 147328 147329 147330 147331 147332 147333 147334 147335 147336 147337 147338 147339 147340 147341 147342 147343 147344 147345 147346 147347 147348 147349 147350 147351 147352 147353 147354 147355 147356 147357 147358 147359 147360 147361 147362 147363 147364 147365 147366 147367 147368 147369 147370 147371 147372 147373 147374 147375 147376 147377 147378 147379 147380 147381 147382 147383 147384 147385 147386 147387 147388 | { 174, -3 }, /* (80) select ::= WITH wqlist selectnowith */ { 174, -4 }, /* (81) select ::= WITH RECURSIVE wqlist selectnowith */ { 174, -1 }, /* (82) select ::= selectnowith */ { 206, -3 }, /* (83) selectnowith ::= selectnowith multiselect_op oneselect */ { 209, -1 }, /* (84) multiselect_op ::= UNION */ { 209, -2 }, /* (85) multiselect_op ::= UNION ALL */ { 209, -1 }, /* (86) multiselect_op ::= EXCEPT|INTERSECT */ { 207, -9 }, /* (87) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { 207, -10 }, /* (88) oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { 219, -4 }, /* (89) values ::= VALUES LP nexprlist RP */ { 219, -5 }, /* (90) values ::= values COMMA LP nexprlist RP */ { 210, -1 }, /* (91) distinct ::= DISTINCT */ { 210, -1 }, /* (92) distinct ::= ALL */ { 210, 0 }, /* (93) distinct ::= */ { 221, 0 }, /* (94) sclp ::= */ { 211, -5 }, /* (95) selcollist ::= sclp scanpt expr scanpt as */ { 211, -3 }, /* (96) selcollist ::= sclp scanpt STAR */ { 211, -5 }, /* (97) selcollist ::= sclp scanpt nm DOT STAR */ { 222, -2 }, /* (98) as ::= AS nm */ { 222, 0 }, /* (99) as ::= */ { 212, 0 }, /* (100) from ::= */ { 212, -2 }, /* (101) from ::= FROM seltablist */ { 224, -2 }, /* (102) stl_prefix ::= seltablist joinop */ { 224, 0 }, /* (103) stl_prefix ::= */ { 223, -7 }, /* (104) seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { 223, -9 }, /* (105) seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { 223, -7 }, /* (106) seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { 223, -7 }, /* (107) seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { 170, 0 }, /* (108) dbnm ::= */ { 170, -2 }, /* (109) dbnm ::= DOT nm */ { 205, -1 }, /* (110) fullname ::= nm */ { 205, -3 }, /* (111) fullname ::= nm DOT nm */ { 230, -1 }, /* (112) xfullname ::= nm */ { 230, -3 }, /* (113) xfullname ::= nm DOT nm */ { 230, -5 }, /* (114) xfullname ::= nm DOT nm AS nm */ { 230, -3 }, /* (115) xfullname ::= nm AS nm */ { 225, -1 }, /* (116) joinop ::= COMMA|JOIN */ { 225, -2 }, /* (117) joinop ::= JOIN_KW JOIN */ { 225, -3 }, /* (118) joinop ::= JOIN_KW nm JOIN */ { 225, -4 }, /* (119) joinop ::= JOIN_KW nm nm JOIN */ { 227, -2 }, /* (120) on_opt ::= ON expr */ { 227, 0 }, /* (121) on_opt ::= */ { 226, 0 }, /* (122) indexed_opt ::= */ { 226, -3 }, /* (123) indexed_opt ::= INDEXED BY nm */ { 226, -2 }, /* (124) indexed_opt ::= NOT INDEXED */ { 228, -4 }, /* (125) using_opt ::= USING LP idlist RP */ { 228, 0 }, /* (126) using_opt ::= */ { 216, 0 }, /* (127) orderby_opt ::= */ { 216, -3 }, /* (128) orderby_opt ::= ORDER BY sortlist */ { 198, -4 }, /* (129) sortlist ::= sortlist COMMA expr sortorder */ { 198, -2 }, /* (130) sortlist ::= expr sortorder */ { 187, -1 }, /* (131) sortorder ::= ASC */ { 187, -1 }, /* (132) sortorder ::= DESC */ { 187, 0 }, /* (133) sortorder ::= */ { 214, 0 }, /* (134) groupby_opt ::= */ { 214, -3 }, /* (135) groupby_opt ::= GROUP BY nexprlist */ { 215, 0 }, /* (136) having_opt ::= */ { 215, -2 }, /* (137) having_opt ::= HAVING expr */ { 217, 0 }, /* (138) limit_opt ::= */ { 217, -2 }, /* (139) limit_opt ::= LIMIT expr */ { 217, -4 }, /* (140) limit_opt ::= LIMIT expr OFFSET expr */ { 217, -4 }, /* (141) limit_opt ::= LIMIT expr COMMA expr */ { 160, -6 }, /* (142) cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ { 213, 0 }, /* (143) where_opt ::= */ { 213, -2 }, /* (144) where_opt ::= WHERE expr */ { 160, -8 }, /* (145) cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ { 233, -5 }, /* (146) setlist ::= setlist COMMA nm EQ expr */ { 233, -7 }, /* (147) setlist ::= setlist COMMA LP idlist RP EQ expr */ { 233, -3 }, /* (148) setlist ::= nm EQ expr */ { 233, -5 }, /* (149) setlist ::= LP idlist RP EQ expr */ { 160, -7 }, /* (150) cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { 160, -7 }, /* (151) cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ { 236, 0 }, /* (152) upsert ::= */ { 236, -11 }, /* (153) upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ { 236, -8 }, /* (154) upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ { 236, -4 }, /* (155) upsert ::= ON CONFLICT DO NOTHING */ { 234, -2 }, /* (156) insert_cmd ::= INSERT orconf */ { 234, -1 }, /* (157) insert_cmd ::= REPLACE */ { 235, 0 }, /* (158) idlist_opt ::= */ { 235, -3 }, /* (159) idlist_opt ::= LP idlist RP */ { 231, -3 }, /* (160) idlist ::= idlist COMMA nm */ { 231, -1 }, /* (161) idlist ::= nm */ { 185, -3 }, /* (162) expr ::= LP expr RP */ { 185, -1 }, /* (163) expr ::= ID|INDEXED */ { 185, -1 }, /* (164) expr ::= JOIN_KW */ { 185, -3 }, /* (165) expr ::= nm DOT nm */ { 185, -5 }, /* (166) expr ::= nm DOT nm DOT nm */ { 184, -1 }, /* (167) term ::= NULL|FLOAT|BLOB */ { 184, -1 }, /* (168) term ::= STRING */ { 184, -1 }, /* (169) term ::= INTEGER */ { 185, -1 }, /* (170) expr ::= VARIABLE */ { 185, -3 }, /* (171) expr ::= expr COLLATE ID|STRING */ { 185, -6 }, /* (172) expr ::= CAST LP expr AS typetoken RP */ { 185, -5 }, /* (173) expr ::= ID|INDEXED LP distinct exprlist RP */ { 185, -4 }, /* (174) expr ::= ID|INDEXED LP STAR RP */ { 185, -6 }, /* (175) expr ::= ID|INDEXED LP distinct exprlist RP over_clause */ { 185, -5 }, /* (176) expr ::= ID|INDEXED LP STAR RP over_clause */ { 184, -1 }, /* (177) term ::= CTIME_KW */ { 185, -5 }, /* (178) expr ::= LP nexprlist COMMA expr RP */ { 185, -3 }, /* (179) expr ::= expr AND expr */ { 185, -3 }, /* (180) expr ::= expr OR expr */ { 185, -3 }, /* (181) expr ::= expr LT|GT|GE|LE expr */ { 185, -3 }, /* (182) expr ::= expr EQ|NE expr */ { 185, -3 }, /* (183) expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ { 185, -3 }, /* (184) expr ::= expr PLUS|MINUS expr */ { 185, -3 }, /* (185) expr ::= expr STAR|SLASH|REM expr */ { 185, -3 }, /* (186) expr ::= expr CONCAT expr */ { 238, -2 }, /* (187) likeop ::= NOT LIKE_KW|MATCH */ { 185, -3 }, /* (188) expr ::= expr likeop expr */ { 185, -5 }, /* (189) expr ::= expr likeop expr ESCAPE expr */ { 185, -2 }, /* (190) expr ::= expr ISNULL|NOTNULL */ { 185, -3 }, /* (191) expr ::= expr NOT NULL */ { 185, -3 }, /* (192) expr ::= expr IS expr */ { 185, -4 }, /* (193) expr ::= expr IS NOT expr */ { 185, -2 }, /* (194) expr ::= NOT expr */ { 185, -2 }, /* (195) expr ::= BITNOT expr */ { 185, -2 }, /* (196) expr ::= PLUS|MINUS expr */ { 239, -1 }, /* (197) between_op ::= BETWEEN */ { 239, -2 }, /* (198) between_op ::= NOT BETWEEN */ { 185, -5 }, /* (199) expr ::= expr between_op expr AND expr */ { 240, -1 }, /* (200) in_op ::= IN */ { 240, -2 }, /* (201) in_op ::= NOT IN */ { 185, -5 }, /* (202) expr ::= expr in_op LP exprlist RP */ { 185, -3 }, /* (203) expr ::= LP select RP */ { 185, -5 }, /* (204) expr ::= expr in_op LP select RP */ { 185, -5 }, /* (205) expr ::= expr in_op nm dbnm paren_exprlist */ { 185, -4 }, /* (206) expr ::= EXISTS LP select RP */ { 185, -5 }, /* (207) expr ::= CASE case_operand case_exprlist case_else END */ { 243, -5 }, /* (208) case_exprlist ::= case_exprlist WHEN expr THEN expr */ { 243, -4 }, /* (209) case_exprlist ::= WHEN expr THEN expr */ { 244, -2 }, /* (210) case_else ::= ELSE expr */ { 244, 0 }, /* (211) case_else ::= */ { 242, -1 }, /* (212) case_operand ::= expr */ { 242, 0 }, /* (213) case_operand ::= */ { 229, 0 }, /* (214) exprlist ::= */ { 220, -3 }, /* (215) nexprlist ::= nexprlist COMMA expr */ { 220, -1 }, /* (216) nexprlist ::= expr */ { 241, 0 }, /* (217) paren_exprlist ::= */ { 241, -3 }, /* (218) paren_exprlist ::= LP exprlist RP */ { 160, -12 }, /* (219) cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { 245, -1 }, /* (220) uniqueflag ::= UNIQUE */ { 245, 0 }, /* (221) uniqueflag ::= */ { 189, 0 }, /* (222) eidlist_opt ::= */ { 189, -3 }, /* (223) eidlist_opt ::= LP eidlist RP */ { 199, -5 }, /* (224) eidlist ::= eidlist COMMA nm collate sortorder */ { 199, -3 }, /* (225) eidlist ::= nm collate sortorder */ { 246, 0 }, /* (226) collate ::= */ { 246, -2 }, /* (227) collate ::= COLLATE ID|STRING */ { 160, -4 }, /* (228) cmd ::= DROP INDEX ifexists fullname */ { 160, -1 }, /* (229) cmd ::= VACUUM */ { 160, -2 }, /* (230) cmd ::= VACUUM nm */ { 160, -3 }, /* (231) cmd ::= PRAGMA nm dbnm */ { 160, -5 }, /* (232) cmd ::= PRAGMA nm dbnm EQ nmnum */ { 160, -6 }, /* (233) cmd ::= PRAGMA nm dbnm LP nmnum RP */ { 160, -5 }, /* (234) cmd ::= PRAGMA nm dbnm EQ minus_num */ { 160, -6 }, /* (235) cmd ::= PRAGMA nm dbnm LP minus_num RP */ { 180, -2 }, /* (236) plus_num ::= PLUS INTEGER|FLOAT */ { 181, -2 }, /* (237) minus_num ::= MINUS INTEGER|FLOAT */ { 160, -5 }, /* (238) cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ { 248, -11 }, /* (239) trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ { 250, -1 }, /* (240) trigger_time ::= BEFORE|AFTER */ { 250, -2 }, /* (241) trigger_time ::= INSTEAD OF */ { 250, 0 }, /* (242) trigger_time ::= */ { 251, -1 }, /* (243) trigger_event ::= DELETE|INSERT */ { 251, -1 }, /* (244) trigger_event ::= UPDATE */ { 251, -3 }, /* (245) trigger_event ::= UPDATE OF idlist */ { 253, 0 }, /* (246) when_clause ::= */ { 253, -2 }, /* (247) when_clause ::= WHEN expr */ { 249, -3 }, /* (248) trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { 249, -2 }, /* (249) trigger_cmd_list ::= trigger_cmd SEMI */ { 255, -3 }, /* (250) trnm ::= nm DOT nm */ { 256, -3 }, /* (251) tridxby ::= INDEXED BY nm */ { 256, -2 }, /* (252) tridxby ::= NOT INDEXED */ { 254, -8 }, /* (253) trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ { 254, -8 }, /* (254) trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { 254, -6 }, /* (255) trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ { 254, -3 }, /* (256) trigger_cmd ::= scanpt select scanpt */ { 185, -4 }, /* (257) expr ::= RAISE LP IGNORE RP */ { 185, -6 }, /* (258) expr ::= RAISE LP raisetype COMMA nm RP */ { 203, -1 }, /* (259) raisetype ::= ROLLBACK */ { 203, -1 }, /* (260) raisetype ::= ABORT */ { 203, -1 }, /* (261) raisetype ::= FAIL */ { 160, -4 }, /* (262) cmd ::= DROP TRIGGER ifexists fullname */ { 160, -6 }, /* (263) cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { 160, -3 }, /* (264) cmd ::= DETACH database_kw_opt expr */ { 258, 0 }, /* (265) key_opt ::= */ { 258, -2 }, /* (266) key_opt ::= KEY expr */ { 160, -1 }, /* (267) cmd ::= REINDEX */ { 160, -3 }, /* (268) cmd ::= REINDEX nm dbnm */ { 160, -1 }, /* (269) cmd ::= ANALYZE */ { 160, -3 }, /* (270) cmd ::= ANALYZE nm dbnm */ { 160, -6 }, /* (271) cmd ::= ALTER TABLE fullname RENAME TO nm */ { 160, -7 }, /* (272) cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { 259, -1 }, /* (273) add_column_fullname ::= fullname */ { 160, -1 }, /* (274) cmd ::= create_vtab */ { 160, -4 }, /* (275) cmd ::= create_vtab LP vtabarglist RP */ { 261, -8 }, /* (276) create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { 263, 0 }, /* (277) vtabarg ::= */ { 264, -1 }, /* (278) vtabargtoken ::= ANY */ { 264, -3 }, /* (279) vtabargtoken ::= lp anylist RP */ { 265, -1 }, /* (280) lp ::= LP */ { 232, -2 }, /* (281) with ::= WITH wqlist */ { 232, -3 }, /* (282) with ::= WITH RECURSIVE wqlist */ { 208, -6 }, /* (283) wqlist ::= nm eidlist_opt AS LP select RP */ { 208, -8 }, /* (284) wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { 267, -1 }, /* (285) windowdefn_list ::= windowdefn */ { 267, -3 }, /* (286) windowdefn_list ::= windowdefn_list COMMA windowdefn */ { 268, -3 }, /* (287) windowdefn ::= nm AS window */ { 269, -5 }, /* (288) window ::= LP part_opt orderby_opt frame_opt RP */ { 271, -3 }, /* (289) part_opt ::= PARTITION BY nexprlist */ { 271, 0 }, /* (290) part_opt ::= */ { 270, 0 }, /* (291) frame_opt ::= */ { 270, -2 }, /* (292) frame_opt ::= range_or_rows frame_bound_s */ { 270, -5 }, /* (293) frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ { 273, -1 }, /* (294) range_or_rows ::= RANGE */ { 273, -1 }, /* (295) range_or_rows ::= ROWS */ { 275, -1 }, /* (296) frame_bound_s ::= frame_bound */ { 275, -2 }, /* (297) frame_bound_s ::= UNBOUNDED PRECEDING */ { 276, -1 }, /* (298) frame_bound_e ::= frame_bound */ { 276, -2 }, /* (299) frame_bound_e ::= UNBOUNDED FOLLOWING */ { 274, -2 }, /* (300) frame_bound ::= expr PRECEDING */ { 274, -2 }, /* (301) frame_bound ::= CURRENT ROW */ { 274, -2 }, /* (302) frame_bound ::= expr FOLLOWING */ { 218, -2 }, /* (303) window_clause ::= WINDOW windowdefn_list */ { 237, -3 }, /* (304) over_clause ::= filter_opt OVER window */ { 237, -3 }, /* (305) over_clause ::= filter_opt OVER nm */ { 272, 0 }, /* (306) filter_opt ::= */ { 272, -5 }, /* (307) filter_opt ::= FILTER LP WHERE expr RP */ { 155, -1 }, /* (308) input ::= cmdlist */ { 156, -2 }, /* (309) cmdlist ::= cmdlist ecmd */ { 156, -1 }, /* (310) cmdlist ::= ecmd */ { 157, -1 }, /* (311) ecmd ::= SEMI */ { 157, -2 }, /* (312) ecmd ::= cmdx SEMI */ { 157, -2 }, /* (313) ecmd ::= explain cmdx */ { 162, 0 }, /* (314) trans_opt ::= */ { 162, -1 }, /* (315) trans_opt ::= TRANSACTION */ { 162, -2 }, /* (316) trans_opt ::= TRANSACTION nm */ { 164, -1 }, /* (317) savepoint_opt ::= SAVEPOINT */ { 164, 0 }, /* (318) savepoint_opt ::= */ { 160, -2 }, /* (319) cmd ::= create_table create_table_args */ { 171, -4 }, /* (320) columnlist ::= columnlist COMMA columnname carglist */ { 171, -2 }, /* (321) columnlist ::= columnname carglist */ { 163, -1 }, /* (322) nm ::= ID|INDEXED */ { 163, -1 }, /* (323) nm ::= STRING */ { 163, -1 }, /* (324) nm ::= JOIN_KW */ { 177, -1 }, /* (325) typetoken ::= typename */ { 178, -1 }, /* (326) typename ::= ID|STRING */ { 179, -1 }, /* (327) signed ::= plus_num */ { 179, -1 }, /* (328) signed ::= minus_num */ { 176, -2 }, /* (329) carglist ::= carglist ccons */ { 176, 0 }, /* (330) carglist ::= */ { 183, -2 }, /* (331) ccons ::= NULL onconf */ { 172, -2 }, /* (332) conslist_opt ::= COMMA conslist */ { 195, -3 }, /* (333) conslist ::= conslist tconscomma tcons */ { 195, -1 }, /* (334) conslist ::= tcons */ { 196, 0 }, /* (335) tconscomma ::= */ { 200, -1 }, /* (336) defer_subclause_opt ::= defer_subclause */ { 202, -1 }, /* (337) resolvetype ::= raisetype */ { 206, -1 }, /* (338) selectnowith ::= oneselect */ { 207, -1 }, /* (339) oneselect ::= values */ { 221, -2 }, /* (340) sclp ::= selcollist COMMA */ { 222, -1 }, /* (341) as ::= ID|STRING */ { 185, -1 }, /* (342) expr ::= term */ { 238, -1 }, /* (343) likeop ::= LIKE_KW|MATCH */ { 229, -1 }, /* (344) exprlist ::= nexprlist */ { 247, -1 }, /* (345) nmnum ::= plus_num */ { 247, -1 }, /* (346) nmnum ::= nm */ { 247, -1 }, /* (347) nmnum ::= ON */ { 247, -1 }, /* (348) nmnum ::= DELETE */ { 247, -1 }, /* (349) nmnum ::= DEFAULT */ { 180, -1 }, /* (350) plus_num ::= INTEGER|FLOAT */ { 252, 0 }, /* (351) foreach_clause ::= */ { 252, -3 }, /* (352) foreach_clause ::= FOR EACH ROW */ { 255, -1 }, /* (353) trnm ::= nm */ { 256, 0 }, /* (354) tridxby ::= */ { 257, -1 }, /* (355) database_kw_opt ::= DATABASE */ { 257, 0 }, /* (356) database_kw_opt ::= */ { 260, 0 }, /* (357) kwcolumn_opt ::= */ { 260, -1 }, /* (358) kwcolumn_opt ::= COLUMNKW */ { 262, -1 }, /* (359) vtabarglist ::= vtabarg */ { 262, -3 }, /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ { 263, -2 }, /* (361) vtabarg ::= vtabarg vtabargtoken */ { 266, 0 }, /* (362) anylist ::= */ { 266, -4 }, /* (363) anylist ::= anylist LP anylist RP */ { 266, -2 }, /* (364) anylist ::= anylist ANY */ { 232, 0 }, /* (365) with ::= */ }; static void yy_accept(yyParser*); /* Forward Declaration */ /* ** Perform a reduce action and the shift that must immediately ** follow the reduce. |
︙ | ︙ | |||
147594 147595 147596 147597 147598 147599 147600 | case 15: /* ifnotexists ::= */ case 18: /* temp ::= */ yytestcase(yyruleno==18); case 21: /* table_options ::= */ yytestcase(yyruleno==21); case 42: /* autoinc ::= */ yytestcase(yyruleno==42); case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); case 76: /* ifexists ::= */ yytestcase(yyruleno==76); | | | | 147515 147516 147517 147518 147519 147520 147521 147522 147523 147524 147525 147526 147527 147528 147529 147530 | case 15: /* ifnotexists ::= */ case 18: /* temp ::= */ yytestcase(yyruleno==18); case 21: /* table_options ::= */ yytestcase(yyruleno==21); case 42: /* autoinc ::= */ yytestcase(yyruleno==42); case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); case 76: /* ifexists ::= */ yytestcase(yyruleno==76); case 93: /* distinct ::= */ yytestcase(yyruleno==93); case 226: /* collate ::= */ yytestcase(yyruleno==226); {yymsp[1].minor.yy70 = 0;} break; case 16: /* ifnotexists ::= IF NOT EXISTS */ {yymsp[-2].minor.yy70 = 1;} break; case 17: /* temp ::= TEMP */ case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43); |
︙ | ︙ | |||
147631 147632 147633 147634 147635 147636 147637 | } break; case 23: /* columnname ::= nm typetoken */ {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} break; case 24: /* typetoken ::= */ case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60); | | | 147552 147553 147554 147555 147556 147557 147558 147559 147560 147561 147562 147563 147564 147565 147566 | } break; case 23: /* columnname ::= nm typetoken */ {sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} break; case 24: /* typetoken ::= */ case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60); case 99: /* as ::= */ yytestcase(yyruleno==99); {yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;} break; case 25: /* typetoken ::= typename LP signed RP */ { yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z); } break; |
︙ | ︙ | |||
147742 147743 147744 147745 147746 147747 147748 | { yymsp[-1].minor.yy70 = OE_None; /* EV: R-33326-45252 */} break; case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ {yymsp[-2].minor.yy70 = 0;} break; case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); | | | | | | 147663 147664 147665 147666 147667 147668 147669 147670 147671 147672 147673 147674 147675 147676 147677 147678 147679 147680 147681 147682 147683 147684 | { yymsp[-1].minor.yy70 = OE_None; /* EV: R-33326-45252 */} break; case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ {yymsp[-2].minor.yy70 = 0;} break; case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); case 156: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==156); {yymsp[-1].minor.yy70 = yymsp[0].minor.yy70;} break; case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); case 198: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==198); case 201: /* in_op ::= NOT IN */ yytestcase(yyruleno==201); case 227: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==227); {yymsp[-1].minor.yy70 = 1;} break; case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ {yymsp[-1].minor.yy70 = 0;} break; case 61: /* tconscomma ::= COMMA */ {pParse->constraintName.n = 0;} |
︙ | ︙ | |||
147785 147786 147787 147788 147789 147790 147791 | case 69: /* onconf ::= ON CONFLICT resolvetype */ {yymsp[-2].minor.yy70 = yymsp[0].minor.yy70;} break; case 72: /* resolvetype ::= IGNORE */ {yymsp[0].minor.yy70 = OE_Ignore;} break; case 73: /* resolvetype ::= REPLACE */ | | | 147706 147707 147708 147709 147710 147711 147712 147713 147714 147715 147716 147717 147718 147719 147720 | case 69: /* onconf ::= ON CONFLICT resolvetype */ {yymsp[-2].minor.yy70 = yymsp[0].minor.yy70;} break; case 72: /* resolvetype ::= IGNORE */ {yymsp[0].minor.yy70 = OE_Ignore;} break; case 73: /* resolvetype ::= REPLACE */ case 157: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==157); {yymsp[0].minor.yy70 = OE_Replace;} break; case 74: /* cmd ::= DROP TABLE ifexists fullname */ { sqlite3DropTable(pParse, yymsp[0].minor.yy135, 0, yymsp[-1].minor.yy70); } break; |
︙ | ︙ | |||
147874 147875 147876 147877 147878 147879 147880 | case 84: /* multiselect_op ::= UNION */ case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86); {yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-OP*/} break; case 85: /* multiselect_op ::= UNION ALL */ {yymsp[-1].minor.yy70 = TK_ALL;} break; | | > > > > > < < | | | | | | | | | | | | | | | | | | | | | | | | | | 147795 147796 147797 147798 147799 147800 147801 147802 147803 147804 147805 147806 147807 147808 147809 147810 147811 147812 147813 147814 147815 147816 147817 147818 147819 147820 147821 147822 147823 147824 147825 147826 147827 147828 147829 147830 147831 147832 147833 147834 147835 147836 147837 147838 147839 147840 147841 147842 147843 147844 147845 147846 147847 147848 147849 147850 147851 147852 147853 147854 147855 147856 147857 147858 147859 147860 147861 147862 147863 147864 147865 147866 147867 147868 147869 147870 147871 147872 147873 147874 147875 147876 147877 147878 147879 147880 147881 147882 147883 147884 147885 147886 147887 147888 147889 147890 147891 147892 147893 147894 147895 147896 147897 147898 147899 147900 147901 147902 147903 147904 147905 147906 147907 147908 147909 147910 147911 147912 147913 147914 147915 147916 147917 147918 | case 84: /* multiselect_op ::= UNION */ case 86: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==86); {yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-OP*/} break; case 85: /* multiselect_op ::= UNION ALL */ {yymsp[-1].minor.yy70 = TK_ALL;} break; case 87: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ { yymsp[-8].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy420,yymsp[-5].minor.yy135,yymsp[-4].minor.yy18,yymsp[-3].minor.yy420,yymsp[-2].minor.yy18,yymsp[-1].minor.yy420,yymsp[-7].minor.yy70,yymsp[0].minor.yy18); } break; case 88: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt window_clause orderby_opt limit_opt */ { yymsp[-9].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-7].minor.yy420,yymsp[-6].minor.yy135,yymsp[-5].minor.yy18,yymsp[-4].minor.yy420,yymsp[-3].minor.yy18,yymsp[-1].minor.yy420,yymsp[-8].minor.yy70,yymsp[0].minor.yy18); if( yymsp[-9].minor.yy489 ){ yymsp[-9].minor.yy489->pWinDefn = yymsp[-2].minor.yy327; }else{ sqlite3WindowListDelete(pParse->db, yymsp[-2].minor.yy327); } } break; case 89: /* values ::= VALUES LP nexprlist RP */ { yymsp[-3].minor.yy489 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values,0); } break; case 90: /* values ::= values COMMA LP nexprlist RP */ { Select *pRight, *pLeft = yymsp[-4].minor.yy489; pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy420,0,0,0,0,0,SF_Values|SF_MultiValue,0); if( ALWAYS(pLeft) ) pLeft->selFlags &= ~SF_MultiValue; if( pRight ){ pRight->op = TK_ALL; pRight->pPrior = pLeft; yymsp[-4].minor.yy489 = pRight; }else{ yymsp[-4].minor.yy489 = pLeft; } } break; case 91: /* distinct ::= DISTINCT */ {yymsp[0].minor.yy70 = SF_Distinct;} break; case 92: /* distinct ::= ALL */ {yymsp[0].minor.yy70 = SF_All;} break; case 94: /* sclp ::= */ case 127: /* orderby_opt ::= */ yytestcase(yyruleno==127); case 134: /* groupby_opt ::= */ yytestcase(yyruleno==134); case 214: /* exprlist ::= */ yytestcase(yyruleno==214); case 217: /* paren_exprlist ::= */ yytestcase(yyruleno==217); case 222: /* eidlist_opt ::= */ yytestcase(yyruleno==222); {yymsp[1].minor.yy420 = 0;} break; case 95: /* selcollist ::= sclp scanpt expr scanpt as */ { yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[-2].minor.yy18); if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[0].minor.yy0, 1); sqlite3ExprListSetSpan(pParse,yymsp[-4].minor.yy420,yymsp[-3].minor.yy392,yymsp[-1].minor.yy392); } break; case 96: /* selcollist ::= sclp scanpt STAR */ { Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0); yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy420, p); } break; case 97: /* selcollist ::= sclp scanpt nm DOT STAR */ { Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0); Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight); yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, pDot); } break; case 98: /* as ::= AS nm */ case 109: /* dbnm ::= DOT nm */ yytestcase(yyruleno==109); case 236: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==236); case 237: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==237); {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} break; case 100: /* from ::= */ {yymsp[1].minor.yy135 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy135));} break; case 101: /* from ::= FROM seltablist */ { yymsp[-1].minor.yy135 = yymsp[0].minor.yy135; sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy135); } break; case 102: /* stl_prefix ::= seltablist joinop */ { if( ALWAYS(yymsp[-1].minor.yy135 && yymsp[-1].minor.yy135->nSrc>0) ) yymsp[-1].minor.yy135->a[yymsp[-1].minor.yy135->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy70; } break; case 103: /* stl_prefix ::= */ {yymsp[1].minor.yy135 = 0;} break; case 104: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ { yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy135, &yymsp[-2].minor.yy0); } break; case 105: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */ { yymsp[-8].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy135,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy135, yymsp[-4].minor.yy420); } break; case 106: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ { yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy489,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); } break; case 107: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ { if( yymsp[-6].minor.yy135==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy18==0 && yymsp[0].minor.yy48==0 ){ yymsp[-6].minor.yy135 = yymsp[-4].minor.yy135; }else if( yymsp[-4].minor.yy135->nSrc==1 ){ yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); if( yymsp[-6].minor.yy135 ){ struct SrcList_item *pNew = &yymsp[-6].minor.yy135->a[yymsp[-6].minor.yy135->nSrc-1]; |
︙ | ︙ | |||
148004 148005 148006 148007 148008 148009 148010 | Select *pSubquery; sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy135); pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy135,0,0,0,0,SF_NestedFrom,0); yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); } } break; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 147928 147929 147930 147931 147932 147933 147934 147935 147936 147937 147938 147939 147940 147941 147942 147943 147944 147945 147946 147947 147948 147949 147950 147951 147952 147953 147954 147955 147956 147957 147958 147959 147960 147961 147962 147963 147964 147965 147966 147967 147968 147969 147970 147971 147972 147973 147974 147975 147976 147977 147978 147979 147980 147981 147982 147983 147984 147985 147986 147987 147988 147989 147990 147991 147992 147993 147994 147995 147996 147997 147998 147999 148000 148001 148002 148003 148004 148005 148006 148007 148008 148009 148010 148011 148012 148013 148014 148015 148016 148017 148018 148019 148020 148021 148022 148023 148024 148025 148026 148027 148028 148029 148030 148031 148032 148033 148034 148035 148036 148037 148038 148039 148040 148041 148042 148043 148044 148045 148046 148047 148048 148049 148050 148051 148052 148053 148054 148055 148056 148057 148058 148059 148060 148061 148062 148063 148064 148065 148066 148067 148068 148069 148070 148071 148072 148073 148074 148075 148076 148077 148078 148079 148080 148081 148082 148083 148084 148085 148086 148087 148088 148089 148090 148091 148092 148093 148094 148095 148096 148097 148098 148099 148100 148101 148102 148103 148104 148105 148106 148107 148108 148109 148110 148111 148112 148113 148114 148115 148116 148117 148118 148119 148120 148121 148122 148123 148124 148125 148126 148127 148128 148129 148130 148131 148132 148133 148134 148135 148136 148137 148138 148139 148140 148141 | Select *pSubquery; sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy135); pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy135,0,0,0,0,SF_NestedFrom,0); yymsp[-6].minor.yy135 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy135,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy18,yymsp[0].minor.yy48); } } break; case 108: /* dbnm ::= */ case 122: /* indexed_opt ::= */ yytestcase(yyruleno==122); {yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;} break; case 110: /* fullname ::= nm */ case 112: /* xfullname ::= nm */ yytestcase(yyruleno==112); {yymsp[0].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[0].minor.yy0,0); /*A-overwrites-X*/} break; case 111: /* fullname ::= nm DOT nm */ case 113: /* xfullname ::= nm DOT nm */ yytestcase(yyruleno==113); {yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 114: /* xfullname ::= nm DOT nm AS nm */ { yymsp[-4].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,&yymsp[-2].minor.yy0); /*A-overwrites-X*/ if( yymsp[-4].minor.yy135 ) yymsp[-4].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 115: /* xfullname ::= nm AS nm */ { yymsp[-2].minor.yy135 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-2].minor.yy0,0); /*A-overwrites-X*/ if( yymsp[-2].minor.yy135 ) yymsp[-2].minor.yy135->a[0].zAlias = sqlite3NameFromToken(pParse->db, &yymsp[0].minor.yy0); } break; case 116: /* joinop ::= COMMA|JOIN */ { yymsp[0].minor.yy70 = JT_INNER; } break; case 117: /* joinop ::= JOIN_KW JOIN */ {yymsp[-1].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/} break; case 118: /* joinop ::= JOIN_KW nm JOIN */ {yymsp[-2].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/} break; case 119: /* joinop ::= JOIN_KW nm nm JOIN */ {yymsp[-3].minor.yy70 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} break; case 120: /* on_opt ::= ON expr */ case 137: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==137); case 144: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==144); case 210: /* case_else ::= ELSE expr */ yytestcase(yyruleno==210); {yymsp[-1].minor.yy18 = yymsp[0].minor.yy18;} break; case 121: /* on_opt ::= */ case 136: /* having_opt ::= */ yytestcase(yyruleno==136); case 138: /* limit_opt ::= */ yytestcase(yyruleno==138); case 143: /* where_opt ::= */ yytestcase(yyruleno==143); case 211: /* case_else ::= */ yytestcase(yyruleno==211); case 213: /* case_operand ::= */ yytestcase(yyruleno==213); {yymsp[1].minor.yy18 = 0;} break; case 123: /* indexed_opt ::= INDEXED BY nm */ {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} break; case 124: /* indexed_opt ::= NOT INDEXED */ {yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;} break; case 125: /* using_opt ::= USING LP idlist RP */ {yymsp[-3].minor.yy48 = yymsp[-1].minor.yy48;} break; case 126: /* using_opt ::= */ case 158: /* idlist_opt ::= */ yytestcase(yyruleno==158); {yymsp[1].minor.yy48 = 0;} break; case 128: /* orderby_opt ::= ORDER BY sortlist */ case 135: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==135); {yymsp[-2].minor.yy420 = yymsp[0].minor.yy420;} break; case 129: /* sortlist ::= sortlist COMMA expr sortorder */ { yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420,yymsp[-1].minor.yy18); sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy420,yymsp[0].minor.yy70); } break; case 130: /* sortlist ::= expr sortorder */ { yymsp[-1].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy18); /*A-overwrites-Y*/ sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy420,yymsp[0].minor.yy70); } break; case 131: /* sortorder ::= ASC */ {yymsp[0].minor.yy70 = SQLITE_SO_ASC;} break; case 132: /* sortorder ::= DESC */ {yymsp[0].minor.yy70 = SQLITE_SO_DESC;} break; case 133: /* sortorder ::= */ {yymsp[1].minor.yy70 = SQLITE_SO_UNDEFINED;} break; case 139: /* limit_opt ::= LIMIT expr */ {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,0);} break; case 140: /* limit_opt ::= LIMIT expr OFFSET expr */ {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);} break; case 141: /* limit_opt ::= LIMIT expr COMMA expr */ {yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_LIMIT,yymsp[0].minor.yy18,yymsp[-2].minor.yy18);} break; case 142: /* cmd ::= with DELETE FROM xfullname indexed_opt where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy135, &yymsp[-1].minor.yy0); sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy135,yymsp[0].minor.yy18,0,0); } break; case 145: /* cmd ::= with UPDATE orconf xfullname indexed_opt SET setlist where_opt */ { sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy135, &yymsp[-3].minor.yy0); sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy420,"set list"); sqlite3Update(pParse,yymsp[-4].minor.yy135,yymsp[-1].minor.yy420,yymsp[0].minor.yy18,yymsp[-5].minor.yy70,0,0,0); } break; case 146: /* setlist ::= setlist COMMA nm EQ expr */ { yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy420, yymsp[0].minor.yy18); sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, 1); } break; case 147: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ { yymsp[-6].minor.yy420 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy420, yymsp[-3].minor.yy48, yymsp[0].minor.yy18); } break; case 148: /* setlist ::= nm EQ expr */ { yylhsminor.yy420 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy18); sqlite3ExprListSetName(pParse, yylhsminor.yy420, &yymsp[-2].minor.yy0, 1); } yymsp[-2].minor.yy420 = yylhsminor.yy420; break; case 149: /* setlist ::= LP idlist RP EQ expr */ { yymsp[-4].minor.yy420 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy48, yymsp[0].minor.yy18); } break; case 150: /* cmd ::= with insert_cmd INTO xfullname idlist_opt select upsert */ { sqlite3Insert(pParse, yymsp[-3].minor.yy135, yymsp[-1].minor.yy489, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, yymsp[0].minor.yy340); } break; case 151: /* cmd ::= with insert_cmd INTO xfullname idlist_opt DEFAULT VALUES */ { sqlite3Insert(pParse, yymsp[-3].minor.yy135, 0, yymsp[-2].minor.yy48, yymsp[-5].minor.yy70, 0); } break; case 152: /* upsert ::= */ { yymsp[1].minor.yy340 = 0; } break; case 153: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO UPDATE SET setlist where_opt */ { yymsp[-10].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-7].minor.yy420,yymsp[-5].minor.yy18,yymsp[-1].minor.yy420,yymsp[0].minor.yy18);} break; case 154: /* upsert ::= ON CONFLICT LP sortlist RP where_opt DO NOTHING */ { yymsp[-7].minor.yy340 = sqlite3UpsertNew(pParse->db,yymsp[-4].minor.yy420,yymsp[-2].minor.yy18,0,0); } break; case 155: /* upsert ::= ON CONFLICT DO NOTHING */ { yymsp[-3].minor.yy340 = sqlite3UpsertNew(pParse->db,0,0,0,0); } break; case 159: /* idlist_opt ::= LP idlist RP */ {yymsp[-2].minor.yy48 = yymsp[-1].minor.yy48;} break; case 160: /* idlist ::= idlist COMMA nm */ {yymsp[-2].minor.yy48 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy48,&yymsp[0].minor.yy0);} break; case 161: /* idlist ::= nm */ {yymsp[0].minor.yy48 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} break; case 162: /* expr ::= LP expr RP */ {yymsp[-2].minor.yy18 = yymsp[-1].minor.yy18;} break; case 163: /* expr ::= ID|INDEXED */ case 164: /* expr ::= JOIN_KW */ yytestcase(yyruleno==164); {yymsp[0].minor.yy18=tokenExpr(pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 165: /* expr ::= nm DOT nm */ { Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp2); } yymsp[-2].minor.yy18 = yylhsminor.yy18; break; case 166: /* expr ::= nm DOT nm DOT nm */ { Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1); Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1); Expr *temp3 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1); Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3); yylhsminor.yy18 = sqlite3PExpr(pParse, TK_DOT, temp1, temp4); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; case 167: /* term ::= NULL|FLOAT|BLOB */ case 168: /* term ::= STRING */ yytestcase(yyruleno==168); {yymsp[0].minor.yy18=tokenExpr(pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/} break; case 169: /* term ::= INTEGER */ { yylhsminor.yy18 = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1); } yymsp[0].minor.yy18 = yylhsminor.yy18; break; case 170: /* expr ::= VARIABLE */ { if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ u32 n = yymsp[0].minor.yy0.n; yymsp[0].minor.yy18 = tokenExpr(pParse, TK_VARIABLE, yymsp[0].minor.yy0); sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy18, n); }else{ /* When doing a nested parse, one can include terms in an expression |
︙ | ︙ | |||
148225 148226 148227 148228 148229 148230 148231 | }else{ yymsp[0].minor.yy18 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable); } } } break; | | | | | < | > > > > | < < | > > > > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 148149 148150 148151 148152 148153 148154 148155 148156 148157 148158 148159 148160 148161 148162 148163 148164 148165 148166 148167 148168 148169 148170 148171 148172 148173 148174 148175 148176 148177 148178 148179 148180 148181 148182 148183 148184 148185 148186 148187 148188 148189 148190 148191 148192 148193 148194 148195 148196 148197 148198 148199 148200 148201 148202 148203 148204 148205 148206 148207 148208 148209 148210 148211 148212 148213 148214 148215 148216 148217 148218 148219 148220 148221 148222 148223 148224 148225 148226 148227 148228 148229 148230 148231 148232 148233 148234 148235 148236 148237 148238 148239 148240 148241 148242 148243 148244 148245 148246 148247 148248 148249 148250 148251 148252 148253 148254 148255 148256 148257 148258 148259 148260 148261 148262 148263 148264 148265 148266 148267 148268 148269 148270 148271 148272 148273 148274 148275 148276 148277 148278 148279 148280 148281 148282 148283 148284 148285 148286 148287 148288 148289 148290 148291 148292 148293 148294 148295 148296 148297 148298 148299 148300 | }else{ yymsp[0].minor.yy18 = sqlite3PExpr(pParse, TK_REGISTER, 0, 0); if( yymsp[0].minor.yy18 ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy18->iTable); } } } break; case 171: /* expr ::= expr COLLATE ID|STRING */ { yymsp[-2].minor.yy18 = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy18, &yymsp[0].minor.yy0, 1); } break; case 172: /* expr ::= CAST LP expr AS typetoken RP */ { yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1); sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy18, yymsp[-3].minor.yy18, 0); } break; case 173: /* expr ::= ID|INDEXED LP distinct exprlist RP */ { yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy420, &yymsp[-4].minor.yy0, yymsp[-2].minor.yy70); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; case 174: /* expr ::= ID|INDEXED LP STAR RP */ { yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0, 0); } yymsp[-3].minor.yy18 = yylhsminor.yy18; break; case 175: /* expr ::= ID|INDEXED LP distinct exprlist RP over_clause */ { yylhsminor.yy18 = sqlite3ExprFunction(pParse, yymsp[-2].minor.yy420, &yymsp[-5].minor.yy0, yymsp[-3].minor.yy70); sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327); } yymsp[-5].minor.yy18 = yylhsminor.yy18; break; case 176: /* expr ::= ID|INDEXED LP STAR RP over_clause */ { yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[-4].minor.yy0, 0); sqlite3WindowAttach(pParse, yylhsminor.yy18, yymsp[0].minor.yy327); } yymsp[-4].minor.yy18 = yylhsminor.yy18; break; case 177: /* term ::= CTIME_KW */ { yylhsminor.yy18 = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0, 0); } yymsp[0].minor.yy18 = yylhsminor.yy18; break; case 178: /* expr ::= LP nexprlist COMMA expr RP */ { ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy420, yymsp[-1].minor.yy18); yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_VECTOR, 0, 0); if( yymsp[-4].minor.yy18 ){ yymsp[-4].minor.yy18->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } } break; case 179: /* expr ::= expr AND expr */ case 180: /* expr ::= expr OR expr */ yytestcase(yyruleno==180); case 181: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==181); case 182: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==182); case 183: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==183); case 184: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==184); case 185: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==185); case 186: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==186); {yymsp[-2].minor.yy18=sqlite3PExpr(pParse,yymsp[-1].major,yymsp[-2].minor.yy18,yymsp[0].minor.yy18);} break; case 187: /* likeop ::= NOT LIKE_KW|MATCH */ {yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/} break; case 188: /* expr ::= expr likeop expr */ { ExprList *pList; int bNot = yymsp[-1].minor.yy0.n & 0x80000000; yymsp[-1].minor.yy0.n &= 0x7fffffff; pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy18); pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy18); yymsp[-2].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy0, 0); if( bNot ) yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-2].minor.yy18, 0); if( yymsp[-2].minor.yy18 ) yymsp[-2].minor.yy18->flags |= EP_InfixFunc; } break; case 189: /* expr ::= expr likeop expr ESCAPE expr */ { ExprList *pList; int bNot = yymsp[-3].minor.yy0.n & 0x80000000; yymsp[-3].minor.yy0.n &= 0x7fffffff; pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18); pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy18); pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18); yymsp[-4].minor.yy18 = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy0, 0); if( bNot ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); if( yymsp[-4].minor.yy18 ) yymsp[-4].minor.yy18->flags |= EP_InfixFunc; } break; case 190: /* expr ::= expr ISNULL|NOTNULL */ {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse,yymsp[0].major,yymsp[-1].minor.yy18,0);} break; case 191: /* expr ::= expr NOT NULL */ {yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_NOTNULL,yymsp[-2].minor.yy18,0);} break; case 192: /* expr ::= expr IS expr */ { yymsp[-2].minor.yy18 = sqlite3PExpr(pParse,TK_IS,yymsp[-2].minor.yy18,yymsp[0].minor.yy18); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-2].minor.yy18, TK_ISNULL); } break; case 193: /* expr ::= expr IS NOT expr */ { yymsp[-3].minor.yy18 = sqlite3PExpr(pParse,TK_ISNOT,yymsp[-3].minor.yy18,yymsp[0].minor.yy18); binaryToUnaryIfNull(pParse, yymsp[0].minor.yy18, yymsp[-3].minor.yy18, TK_NOTNULL); } break; case 194: /* expr ::= NOT expr */ case 195: /* expr ::= BITNOT expr */ yytestcase(yyruleno==195); {yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major, yymsp[0].minor.yy18, 0);/*A-overwrites-B*/} break; case 196: /* expr ::= PLUS|MINUS expr */ { yymsp[-1].minor.yy18 = sqlite3PExpr(pParse, yymsp[-1].major==TK_PLUS ? TK_UPLUS : TK_UMINUS, yymsp[0].minor.yy18, 0); /*A-overwrites-B*/ } break; case 197: /* between_op ::= BETWEEN */ case 200: /* in_op ::= IN */ yytestcase(yyruleno==200); {yymsp[0].minor.yy70 = 0;} break; case 199: /* expr ::= expr between_op expr AND expr */ { ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18); pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy18); yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy18, 0); if( yymsp[-4].minor.yy18 ){ yymsp[-4].minor.yy18->x.pList = pList; }else{ sqlite3ExprListDelete(pParse->db, pList); } if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); } break; case 202: /* expr ::= expr in_op LP exprlist RP */ { if( yymsp[-1].minor.yy420==0 ){ /* Expressions of the form ** ** expr1 IN () ** expr1 NOT IN () ** |
︙ | ︙ | |||
148408 148409 148410 148411 148412 148413 148414 | }else{ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy420); } if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); } } break; | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 148338 148339 148340 148341 148342 148343 148344 148345 148346 148347 148348 148349 148350 148351 148352 148353 148354 148355 148356 148357 148358 148359 148360 148361 148362 148363 148364 148365 148366 148367 148368 148369 148370 148371 148372 148373 148374 148375 148376 148377 148378 148379 148380 148381 148382 148383 148384 148385 148386 148387 148388 148389 148390 148391 148392 148393 148394 148395 148396 148397 148398 148399 148400 148401 148402 148403 148404 148405 148406 148407 148408 148409 148410 148411 148412 148413 148414 148415 148416 148417 148418 148419 148420 148421 148422 148423 148424 148425 148426 148427 148428 148429 148430 148431 148432 148433 148434 148435 148436 148437 148438 148439 148440 148441 148442 148443 148444 148445 148446 148447 148448 148449 148450 148451 148452 148453 148454 148455 148456 148457 148458 148459 148460 148461 148462 148463 148464 148465 148466 148467 148468 148469 148470 148471 148472 148473 148474 148475 148476 148477 148478 148479 148480 148481 148482 148483 148484 148485 148486 148487 148488 148489 148490 148491 148492 148493 148494 148495 148496 148497 148498 148499 148500 148501 148502 148503 148504 148505 148506 148507 148508 148509 148510 148511 148512 148513 148514 148515 148516 148517 148518 148519 148520 148521 148522 148523 148524 148525 148526 148527 148528 148529 148530 148531 148532 148533 148534 148535 148536 148537 148538 148539 148540 148541 148542 148543 148544 148545 148546 148547 148548 148549 148550 148551 148552 148553 148554 148555 148556 148557 148558 148559 148560 148561 148562 148563 148564 148565 148566 148567 148568 148569 148570 148571 148572 148573 148574 148575 148576 148577 148578 148579 148580 148581 148582 148583 148584 148585 148586 148587 148588 148589 148590 148591 148592 148593 148594 148595 148596 148597 148598 148599 148600 148601 148602 148603 148604 148605 148606 148607 148608 148609 148610 148611 148612 148613 148614 148615 148616 148617 148618 148619 148620 148621 148622 148623 148624 148625 148626 148627 148628 148629 148630 148631 148632 148633 148634 148635 148636 148637 148638 148639 148640 148641 148642 148643 148644 148645 148646 148647 148648 148649 148650 148651 148652 148653 148654 148655 148656 148657 148658 148659 148660 148661 148662 148663 148664 148665 148666 148667 148668 148669 148670 148671 148672 148673 148674 148675 148676 148677 148678 148679 148680 148681 148682 148683 148684 148685 148686 148687 148688 148689 148690 148691 148692 148693 148694 148695 148696 148697 148698 148699 148700 148701 148702 148703 148704 148705 148706 148707 148708 148709 148710 148711 148712 148713 148714 148715 148716 148717 148718 148719 148720 148721 148722 148723 148724 148725 148726 148727 148728 148729 148730 148731 148732 148733 148734 148735 148736 148737 148738 148739 148740 148741 148742 148743 148744 148745 148746 148747 148748 148749 148750 148751 148752 148753 148754 148755 148756 148757 148758 148759 148760 148761 148762 148763 148764 148765 148766 148767 148768 148769 148770 148771 148772 148773 148774 148775 148776 148777 148778 148779 148780 148781 148782 148783 148784 148785 148786 148787 148788 148789 148790 148791 148792 148793 148794 148795 148796 148797 148798 148799 148800 148801 148802 148803 148804 148805 148806 148807 148808 148809 148810 148811 148812 148813 148814 148815 148816 148817 148818 148819 148820 148821 | }else{ sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy420); } if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); } } break; case 203: /* expr ::= LP select RP */ { yymsp[-2].minor.yy18 = sqlite3PExpr(pParse, TK_SELECT, 0, 0); sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy18, yymsp[-1].minor.yy489); } break; case 204: /* expr ::= expr in_op LP select RP */ { yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0); sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, yymsp[-1].minor.yy489); if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); } break; case 205: /* expr ::= expr in_op nm dbnm paren_exprlist */ { SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0); if( yymsp[0].minor.yy420 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy420); yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy18, 0); sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy18, pSelect); if( yymsp[-3].minor.yy70 ) yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_NOT, yymsp[-4].minor.yy18, 0); } break; case 206: /* expr ::= EXISTS LP select RP */ { Expr *p; p = yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_EXISTS, 0, 0); sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy489); } break; case 207: /* expr ::= CASE case_operand case_exprlist case_else END */ { yymsp[-4].minor.yy18 = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy18, 0); if( yymsp[-4].minor.yy18 ){ yymsp[-4].minor.yy18->x.pList = yymsp[-1].minor.yy18 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[-1].minor.yy18) : yymsp[-2].minor.yy420; sqlite3ExprSetHeightAndFlags(pParse, yymsp[-4].minor.yy18); }else{ sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy420); sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy18); } } break; case 208: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ { yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[-2].minor.yy18); yymsp[-4].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy420, yymsp[0].minor.yy18); } break; case 209: /* case_exprlist ::= WHEN expr THEN expr */ { yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy18); yymsp[-3].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy420, yymsp[0].minor.yy18); } break; case 212: /* case_operand ::= expr */ {yymsp[0].minor.yy18 = yymsp[0].minor.yy18; /*A-overwrites-X*/} break; case 215: /* nexprlist ::= nexprlist COMMA expr */ {yymsp[-2].minor.yy420 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy420,yymsp[0].minor.yy18);} break; case 216: /* nexprlist ::= expr */ {yymsp[0].minor.yy420 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy18); /*A-overwrites-Y*/} break; case 218: /* paren_exprlist ::= LP exprlist RP */ case 223: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==223); {yymsp[-2].minor.yy420 = yymsp[-1].minor.yy420;} break; case 219: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ { sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy420, yymsp[-10].minor.yy70, &yymsp[-11].minor.yy0, yymsp[0].minor.yy18, SQLITE_SO_ASC, yymsp[-8].minor.yy70, SQLITE_IDXTYPE_APPDEF); } break; case 220: /* uniqueflag ::= UNIQUE */ case 260: /* raisetype ::= ABORT */ yytestcase(yyruleno==260); {yymsp[0].minor.yy70 = OE_Abort;} break; case 221: /* uniqueflag ::= */ {yymsp[1].minor.yy70 = OE_None;} break; case 224: /* eidlist ::= eidlist COMMA nm collate sortorder */ { yymsp[-4].minor.yy420 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy420, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70); } break; case 225: /* eidlist ::= nm collate sortorder */ { yymsp[-2].minor.yy420 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy70, yymsp[0].minor.yy70); /*A-overwrites-Y*/ } break; case 228: /* cmd ::= DROP INDEX ifexists fullname */ {sqlite3DropIndex(pParse, yymsp[0].minor.yy135, yymsp[-1].minor.yy70);} break; case 229: /* cmd ::= VACUUM */ {sqlite3Vacuum(pParse,0);} break; case 230: /* cmd ::= VACUUM nm */ {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);} break; case 231: /* cmd ::= PRAGMA nm dbnm */ {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} break; case 232: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} break; case 233: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} break; case 234: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} break; case 235: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} break; case 238: /* 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.yy207, &all); } break; case 239: /* 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.yy70, yymsp[-4].minor.yy34.a, yymsp[-4].minor.yy34.b, yymsp[-2].minor.yy135, yymsp[0].minor.yy18, yymsp[-10].minor.yy70, yymsp[-8].minor.yy70); yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ } break; case 240: /* trigger_time ::= BEFORE|AFTER */ { yymsp[0].minor.yy70 = yymsp[0].major; /*A-overwrites-X*/ } break; case 241: /* trigger_time ::= INSTEAD OF */ { yymsp[-1].minor.yy70 = TK_INSTEAD;} break; case 242: /* trigger_time ::= */ { yymsp[1].minor.yy70 = TK_BEFORE; } break; case 243: /* trigger_event ::= DELETE|INSERT */ case 244: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==244); {yymsp[0].minor.yy34.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy34.b = 0;} break; case 245: /* trigger_event ::= UPDATE OF idlist */ {yymsp[-2].minor.yy34.a = TK_UPDATE; yymsp[-2].minor.yy34.b = yymsp[0].minor.yy48;} break; case 246: /* when_clause ::= */ case 265: /* key_opt ::= */ yytestcase(yyruleno==265); case 306: /* filter_opt ::= */ yytestcase(yyruleno==306); { yymsp[1].minor.yy18 = 0; } break; case 247: /* when_clause ::= WHEN expr */ case 266: /* key_opt ::= KEY expr */ yytestcase(yyruleno==266); { yymsp[-1].minor.yy18 = yymsp[0].minor.yy18; } break; case 248: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ { assert( yymsp[-2].minor.yy207!=0 ); yymsp[-2].minor.yy207->pLast->pNext = yymsp[-1].minor.yy207; yymsp[-2].minor.yy207->pLast = yymsp[-1].minor.yy207; } break; case 249: /* trigger_cmd_list ::= trigger_cmd SEMI */ { assert( yymsp[-1].minor.yy207!=0 ); yymsp[-1].minor.yy207->pLast = yymsp[-1].minor.yy207; } break; case 250: /* trnm ::= nm DOT nm */ { yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; sqlite3ErrorMsg(pParse, "qualified table names are not allowed on INSERT, UPDATE, and DELETE " "statements within triggers"); } break; case 251: /* tridxby ::= INDEXED BY nm */ { sqlite3ErrorMsg(pParse, "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 252: /* tridxby ::= NOT INDEXED */ { sqlite3ErrorMsg(pParse, "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " "within triggers"); } break; case 253: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt scanpt */ {yylhsminor.yy207 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-5].minor.yy0, yymsp[-2].minor.yy420, yymsp[-1].minor.yy18, yymsp[-6].minor.yy70, yymsp[-7].minor.yy0.z, yymsp[0].minor.yy392);} yymsp[-7].minor.yy207 = yylhsminor.yy207; break; case 254: /* trigger_cmd ::= scanpt insert_cmd INTO trnm idlist_opt select upsert scanpt */ { yylhsminor.yy207 = sqlite3TriggerInsertStep(pParse->db,&yymsp[-4].minor.yy0,yymsp[-3].minor.yy48,yymsp[-2].minor.yy489,yymsp[-6].minor.yy70,yymsp[-1].minor.yy340,yymsp[-7].minor.yy392,yymsp[0].minor.yy392);/*yylhsminor.yy207-overwrites-yymsp[-6].minor.yy70*/ } yymsp[-7].minor.yy207 = yylhsminor.yy207; break; case 255: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt scanpt */ {yylhsminor.yy207 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-3].minor.yy0, yymsp[-1].minor.yy18, yymsp[-5].minor.yy0.z, yymsp[0].minor.yy392);} yymsp[-5].minor.yy207 = yylhsminor.yy207; break; case 256: /* trigger_cmd ::= scanpt select scanpt */ {yylhsminor.yy207 = sqlite3TriggerSelectStep(pParse->db, yymsp[-1].minor.yy489, yymsp[-2].minor.yy392, yymsp[0].minor.yy392); /*yylhsminor.yy207-overwrites-yymsp[-1].minor.yy489*/} yymsp[-2].minor.yy207 = yylhsminor.yy207; break; case 257: /* expr ::= RAISE LP IGNORE RP */ { yymsp[-3].minor.yy18 = sqlite3PExpr(pParse, TK_RAISE, 0, 0); if( yymsp[-3].minor.yy18 ){ yymsp[-3].minor.yy18->affinity = OE_Ignore; } } break; case 258: /* expr ::= RAISE LP raisetype COMMA nm RP */ { yymsp[-5].minor.yy18 = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1); if( yymsp[-5].minor.yy18 ) { yymsp[-5].minor.yy18->affinity = (char)yymsp[-3].minor.yy70; } } break; case 259: /* raisetype ::= ROLLBACK */ {yymsp[0].minor.yy70 = OE_Rollback;} break; case 261: /* raisetype ::= FAIL */ {yymsp[0].minor.yy70 = OE_Fail;} break; case 262: /* cmd ::= DROP TRIGGER ifexists fullname */ { sqlite3DropTrigger(pParse,yymsp[0].minor.yy135,yymsp[-1].minor.yy70); } break; case 263: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ { sqlite3Attach(pParse, yymsp[-3].minor.yy18, yymsp[-1].minor.yy18, yymsp[0].minor.yy18); } break; case 264: /* cmd ::= DETACH database_kw_opt expr */ { sqlite3Detach(pParse, yymsp[0].minor.yy18); } break; case 267: /* cmd ::= REINDEX */ {sqlite3Reindex(pParse, 0, 0);} break; case 268: /* cmd ::= REINDEX nm dbnm */ {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 269: /* cmd ::= ANALYZE */ {sqlite3Analyze(pParse, 0, 0);} break; case 270: /* cmd ::= ANALYZE nm dbnm */ {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} break; case 271: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ { sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy135,&yymsp[0].minor.yy0); } break; case 272: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ { yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); } break; case 273: /* add_column_fullname ::= fullname */ { disableLookaside(pParse); sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy135); } break; case 274: /* cmd ::= create_vtab */ {sqlite3VtabFinishParse(pParse,0);} break; case 275: /* cmd ::= create_vtab LP vtabarglist RP */ {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} break; case 276: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ { sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy70); } break; case 277: /* vtabarg ::= */ {sqlite3VtabArgInit(pParse);} break; case 278: /* vtabargtoken ::= ANY */ case 279: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==279); case 280: /* lp ::= LP */ yytestcase(yyruleno==280); {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} break; case 281: /* with ::= WITH wqlist */ case 282: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==282); { sqlite3WithPush(pParse, yymsp[0].minor.yy449, 1); } break; case 283: /* wqlist ::= nm eidlist_opt AS LP select RP */ { yymsp[-5].minor.yy449 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); /*A-overwrites-X*/ } break; case 284: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ { yymsp[-7].minor.yy449 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy449, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy420, yymsp[-1].minor.yy489); } break; case 285: /* windowdefn_list ::= windowdefn */ { yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[0].minor.yy327 = yylhsminor.yy327; break; case 286: /* windowdefn_list ::= windowdefn_list COMMA windowdefn */ { assert( yymsp[0].minor.yy327!=0 ); yymsp[0].minor.yy327->pNextWin = yymsp[-2].minor.yy327; yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 287: /* windowdefn ::= nm AS window */ { if( ALWAYS(yymsp[0].minor.yy327) ){ yymsp[0].minor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[-2].minor.yy0.z, yymsp[-2].minor.yy0.n); } yylhsminor.yy327 = yymsp[0].minor.yy327; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 288: /* window ::= LP part_opt orderby_opt frame_opt RP */ { yymsp[-4].minor.yy327 = yymsp[-1].minor.yy327; if( ALWAYS(yymsp[-4].minor.yy327) ){ yymsp[-4].minor.yy327->pPartition = yymsp[-3].minor.yy420; yymsp[-4].minor.yy327->pOrderBy = yymsp[-2].minor.yy420; } } break; case 289: /* part_opt ::= PARTITION BY nexprlist */ { yymsp[-2].minor.yy420 = yymsp[0].minor.yy420; } break; case 290: /* part_opt ::= */ { yymsp[1].minor.yy420 = 0; } break; case 291: /* frame_opt ::= */ { yymsp[1].minor.yy327 = sqlite3WindowAlloc(pParse, TK_RANGE, TK_UNBOUNDED, 0, TK_CURRENT, 0); } break; case 292: /* frame_opt ::= range_or_rows frame_bound_s */ { yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-1].minor.yy70, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr, TK_CURRENT, 0); } yymsp[-1].minor.yy327 = yylhsminor.yy327; break; case 293: /* frame_opt ::= range_or_rows BETWEEN frame_bound_s AND frame_bound_e */ { yylhsminor.yy327 = sqlite3WindowAlloc(pParse, yymsp[-4].minor.yy70, yymsp[-2].minor.yy119.eType, yymsp[-2].minor.yy119.pExpr, yymsp[0].minor.yy119.eType, yymsp[0].minor.yy119.pExpr); } yymsp[-4].minor.yy327 = yylhsminor.yy327; break; case 294: /* range_or_rows ::= RANGE */ { yymsp[0].minor.yy70 = TK_RANGE; } break; case 295: /* range_or_rows ::= ROWS */ { yymsp[0].minor.yy70 = TK_ROWS; } break; case 296: /* frame_bound_s ::= frame_bound */ case 298: /* frame_bound_e ::= frame_bound */ yytestcase(yyruleno==298); { yylhsminor.yy119 = yymsp[0].minor.yy119; } yymsp[0].minor.yy119 = yylhsminor.yy119; break; case 297: /* frame_bound_s ::= UNBOUNDED PRECEDING */ case 299: /* frame_bound_e ::= UNBOUNDED FOLLOWING */ yytestcase(yyruleno==299); {yymsp[-1].minor.yy119.eType = TK_UNBOUNDED; yymsp[-1].minor.yy119.pExpr = 0;} break; case 300: /* frame_bound ::= expr PRECEDING */ { yylhsminor.yy119.eType = TK_PRECEDING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } yymsp[-1].minor.yy119 = yylhsminor.yy119; break; case 301: /* frame_bound ::= CURRENT ROW */ { yymsp[-1].minor.yy119.eType = TK_CURRENT ; yymsp[-1].minor.yy119.pExpr = 0; } break; case 302: /* frame_bound ::= expr FOLLOWING */ { yylhsminor.yy119.eType = TK_FOLLOWING; yylhsminor.yy119.pExpr = yymsp[-1].minor.yy18; } yymsp[-1].minor.yy119 = yylhsminor.yy119; break; case 303: /* window_clause ::= WINDOW windowdefn_list */ { yymsp[-1].minor.yy327 = yymsp[0].minor.yy327; } break; case 304: /* over_clause ::= filter_opt OVER window */ { yylhsminor.yy327 = yymsp[0].minor.yy327; assert( yylhsminor.yy327!=0 ); yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 305: /* over_clause ::= filter_opt OVER nm */ { yylhsminor.yy327 = (Window*)sqlite3DbMallocZero(pParse->db, sizeof(Window)); if( yylhsminor.yy327 ){ yylhsminor.yy327->zName = sqlite3DbStrNDup(pParse->db, yymsp[0].minor.yy0.z, yymsp[0].minor.yy0.n); yylhsminor.yy327->pFilter = yymsp[-2].minor.yy18; }else{ sqlite3ExprDelete(pParse->db, yymsp[-2].minor.yy18); } } yymsp[-2].minor.yy327 = yylhsminor.yy327; break; case 307: /* filter_opt ::= FILTER LP WHERE expr RP */ { yymsp[-4].minor.yy18 = yymsp[-1].minor.yy18; } break; default: /* (308) input ::= cmdlist */ yytestcase(yyruleno==308); /* (309) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==309); /* (310) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=310); /* (311) ecmd ::= SEMI */ yytestcase(yyruleno==311); /* (312) ecmd ::= cmdx SEMI */ yytestcase(yyruleno==312); /* (313) ecmd ::= explain cmdx */ yytestcase(yyruleno==313); /* (314) trans_opt ::= */ yytestcase(yyruleno==314); /* (315) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==315); /* (316) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==316); /* (317) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==317); /* (318) savepoint_opt ::= */ yytestcase(yyruleno==318); /* (319) cmd ::= create_table create_table_args */ yytestcase(yyruleno==319); /* (320) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==320); /* (321) columnlist ::= columnname carglist */ yytestcase(yyruleno==321); /* (322) nm ::= ID|INDEXED */ yytestcase(yyruleno==322); /* (323) nm ::= STRING */ yytestcase(yyruleno==323); /* (324) nm ::= JOIN_KW */ yytestcase(yyruleno==324); /* (325) typetoken ::= typename */ yytestcase(yyruleno==325); /* (326) typename ::= ID|STRING */ yytestcase(yyruleno==326); /* (327) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=327); /* (328) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=328); /* (329) carglist ::= carglist ccons */ yytestcase(yyruleno==329); /* (330) carglist ::= */ yytestcase(yyruleno==330); /* (331) ccons ::= NULL onconf */ yytestcase(yyruleno==331); /* (332) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==332); /* (333) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==333); /* (334) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=334); /* (335) tconscomma ::= */ yytestcase(yyruleno==335); /* (336) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=336); /* (337) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=337); /* (338) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=338); /* (339) oneselect ::= values */ yytestcase(yyruleno==339); /* (340) sclp ::= selcollist COMMA */ yytestcase(yyruleno==340); /* (341) as ::= ID|STRING */ yytestcase(yyruleno==341); /* (342) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=342); /* (343) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==343); /* (344) exprlist ::= nexprlist */ yytestcase(yyruleno==344); /* (345) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=345); /* (346) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=346); /* (347) nmnum ::= ON */ yytestcase(yyruleno==347); /* (348) nmnum ::= DELETE */ yytestcase(yyruleno==348); /* (349) nmnum ::= DEFAULT */ yytestcase(yyruleno==349); /* (350) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==350); /* (351) foreach_clause ::= */ yytestcase(yyruleno==351); /* (352) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==352); /* (353) trnm ::= nm */ yytestcase(yyruleno==353); /* (354) tridxby ::= */ yytestcase(yyruleno==354); /* (355) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==355); /* (356) database_kw_opt ::= */ yytestcase(yyruleno==356); /* (357) kwcolumn_opt ::= */ yytestcase(yyruleno==357); /* (358) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==358); /* (359) vtabarglist ::= vtabarg */ yytestcase(yyruleno==359); /* (360) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==360); /* (361) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==361); /* (362) anylist ::= */ yytestcase(yyruleno==362); /* (363) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==363); /* (364) anylist ::= anylist ANY */ yytestcase(yyruleno==364); /* (365) with ::= */ yytestcase(yyruleno==365); break; /********** End reduce actions ************************************************/ }; assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); yygoto = yyRuleInfo[yyruleno].lhs; yysize = yyRuleInfo[yyruleno].nrhs; yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto); |
︙ | ︙ | |||
151536 151537 151538 151539 151540 151541 151542 151543 151544 151545 151546 151547 151548 151549 | */ }else{ rc = nKey1 - nKey2; } } return rc; } /* ** Another built-in collating sequence: NOCASE. ** ** This collating sequence is intended to be used for "case independent ** comparison". SQLite's knowledge of upper and lower case equivalents ** extends only to the 26 characters used in the English language. | > > > > > > > > > | 151462 151463 151464 151465 151466 151467 151468 151469 151470 151471 151472 151473 151474 151475 151476 151477 151478 151479 151480 151481 151482 151483 151484 | */ }else{ rc = nKey1 - nKey2; } } return rc; } /* ** Return true if CollSeq is the default built-in BINARY. */ SQLITE_PRIVATE int sqlite3IsBinary(const CollSeq *p){ assert( p==0 || p->xCmp!=binCollFunc || p->pUser!=0 || strcmp(p->zName,"BINARY")==0 ); return p==0 || (p->xCmp==binCollFunc && p->pUser==0); } /* ** Another built-in collating sequence: NOCASE. ** ** This collating sequence is intended to be used for "case independent ** comparison". SQLite's knowledge of upper and lower case equivalents ** extends only to the 26 characters used in the English language. |
︙ | ︙ | |||
151658 151659 151660 151661 151662 151663 151664 | static void disconnectAllVtab(sqlite3 *db){ #ifndef SQLITE_OMIT_VIRTUALTABLE int i; HashElem *p; sqlite3BtreeEnterAll(db); for(i=0; i<db->nDb; i++){ Schema *pSchema = db->aDb[i].pSchema; | | | 151593 151594 151595 151596 151597 151598 151599 151600 151601 151602 151603 151604 151605 151606 151607 | static void disconnectAllVtab(sqlite3 *db){ #ifndef SQLITE_OMIT_VIRTUALTABLE int i; HashElem *p; sqlite3BtreeEnterAll(db); for(i=0; i<db->nDb; i++){ Schema *pSchema = db->aDb[i].pSchema; if( pSchema ){ for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ Table *pTab = (Table *)sqliteHashData(p); if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab); } } } for(p=sqliteHashFirst(&db->aModule); p; p=sqliteHashNext(p)){ |
︙ | ︙ | |||
154827 154828 154829 154830 154831 154832 154833 | #endif sqlite3_mutex_enter(db->mutex); if( db->autoCommit==0 ){ int iDb; iDb = sqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; | > > > | > > > > > > > > > > > | > | > > > | 154762 154763 154764 154765 154766 154767 154768 154769 154770 154771 154772 154773 154774 154775 154776 154777 154778 154779 154780 154781 154782 154783 154784 154785 154786 154787 154788 154789 154790 154791 154792 154793 154794 154795 154796 154797 154798 | #endif sqlite3_mutex_enter(db->mutex); if( db->autoCommit==0 ){ int iDb; iDb = sqlite3FindDbName(db, zDb); if( iDb==0 || iDb>1 ){ Btree *pBt = db->aDb[iDb].pBt; if( sqlite3BtreeIsInTrans(pBt)==0 ){ Pager *pPager = sqlite3BtreePager(pBt); int bUnlock = 0; if( sqlite3BtreeIsInReadTrans(pBt) ){ if( db->nVdbeActive==0 ){ rc = sqlite3PagerSnapshotCheck(pPager, pSnapshot); if( rc==SQLITE_OK ){ bUnlock = 1; rc = sqlite3BtreeCommit(pBt); } } }else{ rc = SQLITE_OK; } if( rc==SQLITE_OK ){ rc = sqlite3PagerSnapshotOpen(pPager, pSnapshot); } if( rc==SQLITE_OK ){ rc = sqlite3BtreeBeginTrans(pBt, 0, 0); sqlite3PagerSnapshotOpen(pPager, 0); } if( bUnlock ){ sqlite3PagerSnapshotUnlock(pPager); } } } } sqlite3_mutex_leave(db->mutex); #endif /* SQLITE_OMIT_WAL */ |
︙ | ︙ | |||
207690 207691 207692 207693 207694 207695 207696 | int nChar ){ int n = 0; int i; for(i=0; i<nChar; i++){ if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */ if( (unsigned char)p[n++]>=0xc0 ){ | | > > > | 207643 207644 207645 207646 207647 207648 207649 207650 207651 207652 207653 207654 207655 207656 207657 207658 207659 207660 | int nChar ){ int n = 0; int i; for(i=0; i<nChar; i++){ if( n>=nByte ) return 0; /* Input contains fewer than nChar chars */ if( (unsigned char)p[n++]>=0xc0 ){ while( (p[n] & 0xc0)==0x80 ){ n++; if( n>=nByte ) break; } } } return n; } /* ** pIn is a UTF-8 encoded string, nIn bytes in size. Return the number of |
︙ | ︙ | |||
211570 211571 211572 211573 211574 211575 211576 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); | | | 211526 211527 211528 211529 211530 211531 211532 211533 211534 211535 211536 211537 211538 211539 211540 | static void fts5SourceIdFunc( sqlite3_context *pCtx, /* Function call context */ int nArg, /* Number of args */ sqlite3_value **apUnused /* Function arguments */ ){ assert( nArg==0 ); UNUSED_PARAM2(nArg, apUnused); sqlite3_result_text(pCtx, "fts5: 2018-08-16 15:29:40 60045fbf52162f15f2e18a4e392e80fab19bdbce242728b5e62b0894eac49dfd", -1, SQLITE_TRANSIENT); } static int fts5Init(sqlite3 *db){ static const sqlite3_module fts5Mod = { /* iVersion */ 2, /* xCreate */ fts5CreateMethod, /* xConnect */ fts5ConnectMethod, |
︙ | ︙ | |||
216280 216281 216282 216283 216284 216285 216286 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ | | | | 216236 216237 216238 216239 216240 216241 216242 216243 216244 216245 216246 216247 216248 216249 | #endif return rc; } #endif /* SQLITE_CORE */ #endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */ /************** End of stmt.c ************************************************/ #if __LINE__!=216243 #undef SQLITE_SOURCE_ID #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0calt2" #endif /* Return the source-id for this library */ SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } /************************** End of sqlite3.c ******************************/ |
Changes to src/sqlite3.h.
︙ | ︙ | |||
121 122 123 124 125 126 127 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | ** ** See also: [sqlite3_libversion()], ** [sqlite3_libversion_number()], [sqlite3_sourceid()], ** [sqlite_version()] and [sqlite_source_id()]. */ #define SQLITE_VERSION "3.25.0" #define SQLITE_VERSION_NUMBER 3025000 #define SQLITE_SOURCE_ID "2018-08-16 16:24:24 456842924bb33c0af8af29402f06e5f25b6791f698a0d12a080258b20b0cfb61" /* ** CAPI3REF: Run-Time Library Version Numbers ** KEYWORDS: sqlite3_version sqlite3_sourceid ** ** These interfaces provide the same information as the [SQLITE_VERSION], ** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros |
︙ | ︙ | |||
8996 8997 8998 8999 9000 9001 9002 | ** ** The following must be true for this function to succeed. If any of ** the following statements are false when sqlite3_snapshot_get() is ** called, SQLITE_ERROR is returned. The final value of *P is undefined ** in this case. ** ** <ul> | | | 8996 8997 8998 8999 9000 9001 9002 9003 9004 9005 9006 9007 9008 9009 9010 | ** ** The following must be true for this function to succeed. If any of ** the following statements are false when sqlite3_snapshot_get() is ** called, SQLITE_ERROR is returned. The final value of *P is undefined ** in this case. ** ** <ul> ** <li> The database handle must not be in [autocommit mode]. ** ** <li> Schema S of [database connection] D must be a [WAL mode] database. ** ** <li> There must not be a write transaction open on schema S of database ** connection D. ** ** <li> One or more transactions must have been written to the current wal |
︙ | ︙ | |||
9031 9032 9033 9034 9035 9036 9037 | sqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot ** METHOD: sqlite3_snapshot ** | | | | | < | | | < | > > > > | > | < | > | > > > > > > > > | 9031 9032 9033 9034 9035 9036 9037 9038 9039 9040 9041 9042 9043 9044 9045 9046 9047 9048 9049 9050 9051 9052 9053 9054 9055 9056 9057 9058 9059 9060 9061 9062 9063 9064 9065 9066 9067 9068 9069 9070 9071 | sqlite3_snapshot **ppSnapshot ); /* ** CAPI3REF: Start a read transaction on an historical snapshot ** METHOD: sqlite3_snapshot ** ** ^The [sqlite3_snapshot_open(D,S,P)] interface either starts a new read ** transaction or upgrades an existing one for schema S of ** [database connection] D such that the read transaction refers to ** historical [snapshot] P, rather than the most recent change to the ** database. ^The [sqlite3_snapshot_open()] interface returns SQLITE_OK ** on success or an appropriate [error code] if it fails. ** ** ^In order to succeed, the database connection must not be in ** [autocommit mode] when [sqlite3_snapshot_open(D,S,P)] is called. If there ** is already a read transaction open on schema S, then the database handle ** must have no active statements (SELECT statements that have been passed ** to sqlite3_step() but not sqlite3_reset() or sqlite3_finalize()). ** SQLITE_ERROR is returned if either of these conditions is violated, or ** if schema S does not exist, or if the snapshot object is invalid. ** ** ^A call to sqlite3_snapshot_open() will fail to open if the specified ** snapshot has been overwritten by a [checkpoint]. In this case ** SQLITE_BUSY_SNAPSHOT is returned. ** ** If there is already a read transaction open when this function is ** invoked, then the same read transaction remains open (on the same ** database snapshot) if SQLITE_ERROR, SQLITE_BUSY or SQLITE_BUSY_SNAPSHOT ** is returned. If another error code - for example SQLITE_PROTOCOL or an ** SQLITE_IOERR error code - is returned, then the final state of the ** read transaction is undefined. If SQLITE_OK is returned, then the ** read transaction is now open on database snapshot P. ** ** ^(A call to [sqlite3_snapshot_open(D,S,P)] will fail if the ** database connection D does not know that the database file for ** schema S is in [WAL mode]. A database connection might not know ** that the database file is in [WAL mode] if there has been no prior ** I/O on that database connection, or if the database entered [WAL mode] ** after the most recent I/O on the database connection.)^ ** (Hint: Run "[PRAGMA application_id]" against a newly opened |
︙ | ︙ |