| | @@ -380,11 +380,11 @@ |
| 380 | 380 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 381 | 381 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 382 | 382 | */ |
| 383 | 383 | #define SQLITE_VERSION "3.15.0" |
| 384 | 384 | #define SQLITE_VERSION_NUMBER 3015000 |
| 385 | | -#define SQLITE_SOURCE_ID "2016-08-22 20:10:01 7839519349c7371cdb4e16a215eacd27004cbc62" |
| 385 | +#define SQLITE_SOURCE_ID "2016-09-07 19:54:24 ddb5f0558c44569913d22781ab78f3e9b58d7aea" |
| 386 | 386 | |
| 387 | 387 | /* |
| 388 | 388 | ** CAPI3REF: Run-Time Library Version Numbers |
| 389 | 389 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 390 | 390 | ** |
| | @@ -9477,16 +9477,16 @@ |
| 9477 | 9477 | void **ppOut /* OUT: Buffer containing output changeset */ |
| 9478 | 9478 | ); |
| 9479 | 9479 | |
| 9480 | 9480 | |
| 9481 | 9481 | /* |
| 9482 | | -** Changegroup handle. |
| 9482 | +** CAPI3REF: Changegroup Handle |
| 9483 | 9483 | */ |
| 9484 | 9484 | typedef struct sqlite3_changegroup sqlite3_changegroup; |
| 9485 | 9485 | |
| 9486 | 9486 | /* |
| 9487 | | -** CAPI3REF: Combine two or more changesets into a single changeset. |
| 9487 | +** CAPI3REF: Create A New Changegroup Object |
| 9488 | 9488 | ** |
| 9489 | 9489 | ** An sqlite3_changegroup object is used to combine two or more changesets |
| 9490 | 9490 | ** (or patchsets) into a single changeset (or patchset). A single changegroup |
| 9491 | 9491 | ** object may combine changesets or patchsets, but not both. The output is |
| 9492 | 9492 | ** always in the same format as the input. |
| | @@ -9519,10 +9519,12 @@ |
| 9519 | 9519 | ** versions sqlite3changegroup_add_strm() and sqlite3changegroup_output_strm(). |
| 9520 | 9520 | */ |
| 9521 | 9521 | int sqlite3changegroup_new(sqlite3_changegroup **pp); |
| 9522 | 9522 | |
| 9523 | 9523 | /* |
| 9524 | +** CAPI3REF: Add A Changeset To A Changegroup |
| 9525 | +** |
| 9524 | 9526 | ** Add all changes within the changeset (or patchset) in buffer pData (size |
| 9525 | 9527 | ** nData bytes) to the changegroup. |
| 9526 | 9528 | ** |
| 9527 | 9529 | ** If the buffer contains a patchset, then all prior calls to this function |
| 9528 | 9530 | ** on the same changegroup object must also have specified patchsets. Or, if |
| | @@ -9594,10 +9596,12 @@ |
| 9594 | 9596 | ** If no error occurs, SQLITE_OK is returned. |
| 9595 | 9597 | */ |
| 9596 | 9598 | int sqlite3changegroup_add(sqlite3_changegroup*, int nData, void *pData); |
| 9597 | 9599 | |
| 9598 | 9600 | /* |
| 9601 | +** CAPI3REF: Obtain A Composite Changeset From A Changegroup |
| 9602 | +** |
| 9599 | 9603 | ** Obtain a buffer containing a changeset (or patchset) representing the |
| 9600 | 9604 | ** current contents of the changegroup. If the inputs to the changegroup |
| 9601 | 9605 | ** were themselves changesets, the output is a changeset. Or, if the |
| 9602 | 9606 | ** inputs were patchsets, the output is also a patchset. |
| 9603 | 9607 | ** |
| | @@ -9622,11 +9626,11 @@ |
| 9622 | 9626 | int *pnData, /* OUT: Size of output buffer in bytes */ |
| 9623 | 9627 | void **ppData /* OUT: Pointer to output buffer */ |
| 9624 | 9628 | ); |
| 9625 | 9629 | |
| 9626 | 9630 | /* |
| 9627 | | -** Delete a changegroup object. |
| 9631 | +** CAPI3REF: Delete A Changegroup Object |
| 9628 | 9632 | */ |
| 9629 | 9633 | void sqlite3changegroup_delete(sqlite3_changegroup*); |
| 9630 | 9634 | |
| 9631 | 9635 | /* |
| 9632 | 9636 | ** CAPI3REF: Apply A Changeset To A Database |
| | @@ -11425,14 +11429,16 @@ |
| 11425 | 11429 | #define TK_AGG_FUNCTION 153 |
| 11426 | 11430 | #define TK_AGG_COLUMN 154 |
| 11427 | 11431 | #define TK_UMINUS 155 |
| 11428 | 11432 | #define TK_UPLUS 156 |
| 11429 | 11433 | #define TK_REGISTER 157 |
| 11430 | | -#define TK_ASTERISK 158 |
| 11431 | | -#define TK_SPAN 159 |
| 11432 | | -#define TK_SPACE 160 |
| 11433 | | -#define TK_ILLEGAL 161 |
| 11434 | +#define TK_VECTOR 158 |
| 11435 | +#define TK_SELECT_COLUMN 159 |
| 11436 | +#define TK_ASTERISK 160 |
| 11437 | +#define TK_SPAN 161 |
| 11438 | +#define TK_SPACE 162 |
| 11439 | +#define TK_ILLEGAL 163 |
| 11434 | 11440 | |
| 11435 | 11441 | /* The token codes above must all fit in 8 bits */ |
| 11436 | 11442 | #define TKFLG_MASK 0xff |
| 11437 | 11443 | |
| 11438 | 11444 | /* Flags that can be added to a token code when it is not |
| | @@ -12569,17 +12575,17 @@ |
| 12569 | 12575 | #define OP_Found 31 /* synopsis: key=r[P3@P4] */ |
| 12570 | 12576 | #define OP_SeekRowid 32 /* synopsis: intkey=r[P3] */ |
| 12571 | 12577 | #define OP_NotExists 33 /* synopsis: intkey=r[P3] */ |
| 12572 | 12578 | #define OP_IsNull 34 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ |
| 12573 | 12579 | #define OP_NotNull 35 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ |
| 12574 | | -#define OP_Ne 36 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ |
| 12575 | | -#define OP_Eq 37 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */ |
| 12576 | | -#define OP_Gt 38 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */ |
| 12577 | | -#define OP_Le 39 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ |
| 12578 | | -#define OP_Lt 40 /* same as TK_LT, synopsis: if r[P1]<r[P3] goto P2 */ |
| 12579 | | -#define OP_Ge 41 /* same as TK_GE, synopsis: if r[P1]>=r[P3] goto P2 */ |
| 12580 | | -#define OP_Last 42 |
| 12580 | +#define OP_Ne 36 /* same as TK_NE, synopsis: IF r[P3]!=r[P1] */ |
| 12581 | +#define OP_Eq 37 /* same as TK_EQ, synopsis: IF r[P3]==r[P1] */ |
| 12582 | +#define OP_Gt 38 /* same as TK_GT, synopsis: IF r[P3]>r[P1] */ |
| 12583 | +#define OP_Le 39 /* same as TK_LE, synopsis: IF r[P3]<=r[P1] */ |
| 12584 | +#define OP_Lt 40 /* same as TK_LT, synopsis: IF r[P3]<r[P1] */ |
| 12585 | +#define OP_Ge 41 /* same as TK_GE, synopsis: IF r[P3]>=r[P1] */ |
| 12586 | +#define OP_ElseNotEq 42 /* same as TK_ESCAPE */ |
| 12581 | 12587 | #define OP_BitAnd 43 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 12582 | 12588 | #define OP_BitOr 44 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 12583 | 12589 | #define OP_ShiftLeft 45 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 12584 | 12590 | #define OP_ShiftRight 46 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 12585 | 12591 | #define OP_Add 47 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| | @@ -12586,119 +12592,120 @@ |
| 12586 | 12592 | #define OP_Subtract 48 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 12587 | 12593 | #define OP_Multiply 49 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 12588 | 12594 | #define OP_Divide 50 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 12589 | 12595 | #define OP_Remainder 51 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 12590 | 12596 | #define OP_Concat 52 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 12591 | | -#define OP_SorterSort 53 |
| 12597 | +#define OP_Last 53 |
| 12592 | 12598 | #define OP_BitNot 54 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ |
| 12593 | | -#define OP_Sort 55 |
| 12594 | | -#define OP_Rewind 56 |
| 12595 | | -#define OP_IdxLE 57 /* synopsis: key=r[P3@P4] */ |
| 12596 | | -#define OP_IdxGT 58 /* synopsis: key=r[P3@P4] */ |
| 12597 | | -#define OP_IdxLT 59 /* synopsis: key=r[P3@P4] */ |
| 12598 | | -#define OP_IdxGE 60 /* synopsis: key=r[P3@P4] */ |
| 12599 | | -#define OP_RowSetRead 61 /* synopsis: r[P3]=rowset(P1) */ |
| 12600 | | -#define OP_RowSetTest 62 /* synopsis: if r[P3] in rowset(P1) goto P2 */ |
| 12601 | | -#define OP_Program 63 |
| 12602 | | -#define OP_FkIfZero 64 /* synopsis: if fkctr[P1]==0 goto P2 */ |
| 12603 | | -#define OP_IfPos 65 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ |
| 12604 | | -#define OP_IfNotZero 66 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ |
| 12605 | | -#define OP_DecrJumpZero 67 /* synopsis: if (--r[P1])==0 goto P2 */ |
| 12606 | | -#define OP_IncrVacuum 68 |
| 12607 | | -#define OP_VNext 69 |
| 12608 | | -#define OP_Init 70 /* synopsis: Start at P2 */ |
| 12609 | | -#define OP_Return 71 |
| 12610 | | -#define OP_EndCoroutine 72 |
| 12611 | | -#define OP_HaltIfNull 73 /* synopsis: if r[P3]=null halt */ |
| 12612 | | -#define OP_Halt 74 |
| 12613 | | -#define OP_Integer 75 /* synopsis: r[P2]=P1 */ |
| 12614 | | -#define OP_Int64 76 /* synopsis: r[P2]=P4 */ |
| 12615 | | -#define OP_String 77 /* synopsis: r[P2]='P4' (len=P1) */ |
| 12616 | | -#define OP_Null 78 /* synopsis: r[P2..P3]=NULL */ |
| 12617 | | -#define OP_SoftNull 79 /* synopsis: r[P1]=NULL */ |
| 12618 | | -#define OP_Blob 80 /* synopsis: r[P2]=P4 (len=P1) */ |
| 12619 | | -#define OP_Variable 81 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 12620 | | -#define OP_Move 82 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 12621 | | -#define OP_Copy 83 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 12622 | | -#define OP_SCopy 84 /* synopsis: r[P2]=r[P1] */ |
| 12623 | | -#define OP_IntCopy 85 /* synopsis: r[P2]=r[P1] */ |
| 12624 | | -#define OP_ResultRow 86 /* synopsis: output=r[P1@P2] */ |
| 12625 | | -#define OP_CollSeq 87 |
| 12626 | | -#define OP_Function0 88 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12627 | | -#define OP_Function 89 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12628 | | -#define OP_AddImm 90 /* synopsis: r[P1]=r[P1]+P2 */ |
| 12629 | | -#define OP_RealAffinity 91 |
| 12630 | | -#define OP_Cast 92 /* synopsis: affinity(r[P1]) */ |
| 12631 | | -#define OP_Permutation 93 |
| 12632 | | -#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 12633 | | -#define OP_Column 95 /* synopsis: r[P3]=PX */ |
| 12634 | | -#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */ |
| 12599 | +#define OP_SorterSort 55 |
| 12600 | +#define OP_Sort 56 |
| 12601 | +#define OP_Rewind 57 |
| 12602 | +#define OP_IdxLE 58 /* synopsis: key=r[P3@P4] */ |
| 12603 | +#define OP_IdxGT 59 /* synopsis: key=r[P3@P4] */ |
| 12604 | +#define OP_IdxLT 60 /* synopsis: key=r[P3@P4] */ |
| 12605 | +#define OP_IdxGE 61 /* synopsis: key=r[P3@P4] */ |
| 12606 | +#define OP_RowSetRead 62 /* synopsis: r[P3]=rowset(P1) */ |
| 12607 | +#define OP_RowSetTest 63 /* synopsis: if r[P3] in rowset(P1) goto P2 */ |
| 12608 | +#define OP_Program 64 |
| 12609 | +#define OP_FkIfZero 65 /* synopsis: if fkctr[P1]==0 goto P2 */ |
| 12610 | +#define OP_IfPos 66 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */ |
| 12611 | +#define OP_IfNotZero 67 /* synopsis: if r[P1]!=0 then r[P1]-=P3, goto P2 */ |
| 12612 | +#define OP_DecrJumpZero 68 /* synopsis: if (--r[P1])==0 goto P2 */ |
| 12613 | +#define OP_IncrVacuum 69 |
| 12614 | +#define OP_VNext 70 |
| 12615 | +#define OP_Init 71 /* synopsis: Start at P2 */ |
| 12616 | +#define OP_Return 72 |
| 12617 | +#define OP_EndCoroutine 73 |
| 12618 | +#define OP_HaltIfNull 74 /* synopsis: if r[P3]=null halt */ |
| 12619 | +#define OP_Halt 75 |
| 12620 | +#define OP_Integer 76 /* synopsis: r[P2]=P1 */ |
| 12621 | +#define OP_Int64 77 /* synopsis: r[P2]=P4 */ |
| 12622 | +#define OP_String 78 /* synopsis: r[P2]='P4' (len=P1) */ |
| 12623 | +#define OP_Null 79 /* synopsis: r[P2..P3]=NULL */ |
| 12624 | +#define OP_SoftNull 80 /* synopsis: r[P1]=NULL */ |
| 12625 | +#define OP_Blob 81 /* synopsis: r[P2]=P4 (len=P1) */ |
| 12626 | +#define OP_Variable 82 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 12627 | +#define OP_Move 83 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 12628 | +#define OP_Copy 84 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 12629 | +#define OP_SCopy 85 /* synopsis: r[P2]=r[P1] */ |
| 12630 | +#define OP_IntCopy 86 /* synopsis: r[P2]=r[P1] */ |
| 12631 | +#define OP_ResultRow 87 /* synopsis: output=r[P1@P2] */ |
| 12632 | +#define OP_CollSeq 88 |
| 12633 | +#define OP_Function0 89 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12634 | +#define OP_Function 90 /* synopsis: r[P3]=func(r[P2@P5]) */ |
| 12635 | +#define OP_AddImm 91 /* synopsis: r[P1]=r[P1]+P2 */ |
| 12636 | +#define OP_RealAffinity 92 |
| 12637 | +#define OP_Cast 93 /* synopsis: affinity(r[P1]) */ |
| 12638 | +#define OP_Permutation 94 |
| 12639 | +#define OP_Compare 95 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 12640 | +#define OP_Column 96 /* synopsis: r[P3]=PX */ |
| 12635 | 12641 | #define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 12636 | | -#define OP_MakeRecord 98 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 12637 | | -#define OP_Count 99 /* synopsis: r[P2]=count() */ |
| 12638 | | -#define OP_ReadCookie 100 |
| 12639 | | -#define OP_SetCookie 101 |
| 12640 | | -#define OP_ReopenIdx 102 /* synopsis: root=P2 iDb=P3 */ |
| 12641 | | -#define OP_OpenRead 103 /* synopsis: root=P2 iDb=P3 */ |
| 12642 | | -#define OP_OpenWrite 104 /* synopsis: root=P2 iDb=P3 */ |
| 12643 | | -#define OP_OpenAutoindex 105 /* synopsis: nColumn=P2 */ |
| 12644 | | -#define OP_OpenEphemeral 106 /* synopsis: nColumn=P2 */ |
| 12645 | | -#define OP_SorterOpen 107 |
| 12646 | | -#define OP_SequenceTest 108 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 12647 | | -#define OP_OpenPseudo 109 /* synopsis: P3 columns in r[P2] */ |
| 12648 | | -#define OP_Close 110 |
| 12649 | | -#define OP_ColumnsUsed 111 |
| 12650 | | -#define OP_Sequence 112 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 12651 | | -#define OP_NewRowid 113 /* synopsis: r[P2]=rowid */ |
| 12652 | | -#define OP_Insert 114 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 12653 | | -#define OP_InsertInt 115 /* synopsis: intkey=P3 data=r[P2] */ |
| 12654 | | -#define OP_Delete 116 |
| 12655 | | -#define OP_ResetCount 117 |
| 12656 | | -#define OP_SorterCompare 118 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 12657 | | -#define OP_SorterData 119 /* synopsis: r[P2]=data */ |
| 12658 | | -#define OP_RowKey 120 /* synopsis: r[P2]=key */ |
| 12659 | | -#define OP_RowData 121 /* synopsis: r[P2]=data */ |
| 12660 | | -#define OP_Rowid 122 /* synopsis: r[P2]=rowid */ |
| 12661 | | -#define OP_NullRow 123 |
| 12662 | | -#define OP_SorterInsert 124 |
| 12663 | | -#define OP_IdxInsert 125 /* synopsis: key=r[P2] */ |
| 12664 | | -#define OP_IdxDelete 126 /* synopsis: key=r[P2@P3] */ |
| 12665 | | -#define OP_Seek 127 /* synopsis: Move P3 to P1.rowid */ |
| 12666 | | -#define OP_IdxRowid 128 /* synopsis: r[P2]=rowid */ |
| 12667 | | -#define OP_Destroy 129 |
| 12668 | | -#define OP_Clear 130 |
| 12669 | | -#define OP_ResetSorter 131 |
| 12670 | | -#define OP_CreateIndex 132 /* synopsis: r[P2]=root iDb=P1 */ |
| 12642 | +#define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */ |
| 12643 | +#define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 12644 | +#define OP_Count 100 /* synopsis: r[P2]=count() */ |
| 12645 | +#define OP_ReadCookie 101 |
| 12646 | +#define OP_SetCookie 102 |
| 12647 | +#define OP_ReopenIdx 103 /* synopsis: root=P2 iDb=P3 */ |
| 12648 | +#define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */ |
| 12649 | +#define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */ |
| 12650 | +#define OP_OpenAutoindex 106 /* synopsis: nColumn=P2 */ |
| 12651 | +#define OP_OpenEphemeral 107 /* synopsis: nColumn=P2 */ |
| 12652 | +#define OP_SorterOpen 108 |
| 12653 | +#define OP_SequenceTest 109 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 12654 | +#define OP_OpenPseudo 110 /* synopsis: P3 columns in r[P2] */ |
| 12655 | +#define OP_Close 111 |
| 12656 | +#define OP_ColumnsUsed 112 |
| 12657 | +#define OP_Sequence 113 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 12658 | +#define OP_NewRowid 114 /* synopsis: r[P2]=rowid */ |
| 12659 | +#define OP_Insert 115 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 12660 | +#define OP_InsertInt 116 /* synopsis: intkey=P3 data=r[P2] */ |
| 12661 | +#define OP_Delete 117 |
| 12662 | +#define OP_ResetCount 118 |
| 12663 | +#define OP_SorterCompare 119 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 12664 | +#define OP_SorterData 120 /* synopsis: r[P2]=data */ |
| 12665 | +#define OP_RowKey 121 /* synopsis: r[P2]=key */ |
| 12666 | +#define OP_RowData 122 /* synopsis: r[P2]=data */ |
| 12667 | +#define OP_Rowid 123 /* synopsis: r[P2]=rowid */ |
| 12668 | +#define OP_NullRow 124 |
| 12669 | +#define OP_SorterInsert 125 |
| 12670 | +#define OP_IdxInsert 126 /* synopsis: key=r[P2] */ |
| 12671 | +#define OP_IdxDelete 127 /* synopsis: key=r[P2@P3] */ |
| 12672 | +#define OP_Seek 128 /* synopsis: Move P3 to P1.rowid */ |
| 12673 | +#define OP_IdxRowid 129 /* synopsis: r[P2]=rowid */ |
| 12674 | +#define OP_Destroy 130 |
| 12675 | +#define OP_Clear 131 |
| 12676 | +#define OP_ResetSorter 132 |
| 12671 | 12677 | #define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 12672 | | -#define OP_CreateTable 134 /* synopsis: r[P2]=root iDb=P1 */ |
| 12673 | | -#define OP_ParseSchema 135 |
| 12674 | | -#define OP_LoadAnalysis 136 |
| 12675 | | -#define OP_DropTable 137 |
| 12676 | | -#define OP_DropIndex 138 |
| 12677 | | -#define OP_DropTrigger 139 |
| 12678 | | -#define OP_IntegrityCk 140 |
| 12679 | | -#define OP_RowSetAdd 141 /* synopsis: rowset(P1)=r[P2] */ |
| 12680 | | -#define OP_Param 142 |
| 12681 | | -#define OP_FkCounter 143 /* synopsis: fkctr[P1]+=P2 */ |
| 12682 | | -#define OP_MemMax 144 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 12683 | | -#define OP_OffsetLimit 145 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 12684 | | -#define OP_AggStep0 146 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12685 | | -#define OP_AggStep 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12686 | | -#define OP_AggFinal 148 /* synopsis: accum=r[P1] N=P2 */ |
| 12687 | | -#define OP_Expire 149 |
| 12688 | | -#define OP_TableLock 150 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 12689 | | -#define OP_VBegin 151 |
| 12690 | | -#define OP_VCreate 152 |
| 12691 | | -#define OP_VDestroy 153 |
| 12692 | | -#define OP_VOpen 154 |
| 12693 | | -#define OP_VColumn 155 /* synopsis: r[P3]=vcolumn(P2) */ |
| 12694 | | -#define OP_VRename 156 |
| 12695 | | -#define OP_Pagecount 157 |
| 12696 | | -#define OP_MaxPgcnt 158 |
| 12697 | | -#define OP_CursorHint 159 |
| 12698 | | -#define OP_Noop 160 |
| 12699 | | -#define OP_Explain 161 |
| 12678 | +#define OP_CreateIndex 134 /* synopsis: r[P2]=root iDb=P1 */ |
| 12679 | +#define OP_CreateTable 135 /* synopsis: r[P2]=root iDb=P1 */ |
| 12680 | +#define OP_ParseSchema 136 |
| 12681 | +#define OP_LoadAnalysis 137 |
| 12682 | +#define OP_DropTable 138 |
| 12683 | +#define OP_DropIndex 139 |
| 12684 | +#define OP_DropTrigger 140 |
| 12685 | +#define OP_IntegrityCk 141 |
| 12686 | +#define OP_RowSetAdd 142 /* synopsis: rowset(P1)=r[P2] */ |
| 12687 | +#define OP_Param 143 |
| 12688 | +#define OP_FkCounter 144 /* synopsis: fkctr[P1]+=P2 */ |
| 12689 | +#define OP_MemMax 145 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 12690 | +#define OP_OffsetLimit 146 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 12691 | +#define OP_AggStep0 147 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12692 | +#define OP_AggStep 148 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 12693 | +#define OP_AggFinal 149 /* synopsis: accum=r[P1] N=P2 */ |
| 12694 | +#define OP_Expire 150 |
| 12695 | +#define OP_TableLock 151 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 12696 | +#define OP_VBegin 152 |
| 12697 | +#define OP_VCreate 153 |
| 12698 | +#define OP_VDestroy 154 |
| 12699 | +#define OP_VOpen 155 |
| 12700 | +#define OP_VColumn 156 /* synopsis: r[P3]=vcolumn(P2) */ |
| 12701 | +#define OP_VRename 157 |
| 12702 | +#define OP_Pagecount 158 |
| 12703 | +#define OP_MaxPgcnt 159 |
| 12704 | +#define OP_CursorHint 160 |
| 12705 | +#define OP_Noop 161 |
| 12706 | +#define OP_Explain 162 |
| 12700 | 12707 | |
| 12701 | 12708 | /* Properties such as "out2" or "jump" that are specified in |
| 12702 | 12709 | ** comments following the "case" for each opcode in the vdbe.c |
| 12703 | 12710 | ** are encoded into bitvectors as follows: |
| 12704 | 12711 | */ |
| | @@ -12714,32 +12721,32 @@ |
| 12714 | 12721 | /* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x09,\ |
| 12715 | 12722 | /* 24 */ 0x09, 0x09, 0x09, 0x26, 0x26, 0x09, 0x09, 0x09,\ |
| 12716 | 12723 | /* 32 */ 0x09, 0x09, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 12717 | 12724 | /* 40 */ 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 12718 | 12725 | /* 48 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x01, 0x12, 0x01,\ |
| 12719 | | -/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b, 0x01,\ |
| 12720 | | -/* 64 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01, 0x02,\ |
| 12721 | | -/* 72 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\ |
| 12722 | | -/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 12723 | | -/* 88 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\ |
| 12724 | | -/* 96 */ 0x00, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,\ |
| 12726 | +/* 56 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x23, 0x0b,\ |
| 12727 | +/* 64 */ 0x01, 0x01, 0x03, 0x03, 0x03, 0x01, 0x01, 0x01,\ |
| 12728 | +/* 72 */ 0x02, 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10,\ |
| 12729 | +/* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 12730 | +/* 88 */ 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00,\ |
| 12731 | +/* 96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 12725 | 12732 | /* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12726 | | -/* 112 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12727 | | -/* 120 */ 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00, 0x00,\ |
| 12728 | | -/* 128 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00,\ |
| 12729 | | -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10, 0x00,\ |
| 12730 | | -/* 144 */ 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12731 | | -/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 12732 | | -/* 160 */ 0x00, 0x00,} |
| 12733 | +/* 112 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12734 | +/* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x04, 0x04, 0x00,\ |
| 12735 | +/* 128 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x10,\ |
| 12736 | +/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x10,\ |
| 12737 | +/* 144 */ 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 12738 | +/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ |
| 12739 | +/* 160 */ 0x00, 0x00, 0x00,} |
| 12733 | 12740 | |
| 12734 | 12741 | /* The sqlite3P2Values() routine is able to run faster if it knows |
| 12735 | 12742 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 12736 | 12743 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 12737 | 12744 | ** generated this include file strives to group all JUMP opcodes |
| 12738 | 12745 | ** together near the beginning of the list. |
| 12739 | 12746 | */ |
| 12740 | | -#define SQLITE_MX_JUMP_OPCODE 70 /* Maximum JUMP opcode */ |
| 12747 | +#define SQLITE_MX_JUMP_OPCODE 71 /* Maximum JUMP opcode */ |
| 12741 | 12748 | |
| 12742 | 12749 | /************** End of opcodes.h *********************************************/ |
| 12743 | 12750 | /************** Continuing where we left off in vdbe.h ***********************/ |
| 12744 | 12751 | |
| 12745 | 12752 | /* |
| | @@ -14340,10 +14347,11 @@ |
| 14340 | 14347 | ** The SQLITE_NOTNULL flag is a combination of NULLEQ and JUMPIFNULL. |
| 14341 | 14348 | ** It causes an assert() to fire if either operand to a comparison |
| 14342 | 14349 | ** operator is NULL. It is added to certain comparison operators to |
| 14343 | 14350 | ** prove that the operands are always NOT NULL. |
| 14344 | 14351 | */ |
| 14352 | +#define SQLITE_KEEPNULL 0x08 /* Used by vector == or <> */ |
| 14345 | 14353 | #define SQLITE_JUMPIFNULL 0x10 /* jumps if either operand is NULL */ |
| 14346 | 14354 | #define SQLITE_STOREP2 0x20 /* Store result in reg[P2] rather than jump */ |
| 14347 | 14355 | #define SQLITE_NULLEQ 0x80 /* NULL=NULL */ |
| 14348 | 14356 | #define SQLITE_NOTNULL 0x90 /* Assert that operands are never NULL */ |
| 14349 | 14357 | |
| | @@ -14904,13 +14912,15 @@ |
| 14904 | 14912 | int nHeight; /* Height of the tree headed by this node */ |
| 14905 | 14913 | #endif |
| 14906 | 14914 | int iTable; /* TK_COLUMN: cursor number of table holding column |
| 14907 | 14915 | ** TK_REGISTER: register number |
| 14908 | 14916 | ** TK_TRIGGER: 1 -> new, 0 -> old |
| 14909 | | - ** EP_Unlikely: 134217728 times likelihood */ |
| 14917 | + ** EP_Unlikely: 134217728 times likelihood |
| 14918 | + ** TK_SELECT: 1st register of result vector */ |
| 14910 | 14919 | ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. |
| 14911 | | - ** TK_VARIABLE: variable number (always >= 1). */ |
| 14920 | + ** TK_VARIABLE: variable number (always >= 1). |
| 14921 | + ** TK_SELECT_COLUMN: column of the result vector */ |
| 14912 | 14922 | i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ |
| 14913 | 14923 | i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ |
| 14914 | 14924 | u8 op2; /* TK_REGISTER: original value of Expr.op |
| 14915 | 14925 | ** TK_COLUMN: the value of p5 for OP_Column |
| 14916 | 14926 | ** TK_AGG_FUNCTION: nesting depth */ |
| | @@ -15387,11 +15397,11 @@ |
| 15387 | 15397 | ** An instance of this object describes where to put of the results of |
| 15388 | 15398 | ** a SELECT statement. |
| 15389 | 15399 | */ |
| 15390 | 15400 | struct SelectDest { |
| 15391 | 15401 | u8 eDest; /* How to dispose of the results. On of SRT_* above. */ |
| 15392 | | - char affSdst; /* Affinity used when eDest==SRT_Set */ |
| 15402 | + char *zAffSdst; /* Affinity used when eDest==SRT_Set */ |
| 15393 | 15403 | int iSDParm; /* A parameter used by the eDest disposal method */ |
| 15394 | 15404 | int iSdst; /* Base register where results are written */ |
| 15395 | 15405 | int nSdst; /* Number of registers allocated */ |
| 15396 | 15406 | ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */ |
| 15397 | 15407 | }; |
| | @@ -16119,10 +16129,11 @@ |
| 16119 | 16129 | SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*); |
| 16120 | 16130 | #endif |
| 16121 | 16131 | |
| 16122 | 16132 | #if defined(SQLITE_DEBUG) |
| 16123 | 16133 | SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView*, const Expr*, u8); |
| 16134 | +SQLITE_PRIVATE void sqlite3TreeViewBareExprList(TreeView*, const ExprList*, const char*); |
| 16124 | 16135 | SQLITE_PRIVATE void sqlite3TreeViewExprList(TreeView*, const ExprList*, u8, const char*); |
| 16125 | 16136 | SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView*, const Select*, u8); |
| 16126 | 16137 | SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView*, const With*, u8); |
| 16127 | 16138 | #endif |
| 16128 | 16139 | |
| | @@ -16150,10 +16161,11 @@ |
| 16150 | 16161 | SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); |
| 16151 | 16162 | SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*); |
| 16152 | 16163 | SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*); |
| 16153 | 16164 | SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); |
| 16154 | 16165 | SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); |
| 16166 | +SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector(Parse*,ExprList*,IdList*,Expr*); |
| 16155 | 16167 | SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList*,int); |
| 16156 | 16168 | SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); |
| 16157 | 16169 | SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*); |
| 16158 | 16170 | SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); |
| 16159 | 16171 | SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList*); |
| | @@ -16485,10 +16497,11 @@ |
| 16485 | 16497 | |
| 16486 | 16498 | SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(sqlite3*, Index*); |
| 16487 | 16499 | SQLITE_PRIVATE void sqlite3TableAffinity(Vdbe*, Table*, int); |
| 16488 | 16500 | SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2); |
| 16489 | 16501 | SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); |
| 16502 | +SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table*,int); |
| 16490 | 16503 | SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr); |
| 16491 | 16504 | SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8); |
| 16492 | 16505 | SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char*, i64*); |
| 16493 | 16506 | SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3*, int, const char*,...); |
| 16494 | 16507 | SQLITE_PRIVATE void sqlite3Error(sqlite3*,int); |
| | @@ -16550,11 +16563,11 @@ |
| 16550 | 16563 | SQLITE_PRIVATE void sqlite3AlterFunctions(void); |
| 16551 | 16564 | SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); |
| 16552 | 16565 | SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); |
| 16553 | 16566 | SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); |
| 16554 | 16567 | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*); |
| 16555 | | -SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int); |
| 16568 | +SQLITE_PRIVATE int sqlite3CodeSubselect(Parse*, Expr *, int, int); |
| 16556 | 16569 | SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); |
| 16557 | 16570 | SQLITE_PRIVATE void sqlite3SelectWrongNumTermsError(Parse *pParse, Select *p); |
| 16558 | 16571 | SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); |
| 16559 | 16572 | SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); |
| 16560 | 16573 | SQLITE_PRIVATE int sqlite3ResolveExprListNames(NameContext*, ExprList*); |
| | @@ -16604,17 +16617,25 @@ |
| 16604 | 16617 | SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); |
| 16605 | 16618 | SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); |
| 16606 | 16619 | |
| 16607 | 16620 | SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); |
| 16608 | 16621 | SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); |
| 16622 | + |
| 16623 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 16624 | +SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse*, Expr*); |
| 16625 | +#else |
| 16626 | +# define sqlite3ExprCheckIN(x,y) SQLITE_OK |
| 16627 | +#endif |
| 16609 | 16628 | |
| 16610 | 16629 | #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 |
| 16611 | 16630 | SQLITE_PRIVATE void sqlite3AnalyzeFunctions(void); |
| 16612 | | -SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(Parse*,Index*,UnpackedRecord**,Expr*,u8,int,int*); |
| 16631 | +SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( |
| 16632 | + Parse*,Index*,UnpackedRecord**,Expr*,int,int,int*); |
| 16613 | 16633 | SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr(Parse*, Expr*, u8, sqlite3_value**); |
| 16614 | 16634 | SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord*); |
| 16615 | 16635 | SQLITE_PRIVATE int sqlite3Stat4Column(sqlite3*, const void*, int, int, sqlite3_value**); |
| 16636 | +SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3*, Index*, int); |
| 16616 | 16637 | #endif |
| 16617 | 16638 | |
| 16618 | 16639 | /* |
| 16619 | 16640 | ** The interface to the LEMON-generated parser |
| 16620 | 16641 | */ |
| | @@ -16763,11 +16784,11 @@ |
| 16763 | 16784 | ** Allowed flags for the 3rd parameter to sqlite3FindInIndex(). |
| 16764 | 16785 | */ |
| 16765 | 16786 | #define IN_INDEX_NOOP_OK 0x0001 /* OK to return IN_INDEX_NOOP */ |
| 16766 | 16787 | #define IN_INDEX_MEMBERSHIP 0x0002 /* IN operator used for membership test */ |
| 16767 | 16788 | #define IN_INDEX_LOOP 0x0004 /* IN operator used as a loop */ |
| 16768 | | -SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, u32, int*); |
| 16789 | +SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, u32, int*, int*); |
| 16769 | 16790 | |
| 16770 | 16791 | SQLITE_PRIVATE int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); |
| 16771 | 16792 | SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *); |
| 16772 | 16793 | #ifdef SQLITE_ENABLE_ATOMIC_WRITE |
| 16773 | 16794 | SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *); |
| | @@ -16868,10 +16889,15 @@ |
| 16868 | 16889 | |
| 16869 | 16890 | #if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST) |
| 16870 | 16891 | SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*); |
| 16871 | 16892 | #endif |
| 16872 | 16893 | |
| 16894 | +SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr); |
| 16895 | +SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr); |
| 16896 | +SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int); |
| 16897 | +SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int); |
| 16898 | + |
| 16873 | 16899 | #endif /* SQLITEINT_H */ |
| 16874 | 16900 | |
| 16875 | 16901 | /************** End of sqliteInt.h *******************************************/ |
| 16876 | 16902 | /************** Begin file global.c ******************************************/ |
| 16877 | 16903 | /* |
| | @@ -25882,11 +25908,11 @@ |
| 25882 | 25908 | } |
| 25883 | 25909 | } |
| 25884 | 25910 | |
| 25885 | 25911 | |
| 25886 | 25912 | /* |
| 25887 | | -** Generate a human-readable description of a the Select object. |
| 25913 | +** Generate a human-readable description of a Select object. |
| 25888 | 25914 | */ |
| 25889 | 25915 | SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select *p, u8 moreToFollow){ |
| 25890 | 25916 | int n = 0; |
| 25891 | 25917 | int cnt = 0; |
| 25892 | 25918 | pView = sqlite3TreeViewPush(pView, moreToFollow); |
| | @@ -26212,10 +26238,19 @@ |
| 26212 | 26238 | case TK_MATCH: { |
| 26213 | 26239 | sqlite3TreeViewLine(pView, "MATCH {%d:%d}%s", |
| 26214 | 26240 | pExpr->iTable, pExpr->iColumn, zFlgs); |
| 26215 | 26241 | sqlite3TreeViewExpr(pView, pExpr->pRight, 0); |
| 26216 | 26242 | break; |
| 26243 | + } |
| 26244 | + case TK_VECTOR: { |
| 26245 | + sqlite3TreeViewBareExprList(pView, pExpr->x.pList, "VECTOR"); |
| 26246 | + break; |
| 26247 | + } |
| 26248 | + case TK_SELECT_COLUMN: { |
| 26249 | + sqlite3TreeViewLine(pView, "SELECT-COLUMN %d", pExpr->iColumn); |
| 26250 | + sqlite3TreeViewSelect(pView, pExpr->pLeft->x.pSelect, 0); |
| 26251 | + break; |
| 26217 | 26252 | } |
| 26218 | 26253 | default: { |
| 26219 | 26254 | sqlite3TreeViewLine(pView, "op=%d", pExpr->op); |
| 26220 | 26255 | break; |
| 26221 | 26256 | } |
| | @@ -26228,26 +26263,25 @@ |
| 26228 | 26263 | sqlite3TreeViewLine(pView, "%s%s", zUniOp, zFlgs); |
| 26229 | 26264 | sqlite3TreeViewExpr(pView, pExpr->pLeft, 0); |
| 26230 | 26265 | } |
| 26231 | 26266 | sqlite3TreeViewPop(pView); |
| 26232 | 26267 | } |
| 26268 | + |
| 26233 | 26269 | |
| 26234 | 26270 | /* |
| 26235 | 26271 | ** Generate a human-readable explanation of an expression list. |
| 26236 | 26272 | */ |
| 26237 | | -SQLITE_PRIVATE void sqlite3TreeViewExprList( |
| 26273 | +SQLITE_PRIVATE void sqlite3TreeViewBareExprList( |
| 26238 | 26274 | TreeView *pView, |
| 26239 | 26275 | const ExprList *pList, |
| 26240 | | - u8 moreToFollow, |
| 26241 | 26276 | const char *zLabel |
| 26242 | 26277 | ){ |
| 26243 | | - int i; |
| 26244 | | - pView = sqlite3TreeViewPush(pView, moreToFollow); |
| 26245 | 26278 | if( zLabel==0 || zLabel[0]==0 ) zLabel = "LIST"; |
| 26246 | 26279 | if( pList==0 ){ |
| 26247 | 26280 | sqlite3TreeViewLine(pView, "%s (empty)", zLabel); |
| 26248 | 26281 | }else{ |
| 26282 | + int i; |
| 26249 | 26283 | sqlite3TreeViewLine(pView, "%s", zLabel); |
| 26250 | 26284 | for(i=0; i<pList->nExpr; i++){ |
| 26251 | 26285 | int j = pList->a[i].u.x.iOrderByCol; |
| 26252 | 26286 | if( j ){ |
| 26253 | 26287 | sqlite3TreeViewPush(pView, 0); |
| | @@ -26255,10 +26289,19 @@ |
| 26255 | 26289 | } |
| 26256 | 26290 | sqlite3TreeViewExpr(pView, pList->a[i].pExpr, i<pList->nExpr-1); |
| 26257 | 26291 | if( j ) sqlite3TreeViewPop(pView); |
| 26258 | 26292 | } |
| 26259 | 26293 | } |
| 26294 | +} |
| 26295 | +SQLITE_PRIVATE void sqlite3TreeViewExprList( |
| 26296 | + TreeView *pView, |
| 26297 | + const ExprList *pList, |
| 26298 | + u8 moreToFollow, |
| 26299 | + const char *zLabel |
| 26300 | +){ |
| 26301 | + pView = sqlite3TreeViewPush(pView, moreToFollow); |
| 26302 | + sqlite3TreeViewBareExprList(pView, pList, zLabel); |
| 26260 | 26303 | sqlite3TreeViewPop(pView); |
| 26261 | 26304 | } |
| 26262 | 26305 | |
| 26263 | 26306 | #endif /* SQLITE_DEBUG */ |
| 26264 | 26307 | |
| | @@ -29000,17 +29043,17 @@ |
| 29000 | 29043 | /* 31 */ "Found" OpHelp("key=r[P3@P4]"), |
| 29001 | 29044 | /* 32 */ "SeekRowid" OpHelp("intkey=r[P3]"), |
| 29002 | 29045 | /* 33 */ "NotExists" OpHelp("intkey=r[P3]"), |
| 29003 | 29046 | /* 34 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), |
| 29004 | 29047 | /* 35 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), |
| 29005 | | - /* 36 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), |
| 29006 | | - /* 37 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"), |
| 29007 | | - /* 38 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"), |
| 29008 | | - /* 39 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), |
| 29009 | | - /* 40 */ "Lt" OpHelp("if r[P1]<r[P3] goto P2"), |
| 29010 | | - /* 41 */ "Ge" OpHelp("if r[P1]>=r[P3] goto P2"), |
| 29011 | | - /* 42 */ "Last" OpHelp(""), |
| 29048 | + /* 36 */ "Ne" OpHelp("IF r[P3]!=r[P1]"), |
| 29049 | + /* 37 */ "Eq" OpHelp("IF r[P3]==r[P1]"), |
| 29050 | + /* 38 */ "Gt" OpHelp("IF r[P3]>r[P1]"), |
| 29051 | + /* 39 */ "Le" OpHelp("IF r[P3]<=r[P1]"), |
| 29052 | + /* 40 */ "Lt" OpHelp("IF r[P3]<r[P1]"), |
| 29053 | + /* 41 */ "Ge" OpHelp("IF r[P3]>=r[P1]"), |
| 29054 | + /* 42 */ "ElseNotEq" OpHelp(""), |
| 29012 | 29055 | /* 43 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 29013 | 29056 | /* 44 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 29014 | 29057 | /* 45 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 29015 | 29058 | /* 46 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 29016 | 29059 | /* 47 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| | @@ -29017,119 +29060,120 @@ |
| 29017 | 29060 | /* 48 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 29018 | 29061 | /* 49 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 29019 | 29062 | /* 50 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 29020 | 29063 | /* 51 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 29021 | 29064 | /* 52 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 29022 | | - /* 53 */ "SorterSort" OpHelp(""), |
| 29065 | + /* 53 */ "Last" OpHelp(""), |
| 29023 | 29066 | /* 54 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), |
| 29024 | | - /* 55 */ "Sort" OpHelp(""), |
| 29025 | | - /* 56 */ "Rewind" OpHelp(""), |
| 29026 | | - /* 57 */ "IdxLE" OpHelp("key=r[P3@P4]"), |
| 29027 | | - /* 58 */ "IdxGT" OpHelp("key=r[P3@P4]"), |
| 29028 | | - /* 59 */ "IdxLT" OpHelp("key=r[P3@P4]"), |
| 29029 | | - /* 60 */ "IdxGE" OpHelp("key=r[P3@P4]"), |
| 29030 | | - /* 61 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), |
| 29031 | | - /* 62 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), |
| 29032 | | - /* 63 */ "Program" OpHelp(""), |
| 29033 | | - /* 64 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), |
| 29034 | | - /* 65 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), |
| 29035 | | - /* 66 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), |
| 29036 | | - /* 67 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), |
| 29037 | | - /* 68 */ "IncrVacuum" OpHelp(""), |
| 29038 | | - /* 69 */ "VNext" OpHelp(""), |
| 29039 | | - /* 70 */ "Init" OpHelp("Start at P2"), |
| 29040 | | - /* 71 */ "Return" OpHelp(""), |
| 29041 | | - /* 72 */ "EndCoroutine" OpHelp(""), |
| 29042 | | - /* 73 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 29043 | | - /* 74 */ "Halt" OpHelp(""), |
| 29044 | | - /* 75 */ "Integer" OpHelp("r[P2]=P1"), |
| 29045 | | - /* 76 */ "Int64" OpHelp("r[P2]=P4"), |
| 29046 | | - /* 77 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 29047 | | - /* 78 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 29048 | | - /* 79 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 29049 | | - /* 80 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 29050 | | - /* 81 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 29051 | | - /* 82 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 29052 | | - /* 83 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 29053 | | - /* 84 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 29054 | | - /* 85 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 29055 | | - /* 86 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 29056 | | - /* 87 */ "CollSeq" OpHelp(""), |
| 29057 | | - /* 88 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29058 | | - /* 89 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29059 | | - /* 90 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 29060 | | - /* 91 */ "RealAffinity" OpHelp(""), |
| 29061 | | - /* 92 */ "Cast" OpHelp("affinity(r[P1])"), |
| 29062 | | - /* 93 */ "Permutation" OpHelp(""), |
| 29063 | | - /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 29064 | | - /* 95 */ "Column" OpHelp("r[P3]=PX"), |
| 29065 | | - /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 29067 | + /* 55 */ "SorterSort" OpHelp(""), |
| 29068 | + /* 56 */ "Sort" OpHelp(""), |
| 29069 | + /* 57 */ "Rewind" OpHelp(""), |
| 29070 | + /* 58 */ "IdxLE" OpHelp("key=r[P3@P4]"), |
| 29071 | + /* 59 */ "IdxGT" OpHelp("key=r[P3@P4]"), |
| 29072 | + /* 60 */ "IdxLT" OpHelp("key=r[P3@P4]"), |
| 29073 | + /* 61 */ "IdxGE" OpHelp("key=r[P3@P4]"), |
| 29074 | + /* 62 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), |
| 29075 | + /* 63 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), |
| 29076 | + /* 64 */ "Program" OpHelp(""), |
| 29077 | + /* 65 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), |
| 29078 | + /* 66 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"), |
| 29079 | + /* 67 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]-=P3, goto P2"), |
| 29080 | + /* 68 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"), |
| 29081 | + /* 69 */ "IncrVacuum" OpHelp(""), |
| 29082 | + /* 70 */ "VNext" OpHelp(""), |
| 29083 | + /* 71 */ "Init" OpHelp("Start at P2"), |
| 29084 | + /* 72 */ "Return" OpHelp(""), |
| 29085 | + /* 73 */ "EndCoroutine" OpHelp(""), |
| 29086 | + /* 74 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 29087 | + /* 75 */ "Halt" OpHelp(""), |
| 29088 | + /* 76 */ "Integer" OpHelp("r[P2]=P1"), |
| 29089 | + /* 77 */ "Int64" OpHelp("r[P2]=P4"), |
| 29090 | + /* 78 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 29091 | + /* 79 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 29092 | + /* 80 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 29093 | + /* 81 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 29094 | + /* 82 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 29095 | + /* 83 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 29096 | + /* 84 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 29097 | + /* 85 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 29098 | + /* 86 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 29099 | + /* 87 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 29100 | + /* 88 */ "CollSeq" OpHelp(""), |
| 29101 | + /* 89 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29102 | + /* 90 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), |
| 29103 | + /* 91 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 29104 | + /* 92 */ "RealAffinity" OpHelp(""), |
| 29105 | + /* 93 */ "Cast" OpHelp("affinity(r[P1])"), |
| 29106 | + /* 94 */ "Permutation" OpHelp(""), |
| 29107 | + /* 95 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 29108 | + /* 96 */ "Column" OpHelp("r[P3]=PX"), |
| 29066 | 29109 | /* 97 */ "String8" OpHelp("r[P2]='P4'"), |
| 29067 | | - /* 98 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 29068 | | - /* 99 */ "Count" OpHelp("r[P2]=count()"), |
| 29069 | | - /* 100 */ "ReadCookie" OpHelp(""), |
| 29070 | | - /* 101 */ "SetCookie" OpHelp(""), |
| 29071 | | - /* 102 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 29072 | | - /* 103 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 29073 | | - /* 104 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 29074 | | - /* 105 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 29075 | | - /* 106 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 29076 | | - /* 107 */ "SorterOpen" OpHelp(""), |
| 29077 | | - /* 108 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 29078 | | - /* 109 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 29079 | | - /* 110 */ "Close" OpHelp(""), |
| 29080 | | - /* 111 */ "ColumnsUsed" OpHelp(""), |
| 29081 | | - /* 112 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 29082 | | - /* 113 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 29083 | | - /* 114 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 29084 | | - /* 115 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), |
| 29085 | | - /* 116 */ "Delete" OpHelp(""), |
| 29086 | | - /* 117 */ "ResetCount" OpHelp(""), |
| 29087 | | - /* 118 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 29088 | | - /* 119 */ "SorterData" OpHelp("r[P2]=data"), |
| 29089 | | - /* 120 */ "RowKey" OpHelp("r[P2]=key"), |
| 29090 | | - /* 121 */ "RowData" OpHelp("r[P2]=data"), |
| 29091 | | - /* 122 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 29092 | | - /* 123 */ "NullRow" OpHelp(""), |
| 29093 | | - /* 124 */ "SorterInsert" OpHelp(""), |
| 29094 | | - /* 125 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 29095 | | - /* 126 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 29096 | | - /* 127 */ "Seek" OpHelp("Move P3 to P1.rowid"), |
| 29097 | | - /* 128 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 29098 | | - /* 129 */ "Destroy" OpHelp(""), |
| 29099 | | - /* 130 */ "Clear" OpHelp(""), |
| 29100 | | - /* 131 */ "ResetSorter" OpHelp(""), |
| 29101 | | - /* 132 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), |
| 29110 | + /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 29111 | + /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 29112 | + /* 100 */ "Count" OpHelp("r[P2]=count()"), |
| 29113 | + /* 101 */ "ReadCookie" OpHelp(""), |
| 29114 | + /* 102 */ "SetCookie" OpHelp(""), |
| 29115 | + /* 103 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 29116 | + /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 29117 | + /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 29118 | + /* 106 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 29119 | + /* 107 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 29120 | + /* 108 */ "SorterOpen" OpHelp(""), |
| 29121 | + /* 109 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 29122 | + /* 110 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 29123 | + /* 111 */ "Close" OpHelp(""), |
| 29124 | + /* 112 */ "ColumnsUsed" OpHelp(""), |
| 29125 | + /* 113 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 29126 | + /* 114 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 29127 | + /* 115 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 29128 | + /* 116 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), |
| 29129 | + /* 117 */ "Delete" OpHelp(""), |
| 29130 | + /* 118 */ "ResetCount" OpHelp(""), |
| 29131 | + /* 119 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 29132 | + /* 120 */ "SorterData" OpHelp("r[P2]=data"), |
| 29133 | + /* 121 */ "RowKey" OpHelp("r[P2]=key"), |
| 29134 | + /* 122 */ "RowData" OpHelp("r[P2]=data"), |
| 29135 | + /* 123 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 29136 | + /* 124 */ "NullRow" OpHelp(""), |
| 29137 | + /* 125 */ "SorterInsert" OpHelp(""), |
| 29138 | + /* 126 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 29139 | + /* 127 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 29140 | + /* 128 */ "Seek" OpHelp("Move P3 to P1.rowid"), |
| 29141 | + /* 129 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 29142 | + /* 130 */ "Destroy" OpHelp(""), |
| 29143 | + /* 131 */ "Clear" OpHelp(""), |
| 29144 | + /* 132 */ "ResetSorter" OpHelp(""), |
| 29102 | 29145 | /* 133 */ "Real" OpHelp("r[P2]=P4"), |
| 29103 | | - /* 134 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), |
| 29104 | | - /* 135 */ "ParseSchema" OpHelp(""), |
| 29105 | | - /* 136 */ "LoadAnalysis" OpHelp(""), |
| 29106 | | - /* 137 */ "DropTable" OpHelp(""), |
| 29107 | | - /* 138 */ "DropIndex" OpHelp(""), |
| 29108 | | - /* 139 */ "DropTrigger" OpHelp(""), |
| 29109 | | - /* 140 */ "IntegrityCk" OpHelp(""), |
| 29110 | | - /* 141 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 29111 | | - /* 142 */ "Param" OpHelp(""), |
| 29112 | | - /* 143 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 29113 | | - /* 144 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 29114 | | - /* 145 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 29115 | | - /* 146 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29116 | | - /* 147 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29117 | | - /* 148 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 29118 | | - /* 149 */ "Expire" OpHelp(""), |
| 29119 | | - /* 150 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 29120 | | - /* 151 */ "VBegin" OpHelp(""), |
| 29121 | | - /* 152 */ "VCreate" OpHelp(""), |
| 29122 | | - /* 153 */ "VDestroy" OpHelp(""), |
| 29123 | | - /* 154 */ "VOpen" OpHelp(""), |
| 29124 | | - /* 155 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 29125 | | - /* 156 */ "VRename" OpHelp(""), |
| 29126 | | - /* 157 */ "Pagecount" OpHelp(""), |
| 29127 | | - /* 158 */ "MaxPgcnt" OpHelp(""), |
| 29128 | | - /* 159 */ "CursorHint" OpHelp(""), |
| 29129 | | - /* 160 */ "Noop" OpHelp(""), |
| 29130 | | - /* 161 */ "Explain" OpHelp(""), |
| 29146 | + /* 134 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), |
| 29147 | + /* 135 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), |
| 29148 | + /* 136 */ "ParseSchema" OpHelp(""), |
| 29149 | + /* 137 */ "LoadAnalysis" OpHelp(""), |
| 29150 | + /* 138 */ "DropTable" OpHelp(""), |
| 29151 | + /* 139 */ "DropIndex" OpHelp(""), |
| 29152 | + /* 140 */ "DropTrigger" OpHelp(""), |
| 29153 | + /* 141 */ "IntegrityCk" OpHelp(""), |
| 29154 | + /* 142 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 29155 | + /* 143 */ "Param" OpHelp(""), |
| 29156 | + /* 144 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 29157 | + /* 145 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 29158 | + /* 146 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 29159 | + /* 147 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29160 | + /* 148 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 29161 | + /* 149 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 29162 | + /* 150 */ "Expire" OpHelp(""), |
| 29163 | + /* 151 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 29164 | + /* 152 */ "VBegin" OpHelp(""), |
| 29165 | + /* 153 */ "VCreate" OpHelp(""), |
| 29166 | + /* 154 */ "VDestroy" OpHelp(""), |
| 29167 | + /* 155 */ "VOpen" OpHelp(""), |
| 29168 | + /* 156 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 29169 | + /* 157 */ "VRename" OpHelp(""), |
| 29170 | + /* 158 */ "Pagecount" OpHelp(""), |
| 29171 | + /* 159 */ "MaxPgcnt" OpHelp(""), |
| 29172 | + /* 160 */ "CursorHint" OpHelp(""), |
| 29173 | + /* 161 */ "Noop" OpHelp(""), |
| 29174 | + /* 162 */ "Explain" OpHelp(""), |
| 29131 | 29175 | }; |
| 29132 | 29176 | return azName[i]; |
| 29133 | 29177 | } |
| 29134 | 29178 | #endif |
| 29135 | 29179 | |
| | @@ -52964,11 +53008,15 @@ |
| 52964 | 53008 | ** This function may return SQLITE_NOMEM if a memory allocation fails, |
| 52965 | 53009 | ** or an IO error code if an IO error occurs while rolling back a |
| 52966 | 53010 | ** savepoint. If no errors occur, SQLITE_OK is returned. |
| 52967 | 53011 | */ |
| 52968 | 53012 | SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ |
| 52969 | | - int rc = pPager->errCode; /* Return code */ |
| 53013 | + int rc = pPager->errCode; |
| 53014 | + |
| 53015 | +#ifdef SQLITE_ENABLE_ZIPVFS |
| 53016 | + if( op==SAVEPOINT_RELEASE ) rc = SQLITE_OK; |
| 53017 | +#endif |
| 52970 | 53018 | |
| 52971 | 53019 | assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK ); |
| 52972 | 53020 | assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK ); |
| 52973 | 53021 | |
| 52974 | 53022 | if( rc==SQLITE_OK && iSavepoint<pPager->nSavepoint ){ |
| | @@ -53005,10 +53053,24 @@ |
| 53005 | 53053 | else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){ |
| 53006 | 53054 | PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1]; |
| 53007 | 53055 | rc = pagerPlaybackSavepoint(pPager, pSavepoint); |
| 53008 | 53056 | assert(rc!=SQLITE_DONE); |
| 53009 | 53057 | } |
| 53058 | + |
| 53059 | +#ifdef SQLITE_ENABLE_ZIPVFS |
| 53060 | + /* If the cache has been modified but the savepoint cannot be rolled |
| 53061 | + ** back journal_mode=off, put the pager in the error state. This way, |
| 53062 | + ** if the VFS used by this pager includes ZipVFS, the entire transaction |
| 53063 | + ** can be rolled back at the ZipVFS level. */ |
| 53064 | + else if( |
| 53065 | + pPager->journalMode==PAGER_JOURNALMODE_OFF |
| 53066 | + && pPager->eState>=PAGER_WRITER_CACHEMOD |
| 53067 | + ){ |
| 53068 | + pPager->errCode = SQLITE_ABORT; |
| 53069 | + pPager->eState = PAGER_ERROR; |
| 53070 | + } |
| 53071 | +#endif |
| 53010 | 53072 | } |
| 53011 | 53073 | |
| 53012 | 53074 | return rc; |
| 53013 | 53075 | } |
| 53014 | 53076 | |
| | @@ -68078,11 +68140,10 @@ |
| 68078 | 68140 | p->pSrcDb = pSrcDb; |
| 68079 | 68141 | p->iNext = 1; |
| 68080 | 68142 | p->isAttached = 0; |
| 68081 | 68143 | |
| 68082 | 68144 | if( 0==p->pSrc || 0==p->pDest |
| 68083 | | - || setDestPgsz(p)==SQLITE_NOMEM |
| 68084 | 68145 | || checkReadTransaction(pDestDb, p->pDest)!=SQLITE_OK |
| 68085 | 68146 | ){ |
| 68086 | 68147 | /* One (or both) of the named databases did not exist or an OOM |
| 68087 | 68148 | ** error was hit. Or there is a transaction open on the destination |
| 68088 | 68149 | ** database. The error has already been written into the pDestDb |
| | @@ -68266,26 +68327,36 @@ |
| 68266 | 68327 | rc = SQLITE_BUSY; |
| 68267 | 68328 | }else{ |
| 68268 | 68329 | rc = SQLITE_OK; |
| 68269 | 68330 | } |
| 68270 | 68331 | |
| 68271 | | - /* Lock the destination database, if it is not locked already. */ |
| 68272 | | - if( SQLITE_OK==rc && p->bDestLocked==0 |
| 68273 | | - && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) |
| 68274 | | - ){ |
| 68275 | | - p->bDestLocked = 1; |
| 68276 | | - sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema); |
| 68277 | | - } |
| 68278 | | - |
| 68279 | 68332 | /* If there is no open read-transaction on the source database, open |
| 68280 | 68333 | ** one now. If a transaction is opened here, then it will be closed |
| 68281 | 68334 | ** before this function exits. |
| 68282 | 68335 | */ |
| 68283 | 68336 | if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){ |
| 68284 | 68337 | rc = sqlite3BtreeBeginTrans(p->pSrc, 0); |
| 68285 | 68338 | bCloseTrans = 1; |
| 68286 | 68339 | } |
| 68340 | + |
| 68341 | + /* If the destination database has not yet been locked (i.e. if this |
| 68342 | + ** is the first call to backup_step() for the current backup operation), |
| 68343 | + ** try to set its page size to the same as the source database. This |
| 68344 | + ** is especially important on ZipVFS systems, as in that case it is |
| 68345 | + ** not possible to create a database file that uses one page size by |
| 68346 | + ** writing to it with another. */ |
| 68347 | + if( p->bDestLocked==0 && rc==SQLITE_OK && setDestPgsz(p)==SQLITE_NOMEM ){ |
| 68348 | + rc = SQLITE_NOMEM; |
| 68349 | + } |
| 68350 | + |
| 68351 | + /* Lock the destination database, if it is not locked already. */ |
| 68352 | + if( SQLITE_OK==rc && p->bDestLocked==0 |
| 68353 | + && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) |
| 68354 | + ){ |
| 68355 | + p->bDestLocked = 1; |
| 68356 | + sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema); |
| 68357 | + } |
| 68287 | 68358 | |
| 68288 | 68359 | /* Do not allow backup if the destination database is in WAL mode |
| 68289 | 68360 | ** and the page sizes are different between source and destination */ |
| 68290 | 68361 | pgszSrc = sqlite3BtreeGetPageSize(p->pSrc); |
| 68291 | 68362 | pgszDest = sqlite3BtreeGetPageSize(p->pDest); |
| | @@ -70202,25 +70273,29 @@ |
| 70202 | 70273 | /* |
| 70203 | 70274 | ** This function is used to allocate and populate UnpackedRecord |
| 70204 | 70275 | ** structures intended to be compared against sample index keys stored |
| 70205 | 70276 | ** in the sqlite_stat4 table. |
| 70206 | 70277 | ** |
| 70207 | | -** A single call to this function attempts to populates field iVal (leftmost |
| 70208 | | -** is 0 etc.) of the unpacked record with a value extracted from expression |
| 70209 | | -** pExpr. Extraction of values is possible if: |
| 70278 | +** A single call to this function populates zero or more fields of the |
| 70279 | +** record starting with field iVal (fields are numbered from left to |
| 70280 | +** right starting with 0). A single field is populated if: |
| 70210 | 70281 | ** |
| 70211 | 70282 | ** * (pExpr==0). In this case the value is assumed to be an SQL NULL, |
| 70212 | 70283 | ** |
| 70213 | 70284 | ** * The expression is a bound variable, and this is a reprepare, or |
| 70214 | 70285 | ** |
| 70215 | 70286 | ** * The sqlite3ValueFromExpr() function is able to extract a value |
| 70216 | 70287 | ** from the expression (i.e. the expression is a literal value). |
| 70217 | 70288 | ** |
| 70218 | | -** If a value can be extracted, the affinity passed as the 5th argument |
| 70219 | | -** is applied to it before it is copied into the UnpackedRecord. Output |
| 70220 | | -** parameter *pbOk is set to true if a value is extracted, or false |
| 70221 | | -** otherwise. |
| 70289 | +** Or, if pExpr is a TK_VECTOR, one field is populated for each of the |
| 70290 | +** vector components that match either of the two latter criteria listed |
| 70291 | +** above. |
| 70292 | +** |
| 70293 | +** Before any value is appended to the record, the affinity of the |
| 70294 | +** corresponding column within index pIdx is applied to it. Before |
| 70295 | +** this function returns, output parameter *pnExtract is set to the |
| 70296 | +** number of values appended to the record. |
| 70222 | 70297 | ** |
| 70223 | 70298 | ** When this function is called, *ppRec must either point to an object |
| 70224 | 70299 | ** allocated by an earlier call to this function, or must be NULL. If it |
| 70225 | 70300 | ** is NULL and a value can be successfully extracted, a new UnpackedRecord |
| 70226 | 70301 | ** is allocated (and *ppRec set to point to it) before returning. |
| | @@ -70232,26 +70307,37 @@ |
| 70232 | 70307 | SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue( |
| 70233 | 70308 | Parse *pParse, /* Parse context */ |
| 70234 | 70309 | Index *pIdx, /* Index being probed */ |
| 70235 | 70310 | UnpackedRecord **ppRec, /* IN/OUT: Probe record */ |
| 70236 | 70311 | Expr *pExpr, /* The expression to extract a value from */ |
| 70237 | | - u8 affinity, /* Affinity to use */ |
| 70312 | + int nElem, /* Maximum number of values to append */ |
| 70238 | 70313 | int iVal, /* Array element to populate */ |
| 70239 | | - int *pbOk /* OUT: True if value was extracted */ |
| 70314 | + int *pnExtract /* OUT: Values appended to the record */ |
| 70240 | 70315 | ){ |
| 70241 | | - int rc; |
| 70242 | | - sqlite3_value *pVal = 0; |
| 70243 | | - struct ValueNewStat4Ctx alloc; |
| 70244 | | - |
| 70245 | | - alloc.pParse = pParse; |
| 70246 | | - alloc.pIdx = pIdx; |
| 70247 | | - alloc.ppRec = ppRec; |
| 70248 | | - alloc.iVal = iVal; |
| 70249 | | - |
| 70250 | | - rc = stat4ValueFromExpr(pParse, pExpr, affinity, &alloc, &pVal); |
| 70251 | | - assert( pVal==0 || pVal->db==pParse->db ); |
| 70252 | | - *pbOk = (pVal!=0); |
| 70316 | + int rc = SQLITE_OK; |
| 70317 | + int nExtract = 0; |
| 70318 | + |
| 70319 | + if( pExpr==0 || pExpr->op!=TK_SELECT ){ |
| 70320 | + int i; |
| 70321 | + struct ValueNewStat4Ctx alloc; |
| 70322 | + |
| 70323 | + alloc.pParse = pParse; |
| 70324 | + alloc.pIdx = pIdx; |
| 70325 | + alloc.ppRec = ppRec; |
| 70326 | + |
| 70327 | + for(i=0; i<nElem; i++){ |
| 70328 | + sqlite3_value *pVal = 0; |
| 70329 | + Expr *pElem = (pExpr ? sqlite3VectorFieldSubexpr(pExpr, i) : 0); |
| 70330 | + u8 aff = sqlite3IndexColumnAffinity(pParse->db, pIdx, iVal+i); |
| 70331 | + alloc.iVal = iVal+i; |
| 70332 | + rc = stat4ValueFromExpr(pParse, pElem, aff, &alloc, &pVal); |
| 70333 | + if( !pVal ) break; |
| 70334 | + nExtract++; |
| 70335 | + } |
| 70336 | + } |
| 70337 | + |
| 70338 | + *pnExtract = nExtract; |
| 70253 | 70339 | return rc; |
| 70254 | 70340 | } |
| 70255 | 70341 | |
| 70256 | 70342 | /* |
| 70257 | 70343 | ** Attempt to extract a value from expression pExpr using the methods |
| | @@ -71483,16 +71569,25 @@ |
| 71483 | 71569 | ){ |
| 71484 | 71570 | const char *zOpName; |
| 71485 | 71571 | const char *zSynopsis; |
| 71486 | 71572 | int nOpName; |
| 71487 | 71573 | int ii, jj; |
| 71574 | + char zAlt[50]; |
| 71488 | 71575 | zOpName = sqlite3OpcodeName(pOp->opcode); |
| 71489 | 71576 | nOpName = sqlite3Strlen30(zOpName); |
| 71490 | 71577 | if( zOpName[nOpName+1] ){ |
| 71491 | 71578 | int seenCom = 0; |
| 71492 | 71579 | char c; |
| 71493 | 71580 | zSynopsis = zOpName += nOpName + 1; |
| 71581 | + if( strncmp(zSynopsis,"IF ",3)==0 ){ |
| 71582 | + if( pOp->p5 & SQLITE_STOREP2 ){ |
| 71583 | + sqlite3_snprintf(sizeof(zAlt), zAlt, "r[P2] = (%s)", zSynopsis+3); |
| 71584 | + }else{ |
| 71585 | + sqlite3_snprintf(sizeof(zAlt), zAlt, "if %s goto P2", zSynopsis+3); |
| 71586 | + } |
| 71587 | + zSynopsis = zAlt; |
| 71588 | + } |
| 71494 | 71589 | for(ii=jj=0; jj<nTemp-1 && (c = zSynopsis[ii])!=0; ii++){ |
| 71495 | 71590 | if( c=='P' ){ |
| 71496 | 71591 | c = zSynopsis[++ii]; |
| 71497 | 71592 | if( c=='4' ){ |
| 71498 | 71593 | sqlite3_snprintf(nTemp-jj, zTemp+jj, "%s", zP4); |
| | @@ -77732,11 +77827,11 @@ |
| 77732 | 77827 | #endif |
| 77733 | 77828 | int rc = SQLITE_OK; /* Value to return */ |
| 77734 | 77829 | sqlite3 *db = p->db; /* The database */ |
| 77735 | 77830 | u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */ |
| 77736 | 77831 | u8 encoding = ENC(db); /* The database encoding */ |
| 77737 | | - int iCompare = 0; /* Result of last OP_Compare operation */ |
| 77832 | + int iCompare = 0; /* Result of last comparison */ |
| 77738 | 77833 | unsigned nVmStep = 0; /* Number of virtual machine steps */ |
| 77739 | 77834 | #ifndef SQLITE_OMIT_PROGRESS_CALLBACK |
| 77740 | 77835 | unsigned nProgressLimit = 0;/* Invoke xProgress() when nVmStep reaches this */ |
| 77741 | 77836 | #endif |
| 77742 | 77837 | Mem *aMem = p->aMem; /* Copy of p->aMem */ |
| | @@ -78064,11 +78159,11 @@ |
| 78064 | 78159 | pOp = &aOp[pcDest]; |
| 78065 | 78160 | break; |
| 78066 | 78161 | } |
| 78067 | 78162 | |
| 78068 | 78163 | /* Opcode: HaltIfNull P1 P2 P3 P4 P5 |
| 78069 | | -** Synopsis: if r[P3]=null halt |
| 78164 | +** Synopsis: if r[P3]=null halt |
| 78070 | 78165 | ** |
| 78071 | 78166 | ** Check the value in register P3. If it is NULL then Halt using |
| 78072 | 78167 | ** parameter P1, P2, and P4 as if this were a Halt instruction. If the |
| 78073 | 78168 | ** value in register P3 is not NULL, then this routine is a no-op. |
| 78074 | 78169 | ** The P5 parameter should be 1. |
| | @@ -78277,11 +78372,11 @@ |
| 78277 | 78372 | #endif |
| 78278 | 78373 | break; |
| 78279 | 78374 | } |
| 78280 | 78375 | |
| 78281 | 78376 | /* Opcode: Null P1 P2 P3 * * |
| 78282 | | -** Synopsis: r[P2..P3]=NULL |
| 78377 | +** Synopsis: r[P2..P3]=NULL |
| 78283 | 78378 | ** |
| 78284 | 78379 | ** Write a NULL into registers P2. If P3 greater than P2, then also write |
| 78285 | 78380 | ** NULL into register P3 and every register in between P2 and P3. If P3 |
| 78286 | 78381 | ** is less than P2 (typically P3 is zero) then only register P2 is |
| 78287 | 78382 | ** set to NULL. |
| | @@ -78306,11 +78401,11 @@ |
| 78306 | 78401 | } |
| 78307 | 78402 | break; |
| 78308 | 78403 | } |
| 78309 | 78404 | |
| 78310 | 78405 | /* Opcode: SoftNull P1 * * * * |
| 78311 | | -** Synopsis: r[P1]=NULL |
| 78406 | +** Synopsis: r[P1]=NULL |
| 78312 | 78407 | ** |
| 78313 | 78408 | ** Set register P1 to have the value NULL as seen by the OP_MakeRecord |
| 78314 | 78409 | ** instruction, but do not free any string or blob memory associated with |
| 78315 | 78410 | ** the register, so that if the value was a string or blob that was |
| 78316 | 78411 | ** previously copied using OP_SCopy, the copies will continue to be valid. |
| | @@ -78359,11 +78454,11 @@ |
| 78359 | 78454 | UPDATE_MAX_BLOBSIZE(pOut); |
| 78360 | 78455 | break; |
| 78361 | 78456 | } |
| 78362 | 78457 | |
| 78363 | 78458 | /* Opcode: Move P1 P2 P3 * * |
| 78364 | | -** Synopsis: r[P2@P3]=r[P1@P3] |
| 78459 | +** Synopsis: r[P2@P3]=r[P1@P3] |
| 78365 | 78460 | ** |
| 78366 | 78461 | ** Move the P3 values in register P1..P1+P3-1 over into |
| 78367 | 78462 | ** registers P2..P2+P3-1. Registers P1..P1+P3-1 are |
| 78368 | 78463 | ** left holding a NULL. It is an error for register ranges |
| 78369 | 78464 | ** P1..P1+P3-1 and P2..P2+P3-1 to overlap. It is an error |
| | @@ -78469,11 +78564,11 @@ |
| 78469 | 78564 | sqlite3VdbeMemSetInt64(pOut, pIn1->u.i); |
| 78470 | 78565 | break; |
| 78471 | 78566 | } |
| 78472 | 78567 | |
| 78473 | 78568 | /* Opcode: ResultRow P1 P2 * * * |
| 78474 | | -** Synopsis: output=r[P1@P2] |
| 78569 | +** Synopsis: output=r[P1@P2] |
| 78475 | 78570 | ** |
| 78476 | 78571 | ** The registers P1 through P1+P2-1 contain a single row of |
| 78477 | 78572 | ** results. This opcode causes the sqlite3_step() call to terminate |
| 78478 | 78573 | ** with an SQLITE_ROW return code and it sets up the sqlite3_stmt |
| 78479 | 78574 | ** structure to provide access to the r(P1)..r(P1+P2-1) values as |
| | @@ -78602,41 +78697,41 @@ |
| 78602 | 78697 | UPDATE_MAX_BLOBSIZE(pOut); |
| 78603 | 78698 | break; |
| 78604 | 78699 | } |
| 78605 | 78700 | |
| 78606 | 78701 | /* Opcode: Add P1 P2 P3 * * |
| 78607 | | -** Synopsis: r[P3]=r[P1]+r[P2] |
| 78702 | +** Synopsis: r[P3]=r[P1]+r[P2] |
| 78608 | 78703 | ** |
| 78609 | 78704 | ** Add the value in register P1 to the value in register P2 |
| 78610 | 78705 | ** and store the result in register P3. |
| 78611 | 78706 | ** If either input is NULL, the result is NULL. |
| 78612 | 78707 | */ |
| 78613 | 78708 | /* Opcode: Multiply P1 P2 P3 * * |
| 78614 | | -** Synopsis: r[P3]=r[P1]*r[P2] |
| 78709 | +** Synopsis: r[P3]=r[P1]*r[P2] |
| 78615 | 78710 | ** |
| 78616 | 78711 | ** |
| 78617 | 78712 | ** Multiply the value in register P1 by the value in register P2 |
| 78618 | 78713 | ** and store the result in register P3. |
| 78619 | 78714 | ** If either input is NULL, the result is NULL. |
| 78620 | 78715 | */ |
| 78621 | 78716 | /* Opcode: Subtract P1 P2 P3 * * |
| 78622 | | -** Synopsis: r[P3]=r[P2]-r[P1] |
| 78717 | +** Synopsis: r[P3]=r[P2]-r[P1] |
| 78623 | 78718 | ** |
| 78624 | 78719 | ** Subtract the value in register P1 from the value in register P2 |
| 78625 | 78720 | ** and store the result in register P3. |
| 78626 | 78721 | ** If either input is NULL, the result is NULL. |
| 78627 | 78722 | */ |
| 78628 | 78723 | /* Opcode: Divide P1 P2 P3 * * |
| 78629 | | -** Synopsis: r[P3]=r[P2]/r[P1] |
| 78724 | +** Synopsis: r[P3]=r[P2]/r[P1] |
| 78630 | 78725 | ** |
| 78631 | 78726 | ** Divide the value in register P1 by the value in register P2 |
| 78632 | 78727 | ** and store the result in register P3 (P3=P2/P1). If the value in |
| 78633 | 78728 | ** register P1 is zero, then the result is NULL. If either input is |
| 78634 | 78729 | ** NULL, the result is NULL. |
| 78635 | 78730 | */ |
| 78636 | 78731 | /* Opcode: Remainder P1 P2 P3 * * |
| 78637 | | -** Synopsis: r[P3]=r[P2]%r[P1] |
| 78732 | +** Synopsis: r[P3]=r[P2]%r[P1] |
| 78638 | 78733 | ** |
| 78639 | 78734 | ** Compute the remainder after integer register P2 is divided by |
| 78640 | 78735 | ** register P1 and store the result in register P3. |
| 78641 | 78736 | ** If the value in register P1 is zero the result is NULL. |
| 78642 | 78737 | ** If either operand is NULL, the result is NULL. |
| | @@ -78865,33 +78960,33 @@ |
| 78865 | 78960 | UPDATE_MAX_BLOBSIZE(pCtx->pOut); |
| 78866 | 78961 | break; |
| 78867 | 78962 | } |
| 78868 | 78963 | |
| 78869 | 78964 | /* Opcode: BitAnd P1 P2 P3 * * |
| 78870 | | -** Synopsis: r[P3]=r[P1]&r[P2] |
| 78965 | +** Synopsis: r[P3]=r[P1]&r[P2] |
| 78871 | 78966 | ** |
| 78872 | 78967 | ** Take the bit-wise AND of the values in register P1 and P2 and |
| 78873 | 78968 | ** store the result in register P3. |
| 78874 | 78969 | ** If either input is NULL, the result is NULL. |
| 78875 | 78970 | */ |
| 78876 | 78971 | /* Opcode: BitOr P1 P2 P3 * * |
| 78877 | | -** Synopsis: r[P3]=r[P1]|r[P2] |
| 78972 | +** Synopsis: r[P3]=r[P1]|r[P2] |
| 78878 | 78973 | ** |
| 78879 | 78974 | ** Take the bit-wise OR of the values in register P1 and P2 and |
| 78880 | 78975 | ** store the result in register P3. |
| 78881 | 78976 | ** If either input is NULL, the result is NULL. |
| 78882 | 78977 | */ |
| 78883 | 78978 | /* Opcode: ShiftLeft P1 P2 P3 * * |
| 78884 | | -** Synopsis: r[P3]=r[P2]<<r[P1] |
| 78979 | +** Synopsis: r[P3]=r[P2]<<r[P1] |
| 78885 | 78980 | ** |
| 78886 | 78981 | ** Shift the integer value in register P2 to the left by the |
| 78887 | 78982 | ** number of bits specified by the integer in register P1. |
| 78888 | 78983 | ** Store the result in register P3. |
| 78889 | 78984 | ** If either input is NULL, the result is NULL. |
| 78890 | 78985 | */ |
| 78891 | 78986 | /* Opcode: ShiftRight P1 P2 P3 * * |
| 78892 | | -** Synopsis: r[P3]=r[P2]>>r[P1] |
| 78987 | +** Synopsis: r[P3]=r[P2]>>r[P1] |
| 78893 | 78988 | ** |
| 78894 | 78989 | ** Shift the integer value in register P2 to the right by the |
| 78895 | 78990 | ** number of bits specified by the integer in register P1. |
| 78896 | 78991 | ** Store the result in register P3. |
| 78897 | 78992 | ** If either input is NULL, the result is NULL. |
| | @@ -78947,11 +79042,11 @@ |
| 78947 | 79042 | MemSetTypeFlag(pOut, MEM_Int); |
| 78948 | 79043 | break; |
| 78949 | 79044 | } |
| 78950 | 79045 | |
| 78951 | 79046 | /* Opcode: AddImm P1 P2 * * * |
| 78952 | | -** Synopsis: r[P1]=r[P1]+P2 |
| 79047 | +** Synopsis: r[P1]=r[P1]+P2 |
| 78953 | 79048 | ** |
| 78954 | 79049 | ** Add the constant P2 to the value in register P1. |
| 78955 | 79050 | ** The result is always an integer. |
| 78956 | 79051 | ** |
| 78957 | 79052 | ** To force any register to be an integer, just add 0. |
| | @@ -79039,18 +79134,65 @@ |
| 79039 | 79134 | if( rc ) goto abort_due_to_error; |
| 79040 | 79135 | break; |
| 79041 | 79136 | } |
| 79042 | 79137 | #endif /* SQLITE_OMIT_CAST */ |
| 79043 | 79138 | |
| 79139 | +/* Opcode: Eq P1 P2 P3 P4 P5 |
| 79140 | +** Synopsis: IF r[P3]==r[P1] |
| 79141 | +** |
| 79142 | +** Compare the values in register P1 and P3. If reg(P3)==reg(P1) then |
| 79143 | +** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5, then |
| 79144 | +** store the result of comparison in register P2. |
| 79145 | +** |
| 79146 | +** The SQLITE_AFF_MASK portion of P5 must be an affinity character - |
| 79147 | +** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made |
| 79148 | +** to coerce both inputs according to this affinity before the |
| 79149 | +** comparison is made. If the SQLITE_AFF_MASK is 0x00, then numeric |
| 79150 | +** affinity is used. Note that the affinity conversions are stored |
| 79151 | +** back into the input registers P1 and P3. So this opcode can cause |
| 79152 | +** persistent changes to registers P1 and P3. |
| 79153 | +** |
| 79154 | +** Once any conversions have taken place, and neither value is NULL, |
| 79155 | +** the values are compared. If both values are blobs then memcmp() is |
| 79156 | +** used to determine the results of the comparison. If both values |
| 79157 | +** are text, then the appropriate collating function specified in |
| 79158 | +** P4 is used to do the comparison. If P4 is not specified then |
| 79159 | +** memcmp() is used to compare text string. If both values are |
| 79160 | +** numeric, then a numeric comparison is used. If the two values |
| 79161 | +** are of different types, then numbers are considered less than |
| 79162 | +** strings and strings are considered less than blobs. |
| 79163 | +** |
| 79164 | +** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either |
| 79165 | +** true or false and is never NULL. If both operands are NULL then the result |
| 79166 | +** of comparison is true. If either operand is NULL then the result is false. |
| 79167 | +** If neither operand is NULL the result is the same as it would be if |
| 79168 | +** the SQLITE_NULLEQ flag were omitted from P5. |
| 79169 | +** |
| 79170 | +** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the |
| 79171 | +** content of r[P2] is only changed if the new value is NULL or 0 (false). |
| 79172 | +** In other words, a prior r[P2] value will not be overwritten by 1 (true). |
| 79173 | +*/ |
| 79174 | +/* Opcode: Ne P1 P2 P3 P4 P5 |
| 79175 | +** Synopsis: IF r[P3]!=r[P1] |
| 79176 | +** |
| 79177 | +** This works just like the Eq opcode except that the jump is taken if |
| 79178 | +** the operands in registers P1 and P3 are not equal. See the Eq opcode for |
| 79179 | +** additional information. |
| 79180 | +** |
| 79181 | +** If both SQLITE_STOREP2 and SQLITE_KEEPNULL flags are set then the |
| 79182 | +** content of r[P2] is only changed if the new value is NULL or 1 (true). |
| 79183 | +** In other words, a prior r[P2] value will not be overwritten by 0 (false). |
| 79184 | +*/ |
| 79044 | 79185 | /* Opcode: Lt P1 P2 P3 P4 P5 |
| 79045 | | -** Synopsis: if r[P1]<r[P3] goto P2 |
| 79186 | +** Synopsis: IF r[P3]<r[P1] |
| 79046 | 79187 | ** |
| 79047 | 79188 | ** Compare the values in register P1 and P3. If reg(P3)<reg(P1) then |
| 79048 | | -** jump to address P2. |
| 79189 | +** jump to address P2. Or if the SQLITE_STOREP2 flag is set in P5 store |
| 79190 | +** the result of comparison (0 or 1 or NULL) into register P2. |
| 79049 | 79191 | ** |
| 79050 | 79192 | ** If the SQLITE_JUMPIFNULL bit of P5 is set and either reg(P1) or |
| 79051 | | -** reg(P3) is NULL then take the jump. If the SQLITE_JUMPIFNULL |
| 79193 | +** reg(P3) is NULL then the take the jump. If the SQLITE_JUMPIFNULL |
| 79052 | 79194 | ** bit is clear then fall through if either operand is NULL. |
| 79053 | 79195 | ** |
| 79054 | 79196 | ** The SQLITE_AFF_MASK portion of P5 must be an affinity character - |
| 79055 | 79197 | ** SQLITE_AFF_TEXT, SQLITE_AFF_INTEGER, and so forth. An attempt is made |
| 79056 | 79198 | ** to coerce both inputs according to this affinity before the |
| | @@ -79066,60 +79208,27 @@ |
| 79066 | 79208 | ** P4 is used to do the comparison. If P4 is not specified then |
| 79067 | 79209 | ** memcmp() is used to compare text string. If both values are |
| 79068 | 79210 | ** numeric, then a numeric comparison is used. If the two values |
| 79069 | 79211 | ** are of different types, then numbers are considered less than |
| 79070 | 79212 | ** strings and strings are considered less than blobs. |
| 79071 | | -** |
| 79072 | | -** If the SQLITE_STOREP2 bit of P5 is set, then do not jump. Instead, |
| 79073 | | -** store a boolean result (either 0, or 1, or NULL) in register P2. |
| 79074 | | -** |
| 79075 | | -** If the SQLITE_NULLEQ bit is set in P5, then NULL values are considered |
| 79076 | | -** equal to one another, provided that they do not have their MEM_Cleared |
| 79077 | | -** bit set. |
| 79078 | | -*/ |
| 79079 | | -/* Opcode: Ne P1 P2 P3 P4 P5 |
| 79080 | | -** Synopsis: if r[P1]!=r[P3] goto P2 |
| 79081 | | -** |
| 79082 | | -** This works just like the Lt opcode except that the jump is taken if |
| 79083 | | -** the operands in registers P1 and P3 are not equal. See the Lt opcode for |
| 79084 | | -** additional information. |
| 79085 | | -** |
| 79086 | | -** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either |
| 79087 | | -** true or false and is never NULL. If both operands are NULL then the result |
| 79088 | | -** of comparison is false. If either operand is NULL then the result is true. |
| 79089 | | -** If neither operand is NULL the result is the same as it would be if |
| 79090 | | -** the SQLITE_NULLEQ flag were omitted from P5. |
| 79091 | | -*/ |
| 79092 | | -/* Opcode: Eq P1 P2 P3 P4 P5 |
| 79093 | | -** Synopsis: if r[P1]==r[P3] goto P2 |
| 79094 | | -** |
| 79095 | | -** This works just like the Lt opcode except that the jump is taken if |
| 79096 | | -** the operands in registers P1 and P3 are equal. |
| 79097 | | -** See the Lt opcode for additional information. |
| 79098 | | -** |
| 79099 | | -** If SQLITE_NULLEQ is set in P5 then the result of comparison is always either |
| 79100 | | -** true or false and is never NULL. If both operands are NULL then the result |
| 79101 | | -** of comparison is true. If either operand is NULL then the result is false. |
| 79102 | | -** If neither operand is NULL the result is the same as it would be if |
| 79103 | | -** the SQLITE_NULLEQ flag were omitted from P5. |
| 79104 | 79213 | */ |
| 79105 | 79214 | /* Opcode: Le P1 P2 P3 P4 P5 |
| 79106 | | -** Synopsis: if r[P1]<=r[P3] goto P2 |
| 79215 | +** Synopsis: IF r[P3]<=r[P1] |
| 79107 | 79216 | ** |
| 79108 | 79217 | ** This works just like the Lt opcode except that the jump is taken if |
| 79109 | 79218 | ** the content of register P3 is less than or equal to the content of |
| 79110 | 79219 | ** register P1. See the Lt opcode for additional information. |
| 79111 | 79220 | */ |
| 79112 | 79221 | /* Opcode: Gt P1 P2 P3 P4 P5 |
| 79113 | | -** Synopsis: if r[P1]>r[P3] goto P2 |
| 79222 | +** Synopsis: IF r[P3]>r[P1] |
| 79114 | 79223 | ** |
| 79115 | 79224 | ** This works just like the Lt opcode except that the jump is taken if |
| 79116 | 79225 | ** the content of register P3 is greater than the content of |
| 79117 | 79226 | ** register P1. See the Lt opcode for additional information. |
| 79118 | 79227 | */ |
| 79119 | 79228 | /* Opcode: Ge P1 P2 P3 P4 P5 |
| 79120 | | -** Synopsis: if r[P1]>=r[P3] goto P2 |
| 79229 | +** Synopsis: IF r[P3]>=r[P1] |
| 79121 | 79230 | ** |
| 79122 | 79231 | ** This works just like the Lt opcode except that the jump is taken if |
| 79123 | 79232 | ** the content of register P3 is greater than or equal to the content of |
| 79124 | 79233 | ** register P1. See the Lt opcode for additional information. |
| 79125 | 79234 | */ |
| | @@ -79127,11 +79236,11 @@ |
| 79127 | 79236 | case OP_Ne: /* same as TK_NE, jump, in1, in3 */ |
| 79128 | 79237 | case OP_Lt: /* same as TK_LT, jump, in1, in3 */ |
| 79129 | 79238 | case OP_Le: /* same as TK_LE, jump, in1, in3 */ |
| 79130 | 79239 | case OP_Gt: /* same as TK_GT, jump, in1, in3 */ |
| 79131 | 79240 | case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ |
| 79132 | | - int res; /* Result of the comparison of pIn1 against pIn3 */ |
| 79241 | + int res, res2; /* Result of the comparison of pIn1 against pIn3 */ |
| 79133 | 79242 | char affinity; /* Affinity to use for comparison */ |
| 79134 | 79243 | u16 flags1; /* Copy of initial value of pIn1->flags */ |
| 79135 | 79244 | u16 flags3; /* Copy of initial value of pIn3->flags */ |
| 79136 | 79245 | |
| 79137 | 79246 | pIn1 = &aMem[pOp->p1]; |
| | @@ -79150,21 +79259,22 @@ |
| 79150 | 79259 | assert( (pOp->p5 & SQLITE_JUMPIFNULL)==0 ); |
| 79151 | 79260 | if( (flags1&MEM_Null)!=0 |
| 79152 | 79261 | && (flags3&MEM_Null)!=0 |
| 79153 | 79262 | && (flags3&MEM_Cleared)==0 |
| 79154 | 79263 | ){ |
| 79155 | | - res = 0; /* Results are equal */ |
| 79264 | + res = 0; /* Operands are equal */ |
| 79156 | 79265 | }else{ |
| 79157 | | - res = 1; /* Results are not equal */ |
| 79266 | + res = 1; /* Operands are not equal */ |
| 79158 | 79267 | } |
| 79159 | 79268 | }else{ |
| 79160 | 79269 | /* SQLITE_NULLEQ is clear and at least one operand is NULL, |
| 79161 | 79270 | ** then the result is always NULL. |
| 79162 | 79271 | ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. |
| 79163 | 79272 | */ |
| 79164 | 79273 | if( pOp->p5 & SQLITE_STOREP2 ){ |
| 79165 | 79274 | pOut = &aMem[pOp->p2]; |
| 79275 | + iCompare = 1; /* Operands are not equal */ |
| 79166 | 79276 | memAboutToChange(p, pOut); |
| 79167 | 79277 | MemSetTypeFlag(pOut, MEM_Null); |
| 79168 | 79278 | REGISTER_TRACE(pOp->p2, pOut); |
| 79169 | 79279 | }else{ |
| 79170 | 79280 | VdbeBranchTaken(2,3); |
| | @@ -79214,16 +79324,16 @@ |
| 79214 | 79324 | flags3 &= ~MEM_Zero; |
| 79215 | 79325 | } |
| 79216 | 79326 | res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl); |
| 79217 | 79327 | } |
| 79218 | 79328 | switch( pOp->opcode ){ |
| 79219 | | - case OP_Eq: res = res==0; break; |
| 79220 | | - case OP_Ne: res = res!=0; break; |
| 79221 | | - case OP_Lt: res = res<0; break; |
| 79222 | | - case OP_Le: res = res<=0; break; |
| 79223 | | - case OP_Gt: res = res>0; break; |
| 79224 | | - default: res = res>=0; break; |
| 79329 | + case OP_Eq: res2 = res==0; break; |
| 79330 | + case OP_Ne: res2 = res; break; |
| 79331 | + case OP_Lt: res2 = res<0; break; |
| 79332 | + case OP_Le: res2 = res<=0; break; |
| 79333 | + case OP_Gt: res2 = res>0; break; |
| 79334 | + default: res2 = res>=0; break; |
| 79225 | 79335 | } |
| 79226 | 79336 | |
| 79227 | 79337 | /* Undo any changes made by applyAffinity() to the input registers. */ |
| 79228 | 79338 | assert( (pIn1->flags & MEM_Dyn) == (flags1 & MEM_Dyn) ); |
| 79229 | 79339 | pIn1->flags = flags1; |
| | @@ -79230,22 +79340,58 @@ |
| 79230 | 79340 | assert( (pIn3->flags & MEM_Dyn) == (flags3 & MEM_Dyn) ); |
| 79231 | 79341 | pIn3->flags = flags3; |
| 79232 | 79342 | |
| 79233 | 79343 | if( pOp->p5 & SQLITE_STOREP2 ){ |
| 79234 | 79344 | pOut = &aMem[pOp->p2]; |
| 79345 | + iCompare = res; |
| 79346 | + res2 = res2!=0; /* For this path res2 must be exactly 0 or 1 */ |
| 79347 | + if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){ |
| 79348 | + /* The KEEPNULL flag prevents OP_Eq from overwriting a NULL with 1 |
| 79349 | + ** and prevents OP_Ne from overwriting NULL with 0. This flag |
| 79350 | + ** is only used in contexts where either: |
| 79351 | + ** (1) op==OP_Eq && (r[P2]==NULL || r[P2]==0) |
| 79352 | + ** (2) op==OP_Ne && (r[P2]==NULL || r[P2]==1) |
| 79353 | + ** Therefore it is not necessary to check the content of r[P2] for |
| 79354 | + ** NULL. */ |
| 79355 | + assert( pOp->opcode==OP_Ne || pOp->opcode==OP_Eq ); |
| 79356 | + assert( res2==0 || res2==1 ); |
| 79357 | + testcase( res2==0 && pOp->opcode==OP_Eq ); |
| 79358 | + testcase( res2==1 && pOp->opcode==OP_Eq ); |
| 79359 | + testcase( res2==0 && pOp->opcode==OP_Ne ); |
| 79360 | + testcase( res2==1 && pOp->opcode==OP_Ne ); |
| 79361 | + if( (pOp->opcode==OP_Eq)==res2 ) break; |
| 79362 | + } |
| 79235 | 79363 | memAboutToChange(p, pOut); |
| 79236 | 79364 | MemSetTypeFlag(pOut, MEM_Int); |
| 79237 | | - pOut->u.i = res; |
| 79365 | + pOut->u.i = res2; |
| 79238 | 79366 | REGISTER_TRACE(pOp->p2, pOut); |
| 79239 | 79367 | }else{ |
| 79240 | 79368 | VdbeBranchTaken(res!=0, (pOp->p5 & SQLITE_NULLEQ)?2:3); |
| 79241 | | - if( res ){ |
| 79369 | + if( res2 ){ |
| 79242 | 79370 | goto jump_to_p2; |
| 79243 | 79371 | } |
| 79244 | 79372 | } |
| 79245 | 79373 | break; |
| 79246 | 79374 | } |
| 79375 | + |
| 79376 | +/* Opcode: ElseNotEq * P2 * * * |
| 79377 | +** |
| 79378 | +** This opcode must immediately follow an Lt or Gt comparison operator. |
| 79379 | +** If the operands in that previous comparison had been used with an Eq |
| 79380 | +** operator and if the result of that Eq would be NULL or false (0), then |
| 79381 | +** then jump to P2. If the result of comparing the two previous operands |
| 79382 | +** using Eq would have been true (1), then fall through. |
| 79383 | +*/ |
| 79384 | +case OP_ElseNotEq: { /* same as TK_ESCAPE, jump */ |
| 79385 | + assert( pOp>aOp ); |
| 79386 | + assert( pOp[-1].opcode==OP_Lt || pOp[-1].opcode==OP_Gt ); |
| 79387 | + assert( pOp[-1].p5 & SQLITE_STOREP2 ); |
| 79388 | + VdbeBranchTaken(iCompare!=0, 2); |
| 79389 | + if( iCompare!=0 ) goto jump_to_p2; |
| 79390 | + break; |
| 79391 | +} |
| 79392 | + |
| 79247 | 79393 | |
| 79248 | 79394 | /* Opcode: Permutation * * * P4 * |
| 79249 | 79395 | ** |
| 79250 | 79396 | ** Set the permutation used by the OP_Compare operator to be the array |
| 79251 | 79397 | ** of integers in P4. |
| | @@ -79492,11 +79638,11 @@ |
| 79492 | 79638 | } |
| 79493 | 79639 | break; |
| 79494 | 79640 | } |
| 79495 | 79641 | |
| 79496 | 79642 | /* Opcode: IsNull P1 P2 * * * |
| 79497 | | -** Synopsis: if r[P1]==NULL goto P2 |
| 79643 | +** Synopsis: if r[P1]==NULL goto P2 |
| 79498 | 79644 | ** |
| 79499 | 79645 | ** Jump to P2 if the value in register P1 is NULL. |
| 79500 | 79646 | */ |
| 79501 | 79647 | case OP_IsNull: { /* same as TK_ISNULL, jump, in1 */ |
| 79502 | 79648 | pIn1 = &aMem[pOp->p1]; |
| | @@ -79520,11 +79666,11 @@ |
| 79520 | 79666 | } |
| 79521 | 79667 | break; |
| 79522 | 79668 | } |
| 79523 | 79669 | |
| 79524 | 79670 | /* Opcode: Column P1 P2 P3 P4 P5 |
| 79525 | | -** Synopsis: r[P3]=PX |
| 79671 | +** Synopsis: r[P3]=PX |
| 79526 | 79672 | ** |
| 79527 | 79673 | ** Interpret the data that cursor P1 points to as a structure built using |
| 79528 | 79674 | ** the MakeRecord instruction. (See the MakeRecord opcode for additional |
| 79529 | 79675 | ** information about the format of the data.) Extract the P2-th column |
| 79530 | 79676 | ** from this record. If there are less that (P2+1) |
| | @@ -81030,11 +81176,10 @@ |
| 81030 | 81176 | assert( pOp[1].opcode==OP_IdxLT || pOp[1].opcode==OP_IdxGT ); |
| 81031 | 81177 | pOp++; /* Skip the OP_IdxLt or OP_IdxGT that follows */ |
| 81032 | 81178 | } |
| 81033 | 81179 | break; |
| 81034 | 81180 | } |
| 81035 | | - |
| 81036 | 81181 | |
| 81037 | 81182 | /* Opcode: Found P1 P2 P3 P4 * |
| 81038 | 81183 | ** Synopsis: key=r[P3@P4] |
| 81039 | 81184 | ** |
| 81040 | 81185 | ** If P4==0 then register P3 holds a blob constructed by MakeRecord. If |
| | @@ -81463,11 +81608,11 @@ |
| 81463 | 81608 | ** |
| 81464 | 81609 | ** This instruction only works on tables. The equivalent instruction |
| 81465 | 81610 | ** for indices is OP_IdxInsert. |
| 81466 | 81611 | */ |
| 81467 | 81612 | /* Opcode: InsertInt P1 P2 P3 P4 P5 |
| 81468 | | -** Synopsis: intkey=P3 data=r[P2] |
| 81613 | +** Synopsis: intkey=P3 data=r[P2] |
| 81469 | 81614 | ** |
| 81470 | 81615 | ** This works exactly like OP_Insert except that the key is the |
| 81471 | 81616 | ** integer value P3, not the value of the integer stored in register P3. |
| 81472 | 81617 | */ |
| 81473 | 81618 | case OP_Insert: |
| | @@ -81694,11 +81839,11 @@ |
| 81694 | 81839 | p->nChange = 0; |
| 81695 | 81840 | break; |
| 81696 | 81841 | } |
| 81697 | 81842 | |
| 81698 | 81843 | /* Opcode: SorterCompare P1 P2 P3 P4 |
| 81699 | | -** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 |
| 81844 | +** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2 |
| 81700 | 81845 | ** |
| 81701 | 81846 | ** P1 is a sorter cursor. This instruction compares a prefix of the |
| 81702 | 81847 | ** record blob in register P3 against a prefix of the entry that |
| 81703 | 81848 | ** the sorter cursor currently points to. Only the first P4 fields |
| 81704 | 81849 | ** of r[P3] and the sorter record are compared. |
| | @@ -82221,11 +82366,11 @@ |
| 82221 | 82366 | pC->cacheStatus = CACHE_STALE; |
| 82222 | 82367 | break; |
| 82223 | 82368 | } |
| 82224 | 82369 | |
| 82225 | 82370 | /* Opcode: Seek P1 * P3 P4 * |
| 82226 | | -** Synopsis: Move P3 to P1.rowid |
| 82371 | +** Synopsis: Move P3 to P1.rowid |
| 82227 | 82372 | ** |
| 82228 | 82373 | ** P1 is an open index cursor and P3 is a cursor on the corresponding |
| 82229 | 82374 | ** table. This opcode does a deferred seek of the P3 table cursor |
| 82230 | 82375 | ** to the row that corresponds to the current row of P1. |
| 82231 | 82376 | ** |
| | @@ -82728,11 +82873,11 @@ |
| 82728 | 82873 | break; |
| 82729 | 82874 | } |
| 82730 | 82875 | #endif /* SQLITE_OMIT_INTEGRITY_CHECK */ |
| 82731 | 82876 | |
| 82732 | 82877 | /* Opcode: RowSetAdd P1 P2 * * * |
| 82733 | | -** Synopsis: rowset(P1)=r[P2] |
| 82878 | +** Synopsis: rowset(P1)=r[P2] |
| 82734 | 82879 | ** |
| 82735 | 82880 | ** Insert the integer value held by register P2 into a boolean index |
| 82736 | 82881 | ** held in register P1. |
| 82737 | 82882 | ** |
| 82738 | 82883 | ** An assertion fails if P2 is not an integer. |
| | @@ -82748,11 +82893,11 @@ |
| 82748 | 82893 | sqlite3RowSetInsert(pIn1->u.pRowSet, pIn2->u.i); |
| 82749 | 82894 | break; |
| 82750 | 82895 | } |
| 82751 | 82896 | |
| 82752 | 82897 | /* Opcode: RowSetRead P1 P2 P3 * * |
| 82753 | | -** Synopsis: r[P3]=rowset(P1) |
| 82898 | +** Synopsis: r[P3]=rowset(P1) |
| 82754 | 82899 | ** |
| 82755 | 82900 | ** Extract the smallest value from boolean index P1 and put that value into |
| 82756 | 82901 | ** register P3. Or, if boolean index P1 is initially empty, leave P3 |
| 82757 | 82902 | ** unchanged and jump to instruction P2. |
| 82758 | 82903 | */ |
| | @@ -83927,11 +84072,11 @@ |
| 83927 | 84072 | } |
| 83928 | 84073 | #endif |
| 83929 | 84074 | |
| 83930 | 84075 | |
| 83931 | 84076 | /* Opcode: Init * P2 * P4 * |
| 83932 | | -** Synopsis: Start at P2 |
| 84077 | +** Synopsis: Start at P2 |
| 83933 | 84078 | ** |
| 83934 | 84079 | ** Programs contain a single instance of this opcode as the very first |
| 83935 | 84080 | ** opcode. |
| 83936 | 84081 | ** |
| 83937 | 84082 | ** If tracing is enabled (by the sqlite3_trace()) interface, then |
| | @@ -83987,12 +84132,12 @@ |
| 83987 | 84132 | ){ |
| 83988 | 84133 | sqlite3DebugPrintf("SQL-trace: %s\n", zTrace); |
| 83989 | 84134 | } |
| 83990 | 84135 | #endif /* SQLITE_DEBUG */ |
| 83991 | 84136 | #endif /* SQLITE_OMIT_TRACE */ |
| 83992 | | - if( pOp->p2 ) goto jump_to_p2; |
| 83993 | | - break; |
| 84137 | + assert( pOp->p2>0 ); |
| 84138 | + goto jump_to_p2; |
| 83994 | 84139 | } |
| 83995 | 84140 | |
| 83996 | 84141 | #ifdef SQLITE_ENABLE_CURSOR_HINTS |
| 83997 | 84142 | /* Opcode: CursorHint P1 * * P4 * |
| 83998 | 84143 | ** |
| | @@ -88760,10 +88905,37 @@ |
| 88760 | 88905 | } |
| 88761 | 88906 | case TK_VARIABLE: { |
| 88762 | 88907 | notValid(pParse, pNC, "parameters", NC_IsCheck|NC_PartIdx|NC_IdxExpr); |
| 88763 | 88908 | break; |
| 88764 | 88909 | } |
| 88910 | + case TK_EQ: |
| 88911 | + case TK_NE: |
| 88912 | + case TK_LT: |
| 88913 | + case TK_LE: |
| 88914 | + case TK_GT: |
| 88915 | + case TK_GE: |
| 88916 | + case TK_IS: |
| 88917 | + case TK_ISNOT: { |
| 88918 | + int nLeft, nRight; |
| 88919 | + if( pParse->db->mallocFailed ) break; |
| 88920 | + assert( pExpr->pRight!=0 ); |
| 88921 | + assert( pExpr->pLeft!=0 ); |
| 88922 | + nLeft = sqlite3ExprVectorSize(pExpr->pLeft); |
| 88923 | + nRight = sqlite3ExprVectorSize(pExpr->pRight); |
| 88924 | + if( nLeft!=nRight ){ |
| 88925 | + testcase( pExpr->op==TK_EQ ); |
| 88926 | + testcase( pExpr->op==TK_NE ); |
| 88927 | + testcase( pExpr->op==TK_LT ); |
| 88928 | + testcase( pExpr->op==TK_LE ); |
| 88929 | + testcase( pExpr->op==TK_GT ); |
| 88930 | + testcase( pExpr->op==TK_GE ); |
| 88931 | + testcase( pExpr->op==TK_IS ); |
| 88932 | + testcase( pExpr->op==TK_ISNOT ); |
| 88933 | + sqlite3ErrorMsg(pParse, "row value misused"); |
| 88934 | + } |
| 88935 | + break; |
| 88936 | + } |
| 88765 | 88937 | } |
| 88766 | 88938 | return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue; |
| 88767 | 88939 | } |
| 88768 | 88940 | |
| 88769 | 88941 | /* |
| | @@ -89501,10 +89673,22 @@ |
| 89501 | 89673 | ************************************************************************* |
| 89502 | 89674 | ** This file contains routines used for analyzing expressions and |
| 89503 | 89675 | ** for generating VDBE code that evaluates expressions in SQLite. |
| 89504 | 89676 | */ |
| 89505 | 89677 | /* #include "sqliteInt.h" */ |
| 89678 | + |
| 89679 | +/* Forward declarations */ |
| 89680 | +static void exprCodeBetween(Parse*,Expr*,int,void(*)(Parse*,Expr*,int,int),int); |
| 89681 | +static int exprCodeVector(Parse *pParse, Expr *p, int *piToFree); |
| 89682 | + |
| 89683 | +/* |
| 89684 | +** Return the affinity character for a single column of a table. |
| 89685 | +*/ |
| 89686 | +SQLITE_PRIVATE char sqlite3TableColumnAffinity(Table *pTab, int iCol){ |
| 89687 | + assert( iCol<pTab->nCol ); |
| 89688 | + return iCol>=0 ? pTab->aCol[iCol].affinity : SQLITE_AFF_INTEGER; |
| 89689 | +} |
| 89506 | 89690 | |
| 89507 | 89691 | /* |
| 89508 | 89692 | ** Return the 'affinity' of the expression pExpr if any. |
| 89509 | 89693 | ** |
| 89510 | 89694 | ** If pExpr is a column, a reference to a column via an 'AS' alias, |
| | @@ -89527,25 +89711,25 @@ |
| 89527 | 89711 | op = pExpr->op; |
| 89528 | 89712 | if( op==TK_SELECT ){ |
| 89529 | 89713 | assert( pExpr->flags&EP_xIsSelect ); |
| 89530 | 89714 | return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); |
| 89531 | 89715 | } |
| 89716 | + if( op==TK_REGISTER ) op = pExpr->op2; |
| 89532 | 89717 | #ifndef SQLITE_OMIT_CAST |
| 89533 | 89718 | if( op==TK_CAST ){ |
| 89534 | 89719 | assert( !ExprHasProperty(pExpr, EP_IntValue) ); |
| 89535 | 89720 | return sqlite3AffinityType(pExpr->u.zToken, 0); |
| 89536 | 89721 | } |
| 89537 | 89722 | #endif |
| 89538 | | - if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER) |
| 89539 | | - && pExpr->pTab!=0 |
| 89540 | | - ){ |
| 89541 | | - /* op==TK_REGISTER && pExpr->pTab!=0 happens when pExpr was originally |
| 89542 | | - ** a TK_COLUMN but was previously evaluated and cached in a register */ |
| 89543 | | - int j = pExpr->iColumn; |
| 89544 | | - if( j<0 ) return SQLITE_AFF_INTEGER; |
| 89545 | | - assert( pExpr->pTab && j<pExpr->pTab->nCol ); |
| 89546 | | - return pExpr->pTab->aCol[j].affinity; |
| 89723 | + if( op==TK_AGG_COLUMN || op==TK_COLUMN ){ |
| 89724 | + return sqlite3TableColumnAffinity(pExpr->pTab, pExpr->iColumn); |
| 89725 | + } |
| 89726 | + if( op==TK_SELECT_COLUMN ){ |
| 89727 | + assert( pExpr->pLeft->flags&EP_xIsSelect ); |
| 89728 | + return sqlite3ExprAffinity( |
| 89729 | + pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr |
| 89730 | + ); |
| 89547 | 89731 | } |
| 89548 | 89732 | return pExpr->affinity; |
| 89549 | 89733 | } |
| 89550 | 89734 | |
| 89551 | 89735 | /* |
| | @@ -89707,11 +89891,11 @@ |
| 89707 | 89891 | aff = sqlite3ExprAffinity(pExpr->pLeft); |
| 89708 | 89892 | if( pExpr->pRight ){ |
| 89709 | 89893 | aff = sqlite3CompareAffinity(pExpr->pRight, aff); |
| 89710 | 89894 | }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 89711 | 89895 | aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff); |
| 89712 | | - }else if( !aff ){ |
| 89896 | + }else if( NEVER(aff==0) ){ |
| 89713 | 89897 | aff = SQLITE_AFF_BLOB; |
| 89714 | 89898 | } |
| 89715 | 89899 | return aff; |
| 89716 | 89900 | } |
| 89717 | 89901 | |
| | @@ -89796,10 +89980,274 @@ |
| 89796 | 89980 | addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, |
| 89797 | 89981 | (void*)p4, P4_COLLSEQ); |
| 89798 | 89982 | sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); |
| 89799 | 89983 | return addr; |
| 89800 | 89984 | } |
| 89985 | + |
| 89986 | +/* |
| 89987 | +** Return true if expression pExpr is a vector, or false otherwise. |
| 89988 | +** |
| 89989 | +** A vector is defined as any expression that results in two or more |
| 89990 | +** columns of result. Every TK_VECTOR node is an vector because the |
| 89991 | +** parser will not generate a TK_VECTOR with fewer than two entries. |
| 89992 | +** But a TK_SELECT might be either a vector or a scalar. It is only |
| 89993 | +** considered a vector if it has two or more result columns. |
| 89994 | +*/ |
| 89995 | +SQLITE_PRIVATE int sqlite3ExprIsVector(Expr *pExpr){ |
| 89996 | + return sqlite3ExprVectorSize(pExpr)>1; |
| 89997 | +} |
| 89998 | + |
| 89999 | +/* |
| 90000 | +** If the expression passed as the only argument is of type TK_VECTOR |
| 90001 | +** return the number of expressions in the vector. Or, if the expression |
| 90002 | +** is a sub-select, return the number of columns in the sub-select. For |
| 90003 | +** any other type of expression, return 1. |
| 90004 | +*/ |
| 90005 | +SQLITE_PRIVATE int sqlite3ExprVectorSize(Expr *pExpr){ |
| 90006 | + u8 op = pExpr->op; |
| 90007 | + if( op==TK_REGISTER ) op = pExpr->op2; |
| 90008 | + if( op==TK_VECTOR ){ |
| 90009 | + return pExpr->x.pList->nExpr; |
| 90010 | + }else if( op==TK_SELECT ){ |
| 90011 | + return pExpr->x.pSelect->pEList->nExpr; |
| 90012 | + }else{ |
| 90013 | + return 1; |
| 90014 | + } |
| 90015 | +} |
| 90016 | + |
| 90017 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 90018 | +/* |
| 90019 | +** Return a pointer to a subexpression of pVector that is the i-th |
| 90020 | +** column of the vector (numbered starting with 0). The caller must |
| 90021 | +** ensure that i is within range. |
| 90022 | +** |
| 90023 | +** If pVector is really a scalar (and "scalar" here includes subqueries |
| 90024 | +** that return a single column!) then return pVector unmodified. |
| 90025 | +** |
| 90026 | +** pVector retains ownership of the returned subexpression. |
| 90027 | +** |
| 90028 | +** If the vector is a (SELECT ...) then the expression returned is |
| 90029 | +** just the expression for the i-th term of the result set, and may |
| 90030 | +** not be ready for evaluation because the table cursor has not yet |
| 90031 | +** been positioned. |
| 90032 | +*/ |
| 90033 | +SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr *pVector, int i){ |
| 90034 | + assert( i<sqlite3ExprVectorSize(pVector) ); |
| 90035 | + if( sqlite3ExprIsVector(pVector) ){ |
| 90036 | + assert( pVector->op2==0 || pVector->op==TK_REGISTER ); |
| 90037 | + if( pVector->op==TK_SELECT || pVector->op2==TK_SELECT ){ |
| 90038 | + return pVector->x.pSelect->pEList->a[i].pExpr; |
| 90039 | + }else{ |
| 90040 | + return pVector->x.pList->a[i].pExpr; |
| 90041 | + } |
| 90042 | + } |
| 90043 | + return pVector; |
| 90044 | +} |
| 90045 | +#endif /* !defined(SQLITE_OMIT_SUBQUERY) */ |
| 90046 | + |
| 90047 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 90048 | +/* |
| 90049 | +** Compute and return a new Expr object which when passed to |
| 90050 | +** sqlite3ExprCode() will generate all necessary code to compute |
| 90051 | +** the iField-th column of the vector expression pVector. |
| 90052 | +** |
| 90053 | +** It is ok for pVector to be a scalar (as long as iField==0). |
| 90054 | +** In that case, this routine works like sqlite3ExprDup(). |
| 90055 | +** |
| 90056 | +** The caller owns the returned Expr object and is responsible for |
| 90057 | +** ensuring that the returned value eventually gets freed. |
| 90058 | +** |
| 90059 | +** The caller retains ownership of pVector. If pVector is a TK_SELECT, |
| 90060 | +** then the returned object will reference pVector and so pVector must remain |
| 90061 | +** valid for the life of the returned object. If pVector is a TK_VECTOR |
| 90062 | +** or a scalar expression, then it can be deleted as soon as this routine |
| 90063 | +** returns. |
| 90064 | +** |
| 90065 | +** A trick to cause a TK_SELECT pVector to be deleted together with |
| 90066 | +** the returned Expr object is to attach the pVector to the pRight field |
| 90067 | +** of the returned TK_SELECT_COLUMN Expr object. |
| 90068 | +*/ |
| 90069 | +SQLITE_PRIVATE Expr *sqlite3ExprForVectorField( |
| 90070 | + Parse *pParse, /* Parsing context */ |
| 90071 | + Expr *pVector, /* The vector. List of expressions or a sub-SELECT */ |
| 90072 | + int iField /* Which column of the vector to return */ |
| 90073 | +){ |
| 90074 | + Expr *pRet; |
| 90075 | + if( pVector->op==TK_SELECT ){ |
| 90076 | + assert( pVector->flags & EP_xIsSelect ); |
| 90077 | + /* The TK_SELECT_COLUMN Expr node: |
| 90078 | + ** |
| 90079 | + ** pLeft: pVector containing TK_SELECT |
| 90080 | + ** pRight: not used. But recursively deleted. |
| 90081 | + ** iColumn: Index of a column in pVector |
| 90082 | + ** pLeft->iTable: First in an array of register holding result, or 0 |
| 90083 | + ** if the result is not yet computed. |
| 90084 | + ** |
| 90085 | + ** sqlite3ExprDelete() specifically skips the recursive delete of |
| 90086 | + ** pLeft on TK_SELECT_COLUMN nodes. But pRight is followed, so pVector |
| 90087 | + ** can be attached to pRight to cause this node to take ownership of |
| 90088 | + ** pVector. Typically there will be multiple TK_SELECT_COLUMN nodes |
| 90089 | + ** with the same pLeft pointer to the pVector, but only one of them |
| 90090 | + ** will own the pVector. |
| 90091 | + */ |
| 90092 | + pRet = sqlite3PExpr(pParse, TK_SELECT_COLUMN, 0, 0, 0); |
| 90093 | + if( pRet ){ |
| 90094 | + pRet->iColumn = iField; |
| 90095 | + pRet->pLeft = pVector; |
| 90096 | + } |
| 90097 | + assert( pRet==0 || pRet->iTable==0 ); |
| 90098 | + }else{ |
| 90099 | + if( pVector->op==TK_VECTOR ) pVector = pVector->x.pList->a[iField].pExpr; |
| 90100 | + pRet = sqlite3ExprDup(pParse->db, pVector, 0); |
| 90101 | + } |
| 90102 | + return pRet; |
| 90103 | +} |
| 90104 | +#endif /* !define(SQLITE_OMIT_SUBQUERY) */ |
| 90105 | + |
| 90106 | +/* |
| 90107 | +** If expression pExpr is of type TK_SELECT, generate code to evaluate |
| 90108 | +** it. Return the register in which the result is stored (or, if the |
| 90109 | +** sub-select returns more than one column, the first in an array |
| 90110 | +** of registers in which the result is stored). |
| 90111 | +** |
| 90112 | +** If pExpr is not a TK_SELECT expression, return 0. |
| 90113 | +*/ |
| 90114 | +static int exprCodeSubselect(Parse *pParse, Expr *pExpr){ |
| 90115 | + int reg = 0; |
| 90116 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 90117 | + if( pExpr->op==TK_SELECT ){ |
| 90118 | + reg = sqlite3CodeSubselect(pParse, pExpr, 0, 0); |
| 90119 | + } |
| 90120 | +#endif |
| 90121 | + return reg; |
| 90122 | +} |
| 90123 | + |
| 90124 | +/* |
| 90125 | +** Argument pVector points to a vector expression - either a TK_VECTOR |
| 90126 | +** or TK_SELECT that returns more than one column. This function returns |
| 90127 | +** the register number of a register that contains the value of |
| 90128 | +** element iField of the vector. |
| 90129 | +** |
| 90130 | +** If pVector is a TK_SELECT expression, then code for it must have |
| 90131 | +** already been generated using the exprCodeSubselect() routine. In this |
| 90132 | +** case parameter regSelect should be the first in an array of registers |
| 90133 | +** containing the results of the sub-select. |
| 90134 | +** |
| 90135 | +** If pVector is of type TK_VECTOR, then code for the requested field |
| 90136 | +** is generated. In this case (*pRegFree) may be set to the number of |
| 90137 | +** a temporary register to be freed by the caller before returning. |
| 90138 | +** |
| 90139 | +** Before returning, output parameter (*ppExpr) is set to point to the |
| 90140 | +** Expr object corresponding to element iElem of the vector. |
| 90141 | +*/ |
| 90142 | +static int exprVectorRegister( |
| 90143 | + Parse *pParse, /* Parse context */ |
| 90144 | + Expr *pVector, /* Vector to extract element from */ |
| 90145 | + int iField, /* Field to extract from pVector */ |
| 90146 | + int regSelect, /* First in array of registers */ |
| 90147 | + Expr **ppExpr, /* OUT: Expression element */ |
| 90148 | + int *pRegFree /* OUT: Temp register to free */ |
| 90149 | +){ |
| 90150 | + u8 op = pVector->op; |
| 90151 | + assert( op==TK_VECTOR || op==TK_REGISTER || op==TK_SELECT ); |
| 90152 | + if( op==TK_REGISTER ){ |
| 90153 | + *ppExpr = sqlite3VectorFieldSubexpr(pVector, iField); |
| 90154 | + return pVector->iTable+iField; |
| 90155 | + } |
| 90156 | + if( op==TK_SELECT ){ |
| 90157 | + *ppExpr = pVector->x.pSelect->pEList->a[iField].pExpr; |
| 90158 | + return regSelect+iField; |
| 90159 | + } |
| 90160 | + *ppExpr = pVector->x.pList->a[iField].pExpr; |
| 90161 | + return sqlite3ExprCodeTemp(pParse, *ppExpr, pRegFree); |
| 90162 | +} |
| 90163 | + |
| 90164 | +/* |
| 90165 | +** Expression pExpr is a comparison between two vector values. Compute |
| 90166 | +** the result of the comparison (1, 0, or NULL) and write that |
| 90167 | +** result into register dest. |
| 90168 | +** |
| 90169 | +** The caller must satisfy the following preconditions: |
| 90170 | +** |
| 90171 | +** if pExpr->op==TK_IS: op==TK_EQ and p5==SQLITE_NULLEQ |
| 90172 | +** if pExpr->op==TK_ISNOT: op==TK_NE and p5==SQLITE_NULLEQ |
| 90173 | +** otherwise: op==pExpr->op and p5==0 |
| 90174 | +*/ |
| 90175 | +static void codeVectorCompare( |
| 90176 | + Parse *pParse, /* Code generator context */ |
| 90177 | + Expr *pExpr, /* The comparison operation */ |
| 90178 | + int dest, /* Write results into this register */ |
| 90179 | + u8 op, /* Comparison operator */ |
| 90180 | + u8 p5 /* SQLITE_NULLEQ or zero */ |
| 90181 | +){ |
| 90182 | + Vdbe *v = pParse->pVdbe; |
| 90183 | + Expr *pLeft = pExpr->pLeft; |
| 90184 | + Expr *pRight = pExpr->pRight; |
| 90185 | + int nLeft = sqlite3ExprVectorSize(pLeft); |
| 90186 | + int i; |
| 90187 | + int regLeft = 0; |
| 90188 | + int regRight = 0; |
| 90189 | + u8 opx = op; |
| 90190 | + int addrDone = sqlite3VdbeMakeLabel(v); |
| 90191 | + |
| 90192 | + assert( nLeft==sqlite3ExprVectorSize(pRight) ); |
| 90193 | + assert( pExpr->op==TK_EQ || pExpr->op==TK_NE |
| 90194 | + || pExpr->op==TK_IS || pExpr->op==TK_ISNOT |
| 90195 | + || pExpr->op==TK_LT || pExpr->op==TK_GT |
| 90196 | + || pExpr->op==TK_LE || pExpr->op==TK_GE |
| 90197 | + ); |
| 90198 | + assert( pExpr->op==op || (pExpr->op==TK_IS && op==TK_EQ) |
| 90199 | + || (pExpr->op==TK_ISNOT && op==TK_NE) ); |
| 90200 | + assert( p5==0 || pExpr->op!=op ); |
| 90201 | + assert( p5==SQLITE_NULLEQ || pExpr->op==op ); |
| 90202 | + |
| 90203 | + p5 |= SQLITE_STOREP2; |
| 90204 | + if( opx==TK_LE ) opx = TK_LT; |
| 90205 | + if( opx==TK_GE ) opx = TK_GT; |
| 90206 | + |
| 90207 | + regLeft = exprCodeSubselect(pParse, pLeft); |
| 90208 | + regRight = exprCodeSubselect(pParse, pRight); |
| 90209 | + |
| 90210 | + for(i=0; 1 /*Loop exits by "break"*/; i++){ |
| 90211 | + int regFree1 = 0, regFree2 = 0; |
| 90212 | + Expr *pL, *pR; |
| 90213 | + int r1, r2; |
| 90214 | + assert( i>=0 && i<nLeft ); |
| 90215 | + if( i>0 ) sqlite3ExprCachePush(pParse); |
| 90216 | + r1 = exprVectorRegister(pParse, pLeft, i, regLeft, &pL, ®Free1); |
| 90217 | + r2 = exprVectorRegister(pParse, pRight, i, regRight, &pR, ®Free2); |
| 90218 | + codeCompare(pParse, pL, pR, opx, r1, r2, dest, p5); |
| 90219 | + testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 90220 | + testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 90221 | + testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 90222 | + testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 90223 | + testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); |
| 90224 | + testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 90225 | + sqlite3ReleaseTempReg(pParse, regFree1); |
| 90226 | + sqlite3ReleaseTempReg(pParse, regFree2); |
| 90227 | + if( i>0 ) sqlite3ExprCachePop(pParse); |
| 90228 | + if( i==nLeft-1 ){ |
| 90229 | + break; |
| 90230 | + } |
| 90231 | + if( opx==TK_EQ ){ |
| 90232 | + sqlite3VdbeAddOp2(v, OP_IfNot, dest, addrDone); VdbeCoverage(v); |
| 90233 | + p5 |= SQLITE_KEEPNULL; |
| 90234 | + }else if( opx==TK_NE ){ |
| 90235 | + sqlite3VdbeAddOp2(v, OP_If, dest, addrDone); VdbeCoverage(v); |
| 90236 | + p5 |= SQLITE_KEEPNULL; |
| 90237 | + }else{ |
| 90238 | + assert( op==TK_LT || op==TK_GT || op==TK_LE || op==TK_GE ); |
| 90239 | + sqlite3VdbeAddOp2(v, OP_ElseNotEq, 0, addrDone); |
| 90240 | + VdbeCoverageIf(v, op==TK_LT); |
| 90241 | + VdbeCoverageIf(v, op==TK_GT); |
| 90242 | + VdbeCoverageIf(v, op==TK_LE); |
| 90243 | + VdbeCoverageIf(v, op==TK_GE); |
| 90244 | + if( i==nLeft-2 ) opx = op; |
| 90245 | + } |
| 90246 | + } |
| 90247 | + sqlite3VdbeResolveLabel(v, addrDone); |
| 90248 | +} |
| 89801 | 90249 | |
| 89802 | 90250 | #if SQLITE_MAX_EXPR_DEPTH>0 |
| 89803 | 90251 | /* |
| 89804 | 90252 | ** Check that argument nHeight is less than or equal to the maximum |
| 89805 | 90253 | ** expression depth allowed. If it is not, leave an error message in |
| | @@ -90231,11 +90679,11 @@ |
| 90231 | 90679 | /* Sanity check: Assert that the IntValue is non-negative if it exists */ |
| 90232 | 90680 | assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 ); |
| 90233 | 90681 | if( !ExprHasProperty(p, EP_TokenOnly) ){ |
| 90234 | 90682 | /* The Expr.x union is never used at the same time as Expr.pRight */ |
| 90235 | 90683 | assert( p->x.pList==0 || p->pRight==0 ); |
| 90236 | | - sqlite3ExprDelete(db, p->pLeft); |
| 90684 | + if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft); |
| 90237 | 90685 | sqlite3ExprDelete(db, p->pRight); |
| 90238 | 90686 | if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken); |
| 90239 | 90687 | if( ExprHasProperty(p, EP_xIsSelect) ){ |
| 90240 | 90688 | sqlite3SelectDelete(db, p->x.pSelect); |
| 90241 | 90689 | }else{ |
| | @@ -90439,11 +90887,15 @@ |
| 90439 | 90887 | if( pzBuffer ){ |
| 90440 | 90888 | *pzBuffer = zAlloc; |
| 90441 | 90889 | } |
| 90442 | 90890 | }else{ |
| 90443 | 90891 | if( !ExprHasProperty(p, EP_TokenOnly) ){ |
| 90444 | | - pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); |
| 90892 | + if( pNew->op==TK_SELECT_COLUMN ){ |
| 90893 | + pNew->pLeft = p->pLeft; |
| 90894 | + }else{ |
| 90895 | + pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); |
| 90896 | + } |
| 90445 | 90897 | pNew->pRight = sqlite3ExprDup(db, p->pRight, 0); |
| 90446 | 90898 | } |
| 90447 | 90899 | } |
| 90448 | 90900 | } |
| 90449 | 90901 | return pNew; |
| | @@ -90679,10 +91131,64 @@ |
| 90679 | 91131 | /* Avoid leaking memory if malloc has failed. */ |
| 90680 | 91132 | sqlite3ExprDelete(db, pExpr); |
| 90681 | 91133 | sqlite3ExprListDelete(db, pList); |
| 90682 | 91134 | return 0; |
| 90683 | 91135 | } |
| 91136 | + |
| 91137 | +/* |
| 91138 | +** pColumns and pExpr form a vector assignment which is part of the SET |
| 91139 | +** clause of an UPDATE statement. Like this: |
| 91140 | +** |
| 91141 | +** (a,b,c) = (expr1,expr2,expr3) |
| 91142 | +** Or: (a,b,c) = (SELECT x,y,z FROM ....) |
| 91143 | +** |
| 91144 | +** For each term of the vector assignment, append new entries to the |
| 91145 | +** expression list pList. In the case of a subquery on the LHS, append |
| 91146 | +** TK_SELECT_COLUMN expressions. |
| 91147 | +*/ |
| 91148 | +SQLITE_PRIVATE ExprList *sqlite3ExprListAppendVector( |
| 91149 | + Parse *pParse, /* Parsing context */ |
| 91150 | + ExprList *pList, /* List to which to append. Might be NULL */ |
| 91151 | + IdList *pColumns, /* List of names of LHS of the assignment */ |
| 91152 | + Expr *pExpr /* Vector expression to be appended. Might be NULL */ |
| 91153 | +){ |
| 91154 | + sqlite3 *db = pParse->db; |
| 91155 | + int n; |
| 91156 | + int i; |
| 91157 | + int iFirst = pList ? pList->nExpr : 0; |
| 91158 | + /* pColumns can only be NULL due to an OOM but an OOM will cause an |
| 91159 | + ** exit prior to this routine being invoked */ |
| 91160 | + if( NEVER(pColumns==0) ) goto vector_append_error; |
| 91161 | + if( pExpr==0 ) goto vector_append_error; |
| 91162 | + n = sqlite3ExprVectorSize(pExpr); |
| 91163 | + if( pColumns->nId!=n ){ |
| 91164 | + sqlite3ErrorMsg(pParse, "%d columns assigned %d values", |
| 91165 | + pColumns->nId, n); |
| 91166 | + goto vector_append_error; |
| 91167 | + } |
| 91168 | + for(i=0; i<n; i++){ |
| 91169 | + Expr *pSubExpr = sqlite3ExprForVectorField(pParse, pExpr, i); |
| 91170 | + pList = sqlite3ExprListAppend(pParse, pList, pSubExpr); |
| 91171 | + if( pList ){ |
| 91172 | + assert( pList->nExpr==iFirst+i+1 ); |
| 91173 | + pList->a[pList->nExpr-1].zName = pColumns->a[i].zName; |
| 91174 | + pColumns->a[i].zName = 0; |
| 91175 | + } |
| 91176 | + } |
| 91177 | + if( pExpr->op==TK_SELECT ){ |
| 91178 | + if( pList && pList->a[iFirst].pExpr ){ |
| 91179 | + assert( pList->a[iFirst].pExpr->op==TK_SELECT_COLUMN ); |
| 91180 | + pList->a[iFirst].pExpr->pRight = pExpr; |
| 91181 | + pExpr = 0; |
| 91182 | + } |
| 91183 | + } |
| 91184 | + |
| 91185 | +vector_append_error: |
| 91186 | + sqlite3ExprDelete(db, pExpr); |
| 91187 | + sqlite3IdListDelete(db, pColumns); |
| 91188 | + return pList; |
| 91189 | +} |
| 90684 | 91190 | |
| 90685 | 91191 | /* |
| 90686 | 91192 | ** Set the sort order for the last element on the given ExprList. |
| 90687 | 91193 | */ |
| 90688 | 91194 | SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOrder){ |
| | @@ -91087,12 +91593,12 @@ |
| 91087 | 91593 | #ifndef SQLITE_OMIT_SUBQUERY |
| 91088 | 91594 | static Select *isCandidateForInOpt(Expr *pX){ |
| 91089 | 91595 | Select *p; |
| 91090 | 91596 | SrcList *pSrc; |
| 91091 | 91597 | ExprList *pEList; |
| 91092 | | - Expr *pRes; |
| 91093 | 91598 | Table *pTab; |
| 91599 | + int i; |
| 91094 | 91600 | if( !ExprHasProperty(pX, EP_xIsSelect) ) return 0; /* Not a subquery */ |
| 91095 | 91601 | if( ExprHasProperty(pX, EP_VarSelect) ) return 0; /* Correlated subq */ |
| 91096 | 91602 | p = pX->x.pSelect; |
| 91097 | 91603 | if( p->pPrior ) return 0; /* Not a compound SELECT */ |
| 91098 | 91604 | if( p->selFlags & (SF_Distinct|SF_Aggregate) ){ |
| | @@ -91111,14 +91617,17 @@ |
| 91111 | 91617 | pTab = pSrc->a[0].pTab; |
| 91112 | 91618 | assert( pTab!=0 ); |
| 91113 | 91619 | assert( pTab->pSelect==0 ); /* FROM clause is not a view */ |
| 91114 | 91620 | if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */ |
| 91115 | 91621 | pEList = p->pEList; |
| 91116 | | - if( pEList->nExpr!=1 ) return 0; /* One column in the result set */ |
| 91117 | | - pRes = pEList->a[0].pExpr; |
| 91118 | | - if( pRes->op!=TK_COLUMN ) return 0; /* Result is a column */ |
| 91119 | | - assert( pRes->iTable==pSrc->a[0].iCursor ); /* Not a correlated subquery */ |
| 91622 | + assert( pEList!=0 ); |
| 91623 | + /* All SELECT results must be columns. */ |
| 91624 | + for(i=0; i<pEList->nExpr; i++){ |
| 91625 | + Expr *pRes = pEList->a[i].pExpr; |
| 91626 | + if( pRes->op!=TK_COLUMN ) return 0; |
| 91627 | + assert( pRes->iTable==pSrc->a[0].iCursor ); /* Not a correlated subquery */ |
| 91628 | + } |
| 91120 | 91629 | return p; |
| 91121 | 91630 | } |
| 91122 | 91631 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| 91123 | 91632 | |
| 91124 | 91633 | /* |
| | @@ -91128,10 +91637,11 @@ |
| 91128 | 91637 | SQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){ |
| 91129 | 91638 | Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ |
| 91130 | 91639 | return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++); |
| 91131 | 91640 | } |
| 91132 | 91641 | |
| 91642 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 91133 | 91643 | /* |
| 91134 | 91644 | ** Generate code that checks the left-most column of index table iCur to see if |
| 91135 | 91645 | ** it contains any NULL entries. Cause the register at regHasNull to be set |
| 91136 | 91646 | ** to a non-NULL value if iCur contains no NULLs. Cause register regHasNull |
| 91137 | 91647 | ** to be set to NULL if iCur contains one or more NULL values. |
| | @@ -91143,10 +91653,11 @@ |
| 91143 | 91653 | sqlite3VdbeAddOp3(v, OP_Column, iCur, 0, regHasNull); |
| 91144 | 91654 | sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG); |
| 91145 | 91655 | VdbeComment((v, "first_entry_in(%d)", iCur)); |
| 91146 | 91656 | sqlite3VdbeJumpHere(v, addr1); |
| 91147 | 91657 | } |
| 91658 | +#endif |
| 91148 | 91659 | |
| 91149 | 91660 | |
| 91150 | 91661 | #ifndef SQLITE_OMIT_SUBQUERY |
| 91151 | 91662 | /* |
| 91152 | 91663 | ** The argument is an IN operator with a list (not a subquery) on the |
| | @@ -91187,11 +91698,11 @@ |
| 91187 | 91698 | ** implemented as a sequence of comparisons. |
| 91188 | 91699 | ** |
| 91189 | 91700 | ** An existing b-tree might be used if the RHS expression pX is a simple |
| 91190 | 91701 | ** subquery such as: |
| 91191 | 91702 | ** |
| 91192 | | -** SELECT <column> FROM <table> |
| 91703 | +** SELECT <column1>, <column2>... FROM <table> |
| 91193 | 91704 | ** |
| 91194 | 91705 | ** If the RHS of the IN operator is a list or a more complex subquery, then |
| 91195 | 91706 | ** an ephemeral table might need to be generated from the RHS and then |
| 91196 | 91707 | ** pX->iTable made to point to the ephemeral table instead of an |
| 91197 | 91708 | ** existing table. |
| | @@ -91203,18 +91714,18 @@ |
| 91203 | 91714 | ** IN index will be used to loop over all values of the RHS of the |
| 91204 | 91715 | ** IN operator. |
| 91205 | 91716 | ** |
| 91206 | 91717 | ** When IN_INDEX_LOOP is used (and the b-tree will be used to iterate |
| 91207 | 91718 | ** through the set members) then the b-tree must not contain duplicates. |
| 91208 | | -** An epheremal table must be used unless the selected <column> is guaranteed |
| 91209 | | -** to be unique - either because it is an INTEGER PRIMARY KEY or it |
| 91210 | | -** has a UNIQUE constraint or UNIQUE index. |
| 91719 | +** An epheremal table must be used unless the selected columns are guaranteed |
| 91720 | +** to be unique - either because it is an INTEGER PRIMARY KEY or due to |
| 91721 | +** a UNIQUE constraint or index. |
| 91211 | 91722 | ** |
| 91212 | 91723 | ** When IN_INDEX_MEMBERSHIP is used (and the b-tree will be used |
| 91213 | 91724 | ** for fast set membership tests) then an epheremal table must |
| 91214 | | -** be used unless <column> is an INTEGER PRIMARY KEY or an index can |
| 91215 | | -** be found with <column> as its left-most column. |
| 91725 | +** be used unless <columns> is a single INTEGER PRIMARY KEY column or an |
| 91726 | +** index can be found with the specified <columns> as its left-most. |
| 91216 | 91727 | ** |
| 91217 | 91728 | ** If the IN_INDEX_NOOP_OK and IN_INDEX_MEMBERSHIP are both set and |
| 91218 | 91729 | ** if the RHS of the IN operator is a list (not a subquery) then this |
| 91219 | 91730 | ** routine might decide that creating an ephemeral b-tree for membership |
| 91220 | 91731 | ** testing is too expensive and return IN_INDEX_NOOP. In that case, the |
| | @@ -91231,98 +91742,190 @@ |
| 91231 | 91742 | ** |
| 91232 | 91743 | ** If a register is allocated and its location stored in *prRhsHasNull, then |
| 91233 | 91744 | ** the value in that register will be NULL if the b-tree contains one or more |
| 91234 | 91745 | ** NULL values, and it will be some non-NULL value if the b-tree contains no |
| 91235 | 91746 | ** NULL values. |
| 91747 | +** |
| 91748 | +** If the aiMap parameter is not NULL, it must point to an array containing |
| 91749 | +** one element for each column returned by the SELECT statement on the RHS |
| 91750 | +** of the IN(...) operator. The i'th entry of the array is populated with the |
| 91751 | +** offset of the index column that matches the i'th column returned by the |
| 91752 | +** SELECT. For example, if the expression and selected index are: |
| 91753 | +** |
| 91754 | +** (?,?,?) IN (SELECT a, b, c FROM t1) |
| 91755 | +** CREATE INDEX i1 ON t1(b, c, a); |
| 91756 | +** |
| 91757 | +** then aiMap[] is populated with {2, 0, 1}. |
| 91236 | 91758 | */ |
| 91237 | 91759 | #ifndef SQLITE_OMIT_SUBQUERY |
| 91238 | | -SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, u32 inFlags, int *prRhsHasNull){ |
| 91760 | +SQLITE_PRIVATE int sqlite3FindInIndex( |
| 91761 | + Parse *pParse, /* Parsing context */ |
| 91762 | + Expr *pX, /* The right-hand side (RHS) of the IN operator */ |
| 91763 | + u32 inFlags, /* IN_INDEX_LOOP, _MEMBERSHIP, and/or _NOOP_OK */ |
| 91764 | + int *prRhsHasNull, /* Register holding NULL status. See notes */ |
| 91765 | + int *aiMap /* Mapping from Index fields to RHS fields */ |
| 91766 | +){ |
| 91239 | 91767 | Select *p; /* SELECT to the right of IN operator */ |
| 91240 | 91768 | int eType = 0; /* Type of RHS table. IN_INDEX_* */ |
| 91241 | 91769 | int iTab = pParse->nTab++; /* Cursor of the RHS table */ |
| 91242 | 91770 | int mustBeUnique; /* True if RHS must be unique */ |
| 91243 | 91771 | Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ |
| 91244 | 91772 | |
| 91245 | 91773 | assert( pX->op==TK_IN ); |
| 91246 | 91774 | mustBeUnique = (inFlags & IN_INDEX_LOOP)!=0; |
| 91775 | + |
| 91776 | + /* If the RHS of this IN(...) operator is a SELECT, and if it matters |
| 91777 | + ** whether or not the SELECT result contains NULL values, check whether |
| 91778 | + ** or not NULL is actually possible (it may not be, for example, due |
| 91779 | + ** to NOT NULL constraints in the schema). If no NULL values are possible, |
| 91780 | + ** set prRhsHasNull to 0 before continuing. */ |
| 91781 | + if( prRhsHasNull && (pX->flags & EP_xIsSelect) ){ |
| 91782 | + int i; |
| 91783 | + ExprList *pEList = pX->x.pSelect->pEList; |
| 91784 | + for(i=0; i<pEList->nExpr; i++){ |
| 91785 | + if( sqlite3ExprCanBeNull(pEList->a[i].pExpr) ) break; |
| 91786 | + } |
| 91787 | + if( i==pEList->nExpr ){ |
| 91788 | + prRhsHasNull = 0; |
| 91789 | + } |
| 91790 | + } |
| 91247 | 91791 | |
| 91248 | 91792 | /* Check to see if an existing table or index can be used to |
| 91249 | 91793 | ** satisfy the query. This is preferable to generating a new |
| 91250 | | - ** ephemeral table. |
| 91251 | | - */ |
| 91794 | + ** ephemeral table. */ |
| 91252 | 91795 | if( pParse->nErr==0 && (p = isCandidateForInOpt(pX))!=0 ){ |
| 91253 | 91796 | sqlite3 *db = pParse->db; /* Database connection */ |
| 91254 | 91797 | Table *pTab; /* Table <table>. */ |
| 91255 | | - Expr *pExpr; /* Expression <column> */ |
| 91256 | | - i16 iCol; /* Index of column <column> */ |
| 91257 | 91798 | i16 iDb; /* Database idx for pTab */ |
| 91799 | + ExprList *pEList = p->pEList; |
| 91800 | + int nExpr = pEList->nExpr; |
| 91258 | 91801 | |
| 91259 | 91802 | assert( p->pEList!=0 ); /* Because of isCandidateForInOpt(p) */ |
| 91260 | 91803 | assert( p->pEList->a[0].pExpr!=0 ); /* Because of isCandidateForInOpt(p) */ |
| 91261 | 91804 | assert( p->pSrc!=0 ); /* Because of isCandidateForInOpt(p) */ |
| 91262 | 91805 | pTab = p->pSrc->a[0].pTab; |
| 91263 | | - pExpr = p->pEList->a[0].pExpr; |
| 91264 | | - iCol = (i16)pExpr->iColumn; |
| 91265 | | - |
| 91806 | + |
| 91266 | 91807 | /* Code an OP_Transaction and OP_TableLock for <table>. */ |
| 91267 | 91808 | iDb = sqlite3SchemaToIndex(db, pTab->pSchema); |
| 91268 | 91809 | sqlite3CodeVerifySchema(pParse, iDb); |
| 91269 | 91810 | sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); |
| 91270 | 91811 | |
| 91271 | | - /* This function is only called from two places. In both cases the vdbe |
| 91272 | | - ** has already been allocated. So assume sqlite3GetVdbe() is always |
| 91273 | | - ** successful here. |
| 91274 | | - */ |
| 91275 | | - assert(v); |
| 91276 | | - if( iCol<0 ){ |
| 91812 | + assert(v); /* sqlite3GetVdbe() has always been previously called */ |
| 91813 | + if( nExpr==1 && pEList->a[0].pExpr->iColumn<0 ){ |
| 91814 | + /* The "x IN (SELECT rowid FROM table)" case */ |
| 91277 | 91815 | int iAddr = sqlite3CodeOnce(pParse); |
| 91278 | 91816 | VdbeCoverage(v); |
| 91279 | 91817 | |
| 91280 | 91818 | sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); |
| 91281 | 91819 | eType = IN_INDEX_ROWID; |
| 91282 | 91820 | |
| 91283 | 91821 | sqlite3VdbeJumpHere(v, iAddr); |
| 91284 | 91822 | }else{ |
| 91285 | 91823 | Index *pIdx; /* Iterator variable */ |
| 91286 | | - |
| 91287 | | - /* The collation sequence used by the comparison. If an index is to |
| 91288 | | - ** be used in place of a temp-table, it must be ordered according |
| 91289 | | - ** to this collation sequence. */ |
| 91290 | | - CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pExpr); |
| 91291 | | - |
| 91292 | | - /* Check that the affinity that will be used to perform the |
| 91293 | | - ** comparison is the same as the affinity of the column. If |
| 91294 | | - ** it is not, it is not possible to use any index. |
| 91295 | | - */ |
| 91296 | | - int affinity_ok = sqlite3IndexAffinityOk(pX, pTab->aCol[iCol].affinity); |
| 91297 | | - |
| 91298 | | - for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){ |
| 91299 | | - if( (pIdx->aiColumn[0]==iCol) |
| 91300 | | - && sqlite3FindCollSeq(db, ENC(db), pIdx->azColl[0], 0)==pReq |
| 91301 | | - && (!mustBeUnique || (pIdx->nKeyCol==1 && IsUniqueIndex(pIdx))) |
| 91302 | | - ){ |
| 91303 | | - int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v); |
| 91304 | | - sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb); |
| 91305 | | - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 91306 | | - VdbeComment((v, "%s", pIdx->zName)); |
| 91307 | | - assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); |
| 91308 | | - eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; |
| 91309 | | - |
| 91310 | | - if( prRhsHasNull && !pTab->aCol[iCol].notNull ){ |
| 91311 | | -#ifdef SQLITE_ENABLE_COLUMN_USED_MASK |
| 91312 | | - const i64 sOne = 1; |
| 91313 | | - sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, |
| 91314 | | - iTab, 0, 0, (u8*)&sOne, P4_INT64); |
| 91315 | | -#endif |
| 91316 | | - *prRhsHasNull = ++pParse->nMem; |
| 91317 | | - sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); |
| 91318 | | - } |
| 91319 | | - sqlite3VdbeJumpHere(v, iAddr); |
| 91320 | | - } |
| 91321 | | - } |
| 91322 | | - } |
| 91323 | | - } |
| 91824 | + int affinity_ok = 1; |
| 91825 | + int i; |
| 91826 | + |
| 91827 | + /* Check that the affinity that will be used to perform each |
| 91828 | + ** comparison is the same as the affinity of each column in table |
| 91829 | + ** on the RHS of the IN operator. If it not, it is not possible to |
| 91830 | + ** use any index of the RHS table. */ |
| 91831 | + for(i=0; i<nExpr && affinity_ok; i++){ |
| 91832 | + Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i); |
| 91833 | + int iCol = pEList->a[i].pExpr->iColumn; |
| 91834 | + char idxaff = sqlite3TableColumnAffinity(pTab,iCol); /* RHS table */ |
| 91835 | + char cmpaff = sqlite3CompareAffinity(pLhs, idxaff); |
| 91836 | + testcase( cmpaff==SQLITE_AFF_BLOB ); |
| 91837 | + testcase( cmpaff==SQLITE_AFF_TEXT ); |
| 91838 | + switch( cmpaff ){ |
| 91839 | + case SQLITE_AFF_BLOB: |
| 91840 | + break; |
| 91841 | + case SQLITE_AFF_TEXT: |
| 91842 | + /* sqlite3CompareAffinity() only returns TEXT if one side or the |
| 91843 | + ** other has no affinity and the other side is TEXT. Hence, |
| 91844 | + ** the only way for cmpaff to be TEXT is for idxaff to be TEXT |
| 91845 | + ** and for the term on the LHS of the IN to have no affinity. */ |
| 91846 | + assert( idxaff==SQLITE_AFF_TEXT ); |
| 91847 | + break; |
| 91848 | + default: |
| 91849 | + affinity_ok = sqlite3IsNumericAffinity(idxaff); |
| 91850 | + } |
| 91851 | + } |
| 91852 | + |
| 91853 | + if( affinity_ok ){ |
| 91854 | + /* Search for an existing index that will work for this IN operator */ |
| 91855 | + for(pIdx=pTab->pIndex; pIdx && eType==0; pIdx=pIdx->pNext){ |
| 91856 | + Bitmask colUsed; /* Columns of the index used */ |
| 91857 | + Bitmask mCol; /* Mask for the current column */ |
| 91858 | + if( pIdx->nColumn<nExpr ) continue; |
| 91859 | + /* Maximum nColumn is BMS-2, not BMS-1, so that we can compute |
| 91860 | + ** BITMASK(nExpr) without overflowing */ |
| 91861 | + testcase( pIdx->nColumn==BMS-2 ); |
| 91862 | + testcase( pIdx->nColumn==BMS-1 ); |
| 91863 | + if( pIdx->nColumn>=BMS-1 ) continue; |
| 91864 | + if( mustBeUnique ){ |
| 91865 | + if( pIdx->nKeyCol>nExpr |
| 91866 | + ||(pIdx->nColumn>nExpr && !IsUniqueIndex(pIdx)) |
| 91867 | + ){ |
| 91868 | + continue; /* This index is not unique over the IN RHS columns */ |
| 91869 | + } |
| 91870 | + } |
| 91871 | + |
| 91872 | + colUsed = 0; /* Columns of index used so far */ |
| 91873 | + for(i=0; i<nExpr; i++){ |
| 91874 | + Expr *pLhs = sqlite3VectorFieldSubexpr(pX->pLeft, i); |
| 91875 | + Expr *pRhs = pEList->a[i].pExpr; |
| 91876 | + CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); |
| 91877 | + int j; |
| 91878 | + |
| 91879 | + assert( pReq!=0 || pRhs->iColumn==XN_ROWID || pParse->nErr ); |
| 91880 | + for(j=0; j<nExpr; j++){ |
| 91881 | + if( pIdx->aiColumn[j]!=pRhs->iColumn ) continue; |
| 91882 | + assert( pIdx->azColl[j] ); |
| 91883 | + if( pReq!=0 && sqlite3StrICmp(pReq->zName, pIdx->azColl[j])!=0 ){ |
| 91884 | + continue; |
| 91885 | + } |
| 91886 | + break; |
| 91887 | + } |
| 91888 | + if( j==nExpr ) break; |
| 91889 | + mCol = MASKBIT(j); |
| 91890 | + if( mCol & colUsed ) break; /* Each column used only once */ |
| 91891 | + colUsed |= mCol; |
| 91892 | + if( aiMap ) aiMap[i] = j; |
| 91893 | + } |
| 91894 | + |
| 91895 | + assert( i==nExpr || colUsed!=(MASKBIT(nExpr)-1) ); |
| 91896 | + if( colUsed==(MASKBIT(nExpr)-1) ){ |
| 91897 | + /* If we reach this point, that means the index pIdx is usable */ |
| 91898 | + int iAddr = sqlite3CodeOnce(pParse); VdbeCoverage(v); |
| 91899 | + #ifndef SQLITE_OMIT_EXPLAIN |
| 91900 | + sqlite3VdbeAddOp4(v, OP_Explain, 0, 0, 0, |
| 91901 | + sqlite3MPrintf(db, "USING INDEX %s FOR IN-OPERATOR",pIdx->zName), |
| 91902 | + P4_DYNAMIC); |
| 91903 | + #endif |
| 91904 | + sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb); |
| 91905 | + sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 91906 | + VdbeComment((v, "%s", pIdx->zName)); |
| 91907 | + assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); |
| 91908 | + eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; |
| 91909 | + |
| 91910 | + if( prRhsHasNull ){ |
| 91911 | + *prRhsHasNull = ++pParse->nMem; |
| 91912 | + #ifdef SQLITE_ENABLE_COLUMN_USED_MASK |
| 91913 | + i64 mask = (1<<nExpr)-1; |
| 91914 | + sqlite3VdbeAddOp4Dup8(v, OP_ColumnsUsed, |
| 91915 | + iTab, 0, 0, (u8*)&mask, P4_INT64); |
| 91916 | + #endif |
| 91917 | + if( nExpr==1 ){ |
| 91918 | + sqlite3SetHasNullFlag(v, iTab, *prRhsHasNull); |
| 91919 | + } |
| 91920 | + } |
| 91921 | + sqlite3VdbeJumpHere(v, iAddr); |
| 91922 | + } |
| 91923 | + } /* End loop over indexes */ |
| 91924 | + } /* End if( affinity_ok ) */ |
| 91925 | + } /* End if not an rowid index */ |
| 91926 | + } /* End attempt to optimize using an index */ |
| 91324 | 91927 | |
| 91325 | 91928 | /* If no preexisting index is available for the IN clause |
| 91326 | 91929 | ** and IN_INDEX_NOOP is an allowed reply |
| 91327 | 91930 | ** and the RHS of the IN operator is a list, not a subquery |
| 91328 | 91931 | ** and the RHS is not constant or has two or fewer terms, |
| | @@ -91334,11 +91937,10 @@ |
| 91334 | 91937 | && !ExprHasProperty(pX, EP_xIsSelect) |
| 91335 | 91938 | && (!sqlite3InRhsIsConstant(pX) || pX->x.pList->nExpr<=2) |
| 91336 | 91939 | ){ |
| 91337 | 91940 | eType = IN_INDEX_NOOP; |
| 91338 | 91941 | } |
| 91339 | | - |
| 91340 | 91942 | |
| 91341 | 91943 | if( eType==0 ){ |
| 91342 | 91944 | /* Could not find an existing table or index to use as the RHS b-tree. |
| 91343 | 91945 | ** We will have to generate an ephemeral table to do the job. |
| 91344 | 91946 | */ |
| | @@ -91356,13 +91958,66 @@ |
| 91356 | 91958 | sqlite3CodeSubselect(pParse, pX, rMayHaveNull, eType==IN_INDEX_ROWID); |
| 91357 | 91959 | pParse->nQueryLoop = savedNQueryLoop; |
| 91358 | 91960 | }else{ |
| 91359 | 91961 | pX->iTable = iTab; |
| 91360 | 91962 | } |
| 91963 | + |
| 91964 | + if( aiMap && eType!=IN_INDEX_INDEX_ASC && eType!=IN_INDEX_INDEX_DESC ){ |
| 91965 | + int i, n; |
| 91966 | + n = sqlite3ExprVectorSize(pX->pLeft); |
| 91967 | + for(i=0; i<n; i++) aiMap[i] = i; |
| 91968 | + } |
| 91361 | 91969 | return eType; |
| 91362 | 91970 | } |
| 91363 | 91971 | #endif |
| 91972 | + |
| 91973 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 91974 | +/* |
| 91975 | +** Argument pExpr is an (?, ?...) IN(...) expression. This |
| 91976 | +** function allocates and returns a nul-terminated string containing |
| 91977 | +** the affinities to be used for each column of the comparison. |
| 91978 | +** |
| 91979 | +** It is the responsibility of the caller to ensure that the returned |
| 91980 | +** string is eventually freed using sqlite3DbFree(). |
| 91981 | +*/ |
| 91982 | +static char *exprINAffinity(Parse *pParse, Expr *pExpr){ |
| 91983 | + Expr *pLeft = pExpr->pLeft; |
| 91984 | + int nVal = sqlite3ExprVectorSize(pLeft); |
| 91985 | + Select *pSelect = (pExpr->flags & EP_xIsSelect) ? pExpr->x.pSelect : 0; |
| 91986 | + char *zRet; |
| 91987 | + |
| 91988 | + assert( pExpr->op==TK_IN ); |
| 91989 | + zRet = sqlite3DbMallocZero(pParse->db, nVal+1); |
| 91990 | + if( zRet ){ |
| 91991 | + int i; |
| 91992 | + for(i=0; i<nVal; i++){ |
| 91993 | + Expr *pA = sqlite3VectorFieldSubexpr(pLeft, i); |
| 91994 | + char a = sqlite3ExprAffinity(pA); |
| 91995 | + if( pSelect ){ |
| 91996 | + zRet[i] = sqlite3CompareAffinity(pSelect->pEList->a[i].pExpr, a); |
| 91997 | + }else{ |
| 91998 | + zRet[i] = a; |
| 91999 | + } |
| 92000 | + } |
| 92001 | + zRet[nVal] = '\0'; |
| 92002 | + } |
| 92003 | + return zRet; |
| 92004 | +} |
| 92005 | +#endif |
| 92006 | + |
| 92007 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 92008 | +/* |
| 92009 | +** Load the Parse object passed as the first argument with an error |
| 92010 | +** message of the form: |
| 92011 | +** |
| 92012 | +** "sub-select returns N columns - expected M" |
| 92013 | +*/ |
| 92014 | +SQLITE_PRIVATE void sqlite3SubselectError(Parse *pParse, int nActual, int nExpect){ |
| 92015 | + const char *zFmt = "sub-select returns %d columns - expected %d"; |
| 92016 | + sqlite3ErrorMsg(pParse, zFmt, nActual, nExpect); |
| 92017 | +} |
| 92018 | +#endif |
| 91364 | 92019 | |
| 91365 | 92020 | /* |
| 91366 | 92021 | ** Generate code for scalar subqueries used as a subquery expression, EXISTS, |
| 91367 | 92022 | ** or IN operators. Examples: |
| 91368 | 92023 | ** |
| | @@ -91385,11 +92040,13 @@ |
| 91385 | 92040 | ** All this routine does is initialize the register given by rMayHaveNull |
| 91386 | 92041 | ** to NULL. Calling routines will take care of changing this register |
| 91387 | 92042 | ** value to non-NULL if the RHS is NULL-free. |
| 91388 | 92043 | ** |
| 91389 | 92044 | ** For a SELECT or EXISTS operator, return the register that holds the |
| 91390 | | -** result. For IN operators or if an error occurs, the return value is 0. |
| 92045 | +** result. For a multi-column SELECT, the result is stored in a contiguous |
| 92046 | +** array of registers and the return value is the register of the left-most |
| 92047 | +** result column. Return 0 for IN operators or if an error occurs. |
| 91391 | 92048 | */ |
| 91392 | 92049 | #ifndef SQLITE_OMIT_SUBQUERY |
| 91393 | 92050 | SQLITE_PRIVATE int sqlite3CodeSubselect( |
| 91394 | 92051 | Parse *pParse, /* Parsing context */ |
| 91395 | 92052 | Expr *pExpr, /* The IN, SELECT, or EXISTS operator */ |
| | @@ -91400,12 +92057,12 @@ |
| 91400 | 92057 | int rReg = 0; /* Register storing resulting */ |
| 91401 | 92058 | Vdbe *v = sqlite3GetVdbe(pParse); |
| 91402 | 92059 | if( NEVER(v==0) ) return 0; |
| 91403 | 92060 | sqlite3ExprCachePush(pParse); |
| 91404 | 92061 | |
| 91405 | | - /* This code must be run in its entirety every time it is encountered |
| 91406 | | - ** if any of the following is true: |
| 92062 | + /* The evaluation of the IN/EXISTS/SELECT must be repeated every time it |
| 92063 | + ** is encountered if any of the following is true: |
| 91407 | 92064 | ** |
| 91408 | 92065 | ** * The right-hand side is a correlated subquery |
| 91409 | 92066 | ** * The right-hand side is an expression list containing variables |
| 91410 | 92067 | ** * We are inside a trigger |
| 91411 | 92068 | ** |
| | @@ -91427,21 +92084,22 @@ |
| 91427 | 92084 | } |
| 91428 | 92085 | #endif |
| 91429 | 92086 | |
| 91430 | 92087 | switch( pExpr->op ){ |
| 91431 | 92088 | case TK_IN: { |
| 91432 | | - char affinity; /* Affinity of the LHS of the IN */ |
| 91433 | 92089 | int addr; /* Address of OP_OpenEphemeral instruction */ |
| 91434 | 92090 | Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ |
| 91435 | 92091 | KeyInfo *pKeyInfo = 0; /* Key information */ |
| 91436 | | - |
| 91437 | | - affinity = sqlite3ExprAffinity(pLeft); |
| 92092 | + int nVal; /* Size of vector pLeft */ |
| 92093 | + |
| 92094 | + nVal = sqlite3ExprVectorSize(pLeft); |
| 92095 | + assert( !isRowid || nVal==1 ); |
| 91438 | 92096 | |
| 91439 | 92097 | /* Whether this is an 'x IN(SELECT...)' or an 'x IN(<exprlist>)' |
| 91440 | 92098 | ** expression it is handled the same way. An ephemeral table is |
| 91441 | | - ** filled with single-field index keys representing the results |
| 91442 | | - ** from the SELECT or the <exprlist>. |
| 92099 | + ** filled with index keys representing the results from the |
| 92100 | + ** SELECT or the <exprlist>. |
| 91443 | 92101 | ** |
| 91444 | 92102 | ** If the 'x' expression is a column value, or the SELECT... |
| 91445 | 92103 | ** statement returns a column value, then the affinity of that |
| 91446 | 92104 | ** column is used to build the index keys. If both 'x' and the |
| 91447 | 92105 | ** SELECT... statement are columns, then numeric affinity is used |
| | @@ -91448,54 +92106,67 @@ |
| 91448 | 92106 | ** if either column has NUMERIC or INTEGER affinity. If neither |
| 91449 | 92107 | ** 'x' nor the SELECT... statement are columns, then numeric affinity |
| 91450 | 92108 | ** is used. |
| 91451 | 92109 | */ |
| 91452 | 92110 | pExpr->iTable = pParse->nTab++; |
| 91453 | | - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid); |
| 91454 | | - pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, 1, 1); |
| 92111 | + addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, |
| 92112 | + pExpr->iTable, (isRowid?0:nVal)); |
| 92113 | + pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, nVal, 1); |
| 91455 | 92114 | |
| 91456 | 92115 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 91457 | 92116 | /* Case 1: expr IN (SELECT ...) |
| 91458 | 92117 | ** |
| 91459 | 92118 | ** Generate code to write the results of the select into the temporary |
| 91460 | 92119 | ** table allocated and opened above. |
| 91461 | 92120 | */ |
| 91462 | 92121 | Select *pSelect = pExpr->x.pSelect; |
| 91463 | | - SelectDest dest; |
| 91464 | | - ExprList *pEList; |
| 92122 | + ExprList *pEList = pSelect->pEList; |
| 91465 | 92123 | |
| 91466 | 92124 | assert( !isRowid ); |
| 91467 | | - sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); |
| 91468 | | - dest.affSdst = (u8)affinity; |
| 91469 | | - assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); |
| 91470 | | - pSelect->iLimit = 0; |
| 91471 | | - testcase( pSelect->selFlags & SF_Distinct ); |
| 91472 | | - testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */ |
| 91473 | | - if( sqlite3Select(pParse, pSelect, &dest) ){ |
| 91474 | | - sqlite3KeyInfoUnref(pKeyInfo); |
| 91475 | | - return 0; |
| 91476 | | - } |
| 91477 | | - pEList = pSelect->pEList; |
| 91478 | | - assert( pKeyInfo!=0 ); /* OOM will cause exit after sqlite3Select() */ |
| 91479 | | - assert( pEList!=0 ); |
| 91480 | | - assert( pEList->nExpr>0 ); |
| 91481 | | - assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); |
| 91482 | | - pKeyInfo->aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, |
| 91483 | | - pEList->a[0].pExpr); |
| 92125 | + /* If the LHS and RHS of the IN operator do not match, that |
| 92126 | + ** error will have been caught long before we reach this point. */ |
| 92127 | + if( ALWAYS(pEList->nExpr==nVal) ){ |
| 92128 | + SelectDest dest; |
| 92129 | + int i; |
| 92130 | + sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); |
| 92131 | + dest.zAffSdst = exprINAffinity(pParse, pExpr); |
| 92132 | + assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); |
| 92133 | + pSelect->iLimit = 0; |
| 92134 | + testcase( pSelect->selFlags & SF_Distinct ); |
| 92135 | + testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */ |
| 92136 | + if( sqlite3Select(pParse, pSelect, &dest) ){ |
| 92137 | + sqlite3DbFree(pParse->db, dest.zAffSdst); |
| 92138 | + sqlite3KeyInfoUnref(pKeyInfo); |
| 92139 | + return 0; |
| 92140 | + } |
| 92141 | + sqlite3DbFree(pParse->db, dest.zAffSdst); |
| 92142 | + assert( pKeyInfo!=0 ); /* OOM will cause exit after sqlite3Select() */ |
| 92143 | + assert( pEList!=0 ); |
| 92144 | + assert( pEList->nExpr>0 ); |
| 92145 | + assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); |
| 92146 | + for(i=0; i<nVal; i++){ |
| 92147 | + Expr *p = sqlite3VectorFieldSubexpr(pLeft, i); |
| 92148 | + pKeyInfo->aColl[i] = sqlite3BinaryCompareCollSeq( |
| 92149 | + pParse, p, pEList->a[i].pExpr |
| 92150 | + ); |
| 92151 | + } |
| 92152 | + } |
| 91484 | 92153 | }else if( ALWAYS(pExpr->x.pList!=0) ){ |
| 91485 | 92154 | /* Case 2: expr IN (exprlist) |
| 91486 | 92155 | ** |
| 91487 | 92156 | ** For each expression, build an index key from the evaluation and |
| 91488 | 92157 | ** store it in the temporary table. If <expr> is a column, then use |
| 91489 | 92158 | ** that columns affinity when building index keys. If <expr> is not |
| 91490 | 92159 | ** a column, use numeric affinity. |
| 91491 | 92160 | */ |
| 92161 | + char affinity; /* Affinity of the LHS of the IN */ |
| 91492 | 92162 | int i; |
| 91493 | 92163 | ExprList *pList = pExpr->x.pList; |
| 91494 | 92164 | struct ExprList_item *pItem; |
| 91495 | 92165 | int r1, r2, r3; |
| 91496 | 92166 | |
| 92167 | + affinity = sqlite3ExprAffinity(pLeft); |
| 91497 | 92168 | if( !affinity ){ |
| 91498 | 92169 | affinity = SQLITE_AFF_BLOB; |
| 91499 | 92170 | } |
| 91500 | 92171 | if( pKeyInfo ){ |
| 91501 | 92172 | assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); |
| | @@ -91547,30 +92218,41 @@ |
| 91547 | 92218 | } |
| 91548 | 92219 | |
| 91549 | 92220 | case TK_EXISTS: |
| 91550 | 92221 | case TK_SELECT: |
| 91551 | 92222 | default: { |
| 91552 | | - /* If this has to be a scalar SELECT. Generate code to put the |
| 91553 | | - ** value of this select in a memory cell and record the number |
| 91554 | | - ** of the memory cell in iColumn. If this is an EXISTS, write |
| 91555 | | - ** an integer 0 (not exists) or 1 (exists) into a memory cell |
| 91556 | | - ** and record that memory cell in iColumn. |
| 92223 | + /* Case 3: (SELECT ... FROM ...) |
| 92224 | + ** or: EXISTS(SELECT ... FROM ...) |
| 92225 | + ** |
| 92226 | + ** For a SELECT, generate code to put the values for all columns of |
| 92227 | + ** the first row into an array of registers and return the index of |
| 92228 | + ** the first register. |
| 92229 | + ** |
| 92230 | + ** If this is an EXISTS, write an integer 0 (not exists) or 1 (exists) |
| 92231 | + ** into a register and return that register number. |
| 92232 | + ** |
| 92233 | + ** In both cases, the query is augmented with "LIMIT 1". Any |
| 92234 | + ** preexisting limit is discarded in place of the new LIMIT 1. |
| 91557 | 92235 | */ |
| 91558 | 92236 | Select *pSel; /* SELECT statement to encode */ |
| 91559 | | - SelectDest dest; /* How to deal with SELECt result */ |
| 92237 | + SelectDest dest; /* How to deal with SELECT result */ |
| 92238 | + int nReg; /* Registers to allocate */ |
| 91560 | 92239 | |
| 91561 | 92240 | testcase( pExpr->op==TK_EXISTS ); |
| 91562 | 92241 | testcase( pExpr->op==TK_SELECT ); |
| 91563 | 92242 | assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT ); |
| 91564 | | - |
| 91565 | 92243 | assert( ExprHasProperty(pExpr, EP_xIsSelect) ); |
| 92244 | + |
| 91566 | 92245 | pSel = pExpr->x.pSelect; |
| 91567 | | - sqlite3SelectDestInit(&dest, 0, ++pParse->nMem); |
| 92246 | + nReg = pExpr->op==TK_SELECT ? pSel->pEList->nExpr : 1; |
| 92247 | + sqlite3SelectDestInit(&dest, 0, pParse->nMem+1); |
| 92248 | + pParse->nMem += nReg; |
| 91568 | 92249 | if( pExpr->op==TK_SELECT ){ |
| 91569 | 92250 | dest.eDest = SRT_Mem; |
| 91570 | 92251 | dest.iSdst = dest.iSDParm; |
| 91571 | | - sqlite3VdbeAddOp2(v, OP_Null, 0, dest.iSDParm); |
| 92252 | + dest.nSdst = nReg; |
| 92253 | + sqlite3VdbeAddOp3(v, OP_Null, 0, dest.iSDParm, dest.iSDParm+nReg-1); |
| 91572 | 92254 | VdbeComment((v, "Init subquery result")); |
| 91573 | 92255 | }else{ |
| 91574 | 92256 | dest.eDest = SRT_Exists; |
| 91575 | 92257 | sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); |
| 91576 | 92258 | VdbeComment((v, "Init EXISTS result")); |
| | @@ -91599,66 +92281,147 @@ |
| 91599 | 92281 | sqlite3ExprCachePop(pParse); |
| 91600 | 92282 | |
| 91601 | 92283 | return rReg; |
| 91602 | 92284 | } |
| 91603 | 92285 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| 92286 | + |
| 92287 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 92288 | +/* |
| 92289 | +** Expr pIn is an IN(...) expression. This function checks that the |
| 92290 | +** sub-select on the RHS of the IN() operator has the same number of |
| 92291 | +** columns as the vector on the LHS. Or, if the RHS of the IN() is not |
| 92292 | +** a sub-query, that the LHS is a vector of size 1. |
| 92293 | +*/ |
| 92294 | +SQLITE_PRIVATE int sqlite3ExprCheckIN(Parse *pParse, Expr *pIn){ |
| 92295 | + int nVector = sqlite3ExprVectorSize(pIn->pLeft); |
| 92296 | + if( (pIn->flags & EP_xIsSelect) ){ |
| 92297 | + if( nVector!=pIn->x.pSelect->pEList->nExpr ){ |
| 92298 | + sqlite3SubselectError(pParse, pIn->x.pSelect->pEList->nExpr, nVector); |
| 92299 | + return 1; |
| 92300 | + } |
| 92301 | + }else if( nVector!=1 ){ |
| 92302 | + if( (pIn->pLeft->flags & EP_xIsSelect) ){ |
| 92303 | + sqlite3SubselectError(pParse, nVector, 1); |
| 92304 | + }else{ |
| 92305 | + sqlite3ErrorMsg(pParse, "row value misused"); |
| 92306 | + } |
| 92307 | + return 1; |
| 92308 | + } |
| 92309 | + return 0; |
| 92310 | +} |
| 92311 | +#endif |
| 91604 | 92312 | |
| 91605 | 92313 | #ifndef SQLITE_OMIT_SUBQUERY |
| 91606 | 92314 | /* |
| 91607 | 92315 | ** Generate code for an IN expression. |
| 91608 | 92316 | ** |
| 91609 | 92317 | ** x IN (SELECT ...) |
| 91610 | 92318 | ** x IN (value, value, ...) |
| 91611 | 92319 | ** |
| 91612 | | -** The left-hand side (LHS) is a scalar expression. The right-hand side (RHS) |
| 91613 | | -** is an array of zero or more values. The expression is true if the LHS is |
| 91614 | | -** contained within the RHS. The value of the expression is unknown (NULL) |
| 91615 | | -** if the LHS is NULL or if the LHS is not contained within the RHS and the |
| 91616 | | -** RHS contains one or more NULL values. |
| 92320 | +** The left-hand side (LHS) is a scalar or vector expression. The |
| 92321 | +** right-hand side (RHS) is an array of zero or more scalar values, or a |
| 92322 | +** subquery. If the RHS is a subquery, the number of result columns must |
| 92323 | +** match the number of columns in the vector on the LHS. If the RHS is |
| 92324 | +** a list of values, the LHS must be a scalar. |
| 92325 | +** |
| 92326 | +** The IN operator is true if the LHS value is contained within the RHS. |
| 92327 | +** The result is false if the LHS is definitely not in the RHS. The |
| 92328 | +** result is NULL if the presence of the LHS in the RHS cannot be |
| 92329 | +** determined due to NULLs. |
| 91617 | 92330 | ** |
| 91618 | 92331 | ** This routine generates code that jumps to destIfFalse if the LHS is not |
| 91619 | 92332 | ** contained within the RHS. If due to NULLs we cannot determine if the LHS |
| 91620 | 92333 | ** is contained in the RHS then jump to destIfNull. If the LHS is contained |
| 91621 | 92334 | ** within the RHS then fall through. |
| 92335 | +** |
| 92336 | +** See the separate in-operator.md documentation file in the canonical |
| 92337 | +** SQLite source tree for additional information. |
| 91622 | 92338 | */ |
| 91623 | 92339 | static void sqlite3ExprCodeIN( |
| 91624 | 92340 | Parse *pParse, /* Parsing and code generating context */ |
| 91625 | 92341 | Expr *pExpr, /* The IN expression */ |
| 91626 | 92342 | int destIfFalse, /* Jump here if LHS is not contained in the RHS */ |
| 91627 | 92343 | int destIfNull /* Jump here if the results are unknown due to NULLs */ |
| 91628 | 92344 | ){ |
| 91629 | 92345 | int rRhsHasNull = 0; /* Register that is true if RHS contains NULL values */ |
| 91630 | | - char affinity; /* Comparison affinity to use */ |
| 91631 | 92346 | int eType; /* Type of the RHS */ |
| 91632 | | - int r1; /* Temporary use register */ |
| 92347 | + int rLhs; /* Register(s) holding the LHS values */ |
| 92348 | + int rLhsOrig; /* LHS values prior to reordering by aiMap[] */ |
| 91633 | 92349 | Vdbe *v; /* Statement under construction */ |
| 92350 | + int *aiMap = 0; /* Map from vector field to index column */ |
| 92351 | + char *zAff = 0; /* Affinity string for comparisons */ |
| 92352 | + int nVector; /* Size of vectors for this IN operator */ |
| 92353 | + int iDummy; /* Dummy parameter to exprCodeVector() */ |
| 92354 | + Expr *pLeft; /* The LHS of the IN operator */ |
| 92355 | + int i; /* loop counter */ |
| 92356 | + int destStep2; /* Where to jump when NULLs seen in step 2 */ |
| 92357 | + int destStep6 = 0; /* Start of code for Step 6 */ |
| 92358 | + int addrTruthOp; /* Address of opcode that determines the IN is true */ |
| 92359 | + int destNotNull; /* Jump here if a comparison is not true in step 6 */ |
| 92360 | + int addrTop; /* Top of the step-6 loop */ |
| 91634 | 92361 | |
| 91635 | | - /* Compute the RHS. After this step, the table with cursor |
| 91636 | | - ** pExpr->iTable will contains the values that make up the RHS. |
| 91637 | | - */ |
| 92362 | + pLeft = pExpr->pLeft; |
| 92363 | + if( sqlite3ExprCheckIN(pParse, pExpr) ) return; |
| 92364 | + zAff = exprINAffinity(pParse, pExpr); |
| 92365 | + nVector = sqlite3ExprVectorSize(pExpr->pLeft); |
| 92366 | + aiMap = (int*)sqlite3DbMallocZero( |
| 92367 | + pParse->db, nVector*(sizeof(int) + sizeof(char)) + 1 |
| 92368 | + ); |
| 92369 | + if( pParse->db->mallocFailed ) goto sqlite3ExprCodeIN_oom_error; |
| 92370 | + |
| 92371 | + /* Attempt to compute the RHS. After this step, if anything other than |
| 92372 | + ** IN_INDEX_NOOP is returned, the table opened ith cursor pExpr->iTable |
| 92373 | + ** contains the values that make up the RHS. If IN_INDEX_NOOP is returned, |
| 92374 | + ** the RHS has not yet been coded. */ |
| 91638 | 92375 | v = pParse->pVdbe; |
| 91639 | 92376 | assert( v!=0 ); /* OOM detected prior to this routine */ |
| 91640 | 92377 | VdbeNoopComment((v, "begin IN expr")); |
| 91641 | 92378 | eType = sqlite3FindInIndex(pParse, pExpr, |
| 91642 | 92379 | IN_INDEX_MEMBERSHIP | IN_INDEX_NOOP_OK, |
| 91643 | | - destIfFalse==destIfNull ? 0 : &rRhsHasNull); |
| 91644 | | - |
| 91645 | | - /* Figure out the affinity to use to create a key from the results |
| 91646 | | - ** of the expression. affinityStr stores a static string suitable for |
| 91647 | | - ** P4 of OP_MakeRecord. |
| 91648 | | - */ |
| 91649 | | - affinity = comparisonAffinity(pExpr); |
| 91650 | | - |
| 91651 | | - /* Code the LHS, the <expr> from "<expr> IN (...)". |
| 92380 | + destIfFalse==destIfNull ? 0 : &rRhsHasNull, aiMap); |
| 92381 | + |
| 92382 | + assert( pParse->nErr || nVector==1 || eType==IN_INDEX_EPH |
| 92383 | + || eType==IN_INDEX_INDEX_ASC || eType==IN_INDEX_INDEX_DESC |
| 92384 | + ); |
| 92385 | +#ifdef SQLITE_DEBUG |
| 92386 | + /* Confirm that aiMap[] contains nVector integer values between 0 and |
| 92387 | + ** nVector-1. */ |
| 92388 | + for(i=0; i<nVector; i++){ |
| 92389 | + int j, cnt; |
| 92390 | + for(cnt=j=0; j<nVector; j++) if( aiMap[j]==i ) cnt++; |
| 92391 | + assert( cnt==1 ); |
| 92392 | + } |
| 92393 | +#endif |
| 92394 | + |
| 92395 | + /* Code the LHS, the <expr> from "<expr> IN (...)". If the LHS is a |
| 92396 | + ** vector, then it is stored in an array of nVector registers starting |
| 92397 | + ** at r1. |
| 92398 | + ** |
| 92399 | + ** sqlite3FindInIndex() might have reordered the fields of the LHS vector |
| 92400 | + ** so that the fields are in the same order as an existing index. The |
| 92401 | + ** aiMap[] array contains a mapping from the original LHS field order to |
| 92402 | + ** the field order that matches the RHS index. |
| 91652 | 92403 | */ |
| 91653 | 92404 | sqlite3ExprCachePush(pParse); |
| 91654 | | - r1 = sqlite3GetTempReg(pParse); |
| 91655 | | - sqlite3ExprCode(pParse, pExpr->pLeft, r1); |
| 92405 | + rLhsOrig = exprCodeVector(pParse, pLeft, &iDummy); |
| 92406 | + for(i=0; i<nVector && aiMap[i]==i; i++){} /* Are LHS fields reordered? */ |
| 92407 | + if( i==nVector ){ |
| 92408 | + /* LHS fields are not reordered */ |
| 92409 | + rLhs = rLhsOrig; |
| 92410 | + }else{ |
| 92411 | + /* Need to reorder the LHS fields according to aiMap */ |
| 92412 | + rLhs = sqlite3GetTempRange(pParse, nVector); |
| 92413 | + for(i=0; i<nVector; i++){ |
| 92414 | + sqlite3VdbeAddOp3(v, OP_Copy, rLhsOrig+i, rLhs+aiMap[i], 0); |
| 92415 | + } |
| 92416 | + } |
| 91656 | 92417 | |
| 91657 | 92418 | /* If sqlite3FindInIndex() did not find or create an index that is |
| 91658 | 92419 | ** suitable for evaluating the IN operator, then evaluate using a |
| 91659 | 92420 | ** sequence of comparisons. |
| 92421 | + ** |
| 92422 | + ** This is step (1) in the in-operator.md optimized algorithm. |
| 91660 | 92423 | */ |
| 91661 | 92424 | if( eType==IN_INDEX_NOOP ){ |
| 91662 | 92425 | ExprList *pList = pExpr->x.pList; |
| 91663 | 92426 | CollSeq *pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft); |
| 91664 | 92427 | int labelOk = sqlite3VdbeMakeLabel(v); |
| | @@ -91666,108 +92429,144 @@ |
| 91666 | 92429 | int regCkNull = 0; |
| 91667 | 92430 | int ii; |
| 91668 | 92431 | assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); |
| 91669 | 92432 | if( destIfNull!=destIfFalse ){ |
| 91670 | 92433 | regCkNull = sqlite3GetTempReg(pParse); |
| 91671 | | - sqlite3VdbeAddOp3(v, OP_BitAnd, r1, r1, regCkNull); |
| 92434 | + sqlite3VdbeAddOp3(v, OP_BitAnd, rLhs, rLhs, regCkNull); |
| 91672 | 92435 | } |
| 91673 | 92436 | for(ii=0; ii<pList->nExpr; ii++){ |
| 91674 | 92437 | r2 = sqlite3ExprCodeTemp(pParse, pList->a[ii].pExpr, ®ToFree); |
| 91675 | 92438 | if( regCkNull && sqlite3ExprCanBeNull(pList->a[ii].pExpr) ){ |
| 91676 | 92439 | sqlite3VdbeAddOp3(v, OP_BitAnd, regCkNull, r2, regCkNull); |
| 91677 | 92440 | } |
| 91678 | 92441 | if( ii<pList->nExpr-1 || destIfNull!=destIfFalse ){ |
| 91679 | | - sqlite3VdbeAddOp4(v, OP_Eq, r1, labelOk, r2, |
| 92442 | + sqlite3VdbeAddOp4(v, OP_Eq, rLhs, labelOk, r2, |
| 91680 | 92443 | (void*)pColl, P4_COLLSEQ); |
| 91681 | 92444 | VdbeCoverageIf(v, ii<pList->nExpr-1); |
| 91682 | 92445 | VdbeCoverageIf(v, ii==pList->nExpr-1); |
| 91683 | | - sqlite3VdbeChangeP5(v, affinity); |
| 92446 | + sqlite3VdbeChangeP5(v, zAff[0]); |
| 91684 | 92447 | }else{ |
| 91685 | 92448 | assert( destIfNull==destIfFalse ); |
| 91686 | | - sqlite3VdbeAddOp4(v, OP_Ne, r1, destIfFalse, r2, |
| 92449 | + sqlite3VdbeAddOp4(v, OP_Ne, rLhs, destIfFalse, r2, |
| 91687 | 92450 | (void*)pColl, P4_COLLSEQ); VdbeCoverage(v); |
| 91688 | | - sqlite3VdbeChangeP5(v, affinity | SQLITE_JUMPIFNULL); |
| 92451 | + sqlite3VdbeChangeP5(v, zAff[0] | SQLITE_JUMPIFNULL); |
| 91689 | 92452 | } |
| 91690 | 92453 | sqlite3ReleaseTempReg(pParse, regToFree); |
| 91691 | 92454 | } |
| 91692 | 92455 | if( regCkNull ){ |
| 91693 | 92456 | sqlite3VdbeAddOp2(v, OP_IsNull, regCkNull, destIfNull); VdbeCoverage(v); |
| 91694 | 92457 | sqlite3VdbeGoto(v, destIfFalse); |
| 91695 | 92458 | } |
| 91696 | 92459 | sqlite3VdbeResolveLabel(v, labelOk); |
| 91697 | 92460 | sqlite3ReleaseTempReg(pParse, regCkNull); |
| 91698 | | - }else{ |
| 91699 | | - |
| 91700 | | - /* If the LHS is NULL, then the result is either false or NULL depending |
| 91701 | | - ** on whether the RHS is empty or not, respectively. |
| 91702 | | - */ |
| 91703 | | - if( sqlite3ExprCanBeNull(pExpr->pLeft) ){ |
| 91704 | | - if( destIfNull==destIfFalse ){ |
| 91705 | | - /* Shortcut for the common case where the false and NULL outcomes are |
| 91706 | | - ** the same. */ |
| 91707 | | - sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull); VdbeCoverage(v); |
| 91708 | | - }else{ |
| 91709 | | - int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1); VdbeCoverage(v); |
| 91710 | | - sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse); |
| 91711 | | - VdbeCoverage(v); |
| 91712 | | - sqlite3VdbeGoto(v, destIfNull); |
| 91713 | | - sqlite3VdbeJumpHere(v, addr1); |
| 91714 | | - } |
| 91715 | | - } |
| 91716 | | - |
| 91717 | | - if( eType==IN_INDEX_ROWID ){ |
| 91718 | | - /* In this case, the RHS is the ROWID of table b-tree |
| 91719 | | - */ |
| 91720 | | - sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, r1); |
| 91721 | | - VdbeCoverage(v); |
| 91722 | | - }else{ |
| 91723 | | - /* In this case, the RHS is an index b-tree. |
| 91724 | | - */ |
| 91725 | | - sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1); |
| 91726 | | - |
| 91727 | | - /* If the set membership test fails, then the result of the |
| 91728 | | - ** "x IN (...)" expression must be either 0 or NULL. If the set |
| 91729 | | - ** contains no NULL values, then the result is 0. If the set |
| 91730 | | - ** contains one or more NULL values, then the result of the |
| 91731 | | - ** expression is also NULL. |
| 91732 | | - */ |
| 91733 | | - assert( destIfFalse!=destIfNull || rRhsHasNull==0 ); |
| 91734 | | - if( rRhsHasNull==0 ){ |
| 91735 | | - /* This branch runs if it is known at compile time that the RHS |
| 91736 | | - ** cannot contain NULL values. This happens as the result |
| 91737 | | - ** of a "NOT NULL" constraint in the database schema. |
| 91738 | | - ** |
| 91739 | | - ** Also run this branch if NULL is equivalent to FALSE |
| 91740 | | - ** for this particular IN operator. |
| 91741 | | - */ |
| 91742 | | - sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse, r1, 1); |
| 91743 | | - VdbeCoverage(v); |
| 91744 | | - }else{ |
| 91745 | | - /* In this branch, the RHS of the IN might contain a NULL and |
| 91746 | | - ** the presence of a NULL on the RHS makes a difference in the |
| 91747 | | - ** outcome. |
| 91748 | | - */ |
| 91749 | | - int addr1; |
| 91750 | | - |
| 91751 | | - /* First check to see if the LHS is contained in the RHS. If so, |
| 91752 | | - ** then the answer is TRUE the presence of NULLs in the RHS does |
| 91753 | | - ** not matter. If the LHS is not contained in the RHS, then the |
| 91754 | | - ** answer is NULL if the RHS contains NULLs and the answer is |
| 91755 | | - ** FALSE if the RHS is NULL-free. |
| 91756 | | - */ |
| 91757 | | - addr1 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, r1, 1); |
| 91758 | | - VdbeCoverage(v); |
| 91759 | | - sqlite3VdbeAddOp2(v, OP_IsNull, rRhsHasNull, destIfNull); |
| 91760 | | - VdbeCoverage(v); |
| 91761 | | - sqlite3VdbeGoto(v, destIfFalse); |
| 91762 | | - sqlite3VdbeJumpHere(v, addr1); |
| 91763 | | - } |
| 91764 | | - } |
| 91765 | | - } |
| 91766 | | - sqlite3ReleaseTempReg(pParse, r1); |
| 92461 | + goto sqlite3ExprCodeIN_finished; |
| 92462 | + } |
| 92463 | + |
| 92464 | + /* Step 2: Check to see if the LHS contains any NULL columns. If the |
| 92465 | + ** LHS does contain NULLs then the result must be either FALSE or NULL. |
| 92466 | + ** We will then skip the binary search of the RHS. |
| 92467 | + */ |
| 92468 | + if( destIfNull==destIfFalse ){ |
| 92469 | + destStep2 = destIfFalse; |
| 92470 | + }else{ |
| 92471 | + destStep2 = destStep6 = sqlite3VdbeMakeLabel(v); |
| 92472 | + } |
| 92473 | + for(i=0; i<nVector; i++){ |
| 92474 | + Expr *p = sqlite3VectorFieldSubexpr(pExpr->pLeft, i); |
| 92475 | + if( sqlite3ExprCanBeNull(p) ){ |
| 92476 | + sqlite3VdbeAddOp2(v, OP_IsNull, rLhs+i, destStep2); |
| 92477 | + VdbeCoverage(v); |
| 92478 | + } |
| 92479 | + } |
| 92480 | + |
| 92481 | + /* Step 3. The LHS is now known to be non-NULL. Do the binary search |
| 92482 | + ** of the RHS using the LHS as a probe. If found, the result is |
| 92483 | + ** true. |
| 92484 | + */ |
| 92485 | + if( eType==IN_INDEX_ROWID ){ |
| 92486 | + /* In this case, the RHS is the ROWID of table b-tree and so we also |
| 92487 | + ** know that the RHS is non-NULL. Hence, we combine steps 3 and 4 |
| 92488 | + ** into a single opcode. */ |
| 92489 | + sqlite3VdbeAddOp3(v, OP_SeekRowid, pExpr->iTable, destIfFalse, rLhs); |
| 92490 | + VdbeCoverage(v); |
| 92491 | + addrTruthOp = sqlite3VdbeAddOp0(v, OP_Goto); /* Return True */ |
| 92492 | + }else{ |
| 92493 | + sqlite3VdbeAddOp4(v, OP_Affinity, rLhs, nVector, 0, zAff, nVector); |
| 92494 | + if( destIfFalse==destIfNull ){ |
| 92495 | + /* Combine Step 3 and Step 5 into a single opcode */ |
| 92496 | + sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse, |
| 92497 | + rLhs, nVector); VdbeCoverage(v); |
| 92498 | + goto sqlite3ExprCodeIN_finished; |
| 92499 | + } |
| 92500 | + /* Ordinary Step 3, for the case where FALSE and NULL are distinct */ |
| 92501 | + addrTruthOp = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, |
| 92502 | + rLhs, nVector); VdbeCoverage(v); |
| 92503 | + } |
| 92504 | + |
| 92505 | + /* Step 4. If the RHS is known to be non-NULL and we did not find |
| 92506 | + ** an match on the search above, then the result must be FALSE. |
| 92507 | + */ |
| 92508 | + if( rRhsHasNull && nVector==1 ){ |
| 92509 | + sqlite3VdbeAddOp2(v, OP_NotNull, rRhsHasNull, destIfFalse); |
| 92510 | + VdbeCoverage(v); |
| 92511 | + } |
| 92512 | + |
| 92513 | + /* Step 5. If we do not care about the difference between NULL and |
| 92514 | + ** FALSE, then just return false. |
| 92515 | + */ |
| 92516 | + if( destIfFalse==destIfNull ) sqlite3VdbeGoto(v, destIfFalse); |
| 92517 | + |
| 92518 | + /* Step 6: Loop through rows of the RHS. Compare each row to the LHS. |
| 92519 | + ** If any comparison is NULL, then the result is NULL. If all |
| 92520 | + ** comparisons are FALSE then the final result is FALSE. |
| 92521 | + ** |
| 92522 | + ** For a scalar LHS, it is sufficient to check just the first row |
| 92523 | + ** of the RHS. |
| 92524 | + */ |
| 92525 | + if( destStep6 ) sqlite3VdbeResolveLabel(v, destStep6); |
| 92526 | + addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse); |
| 92527 | + VdbeCoverage(v); |
| 92528 | + if( nVector>1 ){ |
| 92529 | + destNotNull = sqlite3VdbeMakeLabel(v); |
| 92530 | + }else{ |
| 92531 | + /* For nVector==1, combine steps 6 and 7 by immediately returning |
| 92532 | + ** FALSE if the first comparison is not NULL */ |
| 92533 | + destNotNull = destIfFalse; |
| 92534 | + } |
| 92535 | + for(i=0; i<nVector; i++){ |
| 92536 | + Expr *p; |
| 92537 | + CollSeq *pColl; |
| 92538 | + int r3 = sqlite3GetTempReg(pParse); |
| 92539 | + p = sqlite3VectorFieldSubexpr(pLeft, i); |
| 92540 | + pColl = sqlite3ExprCollSeq(pParse, p); |
| 92541 | + sqlite3VdbeAddOp3(v, OP_Column, pExpr->iTable, i, r3); |
| 92542 | + sqlite3VdbeAddOp4(v, OP_Ne, rLhs+i, destNotNull, r3, |
| 92543 | + (void*)pColl, P4_COLLSEQ); |
| 92544 | + VdbeCoverage(v); |
| 92545 | + sqlite3ReleaseTempReg(pParse, r3); |
| 92546 | + } |
| 92547 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull); |
| 92548 | + if( nVector>1 ){ |
| 92549 | + sqlite3VdbeResolveLabel(v, destNotNull); |
| 92550 | + sqlite3VdbeAddOp2(v, OP_Next, pExpr->iTable, addrTop+1); |
| 92551 | + VdbeCoverage(v); |
| 92552 | + |
| 92553 | + /* Step 7: If we reach this point, we know that the result must |
| 92554 | + ** be false. */ |
| 92555 | + sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse); |
| 92556 | + } |
| 92557 | + |
| 92558 | + /* Jumps here in order to return true. */ |
| 92559 | + sqlite3VdbeJumpHere(v, addrTruthOp); |
| 92560 | + |
| 92561 | +sqlite3ExprCodeIN_finished: |
| 92562 | + if( rLhs!=rLhsOrig ) sqlite3ReleaseTempReg(pParse, rLhs); |
| 91767 | 92563 | sqlite3ExprCachePop(pParse); |
| 91768 | 92564 | VdbeComment((v, "end IN expr")); |
| 92565 | +sqlite3ExprCodeIN_oom_error: |
| 92566 | + sqlite3DbFree(pParse->db, aiMap); |
| 92567 | + sqlite3DbFree(pParse->db, zAff); |
| 91769 | 92568 | } |
| 91770 | 92569 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| 91771 | 92570 | |
| 91772 | 92571 | #ifndef SQLITE_OMIT_FLOATING_POINT |
| 91773 | 92572 | /* |
| | @@ -92148,18 +92947,52 @@ |
| 92148 | 92947 | } |
| 92149 | 92948 | #endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */ |
| 92150 | 92949 | |
| 92151 | 92950 | |
| 92152 | 92951 | /* |
| 92153 | | -** Convert an expression node to a TK_REGISTER |
| 92952 | +** Convert a scalar expression node to a TK_REGISTER referencing |
| 92953 | +** register iReg. The caller must ensure that iReg already contains |
| 92954 | +** the correct value for the expression. |
| 92154 | 92955 | */ |
| 92155 | 92956 | static void exprToRegister(Expr *p, int iReg){ |
| 92156 | 92957 | p->op2 = p->op; |
| 92157 | 92958 | p->op = TK_REGISTER; |
| 92158 | 92959 | p->iTable = iReg; |
| 92159 | 92960 | ExprClearProperty(p, EP_Skip); |
| 92160 | 92961 | } |
| 92962 | + |
| 92963 | +/* |
| 92964 | +** Evaluate an expression (either a vector or a scalar expression) and store |
| 92965 | +** the result in continguous temporary registers. Return the index of |
| 92966 | +** the first register used to store the result. |
| 92967 | +** |
| 92968 | +** If the returned result register is a temporary scalar, then also write |
| 92969 | +** that register number into *piFreeable. If the returned result register |
| 92970 | +** is not a temporary or if the expression is a vector set *piFreeable |
| 92971 | +** to 0. |
| 92972 | +*/ |
| 92973 | +static int exprCodeVector(Parse *pParse, Expr *p, int *piFreeable){ |
| 92974 | + int iResult; |
| 92975 | + int nResult = sqlite3ExprVectorSize(p); |
| 92976 | + if( nResult==1 ){ |
| 92977 | + iResult = sqlite3ExprCodeTemp(pParse, p, piFreeable); |
| 92978 | + }else{ |
| 92979 | + *piFreeable = 0; |
| 92980 | + if( p->op==TK_SELECT ){ |
| 92981 | + iResult = sqlite3CodeSubselect(pParse, p, 0, 0); |
| 92982 | + }else{ |
| 92983 | + int i; |
| 92984 | + iResult = pParse->nMem+1; |
| 92985 | + pParse->nMem += nResult; |
| 92986 | + for(i=0; i<nResult; i++){ |
| 92987 | + sqlite3ExprCode(pParse, p->x.pList->a[i].pExpr, i+iResult); |
| 92988 | + } |
| 92989 | + } |
| 92990 | + } |
| 92991 | + return iResult; |
| 92992 | +} |
| 92993 | + |
| 92161 | 92994 | |
| 92162 | 92995 | /* |
| 92163 | 92996 | ** Generate code into the current Vdbe to evaluate the given |
| 92164 | 92997 | ** expression. Attempt to store the results in register "target". |
| 92165 | 92998 | ** Return the register where results are stored. |
| | @@ -92174,13 +93007,14 @@ |
| 92174 | 93007 | Vdbe *v = pParse->pVdbe; /* The VM under construction */ |
| 92175 | 93008 | int op; /* The opcode being coded */ |
| 92176 | 93009 | int inReg = target; /* Results stored in register inReg */ |
| 92177 | 93010 | int regFree1 = 0; /* If non-zero free this temporary register */ |
| 92178 | 93011 | int regFree2 = 0; /* If non-zero free this temporary register */ |
| 92179 | | - int r1, r2, r3, r4; /* Various register numbers */ |
| 93012 | + int r1, r2; /* Various register numbers */ |
| 92180 | 93013 | sqlite3 *db = pParse->db; /* The database connection */ |
| 92181 | 93014 | Expr tempX; /* Temporary expression node */ |
| 93015 | + int p5 = 0; |
| 92182 | 93016 | |
| 92183 | 93017 | assert( target>0 && target<=pParse->nMem ); |
| 92184 | 93018 | if( v==0 ){ |
| 92185 | 93019 | assert( pParse->db->mallocFailed ); |
| 92186 | 93020 | return 0; |
| | @@ -92289,43 +93123,38 @@ |
| 92289 | 93123 | testcase( usedAsColumnCache(pParse, inReg, inReg) ); |
| 92290 | 93124 | sqlite3ExprCacheAffinityChange(pParse, inReg, 1); |
| 92291 | 93125 | break; |
| 92292 | 93126 | } |
| 92293 | 93127 | #endif /* SQLITE_OMIT_CAST */ |
| 93128 | + case TK_IS: |
| 93129 | + case TK_ISNOT: |
| 93130 | + op = (op==TK_IS) ? TK_EQ : TK_NE; |
| 93131 | + p5 = SQLITE_NULLEQ; |
| 93132 | + /* fall-through */ |
| 92294 | 93133 | case TK_LT: |
| 92295 | 93134 | case TK_LE: |
| 92296 | 93135 | case TK_GT: |
| 92297 | 93136 | case TK_GE: |
| 92298 | 93137 | case TK_NE: |
| 92299 | 93138 | case TK_EQ: { |
| 92300 | | - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 92301 | | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 92302 | | - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 92303 | | - r1, r2, inReg, SQLITE_STOREP2); |
| 92304 | | - assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 92305 | | - assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 92306 | | - assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 92307 | | - assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 92308 | | - assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); |
| 92309 | | - assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 92310 | | - testcase( regFree1==0 ); |
| 92311 | | - testcase( regFree2==0 ); |
| 92312 | | - break; |
| 92313 | | - } |
| 92314 | | - case TK_IS: |
| 92315 | | - case TK_ISNOT: { |
| 92316 | | - testcase( op==TK_IS ); |
| 92317 | | - testcase( op==TK_ISNOT ); |
| 92318 | | - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 92319 | | - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 92320 | | - op = (op==TK_IS) ? TK_EQ : TK_NE; |
| 92321 | | - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 92322 | | - r1, r2, inReg, SQLITE_STOREP2 | SQLITE_NULLEQ); |
| 92323 | | - VdbeCoverageIf(v, op==TK_EQ); |
| 92324 | | - VdbeCoverageIf(v, op==TK_NE); |
| 92325 | | - testcase( regFree1==0 ); |
| 92326 | | - testcase( regFree2==0 ); |
| 93139 | + Expr *pLeft = pExpr->pLeft; |
| 93140 | + if( sqlite3ExprIsVector(pLeft) ){ |
| 93141 | + codeVectorCompare(pParse, pExpr, target, op, p5); |
| 93142 | + }else{ |
| 93143 | + r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); |
| 93144 | + r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 93145 | + codeCompare(pParse, pLeft, pExpr->pRight, op, |
| 93146 | + r1, r2, inReg, SQLITE_STOREP2 | p5); |
| 93147 | + assert(TK_LT==OP_Lt); testcase(op==OP_Lt); VdbeCoverageIf(v,op==OP_Lt); |
| 93148 | + assert(TK_LE==OP_Le); testcase(op==OP_Le); VdbeCoverageIf(v,op==OP_Le); |
| 93149 | + assert(TK_GT==OP_Gt); testcase(op==OP_Gt); VdbeCoverageIf(v,op==OP_Gt); |
| 93150 | + assert(TK_GE==OP_Ge); testcase(op==OP_Ge); VdbeCoverageIf(v,op==OP_Ge); |
| 93151 | + assert(TK_EQ==OP_Eq); testcase(op==OP_Eq); VdbeCoverageIf(v,op==OP_Eq); |
| 93152 | + assert(TK_NE==OP_Ne); testcase(op==OP_Ne); VdbeCoverageIf(v,op==OP_Ne); |
| 93153 | + testcase( regFree1==0 ); |
| 93154 | + testcase( regFree2==0 ); |
| 93155 | + } |
| 92327 | 93156 | break; |
| 92328 | 93157 | } |
| 92329 | 93158 | case TK_AND: |
| 92330 | 93159 | case TK_OR: |
| 92331 | 93160 | case TK_PLUS: |
| | @@ -92547,13 +93376,25 @@ |
| 92547 | 93376 | break; |
| 92548 | 93377 | } |
| 92549 | 93378 | #ifndef SQLITE_OMIT_SUBQUERY |
| 92550 | 93379 | case TK_EXISTS: |
| 92551 | 93380 | case TK_SELECT: { |
| 93381 | + int nCol; |
| 92552 | 93382 | testcase( op==TK_EXISTS ); |
| 92553 | 93383 | testcase( op==TK_SELECT ); |
| 92554 | | - inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0); |
| 93384 | + if( op==TK_SELECT && (nCol = pExpr->x.pSelect->pEList->nExpr)!=1 ){ |
| 93385 | + sqlite3SubselectError(pParse, nCol, 1); |
| 93386 | + }else{ |
| 93387 | + inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0); |
| 93388 | + } |
| 93389 | + break; |
| 93390 | + } |
| 93391 | + case TK_SELECT_COLUMN: { |
| 93392 | + if( pExpr->pLeft->iTable==0 ){ |
| 93393 | + pExpr->pLeft->iTable = sqlite3CodeSubselect(pParse, pExpr->pLeft, 0, 0); |
| 93394 | + } |
| 93395 | + inReg = pExpr->pLeft->iTable + pExpr->iColumn; |
| 92555 | 93396 | break; |
| 92556 | 93397 | } |
| 92557 | 93398 | case TK_IN: { |
| 92558 | 93399 | int destIfFalse = sqlite3VdbeMakeLabel(v); |
| 92559 | 93400 | int destIfNull = sqlite3VdbeMakeLabel(v); |
| | @@ -92578,32 +93419,11 @@ |
| 92578 | 93419 | ** X is stored in pExpr->pLeft. |
| 92579 | 93420 | ** Y is stored in pExpr->pList->a[0].pExpr. |
| 92580 | 93421 | ** Z is stored in pExpr->pList->a[1].pExpr. |
| 92581 | 93422 | */ |
| 92582 | 93423 | case TK_BETWEEN: { |
| 92583 | | - Expr *pLeft = pExpr->pLeft; |
| 92584 | | - struct ExprList_item *pLItem = pExpr->x.pList->a; |
| 92585 | | - Expr *pRight = pLItem->pExpr; |
| 92586 | | - |
| 92587 | | - r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); |
| 92588 | | - r2 = sqlite3ExprCodeTemp(pParse, pRight, ®Free2); |
| 92589 | | - testcase( regFree1==0 ); |
| 92590 | | - testcase( regFree2==0 ); |
| 92591 | | - r3 = sqlite3GetTempReg(pParse); |
| 92592 | | - r4 = sqlite3GetTempReg(pParse); |
| 92593 | | - codeCompare(pParse, pLeft, pRight, OP_Ge, |
| 92594 | | - r1, r2, r3, SQLITE_STOREP2); VdbeCoverage(v); |
| 92595 | | - pLItem++; |
| 92596 | | - pRight = pLItem->pExpr; |
| 92597 | | - sqlite3ReleaseTempReg(pParse, regFree2); |
| 92598 | | - r2 = sqlite3ExprCodeTemp(pParse, pRight, ®Free2); |
| 92599 | | - testcase( regFree2==0 ); |
| 92600 | | - codeCompare(pParse, pLeft, pRight, OP_Le, r1, r2, r4, SQLITE_STOREP2); |
| 92601 | | - VdbeCoverage(v); |
| 92602 | | - sqlite3VdbeAddOp3(v, OP_And, r3, r4, target); |
| 92603 | | - sqlite3ReleaseTempReg(pParse, r3); |
| 92604 | | - sqlite3ReleaseTempReg(pParse, r4); |
| 93424 | + exprCodeBetween(pParse, pExpr, target, 0, 0); |
| 92605 | 93425 | break; |
| 92606 | 93426 | } |
| 92607 | 93427 | case TK_SPAN: |
| 92608 | 93428 | case TK_COLLATE: |
| 92609 | 93429 | case TK_UPLUS: { |
| | @@ -92665,10 +93485,14 @@ |
| 92665 | 93485 | } |
| 92666 | 93486 | #endif |
| 92667 | 93487 | break; |
| 92668 | 93488 | } |
| 92669 | 93489 | |
| 93490 | + case TK_VECTOR: { |
| 93491 | + sqlite3ErrorMsg(pParse, "row value misused"); |
| 93492 | + break; |
| 93493 | + } |
| 92670 | 93494 | |
| 92671 | 93495 | /* |
| 92672 | 93496 | ** Form A: |
| 92673 | 93497 | ** CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END |
| 92674 | 93498 | ** |
| | @@ -92708,12 +93532,13 @@ |
| 92708 | 93532 | nExpr = pEList->nExpr; |
| 92709 | 93533 | endLabel = sqlite3VdbeMakeLabel(v); |
| 92710 | 93534 | if( (pX = pExpr->pLeft)!=0 ){ |
| 92711 | 93535 | tempX = *pX; |
| 92712 | 93536 | testcase( pX->op==TK_COLUMN ); |
| 92713 | | - exprToRegister(&tempX, sqlite3ExprCodeTemp(pParse, pX, ®Free1)); |
| 93537 | + exprToRegister(&tempX, exprCodeVector(pParse, &tempX, ®Free1)); |
| 92714 | 93538 | testcase( regFree1==0 ); |
| 93539 | + memset(&opCompare, 0, sizeof(opCompare)); |
| 92715 | 93540 | opCompare.op = TK_EQ; |
| 92716 | 93541 | opCompare.pLeft = &tempX; |
| 92717 | 93542 | pTest = &opCompare; |
| 92718 | 93543 | /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: |
| 92719 | 93544 | ** The value in regFree1 might get SCopy-ed into the file result. |
| | @@ -92988,24 +93813,37 @@ |
| 92988 | 93813 | ** |
| 92989 | 93814 | ** x>=y AND x<=z |
| 92990 | 93815 | ** |
| 92991 | 93816 | ** Code it as such, taking care to do the common subexpression |
| 92992 | 93817 | ** elimination of x. |
| 93818 | +** |
| 93819 | +** The xJumpIf parameter determines details: |
| 93820 | +** |
| 93821 | +** NULL: Store the boolean result in reg[dest] |
| 93822 | +** sqlite3ExprIfTrue: Jump to dest if true |
| 93823 | +** sqlite3ExprIfFalse: Jump to dest if false |
| 93824 | +** |
| 93825 | +** The jumpIfNull parameter is ignored if xJumpIf is NULL. |
| 92993 | 93826 | */ |
| 92994 | 93827 | static void exprCodeBetween( |
| 92995 | 93828 | Parse *pParse, /* Parsing and code generating context */ |
| 92996 | 93829 | Expr *pExpr, /* The BETWEEN expression */ |
| 92997 | | - int dest, /* Jump here if the jump is taken */ |
| 92998 | | - int jumpIfTrue, /* Take the jump if the BETWEEN is true */ |
| 93830 | + int dest, /* Jump destination or storage location */ |
| 93831 | + void (*xJump)(Parse*,Expr*,int,int), /* Action to take */ |
| 92999 | 93832 | int jumpIfNull /* Take the jump if the BETWEEN is NULL */ |
| 93000 | 93833 | ){ |
| 93001 | | - Expr exprAnd; /* The AND operator in x>=y AND x<=z */ |
| 93834 | + Expr exprAnd; /* The AND operator in x>=y AND x<=z */ |
| 93002 | 93835 | Expr compLeft; /* The x>=y term */ |
| 93003 | 93836 | Expr compRight; /* The x<=z term */ |
| 93004 | 93837 | Expr exprX; /* The x subexpression */ |
| 93005 | 93838 | int regFree1 = 0; /* Temporary use register */ |
| 93006 | 93839 | |
| 93840 | + |
| 93841 | + memset(&compLeft, 0, sizeof(Expr)); |
| 93842 | + memset(&compRight, 0, sizeof(Expr)); |
| 93843 | + memset(&exprAnd, 0, sizeof(Expr)); |
| 93844 | + |
| 93007 | 93845 | assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); |
| 93008 | 93846 | exprX = *pExpr->pLeft; |
| 93009 | 93847 | exprAnd.op = TK_AND; |
| 93010 | 93848 | exprAnd.pLeft = &compLeft; |
| 93011 | 93849 | exprAnd.pRight = &compRight; |
| | @@ -93013,27 +93851,29 @@ |
| 93013 | 93851 | compLeft.pLeft = &exprX; |
| 93014 | 93852 | compLeft.pRight = pExpr->x.pList->a[0].pExpr; |
| 93015 | 93853 | compRight.op = TK_LE; |
| 93016 | 93854 | compRight.pLeft = &exprX; |
| 93017 | 93855 | compRight.pRight = pExpr->x.pList->a[1].pExpr; |
| 93018 | | - exprToRegister(&exprX, sqlite3ExprCodeTemp(pParse, &exprX, ®Free1)); |
| 93019 | | - if( jumpIfTrue ){ |
| 93020 | | - sqlite3ExprIfTrue(pParse, &exprAnd, dest, jumpIfNull); |
| 93856 | + exprToRegister(&exprX, exprCodeVector(pParse, &exprX, ®Free1)); |
| 93857 | + if( xJump ){ |
| 93858 | + xJump(pParse, &exprAnd, dest, jumpIfNull); |
| 93021 | 93859 | }else{ |
| 93022 | | - sqlite3ExprIfFalse(pParse, &exprAnd, dest, jumpIfNull); |
| 93860 | + exprX.flags |= EP_FromJoin; |
| 93861 | + sqlite3ExprCodeTarget(pParse, &exprAnd, dest); |
| 93023 | 93862 | } |
| 93024 | 93863 | sqlite3ReleaseTempReg(pParse, regFree1); |
| 93025 | 93864 | |
| 93026 | 93865 | /* Ensure adequate test coverage */ |
| 93027 | | - testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1==0 ); |
| 93028 | | - testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1!=0 ); |
| 93029 | | - testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1==0 ); |
| 93030 | | - testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1!=0 ); |
| 93031 | | - testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1==0 ); |
| 93032 | | - testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1!=0 ); |
| 93033 | | - testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1==0 ); |
| 93034 | | - testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1!=0 ); |
| 93866 | + testcase( xJump==sqlite3ExprIfTrue && jumpIfNull==0 && regFree1==0 ); |
| 93867 | + testcase( xJump==sqlite3ExprIfTrue && jumpIfNull==0 && regFree1!=0 ); |
| 93868 | + testcase( xJump==sqlite3ExprIfTrue && jumpIfNull!=0 && regFree1==0 ); |
| 93869 | + testcase( xJump==sqlite3ExprIfTrue && jumpIfNull!=0 && regFree1!=0 ); |
| 93870 | + testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1==0 ); |
| 93871 | + testcase( xJump==sqlite3ExprIfFalse && jumpIfNull==0 && regFree1!=0 ); |
| 93872 | + testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1==0 ); |
| 93873 | + testcase( xJump==sqlite3ExprIfFalse && jumpIfNull!=0 && regFree1!=0 ); |
| 93874 | + testcase( xJump==0 ); |
| 93035 | 93875 | } |
| 93036 | 93876 | |
| 93037 | 93877 | /* |
| 93038 | 93878 | ** Generate code for a boolean expression such that a jump is made |
| 93039 | 93879 | ** to the label "dest" if the expression is true but execution |
| | @@ -93094,10 +93934,11 @@ |
| 93094 | 93934 | case TK_LE: |
| 93095 | 93935 | case TK_GT: |
| 93096 | 93936 | case TK_GE: |
| 93097 | 93937 | case TK_NE: |
| 93098 | 93938 | case TK_EQ: { |
| 93939 | + if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 93099 | 93940 | testcase( jumpIfNull==0 ); |
| 93100 | 93941 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 93101 | 93942 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 93102 | 93943 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 93103 | 93944 | r1, r2, dest, jumpIfNull); |
| | @@ -93126,11 +93967,11 @@ |
| 93126 | 93967 | testcase( regFree1==0 ); |
| 93127 | 93968 | break; |
| 93128 | 93969 | } |
| 93129 | 93970 | case TK_BETWEEN: { |
| 93130 | 93971 | testcase( jumpIfNull==0 ); |
| 93131 | | - exprCodeBetween(pParse, pExpr, dest, 1, jumpIfNull); |
| 93972 | + exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfTrue, jumpIfNull); |
| 93132 | 93973 | break; |
| 93133 | 93974 | } |
| 93134 | 93975 | #ifndef SQLITE_OMIT_SUBQUERY |
| 93135 | 93976 | case TK_IN: { |
| 93136 | 93977 | int destIfFalse = sqlite3VdbeMakeLabel(v); |
| | @@ -93140,10 +93981,11 @@ |
| 93140 | 93981 | sqlite3VdbeResolveLabel(v, destIfFalse); |
| 93141 | 93982 | break; |
| 93142 | 93983 | } |
| 93143 | 93984 | #endif |
| 93144 | 93985 | default: { |
| 93986 | + default_expr: |
| 93145 | 93987 | if( exprAlwaysTrue(pExpr) ){ |
| 93146 | 93988 | sqlite3VdbeGoto(v, dest); |
| 93147 | 93989 | }else if( exprAlwaysFalse(pExpr) ){ |
| 93148 | 93990 | /* No-op */ |
| 93149 | 93991 | }else{ |
| | @@ -93246,10 +94088,11 @@ |
| 93246 | 94088 | case TK_LE: |
| 93247 | 94089 | case TK_GT: |
| 93248 | 94090 | case TK_GE: |
| 93249 | 94091 | case TK_NE: |
| 93250 | 94092 | case TK_EQ: { |
| 94093 | + if( sqlite3ExprIsVector(pExpr->pLeft) ) goto default_expr; |
| 93251 | 94094 | testcase( jumpIfNull==0 ); |
| 93252 | 94095 | r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); |
| 93253 | 94096 | r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); |
| 93254 | 94097 | codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, |
| 93255 | 94098 | r1, r2, dest, jumpIfNull); |
| | @@ -93276,11 +94119,11 @@ |
| 93276 | 94119 | testcase( regFree1==0 ); |
| 93277 | 94120 | break; |
| 93278 | 94121 | } |
| 93279 | 94122 | case TK_BETWEEN: { |
| 93280 | 94123 | testcase( jumpIfNull==0 ); |
| 93281 | | - exprCodeBetween(pParse, pExpr, dest, 0, jumpIfNull); |
| 94124 | + exprCodeBetween(pParse, pExpr, dest, sqlite3ExprIfFalse, jumpIfNull); |
| 93282 | 94125 | break; |
| 93283 | 94126 | } |
| 93284 | 94127 | #ifndef SQLITE_OMIT_SUBQUERY |
| 93285 | 94128 | case TK_IN: { |
| 93286 | 94129 | if( jumpIfNull ){ |
| | @@ -93292,10 +94135,11 @@ |
| 93292 | 94135 | } |
| 93293 | 94136 | break; |
| 93294 | 94137 | } |
| 93295 | 94138 | #endif |
| 93296 | 94139 | default: { |
| 94140 | + default_expr: |
| 93297 | 94141 | if( exprAlwaysFalse(pExpr) ){ |
| 93298 | 94142 | sqlite3VdbeGoto(v, dest); |
| 93299 | 94143 | }else if( exprAlwaysTrue(pExpr) ){ |
| 93300 | 94144 | /* no-op */ |
| 93301 | 94145 | }else{ |
| | @@ -93807,14 +94651,15 @@ |
| 93807 | 94651 | pParse->aTempReg[pParse->nTempReg++] = iReg; |
| 93808 | 94652 | } |
| 93809 | 94653 | } |
| 93810 | 94654 | |
| 93811 | 94655 | /* |
| 93812 | | -** Allocate or deallocate a block of nReg consecutive registers |
| 94656 | +** Allocate or deallocate a block of nReg consecutive registers. |
| 93813 | 94657 | */ |
| 93814 | 94658 | SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){ |
| 93815 | 94659 | int i, n; |
| 94660 | + if( nReg==1 ) return sqlite3GetTempReg(pParse); |
| 93816 | 94661 | i = pParse->iRangeReg; |
| 93817 | 94662 | n = pParse->nRangeReg; |
| 93818 | 94663 | if( nReg<=n ){ |
| 93819 | 94664 | assert( !usedAsColumnCache(pParse, i, i+n-1) ); |
| 93820 | 94665 | pParse->iRangeReg += nReg; |
| | @@ -93824,10 +94669,14 @@ |
| 93824 | 94669 | pParse->nMem += nReg; |
| 93825 | 94670 | } |
| 93826 | 94671 | return i; |
| 93827 | 94672 | } |
| 93828 | 94673 | SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ |
| 94674 | + if( nReg==1 ){ |
| 94675 | + sqlite3ReleaseTempReg(pParse, iReg); |
| 94676 | + return; |
| 94677 | + } |
| 93829 | 94678 | sqlite3ExprCacheRemove(pParse, iReg, nReg); |
| 93830 | 94679 | if( nReg>pParse->nRangeReg ){ |
| 93831 | 94680 | pParse->nRangeReg = nReg; |
| 93832 | 94681 | pParse->iRangeReg = iReg; |
| 93833 | 94682 | } |
| | @@ -97568,12 +98417,12 @@ |
| 97568 | 98417 | |
| 97569 | 98418 | #if SQLITE_USER_AUTHENTICATION |
| 97570 | 98419 | if( pParse->nTableLock>0 && db->init.busy==0 ){ |
| 97571 | 98420 | sqlite3UserAuthInit(db); |
| 97572 | 98421 | if( db->auth.authLevel<UAUTH_User ){ |
| 97573 | | - pParse->rc = SQLITE_AUTH_USER; |
| 97574 | 98422 | sqlite3ErrorMsg(pParse, "user not authenticated"); |
| 98423 | + pParse->rc = SQLITE_AUTH_USER; |
| 97575 | 98424 | return; |
| 97576 | 98425 | } |
| 97577 | 98426 | } |
| 97578 | 98427 | #endif |
| 97579 | 98428 | |
| | @@ -108279,19 +109128,19 @@ |
| 108279 | 109128 | } |
| 108280 | 109129 | if( piIdxCur ) *piIdxCur = iBase; |
| 108281 | 109130 | for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ |
| 108282 | 109131 | int iIdxCur = iBase++; |
| 108283 | 109132 | assert( pIdx->pSchema==pTab->pSchema ); |
| 109133 | + if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ |
| 109134 | + if( piDataCur ) *piDataCur = iIdxCur; |
| 109135 | + p5 = 0; |
| 109136 | + } |
| 108284 | 109137 | if( aToOpen==0 || aToOpen[i+1] ){ |
| 108285 | 109138 | sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb); |
| 108286 | 109139 | sqlite3VdbeSetP4KeyInfo(pParse, pIdx); |
| 108287 | | - VdbeComment((v, "%s", pIdx->zName)); |
| 108288 | | - } |
| 108289 | | - if( IsPrimaryKeyIndex(pIdx) && !HasRowid(pTab) ){ |
| 108290 | | - if( piDataCur ) *piDataCur = iIdxCur; |
| 108291 | | - }else{ |
| 108292 | 109140 | sqlite3VdbeChangeP5(v, p5); |
| 109141 | + VdbeComment((v, "%s", pIdx->zName)); |
| 108293 | 109142 | } |
| 108294 | 109143 | } |
| 108295 | 109144 | if( iBase>pParse->nTab ) pParse->nTab = iBase; |
| 108296 | 109145 | return i; |
| 108297 | 109146 | } |
| | @@ -113611,11 +114460,11 @@ |
| 113611 | 114460 | ** Initialize a SelectDest structure. |
| 113612 | 114461 | */ |
| 113613 | 114462 | SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){ |
| 113614 | 114463 | pDest->eDest = (u8)eDest; |
| 113615 | 114464 | pDest->iSDParm = iParm; |
| 113616 | | - pDest->affSdst = 0; |
| 114465 | + pDest->zAffSdst = 0; |
| 113617 | 114466 | pDest->iSdst = 0; |
| 113618 | 114467 | pDest->nSdst = 0; |
| 113619 | 114468 | } |
| 113620 | 114469 | |
| 113621 | 114470 | |
| | @@ -114182,34 +115031,10 @@ |
| 114182 | 115031 | sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); |
| 114183 | 115032 | sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, r1); |
| 114184 | 115033 | sqlite3ReleaseTempReg(pParse, r1); |
| 114185 | 115034 | } |
| 114186 | 115035 | |
| 114187 | | -#ifndef SQLITE_OMIT_SUBQUERY |
| 114188 | | -/* |
| 114189 | | -** Generate an error message when a SELECT is used within a subexpression |
| 114190 | | -** (example: "a IN (SELECT * FROM table)") but it has more than 1 result |
| 114191 | | -** column. We do this in a subroutine because the error used to occur |
| 114192 | | -** in multiple places. (The error only occurs in one place now, but we |
| 114193 | | -** retain the subroutine to minimize code disruption.) |
| 114194 | | -*/ |
| 114195 | | -static int checkForMultiColumnSelectError( |
| 114196 | | - Parse *pParse, /* Parse context. */ |
| 114197 | | - SelectDest *pDest, /* Destination of SELECT results */ |
| 114198 | | - int nExpr /* Number of result columns returned by SELECT */ |
| 114199 | | -){ |
| 114200 | | - int eDest = pDest->eDest; |
| 114201 | | - if( nExpr>1 && (eDest==SRT_Mem || eDest==SRT_Set) ){ |
| 114202 | | - sqlite3ErrorMsg(pParse, "only a single result allowed for " |
| 114203 | | - "a SELECT that is part of an expression"); |
| 114204 | | - return 1; |
| 114205 | | - }else{ |
| 114206 | | - return 0; |
| 114207 | | - } |
| 114208 | | -} |
| 114209 | | -#endif |
| 114210 | | - |
| 114211 | 115036 | /* |
| 114212 | 115037 | ** This routine generates the code for the inside of the inner loop |
| 114213 | 115038 | ** of a SELECT. |
| 114214 | 115039 | ** |
| 114215 | 115040 | ** If srcTab is negative, then the pEList expressions |
| | @@ -114415,23 +115240,23 @@ |
| 114415 | 115240 | /* If we are creating a set for an "expr IN (SELECT ...)" construct, |
| 114416 | 115241 | ** then there should be a single item on the stack. Write this |
| 114417 | 115242 | ** item into the set table with bogus data. |
| 114418 | 115243 | */ |
| 114419 | 115244 | case SRT_Set: { |
| 114420 | | - assert( nResultCol==1 ); |
| 114421 | | - pDest->affSdst = |
| 114422 | | - sqlite3CompareAffinity(pEList->a[0].pExpr, pDest->affSdst); |
| 114423 | 115245 | if( pSort ){ |
| 114424 | 115246 | /* At first glance you would think we could optimize out the |
| 114425 | 115247 | ** ORDER BY in this case since the order of entries in the set |
| 114426 | 115248 | ** does not matter. But there might be a LIMIT clause, in which |
| 114427 | 115249 | ** case the order does matter */ |
| 114428 | | - pushOntoSorter(pParse, pSort, p, regResult, regResult, 1, nPrefixReg); |
| 115250 | + pushOntoSorter( |
| 115251 | + pParse, pSort, p, regResult, regResult, nResultCol, nPrefixReg); |
| 114429 | 115252 | }else{ |
| 114430 | 115253 | int r1 = sqlite3GetTempReg(pParse); |
| 114431 | | - sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult,1,r1, &pDest->affSdst, 1); |
| 114432 | | - sqlite3ExprCacheAffinityChange(pParse, regResult, 1); |
| 115254 | + assert( sqlite3Strlen30(pDest->zAffSdst)==nResultCol ); |
| 115255 | + sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult, nResultCol, |
| 115256 | + r1, pDest->zAffSdst, nResultCol); |
| 115257 | + sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol); |
| 114433 | 115258 | sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1); |
| 114434 | 115259 | sqlite3ReleaseTempReg(pParse, r1); |
| 114435 | 115260 | } |
| 114436 | 115261 | break; |
| 114437 | 115262 | } |
| | @@ -114443,17 +115268,18 @@ |
| 114443 | 115268 | /* The LIMIT clause will terminate the loop for us */ |
| 114444 | 115269 | break; |
| 114445 | 115270 | } |
| 114446 | 115271 | |
| 114447 | 115272 | /* If this is a scalar select that is part of an expression, then |
| 114448 | | - ** store the results in the appropriate memory cell and break out |
| 114449 | | - ** of the scan loop. |
| 115273 | + ** store the results in the appropriate memory cell or array of |
| 115274 | + ** memory cells and break out of the scan loop. |
| 114450 | 115275 | */ |
| 114451 | 115276 | case SRT_Mem: { |
| 114452 | | - assert( nResultCol==1 ); |
| 115277 | + assert( nResultCol==pDest->nSdst ); |
| 114453 | 115278 | if( pSort ){ |
| 114454 | | - pushOntoSorter(pParse, pSort, p, regResult, regResult, 1, nPrefixReg); |
| 115279 | + pushOntoSorter( |
| 115280 | + pParse, pSort, p, regResult, regResult, nResultCol, nPrefixReg); |
| 114455 | 115281 | }else{ |
| 114456 | 115282 | assert( regResult==iParm ); |
| 114457 | 115283 | /* The LIMIT clause will jump out of the loop for us */ |
| 114458 | 115284 | } |
| 114459 | 115285 | break; |
| | @@ -114764,18 +115590,18 @@ |
| 114764 | 115590 | sqlite3VdbeAddOp2(v, OP_Gosub, pSort->regReturn, pSort->labelBkOut); |
| 114765 | 115591 | sqlite3VdbeGoto(v, addrBreak); |
| 114766 | 115592 | sqlite3VdbeResolveLabel(v, pSort->labelBkOut); |
| 114767 | 115593 | } |
| 114768 | 115594 | iTab = pSort->iECursor; |
| 114769 | | - if( eDest==SRT_Output || eDest==SRT_Coroutine ){ |
| 115595 | + if( eDest==SRT_Output || eDest==SRT_Coroutine || eDest==SRT_Mem ){ |
| 114770 | 115596 | regRowid = 0; |
| 114771 | 115597 | regRow = pDest->iSdst; |
| 114772 | 115598 | nSortData = nColumn; |
| 114773 | 115599 | }else{ |
| 114774 | 115600 | regRowid = sqlite3GetTempReg(pParse); |
| 114775 | | - regRow = sqlite3GetTempReg(pParse); |
| 114776 | | - nSortData = 1; |
| 115601 | + regRow = sqlite3GetTempRange(pParse, nColumn); |
| 115602 | + nSortData = nColumn; |
| 114777 | 115603 | } |
| 114778 | 115604 | nKey = pOrderBy->nExpr - pSort->nOBSat; |
| 114779 | 115605 | if( pSort->sortFlags & SORTFLAG_UseSorter ){ |
| 114780 | 115606 | int regSortOut = ++pParse->nMem; |
| 114781 | 115607 | iSortTab = pParse->nTab++; |
| | @@ -114806,20 +115632,18 @@ |
| 114806 | 115632 | sqlite3VdbeChangeP5(v, OPFLAG_APPEND); |
| 114807 | 115633 | break; |
| 114808 | 115634 | } |
| 114809 | 115635 | #ifndef SQLITE_OMIT_SUBQUERY |
| 114810 | 115636 | case SRT_Set: { |
| 114811 | | - assert( nColumn==1 ); |
| 114812 | | - sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, 1, regRowid, |
| 114813 | | - &pDest->affSdst, 1); |
| 114814 | | - sqlite3ExprCacheAffinityChange(pParse, regRow, 1); |
| 115637 | + assert( nColumn==sqlite3Strlen30(pDest->zAffSdst) ); |
| 115638 | + sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, nColumn, regRowid, |
| 115639 | + pDest->zAffSdst, nColumn); |
| 115640 | + sqlite3ExprCacheAffinityChange(pParse, regRow, nColumn); |
| 114815 | 115641 | sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, regRowid); |
| 114816 | 115642 | break; |
| 114817 | 115643 | } |
| 114818 | 115644 | case SRT_Mem: { |
| 114819 | | - assert( nColumn==1 ); |
| 114820 | | - sqlite3ExprCodeMove(pParse, regRow, iParm, 1); |
| 114821 | 115645 | /* The LIMIT clause will terminate the loop for us */ |
| 114822 | 115646 | break; |
| 114823 | 115647 | } |
| 114824 | 115648 | #endif |
| 114825 | 115649 | default: { |
| | @@ -114834,11 +115658,15 @@ |
| 114834 | 115658 | } |
| 114835 | 115659 | break; |
| 114836 | 115660 | } |
| 114837 | 115661 | } |
| 114838 | 115662 | if( regRowid ){ |
| 114839 | | - sqlite3ReleaseTempReg(pParse, regRow); |
| 115663 | + if( eDest==SRT_Set ){ |
| 115664 | + sqlite3ReleaseTempRange(pParse, regRow, nColumn); |
| 115665 | + }else{ |
| 115666 | + sqlite3ReleaseTempReg(pParse, regRow); |
| 115667 | + } |
| 114840 | 115668 | sqlite3ReleaseTempReg(pParse, regRowid); |
| 114841 | 115669 | } |
| 114842 | 115670 | /* The bottom of the loop |
| 114843 | 115671 | */ |
| 114844 | 115672 | sqlite3VdbeResolveLabel(v, addrContinue); |
| | @@ -115336,11 +116164,11 @@ |
| 115336 | 116164 | ** Get a VDBE for the given parser context. Create a new one if necessary. |
| 115337 | 116165 | ** If an error occurs, return NULL and leave a message in pParse. |
| 115338 | 116166 | */ |
| 115339 | 116167 | static SQLITE_NOINLINE Vdbe *allocVdbe(Parse *pParse){ |
| 115340 | 116168 | Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(pParse); |
| 115341 | | - if( v ) sqlite3VdbeAddOp0(v, OP_Init); |
| 116169 | + if( v ) sqlite3VdbeAddOp2(v, OP_Init, 0, 1); |
| 115342 | 116170 | if( pParse->pToplevel==0 |
| 115343 | 116171 | && OptimizationEnabled(pParse->db,SQLITE_FactorOutConst) |
| 115344 | 116172 | ){ |
| 115345 | 116173 | pParse->okConstFactor = 1; |
| 115346 | 116174 | } |
| | @@ -116175,22 +117003,19 @@ |
| 116175 | 117003 | sqlite3ReleaseTempReg(pParse, r1); |
| 116176 | 117004 | break; |
| 116177 | 117005 | } |
| 116178 | 117006 | |
| 116179 | 117007 | #ifndef SQLITE_OMIT_SUBQUERY |
| 116180 | | - /* If we are creating a set for an "expr IN (SELECT ...)" construct, |
| 116181 | | - ** then there should be a single item on the stack. Write this |
| 116182 | | - ** item into the set table with bogus data. |
| 117008 | + /* If we are creating a set for an "expr IN (SELECT ...)". |
| 116183 | 117009 | */ |
| 116184 | 117010 | case SRT_Set: { |
| 116185 | 117011 | int r1; |
| 116186 | | - assert( pIn->nSdst==1 || pParse->nErr>0 ); |
| 116187 | | - pDest->affSdst = |
| 116188 | | - sqlite3CompareAffinity(p->pEList->a[0].pExpr, pDest->affSdst); |
| 117012 | + testcase( pIn->nSdst>1 ); |
| 116189 | 117013 | r1 = sqlite3GetTempReg(pParse); |
| 116190 | | - sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, 1, r1, &pDest->affSdst,1); |
| 116191 | | - sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, 1); |
| 117014 | + sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, |
| 117015 | + r1, pDest->zAffSdst, pIn->nSdst); |
| 117016 | + sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst); |
| 116192 | 117017 | sqlite3VdbeAddOp2(v, OP_IdxInsert, pDest->iSDParm, r1); |
| 116193 | 117018 | sqlite3ReleaseTempReg(pParse, r1); |
| 116194 | 117019 | break; |
| 116195 | 117020 | } |
| 116196 | 117021 | |
| | @@ -118418,20 +119243,10 @@ |
| 118418 | 119243 | #if SELECTTRACE_ENABLED |
| 118419 | 119244 | if( sqlite3SelectTrace & 0x100 ){ |
| 118420 | 119245 | SELECTTRACE(0x100,pParse,p, ("after name resolution:\n")); |
| 118421 | 119246 | sqlite3TreeViewSelect(0, p, 0); |
| 118422 | 119247 | } |
| 118423 | | -#endif |
| 118424 | | - |
| 118425 | | - |
| 118426 | | - /* If writing to memory or generating a set |
| 118427 | | - ** only a single column may be output. |
| 118428 | | - */ |
| 118429 | | -#ifndef SQLITE_OMIT_SUBQUERY |
| 118430 | | - if( checkForMultiColumnSelectError(pParse, pDest, p->pEList->nExpr) ){ |
| 118431 | | - goto select_end; |
| 118432 | | - } |
| 118433 | 119248 | #endif |
| 118434 | 119249 | |
| 118435 | 119250 | /* Try to flatten subqueries in the FROM clause up into the main query |
| 118436 | 119251 | */ |
| 118437 | 119252 | #if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) |
| | @@ -122398,11 +123213,11 @@ |
| 122398 | 123213 | |
| 122399 | 123214 | /* |
| 122400 | 123215 | ** This function is invoked by the vdbe to call the xCreate method |
| 122401 | 123216 | ** of the virtual table named zTab in database iDb. |
| 122402 | 123217 | ** |
| 122403 | | -** If an error occurs, *pzErr is set to point an an English language |
| 123218 | +** If an error occurs, *pzErr is set to point to an English language |
| 122404 | 123219 | ** description of the error and an SQLITE_XXX error code is returned. |
| 122405 | 123220 | ** In this case the caller must call sqlite3DbFree(db, ) on *pzErr. |
| 122406 | 123221 | */ |
| 122407 | 123222 | SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){ |
| 122408 | 123223 | int rc = SQLITE_OK; |
| | @@ -123099,10 +123914,12 @@ |
| 123099 | 123914 | LogEst rRun; /* Cost of running each loop */ |
| 123100 | 123915 | LogEst nOut; /* Estimated number of output rows */ |
| 123101 | 123916 | union { |
| 123102 | 123917 | struct { /* Information for internal btree tables */ |
| 123103 | 123918 | u16 nEq; /* Number of equality constraints */ |
| 123919 | + u16 nBtm; /* Size of BTM vector */ |
| 123920 | + u16 nTop; /* Size of TOP vector */ |
| 123104 | 123921 | Index *pIndex; /* Index used, or NULL */ |
| 123105 | 123922 | } btree; |
| 123106 | 123923 | struct { /* Information for virtual tables */ |
| 123107 | 123924 | int idxNum; /* Index number */ |
| 123108 | 123925 | u8 needFree; /* True if sqlite3_free(idxStr) is needed */ |
| | @@ -123223,10 +124040,11 @@ |
| 123223 | 124040 | */ |
| 123224 | 124041 | struct WhereTerm { |
| 123225 | 124042 | Expr *pExpr; /* Pointer to the subexpression that is this term */ |
| 123226 | 124043 | int iParent; /* Disable pWC->a[iParent] when this term disabled */ |
| 123227 | 124044 | int leftCursor; /* Cursor number of X in "X <op> <expr>" */ |
| 124045 | + int iField; /* Field in (?,?,?) IN (SELECT...) vector */ |
| 123228 | 124046 | union { |
| 123229 | 124047 | int leftColumn; /* Column number of X in "X <op> <expr>" */ |
| 123230 | 124048 | WhereOrInfo *pOrInfo; /* Extra information if (eOperator & WO_OR)!=0 */ |
| 123231 | 124049 | WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */ |
| 123232 | 124050 | } u; |
| | @@ -123528,10 +124346,21 @@ |
| 123528 | 124346 | |
| 123529 | 124347 | /************** End of whereInt.h ********************************************/ |
| 123530 | 124348 | /************** Continuing where we left off in wherecode.c ******************/ |
| 123531 | 124349 | |
| 123532 | 124350 | #ifndef SQLITE_OMIT_EXPLAIN |
| 124351 | + |
| 124352 | +/* |
| 124353 | +** Return the name of the i-th column of the pIdx index. |
| 124354 | +*/ |
| 124355 | +static const char *explainIndexColumnName(Index *pIdx, int i){ |
| 124356 | + i = pIdx->aiColumn[i]; |
| 124357 | + if( i==XN_EXPR ) return "<expr>"; |
| 124358 | + if( i==XN_ROWID ) return "rowid"; |
| 124359 | + return pIdx->pTable->aCol[i].zName; |
| 124360 | +} |
| 124361 | + |
| 123533 | 124362 | /* |
| 123534 | 124363 | ** This routine is a helper for explainIndexRange() below |
| 123535 | 124364 | ** |
| 123536 | 124365 | ** pStr holds the text of an expression that we are building up one term |
| 123537 | 124366 | ** at a time. This routine adds a new term to the end of the expression. |
| | @@ -123538,28 +124367,36 @@ |
| 123538 | 124367 | ** Terms are separated by AND so add the "AND" text for second and subsequent |
| 123539 | 124368 | ** terms only. |
| 123540 | 124369 | */ |
| 123541 | 124370 | static void explainAppendTerm( |
| 123542 | 124371 | StrAccum *pStr, /* The text expression being built */ |
| 123543 | | - int iTerm, /* Index of this term. First is zero */ |
| 123544 | | - const char *zColumn, /* Name of the column */ |
| 124372 | + Index *pIdx, /* Index to read column names from */ |
| 124373 | + int nTerm, /* Number of terms */ |
| 124374 | + int iTerm, /* Zero-based index of first term. */ |
| 124375 | + int bAnd, /* Non-zero to append " AND " */ |
| 123545 | 124376 | const char *zOp /* Name of the operator */ |
| 123546 | 124377 | ){ |
| 123547 | | - if( iTerm ) sqlite3StrAccumAppend(pStr, " AND ", 5); |
| 123548 | | - sqlite3StrAccumAppendAll(pStr, zColumn); |
| 124378 | + int i; |
| 124379 | + |
| 124380 | + assert( nTerm>=1 ); |
| 124381 | + if( bAnd ) sqlite3StrAccumAppend(pStr, " AND ", 5); |
| 124382 | + |
| 124383 | + if( nTerm>1 ) sqlite3StrAccumAppend(pStr, "(", 1); |
| 124384 | + for(i=0; i<nTerm; i++){ |
| 124385 | + if( i ) sqlite3StrAccumAppend(pStr, ",", 1); |
| 124386 | + sqlite3StrAccumAppendAll(pStr, explainIndexColumnName(pIdx, iTerm+i)); |
| 124387 | + } |
| 124388 | + if( nTerm>1 ) sqlite3StrAccumAppend(pStr, ")", 1); |
| 124389 | + |
| 123549 | 124390 | sqlite3StrAccumAppend(pStr, zOp, 1); |
| 123550 | | - sqlite3StrAccumAppend(pStr, "?", 1); |
| 123551 | | -} |
| 123552 | | - |
| 123553 | | -/* |
| 123554 | | -** Return the name of the i-th column of the pIdx index. |
| 123555 | | -*/ |
| 123556 | | -static const char *explainIndexColumnName(Index *pIdx, int i){ |
| 123557 | | - i = pIdx->aiColumn[i]; |
| 123558 | | - if( i==XN_EXPR ) return "<expr>"; |
| 123559 | | - if( i==XN_ROWID ) return "rowid"; |
| 123560 | | - return pIdx->pTable->aCol[i].zName; |
| 124391 | + |
| 124392 | + if( nTerm>1 ) sqlite3StrAccumAppend(pStr, "(", 1); |
| 124393 | + for(i=0; i<nTerm; i++){ |
| 124394 | + if( i ) sqlite3StrAccumAppend(pStr, ",", 1); |
| 124395 | + sqlite3StrAccumAppend(pStr, "?", 1); |
| 124396 | + } |
| 124397 | + if( nTerm>1 ) sqlite3StrAccumAppend(pStr, ")", 1); |
| 123561 | 124398 | } |
| 123562 | 124399 | |
| 123563 | 124400 | /* |
| 123564 | 124401 | ** Argument pLevel describes a strategy for scanning table pTab. This |
| 123565 | 124402 | ** function appends text to pStr that describes the subset of table |
| | @@ -123588,16 +124425,15 @@ |
| 123588 | 124425 | sqlite3XPrintf(pStr, i>=nSkip ? "%s=?" : "ANY(%s)", z); |
| 123589 | 124426 | } |
| 123590 | 124427 | |
| 123591 | 124428 | j = i; |
| 123592 | 124429 | if( pLoop->wsFlags&WHERE_BTM_LIMIT ){ |
| 123593 | | - const char *z = explainIndexColumnName(pIndex, i); |
| 123594 | | - explainAppendTerm(pStr, i++, z, ">"); |
| 124430 | + explainAppendTerm(pStr, pIndex, pLoop->u.btree.nBtm, j, i, ">"); |
| 124431 | + i = 1; |
| 123595 | 124432 | } |
| 123596 | 124433 | if( pLoop->wsFlags&WHERE_TOP_LIMIT ){ |
| 123597 | | - const char *z = explainIndexColumnName(pIndex, j); |
| 123598 | | - explainAppendTerm(pStr, i, z, "<"); |
| 124434 | + explainAppendTerm(pStr, pIndex, pLoop->u.btree.nTop, j, i, "<"); |
| 123599 | 124435 | } |
| 123600 | 124436 | sqlite3StrAccumAppend(pStr, ")", 1); |
| 123601 | 124437 | } |
| 123602 | 124438 | |
| 123603 | 124439 | /* |
| | @@ -123783,11 +124619,11 @@ |
| 123783 | 124619 | ** a conditional such that is only evaluated on the second pass of a |
| 123784 | 124620 | ** LIKE-optimization loop, when scanning BLOBs instead of strings. |
| 123785 | 124621 | */ |
| 123786 | 124622 | static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){ |
| 123787 | 124623 | int nLoop = 0; |
| 123788 | | - while( pTerm |
| 124624 | + while( ALWAYS(pTerm!=0) |
| 123789 | 124625 | && (pTerm->wtFlags & TERM_CODED)==0 |
| 123790 | 124626 | && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin)) |
| 123791 | 124627 | && (pLevel->notReady & pTerm->prereqAll)==0 |
| 123792 | 124628 | ){ |
| 123793 | 124629 | if( nLoop && (pTerm->wtFlags & TERM_LIKE)!=0 ){ |
| | @@ -123839,20 +124675,50 @@ |
| 123839 | 124675 | sqlite3VdbeAddOp4(v, OP_Affinity, base, n, 0, zAff, n); |
| 123840 | 124676 | sqlite3ExprCacheAffinityChange(pParse, base, n); |
| 123841 | 124677 | } |
| 123842 | 124678 | } |
| 123843 | 124679 | |
| 124680 | +/* |
| 124681 | +** Expression pRight, which is the RHS of a comparison operation, is |
| 124682 | +** either a vector of n elements or, if n==1, a scalar expression. |
| 124683 | +** Before the comparison operation, affinity zAff is to be applied |
| 124684 | +** to the pRight values. This function modifies characters within the |
| 124685 | +** affinity string to SQLITE_AFF_BLOB if either: |
| 124686 | +** |
| 124687 | +** * the comparison will be performed with no affinity, or |
| 124688 | +** * the affinity change in zAff is guaranteed not to change the value. |
| 124689 | +*/ |
| 124690 | +static void updateRangeAffinityStr( |
| 124691 | + Parse *pParse, /* Parse context */ |
| 124692 | + Expr *pRight, /* RHS of comparison */ |
| 124693 | + int n, /* Number of vector elements in comparison */ |
| 124694 | + char *zAff /* Affinity string to modify */ |
| 124695 | +){ |
| 124696 | + int i; |
| 124697 | + for(i=0; i<n; i++){ |
| 124698 | + Expr *p = sqlite3VectorFieldSubexpr(pRight, i); |
| 124699 | + if( sqlite3CompareAffinity(p, zAff[i])==SQLITE_AFF_BLOB |
| 124700 | + || sqlite3ExprNeedsNoAffinityChange(p, zAff[i]) |
| 124701 | + ){ |
| 124702 | + zAff[i] = SQLITE_AFF_BLOB; |
| 124703 | + } |
| 124704 | + } |
| 124705 | +} |
| 123844 | 124706 | |
| 123845 | 124707 | /* |
| 123846 | 124708 | ** Generate code for a single equality term of the WHERE clause. An equality |
| 123847 | 124709 | ** term can be either X=expr or X IN (...). pTerm is the term to be |
| 123848 | 124710 | ** coded. |
| 123849 | 124711 | ** |
| 123850 | | -** The current value for the constraint is left in register iReg. |
| 124712 | +** The current value for the constraint is left in a register, the index |
| 124713 | +** of which is returned. An attempt is made store the result in iTarget but |
| 124714 | +** this is only guaranteed for TK_ISNULL and TK_IN constraints. If the |
| 124715 | +** constraint is a TK_EQ or TK_IS, then the current value might be left in |
| 124716 | +** some other register and it is the caller's responsibility to compensate. |
| 123851 | 124717 | ** |
| 123852 | | -** For a constraint of the form X=expr, the expression is evaluated and its |
| 123853 | | -** result is left on the stack. For constraints of the form X IN (...) |
| 124718 | +** For a constraint of the form X=expr, the expression is evaluated in |
| 124719 | +** straight-line code. For constraints of the form X IN (...) |
| 123854 | 124720 | ** this routine sets up a loop that will iterate over all values of X. |
| 123855 | 124721 | */ |
| 123856 | 124722 | static int codeEqualityTerm( |
| 123857 | 124723 | Parse *pParse, /* The parsing context */ |
| 123858 | 124724 | WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ |
| | @@ -123863,22 +124729,26 @@ |
| 123863 | 124729 | ){ |
| 123864 | 124730 | Expr *pX = pTerm->pExpr; |
| 123865 | 124731 | Vdbe *v = pParse->pVdbe; |
| 123866 | 124732 | int iReg; /* Register holding results */ |
| 123867 | 124733 | |
| 124734 | + assert( pLevel->pWLoop->aLTerm[iEq]==pTerm ); |
| 123868 | 124735 | assert( iTarget>0 ); |
| 123869 | 124736 | if( pX->op==TK_EQ || pX->op==TK_IS ){ |
| 123870 | 124737 | iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); |
| 123871 | 124738 | }else if( pX->op==TK_ISNULL ){ |
| 123872 | 124739 | iReg = iTarget; |
| 123873 | 124740 | sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); |
| 123874 | 124741 | #ifndef SQLITE_OMIT_SUBQUERY |
| 123875 | 124742 | }else{ |
| 123876 | | - int eType; |
| 124743 | + int eType = IN_INDEX_NOOP; |
| 123877 | 124744 | int iTab; |
| 123878 | 124745 | struct InLoop *pIn; |
| 123879 | 124746 | WhereLoop *pLoop = pLevel->pWLoop; |
| 124747 | + int i; |
| 124748 | + int nEq = 0; |
| 124749 | + int *aiMap = 0; |
| 123880 | 124750 | |
| 123881 | 124751 | if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 |
| 123882 | 124752 | && pLoop->u.btree.pIndex!=0 |
| 123883 | 124753 | && pLoop->u.btree.pIndex->aSortOrder[iEq] |
| 123884 | 124754 | ){ |
| | @@ -123886,42 +124756,128 @@ |
| 123886 | 124756 | testcase( bRev ); |
| 123887 | 124757 | bRev = !bRev; |
| 123888 | 124758 | } |
| 123889 | 124759 | assert( pX->op==TK_IN ); |
| 123890 | 124760 | iReg = iTarget; |
| 123891 | | - eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0); |
| 124761 | + |
| 124762 | + for(i=0; i<iEq; i++){ |
| 124763 | + if( pLoop->aLTerm[i] && pLoop->aLTerm[i]->pExpr==pX ){ |
| 124764 | + disableTerm(pLevel, pTerm); |
| 124765 | + return iTarget; |
| 124766 | + } |
| 124767 | + } |
| 124768 | + for(i=iEq;i<pLoop->nLTerm; i++){ |
| 124769 | + if( ALWAYS(pLoop->aLTerm[i]) && pLoop->aLTerm[i]->pExpr==pX ) nEq++; |
| 124770 | + } |
| 124771 | + |
| 124772 | + if( (pX->flags & EP_xIsSelect)==0 || pX->x.pSelect->pEList->nExpr==1 ){ |
| 124773 | + eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, 0); |
| 124774 | + }else{ |
| 124775 | + Select *pSelect = pX->x.pSelect; |
| 124776 | + sqlite3 *db = pParse->db; |
| 124777 | + ExprList *pOrigRhs = pSelect->pEList; |
| 124778 | + ExprList *pOrigLhs = pX->pLeft->x.pList; |
| 124779 | + ExprList *pRhs = 0; /* New Select.pEList for RHS */ |
| 124780 | + ExprList *pLhs = 0; /* New pX->pLeft vector */ |
| 124781 | + |
| 124782 | + for(i=iEq;i<pLoop->nLTerm; i++){ |
| 124783 | + if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 124784 | + int iField = pLoop->aLTerm[i]->iField - 1; |
| 124785 | + Expr *pNewRhs = sqlite3ExprDup(db, pOrigRhs->a[iField].pExpr, 0); |
| 124786 | + Expr *pNewLhs = sqlite3ExprDup(db, pOrigLhs->a[iField].pExpr, 0); |
| 124787 | + |
| 124788 | + pRhs = sqlite3ExprListAppend(pParse, pRhs, pNewRhs); |
| 124789 | + pLhs = sqlite3ExprListAppend(pParse, pLhs, pNewLhs); |
| 124790 | + } |
| 124791 | + } |
| 124792 | + if( !db->mallocFailed ){ |
| 124793 | + Expr *pLeft = pX->pLeft; |
| 124794 | + |
| 124795 | + if( pSelect->pOrderBy ){ |
| 124796 | + /* If the SELECT statement has an ORDER BY clause, zero the |
| 124797 | + ** iOrderByCol variables. These are set to non-zero when an |
| 124798 | + ** ORDER BY term exactly matches one of the terms of the |
| 124799 | + ** result-set. Since the result-set of the SELECT statement may |
| 124800 | + ** have been modified or reordered, these variables are no longer |
| 124801 | + ** set correctly. Since setting them is just an optimization, |
| 124802 | + ** it's easiest just to zero them here. */ |
| 124803 | + ExprList *pOrderBy = pSelect->pOrderBy; |
| 124804 | + for(i=0; i<pOrderBy->nExpr; i++){ |
| 124805 | + pOrderBy->a[i].u.x.iOrderByCol = 0; |
| 124806 | + } |
| 124807 | + } |
| 124808 | + |
| 124809 | + /* Take care here not to generate a TK_VECTOR containing only a |
| 124810 | + ** single value. Since the parser never creates such a vector, some |
| 124811 | + ** of the subroutines do not handle this case. */ |
| 124812 | + if( pLhs->nExpr==1 ){ |
| 124813 | + pX->pLeft = pLhs->a[0].pExpr; |
| 124814 | + }else{ |
| 124815 | + pLeft->x.pList = pLhs; |
| 124816 | + aiMap = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int) * nEq); |
| 124817 | + testcase( aiMap==0 ); |
| 124818 | + } |
| 124819 | + pSelect->pEList = pRhs; |
| 124820 | + eType = sqlite3FindInIndex(pParse, pX, IN_INDEX_LOOP, 0, aiMap); |
| 124821 | + testcase( aiMap!=0 && aiMap[0]!=0 ); |
| 124822 | + pSelect->pEList = pOrigRhs; |
| 124823 | + pLeft->x.pList = pOrigLhs; |
| 124824 | + pX->pLeft = pLeft; |
| 124825 | + } |
| 124826 | + sqlite3ExprListDelete(pParse->db, pLhs); |
| 124827 | + sqlite3ExprListDelete(pParse->db, pRhs); |
| 124828 | + } |
| 124829 | + |
| 123892 | 124830 | if( eType==IN_INDEX_INDEX_DESC ){ |
| 123893 | 124831 | testcase( bRev ); |
| 123894 | 124832 | bRev = !bRev; |
| 123895 | 124833 | } |
| 123896 | 124834 | iTab = pX->iTable; |
| 123897 | 124835 | sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); |
| 123898 | 124836 | VdbeCoverageIf(v, bRev); |
| 123899 | 124837 | VdbeCoverageIf(v, !bRev); |
| 123900 | 124838 | assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); |
| 124839 | + |
| 123901 | 124840 | pLoop->wsFlags |= WHERE_IN_ABLE; |
| 123902 | 124841 | if( pLevel->u.in.nIn==0 ){ |
| 123903 | 124842 | pLevel->addrNxt = sqlite3VdbeMakeLabel(v); |
| 123904 | 124843 | } |
| 123905 | | - pLevel->u.in.nIn++; |
| 124844 | + |
| 124845 | + i = pLevel->u.in.nIn; |
| 124846 | + pLevel->u.in.nIn += nEq; |
| 123906 | 124847 | pLevel->u.in.aInLoop = |
| 123907 | 124848 | sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, |
| 123908 | 124849 | sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); |
| 123909 | 124850 | pIn = pLevel->u.in.aInLoop; |
| 123910 | 124851 | if( pIn ){ |
| 123911 | | - pIn += pLevel->u.in.nIn - 1; |
| 123912 | | - pIn->iCur = iTab; |
| 123913 | | - if( eType==IN_INDEX_ROWID ){ |
| 123914 | | - pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg); |
| 123915 | | - }else{ |
| 123916 | | - pIn->addrInTop = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg); |
| 123917 | | - } |
| 123918 | | - pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen; |
| 123919 | | - sqlite3VdbeAddOp1(v, OP_IsNull, iReg); VdbeCoverage(v); |
| 124852 | + int iMap = 0; /* Index in aiMap[] */ |
| 124853 | + pIn += i; |
| 124854 | + for(i=iEq;i<pLoop->nLTerm; i++){ |
| 124855 | + int iOut = iReg; |
| 124856 | + if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 124857 | + if( eType==IN_INDEX_ROWID ){ |
| 124858 | + assert( nEq==1 && i==iEq ); |
| 124859 | + pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg); |
| 124860 | + }else{ |
| 124861 | + int iCol = aiMap ? aiMap[iMap++] : 0; |
| 124862 | + iOut = iReg + i - iEq; |
| 124863 | + pIn->addrInTop = sqlite3VdbeAddOp3(v,OP_Column,iTab, iCol, iOut); |
| 124864 | + } |
| 124865 | + sqlite3VdbeAddOp1(v, OP_IsNull, iOut); VdbeCoverage(v); |
| 124866 | + if( i==iEq ){ |
| 124867 | + pIn->iCur = iTab; |
| 124868 | + pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen; |
| 124869 | + }else{ |
| 124870 | + pIn->eEndLoopOp = OP_Noop; |
| 124871 | + } |
| 124872 | + pIn++; |
| 124873 | + } |
| 124874 | + } |
| 123920 | 124875 | }else{ |
| 123921 | 124876 | pLevel->u.in.nIn = 0; |
| 123922 | 124877 | } |
| 124878 | + sqlite3DbFree(pParse->db, aiMap); |
| 123923 | 124879 | #endif |
| 123924 | 124880 | } |
| 123925 | 124881 | disableTerm(pLevel, pTerm); |
| 123926 | 124882 | return iReg; |
| 123927 | 124883 | } |
| | @@ -124043,13 +124999,19 @@ |
| 124043 | 124999 | regBase = r1; |
| 124044 | 125000 | }else{ |
| 124045 | 125001 | sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j); |
| 124046 | 125002 | } |
| 124047 | 125003 | } |
| 124048 | | - testcase( pTerm->eOperator & WO_ISNULL ); |
| 124049 | | - testcase( pTerm->eOperator & WO_IN ); |
| 124050 | | - if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){ |
| 125004 | + if( pTerm->eOperator & WO_IN ){ |
| 125005 | + if( pTerm->pExpr->flags & EP_xIsSelect ){ |
| 125006 | + /* No affinity ever needs to be (or should be) applied to a value |
| 125007 | + ** from the RHS of an "? IN (SELECT ...)" expression. The |
| 125008 | + ** sqlite3FindInIndex() routine has already ensured that the |
| 125009 | + ** affinity of the comparison has been applied to the value. */ |
| 125010 | + if( zAff ) zAff[j] = SQLITE_AFF_BLOB; |
| 125011 | + } |
| 125012 | + }else if( (pTerm->eOperator & WO_ISNULL)==0 ){ |
| 124051 | 125013 | Expr *pRight = pTerm->pExpr->pRight; |
| 124052 | 125014 | if( (pTerm->wtFlags & TERM_IS)==0 && sqlite3ExprCanBeNull(pRight) ){ |
| 124053 | 125015 | sqlite3VdbeAddOp2(v, OP_IsNull, regBase+j, pLevel->addrBrk); |
| 124054 | 125016 | VdbeCoverage(v); |
| 124055 | 125017 | } |
| | @@ -124367,10 +125329,43 @@ |
| 124367 | 125329 | } |
| 124368 | 125330 | sqlite3VdbeChangeP4(v, -1, (char*)ai, P4_INTARRAY); |
| 124369 | 125331 | } |
| 124370 | 125332 | } |
| 124371 | 125333 | } |
| 125334 | + |
| 125335 | +/* |
| 125336 | +** If the expression passed as the second argument is a vector, generate |
| 125337 | +** code to write the first nReg elements of the vector into an array |
| 125338 | +** of registers starting with iReg. |
| 125339 | +** |
| 125340 | +** If the expression is not a vector, then nReg must be passed 1. In |
| 125341 | +** this case, generate code to evaluate the expression and leave the |
| 125342 | +** result in register iReg. |
| 125343 | +*/ |
| 125344 | +static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){ |
| 125345 | + assert( nReg>0 ); |
| 125346 | + if( sqlite3ExprIsVector(p) ){ |
| 125347 | +#ifndef SQLITE_OMIT_SUBQUERY |
| 125348 | + if( (p->flags & EP_xIsSelect) ){ |
| 125349 | + Vdbe *v = pParse->pVdbe; |
| 125350 | + int iSelect = sqlite3CodeSubselect(pParse, p, 0, 0); |
| 125351 | + sqlite3VdbeAddOp3(v, OP_Copy, iSelect, iReg, nReg-1); |
| 125352 | + }else |
| 125353 | +#endif |
| 125354 | + { |
| 125355 | + int i; |
| 125356 | + ExprList *pList = p->x.pList; |
| 125357 | + assert( nReg<=pList->nExpr ); |
| 125358 | + for(i=0; i<nReg; i++){ |
| 125359 | + sqlite3ExprCode(pParse, pList->a[i].pExpr, iReg+i); |
| 125360 | + } |
| 125361 | + } |
| 125362 | + }else{ |
| 125363 | + assert( nReg==1 ); |
| 125364 | + sqlite3ExprCode(pParse, p, iReg); |
| 125365 | + } |
| 125366 | +} |
| 124372 | 125367 | |
| 124373 | 125368 | /* |
| 124374 | 125369 | ** Generate code for the start of the iLevel-th loop in the WHERE clause |
| 124375 | 125370 | ** implementation described by pWInfo. |
| 124376 | 125371 | */ |
| | @@ -124463,11 +125458,12 @@ |
| 124463 | 125458 | if( NEVER(pTerm==0) ) continue; |
| 124464 | 125459 | if( pTerm->eOperator & WO_IN ){ |
| 124465 | 125460 | codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); |
| 124466 | 125461 | addrNotFound = pLevel->addrNxt; |
| 124467 | 125462 | }else{ |
| 124468 | | - sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget); |
| 125463 | + Expr *pRight = pTerm->pExpr->pRight; |
| 125464 | + codeExprOrVector(pParse, pRight, iTarget, 1); |
| 124469 | 125465 | } |
| 124470 | 125466 | } |
| 124471 | 125467 | sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); |
| 124472 | 125468 | sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); |
| 124473 | 125469 | sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, |
| | @@ -124577,10 +125573,11 @@ |
| 124577 | 125573 | } |
| 124578 | 125574 | codeCursorHint(pTabItem, pWInfo, pLevel, pEnd); |
| 124579 | 125575 | if( pStart ){ |
| 124580 | 125576 | Expr *pX; /* The expression that defines the start bound */ |
| 124581 | 125577 | int r1, rTemp; /* Registers for holding the start boundary */ |
| 125578 | + int op; /* Cursor seek operation */ |
| 124582 | 125579 | |
| 124583 | 125580 | /* The following constant maps TK_xx codes into corresponding |
| 124584 | 125581 | ** seek opcodes. It depends on a particular ordering of TK_xx |
| 124585 | 125582 | */ |
| 124586 | 125583 | const u8 aMoveOp[] = { |
| | @@ -124596,20 +125593,27 @@ |
| 124596 | 125593 | assert( (pStart->wtFlags & TERM_VNULL)==0 ); |
| 124597 | 125594 | testcase( pStart->wtFlags & TERM_VIRTUAL ); |
| 124598 | 125595 | pX = pStart->pExpr; |
| 124599 | 125596 | assert( pX!=0 ); |
| 124600 | 125597 | testcase( pStart->leftCursor!=iCur ); /* transitive constraints */ |
| 124601 | | - r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); |
| 124602 | | - sqlite3VdbeAddOp3(v, aMoveOp[pX->op-TK_GT], iCur, addrBrk, r1); |
| 125598 | + if( sqlite3ExprIsVector(pX->pRight) ){ |
| 125599 | + r1 = rTemp = sqlite3GetTempReg(pParse); |
| 125600 | + codeExprOrVector(pParse, pX->pRight, r1, 1); |
| 125601 | + op = aMoveOp[(pX->op - TK_GT) | 0x0001]; |
| 125602 | + }else{ |
| 125603 | + r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); |
| 125604 | + disableTerm(pLevel, pStart); |
| 125605 | + op = aMoveOp[(pX->op - TK_GT)]; |
| 125606 | + } |
| 125607 | + sqlite3VdbeAddOp3(v, op, iCur, addrBrk, r1); |
| 124603 | 125608 | VdbeComment((v, "pk")); |
| 124604 | 125609 | VdbeCoverageIf(v, pX->op==TK_GT); |
| 124605 | 125610 | VdbeCoverageIf(v, pX->op==TK_LE); |
| 124606 | 125611 | VdbeCoverageIf(v, pX->op==TK_LT); |
| 124607 | 125612 | VdbeCoverageIf(v, pX->op==TK_GE); |
| 124608 | 125613 | sqlite3ExprCacheAffinityChange(pParse, r1, 1); |
| 124609 | 125614 | sqlite3ReleaseTempReg(pParse, rTemp); |
| 124610 | | - disableTerm(pLevel, pStart); |
| 124611 | 125615 | }else{ |
| 124612 | 125616 | sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk); |
| 124613 | 125617 | VdbeCoverageIf(v, bRev==0); |
| 124614 | 125618 | VdbeCoverageIf(v, bRev!=0); |
| 124615 | 125619 | } |
| | @@ -124619,17 +125623,21 @@ |
| 124619 | 125623 | assert( pX!=0 ); |
| 124620 | 125624 | assert( (pEnd->wtFlags & TERM_VNULL)==0 ); |
| 124621 | 125625 | testcase( pEnd->leftCursor!=iCur ); /* Transitive constraints */ |
| 124622 | 125626 | testcase( pEnd->wtFlags & TERM_VIRTUAL ); |
| 124623 | 125627 | memEndValue = ++pParse->nMem; |
| 124624 | | - sqlite3ExprCode(pParse, pX->pRight, memEndValue); |
| 124625 | | - if( pX->op==TK_LT || pX->op==TK_GT ){ |
| 125628 | + codeExprOrVector(pParse, pX->pRight, memEndValue, 1); |
| 125629 | + if( 0==sqlite3ExprIsVector(pX->pRight) |
| 125630 | + && (pX->op==TK_LT || pX->op==TK_GT) |
| 125631 | + ){ |
| 124626 | 125632 | testOp = bRev ? OP_Le : OP_Ge; |
| 124627 | 125633 | }else{ |
| 124628 | 125634 | testOp = bRev ? OP_Lt : OP_Gt; |
| 124629 | 125635 | } |
| 124630 | | - disableTerm(pLevel, pEnd); |
| 125636 | + if( 0==sqlite3ExprIsVector(pX->pRight) ){ |
| 125637 | + disableTerm(pLevel, pEnd); |
| 125638 | + } |
| 124631 | 125639 | } |
| 124632 | 125640 | start = sqlite3VdbeCurrentAddr(v); |
| 124633 | 125641 | pLevel->op = bRev ? OP_Prev : OP_Next; |
| 124634 | 125642 | pLevel->p1 = iCur; |
| 124635 | 125643 | pLevel->p2 = start; |
| | @@ -124692,10 +125700,12 @@ |
| 124692 | 125700 | OP_IdxGT, /* 1: (end_constraints && !bRev && endEq) */ |
| 124693 | 125701 | OP_IdxLE, /* 2: (end_constraints && bRev && !endEq) */ |
| 124694 | 125702 | OP_IdxLT, /* 3: (end_constraints && bRev && endEq) */ |
| 124695 | 125703 | }; |
| 124696 | 125704 | u16 nEq = pLoop->u.btree.nEq; /* Number of == or IN terms */ |
| 125705 | + u16 nBtm = pLoop->u.btree.nBtm; /* Length of BTM vector */ |
| 125706 | + u16 nTop = pLoop->u.btree.nTop; /* Length of TOP vector */ |
| 124697 | 125707 | int regBase; /* Base register holding constraint values */ |
| 124698 | 125708 | WhereTerm *pRangeStart = 0; /* Inequality constraint at range start */ |
| 124699 | 125709 | WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */ |
| 124700 | 125710 | int startEq; /* True if range start uses ==, >= or <= */ |
| 124701 | 125711 | int endEq; /* True if range end uses ==, >= or <= */ |
| | @@ -124704,11 +125714,11 @@ |
| 124704 | 125714 | Index *pIdx; /* The index we will be using */ |
| 124705 | 125715 | int iIdxCur; /* The VDBE cursor for the index */ |
| 124706 | 125716 | int nExtraReg = 0; /* Number of extra registers needed */ |
| 124707 | 125717 | int op; /* Instruction opcode */ |
| 124708 | 125718 | char *zStartAff; /* Affinity for start of range constraint */ |
| 124709 | | - char cEndAff = 0; /* Affinity for end of range constraint */ |
| 125719 | + char *zEndAff = 0; /* Affinity for end of range constraint */ |
| 124710 | 125720 | u8 bSeekPastNull = 0; /* True to seek past initial nulls */ |
| 124711 | 125721 | u8 bStopAtNull = 0; /* Add condition to terminate at NULLs */ |
| 124712 | 125722 | |
| 124713 | 125723 | pIdx = pLoop->u.btree.pIndex; |
| 124714 | 125724 | iIdxCur = pLevel->iIdxCur; |
| | @@ -124738,18 +125748,18 @@ |
| 124738 | 125748 | ** of the range. |
| 124739 | 125749 | */ |
| 124740 | 125750 | j = nEq; |
| 124741 | 125751 | if( pLoop->wsFlags & WHERE_BTM_LIMIT ){ |
| 124742 | 125752 | pRangeStart = pLoop->aLTerm[j++]; |
| 124743 | | - nExtraReg = 1; |
| 125753 | + nExtraReg = MAX(nExtraReg, pLoop->u.btree.nBtm); |
| 124744 | 125754 | /* Like optimization range constraints always occur in pairs */ |
| 124745 | 125755 | assert( (pRangeStart->wtFlags & TERM_LIKEOPT)==0 || |
| 124746 | 125756 | (pLoop->wsFlags & WHERE_TOP_LIMIT)!=0 ); |
| 124747 | 125757 | } |
| 124748 | 125758 | if( pLoop->wsFlags & WHERE_TOP_LIMIT ){ |
| 124749 | 125759 | pRangeEnd = pLoop->aLTerm[j++]; |
| 124750 | | - nExtraReg = 1; |
| 125760 | + nExtraReg = MAX(nExtraReg, pLoop->u.btree.nTop); |
| 124751 | 125761 | #ifndef SQLITE_LIKE_DOESNT_MATCH_BLOBS |
| 124752 | 125762 | if( (pRangeEnd->wtFlags & TERM_LIKEOPT)!=0 ){ |
| 124753 | 125763 | assert( pRangeStart!=0 ); /* LIKE opt constraints */ |
| 124754 | 125764 | assert( pRangeStart->wtFlags & TERM_LIKEOPT ); /* occur in pairs */ |
| 124755 | 125765 | pLevel->iLikeRepCntr = (u32)++pParse->nMem; |
| | @@ -124781,20 +125791,23 @@ |
| 124781 | 125791 | if( (nEq<pIdx->nKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC)) |
| 124782 | 125792 | || (bRev && pIdx->nKeyCol==nEq) |
| 124783 | 125793 | ){ |
| 124784 | 125794 | SWAP(WhereTerm *, pRangeEnd, pRangeStart); |
| 124785 | 125795 | SWAP(u8, bSeekPastNull, bStopAtNull); |
| 125796 | + SWAP(u8, nBtm, nTop); |
| 124786 | 125797 | } |
| 124787 | 125798 | |
| 124788 | 125799 | /* Generate code to evaluate all constraint terms using == or IN |
| 124789 | 125800 | ** and store the values of those terms in an array of registers |
| 124790 | 125801 | ** starting at regBase. |
| 124791 | 125802 | */ |
| 124792 | 125803 | codeCursorHint(pTabItem, pWInfo, pLevel, pRangeEnd); |
| 124793 | 125804 | regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); |
| 124794 | 125805 | assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); |
| 124795 | | - if( zStartAff ) cEndAff = zStartAff[nEq]; |
| 125806 | + if( zStartAff && nTop ){ |
| 125807 | + zEndAff = sqlite3DbStrDup(db, &zStartAff[nEq]); |
| 125808 | + } |
| 124796 | 125809 | addrNxt = pLevel->addrNxt; |
| 124797 | 125810 | |
| 124798 | 125811 | testcase( pRangeStart && (pRangeStart->eOperator & WO_LE)!=0 ); |
| 124799 | 125812 | testcase( pRangeStart && (pRangeStart->eOperator & WO_GE)!=0 ); |
| 124800 | 125813 | testcase( pRangeEnd && (pRangeEnd->eOperator & WO_LE)!=0 ); |
| | @@ -124805,31 +125818,28 @@ |
| 124805 | 125818 | |
| 124806 | 125819 | /* Seek the index cursor to the start of the range. */ |
| 124807 | 125820 | nConstraint = nEq; |
| 124808 | 125821 | if( pRangeStart ){ |
| 124809 | 125822 | Expr *pRight = pRangeStart->pExpr->pRight; |
| 124810 | | - sqlite3ExprCode(pParse, pRight, regBase+nEq); |
| 125823 | + codeExprOrVector(pParse, pRight, regBase+nEq, nBtm); |
| 124811 | 125824 | whereLikeOptimizationStringFixup(v, pLevel, pRangeStart); |
| 124812 | 125825 | if( (pRangeStart->wtFlags & TERM_VNULL)==0 |
| 124813 | 125826 | && sqlite3ExprCanBeNull(pRight) |
| 124814 | 125827 | ){ |
| 124815 | 125828 | sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); |
| 124816 | 125829 | VdbeCoverage(v); |
| 124817 | 125830 | } |
| 124818 | 125831 | if( zStartAff ){ |
| 124819 | | - if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_BLOB){ |
| 124820 | | - /* Since the comparison is to be performed with no conversions |
| 124821 | | - ** applied to the operands, set the affinity to apply to pRight to |
| 124822 | | - ** SQLITE_AFF_BLOB. */ |
| 124823 | | - zStartAff[nEq] = SQLITE_AFF_BLOB; |
| 124824 | | - } |
| 124825 | | - if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){ |
| 124826 | | - zStartAff[nEq] = SQLITE_AFF_BLOB; |
| 124827 | | - } |
| 124828 | | - } |
| 124829 | | - nConstraint++; |
| 124830 | | - testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); |
| 125832 | + updateRangeAffinityStr(pParse, pRight, nBtm, &zStartAff[nEq]); |
| 125833 | + } |
| 125834 | + nConstraint += nBtm; |
| 125835 | + testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); |
| 125836 | + if( sqlite3ExprIsVector(pRight)==0 ){ |
| 125837 | + disableTerm(pLevel, pRangeStart); |
| 125838 | + }else{ |
| 125839 | + startEq = 1; |
| 125840 | + } |
| 124831 | 125841 | bSeekPastNull = 0; |
| 124832 | 125842 | }else if( bSeekPastNull ){ |
| 124833 | 125843 | sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); |
| 124834 | 125844 | nConstraint++; |
| 124835 | 125845 | startEq = 0; |
| | @@ -124858,31 +125868,39 @@ |
| 124858 | 125868 | */ |
| 124859 | 125869 | nConstraint = nEq; |
| 124860 | 125870 | if( pRangeEnd ){ |
| 124861 | 125871 | Expr *pRight = pRangeEnd->pExpr->pRight; |
| 124862 | 125872 | sqlite3ExprCacheRemove(pParse, regBase+nEq, 1); |
| 124863 | | - sqlite3ExprCode(pParse, pRight, regBase+nEq); |
| 125873 | + codeExprOrVector(pParse, pRight, regBase+nEq, nTop); |
| 124864 | 125874 | whereLikeOptimizationStringFixup(v, pLevel, pRangeEnd); |
| 124865 | 125875 | if( (pRangeEnd->wtFlags & TERM_VNULL)==0 |
| 124866 | 125876 | && sqlite3ExprCanBeNull(pRight) |
| 124867 | 125877 | ){ |
| 124868 | 125878 | sqlite3VdbeAddOp2(v, OP_IsNull, regBase+nEq, addrNxt); |
| 124869 | 125879 | VdbeCoverage(v); |
| 124870 | 125880 | } |
| 124871 | | - if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_BLOB |
| 124872 | | - && !sqlite3ExprNeedsNoAffinityChange(pRight, cEndAff) |
| 124873 | | - ){ |
| 124874 | | - codeApplyAffinity(pParse, regBase+nEq, 1, &cEndAff); |
| 125881 | + if( zEndAff ){ |
| 125882 | + updateRangeAffinityStr(pParse, pRight, nTop, zEndAff); |
| 125883 | + codeApplyAffinity(pParse, regBase+nEq, nTop, zEndAff); |
| 125884 | + }else{ |
| 125885 | + assert( pParse->db->mallocFailed ); |
| 124875 | 125886 | } |
| 124876 | | - nConstraint++; |
| 125887 | + nConstraint += nTop; |
| 124877 | 125888 | testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); |
| 125889 | + |
| 125890 | + if( sqlite3ExprIsVector(pRight)==0 ){ |
| 125891 | + disableTerm(pLevel, pRangeEnd); |
| 125892 | + }else{ |
| 125893 | + endEq = 1; |
| 125894 | + } |
| 124878 | 125895 | }else if( bStopAtNull ){ |
| 124879 | 125896 | sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); |
| 124880 | 125897 | endEq = 0; |
| 124881 | 125898 | nConstraint++; |
| 124882 | 125899 | } |
| 124883 | 125900 | sqlite3DbFree(db, zStartAff); |
| 125901 | + sqlite3DbFree(db, zEndAff); |
| 124884 | 125902 | |
| 124885 | 125903 | /* Top of the loop body */ |
| 124886 | 125904 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 124887 | 125905 | |
| 124888 | 125906 | /* Check if the index cursor is past the end of the range. */ |
| | @@ -124894,12 +125912,10 @@ |
| 124894 | 125912 | testcase( op==OP_IdxLT ); VdbeCoverageIf(v, op==OP_IdxLT ); |
| 124895 | 125913 | testcase( op==OP_IdxLE ); VdbeCoverageIf(v, op==OP_IdxLE ); |
| 124896 | 125914 | } |
| 124897 | 125915 | |
| 124898 | 125916 | /* Seek the table cursor, if required */ |
| 124899 | | - disableTerm(pLevel, pRangeStart); |
| 124900 | | - disableTerm(pLevel, pRangeEnd); |
| 124901 | 125917 | if( omitTable ){ |
| 124902 | 125918 | /* pIdx is a covering index. No need to access the main table. */ |
| 124903 | 125919 | }else if( HasRowid(pIdx->pTable) ){ |
| 124904 | 125920 | if( (pWInfo->wctrlFlags & WHERE_SEEK_TABLE)!=0 ){ |
| 124905 | 125921 | iRowidReg = ++pParse->nMem; |
| | @@ -124919,13 +125935,11 @@ |
| 124919 | 125935 | } |
| 124920 | 125936 | sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, |
| 124921 | 125937 | iRowidReg, pPk->nKeyCol); VdbeCoverage(v); |
| 124922 | 125938 | } |
| 124923 | 125939 | |
| 124924 | | - /* Record the instruction used to terminate the loop. Disable |
| 124925 | | - ** WHERE clause terms made redundant by the index range scan. |
| 124926 | | - */ |
| 125940 | + /* Record the instruction used to terminate the loop. */ |
| 124927 | 125941 | if( pLoop->wsFlags & WHERE_ONEROW ){ |
| 124928 | 125942 | pLevel->op = OP_Noop; |
| 124929 | 125943 | }else if( bRev ){ |
| 124930 | 125944 | pLevel->op = OP_Prev; |
| 124931 | 125945 | }else{ |
| | @@ -124998,11 +126012,11 @@ |
| 124998 | 126012 | int untestedTerms = 0; /* Some terms not completely tested */ |
| 124999 | 126013 | int ii; /* Loop counter */ |
| 125000 | 126014 | u16 wctrlFlags; /* Flags for sub-WHERE clause */ |
| 125001 | 126015 | Expr *pAndExpr = 0; /* An ".. AND (...)" expression */ |
| 125002 | 126016 | Table *pTab = pTabItem->pTab; |
| 125003 | | - |
| 126017 | + |
| 125004 | 126018 | pTerm = pLoop->aLTerm[0]; |
| 125005 | 126019 | assert( pTerm!=0 ); |
| 125006 | 126020 | assert( pTerm->eOperator & WO_OR ); |
| 125007 | 126021 | assert( (pTerm->wtFlags & TERM_ORINFO)!=0 ); |
| 125008 | 126022 | pOrWc = &pTerm->u.pOrInfo->wc; |
| | @@ -125450,11 +126464,11 @@ |
| 125450 | 126464 | } |
| 125451 | 126465 | |
| 125452 | 126466 | /* |
| 125453 | 126467 | ** Return TRUE if the given operator is one of the operators that is |
| 125454 | 126468 | ** allowed for an indexable WHERE clause term. The allowed operators are |
| 125455 | | -** "=", "<", ">", "<=", ">=", "IN", and "IS NULL" |
| 126469 | +** "=", "<", ">", "<=", ">=", "IN", "IS", and "IS NULL" |
| 125456 | 126470 | */ |
| 125457 | 126471 | static int allowedOp(int op){ |
| 125458 | 126472 | assert( TK_GT>TK_EQ && TK_GT<TK_GE ); |
| 125459 | 126473 | assert( TK_LT>TK_EQ && TK_LT<TK_GE ); |
| 125460 | 126474 | assert( TK_LE>TK_EQ && TK_LE<TK_GE ); |
| | @@ -126178,26 +127192,39 @@ |
| 126178 | 127192 | ** Expression pExpr is one operand of a comparison operator that might |
| 126179 | 127193 | ** be useful for indexing. This routine checks to see if pExpr appears |
| 126180 | 127194 | ** in any index. Return TRUE (1) if pExpr is an indexed term and return |
| 126181 | 127195 | ** FALSE (0) if not. If TRUE is returned, also set *piCur to the cursor |
| 126182 | 127196 | ** number of the table that is indexed and *piColumn to the column number |
| 126183 | | -** of the column that is indexed, or -2 if an expression is being indexed. |
| 127197 | +** of the column that is indexed, or XN_EXPR (-2) if an expression is being |
| 127198 | +** indexed. |
| 126184 | 127199 | ** |
| 126185 | 127200 | ** If pExpr is a TK_COLUMN column reference, then this routine always returns |
| 126186 | 127201 | ** true even if that particular column is not indexed, because the column |
| 126187 | 127202 | ** might be added to an automatic index later. |
| 126188 | 127203 | */ |
| 126189 | 127204 | static int exprMightBeIndexed( |
| 126190 | 127205 | SrcList *pFrom, /* The FROM clause */ |
| 127206 | + int op, /* The specific comparison operator */ |
| 126191 | 127207 | Bitmask mPrereq, /* Bitmask of FROM clause terms referenced by pExpr */ |
| 126192 | 127208 | Expr *pExpr, /* An operand of a comparison operator */ |
| 126193 | 127209 | int *piCur, /* Write the referenced table cursor number here */ |
| 126194 | 127210 | int *piColumn /* Write the referenced table column number here */ |
| 126195 | 127211 | ){ |
| 126196 | 127212 | Index *pIdx; |
| 126197 | 127213 | int i; |
| 126198 | 127214 | int iCur; |
| 127215 | + |
| 127216 | + /* If this expression is a vector to the left or right of a |
| 127217 | + ** inequality constraint (>, <, >= or <=), perform the processing |
| 127218 | + ** on the first element of the vector. */ |
| 127219 | + assert( TK_GT+1==TK_LE && TK_GT+2==TK_LT && TK_GT+3==TK_GE ); |
| 127220 | + assert( TK_IS<TK_GE && TK_ISNULL<TK_GE && TK_IN<TK_GE ); |
| 127221 | + assert( op<=TK_GE ); |
| 127222 | + if( pExpr->op==TK_VECTOR && (op>=TK_GT && ALWAYS(op<=TK_GE)) ){ |
| 127223 | + pExpr = pExpr->x.pList->a[0].pExpr; |
| 127224 | + } |
| 127225 | + |
| 126199 | 127226 | if( pExpr->op==TK_COLUMN ){ |
| 126200 | 127227 | *piCur = pExpr->iTable; |
| 126201 | 127228 | *piColumn = pExpr->iColumn; |
| 126202 | 127229 | return 1; |
| 126203 | 127230 | } |
| | @@ -126206,14 +127233,14 @@ |
| 126206 | 127233 | for(i=0; mPrereq>1; i++, mPrereq>>=1){} |
| 126207 | 127234 | iCur = pFrom->a[i].iCursor; |
| 126208 | 127235 | for(pIdx=pFrom->a[i].pTab->pIndex; pIdx; pIdx=pIdx->pNext){ |
| 126209 | 127236 | if( pIdx->aColExpr==0 ) continue; |
| 126210 | 127237 | for(i=0; i<pIdx->nKeyCol; i++){ |
| 126211 | | - if( pIdx->aiColumn[i]!=(-2) ) continue; |
| 127238 | + if( pIdx->aiColumn[i]!=XN_EXPR ) continue; |
| 126212 | 127239 | if( sqlite3ExprCompare(pExpr, pIdx->aColExpr->a[i].pExpr, iCur)==0 ){ |
| 126213 | 127240 | *piCur = iCur; |
| 126214 | | - *piColumn = -2; |
| 127241 | + *piColumn = XN_EXPR; |
| 126215 | 127242 | return 1; |
| 126216 | 127243 | } |
| 126217 | 127244 | } |
| 126218 | 127245 | } |
| 126219 | 127246 | return 0; |
| | @@ -126266,10 +127293,11 @@ |
| 126266 | 127293 | assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); |
| 126267 | 127294 | prereqLeft = sqlite3WhereExprUsage(pMaskSet, pExpr->pLeft); |
| 126268 | 127295 | op = pExpr->op; |
| 126269 | 127296 | if( op==TK_IN ){ |
| 126270 | 127297 | assert( pExpr->pRight==0 ); |
| 127298 | + if( sqlite3ExprCheckIN(pParse, pExpr) ) return; |
| 126271 | 127299 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 126272 | 127300 | pTerm->prereqRight = exprSelectUsage(pMaskSet, pExpr->x.pSelect); |
| 126273 | 127301 | }else{ |
| 126274 | 127302 | pTerm->prereqRight = sqlite3WhereExprListUsage(pMaskSet, pExpr->x.pList); |
| 126275 | 127303 | } |
| | @@ -126292,22 +127320,30 @@ |
| 126292 | 127320 | if( allowedOp(op) ){ |
| 126293 | 127321 | int iCur, iColumn; |
| 126294 | 127322 | Expr *pLeft = sqlite3ExprSkipCollate(pExpr->pLeft); |
| 126295 | 127323 | Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight); |
| 126296 | 127324 | u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV; |
| 126297 | | - if( exprMightBeIndexed(pSrc, prereqLeft, pLeft, &iCur, &iColumn) ){ |
| 127325 | + |
| 127326 | + if( pTerm->iField>0 ){ |
| 127327 | + assert( op==TK_IN ); |
| 127328 | + assert( pLeft->op==TK_VECTOR ); |
| 127329 | + pLeft = pLeft->x.pList->a[pTerm->iField-1].pExpr; |
| 127330 | + } |
| 127331 | + |
| 127332 | + if( exprMightBeIndexed(pSrc, op, prereqLeft, pLeft, &iCur, &iColumn) ){ |
| 126298 | 127333 | pTerm->leftCursor = iCur; |
| 126299 | 127334 | pTerm->u.leftColumn = iColumn; |
| 126300 | 127335 | pTerm->eOperator = operatorMask(op) & opMask; |
| 126301 | 127336 | } |
| 126302 | 127337 | if( op==TK_IS ) pTerm->wtFlags |= TERM_IS; |
| 126303 | 127338 | if( pRight |
| 126304 | | - && exprMightBeIndexed(pSrc, pTerm->prereqRight, pRight, &iCur, &iColumn) |
| 127339 | + && exprMightBeIndexed(pSrc, op, pTerm->prereqRight, pRight, &iCur,&iColumn) |
| 126305 | 127340 | ){ |
| 126306 | 127341 | WhereTerm *pNew; |
| 126307 | 127342 | Expr *pDup; |
| 126308 | 127343 | u16 eExtraOp = 0; /* Extra bits for pNew->eOperator */ |
| 127344 | + assert( pTerm->iField==0 ); |
| 126309 | 127345 | if( pTerm->leftCursor>=0 ){ |
| 126310 | 127346 | int idxNew; |
| 126311 | 127347 | pDup = sqlite3ExprDup(db, pExpr, 0); |
| 126312 | 127348 | if( db->mallocFailed ){ |
| 126313 | 127349 | sqlite3ExprDelete(db, pDup); |
| | @@ -126506,10 +127542,63 @@ |
| 126506 | 127542 | pTerm->wtFlags |= TERM_COPIED; |
| 126507 | 127543 | pNewTerm->prereqAll = pTerm->prereqAll; |
| 126508 | 127544 | } |
| 126509 | 127545 | } |
| 126510 | 127546 | #endif /* SQLITE_OMIT_VIRTUALTABLE */ |
| 127547 | + |
| 127548 | + /* If there is a vector == or IS term - e.g. "(a, b) == (?, ?)" - create |
| 127549 | + ** new terms for each component comparison - "a = ?" and "b = ?". The |
| 127550 | + ** new terms completely replace the original vector comparison, which is |
| 127551 | + ** no longer used. |
| 127552 | + ** |
| 127553 | + ** This is only required if at least one side of the comparison operation |
| 127554 | + ** is not a sub-select. */ |
| 127555 | + if( pWC->op==TK_AND |
| 127556 | + && (pExpr->op==TK_EQ || pExpr->op==TK_IS) |
| 127557 | + && sqlite3ExprIsVector(pExpr->pLeft) |
| 127558 | + && ( (pExpr->pLeft->flags & EP_xIsSelect)==0 |
| 127559 | + || (pExpr->pRight->flags & EP_xIsSelect)==0 |
| 127560 | + )){ |
| 127561 | + int nLeft = sqlite3ExprVectorSize(pExpr->pLeft); |
| 127562 | + int i; |
| 127563 | + assert( nLeft==sqlite3ExprVectorSize(pExpr->pRight) ); |
| 127564 | + for(i=0; i<nLeft; i++){ |
| 127565 | + int idxNew; |
| 127566 | + Expr *pNew; |
| 127567 | + Expr *pLeft = sqlite3ExprForVectorField(pParse, pExpr->pLeft, i); |
| 127568 | + Expr *pRight = sqlite3ExprForVectorField(pParse, pExpr->pRight, i); |
| 127569 | + |
| 127570 | + pNew = sqlite3PExpr(pParse, pExpr->op, pLeft, pRight, 0); |
| 127571 | + idxNew = whereClauseInsert(pWC, pNew, TERM_DYNAMIC); |
| 127572 | + exprAnalyze(pSrc, pWC, idxNew); |
| 127573 | + } |
| 127574 | + pTerm = &pWC->a[idxTerm]; |
| 127575 | + pTerm->wtFlags = TERM_CODED|TERM_VIRTUAL; /* Disable the original */ |
| 127576 | + pTerm->eOperator = 0; |
| 127577 | + } |
| 127578 | + |
| 127579 | + /* If there is a vector IN term - e.g. "(a, b) IN (SELECT ...)" - create |
| 127580 | + ** a virtual term for each vector component. The expression object |
| 127581 | + ** used by each such virtual term is pExpr (the full vector IN(...) |
| 127582 | + ** expression). The WhereTerm.iField variable identifies the index within |
| 127583 | + ** the vector on the LHS that the virtual term represents. |
| 127584 | + ** |
| 127585 | + ** This only works if the RHS is a simple SELECT, not a compound |
| 127586 | + */ |
| 127587 | + if( pWC->op==TK_AND && pExpr->op==TK_IN && pTerm->iField==0 |
| 127588 | + && pExpr->pLeft->op==TK_VECTOR |
| 127589 | + && pExpr->x.pSelect->pPrior==0 |
| 127590 | + ){ |
| 127591 | + int i; |
| 127592 | + for(i=0; i<sqlite3ExprVectorSize(pExpr->pLeft); i++){ |
| 127593 | + int idxNew; |
| 127594 | + idxNew = whereClauseInsert(pWC, pExpr, TERM_VIRTUAL); |
| 127595 | + pWC->a[idxNew].iField = i+1; |
| 127596 | + exprAnalyze(pSrc, pWC, idxNew); |
| 127597 | + markTermAsChild(pWC, idxNew, idxTerm); |
| 127598 | + } |
| 127599 | + } |
| 126511 | 127600 | |
| 126512 | 127601 | #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 |
| 126513 | 127602 | /* When sqlite_stat3 histogram data is available an operator of the |
| 126514 | 127603 | ** form "x IS NOT NULL" can sometimes be evaluated more efficiently |
| 126515 | 127604 | ** as "x>NULL" if x is not an INTEGER PRIMARY KEY. So construct a |
| | @@ -127546,20 +128635,22 @@ |
| 127546 | 128635 | static sqlite3_index_info *allocateIndexInfo( |
| 127547 | 128636 | Parse *pParse, |
| 127548 | 128637 | WhereClause *pWC, |
| 127549 | 128638 | Bitmask mUnusable, /* Ignore terms with these prereqs */ |
| 127550 | 128639 | struct SrcList_item *pSrc, |
| 127551 | | - ExprList *pOrderBy |
| 128640 | + ExprList *pOrderBy, |
| 128641 | + u16 *pmNoOmit /* Mask of terms not to omit */ |
| 127552 | 128642 | ){ |
| 127553 | 128643 | int i, j; |
| 127554 | 128644 | int nTerm; |
| 127555 | 128645 | struct sqlite3_index_constraint *pIdxCons; |
| 127556 | 128646 | struct sqlite3_index_orderby *pIdxOrderBy; |
| 127557 | 128647 | struct sqlite3_index_constraint_usage *pUsage; |
| 127558 | 128648 | WhereTerm *pTerm; |
| 127559 | 128649 | int nOrderBy; |
| 127560 | 128650 | sqlite3_index_info *pIdxInfo; |
| 128651 | + u16 mNoOmit = 0; |
| 127561 | 128652 | |
| 127562 | 128653 | /* Count the number of possible WHERE clause constraints referring |
| 127563 | 128654 | ** to this virtual table */ |
| 127564 | 128655 | for(i=nTerm=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){ |
| 127565 | 128656 | if( pTerm->leftCursor != pSrc->iCursor ) continue; |
| | @@ -127644,18 +128735,28 @@ |
| 127644 | 128735 | assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE ); |
| 127645 | 128736 | assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT ); |
| 127646 | 128737 | assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE ); |
| 127647 | 128738 | assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH ); |
| 127648 | 128739 | assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); |
| 128740 | + |
| 128741 | + if( op & (WO_LT|WO_LE|WO_GT|WO_GE) |
| 128742 | + && sqlite3ExprIsVector(pTerm->pExpr->pRight) |
| 128743 | + ){ |
| 128744 | + if( i<16 ) mNoOmit |= (1 << i); |
| 128745 | + if( op==WO_LT ) pIdxCons[j].op = WO_LE; |
| 128746 | + if( op==WO_GT ) pIdxCons[j].op = WO_GE; |
| 128747 | + } |
| 128748 | + |
| 127649 | 128749 | j++; |
| 127650 | 128750 | } |
| 127651 | 128751 | for(i=0; i<nOrderBy; i++){ |
| 127652 | 128752 | Expr *pExpr = pOrderBy->a[i].pExpr; |
| 127653 | 128753 | pIdxOrderBy[i].iColumn = pExpr->iColumn; |
| 127654 | 128754 | pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder; |
| 127655 | 128755 | } |
| 127656 | 128756 | |
| 128757 | + *pmNoOmit = mNoOmit; |
| 127657 | 128758 | return pIdxInfo; |
| 127658 | 128759 | } |
| 127659 | 128760 | |
| 127660 | 128761 | /* |
| 127661 | 128762 | ** The table object reference passed as the second argument to this function |
| | @@ -127927,11 +129028,11 @@ |
| 127927 | 129028 | |
| 127928 | 129029 | #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 |
| 127929 | 129030 | /* |
| 127930 | 129031 | ** Return the affinity for a single column of an index. |
| 127931 | 129032 | */ |
| 127932 | | -static char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){ |
| 129033 | +SQLITE_PRIVATE char sqlite3IndexColumnAffinity(sqlite3 *db, Index *pIdx, int iCol){ |
| 127933 | 129034 | assert( iCol>=0 && iCol<pIdx->nColumn ); |
| 127934 | 129035 | if( !pIdx->zColAff ){ |
| 127935 | 129036 | if( sqlite3IndexAffinityStr(db, pIdx)==0 ) return SQLITE_AFF_BLOB; |
| 127936 | 129037 | } |
| 127937 | 129038 | return pIdx->zColAff[iCol]; |
| | @@ -128104,11 +129205,12 @@ |
| 128104 | 129205 | |
| 128105 | 129206 | if( p->nSample>0 && nEq<p->nSampleCol ){ |
| 128106 | 129207 | if( nEq==pBuilder->nRecValid ){ |
| 128107 | 129208 | UnpackedRecord *pRec = pBuilder->pRec; |
| 128108 | 129209 | tRowcnt a[2]; |
| 128109 | | - u8 aff; |
| 129210 | + int nBtm = pLoop->u.btree.nBtm; |
| 129211 | + int nTop = pLoop->u.btree.nTop; |
| 128110 | 129212 | |
| 128111 | 129213 | /* Variable iLower will be set to the estimate of the number of rows in |
| 128112 | 129214 | ** the index that are less than the lower bound of the range query. The |
| 128113 | 129215 | ** lower bound being the concatenation of $P and $L, where $P is the |
| 128114 | 129216 | ** key-prefix formed by the nEq values matched against the nEq left-most |
| | @@ -128134,12 +129236,10 @@ |
| 128134 | 129236 | |
| 128135 | 129237 | if( pRec ){ |
| 128136 | 129238 | testcase( pRec->nField!=pBuilder->nRecValid ); |
| 128137 | 129239 | pRec->nField = pBuilder->nRecValid; |
| 128138 | 129240 | } |
| 128139 | | - aff = sqlite3IndexColumnAffinity(pParse->db, p, nEq); |
| 128140 | | - assert( nEq!=p->nKeyCol || aff==SQLITE_AFF_INTEGER ); |
| 128141 | 129241 | /* Determine iLower and iUpper using ($P) only. */ |
| 128142 | 129242 | if( nEq==0 ){ |
| 128143 | 129243 | iLower = 0; |
| 128144 | 129244 | iUpper = p->nRowEst0; |
| 128145 | 129245 | }else{ |
| | @@ -128154,36 +129254,41 @@ |
| 128154 | 129254 | assert( pUpper==0 || (pUpper->eOperator & (WO_LT|WO_LE))!=0 ); |
| 128155 | 129255 | assert( p->aSortOrder!=0 ); |
| 128156 | 129256 | if( p->aSortOrder[nEq] ){ |
| 128157 | 129257 | /* The roles of pLower and pUpper are swapped for a DESC index */ |
| 128158 | 129258 | SWAP(WhereTerm*, pLower, pUpper); |
| 129259 | + SWAP(int, nBtm, nTop); |
| 128159 | 129260 | } |
| 128160 | 129261 | |
| 128161 | 129262 | /* If possible, improve on the iLower estimate using ($P:$L). */ |
| 128162 | 129263 | if( pLower ){ |
| 128163 | | - int bOk; /* True if value is extracted from pExpr */ |
| 129264 | + int n; /* Values extracted from pExpr */ |
| 128164 | 129265 | Expr *pExpr = pLower->pExpr->pRight; |
| 128165 | | - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); |
| 128166 | | - if( rc==SQLITE_OK && bOk ){ |
| 129266 | + rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nBtm, nEq, &n); |
| 129267 | + if( rc==SQLITE_OK && n ){ |
| 128167 | 129268 | tRowcnt iNew; |
| 129269 | + u16 mask = WO_GT|WO_LE; |
| 129270 | + if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); |
| 128168 | 129271 | iLwrIdx = whereKeyStats(pParse, p, pRec, 0, a); |
| 128169 | | - iNew = a[0] + ((pLower->eOperator & (WO_GT|WO_LE)) ? a[1] : 0); |
| 129272 | + iNew = a[0] + ((pLower->eOperator & mask) ? a[1] : 0); |
| 128170 | 129273 | if( iNew>iLower ) iLower = iNew; |
| 128171 | 129274 | nOut--; |
| 128172 | 129275 | pLower = 0; |
| 128173 | 129276 | } |
| 128174 | 129277 | } |
| 128175 | 129278 | |
| 128176 | 129279 | /* If possible, improve on the iUpper estimate using ($P:$U). */ |
| 128177 | 129280 | if( pUpper ){ |
| 128178 | | - int bOk; /* True if value is extracted from pExpr */ |
| 129281 | + int n; /* Values extracted from pExpr */ |
| 128179 | 129282 | Expr *pExpr = pUpper->pExpr->pRight; |
| 128180 | | - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); |
| 128181 | | - if( rc==SQLITE_OK && bOk ){ |
| 129283 | + rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, nTop, nEq, &n); |
| 129284 | + if( rc==SQLITE_OK && n ){ |
| 128182 | 129285 | tRowcnt iNew; |
| 129286 | + u16 mask = WO_GT|WO_LE; |
| 129287 | + if( sqlite3ExprVectorSize(pExpr)>n ) mask = (WO_LE|WO_LT); |
| 128183 | 129288 | iUprIdx = whereKeyStats(pParse, p, pRec, 1, a); |
| 128184 | | - iNew = a[0] + ((pUpper->eOperator & (WO_GT|WO_LE)) ? a[1] : 0); |
| 129289 | + iNew = a[0] + ((pUpper->eOperator & mask) ? a[1] : 0); |
| 128185 | 129290 | if( iNew<iUpper ) iUpper = iNew; |
| 128186 | 129291 | nOut--; |
| 128187 | 129292 | pUpper = 0; |
| 128188 | 129293 | } |
| 128189 | 129294 | } |
| | @@ -128269,11 +129374,10 @@ |
| 128269 | 129374 | tRowcnt *pnRow /* Write the revised row estimate here */ |
| 128270 | 129375 | ){ |
| 128271 | 129376 | Index *p = pBuilder->pNew->u.btree.pIndex; |
| 128272 | 129377 | int nEq = pBuilder->pNew->u.btree.nEq; |
| 128273 | 129378 | UnpackedRecord *pRec = pBuilder->pRec; |
| 128274 | | - u8 aff; /* Column affinity */ |
| 128275 | 129379 | int rc; /* Subfunction return code */ |
| 128276 | 129380 | tRowcnt a[2]; /* Statistics */ |
| 128277 | 129381 | int bOk; |
| 128278 | 129382 | |
| 128279 | 129383 | assert( nEq>=1 ); |
| | @@ -128293,12 +129397,11 @@ |
| 128293 | 129397 | if( nEq>=p->nColumn ){ |
| 128294 | 129398 | *pnRow = 1; |
| 128295 | 129399 | return SQLITE_OK; |
| 128296 | 129400 | } |
| 128297 | 129401 | |
| 128298 | | - aff = sqlite3IndexColumnAffinity(pParse->db, p, nEq-1); |
| 128299 | | - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq-1, &bOk); |
| 129402 | + rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq-1, &bOk); |
| 128300 | 129403 | pBuilder->pRec = pRec; |
| 128301 | 129404 | if( rc!=SQLITE_OK ) return rc; |
| 128302 | 129405 | if( bOk==0 ) return SQLITE_NOTFOUND; |
| 128303 | 129406 | pBuilder->nRecValid = nEq; |
| 128304 | 129407 | |
| | @@ -128383,13 +129486,18 @@ |
| 128383 | 129486 | pTerm->u.pOrInfo->indexable); |
| 128384 | 129487 | }else{ |
| 128385 | 129488 | sqlite3_snprintf(sizeof(zLeft),zLeft,"left=%d", pTerm->leftCursor); |
| 128386 | 129489 | } |
| 128387 | 129490 | sqlite3DebugPrintf( |
| 128388 | | - "TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x\n", |
| 129491 | + "TERM-%-3d %p %s %-12s prob=%-3d op=0x%03x wtFlags=0x%04x", |
| 128389 | 129492 | iTerm, pTerm, zType, zLeft, pTerm->truthProb, |
| 128390 | 129493 | pTerm->eOperator, pTerm->wtFlags); |
| 129494 | + if( pTerm->iField ){ |
| 129495 | + sqlite3DebugPrintf(" iField=%d\n", pTerm->iField); |
| 129496 | + }else{ |
| 129497 | + sqlite3DebugPrintf("\n"); |
| 129498 | + } |
| 128391 | 129499 | sqlite3TreeViewExpr(0, pTerm->pExpr, 0); |
| 128392 | 129500 | } |
| 128393 | 129501 | } |
| 128394 | 129502 | #endif |
| 128395 | 129503 | |
| | @@ -128906,10 +130014,76 @@ |
| 128906 | 130014 | } |
| 128907 | 130015 | } |
| 128908 | 130016 | } |
| 128909 | 130017 | if( pLoop->nOut > nRow-iReduce ) pLoop->nOut = nRow - iReduce; |
| 128910 | 130018 | } |
| 130019 | + |
| 130020 | +/* |
| 130021 | +** Term pTerm is a vector range comparison operation. The first comparison |
| 130022 | +** in the vector can be optimized using column nEq of the index. This |
| 130023 | +** function returns the total number of vector elements that can be used |
| 130024 | +** as part of the range comparison. |
| 130025 | +** |
| 130026 | +** For example, if the query is: |
| 130027 | +** |
| 130028 | +** WHERE a = ? AND (b, c, d) > (?, ?, ?) |
| 130029 | +** |
| 130030 | +** and the index: |
| 130031 | +** |
| 130032 | +** CREATE INDEX ... ON (a, b, c, d, e) |
| 130033 | +** |
| 130034 | +** then this function would be invoked with nEq=1. The value returned in |
| 130035 | +** this case is 3. |
| 130036 | +*/ |
| 130037 | +int whereRangeVectorLen( |
| 130038 | + Parse *pParse, /* Parsing context */ |
| 130039 | + int iCur, /* Cursor open on pIdx */ |
| 130040 | + Index *pIdx, /* The index to be used for a inequality constraint */ |
| 130041 | + int nEq, /* Number of prior equality constraints on same index */ |
| 130042 | + WhereTerm *pTerm /* The vector inequality constraint */ |
| 130043 | +){ |
| 130044 | + int nCmp = sqlite3ExprVectorSize(pTerm->pExpr->pLeft); |
| 130045 | + int i; |
| 130046 | + |
| 130047 | + nCmp = MIN(nCmp, (pIdx->nColumn - nEq)); |
| 130048 | + for(i=1; i<nCmp; i++){ |
| 130049 | + /* Test if comparison i of pTerm is compatible with column (i+nEq) |
| 130050 | + ** of the index. If not, exit the loop. */ |
| 130051 | + char aff; /* Comparison affinity */ |
| 130052 | + char idxaff = 0; /* Indexed columns affinity */ |
| 130053 | + CollSeq *pColl; /* Comparison collation sequence */ |
| 130054 | + Expr *pLhs = pTerm->pExpr->pLeft->x.pList->a[i].pExpr; |
| 130055 | + Expr *pRhs = pTerm->pExpr->pRight; |
| 130056 | + if( pRhs->flags & EP_xIsSelect ){ |
| 130057 | + pRhs = pRhs->x.pSelect->pEList->a[i].pExpr; |
| 130058 | + }else{ |
| 130059 | + pRhs = pRhs->x.pList->a[i].pExpr; |
| 130060 | + } |
| 130061 | + |
| 130062 | + /* Check that the LHS of the comparison is a column reference to |
| 130063 | + ** the right column of the right source table. And that the sort |
| 130064 | + ** order of the index column is the same as the sort order of the |
| 130065 | + ** leftmost index column. */ |
| 130066 | + if( pLhs->op!=TK_COLUMN |
| 130067 | + || pLhs->iTable!=iCur |
| 130068 | + || pLhs->iColumn!=pIdx->aiColumn[i+nEq] |
| 130069 | + || pIdx->aSortOrder[i+nEq]!=pIdx->aSortOrder[nEq] |
| 130070 | + ){ |
| 130071 | + break; |
| 130072 | + } |
| 130073 | + |
| 130074 | + testcase( pLhs->iColumn==XN_ROWID ); |
| 130075 | + aff = sqlite3CompareAffinity(pRhs, sqlite3ExprAffinity(pLhs)); |
| 130076 | + idxaff = sqlite3TableColumnAffinity(pIdx->pTable, pLhs->iColumn); |
| 130077 | + if( aff!=idxaff ) break; |
| 130078 | + |
| 130079 | + pColl = sqlite3BinaryCompareCollSeq(pParse, pLhs, pRhs); |
| 130080 | + if( pColl==0 ) break; |
| 130081 | + if( sqlite3StrICmp(pColl->zName, pIdx->azColl[i+nEq]) ) break; |
| 130082 | + } |
| 130083 | + return i; |
| 130084 | +} |
| 128911 | 130085 | |
| 128912 | 130086 | /* |
| 128913 | 130087 | ** Adjust the cost C by the costMult facter T. This only occurs if |
| 128914 | 130088 | ** compiled with -DSQLITE_ENABLE_COSTMULT |
| 128915 | 130089 | */ |
| | @@ -128945,10 +130119,12 @@ |
| 128945 | 130119 | int opMask; /* Valid operators for constraints */ |
| 128946 | 130120 | WhereScan scan; /* Iterator for WHERE terms */ |
| 128947 | 130121 | Bitmask saved_prereq; /* Original value of pNew->prereq */ |
| 128948 | 130122 | u16 saved_nLTerm; /* Original value of pNew->nLTerm */ |
| 128949 | 130123 | u16 saved_nEq; /* Original value of pNew->u.btree.nEq */ |
| 130124 | + u16 saved_nBtm; /* Original value of pNew->u.btree.nBtm */ |
| 130125 | + u16 saved_nTop; /* Original value of pNew->u.btree.nTop */ |
| 128950 | 130126 | u16 saved_nSkip; /* Original value of pNew->nSkip */ |
| 128951 | 130127 | u32 saved_wsFlags; /* Original value of pNew->wsFlags */ |
| 128952 | 130128 | LogEst saved_nOut; /* Original value of pNew->nOut */ |
| 128953 | 130129 | int rc = SQLITE_OK; /* Return code */ |
| 128954 | 130130 | LogEst rSize; /* Number of rows in the table */ |
| | @@ -128961,17 +130137,20 @@ |
| 128961 | 130137 | assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 ); |
| 128962 | 130138 | assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 ); |
| 128963 | 130139 | if( pNew->wsFlags & WHERE_BTM_LIMIT ){ |
| 128964 | 130140 | opMask = WO_LT|WO_LE; |
| 128965 | 130141 | }else{ |
| 130142 | + assert( pNew->u.btree.nBtm==0 ); |
| 128966 | 130143 | opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE|WO_ISNULL|WO_IS; |
| 128967 | 130144 | } |
| 128968 | 130145 | if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); |
| 128969 | 130146 | |
| 128970 | 130147 | assert( pNew->u.btree.nEq<pProbe->nColumn ); |
| 128971 | 130148 | |
| 128972 | 130149 | saved_nEq = pNew->u.btree.nEq; |
| 130150 | + saved_nBtm = pNew->u.btree.nBtm; |
| 130151 | + saved_nTop = pNew->u.btree.nTop; |
| 128973 | 130152 | saved_nSkip = pNew->nSkip; |
| 128974 | 130153 | saved_nLTerm = pNew->nLTerm; |
| 128975 | 130154 | saved_wsFlags = pNew->wsFlags; |
| 128976 | 130155 | saved_prereq = pNew->prereq; |
| 128977 | 130156 | saved_nOut = pNew->nOut; |
| | @@ -129011,10 +130190,12 @@ |
| 129011 | 130190 | continue; |
| 129012 | 130191 | } |
| 129013 | 130192 | |
| 129014 | 130193 | pNew->wsFlags = saved_wsFlags; |
| 129015 | 130194 | pNew->u.btree.nEq = saved_nEq; |
| 130195 | + pNew->u.btree.nBtm = saved_nBtm; |
| 130196 | + pNew->u.btree.nTop = saved_nTop; |
| 129016 | 130197 | pNew->nLTerm = saved_nLTerm; |
| 129017 | 130198 | if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */ |
| 129018 | 130199 | pNew->aLTerm[pNew->nLTerm++] = pTerm; |
| 129019 | 130200 | pNew->prereq = (saved_prereq | pTerm->prereqRight) & ~pNew->maskSelf; |
| 129020 | 130201 | |
| | @@ -129027,18 +130208,27 @@ |
| 129027 | 130208 | if( eOp & WO_IN ){ |
| 129028 | 130209 | Expr *pExpr = pTerm->pExpr; |
| 129029 | 130210 | pNew->wsFlags |= WHERE_COLUMN_IN; |
| 129030 | 130211 | if( ExprHasProperty(pExpr, EP_xIsSelect) ){ |
| 129031 | 130212 | /* "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows */ |
| 130213 | + int i; |
| 129032 | 130214 | nIn = 46; assert( 46==sqlite3LogEst(25) ); |
| 130215 | + |
| 130216 | + /* The expression may actually be of the form (x, y) IN (SELECT...). |
| 130217 | + ** In this case there is a separate term for each of (x) and (y). |
| 130218 | + ** However, the nIn multiplier should only be applied once, not once |
| 130219 | + ** for each such term. The following loop checks that pTerm is the |
| 130220 | + ** first such term in use, and sets nIn back to 0 if it is not. */ |
| 130221 | + for(i=0; i<pNew->nLTerm-1; i++){ |
| 130222 | + if( pNew->aLTerm[i]->pExpr==pExpr ) nIn = 0; |
| 130223 | + } |
| 129033 | 130224 | }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){ |
| 129034 | 130225 | /* "x IN (value, value, ...)" */ |
| 129035 | 130226 | nIn = sqlite3LogEst(pExpr->x.pList->nExpr); |
| 130227 | + assert( nIn>0 ); /* RHS always has 2 or more terms... The parser |
| 130228 | + ** changes "x IN (?)" into "x=?". */ |
| 129036 | 130229 | } |
| 129037 | | - assert( nIn>0 ); /* RHS always has 2 or more terms... The parser |
| 129038 | | - ** changes "x IN (?)" into "x=?". */ |
| 129039 | | - |
| 129040 | 130230 | }else if( eOp & (WO_EQ|WO_IS) ){ |
| 129041 | 130231 | int iCol = pProbe->aiColumn[saved_nEq]; |
| 129042 | 130232 | pNew->wsFlags |= WHERE_COLUMN_EQ; |
| 129043 | 130233 | assert( saved_nEq==pNew->u.btree.nEq ); |
| 129044 | 130234 | if( iCol==XN_ROWID |
| | @@ -129054,10 +130244,13 @@ |
| 129054 | 130244 | pNew->wsFlags |= WHERE_COLUMN_NULL; |
| 129055 | 130245 | }else if( eOp & (WO_GT|WO_GE) ){ |
| 129056 | 130246 | testcase( eOp & WO_GT ); |
| 129057 | 130247 | testcase( eOp & WO_GE ); |
| 129058 | 130248 | pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT; |
| 130249 | + pNew->u.btree.nBtm = whereRangeVectorLen( |
| 130250 | + pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm |
| 130251 | + ); |
| 129059 | 130252 | pBtm = pTerm; |
| 129060 | 130253 | pTop = 0; |
| 129061 | 130254 | if( pTerm->wtFlags & TERM_LIKEOPT ){ |
| 129062 | 130255 | /* Range contraints that come from the LIKE optimization are |
| 129063 | 130256 | ** always used in pairs. */ |
| | @@ -129066,16 +130259,20 @@ |
| 129066 | 130259 | assert( pTop->wtFlags & TERM_LIKEOPT ); |
| 129067 | 130260 | assert( pTop->eOperator==WO_LT ); |
| 129068 | 130261 | if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */ |
| 129069 | 130262 | pNew->aLTerm[pNew->nLTerm++] = pTop; |
| 129070 | 130263 | pNew->wsFlags |= WHERE_TOP_LIMIT; |
| 130264 | + pNew->u.btree.nTop = 1; |
| 129071 | 130265 | } |
| 129072 | 130266 | }else{ |
| 129073 | 130267 | assert( eOp & (WO_LT|WO_LE) ); |
| 129074 | 130268 | testcase( eOp & WO_LT ); |
| 129075 | 130269 | testcase( eOp & WO_LE ); |
| 129076 | 130270 | pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT; |
| 130271 | + pNew->u.btree.nTop = whereRangeVectorLen( |
| 130272 | + pParse, pSrc->iCursor, pProbe, saved_nEq, pTerm |
| 130273 | + ); |
| 129077 | 130274 | pTop = pTerm; |
| 129078 | 130275 | pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ? |
| 129079 | 130276 | pNew->aLTerm[pNew->nLTerm-2] : 0; |
| 129080 | 130277 | } |
| 129081 | 130278 | |
| | @@ -129171,10 +130368,12 @@ |
| 129171 | 130368 | pBuilder->nRecValid = nRecValid; |
| 129172 | 130369 | #endif |
| 129173 | 130370 | } |
| 129174 | 130371 | pNew->prereq = saved_prereq; |
| 129175 | 130372 | pNew->u.btree.nEq = saved_nEq; |
| 130373 | + pNew->u.btree.nBtm = saved_nBtm; |
| 130374 | + pNew->u.btree.nTop = saved_nTop; |
| 129176 | 130375 | pNew->nSkip = saved_nSkip; |
| 129177 | 130376 | pNew->wsFlags = saved_wsFlags; |
| 129178 | 130377 | pNew->nOut = saved_nOut; |
| 129179 | 130378 | pNew->nLTerm = saved_nLTerm; |
| 129180 | 130379 | |
| | @@ -129292,11 +130491,11 @@ |
| 129292 | 130491 | return 0; |
| 129293 | 130492 | } |
| 129294 | 130493 | |
| 129295 | 130494 | /* |
| 129296 | 130495 | ** Add all WhereLoop objects for a single table of the join where the table |
| 129297 | | -** is idenfied by pBuilder->pNew->iTab. That table is guaranteed to be |
| 130496 | +** is identified by pBuilder->pNew->iTab. That table is guaranteed to be |
| 129298 | 130497 | ** a b-tree table, not a virtual table. |
| 129299 | 130498 | ** |
| 129300 | 130499 | ** The costs (WhereLoop.rRun) of the b-tree loops added by this function |
| 129301 | 130500 | ** are calculated as follows: |
| 129302 | 130501 | ** |
| | @@ -129446,10 +130645,12 @@ |
| 129446 | 130645 | testcase( pNew->iTab!=pSrc->iCursor ); /* See ticket [98d973b8f5] */ |
| 129447 | 130646 | continue; /* Partial index inappropriate for this query */ |
| 129448 | 130647 | } |
| 129449 | 130648 | rSize = pProbe->aiRowLogEst[0]; |
| 129450 | 130649 | pNew->u.btree.nEq = 0; |
| 130650 | + pNew->u.btree.nBtm = 0; |
| 130651 | + pNew->u.btree.nTop = 0; |
| 129451 | 130652 | pNew->nSkip = 0; |
| 129452 | 130653 | pNew->nLTerm = 0; |
| 129453 | 130654 | pNew->iSortIdx = 0; |
| 129454 | 130655 | pNew->rSetup = 0; |
| 129455 | 130656 | pNew->prereq = mPrereq; |
| | @@ -129574,10 +130775,11 @@ |
| 129574 | 130775 | WhereLoopBuilder *pBuilder, |
| 129575 | 130776 | Bitmask mPrereq, /* Mask of tables that must be used. */ |
| 129576 | 130777 | Bitmask mUsable, /* Mask of usable tables */ |
| 129577 | 130778 | u16 mExclude, /* Exclude terms using these operators */ |
| 129578 | 130779 | sqlite3_index_info *pIdxInfo, /* Populated object for xBestIndex */ |
| 130780 | + u16 mNoOmit, /* Do not omit these constraints */ |
| 129579 | 130781 | int *pbIn /* OUT: True if plan uses an IN(...) op */ |
| 129580 | 130782 | ){ |
| 129581 | 130783 | WhereClause *pWC = pBuilder->pWC; |
| 129582 | 130784 | struct sqlite3_index_constraint *pIdxCons; |
| 129583 | 130785 | struct sqlite3_index_constraint_usage *pUsage = pIdxInfo->aConstraintUsage; |
| | @@ -129662,10 +130864,11 @@ |
| 129662 | 130864 | pIdxInfo->idxFlags &= ~SQLITE_INDEX_SCAN_UNIQUE; |
| 129663 | 130865 | *pbIn = 1; assert( (mExclude & WO_IN)==0 ); |
| 129664 | 130866 | } |
| 129665 | 130867 | } |
| 129666 | 130868 | } |
| 130869 | + pNew->u.vtab.omitMask &= ~mNoOmit; |
| 129667 | 130870 | |
| 129668 | 130871 | pNew->nLTerm = mxTerm+1; |
| 129669 | 130872 | assert( pNew->nLTerm<=pNew->nLSlot ); |
| 129670 | 130873 | pNew->u.vtab.idxNum = pIdxInfo->idxNum; |
| 129671 | 130874 | pNew->u.vtab.needFree = pIdxInfo->needToFreeIdxStr; |
| | @@ -129735,19 +130938,21 @@ |
| 129735 | 130938 | sqlite3_index_info *p; /* Object to pass to xBestIndex() */ |
| 129736 | 130939 | int nConstraint; /* Number of constraints in p */ |
| 129737 | 130940 | int bIn; /* True if plan uses IN(...) operator */ |
| 129738 | 130941 | WhereLoop *pNew; |
| 129739 | 130942 | Bitmask mBest; /* Tables used by best possible plan */ |
| 130943 | + u16 mNoOmit; |
| 129740 | 130944 | |
| 129741 | 130945 | assert( (mPrereq & mUnusable)==0 ); |
| 129742 | 130946 | pWInfo = pBuilder->pWInfo; |
| 129743 | 130947 | pParse = pWInfo->pParse; |
| 129744 | 130948 | pWC = pBuilder->pWC; |
| 129745 | 130949 | pNew = pBuilder->pNew; |
| 129746 | 130950 | pSrc = &pWInfo->pTabList->a[pNew->iTab]; |
| 129747 | 130951 | assert( IsVirtual(pSrc->pTab) ); |
| 129748 | | - p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy); |
| 130952 | + p = allocateIndexInfo(pParse, pWC, mUnusable, pSrc, pBuilder->pOrderBy, |
| 130953 | + &mNoOmit); |
| 129749 | 130954 | if( p==0 ) return SQLITE_NOMEM_BKPT; |
| 129750 | 130955 | pNew->rSetup = 0; |
| 129751 | 130956 | pNew->wsFlags = WHERE_VIRTUALTABLE; |
| 129752 | 130957 | pNew->nLTerm = 0; |
| 129753 | 130958 | pNew->u.vtab.needFree = 0; |
| | @@ -129757,11 +130962,11 @@ |
| 129757 | 130962 | return SQLITE_NOMEM_BKPT; |
| 129758 | 130963 | } |
| 129759 | 130964 | |
| 129760 | 130965 | /* First call xBestIndex() with all constraints usable. */ |
| 129761 | 130966 | WHERETRACE(0x40, (" VirtualOne: all usable\n")); |
| 129762 | | - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, &bIn); |
| 130967 | + rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, 0, p, mNoOmit, &bIn); |
| 129763 | 130968 | |
| 129764 | 130969 | /* If the call to xBestIndex() with all terms enabled produced a plan |
| 129765 | 130970 | ** that does not require any source tables (IOW: a plan with mBest==0), |
| 129766 | 130971 | ** then there is no point in making any further calls to xBestIndex() |
| 129767 | 130972 | ** since they will all return the same result (if the xBestIndex() |
| | @@ -129774,11 +130979,12 @@ |
| 129774 | 130979 | |
| 129775 | 130980 | /* If the plan produced by the earlier call uses an IN(...) term, call |
| 129776 | 130981 | ** xBestIndex again, this time with IN(...) terms disabled. */ |
| 129777 | 130982 | if( bIn ){ |
| 129778 | 130983 | WHERETRACE(0x40, (" VirtualOne: all usable w/o IN\n")); |
| 129779 | | - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, ALLBITS, WO_IN, p, &bIn); |
| 130984 | + rc = whereLoopAddVirtualOne( |
| 130985 | + pBuilder, mPrereq, ALLBITS, WO_IN, p, mNoOmit, &bIn); |
| 129780 | 130986 | assert( bIn==0 ); |
| 129781 | 130987 | mBestNoIn = pNew->prereq & ~mPrereq; |
| 129782 | 130988 | if( mBestNoIn==0 ){ |
| 129783 | 130989 | seenZero = 1; |
| 129784 | 130990 | seenZeroNoIN = 1; |
| | @@ -129800,11 +131006,12 @@ |
| 129800 | 131006 | mPrev = mNext; |
| 129801 | 131007 | if( mNext==ALLBITS ) break; |
| 129802 | 131008 | if( mNext==mBest || mNext==mBestNoIn ) continue; |
| 129803 | 131009 | WHERETRACE(0x40, (" VirtualOne: mPrev=%04llx mNext=%04llx\n", |
| 129804 | 131010 | (sqlite3_uint64)mPrev, (sqlite3_uint64)mNext)); |
| 129805 | | - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, mNext|mPrereq, 0, p, &bIn); |
| 131011 | + rc = whereLoopAddVirtualOne( |
| 131012 | + pBuilder, mPrereq, mNext|mPrereq, 0, p, mNoOmit, &bIn); |
| 129806 | 131013 | if( pNew->prereq==mPrereq ){ |
| 129807 | 131014 | seenZero = 1; |
| 129808 | 131015 | if( bIn==0 ) seenZeroNoIN = 1; |
| 129809 | 131016 | } |
| 129810 | 131017 | } |
| | @@ -129812,20 +131019,22 @@ |
| 129812 | 131019 | /* If the calls to xBestIndex() in the above loop did not find a plan |
| 129813 | 131020 | ** that requires no source tables at all (i.e. one guaranteed to be |
| 129814 | 131021 | ** usable), make a call here with all source tables disabled */ |
| 129815 | 131022 | if( rc==SQLITE_OK && seenZero==0 ){ |
| 129816 | 131023 | WHERETRACE(0x40, (" VirtualOne: all disabled\n")); |
| 129817 | | - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, mPrereq, 0, p, &bIn); |
| 131024 | + rc = whereLoopAddVirtualOne( |
| 131025 | + pBuilder, mPrereq, mPrereq, 0, p, mNoOmit, &bIn); |
| 129818 | 131026 | if( bIn==0 ) seenZeroNoIN = 1; |
| 129819 | 131027 | } |
| 129820 | 131028 | |
| 129821 | 131029 | /* If the calls to xBestIndex() have so far failed to find a plan |
| 129822 | 131030 | ** that requires no source tables at all and does not use an IN(...) |
| 129823 | 131031 | ** operator, make a final call to obtain one here. */ |
| 129824 | 131032 | if( rc==SQLITE_OK && seenZeroNoIN==0 ){ |
| 129825 | 131033 | WHERETRACE(0x40, (" VirtualOne: all disabled and w/o IN\n")); |
| 129826 | | - rc = whereLoopAddVirtualOne(pBuilder, mPrereq, mPrereq, WO_IN, p, &bIn); |
| 131034 | + rc = whereLoopAddVirtualOne( |
| 131035 | + pBuilder, mPrereq, mPrereq, WO_IN, p, mNoOmit, &bIn); |
| 129827 | 131036 | } |
| 129828 | 131037 | } |
| 129829 | 131038 | |
| 129830 | 131039 | if( p->needToFreeIdxStr ) sqlite3_free(p->idxStr); |
| 129831 | 131040 | sqlite3DbFree(pParse->db, p); |
| | @@ -130121,10 +131330,18 @@ |
| 130121 | 131330 | if( pOBExpr->op!=TK_COLUMN ) continue; |
| 130122 | 131331 | if( pOBExpr->iTable!=iCur ) continue; |
| 130123 | 131332 | pTerm = sqlite3WhereFindTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, |
| 130124 | 131333 | ~ready, eqOpMask, 0); |
| 130125 | 131334 | if( pTerm==0 ) continue; |
| 131335 | + if( pTerm->eOperator==WO_IN ){ |
| 131336 | + /* IN terms are only valid for sorting in the ORDER BY LIMIT |
| 131337 | + ** optimization, and then only if they are actually used |
| 131338 | + ** by the query plan */ |
| 131339 | + assert( wctrlFlags & WHERE_ORDERBY_LIMIT ); |
| 131340 | + for(j=0; j<pLoop->nLTerm && pTerm!=pLoop->aLTerm[j]; j++){} |
| 131341 | + if( j>=pLoop->nLTerm ) continue; |
| 131342 | + } |
| 130126 | 131343 | if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){ |
| 130127 | 131344 | const char *z1, *z2; |
| 130128 | 131345 | pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); |
| 130129 | 131346 | if( !pColl ) pColl = db->pDfltColl; |
| 130130 | 131347 | z1 = pColl->zName; |
| | @@ -130157,24 +131374,46 @@ |
| 130157 | 131374 | ** that are not constrained by == or IN. |
| 130158 | 131375 | */ |
| 130159 | 131376 | rev = revSet = 0; |
| 130160 | 131377 | distinctColumns = 0; |
| 130161 | 131378 | for(j=0; j<nColumn; j++){ |
| 130162 | | - u8 bOnce; /* True to run the ORDER BY search loop */ |
| 130163 | | - |
| 130164 | | - /* Skip over == and IS and ISNULL terms. |
| 130165 | | - ** (Also skip IN terms when doing WHERE_ORDERBY_LIMIT processing) |
| 130166 | | - */ |
| 130167 | | - if( j<pLoop->u.btree.nEq |
| 130168 | | - && pLoop->nSkip==0 |
| 130169 | | - && ((i = pLoop->aLTerm[j]->eOperator) & eqOpMask)!=0 |
| 130170 | | - ){ |
| 130171 | | - if( i & WO_ISNULL ){ |
| 130172 | | - testcase( isOrderDistinct ); |
| 130173 | | - isOrderDistinct = 0; |
| 130174 | | - } |
| 130175 | | - continue; |
| 131379 | + u8 bOnce = 1; /* True to run the ORDER BY search loop */ |
| 131380 | + |
| 131381 | + assert( j>=pLoop->u.btree.nEq |
| 131382 | + || (pLoop->aLTerm[j]==0)==(j<pLoop->nSkip) |
| 131383 | + ); |
| 131384 | + if( j<pLoop->u.btree.nEq && j>=pLoop->nSkip ){ |
| 131385 | + u16 eOp = pLoop->aLTerm[j]->eOperator; |
| 131386 | + |
| 131387 | + /* Skip over == and IS and ISNULL terms. (Also skip IN terms when |
| 131388 | + ** doing WHERE_ORDERBY_LIMIT processing). |
| 131389 | + ** |
| 131390 | + ** If the current term is a column of an ((?,?) IN (SELECT...)) |
| 131391 | + ** expression for which the SELECT returns more than one column, |
| 131392 | + ** check that it is the only column used by this loop. Otherwise, |
| 131393 | + ** if it is one of two or more, none of the columns can be |
| 131394 | + ** considered to match an ORDER BY term. */ |
| 131395 | + if( (eOp & eqOpMask)!=0 ){ |
| 131396 | + if( eOp & WO_ISNULL ){ |
| 131397 | + testcase( isOrderDistinct ); |
| 131398 | + isOrderDistinct = 0; |
| 131399 | + } |
| 131400 | + continue; |
| 131401 | + }else if( ALWAYS(eOp & WO_IN) ){ |
| 131402 | + /* ALWAYS() justification: eOp is an equality operator due to the |
| 131403 | + ** j<pLoop->u.btree.nEq constraint above. Any equality other |
| 131404 | + ** than WO_IN is captured by the previous "if". So this one |
| 131405 | + ** always has to be WO_IN. */ |
| 131406 | + Expr *pX = pLoop->aLTerm[j]->pExpr; |
| 131407 | + for(i=j+1; i<pLoop->u.btree.nEq; i++){ |
| 131408 | + if( pLoop->aLTerm[i]->pExpr==pX ){ |
| 131409 | + assert( (pLoop->aLTerm[i]->eOperator & WO_IN) ); |
| 131410 | + bOnce = 0; |
| 131411 | + break; |
| 131412 | + } |
| 131413 | + } |
| 131414 | + } |
| 130176 | 131415 | } |
| 130177 | 131416 | |
| 130178 | 131417 | /* Get the column number in the table (iColumn) and sort order |
| 130179 | 131418 | ** (revIdx) for the j-th column of the index. |
| 130180 | 131419 | */ |
| | @@ -130199,11 +131438,10 @@ |
| 130199 | 131438 | } |
| 130200 | 131439 | |
| 130201 | 131440 | /* Find the ORDER BY term that corresponds to the j-th column |
| 130202 | 131441 | ** of the index and mark that ORDER BY term off |
| 130203 | 131442 | */ |
| 130204 | | - bOnce = 1; |
| 130205 | 131443 | isMatch = 0; |
| 130206 | 131444 | for(i=0; bOnce && i<nOrderBy; i++){ |
| 130207 | 131445 | if( MASKBIT(i) & obSat ) continue; |
| 130208 | 131446 | pOBExpr = sqlite3ExprSkipCollate(pOrderBy->a[i].pExpr); |
| 130209 | 131447 | testcase( wctrlFlags & WHERE_GROUPBY ); |
| | @@ -131393,14 +132631,16 @@ |
| 131393 | 132631 | struct InLoop *pIn; |
| 131394 | 132632 | int j; |
| 131395 | 132633 | sqlite3VdbeResolveLabel(v, pLevel->addrNxt); |
| 131396 | 132634 | for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){ |
| 131397 | 132635 | sqlite3VdbeJumpHere(v, pIn->addrInTop+1); |
| 131398 | | - sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop); |
| 131399 | | - VdbeCoverage(v); |
| 131400 | | - VdbeCoverageIf(v, pIn->eEndLoopOp==OP_PrevIfOpen); |
| 131401 | | - VdbeCoverageIf(v, pIn->eEndLoopOp==OP_NextIfOpen); |
| 132636 | + if( pIn->eEndLoopOp!=OP_Noop ){ |
| 132637 | + sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop); |
| 132638 | + VdbeCoverage(v); |
| 132639 | + VdbeCoverageIf(v, pIn->eEndLoopOp==OP_PrevIfOpen); |
| 132640 | + VdbeCoverageIf(v, pIn->eEndLoopOp==OP_NextIfOpen); |
| 132641 | + } |
| 131402 | 132642 | sqlite3VdbeJumpHere(v, pIn->addrInTop-1); |
| 131403 | 132643 | } |
| 131404 | 132644 | } |
| 131405 | 132645 | sqlite3VdbeResolveLabel(v, pLevel->addrBrk); |
| 131406 | 132646 | if( pLevel->addrSkip ){ |
| | @@ -131843,20 +133083,20 @@ |
| 131843 | 133083 | #define sqlite3ParserARG_SDECL Parse *pParse; |
| 131844 | 133084 | #define sqlite3ParserARG_PDECL ,Parse *pParse |
| 131845 | 133085 | #define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse |
| 131846 | 133086 | #define sqlite3ParserARG_STORE yypParser->pParse = pParse |
| 131847 | 133087 | #define YYFALLBACK 1 |
| 131848 | | -#define YYNSTATE 443 |
| 131849 | | -#define YYNRULE 328 |
| 131850 | | -#define YY_MAX_SHIFT 442 |
| 131851 | | -#define YY_MIN_SHIFTREDUCE 653 |
| 131852 | | -#define YY_MAX_SHIFTREDUCE 980 |
| 131853 | | -#define YY_MIN_REDUCE 981 |
| 131854 | | -#define YY_MAX_REDUCE 1308 |
| 131855 | | -#define YY_ERROR_ACTION 1309 |
| 131856 | | -#define YY_ACCEPT_ACTION 1310 |
| 131857 | | -#define YY_NO_ACTION 1311 |
| 133088 | +#define YYNSTATE 456 |
| 133089 | +#define YYNRULE 331 |
| 133090 | +#define YY_MAX_SHIFT 455 |
| 133091 | +#define YY_MIN_SHIFTREDUCE 667 |
| 133092 | +#define YY_MAX_SHIFTREDUCE 997 |
| 133093 | +#define YY_MIN_REDUCE 998 |
| 133094 | +#define YY_MAX_REDUCE 1328 |
| 133095 | +#define YY_ERROR_ACTION 1329 |
| 133096 | +#define YY_ACCEPT_ACTION 1330 |
| 133097 | +#define YY_NO_ACTION 1331 |
| 131858 | 133098 | /************* End control #defines *******************************************/ |
| 131859 | 133099 | |
| 131860 | 133100 | /* Define the yytestcase() macro to be a no-op if is not already defined |
| 131861 | 133101 | ** otherwise. |
| 131862 | 133102 | ** |
| | @@ -131924,163 +133164,170 @@ |
| 131924 | 133164 | ** yy_reduce_ofst[] For each state, the offset into yy_action for |
| 131925 | 133165 | ** shifting non-terminals after a reduce. |
| 131926 | 133166 | ** yy_default[] Default action for each state. |
| 131927 | 133167 | ** |
| 131928 | 133168 | *********** Begin parsing tables **********************************************/ |
| 131929 | | -#define YY_ACTTAB_COUNT (1507) |
| 133169 | +#define YY_ACTTAB_COUNT (1571) |
| 131930 | 133170 | static const YYACTIONTYPE yy_action[] = { |
| 131931 | | - /* 0 */ 317, 814, 341, 808, 5, 195, 195, 802, 93, 94, |
| 131932 | | - /* 10 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, |
| 131933 | | - /* 20 */ 92, 92, 92, 293, 90, 90, 90, 90, 89, 89, |
| 131934 | | - /* 30 */ 88, 88, 88, 87, 341, 317, 958, 958, 807, 807, |
| 131935 | | - /* 40 */ 807, 928, 344, 93, 94, 84, 823, 823, 835, 838, |
| 131936 | | - /* 50 */ 827, 827, 91, 91, 92, 92, 92, 92, 328, 90, |
| 131937 | | - /* 60 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, |
| 131938 | | - /* 70 */ 89, 89, 88, 88, 88, 87, 341, 776, 958, 958, |
| 131939 | | - /* 80 */ 317, 88, 88, 88, 87, 341, 777, 69, 93, 94, |
| 131940 | | - /* 90 */ 84, 823, 823, 835, 838, 827, 827, 91, 91, 92, |
| 131941 | | - /* 100 */ 92, 92, 92, 437, 90, 90, 90, 90, 89, 89, |
| 131942 | | - /* 110 */ 88, 88, 88, 87, 341, 1310, 147, 147, 2, 317, |
| 131943 | | - /* 120 */ 76, 25, 74, 49, 49, 87, 341, 93, 94, 84, |
| 131944 | | - /* 130 */ 823, 823, 835, 838, 827, 827, 91, 91, 92, 92, |
| 131945 | | - /* 140 */ 92, 92, 95, 90, 90, 90, 90, 89, 89, 88, |
| 131946 | | - /* 150 */ 88, 88, 87, 341, 939, 939, 317, 260, 415, 400, |
| 131947 | | - /* 160 */ 398, 58, 737, 737, 93, 94, 84, 823, 823, 835, |
| 131948 | | - /* 170 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 57, |
| 131949 | | - /* 180 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131950 | | - /* 190 */ 341, 317, 1253, 928, 344, 269, 940, 941, 242, 93, |
| 131951 | | - /* 200 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131952 | | - /* 210 */ 92, 92, 92, 92, 293, 90, 90, 90, 90, 89, |
| 131953 | | - /* 220 */ 89, 88, 88, 88, 87, 341, 317, 919, 1303, 793, |
| 131954 | | - /* 230 */ 691, 1303, 724, 724, 93, 94, 84, 823, 823, 835, |
| 131955 | | - /* 240 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 337, |
| 131956 | | - /* 250 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131957 | | - /* 260 */ 341, 317, 114, 919, 1304, 684, 395, 1304, 124, 93, |
| 131958 | | - /* 270 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131959 | | - /* 280 */ 92, 92, 92, 92, 683, 90, 90, 90, 90, 89, |
| 131960 | | - /* 290 */ 89, 88, 88, 88, 87, 341, 317, 86, 83, 169, |
| 131961 | | - /* 300 */ 801, 917, 234, 399, 93, 94, 84, 823, 823, 835, |
| 131962 | | - /* 310 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 686, |
| 131963 | | - /* 320 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131964 | | - /* 330 */ 341, 317, 436, 742, 86, 83, 169, 917, 741, 93, |
| 131965 | | - /* 340 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131966 | | - /* 350 */ 92, 92, 92, 92, 902, 90, 90, 90, 90, 89, |
| 131967 | | - /* 360 */ 89, 88, 88, 88, 87, 341, 317, 321, 434, 434, |
| 131968 | | - /* 370 */ 434, 1, 722, 722, 93, 94, 84, 823, 823, 835, |
| 131969 | | - /* 380 */ 838, 827, 827, 91, 91, 92, 92, 92, 92, 190, |
| 131970 | | - /* 390 */ 90, 90, 90, 90, 89, 89, 88, 88, 88, 87, |
| 131971 | | - /* 400 */ 341, 317, 685, 292, 939, 939, 150, 977, 310, 93, |
| 131972 | | - /* 410 */ 94, 84, 823, 823, 835, 838, 827, 827, 91, 91, |
| 131973 | | - /* 420 */ 92, 92, 92, 92, 437, 90, 90, 90, 90, 89, |
| 131974 | | - /* 430 */ 89, 88, 88, 88, 87, 341, 926, 2, 372, 719, |
| 131975 | | - /* 440 */ 698, 369, 950, 317, 49, 49, 940, 941, 719, 177, |
| 131976 | | - /* 450 */ 72, 93, 94, 84, 823, 823, 835, 838, 827, 827, |
| 131977 | | - /* 460 */ 91, 91, 92, 92, 92, 92, 322, 90, 90, 90, |
| 131978 | | - /* 470 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 415, |
| 131979 | | - /* 480 */ 405, 824, 824, 836, 839, 75, 93, 82, 84, 823, |
| 131980 | | - /* 490 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, |
| 131981 | | - /* 500 */ 92, 430, 90, 90, 90, 90, 89, 89, 88, 88, |
| 131982 | | - /* 510 */ 88, 87, 341, 317, 340, 340, 340, 658, 659, 660, |
| 131983 | | - /* 520 */ 333, 288, 94, 84, 823, 823, 835, 838, 827, 827, |
| 131984 | | - /* 530 */ 91, 91, 92, 92, 92, 92, 437, 90, 90, 90, |
| 131985 | | - /* 540 */ 90, 89, 89, 88, 88, 88, 87, 341, 317, 882, |
| 131986 | | - /* 550 */ 882, 375, 828, 66, 330, 409, 49, 49, 84, 823, |
| 131987 | | - /* 560 */ 823, 835, 838, 827, 827, 91, 91, 92, 92, 92, |
| 131988 | | - /* 570 */ 92, 351, 90, 90, 90, 90, 89, 89, 88, 88, |
| 131989 | | - /* 580 */ 88, 87, 341, 80, 432, 742, 3, 1180, 351, 350, |
| 131990 | | - /* 590 */ 741, 334, 796, 939, 939, 761, 80, 432, 278, 3, |
| 131991 | | - /* 600 */ 204, 161, 279, 393, 274, 392, 191, 362, 437, 277, |
| 131992 | | - /* 610 */ 745, 77, 78, 272, 800, 254, 355, 243, 79, 342, |
| 131993 | | - /* 620 */ 342, 86, 83, 169, 77, 78, 234, 399, 49, 49, |
| 131994 | | - /* 630 */ 435, 79, 342, 342, 437, 940, 941, 186, 442, 655, |
| 131995 | | - /* 640 */ 390, 387, 386, 435, 235, 213, 108, 421, 761, 351, |
| 131996 | | - /* 650 */ 437, 385, 167, 732, 10, 10, 124, 124, 671, 814, |
| 131997 | | - /* 660 */ 421, 439, 438, 415, 414, 802, 362, 168, 327, 124, |
| 131998 | | - /* 670 */ 49, 49, 814, 219, 439, 438, 800, 186, 802, 326, |
| 131999 | | - /* 680 */ 390, 387, 386, 437, 1248, 1248, 23, 939, 939, 80, |
| 132000 | | - /* 690 */ 432, 385, 3, 761, 416, 876, 807, 807, 807, 809, |
| 132001 | | - /* 700 */ 19, 290, 149, 49, 49, 415, 396, 260, 910, 807, |
| 132002 | | - /* 710 */ 807, 807, 809, 19, 312, 237, 145, 77, 78, 746, |
| 132003 | | - /* 720 */ 168, 702, 437, 149, 79, 342, 342, 114, 358, 940, |
| 132004 | | - /* 730 */ 941, 302, 223, 397, 345, 313, 435, 260, 415, 417, |
| 132005 | | - /* 740 */ 858, 374, 31, 31, 80, 432, 761, 3, 348, 92, |
| 132006 | | - /* 750 */ 92, 92, 92, 421, 90, 90, 90, 90, 89, 89, |
| 132007 | | - /* 760 */ 88, 88, 88, 87, 341, 814, 114, 439, 438, 796, |
| 132008 | | - /* 770 */ 367, 802, 77, 78, 701, 796, 124, 1187, 220, 79, |
| 132009 | | - /* 780 */ 342, 342, 124, 747, 734, 939, 939, 775, 404, 939, |
| 132010 | | - /* 790 */ 939, 435, 254, 360, 253, 402, 895, 346, 254, 360, |
| 132011 | | - /* 800 */ 253, 774, 807, 807, 807, 809, 19, 800, 421, 90, |
| 132012 | | - /* 810 */ 90, 90, 90, 89, 89, 88, 88, 88, 87, 341, |
| 132013 | | - /* 820 */ 814, 114, 439, 438, 939, 939, 802, 940, 941, 114, |
| 132014 | | - /* 830 */ 437, 940, 941, 86, 83, 169, 192, 166, 309, 979, |
| 132015 | | - /* 840 */ 70, 432, 700, 3, 382, 870, 238, 86, 83, 169, |
| 132016 | | - /* 850 */ 10, 10, 361, 406, 763, 190, 222, 807, 807, 807, |
| 132017 | | - /* 860 */ 809, 19, 870, 872, 329, 24, 940, 941, 77, 78, |
| 132018 | | - /* 870 */ 359, 437, 335, 260, 218, 79, 342, 342, 437, 307, |
| 132019 | | - /* 880 */ 306, 305, 207, 303, 339, 338, 668, 435, 339, 338, |
| 132020 | | - /* 890 */ 407, 10, 10, 762, 216, 216, 939, 939, 49, 49, |
| 132021 | | - /* 900 */ 437, 260, 97, 241, 421, 225, 402, 189, 188, 187, |
| 132022 | | - /* 910 */ 309, 918, 980, 149, 221, 898, 814, 868, 439, 438, |
| 132023 | | - /* 920 */ 10, 10, 802, 870, 915, 316, 898, 163, 162, 171, |
| 132024 | | - /* 930 */ 249, 240, 322, 410, 412, 687, 687, 272, 940, 941, |
| 132025 | | - /* 940 */ 239, 965, 901, 437, 226, 403, 226, 437, 963, 367, |
| 132026 | | - /* 950 */ 964, 173, 248, 807, 807, 807, 809, 19, 174, 367, |
| 132027 | | - /* 960 */ 899, 124, 172, 48, 48, 9, 9, 35, 35, 966, |
| 132028 | | - /* 970 */ 966, 899, 363, 966, 966, 814, 900, 808, 725, 939, |
| 132029 | | - /* 980 */ 939, 802, 895, 318, 980, 324, 125, 900, 726, 420, |
| 132030 | | - /* 990 */ 92, 92, 92, 92, 85, 90, 90, 90, 90, 89, |
| 132031 | | - /* 1000 */ 89, 88, 88, 88, 87, 341, 216, 216, 437, 946, |
| 132032 | | - /* 1010 */ 349, 292, 807, 807, 807, 114, 291, 693, 402, 705, |
| 132033 | | - /* 1020 */ 890, 940, 941, 437, 245, 889, 247, 437, 36, 36, |
| 132034 | | - /* 1030 */ 437, 353, 391, 437, 260, 252, 260, 437, 361, 437, |
| 132035 | | - /* 1040 */ 706, 437, 370, 12, 12, 224, 437, 27, 27, 437, |
| 132036 | | - /* 1050 */ 37, 37, 437, 38, 38, 752, 368, 39, 39, 28, |
| 132037 | | - /* 1060 */ 28, 29, 29, 215, 166, 331, 40, 40, 437, 41, |
| 132038 | | - /* 1070 */ 41, 437, 42, 42, 437, 866, 246, 731, 437, 879, |
| 132039 | | - /* 1080 */ 437, 256, 437, 878, 437, 267, 437, 261, 11, 11, |
| 132040 | | - /* 1090 */ 437, 43, 43, 437, 99, 99, 437, 373, 44, 44, |
| 132041 | | - /* 1100 */ 45, 45, 32, 32, 46, 46, 47, 47, 437, 426, |
| 132042 | | - /* 1110 */ 33, 33, 776, 116, 116, 437, 117, 117, 437, 124, |
| 132043 | | - /* 1120 */ 437, 777, 437, 260, 437, 957, 437, 352, 118, 118, |
| 132044 | | - /* 1130 */ 437, 195, 437, 111, 437, 53, 53, 264, 34, 34, |
| 132045 | | - /* 1140 */ 100, 100, 50, 50, 101, 101, 102, 102, 437, 260, |
| 132046 | | - /* 1150 */ 98, 98, 115, 115, 113, 113, 437, 262, 437, 265, |
| 132047 | | - /* 1160 */ 437, 943, 958, 437, 727, 437, 681, 437, 106, 106, |
| 132048 | | - /* 1170 */ 68, 437, 893, 730, 437, 365, 105, 105, 103, 103, |
| 132049 | | - /* 1180 */ 104, 104, 217, 52, 52, 54, 54, 51, 51, 694, |
| 132050 | | - /* 1190 */ 259, 26, 26, 266, 30, 30, 677, 323, 433, 323, |
| 132051 | | - /* 1200 */ 674, 423, 427, 943, 958, 114, 114, 431, 681, 865, |
| 132052 | | - /* 1210 */ 1277, 233, 366, 714, 112, 20, 154, 704, 703, 810, |
| 132053 | | - /* 1220 */ 914, 55, 159, 311, 798, 255, 383, 194, 68, 200, |
| 132054 | | - /* 1230 */ 21, 694, 268, 114, 114, 114, 270, 711, 712, 68, |
| 132055 | | - /* 1240 */ 114, 739, 770, 715, 71, 194, 861, 875, 875, 200, |
| 132056 | | - /* 1250 */ 696, 865, 874, 874, 679, 699, 273, 110, 229, 419, |
| 132057 | | - /* 1260 */ 768, 810, 799, 378, 748, 759, 418, 210, 294, 281, |
| 132058 | | - /* 1270 */ 295, 806, 283, 682, 676, 665, 664, 666, 933, 151, |
| 132059 | | - /* 1280 */ 285, 7, 1267, 308, 251, 790, 354, 244, 892, 364, |
| 132060 | | - /* 1290 */ 287, 422, 300, 164, 160, 936, 974, 127, 197, 137, |
| 132061 | | - /* 1300 */ 909, 907, 971, 388, 276, 863, 862, 56, 698, 325, |
| 132062 | | - /* 1310 */ 148, 59, 122, 66, 356, 381, 357, 176, 152, 62, |
| 132063 | | - /* 1320 */ 371, 130, 877, 181, 377, 760, 211, 182, 132, 133, |
| 132064 | | - /* 1330 */ 134, 135, 258, 146, 140, 795, 787, 263, 183, 379, |
| 132065 | | - /* 1340 */ 667, 394, 184, 332, 894, 314, 718, 717, 857, 716, |
| 132066 | | - /* 1350 */ 696, 315, 709, 690, 65, 196, 6, 408, 289, 708, |
| 132067 | | - /* 1360 */ 275, 689, 688, 948, 756, 757, 280, 282, 425, 755, |
| 132068 | | - /* 1370 */ 284, 336, 73, 67, 754, 429, 411, 96, 286, 413, |
| 132069 | | - /* 1380 */ 205, 934, 673, 22, 209, 440, 119, 120, 109, 206, |
| 132070 | | - /* 1390 */ 208, 441, 662, 661, 656, 843, 654, 343, 158, 236, |
| 132071 | | - /* 1400 */ 170, 347, 107, 227, 121, 738, 873, 298, 296, 297, |
| 132072 | | - /* 1410 */ 299, 871, 794, 128, 129, 728, 230, 131, 175, 250, |
| 132073 | | - /* 1420 */ 888, 136, 138, 231, 232, 139, 60, 61, 891, 178, |
| 132074 | | - /* 1430 */ 179, 887, 8, 13, 180, 257, 880, 968, 194, 141, |
| 132075 | | - /* 1440 */ 142, 376, 153, 670, 380, 185, 143, 277, 63, 384, |
| 132076 | | - /* 1450 */ 14, 707, 271, 15, 389, 64, 319, 320, 126, 228, |
| 132077 | | - /* 1460 */ 813, 812, 841, 736, 123, 16, 401, 740, 4, 769, |
| 132078 | | - /* 1470 */ 165, 212, 214, 193, 144, 764, 71, 68, 17, 18, |
| 132079 | | - /* 1480 */ 856, 842, 840, 897, 845, 896, 199, 198, 923, 155, |
| 132080 | | - /* 1490 */ 424, 929, 924, 156, 201, 202, 428, 844, 157, 203, |
| 132081 | | - /* 1500 */ 811, 680, 81, 1269, 1268, 301, 304, |
| 133171 | + /* 0 */ 325, 830, 351, 824, 5, 203, 203, 818, 99, 100, |
| 133172 | + /* 10 */ 90, 840, 840, 852, 855, 844, 844, 97, 97, 98, |
| 133173 | + /* 20 */ 98, 98, 98, 301, 96, 96, 96, 96, 95, 95, |
| 133174 | + /* 30 */ 94, 94, 94, 93, 351, 325, 975, 975, 823, 823, |
| 133175 | + /* 40 */ 823, 945, 354, 99, 100, 90, 840, 840, 852, 855, |
| 133176 | + /* 50 */ 844, 844, 97, 97, 98, 98, 98, 98, 338, 96, |
| 133177 | + /* 60 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 133178 | + /* 70 */ 95, 95, 94, 94, 94, 93, 351, 790, 975, 975, |
| 133179 | + /* 80 */ 325, 94, 94, 94, 93, 351, 791, 75, 99, 100, |
| 133180 | + /* 90 */ 90, 840, 840, 852, 855, 844, 844, 97, 97, 98, |
| 133181 | + /* 100 */ 98, 98, 98, 450, 96, 96, 96, 96, 95, 95, |
| 133182 | + /* 110 */ 94, 94, 94, 93, 351, 1330, 155, 155, 2, 325, |
| 133183 | + /* 120 */ 275, 146, 132, 52, 52, 93, 351, 99, 100, 90, |
| 133184 | + /* 130 */ 840, 840, 852, 855, 844, 844, 97, 97, 98, 98, |
| 133185 | + /* 140 */ 98, 98, 101, 96, 96, 96, 96, 95, 95, 94, |
| 133186 | + /* 150 */ 94, 94, 93, 351, 956, 956, 325, 268, 428, 413, |
| 133187 | + /* 160 */ 411, 61, 751, 751, 99, 100, 90, 840, 840, 852, |
| 133188 | + /* 170 */ 855, 844, 844, 97, 97, 98, 98, 98, 98, 60, |
| 133189 | + /* 180 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133190 | + /* 190 */ 351, 325, 270, 329, 273, 277, 957, 958, 250, 99, |
| 133191 | + /* 200 */ 100, 90, 840, 840, 852, 855, 844, 844, 97, 97, |
| 133192 | + /* 210 */ 98, 98, 98, 98, 301, 96, 96, 96, 96, 95, |
| 133193 | + /* 220 */ 95, 94, 94, 94, 93, 351, 325, 936, 1323, 697, |
| 133194 | + /* 230 */ 705, 1323, 242, 412, 99, 100, 90, 840, 840, 852, |
| 133195 | + /* 240 */ 855, 844, 844, 97, 97, 98, 98, 98, 98, 347, |
| 133196 | + /* 250 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133197 | + /* 260 */ 351, 325, 936, 1324, 384, 698, 1324, 381, 379, 99, |
| 133198 | + /* 270 */ 100, 90, 840, 840, 852, 855, 844, 844, 97, 97, |
| 133199 | + /* 280 */ 98, 98, 98, 98, 700, 96, 96, 96, 96, 95, |
| 133200 | + /* 290 */ 95, 94, 94, 94, 93, 351, 325, 92, 89, 178, |
| 133201 | + /* 300 */ 831, 934, 373, 699, 99, 100, 90, 840, 840, 852, |
| 133202 | + /* 310 */ 855, 844, 844, 97, 97, 98, 98, 98, 98, 375, |
| 133203 | + /* 320 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133204 | + /* 330 */ 351, 325, 1273, 945, 354, 817, 934, 738, 738, 99, |
| 133205 | + /* 340 */ 100, 90, 840, 840, 852, 855, 844, 844, 97, 97, |
| 133206 | + /* 350 */ 98, 98, 98, 98, 230, 96, 96, 96, 96, 95, |
| 133207 | + /* 360 */ 95, 94, 94, 94, 93, 351, 325, 967, 227, 92, |
| 133208 | + /* 370 */ 89, 178, 373, 300, 99, 100, 90, 840, 840, 852, |
| 133209 | + /* 380 */ 855, 844, 844, 97, 97, 98, 98, 98, 98, 919, |
| 133210 | + /* 390 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133211 | + /* 400 */ 351, 325, 449, 447, 447, 447, 147, 736, 736, 99, |
| 133212 | + /* 410 */ 100, 90, 840, 840, 852, 855, 844, 844, 97, 97, |
| 133213 | + /* 420 */ 98, 98, 98, 98, 296, 96, 96, 96, 96, 95, |
| 133214 | + /* 430 */ 95, 94, 94, 94, 93, 351, 325, 419, 231, 956, |
| 133215 | + /* 440 */ 956, 158, 25, 422, 99, 100, 90, 840, 840, 852, |
| 133216 | + /* 450 */ 855, 844, 844, 97, 97, 98, 98, 98, 98, 450, |
| 133217 | + /* 460 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133218 | + /* 470 */ 351, 443, 224, 224, 420, 956, 956, 960, 325, 52, |
| 133219 | + /* 480 */ 52, 957, 958, 176, 415, 78, 99, 100, 90, 840, |
| 133220 | + /* 490 */ 840, 852, 855, 844, 844, 97, 97, 98, 98, 98, |
| 133221 | + /* 500 */ 98, 379, 96, 96, 96, 96, 95, 95, 94, 94, |
| 133222 | + /* 510 */ 94, 93, 351, 325, 428, 418, 298, 957, 958, 960, |
| 133223 | + /* 520 */ 81, 99, 88, 90, 840, 840, 852, 855, 844, 844, |
| 133224 | + /* 530 */ 97, 97, 98, 98, 98, 98, 716, 96, 96, 96, |
| 133225 | + /* 540 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 841, |
| 133226 | + /* 550 */ 841, 853, 856, 994, 318, 343, 379, 100, 90, 840, |
| 133227 | + /* 560 */ 840, 852, 855, 844, 844, 97, 97, 98, 98, 98, |
| 133228 | + /* 570 */ 98, 450, 96, 96, 96, 96, 95, 95, 94, 94, |
| 133229 | + /* 580 */ 94, 93, 351, 325, 350, 350, 350, 260, 377, 340, |
| 133230 | + /* 590 */ 927, 52, 52, 90, 840, 840, 852, 855, 844, 844, |
| 133231 | + /* 600 */ 97, 97, 98, 98, 98, 98, 361, 96, 96, 96, |
| 133232 | + /* 610 */ 96, 95, 95, 94, 94, 94, 93, 351, 86, 445, |
| 133233 | + /* 620 */ 845, 3, 1200, 361, 360, 378, 344, 812, 956, 956, |
| 133234 | + /* 630 */ 1297, 86, 445, 728, 3, 212, 169, 287, 405, 282, |
| 133235 | + /* 640 */ 404, 199, 232, 450, 300, 759, 83, 84, 280, 245, |
| 133236 | + /* 650 */ 262, 365, 251, 85, 352, 352, 92, 89, 178, 83, |
| 133237 | + /* 660 */ 84, 242, 412, 52, 52, 448, 85, 352, 352, 246, |
| 133238 | + /* 670 */ 957, 958, 194, 455, 669, 402, 399, 398, 448, 243, |
| 133239 | + /* 680 */ 221, 114, 434, 775, 361, 450, 397, 268, 746, 224, |
| 133240 | + /* 690 */ 224, 132, 132, 198, 830, 434, 452, 451, 428, 427, |
| 133241 | + /* 700 */ 818, 415, 733, 712, 132, 52, 52, 830, 268, 452, |
| 133242 | + /* 710 */ 451, 733, 194, 818, 363, 402, 399, 398, 450, 1268, |
| 133243 | + /* 720 */ 1268, 23, 956, 956, 86, 445, 397, 3, 228, 429, |
| 133244 | + /* 730 */ 893, 823, 823, 823, 825, 19, 203, 719, 52, 52, |
| 133245 | + /* 740 */ 428, 408, 439, 249, 823, 823, 823, 825, 19, 229, |
| 133246 | + /* 750 */ 403, 153, 83, 84, 760, 177, 241, 450, 720, 85, |
| 133247 | + /* 760 */ 352, 352, 120, 157, 957, 958, 58, 975, 409, 355, |
| 133248 | + /* 770 */ 330, 448, 268, 428, 430, 320, 789, 32, 32, 86, |
| 133249 | + /* 780 */ 445, 775, 3, 341, 98, 98, 98, 98, 434, 96, |
| 133250 | + /* 790 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351, |
| 133251 | + /* 800 */ 830, 120, 452, 451, 812, 885, 818, 83, 84, 975, |
| 133252 | + /* 810 */ 812, 132, 410, 918, 85, 352, 352, 132, 407, 788, |
| 133253 | + /* 820 */ 956, 956, 92, 89, 178, 915, 448, 262, 370, 261, |
| 133254 | + /* 830 */ 82, 912, 80, 262, 370, 261, 932, 823, 823, 823, |
| 133255 | + /* 840 */ 825, 19, 257, 434, 96, 96, 96, 96, 95, 95, |
| 133256 | + /* 850 */ 94, 94, 94, 93, 351, 830, 268, 452, 451, 956, |
| 133257 | + /* 860 */ 956, 818, 957, 958, 120, 92, 89, 178, 943, 2, |
| 133258 | + /* 870 */ 916, 963, 268, 1, 766, 76, 445, 761, 3, 707, |
| 133259 | + /* 880 */ 899, 899, 387, 956, 956, 756, 917, 371, 739, 777, |
| 133260 | + /* 890 */ 755, 907, 823, 823, 823, 825, 19, 883, 740, 450, |
| 133261 | + /* 900 */ 24, 957, 958, 83, 84, 369, 956, 956, 708, 226, |
| 133262 | + /* 910 */ 85, 352, 352, 745, 315, 314, 313, 215, 311, 10, |
| 133263 | + /* 920 */ 10, 682, 448, 349, 348, 957, 958, 887, 776, 691, |
| 133264 | + /* 930 */ 331, 956, 956, 337, 157, 450, 268, 103, 450, 434, |
| 133265 | + /* 940 */ 450, 816, 310, 906, 887, 889, 321, 450, 957, 958, |
| 133266 | + /* 950 */ 708, 830, 775, 452, 451, 10, 10, 818, 10, 10, |
| 133267 | + /* 960 */ 52, 52, 171, 170, 180, 225, 248, 10, 10, 339, |
| 133268 | + /* 970 */ 701, 701, 233, 957, 958, 247, 982, 741, 450, 956, |
| 133269 | + /* 980 */ 956, 425, 157, 980, 685, 981, 182, 912, 823, 823, |
| 133270 | + /* 990 */ 823, 825, 19, 183, 324, 423, 132, 181, 51, 51, |
| 133271 | + /* 1000 */ 715, 349, 348, 394, 256, 887, 334, 915, 983, 983, |
| 133272 | + /* 1010 */ 830, 417, 824, 234, 198, 234, 818, 268, 326, 382, |
| 133273 | + /* 1020 */ 120, 957, 958, 264, 177, 98, 98, 98, 98, 91, |
| 133274 | + /* 1030 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93, |
| 133275 | + /* 1040 */ 351, 816, 416, 371, 120, 359, 816, 823, 823, 823, |
| 133276 | + /* 1050 */ 775, 299, 916, 450, 368, 197, 196, 195, 358, 200, |
| 133277 | + /* 1060 */ 175, 380, 9, 9, 450, 1287, 875, 714, 917, 450, |
| 133278 | + /* 1070 */ 433, 237, 450, 36, 36, 132, 253, 450, 255, 450, |
| 133279 | + /* 1080 */ 117, 450, 809, 362, 37, 37, 983, 983, 450, 12, |
| 133280 | + /* 1090 */ 12, 330, 27, 27, 446, 331, 280, 38, 38, 39, |
| 133281 | + /* 1100 */ 39, 40, 40, 1207, 450, 816, 335, 356, 41, 41, |
| 133282 | + /* 1110 */ 450, 336, 450, 695, 450, 120, 450, 332, 133, 450, |
| 133283 | + /* 1120 */ 268, 450, 269, 450, 42, 42, 450, 816, 254, 450, |
| 133284 | + /* 1130 */ 28, 28, 29, 29, 31, 31, 43, 43, 450, 44, |
| 133285 | + /* 1140 */ 44, 45, 45, 11, 11, 450, 46, 46, 450, 105, |
| 133286 | + /* 1150 */ 105, 450, 748, 713, 450, 695, 450, 910, 47, 47, |
| 133287 | + /* 1160 */ 450, 267, 450, 415, 450, 48, 48, 450, 33, 33, |
| 133288 | + /* 1170 */ 386, 49, 49, 450, 50, 50, 34, 34, 450, 172, |
| 133289 | + /* 1180 */ 122, 122, 123, 123, 124, 124, 450, 56, 56, 450, |
| 133290 | + /* 1190 */ 120, 450, 345, 35, 35, 450, 790, 450, 106, 106, |
| 133291 | + /* 1200 */ 450, 74, 450, 974, 450, 791, 53, 53, 432, 107, |
| 133292 | + /* 1210 */ 107, 108, 108, 450, 272, 104, 104, 121, 121, 450, |
| 133293 | + /* 1220 */ 119, 119, 112, 112, 111, 111, 450, 317, 996, 450, |
| 133294 | + /* 1230 */ 118, 450, 162, 109, 109, 317, 935, 450, 896, 110, |
| 133295 | + /* 1240 */ 110, 450, 895, 744, 688, 436, 55, 55, 20, 57, |
| 133296 | + /* 1250 */ 57, 54, 54, 440, 444, 756, 385, 26, 26, 274, |
| 133297 | + /* 1260 */ 755, 30, 30, 21, 672, 673, 674, 223, 175, 931, |
| 133298 | + /* 1270 */ 814, 372, 319, 202, 202, 882, 120, 120, 120, 374, |
| 133299 | + /* 1280 */ 826, 710, 202, 72, 276, 263, 120, 120, 74, 395, |
| 133300 | + /* 1290 */ 278, 286, 208, 74, 718, 717, 725, 726, 892, 892, |
| 133301 | + /* 1300 */ 167, 997, 285, 753, 729, 784, 77, 878, 202, 997, |
| 133302 | + /* 1310 */ 208, 693, 891, 891, 116, 281, 782, 882, 390, 815, |
| 133303 | + /* 1320 */ 762, 773, 826, 431, 302, 303, 822, 218, 696, 289, |
| 133304 | + /* 1330 */ 690, 291, 293, 679, 678, 680, 950, 159, 316, 7, |
| 133305 | + /* 1340 */ 364, 252, 259, 804, 909, 376, 400, 295, 308, 173, |
| 133306 | + /* 1350 */ 435, 953, 168, 991, 135, 205, 926, 924, 59, 988, |
| 133307 | + /* 1360 */ 62, 284, 880, 333, 879, 712, 144, 156, 130, 72, |
| 133308 | + /* 1370 */ 366, 367, 393, 185, 189, 160, 383, 67, 389, 266, |
| 133309 | + /* 1380 */ 137, 894, 774, 219, 154, 139, 190, 140, 391, 271, |
| 133310 | + /* 1390 */ 191, 141, 142, 801, 681, 148, 811, 342, 322, 192, |
| 133311 | + /* 1400 */ 406, 732, 911, 874, 723, 731, 323, 710, 730, 71, |
| 133312 | + /* 1410 */ 704, 204, 283, 703, 6, 79, 421, 702, 965, 770, |
| 133313 | + /* 1420 */ 297, 346, 426, 102, 722, 288, 73, 424, 213, 951, |
| 133314 | + /* 1430 */ 771, 438, 22, 290, 687, 769, 442, 453, 239, 217, |
| 133315 | + /* 1440 */ 214, 668, 125, 353, 126, 216, 454, 166, 676, 115, |
| 133316 | + /* 1450 */ 675, 235, 244, 179, 670, 357, 810, 113, 890, 888, |
| 133317 | + /* 1460 */ 292, 136, 128, 752, 304, 768, 294, 305, 138, 742, |
| 133318 | + /* 1470 */ 306, 307, 127, 184, 860, 258, 905, 145, 143, 238, |
| 133319 | + /* 1480 */ 63, 64, 65, 66, 240, 129, 908, 186, 187, 904, |
| 133320 | + /* 1490 */ 8, 13, 188, 265, 897, 149, 202, 985, 388, 684, |
| 133321 | + /* 1500 */ 150, 161, 392, 285, 193, 279, 151, 396, 68, 14, |
| 133322 | + /* 1510 */ 401, 15, 327, 721, 328, 134, 69, 70, 236, 131, |
| 133323 | + /* 1520 */ 829, 828, 858, 750, 16, 201, 754, 4, 783, 220, |
| 133324 | + /* 1530 */ 414, 174, 222, 152, 77, 778, 74, 17, 18, 873, |
| 133325 | + /* 1540 */ 859, 857, 914, 862, 913, 207, 206, 940, 163, 437, |
| 133326 | + /* 1550 */ 946, 941, 164, 209, 210, 441, 861, 165, 312, 827, |
| 133327 | + /* 1560 */ 694, 87, 1000, 309, 211, 1000, 1000, 1000, 1000, 1289, |
| 133328 | + /* 1570 */ 1288, |
| 132082 | 133329 | }; |
| 132083 | 133330 | static const YYCODETYPE yy_lookahead[] = { |
| 132084 | 133331 | /* 0 */ 19, 95, 53, 97, 22, 24, 24, 101, 27, 28, |
| 132085 | 133332 | /* 10 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 132086 | 133333 | /* 20 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, |
| | @@ -132091,285 +133338,295 @@ |
| 132091 | 133338 | /* 70 */ 47, 48, 49, 50, 51, 52, 53, 61, 97, 97, |
| 132092 | 133339 | /* 80 */ 19, 49, 50, 51, 52, 53, 70, 26, 27, 28, |
| 132093 | 133340 | /* 90 */ 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, |
| 132094 | 133341 | /* 100 */ 39, 40, 41, 152, 43, 44, 45, 46, 47, 48, |
| 132095 | 133342 | /* 110 */ 49, 50, 51, 52, 53, 144, 145, 146, 147, 19, |
| 132096 | | - /* 120 */ 137, 22, 139, 172, 173, 52, 53, 27, 28, 29, |
| 133343 | + /* 120 */ 16, 22, 92, 172, 173, 52, 53, 27, 28, 29, |
| 132097 | 133344 | /* 130 */ 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, |
| 132098 | 133345 | /* 140 */ 40, 41, 81, 43, 44, 45, 46, 47, 48, 49, |
| 132099 | 133346 | /* 150 */ 50, 51, 52, 53, 55, 56, 19, 152, 207, 208, |
| 132100 | 133347 | /* 160 */ 115, 24, 117, 118, 27, 28, 29, 30, 31, 32, |
| 132101 | 133348 | /* 170 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 79, |
| 132102 | 133349 | /* 180 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 132103 | | - /* 190 */ 53, 19, 0, 1, 2, 23, 97, 98, 193, 27, |
| 133350 | + /* 190 */ 53, 19, 88, 157, 90, 23, 97, 98, 193, 27, |
| 132104 | 133351 | /* 200 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 132105 | 133352 | /* 210 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, |
| 132106 | | - /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 163, |
| 132107 | | - /* 230 */ 23, 26, 190, 191, 27, 28, 29, 30, 31, 32, |
| 133353 | + /* 220 */ 48, 49, 50, 51, 52, 53, 19, 22, 23, 172, |
| 133354 | + /* 230 */ 23, 26, 119, 120, 27, 28, 29, 30, 31, 32, |
| 132108 | 133355 | /* 240 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 187, |
| 132109 | 133356 | /* 250 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 132110 | | - /* 260 */ 53, 19, 196, 22, 23, 23, 49, 26, 92, 27, |
| 133357 | + /* 260 */ 53, 19, 22, 23, 228, 23, 26, 231, 152, 27, |
| 132111 | 133358 | /* 270 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 132112 | 133359 | /* 280 */ 38, 39, 40, 41, 172, 43, 44, 45, 46, 47, |
| 132113 | 133360 | /* 290 */ 48, 49, 50, 51, 52, 53, 19, 221, 222, 223, |
| 132114 | | - /* 300 */ 23, 96, 119, 120, 27, 28, 29, 30, 31, 32, |
| 132115 | | - /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 172, |
| 133361 | + /* 300 */ 23, 96, 152, 172, 27, 28, 29, 30, 31, 32, |
| 133362 | + /* 310 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 152, |
| 132116 | 133363 | /* 320 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 132117 | | - /* 330 */ 53, 19, 152, 116, 221, 222, 223, 96, 121, 27, |
| 133364 | + /* 330 */ 53, 19, 0, 1, 2, 23, 96, 190, 191, 27, |
| 132118 | 133365 | /* 340 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 132119 | | - /* 350 */ 38, 39, 40, 41, 241, 43, 44, 45, 46, 47, |
| 132120 | | - /* 360 */ 48, 49, 50, 51, 52, 53, 19, 157, 168, 169, |
| 132121 | | - /* 370 */ 170, 22, 190, 191, 27, 28, 29, 30, 31, 32, |
| 132122 | | - /* 380 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 30, |
| 133366 | + /* 350 */ 38, 39, 40, 41, 238, 43, 44, 45, 46, 47, |
| 133367 | + /* 360 */ 48, 49, 50, 51, 52, 53, 19, 185, 218, 221, |
| 133368 | + /* 370 */ 222, 223, 152, 152, 27, 28, 29, 30, 31, 32, |
| 133369 | + /* 380 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 241, |
| 132123 | 133370 | /* 390 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 132124 | | - /* 400 */ 53, 19, 172, 152, 55, 56, 24, 247, 248, 27, |
| 133371 | + /* 400 */ 53, 19, 152, 168, 169, 170, 22, 190, 191, 27, |
| 132125 | 133372 | /* 410 */ 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, |
| 132126 | 133373 | /* 420 */ 38, 39, 40, 41, 152, 43, 44, 45, 46, 47, |
| 132127 | | - /* 430 */ 48, 49, 50, 51, 52, 53, 146, 147, 228, 179, |
| 132128 | | - /* 440 */ 180, 231, 185, 19, 172, 173, 97, 98, 188, 26, |
| 132129 | | - /* 450 */ 138, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 132130 | | - /* 460 */ 36, 37, 38, 39, 40, 41, 107, 43, 44, 45, |
| 132131 | | - /* 470 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 207, |
| 132132 | | - /* 480 */ 208, 30, 31, 32, 33, 138, 27, 28, 29, 30, |
| 133374 | + /* 430 */ 48, 49, 50, 51, 52, 53, 19, 19, 218, 55, |
| 133375 | + /* 440 */ 56, 24, 22, 152, 27, 28, 29, 30, 31, 32, |
| 133376 | + /* 450 */ 33, 34, 35, 36, 37, 38, 39, 40, 41, 152, |
| 133377 | + /* 460 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 133378 | + /* 470 */ 53, 250, 194, 195, 56, 55, 56, 55, 19, 172, |
| 133379 | + /* 480 */ 173, 97, 98, 152, 206, 138, 27, 28, 29, 30, |
| 132133 | 133380 | /* 490 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 132134 | | - /* 500 */ 41, 250, 43, 44, 45, 46, 47, 48, 49, 50, |
| 132135 | | - /* 510 */ 51, 52, 53, 19, 168, 169, 170, 7, 8, 9, |
| 132136 | | - /* 520 */ 19, 152, 28, 29, 30, 31, 32, 33, 34, 35, |
| 132137 | | - /* 530 */ 36, 37, 38, 39, 40, 41, 152, 43, 44, 45, |
| 132138 | | - /* 540 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 108, |
| 132139 | | - /* 550 */ 109, 110, 101, 130, 53, 152, 172, 173, 29, 30, |
| 133381 | + /* 500 */ 41, 152, 43, 44, 45, 46, 47, 48, 49, 50, |
| 133382 | + /* 510 */ 51, 52, 53, 19, 207, 208, 152, 97, 98, 97, |
| 133383 | + /* 520 */ 138, 27, 28, 29, 30, 31, 32, 33, 34, 35, |
| 133384 | + /* 530 */ 36, 37, 38, 39, 40, 41, 181, 43, 44, 45, |
| 133385 | + /* 540 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 30, |
| 133386 | + /* 550 */ 31, 32, 33, 247, 248, 19, 152, 28, 29, 30, |
| 132140 | 133387 | /* 560 */ 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, |
| 132141 | 133388 | /* 570 */ 41, 152, 43, 44, 45, 46, 47, 48, 49, 50, |
| 132142 | | - /* 580 */ 51, 52, 53, 19, 20, 116, 22, 23, 169, 170, |
| 132143 | | - /* 590 */ 121, 207, 85, 55, 56, 26, 19, 20, 101, 22, |
| 132144 | | - /* 600 */ 99, 100, 101, 102, 103, 104, 105, 152, 152, 112, |
| 132145 | | - /* 610 */ 210, 47, 48, 112, 152, 108, 109, 110, 54, 55, |
| 132146 | | - /* 620 */ 56, 221, 222, 223, 47, 48, 119, 120, 172, 173, |
| 132147 | | - /* 630 */ 66, 54, 55, 56, 152, 97, 98, 99, 148, 149, |
| 132148 | | - /* 640 */ 102, 103, 104, 66, 154, 23, 156, 83, 26, 230, |
| 132149 | | - /* 650 */ 152, 113, 152, 163, 172, 173, 92, 92, 21, 95, |
| 132150 | | - /* 660 */ 83, 97, 98, 207, 208, 101, 152, 98, 186, 92, |
| 132151 | | - /* 670 */ 172, 173, 95, 218, 97, 98, 152, 99, 101, 217, |
| 132152 | | - /* 680 */ 102, 103, 104, 152, 119, 120, 196, 55, 56, 19, |
| 132153 | | - /* 690 */ 20, 113, 22, 124, 163, 11, 132, 133, 134, 135, |
| 132154 | | - /* 700 */ 136, 152, 152, 172, 173, 207, 208, 152, 152, 132, |
| 132155 | | - /* 710 */ 133, 134, 135, 136, 164, 152, 84, 47, 48, 49, |
| 132156 | | - /* 720 */ 98, 181, 152, 152, 54, 55, 56, 196, 91, 97, |
| 132157 | | - /* 730 */ 98, 160, 218, 163, 244, 164, 66, 152, 207, 208, |
| 132158 | | - /* 740 */ 103, 217, 172, 173, 19, 20, 124, 22, 193, 38, |
| 132159 | | - /* 750 */ 39, 40, 41, 83, 43, 44, 45, 46, 47, 48, |
| 132160 | | - /* 760 */ 49, 50, 51, 52, 53, 95, 196, 97, 98, 85, |
| 132161 | | - /* 770 */ 152, 101, 47, 48, 181, 85, 92, 140, 193, 54, |
| 132162 | | - /* 780 */ 55, 56, 92, 49, 195, 55, 56, 175, 163, 55, |
| 132163 | | - /* 790 */ 56, 66, 108, 109, 110, 206, 163, 242, 108, 109, |
| 132164 | | - /* 800 */ 110, 175, 132, 133, 134, 135, 136, 152, 83, 43, |
| 132165 | | - /* 810 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 132166 | | - /* 820 */ 95, 196, 97, 98, 55, 56, 101, 97, 98, 196, |
| 132167 | | - /* 830 */ 152, 97, 98, 221, 222, 223, 211, 212, 22, 23, |
| 132168 | | - /* 840 */ 19, 20, 181, 22, 19, 152, 152, 221, 222, 223, |
| 132169 | | - /* 850 */ 172, 173, 219, 19, 124, 30, 238, 132, 133, 134, |
| 132170 | | - /* 860 */ 135, 136, 169, 170, 186, 232, 97, 98, 47, 48, |
| 132171 | | - /* 870 */ 237, 152, 217, 152, 5, 54, 55, 56, 152, 10, |
| 132172 | | - /* 880 */ 11, 12, 13, 14, 47, 48, 17, 66, 47, 48, |
| 132173 | | - /* 890 */ 56, 172, 173, 124, 194, 195, 55, 56, 172, 173, |
| 132174 | | - /* 900 */ 152, 152, 22, 152, 83, 186, 206, 108, 109, 110, |
| 132175 | | - /* 910 */ 22, 23, 96, 152, 193, 12, 95, 152, 97, 98, |
| 132176 | | - /* 920 */ 172, 173, 101, 230, 152, 164, 12, 47, 48, 60, |
| 132177 | | - /* 930 */ 152, 62, 107, 207, 186, 55, 56, 112, 97, 98, |
| 132178 | | - /* 940 */ 71, 100, 193, 152, 183, 152, 185, 152, 107, 152, |
| 132179 | | - /* 950 */ 109, 82, 16, 132, 133, 134, 135, 136, 89, 152, |
| 132180 | | - /* 960 */ 57, 92, 93, 172, 173, 172, 173, 172, 173, 132, |
| 132181 | | - /* 970 */ 133, 57, 152, 132, 133, 95, 73, 97, 75, 55, |
| 132182 | | - /* 980 */ 56, 101, 163, 114, 96, 245, 246, 73, 85, 75, |
| 132183 | | - /* 990 */ 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, |
| 132184 | | - /* 1000 */ 48, 49, 50, 51, 52, 53, 194, 195, 152, 171, |
| 132185 | | - /* 1010 */ 141, 152, 132, 133, 134, 196, 225, 179, 206, 65, |
| 132186 | | - /* 1020 */ 152, 97, 98, 152, 88, 152, 90, 152, 172, 173, |
| 132187 | | - /* 1030 */ 152, 219, 78, 152, 152, 238, 152, 152, 219, 152, |
| 132188 | | - /* 1040 */ 86, 152, 152, 172, 173, 238, 152, 172, 173, 152, |
| 132189 | | - /* 1050 */ 172, 173, 152, 172, 173, 213, 237, 172, 173, 172, |
| 132190 | | - /* 1060 */ 173, 172, 173, 211, 212, 111, 172, 173, 152, 172, |
| 132191 | | - /* 1070 */ 173, 152, 172, 173, 152, 193, 140, 193, 152, 59, |
| 132192 | | - /* 1080 */ 152, 152, 152, 63, 152, 16, 152, 152, 172, 173, |
| 132193 | | - /* 1090 */ 152, 172, 173, 152, 172, 173, 152, 77, 172, 173, |
| 132194 | | - /* 1100 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 250, |
| 132195 | | - /* 1110 */ 172, 173, 61, 172, 173, 152, 172, 173, 152, 92, |
| 132196 | | - /* 1120 */ 152, 70, 152, 152, 152, 26, 152, 100, 172, 173, |
| 132197 | | - /* 1130 */ 152, 24, 152, 22, 152, 172, 173, 152, 172, 173, |
| 132198 | | - /* 1140 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 152, |
| 132199 | | - /* 1150 */ 172, 173, 172, 173, 172, 173, 152, 88, 152, 90, |
| 132200 | | - /* 1160 */ 152, 55, 55, 152, 193, 152, 55, 152, 172, 173, |
| 132201 | | - /* 1170 */ 26, 152, 163, 163, 152, 19, 172, 173, 172, 173, |
| 132202 | | - /* 1180 */ 172, 173, 22, 172, 173, 172, 173, 172, 173, 55, |
| 132203 | | - /* 1190 */ 193, 172, 173, 152, 172, 173, 166, 167, 166, 167, |
| 132204 | | - /* 1200 */ 163, 163, 163, 97, 97, 196, 196, 163, 97, 55, |
| 132205 | | - /* 1210 */ 23, 199, 56, 26, 22, 22, 24, 100, 101, 55, |
| 132206 | | - /* 1220 */ 23, 209, 123, 26, 23, 23, 23, 26, 26, 26, |
| 132207 | | - /* 1230 */ 37, 97, 152, 196, 196, 196, 23, 7, 8, 26, |
| 132208 | | - /* 1240 */ 196, 23, 23, 152, 26, 26, 23, 132, 133, 26, |
| 132209 | | - /* 1250 */ 106, 97, 132, 133, 23, 152, 152, 26, 210, 191, |
| 132210 | | - /* 1260 */ 152, 97, 152, 234, 152, 152, 152, 233, 152, 210, |
| 132211 | | - /* 1270 */ 152, 152, 210, 152, 152, 152, 152, 152, 152, 197, |
| 132212 | | - /* 1280 */ 210, 198, 122, 150, 239, 201, 214, 214, 201, 239, |
| 132213 | | - /* 1290 */ 214, 227, 200, 184, 198, 155, 67, 243, 122, 22, |
| 132214 | | - /* 1300 */ 159, 159, 69, 176, 175, 175, 175, 240, 180, 159, |
| 132215 | | - /* 1310 */ 220, 240, 27, 130, 18, 18, 159, 158, 220, 137, |
| 132216 | | - /* 1320 */ 159, 189, 236, 158, 74, 159, 159, 158, 192, 192, |
| 132217 | | - /* 1330 */ 192, 192, 235, 22, 189, 189, 201, 159, 158, 177, |
| 132218 | | - /* 1340 */ 159, 107, 158, 76, 201, 177, 174, 174, 201, 174, |
| 132219 | | - /* 1350 */ 106, 177, 182, 174, 107, 159, 22, 125, 159, 182, |
| 132220 | | - /* 1360 */ 174, 176, 174, 174, 216, 216, 215, 215, 177, 216, |
| 132221 | | - /* 1370 */ 215, 53, 137, 128, 216, 177, 127, 129, 215, 126, |
| 132222 | | - /* 1380 */ 25, 13, 162, 26, 6, 161, 165, 165, 178, 153, |
| 132223 | | - /* 1390 */ 153, 151, 151, 151, 151, 224, 4, 3, 22, 142, |
| 132224 | | - /* 1400 */ 15, 94, 16, 178, 165, 205, 23, 202, 204, 203, |
| 132225 | | - /* 1410 */ 201, 23, 120, 131, 111, 20, 226, 123, 125, 16, |
| 132226 | | - /* 1420 */ 1, 123, 131, 229, 229, 111, 37, 37, 56, 64, |
| 132227 | | - /* 1430 */ 122, 1, 5, 22, 107, 140, 80, 87, 26, 80, |
| 132228 | | - /* 1440 */ 107, 72, 24, 20, 19, 105, 22, 112, 22, 79, |
| 132229 | | - /* 1450 */ 22, 58, 23, 22, 79, 22, 249, 249, 246, 79, |
| 132230 | | - /* 1460 */ 23, 23, 23, 116, 68, 22, 26, 23, 22, 56, |
| 132231 | | - /* 1470 */ 122, 23, 23, 64, 22, 124, 26, 26, 64, 64, |
| 132232 | | - /* 1480 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22, |
| 132233 | | - /* 1490 */ 24, 1, 23, 22, 26, 122, 24, 23, 22, 122, |
| 132234 | | - /* 1500 */ 23, 23, 22, 122, 122, 23, 15, |
| 132235 | | -}; |
| 132236 | | -#define YY_SHIFT_USE_DFLT (1507) |
| 132237 | | -#define YY_SHIFT_COUNT (442) |
| 133389 | + /* 580 */ 51, 52, 53, 19, 168, 169, 170, 238, 19, 53, |
| 133390 | + /* 590 */ 152, 172, 173, 29, 30, 31, 32, 33, 34, 35, |
| 133391 | + /* 600 */ 36, 37, 38, 39, 40, 41, 152, 43, 44, 45, |
| 133392 | + /* 610 */ 46, 47, 48, 49, 50, 51, 52, 53, 19, 20, |
| 133393 | + /* 620 */ 101, 22, 23, 169, 170, 56, 207, 85, 55, 56, |
| 133394 | + /* 630 */ 23, 19, 20, 26, 22, 99, 100, 101, 102, 103, |
| 133395 | + /* 640 */ 104, 105, 238, 152, 152, 210, 47, 48, 112, 152, |
| 133396 | + /* 650 */ 108, 109, 110, 54, 55, 56, 221, 222, 223, 47, |
| 133397 | + /* 660 */ 48, 119, 120, 172, 173, 66, 54, 55, 56, 152, |
| 133398 | + /* 670 */ 97, 98, 99, 148, 149, 102, 103, 104, 66, 154, |
| 133399 | + /* 680 */ 23, 156, 83, 26, 230, 152, 113, 152, 163, 194, |
| 133400 | + /* 690 */ 195, 92, 92, 30, 95, 83, 97, 98, 207, 208, |
| 133401 | + /* 700 */ 101, 206, 179, 180, 92, 172, 173, 95, 152, 97, |
| 133402 | + /* 710 */ 98, 188, 99, 101, 219, 102, 103, 104, 152, 119, |
| 133403 | + /* 720 */ 120, 196, 55, 56, 19, 20, 113, 22, 193, 163, |
| 133404 | + /* 730 */ 11, 132, 133, 134, 135, 136, 24, 65, 172, 173, |
| 133405 | + /* 740 */ 207, 208, 250, 152, 132, 133, 134, 135, 136, 193, |
| 133406 | + /* 750 */ 78, 84, 47, 48, 49, 98, 199, 152, 86, 54, |
| 133407 | + /* 760 */ 55, 56, 196, 152, 97, 98, 209, 55, 163, 244, |
| 133408 | + /* 770 */ 107, 66, 152, 207, 208, 164, 175, 172, 173, 19, |
| 133409 | + /* 780 */ 20, 124, 22, 111, 38, 39, 40, 41, 83, 43, |
| 133410 | + /* 790 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, |
| 133411 | + /* 800 */ 95, 196, 97, 98, 85, 152, 101, 47, 48, 97, |
| 133412 | + /* 810 */ 85, 92, 207, 193, 54, 55, 56, 92, 49, 175, |
| 133413 | + /* 820 */ 55, 56, 221, 222, 223, 12, 66, 108, 109, 110, |
| 133414 | + /* 830 */ 137, 163, 139, 108, 109, 110, 152, 132, 133, 134, |
| 133415 | + /* 840 */ 135, 136, 152, 83, 43, 44, 45, 46, 47, 48, |
| 133416 | + /* 850 */ 49, 50, 51, 52, 53, 95, 152, 97, 98, 55, |
| 133417 | + /* 860 */ 56, 101, 97, 98, 196, 221, 222, 223, 146, 147, |
| 133418 | + /* 870 */ 57, 171, 152, 22, 213, 19, 20, 49, 22, 179, |
| 133419 | + /* 880 */ 108, 109, 110, 55, 56, 116, 73, 219, 75, 124, |
| 133420 | + /* 890 */ 121, 152, 132, 133, 134, 135, 136, 193, 85, 152, |
| 133421 | + /* 900 */ 232, 97, 98, 47, 48, 237, 55, 56, 55, 5, |
| 133422 | + /* 910 */ 54, 55, 56, 193, 10, 11, 12, 13, 14, 172, |
| 133423 | + /* 920 */ 173, 17, 66, 47, 48, 97, 98, 152, 124, 166, |
| 133424 | + /* 930 */ 167, 55, 56, 186, 152, 152, 152, 22, 152, 83, |
| 133425 | + /* 940 */ 152, 152, 160, 152, 169, 170, 164, 152, 97, 98, |
| 133426 | + /* 950 */ 97, 95, 26, 97, 98, 172, 173, 101, 172, 173, |
| 133427 | + /* 960 */ 172, 173, 47, 48, 60, 22, 62, 172, 173, 186, |
| 133428 | + /* 970 */ 55, 56, 186, 97, 98, 71, 100, 193, 152, 55, |
| 133429 | + /* 980 */ 56, 186, 152, 107, 21, 109, 82, 163, 132, 133, |
| 133430 | + /* 990 */ 134, 135, 136, 89, 164, 207, 92, 93, 172, 173, |
| 133431 | + /* 1000 */ 181, 47, 48, 19, 16, 230, 217, 12, 132, 133, |
| 133432 | + /* 1010 */ 95, 163, 97, 183, 30, 185, 101, 152, 114, 152, |
| 133433 | + /* 1020 */ 196, 97, 98, 152, 98, 38, 39, 40, 41, 42, |
| 133434 | + /* 1030 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, |
| 133435 | + /* 1040 */ 53, 152, 152, 219, 196, 141, 152, 132, 133, 134, |
| 133436 | + /* 1050 */ 124, 225, 57, 152, 91, 108, 109, 110, 193, 211, |
| 133437 | + /* 1060 */ 212, 237, 172, 173, 152, 122, 103, 181, 73, 152, |
| 133438 | + /* 1070 */ 75, 210, 152, 172, 173, 92, 88, 152, 90, 152, |
| 133439 | + /* 1080 */ 22, 152, 163, 100, 172, 173, 132, 133, 152, 172, |
| 133440 | + /* 1090 */ 173, 107, 172, 173, 166, 167, 112, 172, 173, 172, |
| 133441 | + /* 1100 */ 173, 172, 173, 140, 152, 152, 217, 242, 172, 173, |
| 133442 | + /* 1110 */ 152, 217, 152, 55, 152, 196, 152, 245, 246, 152, |
| 133443 | + /* 1120 */ 152, 152, 152, 152, 172, 173, 152, 152, 140, 152, |
| 133444 | + /* 1130 */ 172, 173, 172, 173, 172, 173, 172, 173, 152, 172, |
| 133445 | + /* 1140 */ 173, 172, 173, 172, 173, 152, 172, 173, 152, 172, |
| 133446 | + /* 1150 */ 173, 152, 195, 152, 152, 97, 152, 163, 172, 173, |
| 133447 | + /* 1160 */ 152, 193, 152, 206, 152, 172, 173, 152, 172, 173, |
| 133448 | + /* 1170 */ 217, 172, 173, 152, 172, 173, 172, 173, 152, 26, |
| 133449 | + /* 1180 */ 172, 173, 172, 173, 172, 173, 152, 172, 173, 152, |
| 133450 | + /* 1190 */ 196, 152, 217, 172, 173, 152, 61, 152, 172, 173, |
| 133451 | + /* 1200 */ 152, 26, 152, 26, 152, 70, 172, 173, 191, 172, |
| 133452 | + /* 1210 */ 173, 172, 173, 152, 152, 172, 173, 172, 173, 152, |
| 133453 | + /* 1220 */ 172, 173, 172, 173, 172, 173, 152, 22, 23, 152, |
| 133454 | + /* 1230 */ 22, 152, 24, 172, 173, 22, 23, 152, 59, 172, |
| 133455 | + /* 1240 */ 173, 152, 63, 163, 163, 163, 172, 173, 22, 172, |
| 133456 | + /* 1250 */ 173, 172, 173, 163, 163, 116, 77, 172, 173, 152, |
| 133457 | + /* 1260 */ 121, 172, 173, 37, 7, 8, 9, 211, 212, 23, |
| 133458 | + /* 1270 */ 23, 23, 26, 26, 26, 55, 196, 196, 196, 23, |
| 133459 | + /* 1280 */ 55, 106, 26, 130, 152, 23, 196, 196, 26, 23, |
| 133460 | + /* 1290 */ 23, 101, 26, 26, 100, 101, 7, 8, 132, 133, |
| 133461 | + /* 1300 */ 123, 96, 112, 23, 152, 23, 26, 23, 26, 96, |
| 133462 | + /* 1310 */ 26, 23, 132, 133, 26, 152, 152, 97, 234, 152, |
| 133463 | + /* 1320 */ 152, 152, 97, 152, 152, 152, 152, 233, 152, 210, |
| 133464 | + /* 1330 */ 152, 210, 210, 152, 152, 152, 152, 197, 150, 198, |
| 133465 | + /* 1340 */ 214, 214, 239, 201, 201, 239, 176, 214, 200, 184, |
| 133466 | + /* 1350 */ 227, 155, 198, 67, 243, 122, 159, 159, 240, 69, |
| 133467 | + /* 1360 */ 240, 175, 175, 159, 175, 180, 22, 220, 27, 130, |
| 133468 | + /* 1370 */ 18, 159, 18, 158, 158, 220, 159, 137, 74, 235, |
| 133469 | + /* 1380 */ 189, 236, 159, 159, 22, 192, 158, 192, 177, 159, |
| 133470 | + /* 1390 */ 158, 192, 192, 201, 159, 189, 189, 76, 177, 158, |
| 133471 | + /* 1400 */ 107, 174, 201, 201, 182, 174, 177, 106, 174, 107, |
| 133472 | + /* 1410 */ 174, 159, 174, 176, 22, 137, 125, 174, 174, 216, |
| 133473 | + /* 1420 */ 159, 53, 126, 129, 182, 215, 128, 127, 25, 13, |
| 133474 | + /* 1430 */ 216, 177, 26, 215, 162, 216, 177, 161, 229, 6, |
| 133475 | + /* 1440 */ 153, 4, 165, 3, 165, 153, 151, 22, 151, 178, |
| 133476 | + /* 1450 */ 151, 178, 142, 15, 151, 94, 120, 16, 23, 23, |
| 133477 | + /* 1460 */ 215, 131, 111, 205, 204, 216, 215, 203, 123, 20, |
| 133478 | + /* 1470 */ 202, 201, 165, 125, 224, 16, 1, 131, 123, 226, |
| 133479 | + /* 1480 */ 37, 37, 37, 37, 229, 111, 56, 64, 122, 1, |
| 133480 | + /* 1490 */ 5, 22, 107, 140, 80, 80, 26, 87, 72, 20, |
| 133481 | + /* 1500 */ 107, 24, 19, 112, 105, 23, 22, 79, 22, 22, |
| 133482 | + /* 1510 */ 79, 22, 249, 58, 249, 246, 22, 26, 79, 68, |
| 133483 | + /* 1520 */ 23, 23, 23, 116, 22, 64, 23, 22, 56, 23, |
| 133484 | + /* 1530 */ 26, 122, 23, 22, 26, 124, 26, 64, 64, 23, |
| 133485 | + /* 1540 */ 23, 23, 23, 11, 23, 22, 26, 23, 22, 24, |
| 133486 | + /* 1550 */ 1, 23, 22, 26, 122, 24, 23, 22, 15, 23, |
| 133487 | + /* 1560 */ 23, 22, 251, 23, 122, 251, 251, 251, 251, 122, |
| 133488 | + /* 1570 */ 122, |
| 133489 | +}; |
| 133490 | +#define YY_SHIFT_USE_DFLT (1571) |
| 133491 | +#define YY_SHIFT_COUNT (455) |
| 132238 | 133492 | #define YY_SHIFT_MIN (-94) |
| 132239 | | -#define YY_SHIFT_MAX (1491) |
| 133493 | +#define YY_SHIFT_MAX (1549) |
| 132240 | 133494 | static const short yy_shift_ofst[] = { |
| 132241 | | - /* 0 */ 40, 564, 869, 577, 725, 725, 725, 725, 690, -19, |
| 132242 | | - /* 10 */ 16, 16, 100, 725, 725, 725, 725, 725, 725, 725, |
| 132243 | | - /* 20 */ 841, 841, 538, 507, 684, 565, 61, 137, 172, 207, |
| 132244 | | - /* 30 */ 242, 277, 312, 347, 382, 424, 424, 424, 424, 424, |
| 132245 | | - /* 40 */ 424, 424, 424, 424, 424, 424, 424, 424, 424, 424, |
| 132246 | | - /* 50 */ 459, 424, 494, 529, 529, 670, 725, 725, 725, 725, |
| 132247 | | - /* 60 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, |
| 132248 | | - /* 70 */ 725, 725, 725, 725, 725, 725, 725, 725, 725, 725, |
| 132249 | | - /* 80 */ 725, 725, 725, 725, 821, 725, 725, 725, 725, 725, |
| 132250 | | - /* 90 */ 725, 725, 725, 725, 725, 725, 725, 725, 952, 711, |
| 132251 | | - /* 100 */ 711, 711, 711, 711, 766, 23, 32, 924, 637, 825, |
| 132252 | | - /* 110 */ 837, 837, 924, 73, 183, -51, 1507, 1507, 1507, 501, |
| 132253 | | - /* 120 */ 501, 501, 903, 903, 632, 205, 241, 924, 924, 924, |
| 132254 | | - /* 130 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132255 | | - /* 140 */ 924, 924, 924, 924, 924, 924, 924, 192, 1027, 1106, |
| 132256 | | - /* 150 */ 1106, 183, 176, 176, 176, 176, 176, 176, 1507, 1507, |
| 132257 | | - /* 160 */ 1507, 880, -94, -94, 578, 734, 99, 730, 769, 349, |
| 132258 | | - /* 170 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132259 | | - /* 180 */ 924, 924, 924, 924, 924, 924, 924, 954, 954, 954, |
| 132260 | | - /* 190 */ 924, 924, 622, 924, 924, 924, -18, 924, 924, 914, |
| 132261 | | - /* 200 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 132262 | | - /* 210 */ 441, 1020, 1107, 1107, 1107, 569, 45, 217, 510, 423, |
| 132263 | | - /* 220 */ 834, 834, 1156, 423, 1156, 1144, 1187, 359, 1051, 834, |
| 132264 | | - /* 230 */ -17, 1051, 1051, 1099, 469, 1192, 1229, 1176, 1176, 1233, |
| 132265 | | - /* 240 */ 1233, 1176, 1277, 1285, 1183, 1296, 1296, 1296, 1296, 1176, |
| 132266 | | - /* 250 */ 1297, 1183, 1277, 1285, 1285, 1183, 1176, 1297, 1182, 1250, |
| 132267 | | - /* 260 */ 1176, 1176, 1297, 1311, 1176, 1297, 1176, 1297, 1311, 1234, |
| 132268 | | - /* 270 */ 1234, 1234, 1267, 1311, 1234, 1244, 1234, 1267, 1234, 1234, |
| 132269 | | - /* 280 */ 1232, 1247, 1232, 1247, 1232, 1247, 1232, 1247, 1176, 1334, |
| 132270 | | - /* 290 */ 1176, 1235, 1311, 1318, 1318, 1311, 1248, 1253, 1245, 1249, |
| 132271 | | - /* 300 */ 1183, 1355, 1357, 1368, 1368, 1378, 1378, 1378, 1378, 1507, |
| 132272 | | - /* 310 */ 1507, 1507, 1507, 1507, 1507, 1507, 1507, 451, 936, 816, |
| 132273 | | - /* 320 */ 888, 1069, 799, 1111, 1197, 1193, 1201, 1202, 1203, 1213, |
| 132274 | | - /* 330 */ 1134, 1117, 1230, 497, 1218, 1219, 1154, 1223, 1115, 1120, |
| 132275 | | - /* 340 */ 1231, 1164, 1160, 1392, 1394, 1376, 1257, 1385, 1307, 1386, |
| 132276 | | - /* 350 */ 1383, 1388, 1292, 1282, 1303, 1294, 1395, 1293, 1403, 1419, |
| 132277 | | - /* 360 */ 1298, 1291, 1389, 1390, 1314, 1372, 1365, 1308, 1430, 1427, |
| 132278 | | - /* 370 */ 1411, 1327, 1295, 1356, 1412, 1359, 1350, 1369, 1333, 1418, |
| 132279 | | - /* 380 */ 1423, 1425, 1335, 1340, 1424, 1370, 1426, 1428, 1429, 1431, |
| 132280 | | - /* 390 */ 1375, 1393, 1433, 1380, 1396, 1437, 1438, 1439, 1347, 1443, |
| 132281 | | - /* 400 */ 1444, 1446, 1440, 1348, 1448, 1449, 1413, 1409, 1452, 1351, |
| 132282 | | - /* 410 */ 1450, 1414, 1451, 1415, 1457, 1450, 1458, 1459, 1460, 1461, |
| 132283 | | - /* 420 */ 1462, 1464, 1473, 1465, 1467, 1466, 1468, 1469, 1471, 1472, |
| 132284 | | - /* 430 */ 1468, 1474, 1476, 1477, 1478, 1480, 1373, 1377, 1381, 1382, |
| 132285 | | - /* 440 */ 1482, 1491, 1490, |
| 133495 | + /* 0 */ 40, 599, 904, 612, 760, 760, 760, 760, 725, -19, |
| 133496 | + /* 10 */ 16, 16, 100, 760, 760, 760, 760, 760, 760, 760, |
| 133497 | + /* 20 */ 876, 876, 573, 542, 719, 600, 61, 137, 172, 207, |
| 133498 | + /* 30 */ 242, 277, 312, 347, 382, 417, 459, 459, 459, 459, |
| 133499 | + /* 40 */ 459, 459, 459, 459, 459, 459, 459, 459, 459, 459, |
| 133500 | + /* 50 */ 459, 459, 459, 494, 459, 529, 564, 564, 705, 760, |
| 133501 | + /* 60 */ 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, |
| 133502 | + /* 70 */ 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, |
| 133503 | + /* 80 */ 760, 760, 760, 760, 760, 760, 760, 760, 760, 760, |
| 133504 | + /* 90 */ 856, 760, 760, 760, 760, 760, 760, 760, 760, 760, |
| 133505 | + /* 100 */ 760, 760, 760, 760, 987, 746, 746, 746, 746, 746, |
| 133506 | + /* 110 */ 801, 23, 32, 924, 963, 984, 954, 954, 924, 73, |
| 133507 | + /* 120 */ 113, -51, 1571, 1571, 1571, 536, 536, 536, 99, 99, |
| 133508 | + /* 130 */ 813, 813, 667, 205, 240, 924, 924, 924, 924, 924, |
| 133509 | + /* 140 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 133510 | + /* 150 */ 924, 924, 924, 924, 924, 332, 983, 422, 422, 113, |
| 133511 | + /* 160 */ 30, 30, 30, 30, 30, 30, 1571, 1571, 1571, 915, |
| 133512 | + /* 170 */ -94, -94, 384, 613, 828, 420, 765, 804, 851, 924, |
| 133513 | + /* 180 */ 924, 924, 924, 924, 924, 924, 924, 924, 924, 924, |
| 133514 | + /* 190 */ 924, 924, 924, 924, 924, 672, 672, 672, 924, 924, |
| 133515 | + /* 200 */ 657, 924, 924, 924, -18, 924, 924, 995, 924, 924, |
| 133516 | + /* 210 */ 924, 924, 924, 924, 924, 924, 924, 924, 772, 1179, |
| 133517 | + /* 220 */ 712, 712, 712, 926, 45, 769, 1257, 1153, 418, 418, |
| 133518 | + /* 230 */ 569, 1153, 569, 1175, 607, 663, 1135, 418, 693, 1135, |
| 133519 | + /* 240 */ 1135, 1177, 1139, 1208, 1286, 1233, 1233, 1290, 1290, 1233, |
| 133520 | + /* 250 */ 1344, 1341, 1239, 1352, 1352, 1352, 1352, 1233, 1354, 1239, |
| 133521 | + /* 260 */ 1344, 1341, 1341, 1239, 1233, 1354, 1240, 1304, 1233, 1233, |
| 133522 | + /* 270 */ 1354, 1362, 1233, 1354, 1233, 1354, 1362, 1293, 1293, 1293, |
| 133523 | + /* 280 */ 1321, 1362, 1293, 1301, 1293, 1321, 1293, 1293, 1291, 1302, |
| 133524 | + /* 290 */ 1291, 1302, 1291, 1302, 1291, 1302, 1233, 1392, 1233, 1278, |
| 133525 | + /* 300 */ 1362, 1368, 1368, 1362, 1294, 1296, 1298, 1300, 1239, 1403, |
| 133526 | + /* 310 */ 1406, 1416, 1416, 1433, 1433, 1433, 1433, 1571, 1571, 1571, |
| 133527 | + /* 320 */ 1571, 1571, 1571, 1571, 1571, 519, 988, 1205, 1213, 104, |
| 133528 | + /* 330 */ 947, 1058, 1246, 1226, 1247, 1248, 1256, 1262, 1266, 1267, |
| 133529 | + /* 340 */ 853, 1194, 1289, 1190, 1280, 1282, 1220, 1284, 1166, 1180, |
| 133530 | + /* 350 */ 1288, 1225, 943, 1437, 1440, 1425, 1310, 1438, 1361, 1441, |
| 133531 | + /* 360 */ 1435, 1436, 1336, 1330, 1351, 1345, 1449, 1348, 1459, 1475, |
| 133532 | + /* 370 */ 1355, 1346, 1443, 1444, 1445, 1446, 1374, 1430, 1423, 1366, |
| 133533 | + /* 380 */ 1488, 1485, 1469, 1385, 1353, 1414, 1470, 1415, 1410, 1426, |
| 133534 | + /* 390 */ 1393, 1477, 1479, 1483, 1391, 1399, 1484, 1428, 1486, 1487, |
| 133535 | + /* 400 */ 1482, 1489, 1431, 1455, 1494, 1439, 1451, 1497, 1498, 1499, |
| 133536 | + /* 410 */ 1491, 1407, 1502, 1503, 1505, 1504, 1409, 1506, 1509, 1472, |
| 133537 | + /* 420 */ 1461, 1511, 1411, 1508, 1473, 1510, 1474, 1516, 1508, 1517, |
| 133538 | + /* 430 */ 1518, 1519, 1520, 1521, 1523, 1532, 1524, 1526, 1525, 1527, |
| 133539 | + /* 440 */ 1528, 1530, 1531, 1527, 1533, 1535, 1536, 1537, 1539, 1432, |
| 133540 | + /* 450 */ 1442, 1447, 1448, 1540, 1543, 1549, |
| 132286 | 133541 | }; |
| 132287 | 133542 | #define YY_REDUCE_USE_DFLT (-130) |
| 132288 | | -#define YY_REDUCE_COUNT (316) |
| 133543 | +#define YY_REDUCE_COUNT (324) |
| 132289 | 133544 | #define YY_REDUCE_MIN (-129) |
| 132290 | | -#define YY_REDUCE_MAX (1243) |
| 133545 | +#define YY_REDUCE_MAX (1307) |
| 132291 | 133546 | static const short yy_reduce_ofst[] = { |
| 132292 | | - /* 0 */ -29, 531, 490, 570, -49, 272, 456, 498, 633, 400, |
| 132293 | | - /* 10 */ 612, 626, 113, 482, 678, 719, 384, 726, 748, 791, |
| 132294 | | - /* 20 */ 419, 693, 761, 812, 819, 625, 76, 76, 76, 76, |
| 133547 | + /* 0 */ -29, 566, 525, 605, -49, 307, 491, 533, 668, 435, |
| 133548 | + /* 10 */ 601, 644, 148, 747, 783, 786, 419, 788, 795, 826, |
| 133549 | + /* 20 */ 454, 775, 830, 495, 824, 848, 76, 76, 76, 76, |
| 132295 | 133550 | /* 30 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, |
| 132296 | 133551 | /* 40 */ 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, |
| 132297 | | - /* 50 */ 76, 76, 76, 76, 76, 793, 795, 856, 871, 875, |
| 132298 | | - /* 60 */ 878, 881, 885, 887, 889, 894, 897, 900, 916, 919, |
| 132299 | | - /* 70 */ 922, 926, 928, 930, 932, 934, 938, 941, 944, 956, |
| 132300 | | - /* 80 */ 963, 966, 968, 970, 972, 974, 978, 980, 982, 996, |
| 132301 | | - /* 90 */ 1004, 1006, 1008, 1011, 1013, 1015, 1019, 1022, 76, 76, |
| 132302 | | - /* 100 */ 76, 76, 76, 76, 76, 76, 76, 555, 210, 260, |
| 132303 | | - /* 110 */ 200, 346, 571, 76, 700, 76, 76, 76, 76, 838, |
| 132304 | | - /* 120 */ 838, 838, 42, 182, 251, 160, 160, 550, 5, 455, |
| 132305 | | - /* 130 */ 585, 721, 749, 882, 884, 971, 618, 462, 797, 514, |
| 132306 | | - /* 140 */ 807, 524, 997, -129, 655, 859, 62, 290, 66, 1030, |
| 132307 | | - /* 150 */ 1032, 589, 1009, 1010, 1037, 1038, 1039, 1044, 740, 852, |
| 132308 | | - /* 160 */ 1012, 112, 147, 230, 257, 180, 369, 403, 500, 549, |
| 132309 | | - /* 170 */ 556, 563, 694, 751, 765, 772, 778, 820, 868, 873, |
| 132310 | | - /* 180 */ 890, 929, 935, 985, 1041, 1080, 1091, 540, 593, 661, |
| 132311 | | - /* 190 */ 1103, 1104, 842, 1108, 1110, 1112, 1048, 1113, 1114, 1068, |
| 132312 | | - /* 200 */ 1116, 1118, 1119, 180, 1121, 1122, 1123, 1124, 1125, 1126, |
| 132313 | | - /* 210 */ 1029, 1034, 1059, 1062, 1070, 842, 1082, 1083, 1133, 1084, |
| 132314 | | - /* 220 */ 1072, 1073, 1045, 1087, 1050, 1127, 1109, 1128, 1129, 1076, |
| 132315 | | - /* 230 */ 1064, 1130, 1131, 1092, 1096, 1140, 1054, 1141, 1142, 1067, |
| 132316 | | - /* 240 */ 1071, 1150, 1090, 1132, 1135, 1136, 1137, 1138, 1139, 1157, |
| 132317 | | - /* 250 */ 1159, 1143, 1098, 1145, 1146, 1147, 1161, 1165, 1086, 1097, |
| 132318 | | - /* 260 */ 1166, 1167, 1169, 1162, 1178, 1180, 1181, 1184, 1168, 1172, |
| 132319 | | - /* 270 */ 1173, 1175, 1170, 1174, 1179, 1185, 1186, 1177, 1188, 1189, |
| 132320 | | - /* 280 */ 1148, 1151, 1149, 1152, 1153, 1155, 1158, 1163, 1196, 1171, |
| 132321 | | - /* 290 */ 1199, 1190, 1191, 1194, 1195, 1198, 1200, 1204, 1206, 1205, |
| 132322 | | - /* 300 */ 1209, 1220, 1224, 1236, 1237, 1240, 1241, 1242, 1243, 1207, |
| 132323 | | - /* 310 */ 1208, 1212, 1221, 1222, 1210, 1225, 1239, |
| 133552 | + /* 50 */ 76, 76, 76, 76, 76, 76, 76, 76, 890, 901, |
| 133553 | + /* 60 */ 912, 917, 920, 925, 927, 929, 936, 952, 958, 960, |
| 133554 | + /* 70 */ 962, 964, 967, 969, 971, 974, 977, 986, 993, 996, |
| 133555 | + /* 80 */ 999, 1002, 1004, 1008, 1010, 1012, 1015, 1021, 1026, 1034, |
| 133556 | + /* 90 */ 1037, 1039, 1043, 1045, 1048, 1050, 1052, 1061, 1067, 1074, |
| 133557 | + /* 100 */ 1077, 1079, 1085, 1089, 76, 76, 76, 76, 76, 76, |
| 133558 | + /* 110 */ 76, 76, 76, 865, 36, 523, 235, 416, 782, 76, |
| 133559 | + /* 120 */ 278, 76, 76, 76, 76, 700, 700, 700, 150, 220, |
| 133560 | + /* 130 */ 147, 217, 221, 306, 306, 611, 5, 535, 556, 620, |
| 133561 | + /* 140 */ 704, 720, 784, 116, 789, 349, 889, 894, 404, 953, |
| 133562 | + /* 150 */ 968, -129, 975, 492, 62, 722, 919, 763, 928, 957, |
| 133563 | + /* 160 */ 994, 1080, 1081, 1082, 1090, 1091, 872, 1056, 557, 57, |
| 133564 | + /* 170 */ 112, 131, 167, 182, 250, 272, 291, 331, 364, 438, |
| 133565 | + /* 180 */ 497, 517, 591, 653, 684, 690, 739, 791, 867, 871, |
| 133566 | + /* 190 */ 970, 1062, 1107, 1132, 1152, 355, 819, 886, 1001, 1163, |
| 133567 | + /* 200 */ 661, 1164, 1167, 1168, 861, 1169, 1171, 1017, 1172, 1173, |
| 133568 | + /* 210 */ 1174, 250, 1176, 1178, 1181, 1182, 1183, 1184, 1084, 1094, |
| 133569 | + /* 220 */ 1119, 1121, 1122, 661, 1140, 1141, 1188, 1142, 1126, 1127, |
| 133570 | + /* 230 */ 1103, 1143, 1106, 1170, 1165, 1185, 1186, 1133, 1123, 1187, |
| 133571 | + /* 240 */ 1189, 1148, 1154, 1196, 1111, 1197, 1198, 1118, 1120, 1204, |
| 133572 | + /* 250 */ 1147, 1191, 1192, 1193, 1195, 1199, 1200, 1212, 1215, 1201, |
| 133573 | + /* 260 */ 1155, 1206, 1207, 1202, 1217, 1216, 1145, 1144, 1223, 1224, |
| 133574 | + /* 270 */ 1228, 1211, 1230, 1232, 1235, 1241, 1221, 1227, 1231, 1234, |
| 133575 | + /* 280 */ 1222, 1229, 1236, 1237, 1238, 1242, 1243, 1244, 1203, 1210, |
| 133576 | + /* 290 */ 1214, 1218, 1219, 1245, 1249, 1251, 1252, 1250, 1261, 1253, |
| 133577 | + /* 300 */ 1254, 1209, 1255, 1259, 1258, 1260, 1264, 1268, 1270, 1272, |
| 133578 | + /* 310 */ 1276, 1287, 1292, 1295, 1297, 1299, 1303, 1263, 1265, 1269, |
| 133579 | + /* 320 */ 1277, 1279, 1271, 1273, 1307, |
| 132324 | 133580 | }; |
| 132325 | 133581 | static const YYACTIONTYPE yy_default[] = { |
| 132326 | | - /* 0 */ 1258, 1248, 1248, 1248, 1180, 1180, 1180, 1180, 1248, 1077, |
| 132327 | | - /* 10 */ 1106, 1106, 1232, 1309, 1309, 1309, 1309, 1309, 1309, 1179, |
| 132328 | | - /* 20 */ 1309, 1309, 1309, 1309, 1248, 1081, 1112, 1309, 1309, 1309, |
| 132329 | | - /* 30 */ 1309, 1309, 1309, 1309, 1309, 1231, 1233, 1120, 1119, 1214, |
| 132330 | | - /* 40 */ 1093, 1117, 1110, 1114, 1181, 1175, 1176, 1174, 1178, 1182, |
| 132331 | | - /* 50 */ 1309, 1113, 1144, 1159, 1143, 1309, 1309, 1309, 1309, 1309, |
| 132332 | | - /* 60 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132333 | | - /* 70 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132334 | | - /* 80 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132335 | | - /* 90 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1153, 1158, |
| 132336 | | - /* 100 */ 1165, 1157, 1154, 1146, 1145, 1147, 1148, 1309, 1000, 1048, |
| 132337 | | - /* 110 */ 1309, 1309, 1309, 1149, 1309, 1150, 1162, 1161, 1160, 1239, |
| 132338 | | - /* 120 */ 1266, 1265, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132339 | | - /* 130 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132340 | | - /* 140 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1258, 1248, 1006, |
| 132341 | | - /* 150 */ 1006, 1309, 1248, 1248, 1248, 1248, 1248, 1248, 1244, 1081, |
| 132342 | | - /* 160 */ 1072, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132343 | | - /* 170 */ 1309, 1236, 1234, 1309, 1195, 1309, 1309, 1309, 1309, 1309, |
| 132344 | | - /* 180 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132345 | | - /* 190 */ 1309, 1309, 1309, 1309, 1309, 1309, 1077, 1309, 1309, 1309, |
| 132346 | | - /* 200 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1260, |
| 132347 | | - /* 210 */ 1309, 1209, 1077, 1077, 1077, 1079, 1061, 1071, 985, 1116, |
| 132348 | | - /* 220 */ 1095, 1095, 1298, 1116, 1298, 1023, 1280, 1020, 1106, 1095, |
| 132349 | | - /* 230 */ 1177, 1106, 1106, 1078, 1071, 1309, 1301, 1086, 1086, 1300, |
| 132350 | | - /* 240 */ 1300, 1086, 1125, 1051, 1116, 1057, 1057, 1057, 1057, 1086, |
| 132351 | | - /* 250 */ 997, 1116, 1125, 1051, 1051, 1116, 1086, 997, 1213, 1295, |
| 132352 | | - /* 260 */ 1086, 1086, 997, 1188, 1086, 997, 1086, 997, 1188, 1049, |
| 132353 | | - /* 270 */ 1049, 1049, 1038, 1188, 1049, 1023, 1049, 1038, 1049, 1049, |
| 132354 | | - /* 280 */ 1099, 1094, 1099, 1094, 1099, 1094, 1099, 1094, 1086, 1183, |
| 132355 | | - /* 290 */ 1086, 1309, 1188, 1192, 1192, 1188, 1111, 1100, 1109, 1107, |
| 132356 | | - /* 300 */ 1116, 1003, 1041, 1263, 1263, 1259, 1259, 1259, 1259, 1306, |
| 132357 | | - /* 310 */ 1306, 1244, 1275, 1275, 1025, 1025, 1275, 1309, 1309, 1309, |
| 132358 | | - /* 320 */ 1309, 1309, 1309, 1270, 1309, 1197, 1309, 1309, 1309, 1309, |
| 132359 | | - /* 330 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132360 | | - /* 340 */ 1309, 1309, 1131, 1309, 981, 1241, 1309, 1309, 1240, 1309, |
| 132361 | | - /* 350 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132362 | | - /* 360 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1297, 1309, 1309, |
| 132363 | | - /* 370 */ 1309, 1309, 1309, 1309, 1212, 1211, 1309, 1309, 1309, 1309, |
| 132364 | | - /* 380 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132365 | | - /* 390 */ 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1309, 1063, 1309, |
| 132366 | | - /* 400 */ 1309, 1309, 1284, 1309, 1309, 1309, 1309, 1309, 1309, 1309, |
| 132367 | | - /* 410 */ 1108, 1309, 1101, 1309, 1309, 1288, 1309, 1309, 1309, 1309, |
| 132368 | | - /* 420 */ 1309, 1309, 1309, 1309, 1309, 1309, 1250, 1309, 1309, 1309, |
| 132369 | | - /* 430 */ 1249, 1309, 1309, 1309, 1309, 1309, 1133, 1309, 1132, 1136, |
| 132370 | | - /* 440 */ 1309, 991, 1309, |
| 133582 | + /* 0 */ 1278, 1268, 1268, 1268, 1200, 1200, 1200, 1200, 1268, 1094, |
| 133583 | + /* 10 */ 1123, 1123, 1252, 1329, 1329, 1329, 1329, 1329, 1329, 1199, |
| 133584 | + /* 20 */ 1329, 1329, 1329, 1329, 1268, 1098, 1129, 1329, 1329, 1329, |
| 133585 | + /* 30 */ 1329, 1201, 1202, 1329, 1329, 1329, 1251, 1253, 1139, 1138, |
| 133586 | + /* 40 */ 1137, 1136, 1234, 1110, 1134, 1127, 1131, 1201, 1195, 1196, |
| 133587 | + /* 50 */ 1194, 1198, 1202, 1329, 1130, 1164, 1179, 1163, 1329, 1329, |
| 133588 | + /* 60 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133589 | + /* 70 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133590 | + /* 80 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133591 | + /* 90 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133592 | + /* 100 */ 1329, 1329, 1329, 1329, 1173, 1178, 1185, 1177, 1174, 1166, |
| 133593 | + /* 110 */ 1165, 1167, 1168, 1329, 1017, 1065, 1329, 1329, 1329, 1169, |
| 133594 | + /* 120 */ 1329, 1170, 1182, 1181, 1180, 1259, 1286, 1285, 1329, 1329, |
| 133595 | + /* 130 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133596 | + /* 140 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133597 | + /* 150 */ 1329, 1329, 1329, 1329, 1329, 1278, 1268, 1023, 1023, 1329, |
| 133598 | + /* 160 */ 1268, 1268, 1268, 1268, 1268, 1268, 1264, 1098, 1089, 1329, |
| 133599 | + /* 170 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133600 | + /* 180 */ 1256, 1254, 1329, 1215, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133601 | + /* 190 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133602 | + /* 200 */ 1329, 1329, 1329, 1329, 1094, 1329, 1329, 1329, 1329, 1329, |
| 133603 | + /* 210 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1280, 1329, 1229, |
| 133604 | + /* 220 */ 1094, 1094, 1094, 1096, 1078, 1088, 1002, 1133, 1112, 1112, |
| 133605 | + /* 230 */ 1318, 1133, 1318, 1040, 1300, 1037, 1123, 1112, 1197, 1123, |
| 133606 | + /* 240 */ 1123, 1095, 1088, 1329, 1321, 1103, 1103, 1320, 1320, 1103, |
| 133607 | + /* 250 */ 1144, 1068, 1133, 1074, 1074, 1074, 1074, 1103, 1014, 1133, |
| 133608 | + /* 260 */ 1144, 1068, 1068, 1133, 1103, 1014, 1233, 1315, 1103, 1103, |
| 133609 | + /* 270 */ 1014, 1208, 1103, 1014, 1103, 1014, 1208, 1066, 1066, 1066, |
| 133610 | + /* 280 */ 1055, 1208, 1066, 1040, 1066, 1055, 1066, 1066, 1116, 1111, |
| 133611 | + /* 290 */ 1116, 1111, 1116, 1111, 1116, 1111, 1103, 1203, 1103, 1329, |
| 133612 | + /* 300 */ 1208, 1212, 1212, 1208, 1128, 1117, 1126, 1124, 1133, 1020, |
| 133613 | + /* 310 */ 1058, 1283, 1283, 1279, 1279, 1279, 1279, 1326, 1326, 1264, |
| 133614 | + /* 320 */ 1295, 1295, 1042, 1042, 1295, 1329, 1329, 1329, 1329, 1329, |
| 133615 | + /* 330 */ 1329, 1290, 1329, 1217, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133616 | + /* 340 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133617 | + /* 350 */ 1329, 1329, 1150, 1329, 998, 1261, 1329, 1329, 1260, 1329, |
| 133618 | + /* 360 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133619 | + /* 370 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1317, |
| 133620 | + /* 380 */ 1329, 1329, 1329, 1329, 1329, 1329, 1232, 1231, 1329, 1329, |
| 133621 | + /* 390 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133622 | + /* 400 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, |
| 133623 | + /* 410 */ 1329, 1080, 1329, 1329, 1329, 1304, 1329, 1329, 1329, 1329, |
| 133624 | + /* 420 */ 1329, 1329, 1329, 1125, 1329, 1118, 1329, 1329, 1308, 1329, |
| 133625 | + /* 430 */ 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1329, 1270, |
| 133626 | + /* 440 */ 1329, 1329, 1329, 1269, 1329, 1329, 1329, 1329, 1329, 1152, |
| 133627 | + /* 450 */ 1329, 1151, 1155, 1329, 1008, 1329, |
| 132371 | 133628 | }; |
| 132372 | 133629 | /********** End of lemon-generated parsing tables *****************************/ |
| 132373 | 133630 | |
| 132374 | 133631 | /* The next table maps tokens (terminal symbols) into fallback tokens. |
| 132375 | 133632 | ** If a construct like the following: |
| | @@ -132775,199 +134032,202 @@ |
| 132775 | 134032 | /* 134 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt", |
| 132776 | 134033 | /* 135 */ "where_opt ::=", |
| 132777 | 134034 | /* 136 */ "where_opt ::= WHERE expr", |
| 132778 | 134035 | /* 137 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt", |
| 132779 | 134036 | /* 138 */ "setlist ::= setlist COMMA nm EQ expr", |
| 132780 | | - /* 139 */ "setlist ::= nm EQ expr", |
| 132781 | | - /* 140 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select", |
| 132782 | | - /* 141 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES", |
| 132783 | | - /* 142 */ "insert_cmd ::= INSERT orconf", |
| 132784 | | - /* 143 */ "insert_cmd ::= REPLACE", |
| 132785 | | - /* 144 */ "idlist_opt ::=", |
| 132786 | | - /* 145 */ "idlist_opt ::= LP idlist RP", |
| 132787 | | - /* 146 */ "idlist ::= idlist COMMA nm", |
| 132788 | | - /* 147 */ "idlist ::= nm", |
| 132789 | | - /* 148 */ "expr ::= LP expr RP", |
| 132790 | | - /* 149 */ "term ::= NULL", |
| 132791 | | - /* 150 */ "expr ::= ID|INDEXED", |
| 132792 | | - /* 151 */ "expr ::= JOIN_KW", |
| 132793 | | - /* 152 */ "expr ::= nm DOT nm", |
| 132794 | | - /* 153 */ "expr ::= nm DOT nm DOT nm", |
| 132795 | | - /* 154 */ "term ::= INTEGER|FLOAT|BLOB", |
| 132796 | | - /* 155 */ "term ::= STRING", |
| 132797 | | - /* 156 */ "expr ::= VARIABLE", |
| 132798 | | - /* 157 */ "expr ::= expr COLLATE ID|STRING", |
| 132799 | | - /* 158 */ "expr ::= CAST LP expr AS typetoken RP", |
| 132800 | | - /* 159 */ "expr ::= ID|INDEXED LP distinct exprlist RP", |
| 132801 | | - /* 160 */ "expr ::= ID|INDEXED LP STAR RP", |
| 132802 | | - /* 161 */ "term ::= CTIME_KW", |
| 132803 | | - /* 162 */ "expr ::= expr AND expr", |
| 132804 | | - /* 163 */ "expr ::= expr OR expr", |
| 132805 | | - /* 164 */ "expr ::= expr LT|GT|GE|LE expr", |
| 132806 | | - /* 165 */ "expr ::= expr EQ|NE expr", |
| 132807 | | - /* 166 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 132808 | | - /* 167 */ "expr ::= expr PLUS|MINUS expr", |
| 132809 | | - /* 168 */ "expr ::= expr STAR|SLASH|REM expr", |
| 132810 | | - /* 169 */ "expr ::= expr CONCAT expr", |
| 132811 | | - /* 170 */ "likeop ::= LIKE_KW|MATCH", |
| 132812 | | - /* 171 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 132813 | | - /* 172 */ "expr ::= expr likeop expr", |
| 132814 | | - /* 173 */ "expr ::= expr likeop expr ESCAPE expr", |
| 132815 | | - /* 174 */ "expr ::= expr ISNULL|NOTNULL", |
| 132816 | | - /* 175 */ "expr ::= expr NOT NULL", |
| 132817 | | - /* 176 */ "expr ::= expr IS expr", |
| 132818 | | - /* 177 */ "expr ::= expr IS NOT expr", |
| 132819 | | - /* 178 */ "expr ::= NOT expr", |
| 132820 | | - /* 179 */ "expr ::= BITNOT expr", |
| 132821 | | - /* 180 */ "expr ::= MINUS expr", |
| 132822 | | - /* 181 */ "expr ::= PLUS expr", |
| 132823 | | - /* 182 */ "between_op ::= BETWEEN", |
| 132824 | | - /* 183 */ "between_op ::= NOT BETWEEN", |
| 132825 | | - /* 184 */ "expr ::= expr between_op expr AND expr", |
| 132826 | | - /* 185 */ "in_op ::= IN", |
| 132827 | | - /* 186 */ "in_op ::= NOT IN", |
| 132828 | | - /* 187 */ "expr ::= expr in_op LP exprlist RP", |
| 132829 | | - /* 188 */ "expr ::= LP select RP", |
| 132830 | | - /* 189 */ "expr ::= expr in_op LP select RP", |
| 132831 | | - /* 190 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 132832 | | - /* 191 */ "expr ::= EXISTS LP select RP", |
| 132833 | | - /* 192 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 132834 | | - /* 193 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 132835 | | - /* 194 */ "case_exprlist ::= WHEN expr THEN expr", |
| 132836 | | - /* 195 */ "case_else ::= ELSE expr", |
| 132837 | | - /* 196 */ "case_else ::=", |
| 132838 | | - /* 197 */ "case_operand ::= expr", |
| 132839 | | - /* 198 */ "case_operand ::=", |
| 132840 | | - /* 199 */ "exprlist ::=", |
| 132841 | | - /* 200 */ "nexprlist ::= nexprlist COMMA expr", |
| 132842 | | - /* 201 */ "nexprlist ::= expr", |
| 132843 | | - /* 202 */ "paren_exprlist ::=", |
| 132844 | | - /* 203 */ "paren_exprlist ::= LP exprlist RP", |
| 132845 | | - /* 204 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 132846 | | - /* 205 */ "uniqueflag ::= UNIQUE", |
| 132847 | | - /* 206 */ "uniqueflag ::=", |
| 132848 | | - /* 207 */ "eidlist_opt ::=", |
| 132849 | | - /* 208 */ "eidlist_opt ::= LP eidlist RP", |
| 132850 | | - /* 209 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 132851 | | - /* 210 */ "eidlist ::= nm collate sortorder", |
| 132852 | | - /* 211 */ "collate ::=", |
| 132853 | | - /* 212 */ "collate ::= COLLATE ID|STRING", |
| 132854 | | - /* 213 */ "cmd ::= DROP INDEX ifexists fullname", |
| 132855 | | - /* 214 */ "cmd ::= VACUUM", |
| 132856 | | - /* 215 */ "cmd ::= VACUUM nm", |
| 132857 | | - /* 216 */ "cmd ::= PRAGMA nm dbnm", |
| 132858 | | - /* 217 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 132859 | | - /* 218 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 132860 | | - /* 219 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 132861 | | - /* 220 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 132862 | | - /* 221 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 132863 | | - /* 222 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 132864 | | - /* 223 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 132865 | | - /* 224 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 132866 | | - /* 225 */ "trigger_time ::= BEFORE", |
| 132867 | | - /* 226 */ "trigger_time ::= AFTER", |
| 132868 | | - /* 227 */ "trigger_time ::= INSTEAD OF", |
| 132869 | | - /* 228 */ "trigger_time ::=", |
| 132870 | | - /* 229 */ "trigger_event ::= DELETE|INSERT", |
| 132871 | | - /* 230 */ "trigger_event ::= UPDATE", |
| 132872 | | - /* 231 */ "trigger_event ::= UPDATE OF idlist", |
| 132873 | | - /* 232 */ "when_clause ::=", |
| 132874 | | - /* 233 */ "when_clause ::= WHEN expr", |
| 132875 | | - /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 132876 | | - /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 132877 | | - /* 236 */ "trnm ::= nm DOT nm", |
| 132878 | | - /* 237 */ "tridxby ::= INDEXED BY nm", |
| 132879 | | - /* 238 */ "tridxby ::= NOT INDEXED", |
| 132880 | | - /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 132881 | | - /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 132882 | | - /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 132883 | | - /* 242 */ "trigger_cmd ::= select", |
| 132884 | | - /* 243 */ "expr ::= RAISE LP IGNORE RP", |
| 132885 | | - /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 132886 | | - /* 245 */ "raisetype ::= ROLLBACK", |
| 132887 | | - /* 246 */ "raisetype ::= ABORT", |
| 132888 | | - /* 247 */ "raisetype ::= FAIL", |
| 132889 | | - /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 132890 | | - /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 132891 | | - /* 250 */ "cmd ::= DETACH database_kw_opt expr", |
| 132892 | | - /* 251 */ "key_opt ::=", |
| 132893 | | - /* 252 */ "key_opt ::= KEY expr", |
| 132894 | | - /* 253 */ "cmd ::= REINDEX", |
| 132895 | | - /* 254 */ "cmd ::= REINDEX nm dbnm", |
| 132896 | | - /* 255 */ "cmd ::= ANALYZE", |
| 132897 | | - /* 256 */ "cmd ::= ANALYZE nm dbnm", |
| 132898 | | - /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 132899 | | - /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 132900 | | - /* 259 */ "add_column_fullname ::= fullname", |
| 132901 | | - /* 260 */ "cmd ::= create_vtab", |
| 132902 | | - /* 261 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 132903 | | - /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 132904 | | - /* 263 */ "vtabarg ::=", |
| 132905 | | - /* 264 */ "vtabargtoken ::= ANY", |
| 132906 | | - /* 265 */ "vtabargtoken ::= lp anylist RP", |
| 132907 | | - /* 266 */ "lp ::= LP", |
| 132908 | | - /* 267 */ "with ::=", |
| 132909 | | - /* 268 */ "with ::= WITH wqlist", |
| 132910 | | - /* 269 */ "with ::= WITH RECURSIVE wqlist", |
| 132911 | | - /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 132912 | | - /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 132913 | | - /* 272 */ "input ::= cmdlist", |
| 132914 | | - /* 273 */ "cmdlist ::= cmdlist ecmd", |
| 132915 | | - /* 274 */ "cmdlist ::= ecmd", |
| 132916 | | - /* 275 */ "ecmd ::= SEMI", |
| 132917 | | - /* 276 */ "ecmd ::= explain cmdx SEMI", |
| 132918 | | - /* 277 */ "explain ::=", |
| 132919 | | - /* 278 */ "trans_opt ::=", |
| 132920 | | - /* 279 */ "trans_opt ::= TRANSACTION", |
| 132921 | | - /* 280 */ "trans_opt ::= TRANSACTION nm", |
| 132922 | | - /* 281 */ "savepoint_opt ::= SAVEPOINT", |
| 132923 | | - /* 282 */ "savepoint_opt ::=", |
| 132924 | | - /* 283 */ "cmd ::= create_table create_table_args", |
| 132925 | | - /* 284 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 132926 | | - /* 285 */ "columnlist ::= columnname carglist", |
| 132927 | | - /* 286 */ "nm ::= ID|INDEXED", |
| 132928 | | - /* 287 */ "nm ::= STRING", |
| 132929 | | - /* 288 */ "nm ::= JOIN_KW", |
| 132930 | | - /* 289 */ "typetoken ::= typename", |
| 132931 | | - /* 290 */ "typename ::= ID|STRING", |
| 132932 | | - /* 291 */ "signed ::= plus_num", |
| 132933 | | - /* 292 */ "signed ::= minus_num", |
| 132934 | | - /* 293 */ "carglist ::= carglist ccons", |
| 132935 | | - /* 294 */ "carglist ::=", |
| 132936 | | - /* 295 */ "ccons ::= NULL onconf", |
| 132937 | | - /* 296 */ "conslist_opt ::= COMMA conslist", |
| 132938 | | - /* 297 */ "conslist ::= conslist tconscomma tcons", |
| 132939 | | - /* 298 */ "conslist ::= tcons", |
| 132940 | | - /* 299 */ "tconscomma ::=", |
| 132941 | | - /* 300 */ "defer_subclause_opt ::= defer_subclause", |
| 132942 | | - /* 301 */ "resolvetype ::= raisetype", |
| 132943 | | - /* 302 */ "selectnowith ::= oneselect", |
| 132944 | | - /* 303 */ "oneselect ::= values", |
| 132945 | | - /* 304 */ "sclp ::= selcollist COMMA", |
| 132946 | | - /* 305 */ "as ::= ID|STRING", |
| 132947 | | - /* 306 */ "expr ::= term", |
| 132948 | | - /* 307 */ "exprlist ::= nexprlist", |
| 132949 | | - /* 308 */ "nmnum ::= plus_num", |
| 132950 | | - /* 309 */ "nmnum ::= nm", |
| 132951 | | - /* 310 */ "nmnum ::= ON", |
| 132952 | | - /* 311 */ "nmnum ::= DELETE", |
| 132953 | | - /* 312 */ "nmnum ::= DEFAULT", |
| 132954 | | - /* 313 */ "plus_num ::= INTEGER|FLOAT", |
| 132955 | | - /* 314 */ "foreach_clause ::=", |
| 132956 | | - /* 315 */ "foreach_clause ::= FOR EACH ROW", |
| 132957 | | - /* 316 */ "trnm ::= nm", |
| 132958 | | - /* 317 */ "tridxby ::=", |
| 132959 | | - /* 318 */ "database_kw_opt ::= DATABASE", |
| 132960 | | - /* 319 */ "database_kw_opt ::=", |
| 132961 | | - /* 320 */ "kwcolumn_opt ::=", |
| 132962 | | - /* 321 */ "kwcolumn_opt ::= COLUMNKW", |
| 132963 | | - /* 322 */ "vtabarglist ::= vtabarg", |
| 132964 | | - /* 323 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 132965 | | - /* 324 */ "vtabarg ::= vtabarg vtabargtoken", |
| 132966 | | - /* 325 */ "anylist ::=", |
| 132967 | | - /* 326 */ "anylist ::= anylist LP anylist RP", |
| 132968 | | - /* 327 */ "anylist ::= anylist ANY", |
| 134037 | + /* 139 */ "setlist ::= setlist COMMA LP idlist RP EQ expr", |
| 134038 | + /* 140 */ "setlist ::= nm EQ expr", |
| 134039 | + /* 141 */ "setlist ::= LP idlist RP EQ expr", |
| 134040 | + /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select", |
| 134041 | + /* 143 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES", |
| 134042 | + /* 144 */ "insert_cmd ::= INSERT orconf", |
| 134043 | + /* 145 */ "insert_cmd ::= REPLACE", |
| 134044 | + /* 146 */ "idlist_opt ::=", |
| 134045 | + /* 147 */ "idlist_opt ::= LP idlist RP", |
| 134046 | + /* 148 */ "idlist ::= idlist COMMA nm", |
| 134047 | + /* 149 */ "idlist ::= nm", |
| 134048 | + /* 150 */ "expr ::= LP expr RP", |
| 134049 | + /* 151 */ "term ::= NULL", |
| 134050 | + /* 152 */ "expr ::= ID|INDEXED", |
| 134051 | + /* 153 */ "expr ::= JOIN_KW", |
| 134052 | + /* 154 */ "expr ::= nm DOT nm", |
| 134053 | + /* 155 */ "expr ::= nm DOT nm DOT nm", |
| 134054 | + /* 156 */ "term ::= INTEGER|FLOAT|BLOB", |
| 134055 | + /* 157 */ "term ::= STRING", |
| 134056 | + /* 158 */ "expr ::= VARIABLE", |
| 134057 | + /* 159 */ "expr ::= expr COLLATE ID|STRING", |
| 134058 | + /* 160 */ "expr ::= CAST LP expr AS typetoken RP", |
| 134059 | + /* 161 */ "expr ::= ID|INDEXED LP distinct exprlist RP", |
| 134060 | + /* 162 */ "expr ::= ID|INDEXED LP STAR RP", |
| 134061 | + /* 163 */ "term ::= CTIME_KW", |
| 134062 | + /* 164 */ "expr ::= LP nexprlist COMMA expr RP", |
| 134063 | + /* 165 */ "expr ::= expr AND expr", |
| 134064 | + /* 166 */ "expr ::= expr OR expr", |
| 134065 | + /* 167 */ "expr ::= expr LT|GT|GE|LE expr", |
| 134066 | + /* 168 */ "expr ::= expr EQ|NE expr", |
| 134067 | + /* 169 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", |
| 134068 | + /* 170 */ "expr ::= expr PLUS|MINUS expr", |
| 134069 | + /* 171 */ "expr ::= expr STAR|SLASH|REM expr", |
| 134070 | + /* 172 */ "expr ::= expr CONCAT expr", |
| 134071 | + /* 173 */ "likeop ::= LIKE_KW|MATCH", |
| 134072 | + /* 174 */ "likeop ::= NOT LIKE_KW|MATCH", |
| 134073 | + /* 175 */ "expr ::= expr likeop expr", |
| 134074 | + /* 176 */ "expr ::= expr likeop expr ESCAPE expr", |
| 134075 | + /* 177 */ "expr ::= expr ISNULL|NOTNULL", |
| 134076 | + /* 178 */ "expr ::= expr NOT NULL", |
| 134077 | + /* 179 */ "expr ::= expr IS expr", |
| 134078 | + /* 180 */ "expr ::= expr IS NOT expr", |
| 134079 | + /* 181 */ "expr ::= NOT expr", |
| 134080 | + /* 182 */ "expr ::= BITNOT expr", |
| 134081 | + /* 183 */ "expr ::= MINUS expr", |
| 134082 | + /* 184 */ "expr ::= PLUS expr", |
| 134083 | + /* 185 */ "between_op ::= BETWEEN", |
| 134084 | + /* 186 */ "between_op ::= NOT BETWEEN", |
| 134085 | + /* 187 */ "expr ::= expr between_op expr AND expr", |
| 134086 | + /* 188 */ "in_op ::= IN", |
| 134087 | + /* 189 */ "in_op ::= NOT IN", |
| 134088 | + /* 190 */ "expr ::= expr in_op LP exprlist RP", |
| 134089 | + /* 191 */ "expr ::= LP select RP", |
| 134090 | + /* 192 */ "expr ::= expr in_op LP select RP", |
| 134091 | + /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist", |
| 134092 | + /* 194 */ "expr ::= EXISTS LP select RP", |
| 134093 | + /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END", |
| 134094 | + /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", |
| 134095 | + /* 197 */ "case_exprlist ::= WHEN expr THEN expr", |
| 134096 | + /* 198 */ "case_else ::= ELSE expr", |
| 134097 | + /* 199 */ "case_else ::=", |
| 134098 | + /* 200 */ "case_operand ::= expr", |
| 134099 | + /* 201 */ "case_operand ::=", |
| 134100 | + /* 202 */ "exprlist ::=", |
| 134101 | + /* 203 */ "nexprlist ::= nexprlist COMMA expr", |
| 134102 | + /* 204 */ "nexprlist ::= expr", |
| 134103 | + /* 205 */ "paren_exprlist ::=", |
| 134104 | + /* 206 */ "paren_exprlist ::= LP exprlist RP", |
| 134105 | + /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt", |
| 134106 | + /* 208 */ "uniqueflag ::= UNIQUE", |
| 134107 | + /* 209 */ "uniqueflag ::=", |
| 134108 | + /* 210 */ "eidlist_opt ::=", |
| 134109 | + /* 211 */ "eidlist_opt ::= LP eidlist RP", |
| 134110 | + /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder", |
| 134111 | + /* 213 */ "eidlist ::= nm collate sortorder", |
| 134112 | + /* 214 */ "collate ::=", |
| 134113 | + /* 215 */ "collate ::= COLLATE ID|STRING", |
| 134114 | + /* 216 */ "cmd ::= DROP INDEX ifexists fullname", |
| 134115 | + /* 217 */ "cmd ::= VACUUM", |
| 134116 | + /* 218 */ "cmd ::= VACUUM nm", |
| 134117 | + /* 219 */ "cmd ::= PRAGMA nm dbnm", |
| 134118 | + /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", |
| 134119 | + /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", |
| 134120 | + /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", |
| 134121 | + /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", |
| 134122 | + /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT", |
| 134123 | + /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT", |
| 134124 | + /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", |
| 134125 | + /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", |
| 134126 | + /* 228 */ "trigger_time ::= BEFORE", |
| 134127 | + /* 229 */ "trigger_time ::= AFTER", |
| 134128 | + /* 230 */ "trigger_time ::= INSTEAD OF", |
| 134129 | + /* 231 */ "trigger_time ::=", |
| 134130 | + /* 232 */ "trigger_event ::= DELETE|INSERT", |
| 134131 | + /* 233 */ "trigger_event ::= UPDATE", |
| 134132 | + /* 234 */ "trigger_event ::= UPDATE OF idlist", |
| 134133 | + /* 235 */ "when_clause ::=", |
| 134134 | + /* 236 */ "when_clause ::= WHEN expr", |
| 134135 | + /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", |
| 134136 | + /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI", |
| 134137 | + /* 239 */ "trnm ::= nm DOT nm", |
| 134138 | + /* 240 */ "tridxby ::= INDEXED BY nm", |
| 134139 | + /* 241 */ "tridxby ::= NOT INDEXED", |
| 134140 | + /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", |
| 134141 | + /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select", |
| 134142 | + /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", |
| 134143 | + /* 245 */ "trigger_cmd ::= select", |
| 134144 | + /* 246 */ "expr ::= RAISE LP IGNORE RP", |
| 134145 | + /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP", |
| 134146 | + /* 248 */ "raisetype ::= ROLLBACK", |
| 134147 | + /* 249 */ "raisetype ::= ABORT", |
| 134148 | + /* 250 */ "raisetype ::= FAIL", |
| 134149 | + /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname", |
| 134150 | + /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", |
| 134151 | + /* 253 */ "cmd ::= DETACH database_kw_opt expr", |
| 134152 | + /* 254 */ "key_opt ::=", |
| 134153 | + /* 255 */ "key_opt ::= KEY expr", |
| 134154 | + /* 256 */ "cmd ::= REINDEX", |
| 134155 | + /* 257 */ "cmd ::= REINDEX nm dbnm", |
| 134156 | + /* 258 */ "cmd ::= ANALYZE", |
| 134157 | + /* 259 */ "cmd ::= ANALYZE nm dbnm", |
| 134158 | + /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", |
| 134159 | + /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist", |
| 134160 | + /* 262 */ "add_column_fullname ::= fullname", |
| 134161 | + /* 263 */ "cmd ::= create_vtab", |
| 134162 | + /* 264 */ "cmd ::= create_vtab LP vtabarglist RP", |
| 134163 | + /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", |
| 134164 | + /* 266 */ "vtabarg ::=", |
| 134165 | + /* 267 */ "vtabargtoken ::= ANY", |
| 134166 | + /* 268 */ "vtabargtoken ::= lp anylist RP", |
| 134167 | + /* 269 */ "lp ::= LP", |
| 134168 | + /* 270 */ "with ::=", |
| 134169 | + /* 271 */ "with ::= WITH wqlist", |
| 134170 | + /* 272 */ "with ::= WITH RECURSIVE wqlist", |
| 134171 | + /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP", |
| 134172 | + /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP", |
| 134173 | + /* 275 */ "input ::= cmdlist", |
| 134174 | + /* 276 */ "cmdlist ::= cmdlist ecmd", |
| 134175 | + /* 277 */ "cmdlist ::= ecmd", |
| 134176 | + /* 278 */ "ecmd ::= SEMI", |
| 134177 | + /* 279 */ "ecmd ::= explain cmdx SEMI", |
| 134178 | + /* 280 */ "explain ::=", |
| 134179 | + /* 281 */ "trans_opt ::=", |
| 134180 | + /* 282 */ "trans_opt ::= TRANSACTION", |
| 134181 | + /* 283 */ "trans_opt ::= TRANSACTION nm", |
| 134182 | + /* 284 */ "savepoint_opt ::= SAVEPOINT", |
| 134183 | + /* 285 */ "savepoint_opt ::=", |
| 134184 | + /* 286 */ "cmd ::= create_table create_table_args", |
| 134185 | + /* 287 */ "columnlist ::= columnlist COMMA columnname carglist", |
| 134186 | + /* 288 */ "columnlist ::= columnname carglist", |
| 134187 | + /* 289 */ "nm ::= ID|INDEXED", |
| 134188 | + /* 290 */ "nm ::= STRING", |
| 134189 | + /* 291 */ "nm ::= JOIN_KW", |
| 134190 | + /* 292 */ "typetoken ::= typename", |
| 134191 | + /* 293 */ "typename ::= ID|STRING", |
| 134192 | + /* 294 */ "signed ::= plus_num", |
| 134193 | + /* 295 */ "signed ::= minus_num", |
| 134194 | + /* 296 */ "carglist ::= carglist ccons", |
| 134195 | + /* 297 */ "carglist ::=", |
| 134196 | + /* 298 */ "ccons ::= NULL onconf", |
| 134197 | + /* 299 */ "conslist_opt ::= COMMA conslist", |
| 134198 | + /* 300 */ "conslist ::= conslist tconscomma tcons", |
| 134199 | + /* 301 */ "conslist ::= tcons", |
| 134200 | + /* 302 */ "tconscomma ::=", |
| 134201 | + /* 303 */ "defer_subclause_opt ::= defer_subclause", |
| 134202 | + /* 304 */ "resolvetype ::= raisetype", |
| 134203 | + /* 305 */ "selectnowith ::= oneselect", |
| 134204 | + /* 306 */ "oneselect ::= values", |
| 134205 | + /* 307 */ "sclp ::= selcollist COMMA", |
| 134206 | + /* 308 */ "as ::= ID|STRING", |
| 134207 | + /* 309 */ "expr ::= term", |
| 134208 | + /* 310 */ "exprlist ::= nexprlist", |
| 134209 | + /* 311 */ "nmnum ::= plus_num", |
| 134210 | + /* 312 */ "nmnum ::= nm", |
| 134211 | + /* 313 */ "nmnum ::= ON", |
| 134212 | + /* 314 */ "nmnum ::= DELETE", |
| 134213 | + /* 315 */ "nmnum ::= DEFAULT", |
| 134214 | + /* 316 */ "plus_num ::= INTEGER|FLOAT", |
| 134215 | + /* 317 */ "foreach_clause ::=", |
| 134216 | + /* 318 */ "foreach_clause ::= FOR EACH ROW", |
| 134217 | + /* 319 */ "trnm ::= nm", |
| 134218 | + /* 320 */ "tridxby ::=", |
| 134219 | + /* 321 */ "database_kw_opt ::= DATABASE", |
| 134220 | + /* 322 */ "database_kw_opt ::=", |
| 134221 | + /* 323 */ "kwcolumn_opt ::=", |
| 134222 | + /* 324 */ "kwcolumn_opt ::= COLUMNKW", |
| 134223 | + /* 325 */ "vtabarglist ::= vtabarg", |
| 134224 | + /* 326 */ "vtabarglist ::= vtabarglist COMMA vtabarg", |
| 134225 | + /* 327 */ "vtabarg ::= vtabarg vtabargtoken", |
| 134226 | + /* 328 */ "anylist ::=", |
| 134227 | + /* 329 */ "anylist ::= anylist LP anylist RP", |
| 134228 | + /* 330 */ "anylist ::= anylist ANY", |
| 132969 | 134229 | }; |
| 132970 | 134230 | #endif /* NDEBUG */ |
| 132971 | 134231 | |
| 132972 | 134232 | |
| 132973 | 134233 | #if YYSTACKDEPTH<=0 |
| | @@ -133526,11 +134786,13 @@ |
| 133526 | 134786 | { 149, 6 }, |
| 133527 | 134787 | { 201, 0 }, |
| 133528 | 134788 | { 201, 2 }, |
| 133529 | 134789 | { 149, 8 }, |
| 133530 | 134790 | { 218, 5 }, |
| 134791 | + { 218, 7 }, |
| 133531 | 134792 | { 218, 3 }, |
| 134793 | + { 218, 5 }, |
| 133532 | 134794 | { 149, 6 }, |
| 133533 | 134795 | { 149, 7 }, |
| 133534 | 134796 | { 219, 2 }, |
| 133535 | 134797 | { 219, 1 }, |
| 133536 | 134798 | { 220, 0 }, |
| | @@ -133549,10 +134811,11 @@ |
| 133549 | 134811 | { 173, 3 }, |
| 133550 | 134812 | { 173, 6 }, |
| 133551 | 134813 | { 173, 5 }, |
| 133552 | 134814 | { 173, 4 }, |
| 133553 | 134815 | { 172, 1 }, |
| 134816 | + { 173, 5 }, |
| 133554 | 134817 | { 173, 3 }, |
| 133555 | 134818 | { 173, 3 }, |
| 133556 | 134819 | { 173, 3 }, |
| 133557 | 134820 | { 173, 3 }, |
| 133558 | 134821 | { 173, 3 }, |
| | @@ -133836,11 +135099,11 @@ |
| 133836 | 135099 | case 42: /* autoinc ::= */ yytestcase(yyruleno==42); |
| 133837 | 135100 | case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57); |
| 133838 | 135101 | case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67); |
| 133839 | 135102 | case 76: /* ifexists ::= */ yytestcase(yyruleno==76); |
| 133840 | 135103 | case 90: /* distinct ::= */ yytestcase(yyruleno==90); |
| 133841 | | - case 211: /* collate ::= */ yytestcase(yyruleno==211); |
| 135104 | + case 214: /* collate ::= */ yytestcase(yyruleno==214); |
| 133842 | 135105 | {yymsp[1].minor.yy194 = 0;} |
| 133843 | 135106 | break; |
| 133844 | 135107 | case 17: /* ifnotexists ::= IF NOT EXISTS */ |
| 133845 | 135108 | {yymsp[-2].minor.yy194 = 1;} |
| 133846 | 135109 | break; |
| | @@ -133975,18 +135238,18 @@ |
| 133975 | 135238 | case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ |
| 133976 | 135239 | {yymsp[-2].minor.yy194 = 0;} |
| 133977 | 135240 | break; |
| 133978 | 135241 | case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ |
| 133979 | 135242 | case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71); |
| 133980 | | - case 142: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==142); |
| 135243 | + case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144); |
| 133981 | 135244 | {yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;} |
| 133982 | 135245 | break; |
| 133983 | 135246 | case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ |
| 133984 | 135247 | case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75); |
| 133985 | | - case 183: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==183); |
| 133986 | | - case 186: /* in_op ::= NOT IN */ yytestcase(yyruleno==186); |
| 133987 | | - case 212: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==212); |
| 135248 | + case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186); |
| 135249 | + case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189); |
| 135250 | + case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215); |
| 133988 | 135251 | {yymsp[-1].minor.yy194 = 1;} |
| 133989 | 135252 | break; |
| 133990 | 135253 | case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ |
| 133991 | 135254 | {yymsp[-1].minor.yy194 = 0;} |
| 133992 | 135255 | break; |
| | @@ -134018,11 +135281,11 @@ |
| 134018 | 135281 | break; |
| 134019 | 135282 | case 72: /* resolvetype ::= IGNORE */ |
| 134020 | 135283 | {yymsp[0].minor.yy194 = OE_Ignore;} |
| 134021 | 135284 | break; |
| 134022 | 135285 | case 73: /* resolvetype ::= REPLACE */ |
| 134023 | | - case 143: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==143); |
| 135286 | + case 145: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==145); |
| 134024 | 135287 | {yymsp[0].minor.yy194 = OE_Replace;} |
| 134025 | 135288 | break; |
| 134026 | 135289 | case 74: /* cmd ::= DROP TABLE ifexists fullname */ |
| 134027 | 135290 | { |
| 134028 | 135291 | sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194); |
| | @@ -134146,13 +135409,13 @@ |
| 134146 | 135409 | {yymsp[0].minor.yy194 = SF_All;} |
| 134147 | 135410 | break; |
| 134148 | 135411 | case 91: /* sclp ::= */ |
| 134149 | 135412 | case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119); |
| 134150 | 135413 | case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126); |
| 134151 | | - case 199: /* exprlist ::= */ yytestcase(yyruleno==199); |
| 134152 | | - case 202: /* paren_exprlist ::= */ yytestcase(yyruleno==202); |
| 134153 | | - case 207: /* eidlist_opt ::= */ yytestcase(yyruleno==207); |
| 135414 | + case 202: /* exprlist ::= */ yytestcase(yyruleno==202); |
| 135415 | + case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205); |
| 135416 | + case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210); |
| 134154 | 135417 | {yymsp[1].minor.yy148 = 0;} |
| 134155 | 135418 | break; |
| 134156 | 135419 | case 92: /* selcollist ::= sclp expr as */ |
| 134157 | 135420 | { |
| 134158 | 135421 | yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr); |
| | @@ -134174,12 +135437,12 @@ |
| 134174 | 135437 | yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot); |
| 134175 | 135438 | } |
| 134176 | 135439 | break; |
| 134177 | 135440 | case 95: /* as ::= AS nm */ |
| 134178 | 135441 | case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106); |
| 134179 | | - case 221: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==221); |
| 134180 | | - case 222: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==222); |
| 135442 | + case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224); |
| 135443 | + case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225); |
| 134181 | 135444 | {yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;} |
| 134182 | 135445 | break; |
| 134183 | 135446 | case 97: /* from ::= */ |
| 134184 | 135447 | {yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));} |
| 134185 | 135448 | break; |
| | @@ -134258,18 +135521,18 @@ |
| 134258 | 135521 | {yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/} |
| 134259 | 135522 | break; |
| 134260 | 135523 | case 112: /* on_opt ::= ON expr */ |
| 134261 | 135524 | case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129); |
| 134262 | 135525 | case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136); |
| 134263 | | - case 195: /* case_else ::= ELSE expr */ yytestcase(yyruleno==195); |
| 135526 | + case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198); |
| 134264 | 135527 | {yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;} |
| 134265 | 135528 | break; |
| 134266 | 135529 | case 113: /* on_opt ::= */ |
| 134267 | 135530 | case 128: /* having_opt ::= */ yytestcase(yyruleno==128); |
| 134268 | 135531 | case 135: /* where_opt ::= */ yytestcase(yyruleno==135); |
| 134269 | | - case 196: /* case_else ::= */ yytestcase(yyruleno==196); |
| 134270 | | - case 198: /* case_operand ::= */ yytestcase(yyruleno==198); |
| 135532 | + case 199: /* case_else ::= */ yytestcase(yyruleno==199); |
| 135533 | + case 201: /* case_operand ::= */ yytestcase(yyruleno==201); |
| 134271 | 135534 | {yymsp[1].minor.yy72 = 0;} |
| 134272 | 135535 | break; |
| 134273 | 135536 | case 115: /* indexed_opt ::= INDEXED BY nm */ |
| 134274 | 135537 | {yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;} |
| 134275 | 135538 | break; |
| | @@ -134278,11 +135541,11 @@ |
| 134278 | 135541 | break; |
| 134279 | 135542 | case 117: /* using_opt ::= USING LP idlist RP */ |
| 134280 | 135543 | {yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;} |
| 134281 | 135544 | break; |
| 134282 | 135545 | case 118: /* using_opt ::= */ |
| 134283 | | - case 144: /* idlist_opt ::= */ yytestcase(yyruleno==144); |
| 135546 | + case 146: /* idlist_opt ::= */ yytestcase(yyruleno==146); |
| 134284 | 135547 | {yymsp[1].minor.yy254 = 0;} |
| 134285 | 135548 | break; |
| 134286 | 135549 | case 120: /* orderby_opt ::= ORDER BY sortlist */ |
| 134287 | 135550 | case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127); |
| 134288 | 135551 | {yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;} |
| | @@ -134339,69 +135602,79 @@ |
| 134339 | 135602 | { |
| 134340 | 135603 | yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 134341 | 135604 | sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1); |
| 134342 | 135605 | } |
| 134343 | 135606 | break; |
| 134344 | | - case 139: /* setlist ::= nm EQ expr */ |
| 135607 | + case 139: /* setlist ::= setlist COMMA LP idlist RP EQ expr */ |
| 135608 | +{ |
| 135609 | + yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr); |
| 135610 | +} |
| 135611 | + break; |
| 135612 | + case 140: /* setlist ::= nm EQ expr */ |
| 134345 | 135613 | { |
| 134346 | 135614 | yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr); |
| 134347 | 135615 | sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1); |
| 134348 | 135616 | } |
| 134349 | 135617 | yymsp[-2].minor.yy148 = yylhsminor.yy148; |
| 134350 | 135618 | break; |
| 134351 | | - case 140: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */ |
| 135619 | + case 141: /* setlist ::= LP idlist RP EQ expr */ |
| 135620 | +{ |
| 135621 | + yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr); |
| 135622 | +} |
| 135623 | + break; |
| 135624 | + case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */ |
| 134352 | 135625 | { |
| 134353 | 135626 | sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1); |
| 134354 | 135627 | sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194); |
| 134355 | 135628 | } |
| 134356 | 135629 | break; |
| 134357 | | - case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ |
| 135630 | + case 143: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */ |
| 134358 | 135631 | { |
| 134359 | 135632 | sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1); |
| 134360 | 135633 | sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194); |
| 134361 | 135634 | } |
| 134362 | 135635 | break; |
| 134363 | | - case 145: /* idlist_opt ::= LP idlist RP */ |
| 135636 | + case 147: /* idlist_opt ::= LP idlist RP */ |
| 134364 | 135637 | {yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;} |
| 134365 | 135638 | break; |
| 134366 | | - case 146: /* idlist ::= idlist COMMA nm */ |
| 135639 | + case 148: /* idlist ::= idlist COMMA nm */ |
| 134367 | 135640 | {yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);} |
| 134368 | 135641 | break; |
| 134369 | | - case 147: /* idlist ::= nm */ |
| 135642 | + case 149: /* idlist ::= nm */ |
| 134370 | 135643 | {yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/} |
| 134371 | 135644 | break; |
| 134372 | | - case 148: /* expr ::= LP expr RP */ |
| 135645 | + case 150: /* expr ::= LP expr RP */ |
| 134373 | 135646 | {spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;} |
| 134374 | 135647 | break; |
| 134375 | | - case 149: /* term ::= NULL */ |
| 134376 | | - case 154: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==154); |
| 134377 | | - case 155: /* term ::= STRING */ yytestcase(yyruleno==155); |
| 135648 | + case 151: /* term ::= NULL */ |
| 135649 | + case 156: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==156); |
| 135650 | + case 157: /* term ::= STRING */ yytestcase(yyruleno==157); |
| 134378 | 135651 | {spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/} |
| 134379 | 135652 | break; |
| 134380 | | - case 150: /* expr ::= ID|INDEXED */ |
| 134381 | | - case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151); |
| 135653 | + case 152: /* expr ::= ID|INDEXED */ |
| 135654 | + case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153); |
| 134382 | 135655 | {spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/} |
| 134383 | 135656 | break; |
| 134384 | | - case 152: /* expr ::= nm DOT nm */ |
| 135657 | + case 154: /* expr ::= nm DOT nm */ |
| 134385 | 135658 | { |
| 134386 | 135659 | Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); |
| 134387 | 135660 | Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); |
| 134388 | 135661 | spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134389 | 135662 | yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); |
| 134390 | 135663 | } |
| 134391 | 135664 | break; |
| 134392 | | - case 153: /* expr ::= nm DOT nm DOT nm */ |
| 135665 | + case 155: /* expr ::= nm DOT nm DOT nm */ |
| 134393 | 135666 | { |
| 134394 | 135667 | Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); |
| 134395 | 135668 | Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); |
| 134396 | 135669 | Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); |
| 134397 | 135670 | Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); |
| 134398 | 135671 | spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134399 | 135672 | yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); |
| 134400 | 135673 | } |
| 134401 | 135674 | break; |
| 134402 | | - case 156: /* expr ::= VARIABLE */ |
| 135675 | + case 158: /* expr ::= VARIABLE */ |
| 134403 | 135676 | { |
| 134404 | 135677 | if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){ |
| 134405 | 135678 | spanExpr(&yymsp[0].minor.yy190, pParse, TK_VARIABLE, yymsp[0].minor.yy0); |
| 134406 | 135679 | sqlite3ExprAssignVarNumber(pParse, yymsp[0].minor.yy190.pExpr); |
| 134407 | 135680 | }else{ |
| | @@ -134419,23 +135692,23 @@ |
| 134419 | 135692 | if( yymsp[0].minor.yy190.pExpr ) sqlite3GetInt32(&t.z[1], &yymsp[0].minor.yy190.pExpr->iTable); |
| 134420 | 135693 | } |
| 134421 | 135694 | } |
| 134422 | 135695 | } |
| 134423 | 135696 | break; |
| 134424 | | - case 157: /* expr ::= expr COLLATE ID|STRING */ |
| 135697 | + case 159: /* expr ::= expr COLLATE ID|STRING */ |
| 134425 | 135698 | { |
| 134426 | 135699 | yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1); |
| 134427 | 135700 | yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134428 | 135701 | } |
| 134429 | 135702 | break; |
| 134430 | | - case 158: /* expr ::= CAST LP expr AS typetoken RP */ |
| 135703 | + case 160: /* expr ::= CAST LP expr AS typetoken RP */ |
| 134431 | 135704 | { |
| 134432 | 135705 | spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134433 | 135706 | yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy190.pExpr, 0, &yymsp[-1].minor.yy0); |
| 134434 | 135707 | } |
| 134435 | 135708 | break; |
| 134436 | | - case 159: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 135709 | + case 161: /* expr ::= ID|INDEXED LP distinct exprlist RP */ |
| 134437 | 135710 | { |
| 134438 | 135711 | if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ |
| 134439 | 135712 | sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); |
| 134440 | 135713 | } |
| 134441 | 135714 | yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy148, &yymsp[-4].minor.yy0); |
| | @@ -134444,41 +135717,54 @@ |
| 134444 | 135717 | yylhsminor.yy190.pExpr->flags |= EP_Distinct; |
| 134445 | 135718 | } |
| 134446 | 135719 | } |
| 134447 | 135720 | yymsp[-4].minor.yy190 = yylhsminor.yy190; |
| 134448 | 135721 | break; |
| 134449 | | - case 160: /* expr ::= ID|INDEXED LP STAR RP */ |
| 135722 | + case 162: /* expr ::= ID|INDEXED LP STAR RP */ |
| 134450 | 135723 | { |
| 134451 | 135724 | yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); |
| 134452 | 135725 | spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); |
| 134453 | 135726 | } |
| 134454 | 135727 | yymsp[-3].minor.yy190 = yylhsminor.yy190; |
| 134455 | 135728 | break; |
| 134456 | | - case 161: /* term ::= CTIME_KW */ |
| 135729 | + case 163: /* term ::= CTIME_KW */ |
| 134457 | 135730 | { |
| 134458 | 135731 | yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); |
| 134459 | 135732 | spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); |
| 134460 | 135733 | } |
| 134461 | 135734 | yymsp[0].minor.yy190 = yylhsminor.yy190; |
| 134462 | 135735 | break; |
| 134463 | | - case 162: /* expr ::= expr AND expr */ |
| 134464 | | - case 163: /* expr ::= expr OR expr */ yytestcase(yyruleno==163); |
| 134465 | | - case 164: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==164); |
| 134466 | | - case 165: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==165); |
| 134467 | | - case 166: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==166); |
| 134468 | | - case 167: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==167); |
| 134469 | | - case 168: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==168); |
| 134470 | | - case 169: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==169); |
| 135736 | + case 164: /* expr ::= LP nexprlist COMMA expr RP */ |
| 135737 | +{ |
| 135738 | + ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr); |
| 135739 | + yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0, 0); |
| 135740 | + if( yylhsminor.yy190.pExpr ){ |
| 135741 | + yylhsminor.yy190.pExpr->x.pList = pList; |
| 135742 | + spanSet(&yylhsminor.yy190, &yymsp[-4].minor.yy0, &yymsp[0].minor.yy0); |
| 135743 | + }else{ |
| 135744 | + sqlite3ExprListDelete(pParse->db, pList); |
| 135745 | + } |
| 135746 | +} |
| 135747 | + yymsp[-4].minor.yy190 = yylhsminor.yy190; |
| 135748 | + break; |
| 135749 | + case 165: /* expr ::= expr AND expr */ |
| 135750 | + case 166: /* expr ::= expr OR expr */ yytestcase(yyruleno==166); |
| 135751 | + case 167: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==167); |
| 135752 | + case 168: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==168); |
| 135753 | + case 169: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==169); |
| 135754 | + case 170: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==170); |
| 135755 | + case 171: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==171); |
| 135756 | + case 172: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==172); |
| 134471 | 135757 | {spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);} |
| 134472 | 135758 | break; |
| 134473 | | - case 170: /* likeop ::= LIKE_KW|MATCH */ |
| 135759 | + case 173: /* likeop ::= LIKE_KW|MATCH */ |
| 134474 | 135760 | {yymsp[0].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[0].minor.yy392.bNot = 0;/*A-overwrites-X*/} |
| 134475 | 135761 | break; |
| 134476 | | - case 171: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 135762 | + case 174: /* likeop ::= NOT LIKE_KW|MATCH */ |
| 134477 | 135763 | {yymsp[-1].minor.yy392.eOperator = yymsp[0].minor.yy0; yymsp[-1].minor.yy392.bNot = 1;} |
| 134478 | 135764 | break; |
| 134479 | | - case 172: /* expr ::= expr likeop expr */ |
| 135765 | + case 175: /* expr ::= expr likeop expr */ |
| 134480 | 135766 | { |
| 134481 | 135767 | ExprList *pList; |
| 134482 | 135768 | pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy190.pExpr); |
| 134483 | 135769 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy190.pExpr); |
| 134484 | 135770 | yymsp[-2].minor.yy190.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy392.eOperator); |
| | @@ -134485,11 +135771,11 @@ |
| 134485 | 135771 | exprNot(pParse, yymsp[-1].minor.yy392.bNot, &yymsp[-2].minor.yy190); |
| 134486 | 135772 | yymsp[-2].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 134487 | 135773 | if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc; |
| 134488 | 135774 | } |
| 134489 | 135775 | break; |
| 134490 | | - case 173: /* expr ::= expr likeop expr ESCAPE expr */ |
| 135776 | + case 176: /* expr ::= expr likeop expr ESCAPE expr */ |
| 134491 | 135777 | { |
| 134492 | 135778 | ExprList *pList; |
| 134493 | 135779 | pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134494 | 135780 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy190.pExpr); |
| 134495 | 135781 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); |
| | @@ -134497,43 +135783,43 @@ |
| 134497 | 135783 | exprNot(pParse, yymsp[-3].minor.yy392.bNot, &yymsp[-4].minor.yy190); |
| 134498 | 135784 | yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 134499 | 135785 | if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc; |
| 134500 | 135786 | } |
| 134501 | 135787 | break; |
| 134502 | | - case 174: /* expr ::= expr ISNULL|NOTNULL */ |
| 135788 | + case 177: /* expr ::= expr ISNULL|NOTNULL */ |
| 134503 | 135789 | {spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);} |
| 134504 | 135790 | break; |
| 134505 | | - case 175: /* expr ::= expr NOT NULL */ |
| 135791 | + case 178: /* expr ::= expr NOT NULL */ |
| 134506 | 135792 | {spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);} |
| 134507 | 135793 | break; |
| 134508 | | - case 176: /* expr ::= expr IS expr */ |
| 135794 | + case 179: /* expr ::= expr IS expr */ |
| 134509 | 135795 | { |
| 134510 | 135796 | spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190); |
| 134511 | 135797 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL); |
| 134512 | 135798 | } |
| 134513 | 135799 | break; |
| 134514 | | - case 177: /* expr ::= expr IS NOT expr */ |
| 135800 | + case 180: /* expr ::= expr IS NOT expr */ |
| 134515 | 135801 | { |
| 134516 | 135802 | spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190); |
| 134517 | 135803 | binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL); |
| 134518 | 135804 | } |
| 134519 | 135805 | break; |
| 134520 | | - case 178: /* expr ::= NOT expr */ |
| 134521 | | - case 179: /* expr ::= BITNOT expr */ yytestcase(yyruleno==179); |
| 135806 | + case 181: /* expr ::= NOT expr */ |
| 135807 | + case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182); |
| 134522 | 135808 | {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134523 | 135809 | break; |
| 134524 | | - case 180: /* expr ::= MINUS expr */ |
| 135810 | + case 183: /* expr ::= MINUS expr */ |
| 134525 | 135811 | {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134526 | 135812 | break; |
| 134527 | | - case 181: /* expr ::= PLUS expr */ |
| 135813 | + case 184: /* expr ::= PLUS expr */ |
| 134528 | 135814 | {spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/} |
| 134529 | 135815 | break; |
| 134530 | | - case 182: /* between_op ::= BETWEEN */ |
| 134531 | | - case 185: /* in_op ::= IN */ yytestcase(yyruleno==185); |
| 135816 | + case 185: /* between_op ::= BETWEEN */ |
| 135817 | + case 188: /* in_op ::= IN */ yytestcase(yyruleno==188); |
| 134532 | 135818 | {yymsp[0].minor.yy194 = 0;} |
| 134533 | 135819 | break; |
| 134534 | | - case 184: /* expr ::= expr between_op expr AND expr */ |
| 135820 | + case 187: /* expr ::= expr between_op expr AND expr */ |
| 134535 | 135821 | { |
| 134536 | 135822 | ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134537 | 135823 | pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr); |
| 134538 | 135824 | yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134539 | 135825 | if( yymsp[-4].minor.yy190.pExpr ){ |
| | @@ -134543,11 +135829,11 @@ |
| 134543 | 135829 | } |
| 134544 | 135830 | exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134545 | 135831 | yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd; |
| 134546 | 135832 | } |
| 134547 | 135833 | break; |
| 134548 | | - case 187: /* expr ::= expr in_op LP exprlist RP */ |
| 135834 | + case 190: /* expr ::= expr in_op LP exprlist RP */ |
| 134549 | 135835 | { |
| 134550 | 135836 | if( yymsp[-1].minor.yy148==0 ){ |
| 134551 | 135837 | /* Expressions of the form |
| 134552 | 135838 | ** |
| 134553 | 135839 | ** expr1 IN () |
| | @@ -134596,26 +135882,26 @@ |
| 134596 | 135882 | exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134597 | 135883 | } |
| 134598 | 135884 | yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134599 | 135885 | } |
| 134600 | 135886 | break; |
| 134601 | | - case 188: /* expr ::= LP select RP */ |
| 135887 | + case 191: /* expr ::= LP select RP */ |
| 134602 | 135888 | { |
| 134603 | 135889 | spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 134604 | 135890 | yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); |
| 134605 | 135891 | sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243); |
| 134606 | 135892 | } |
| 134607 | 135893 | break; |
| 134608 | | - case 189: /* expr ::= expr in_op LP select RP */ |
| 135894 | + case 192: /* expr ::= expr in_op LP select RP */ |
| 134609 | 135895 | { |
| 134610 | 135896 | yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| 134611 | 135897 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243); |
| 134612 | 135898 | exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134613 | 135899 | yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; |
| 134614 | 135900 | } |
| 134615 | 135901 | break; |
| 134616 | | - case 190: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 135902 | + case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */ |
| 134617 | 135903 | { |
| 134618 | 135904 | SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); |
| 134619 | 135905 | Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); |
| 134620 | 135906 | if( yymsp[0].minor.yy148 ) sqlite3SrcListFuncArgs(pParse, pSelect ? pSrc : 0, yymsp[0].minor.yy148); |
| 134621 | 135907 | yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0, 0); |
| | @@ -134622,19 +135908,19 @@ |
| 134622 | 135908 | sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, pSelect); |
| 134623 | 135909 | exprNot(pParse, yymsp[-3].minor.yy194, &yymsp[-4].minor.yy190); |
| 134624 | 135910 | yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n]; |
| 134625 | 135911 | } |
| 134626 | 135912 | break; |
| 134627 | | - case 191: /* expr ::= EXISTS LP select RP */ |
| 135913 | + case 194: /* expr ::= EXISTS LP select RP */ |
| 134628 | 135914 | { |
| 134629 | 135915 | Expr *p; |
| 134630 | 135916 | spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ |
| 134631 | 135917 | p = yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); |
| 134632 | 135918 | sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243); |
| 134633 | 135919 | } |
| 134634 | 135920 | break; |
| 134635 | | - case 192: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 135921 | + case 195: /* expr ::= CASE case_operand case_exprlist case_else END */ |
| 134636 | 135922 | { |
| 134637 | 135923 | spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/ |
| 134638 | 135924 | yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0, 0); |
| 134639 | 135925 | if( yymsp[-4].minor.yy190.pExpr ){ |
| 134640 | 135926 | yymsp[-4].minor.yy190.pExpr->x.pList = yymsp[-1].minor.yy72 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[-1].minor.yy72) : yymsp[-2].minor.yy148; |
| | @@ -134643,334 +135929,334 @@ |
| 134643 | 135929 | sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy148); |
| 134644 | 135930 | sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy72); |
| 134645 | 135931 | } |
| 134646 | 135932 | } |
| 134647 | 135933 | break; |
| 134648 | | - case 193: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 135934 | + case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ |
| 134649 | 135935 | { |
| 134650 | 135936 | yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr); |
| 134651 | 135937 | yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 134652 | 135938 | } |
| 134653 | 135939 | break; |
| 134654 | | - case 194: /* case_exprlist ::= WHEN expr THEN expr */ |
| 135940 | + case 197: /* case_exprlist ::= WHEN expr THEN expr */ |
| 134655 | 135941 | { |
| 134656 | 135942 | yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr); |
| 134657 | 135943 | yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr); |
| 134658 | 135944 | } |
| 134659 | 135945 | break; |
| 134660 | | - case 197: /* case_operand ::= expr */ |
| 135946 | + case 200: /* case_operand ::= expr */ |
| 134661 | 135947 | {yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/} |
| 134662 | 135948 | break; |
| 134663 | | - case 200: /* nexprlist ::= nexprlist COMMA expr */ |
| 135949 | + case 203: /* nexprlist ::= nexprlist COMMA expr */ |
| 134664 | 135950 | {yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);} |
| 134665 | 135951 | break; |
| 134666 | | - case 201: /* nexprlist ::= expr */ |
| 135952 | + case 204: /* nexprlist ::= expr */ |
| 134667 | 135953 | {yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/} |
| 134668 | 135954 | break; |
| 134669 | | - case 203: /* paren_exprlist ::= LP exprlist RP */ |
| 134670 | | - case 208: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==208); |
| 135955 | + case 206: /* paren_exprlist ::= LP exprlist RP */ |
| 135956 | + case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211); |
| 134671 | 135957 | {yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;} |
| 134672 | 135958 | break; |
| 134673 | | - case 204: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 135959 | + case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */ |
| 134674 | 135960 | { |
| 134675 | 135961 | sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, |
| 134676 | 135962 | sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194, |
| 134677 | 135963 | &yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF); |
| 134678 | 135964 | } |
| 134679 | 135965 | break; |
| 134680 | | - case 205: /* uniqueflag ::= UNIQUE */ |
| 134681 | | - case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246); |
| 135966 | + case 208: /* uniqueflag ::= UNIQUE */ |
| 135967 | + case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249); |
| 134682 | 135968 | {yymsp[0].minor.yy194 = OE_Abort;} |
| 134683 | 135969 | break; |
| 134684 | | - case 206: /* uniqueflag ::= */ |
| 135970 | + case 209: /* uniqueflag ::= */ |
| 134685 | 135971 | {yymsp[1].minor.yy194 = OE_None;} |
| 134686 | 135972 | break; |
| 134687 | | - case 209: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 135973 | + case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */ |
| 134688 | 135974 | { |
| 134689 | 135975 | yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); |
| 134690 | 135976 | } |
| 134691 | 135977 | break; |
| 134692 | | - case 210: /* eidlist ::= nm collate sortorder */ |
| 135978 | + case 213: /* eidlist ::= nm collate sortorder */ |
| 134693 | 135979 | { |
| 134694 | 135980 | yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/ |
| 134695 | 135981 | } |
| 134696 | 135982 | break; |
| 134697 | | - case 213: /* cmd ::= DROP INDEX ifexists fullname */ |
| 135983 | + case 216: /* cmd ::= DROP INDEX ifexists fullname */ |
| 134698 | 135984 | {sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);} |
| 134699 | 135985 | break; |
| 134700 | | - case 214: /* cmd ::= VACUUM */ |
| 135986 | + case 217: /* cmd ::= VACUUM */ |
| 134701 | 135987 | {sqlite3Vacuum(pParse,0);} |
| 134702 | 135988 | break; |
| 134703 | | - case 215: /* cmd ::= VACUUM nm */ |
| 135989 | + case 218: /* cmd ::= VACUUM nm */ |
| 134704 | 135990 | {sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);} |
| 134705 | 135991 | break; |
| 134706 | | - case 216: /* cmd ::= PRAGMA nm dbnm */ |
| 135992 | + case 219: /* cmd ::= PRAGMA nm dbnm */ |
| 134707 | 135993 | {sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} |
| 134708 | 135994 | break; |
| 134709 | | - case 217: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 135995 | + case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ |
| 134710 | 135996 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} |
| 134711 | 135997 | break; |
| 134712 | | - case 218: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 135998 | + case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ |
| 134713 | 135999 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} |
| 134714 | 136000 | break; |
| 134715 | | - case 219: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 136001 | + case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ |
| 134716 | 136002 | {sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} |
| 134717 | 136003 | break; |
| 134718 | | - case 220: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 136004 | + case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ |
| 134719 | 136005 | {sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} |
| 134720 | 136006 | break; |
| 134721 | | - case 223: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 136007 | + case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ |
| 134722 | 136008 | { |
| 134723 | 136009 | Token all; |
| 134724 | 136010 | all.z = yymsp[-3].minor.yy0.z; |
| 134725 | 136011 | all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; |
| 134726 | 136012 | sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all); |
| 134727 | 136013 | } |
| 134728 | 136014 | break; |
| 134729 | | - case 224: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 136015 | + case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ |
| 134730 | 136016 | { |
| 134731 | 136017 | sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194); |
| 134732 | 136018 | yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/ |
| 134733 | 136019 | } |
| 134734 | 136020 | break; |
| 134735 | | - case 225: /* trigger_time ::= BEFORE */ |
| 136021 | + case 228: /* trigger_time ::= BEFORE */ |
| 134736 | 136022 | { yymsp[0].minor.yy194 = TK_BEFORE; } |
| 134737 | 136023 | break; |
| 134738 | | - case 226: /* trigger_time ::= AFTER */ |
| 136024 | + case 229: /* trigger_time ::= AFTER */ |
| 134739 | 136025 | { yymsp[0].minor.yy194 = TK_AFTER; } |
| 134740 | 136026 | break; |
| 134741 | | - case 227: /* trigger_time ::= INSTEAD OF */ |
| 136027 | + case 230: /* trigger_time ::= INSTEAD OF */ |
| 134742 | 136028 | { yymsp[-1].minor.yy194 = TK_INSTEAD;} |
| 134743 | 136029 | break; |
| 134744 | | - case 228: /* trigger_time ::= */ |
| 136030 | + case 231: /* trigger_time ::= */ |
| 134745 | 136031 | { yymsp[1].minor.yy194 = TK_BEFORE; } |
| 134746 | 136032 | break; |
| 134747 | | - case 229: /* trigger_event ::= DELETE|INSERT */ |
| 134748 | | - case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230); |
| 136033 | + case 232: /* trigger_event ::= DELETE|INSERT */ |
| 136034 | + case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233); |
| 134749 | 136035 | {yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;} |
| 134750 | 136036 | break; |
| 134751 | | - case 231: /* trigger_event ::= UPDATE OF idlist */ |
| 136037 | + case 234: /* trigger_event ::= UPDATE OF idlist */ |
| 134752 | 136038 | {yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;} |
| 134753 | 136039 | break; |
| 134754 | | - case 232: /* when_clause ::= */ |
| 134755 | | - case 251: /* key_opt ::= */ yytestcase(yyruleno==251); |
| 136040 | + case 235: /* when_clause ::= */ |
| 136041 | + case 254: /* key_opt ::= */ yytestcase(yyruleno==254); |
| 134756 | 136042 | { yymsp[1].minor.yy72 = 0; } |
| 134757 | 136043 | break; |
| 134758 | | - case 233: /* when_clause ::= WHEN expr */ |
| 134759 | | - case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252); |
| 136044 | + case 236: /* when_clause ::= WHEN expr */ |
| 136045 | + case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255); |
| 134760 | 136046 | { yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; } |
| 134761 | 136047 | break; |
| 134762 | | - case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 136048 | + case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ |
| 134763 | 136049 | { |
| 134764 | 136050 | assert( yymsp[-2].minor.yy145!=0 ); |
| 134765 | 136051 | yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145; |
| 134766 | 136052 | yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 134767 | 136053 | } |
| 134768 | 136054 | break; |
| 134769 | | - case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 136055 | + case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */ |
| 134770 | 136056 | { |
| 134771 | 136057 | assert( yymsp[-1].minor.yy145!=0 ); |
| 134772 | 136058 | yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145; |
| 134773 | 136059 | } |
| 134774 | 136060 | break; |
| 134775 | | - case 236: /* trnm ::= nm DOT nm */ |
| 136061 | + case 239: /* trnm ::= nm DOT nm */ |
| 134776 | 136062 | { |
| 134777 | 136063 | yymsp[-2].minor.yy0 = yymsp[0].minor.yy0; |
| 134778 | 136064 | sqlite3ErrorMsg(pParse, |
| 134779 | 136065 | "qualified table names are not allowed on INSERT, UPDATE, and DELETE " |
| 134780 | 136066 | "statements within triggers"); |
| 134781 | 136067 | } |
| 134782 | 136068 | break; |
| 134783 | | - case 237: /* tridxby ::= INDEXED BY nm */ |
| 136069 | + case 240: /* tridxby ::= INDEXED BY nm */ |
| 134784 | 136070 | { |
| 134785 | 136071 | sqlite3ErrorMsg(pParse, |
| 134786 | 136072 | "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " |
| 134787 | 136073 | "within triggers"); |
| 134788 | 136074 | } |
| 134789 | 136075 | break; |
| 134790 | | - case 238: /* tridxby ::= NOT INDEXED */ |
| 136076 | + case 241: /* tridxby ::= NOT INDEXED */ |
| 134791 | 136077 | { |
| 134792 | 136078 | sqlite3ErrorMsg(pParse, |
| 134793 | 136079 | "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " |
| 134794 | 136080 | "within triggers"); |
| 134795 | 136081 | } |
| 134796 | 136082 | break; |
| 134797 | | - case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 136083 | + case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ |
| 134798 | 136084 | {yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);} |
| 134799 | 136085 | break; |
| 134800 | | - case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 136086 | + case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */ |
| 134801 | 136087 | {yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/} |
| 134802 | 136088 | break; |
| 134803 | | - case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 136089 | + case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ |
| 134804 | 136090 | {yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);} |
| 134805 | 136091 | break; |
| 134806 | | - case 242: /* trigger_cmd ::= select */ |
| 136092 | + case 245: /* trigger_cmd ::= select */ |
| 134807 | 136093 | {yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/} |
| 134808 | 136094 | break; |
| 134809 | | - case 243: /* expr ::= RAISE LP IGNORE RP */ |
| 136095 | + case 246: /* expr ::= RAISE LP IGNORE RP */ |
| 134810 | 136096 | { |
| 134811 | 136097 | spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134812 | 136098 | yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); |
| 134813 | 136099 | if( yymsp[-3].minor.yy190.pExpr ){ |
| 134814 | 136100 | yymsp[-3].minor.yy190.pExpr->affinity = OE_Ignore; |
| 134815 | 136101 | } |
| 134816 | 136102 | } |
| 134817 | 136103 | break; |
| 134818 | | - case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 136104 | + case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */ |
| 134819 | 136105 | { |
| 134820 | 136106 | spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/ |
| 134821 | 136107 | yymsp[-5].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); |
| 134822 | 136108 | if( yymsp[-5].minor.yy190.pExpr ) { |
| 134823 | 136109 | yymsp[-5].minor.yy190.pExpr->affinity = (char)yymsp[-3].minor.yy194; |
| 134824 | 136110 | } |
| 134825 | 136111 | } |
| 134826 | 136112 | break; |
| 134827 | | - case 245: /* raisetype ::= ROLLBACK */ |
| 136113 | + case 248: /* raisetype ::= ROLLBACK */ |
| 134828 | 136114 | {yymsp[0].minor.yy194 = OE_Rollback;} |
| 134829 | 136115 | break; |
| 134830 | | - case 247: /* raisetype ::= FAIL */ |
| 136116 | + case 250: /* raisetype ::= FAIL */ |
| 134831 | 136117 | {yymsp[0].minor.yy194 = OE_Fail;} |
| 134832 | 136118 | break; |
| 134833 | | - case 248: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 136119 | + case 251: /* cmd ::= DROP TRIGGER ifexists fullname */ |
| 134834 | 136120 | { |
| 134835 | 136121 | sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194); |
| 134836 | 136122 | } |
| 134837 | 136123 | break; |
| 134838 | | - case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 136124 | + case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ |
| 134839 | 136125 | { |
| 134840 | 136126 | sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72); |
| 134841 | 136127 | } |
| 134842 | 136128 | break; |
| 134843 | | - case 250: /* cmd ::= DETACH database_kw_opt expr */ |
| 136129 | + case 253: /* cmd ::= DETACH database_kw_opt expr */ |
| 134844 | 136130 | { |
| 134845 | 136131 | sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr); |
| 134846 | 136132 | } |
| 134847 | 136133 | break; |
| 134848 | | - case 253: /* cmd ::= REINDEX */ |
| 136134 | + case 256: /* cmd ::= REINDEX */ |
| 134849 | 136135 | {sqlite3Reindex(pParse, 0, 0);} |
| 134850 | 136136 | break; |
| 134851 | | - case 254: /* cmd ::= REINDEX nm dbnm */ |
| 136137 | + case 257: /* cmd ::= REINDEX nm dbnm */ |
| 134852 | 136138 | {sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 134853 | 136139 | break; |
| 134854 | | - case 255: /* cmd ::= ANALYZE */ |
| 136140 | + case 258: /* cmd ::= ANALYZE */ |
| 134855 | 136141 | {sqlite3Analyze(pParse, 0, 0);} |
| 134856 | 136142 | break; |
| 134857 | | - case 256: /* cmd ::= ANALYZE nm dbnm */ |
| 136143 | + case 259: /* cmd ::= ANALYZE nm dbnm */ |
| 134858 | 136144 | {sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} |
| 134859 | 136145 | break; |
| 134860 | | - case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 136146 | + case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ |
| 134861 | 136147 | { |
| 134862 | 136148 | sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0); |
| 134863 | 136149 | } |
| 134864 | 136150 | break; |
| 134865 | | - case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 136151 | + case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */ |
| 134866 | 136152 | { |
| 134867 | 136153 | yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n; |
| 134868 | 136154 | sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0); |
| 134869 | 136155 | } |
| 134870 | 136156 | break; |
| 134871 | | - case 259: /* add_column_fullname ::= fullname */ |
| 136157 | + case 262: /* add_column_fullname ::= fullname */ |
| 134872 | 136158 | { |
| 134873 | 136159 | disableLookaside(pParse); |
| 134874 | 136160 | sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185); |
| 134875 | 136161 | } |
| 134876 | 136162 | break; |
| 134877 | | - case 260: /* cmd ::= create_vtab */ |
| 136163 | + case 263: /* cmd ::= create_vtab */ |
| 134878 | 136164 | {sqlite3VtabFinishParse(pParse,0);} |
| 134879 | 136165 | break; |
| 134880 | | - case 261: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 136166 | + case 264: /* cmd ::= create_vtab LP vtabarglist RP */ |
| 134881 | 136167 | {sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} |
| 134882 | 136168 | break; |
| 134883 | | - case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 136169 | + case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ |
| 134884 | 136170 | { |
| 134885 | 136171 | sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194); |
| 134886 | 136172 | } |
| 134887 | 136173 | break; |
| 134888 | | - case 263: /* vtabarg ::= */ |
| 136174 | + case 266: /* vtabarg ::= */ |
| 134889 | 136175 | {sqlite3VtabArgInit(pParse);} |
| 134890 | 136176 | break; |
| 134891 | | - case 264: /* vtabargtoken ::= ANY */ |
| 134892 | | - case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265); |
| 134893 | | - case 266: /* lp ::= LP */ yytestcase(yyruleno==266); |
| 136177 | + case 267: /* vtabargtoken ::= ANY */ |
| 136178 | + case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268); |
| 136179 | + case 269: /* lp ::= LP */ yytestcase(yyruleno==269); |
| 134894 | 136180 | {sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} |
| 134895 | 136181 | break; |
| 134896 | | - case 267: /* with ::= */ |
| 136182 | + case 270: /* with ::= */ |
| 134897 | 136183 | {yymsp[1].minor.yy285 = 0;} |
| 134898 | 136184 | break; |
| 134899 | | - case 268: /* with ::= WITH wqlist */ |
| 136185 | + case 271: /* with ::= WITH wqlist */ |
| 134900 | 136186 | { yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; } |
| 134901 | 136187 | break; |
| 134902 | | - case 269: /* with ::= WITH RECURSIVE wqlist */ |
| 136188 | + case 272: /* with ::= WITH RECURSIVE wqlist */ |
| 134903 | 136189 | { yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; } |
| 134904 | 136190 | break; |
| 134905 | | - case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 136191 | + case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */ |
| 134906 | 136192 | { |
| 134907 | 136193 | yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/ |
| 134908 | 136194 | } |
| 134909 | 136195 | break; |
| 134910 | | - case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 136196 | + case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */ |
| 134911 | 136197 | { |
| 134912 | 136198 | yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); |
| 134913 | 136199 | } |
| 134914 | 136200 | break; |
| 134915 | 136201 | default: |
| 134916 | | - /* (272) input ::= cmdlist */ yytestcase(yyruleno==272); |
| 134917 | | - /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273); |
| 134918 | | - /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274); |
| 134919 | | - /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275); |
| 134920 | | - /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276); |
| 134921 | | - /* (277) explain ::= */ yytestcase(yyruleno==277); |
| 134922 | | - /* (278) trans_opt ::= */ yytestcase(yyruleno==278); |
| 134923 | | - /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279); |
| 134924 | | - /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280); |
| 134925 | | - /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281); |
| 134926 | | - /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282); |
| 134927 | | - /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283); |
| 134928 | | - /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284); |
| 134929 | | - /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285); |
| 134930 | | - /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286); |
| 134931 | | - /* (287) nm ::= STRING */ yytestcase(yyruleno==287); |
| 134932 | | - /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288); |
| 134933 | | - /* (289) typetoken ::= typename */ yytestcase(yyruleno==289); |
| 134934 | | - /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290); |
| 134935 | | - /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291); |
| 134936 | | - /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292); |
| 134937 | | - /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293); |
| 134938 | | - /* (294) carglist ::= */ yytestcase(yyruleno==294); |
| 134939 | | - /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295); |
| 134940 | | - /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296); |
| 134941 | | - /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297); |
| 134942 | | - /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298); |
| 134943 | | - /* (299) tconscomma ::= */ yytestcase(yyruleno==299); |
| 134944 | | - /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300); |
| 134945 | | - /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301); |
| 134946 | | - /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302); |
| 134947 | | - /* (303) oneselect ::= values */ yytestcase(yyruleno==303); |
| 134948 | | - /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304); |
| 134949 | | - /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305); |
| 134950 | | - /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306); |
| 134951 | | - /* (307) exprlist ::= nexprlist */ yytestcase(yyruleno==307); |
| 134952 | | - /* (308) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=308); |
| 134953 | | - /* (309) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=309); |
| 134954 | | - /* (310) nmnum ::= ON */ yytestcase(yyruleno==310); |
| 134955 | | - /* (311) nmnum ::= DELETE */ yytestcase(yyruleno==311); |
| 134956 | | - /* (312) nmnum ::= DEFAULT */ yytestcase(yyruleno==312); |
| 134957 | | - /* (313) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==313); |
| 134958 | | - /* (314) foreach_clause ::= */ yytestcase(yyruleno==314); |
| 134959 | | - /* (315) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==315); |
| 134960 | | - /* (316) trnm ::= nm */ yytestcase(yyruleno==316); |
| 134961 | | - /* (317) tridxby ::= */ yytestcase(yyruleno==317); |
| 134962 | | - /* (318) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==318); |
| 134963 | | - /* (319) database_kw_opt ::= */ yytestcase(yyruleno==319); |
| 134964 | | - /* (320) kwcolumn_opt ::= */ yytestcase(yyruleno==320); |
| 134965 | | - /* (321) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==321); |
| 134966 | | - /* (322) vtabarglist ::= vtabarg */ yytestcase(yyruleno==322); |
| 134967 | | - /* (323) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==323); |
| 134968 | | - /* (324) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==324); |
| 134969 | | - /* (325) anylist ::= */ yytestcase(yyruleno==325); |
| 134970 | | - /* (326) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==326); |
| 134971 | | - /* (327) anylist ::= anylist ANY */ yytestcase(yyruleno==327); |
| 136202 | + /* (275) input ::= cmdlist */ yytestcase(yyruleno==275); |
| 136203 | + /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276); |
| 136204 | + /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277); |
| 136205 | + /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278); |
| 136206 | + /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279); |
| 136207 | + /* (280) explain ::= */ yytestcase(yyruleno==280); |
| 136208 | + /* (281) trans_opt ::= */ yytestcase(yyruleno==281); |
| 136209 | + /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282); |
| 136210 | + /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283); |
| 136211 | + /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284); |
| 136212 | + /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285); |
| 136213 | + /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286); |
| 136214 | + /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287); |
| 136215 | + /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288); |
| 136216 | + /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289); |
| 136217 | + /* (290) nm ::= STRING */ yytestcase(yyruleno==290); |
| 136218 | + /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291); |
| 136219 | + /* (292) typetoken ::= typename */ yytestcase(yyruleno==292); |
| 136220 | + /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293); |
| 136221 | + /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294); |
| 136222 | + /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295); |
| 136223 | + /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296); |
| 136224 | + /* (297) carglist ::= */ yytestcase(yyruleno==297); |
| 136225 | + /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298); |
| 136226 | + /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299); |
| 136227 | + /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300); |
| 136228 | + /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301); |
| 136229 | + /* (302) tconscomma ::= */ yytestcase(yyruleno==302); |
| 136230 | + /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303); |
| 136231 | + /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304); |
| 136232 | + /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305); |
| 136233 | + /* (306) oneselect ::= values */ yytestcase(yyruleno==306); |
| 136234 | + /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307); |
| 136235 | + /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308); |
| 136236 | + /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309); |
| 136237 | + /* (310) exprlist ::= nexprlist */ yytestcase(yyruleno==310); |
| 136238 | + /* (311) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=311); |
| 136239 | + /* (312) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=312); |
| 136240 | + /* (313) nmnum ::= ON */ yytestcase(yyruleno==313); |
| 136241 | + /* (314) nmnum ::= DELETE */ yytestcase(yyruleno==314); |
| 136242 | + /* (315) nmnum ::= DEFAULT */ yytestcase(yyruleno==315); |
| 136243 | + /* (316) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==316); |
| 136244 | + /* (317) foreach_clause ::= */ yytestcase(yyruleno==317); |
| 136245 | + /* (318) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==318); |
| 136246 | + /* (319) trnm ::= nm */ yytestcase(yyruleno==319); |
| 136247 | + /* (320) tridxby ::= */ yytestcase(yyruleno==320); |
| 136248 | + /* (321) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==321); |
| 136249 | + /* (322) database_kw_opt ::= */ yytestcase(yyruleno==322); |
| 136250 | + /* (323) kwcolumn_opt ::= */ yytestcase(yyruleno==323); |
| 136251 | + /* (324) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==324); |
| 136252 | + /* (325) vtabarglist ::= vtabarg */ yytestcase(yyruleno==325); |
| 136253 | + /* (326) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==326); |
| 136254 | + /* (327) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==327); |
| 136255 | + /* (328) anylist ::= */ yytestcase(yyruleno==328); |
| 136256 | + /* (329) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==329); |
| 136257 | + /* (330) anylist ::= anylist ANY */ yytestcase(yyruleno==330); |
| 134972 | 136258 | break; |
| 134973 | 136259 | /********** End reduce actions ************************************************/ |
| 134974 | 136260 | }; |
| 134975 | 136261 | assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) ); |
| 134976 | 136262 | yygoto = yyRuleInfo[yyruleno].lhs; |
| | @@ -138358,10 +139644,12 @@ |
| 138358 | 139644 | if( !sqlite3SafetyCheckOk(db) ){ |
| 138359 | 139645 | return SQLITE_MISUSE_BKPT; |
| 138360 | 139646 | } |
| 138361 | 139647 | #endif |
| 138362 | 139648 | sqlite3_mutex_enter(db->mutex); |
| 139649 | + if( mTrace==0 ) xTrace = 0; |
| 139650 | + if( xTrace==0 ) mTrace = 0; |
| 138363 | 139651 | db->mTrace = mTrace; |
| 138364 | 139652 | db->xTrace = xTrace; |
| 138365 | 139653 | db->pTraceArg = pArg; |
| 138366 | 139654 | sqlite3_mutex_leave(db->mutex); |
| 138367 | 139655 | return SQLITE_OK; |
| | @@ -139468,15 +140756,24 @@ |
| 139468 | 140756 | ** database schema yet. This is delayed until the first time the database |
| 139469 | 140757 | ** is accessed. |
| 139470 | 140758 | */ |
| 139471 | 140759 | sqlite3Error(db, SQLITE_OK); |
| 139472 | 140760 | sqlite3RegisterPerConnectionBuiltinFunctions(db); |
| 140761 | + rc = sqlite3_errcode(db); |
| 140762 | + |
| 140763 | +#ifdef SQLITE_ENABLE_FTS5 |
| 140764 | + /* Register any built-in FTS5 module before loading the automatic |
| 140765 | + ** extensions. This allows automatic extensions to register FTS5 |
| 140766 | + ** tokenizers and auxiliary functions. */ |
| 140767 | + if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 140768 | + rc = sqlite3Fts5Init(db); |
| 140769 | + } |
| 140770 | +#endif |
| 139473 | 140771 | |
| 139474 | 140772 | /* Load automatic extensions - extensions that have been registered |
| 139475 | 140773 | ** using the sqlite3_automatic_extension() API. |
| 139476 | 140774 | */ |
| 139477 | | - rc = sqlite3_errcode(db); |
| 139478 | 140775 | if( rc==SQLITE_OK ){ |
| 139479 | 140776 | sqlite3AutoLoadExtensions(db); |
| 139480 | 140777 | rc = sqlite3_errcode(db); |
| 139481 | 140778 | if( rc!=SQLITE_OK ){ |
| 139482 | 140779 | goto opendb_out; |
| | @@ -139499,16 +140796,10 @@ |
| 139499 | 140796 | |
| 139500 | 140797 | #ifdef SQLITE_ENABLE_FTS3 /* automatically defined by SQLITE_ENABLE_FTS4 */ |
| 139501 | 140798 | if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 139502 | 140799 | rc = sqlite3Fts3Init(db); |
| 139503 | 140800 | } |
| 139504 | | -#endif |
| 139505 | | - |
| 139506 | | -#ifdef SQLITE_ENABLE_FTS5 |
| 139507 | | - if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 139508 | | - rc = sqlite3Fts5Init(db); |
| 139509 | | - } |
| 139510 | 140801 | #endif |
| 139511 | 140802 | |
| 139512 | 140803 | #ifdef SQLITE_ENABLE_ICU |
| 139513 | 140804 | if( !db->mallocFailed && rc==SQLITE_OK ){ |
| 139514 | 140805 | rc = sqlite3IcuInit(db); |
| | @@ -161530,11 +162821,11 @@ |
| 161530 | 162821 | |
| 161531 | 162822 | pCsr->iStrategy = idxNum; |
| 161532 | 162823 | if( idxNum==1 ){ |
| 161533 | 162824 | /* Special case - lookup by rowid. */ |
| 161534 | 162825 | RtreeNode *pLeaf; /* Leaf on which the required cell resides */ |
| 161535 | | - RtreeSearchPoint *p; /* Search point for the the leaf */ |
| 162826 | + RtreeSearchPoint *p; /* Search point for the leaf */ |
| 161536 | 162827 | i64 iRowid = sqlite3_value_int64(argv[0]); |
| 161537 | 162828 | i64 iNode = 0; |
| 161538 | 162829 | rc = findLeafNode(pRtree, iRowid, &pLeaf, &iNode); |
| 161539 | 162830 | if( rc==SQLITE_OK && pLeaf!=0 ){ |
| 161540 | 162831 | p = rtreeSearchPointNew(pCsr, RTREE_ZERO, 0); |
| | @@ -164566,11 +165857,11 @@ |
| 164566 | 165857 | ** |
| 164567 | 165858 | ** Instead of the plain data_<target> naming scheme, RBU database tables |
| 164568 | 165859 | ** may also be named data<integer>_<target>, where <integer> is any sequence |
| 164569 | 165860 | ** of zero or more numeric characters (0-9). This can be significant because |
| 164570 | 165861 | ** tables within the RBU database are always processed in order sorted by |
| 164571 | | -** name. By judicious selection of the the <integer> portion of the names |
| 165862 | +** name. By judicious selection of the <integer> portion of the names |
| 164572 | 165863 | ** of the RBU tables the user can therefore control the order in which they |
| 164573 | 165864 | ** are processed. This can be useful, for example, to ensure that "external |
| 164574 | 165865 | ** content" FTS4 tables are updated before their underlying content tables. |
| 164575 | 165866 | ** |
| 164576 | 165867 | ** If the target database table is a virtual table or a table that has no |
| | @@ -180154,10 +181445,119 @@ |
| 180154 | 181445 | } |
| 180155 | 181446 | } |
| 180156 | 181447 | /* |
| 180157 | 181448 | ** End of highlight() implementation. |
| 180158 | 181449 | **************************************************************************/ |
| 181450 | + |
| 181451 | +/* |
| 181452 | +** Context object passed to the fts5SentenceFinderCb() function. |
| 181453 | +*/ |
| 181454 | +typedef struct Fts5SFinder Fts5SFinder; |
| 181455 | +struct Fts5SFinder { |
| 181456 | + int iPos; /* Current token position */ |
| 181457 | + int nFirstAlloc; /* Allocated size of aFirst[] */ |
| 181458 | + int nFirst; /* Number of entries in aFirst[] */ |
| 181459 | + int *aFirst; /* Array of first token in each sentence */ |
| 181460 | + const char *zDoc; /* Document being tokenized */ |
| 181461 | +}; |
| 181462 | + |
| 181463 | +/* |
| 181464 | +** Add an entry to the Fts5SFinder.aFirst[] array. Grow the array if |
| 181465 | +** necessary. Return SQLITE_OK if successful, or SQLITE_NOMEM if an |
| 181466 | +** error occurs. |
| 181467 | +*/ |
| 181468 | +static int fts5SentenceFinderAdd(Fts5SFinder *p, int iAdd){ |
| 181469 | + if( p->nFirstAlloc==p->nFirst ){ |
| 181470 | + int nNew = p->nFirstAlloc ? p->nFirstAlloc*2 : 64; |
| 181471 | + int *aNew; |
| 181472 | + |
| 181473 | + aNew = (int*)sqlite3_realloc(p->aFirst, nNew*sizeof(int)); |
| 181474 | + if( aNew==0 ) return SQLITE_NOMEM; |
| 181475 | + p->aFirst = aNew; |
| 181476 | + p->nFirstAlloc = nNew; |
| 181477 | + } |
| 181478 | + p->aFirst[p->nFirst++] = iAdd; |
| 181479 | + return SQLITE_OK; |
| 181480 | +} |
| 181481 | + |
| 181482 | +/* |
| 181483 | +** This function is an xTokenize() callback used by the auxiliary snippet() |
| 181484 | +** function. Its job is to identify tokens that are the first in a sentence. |
| 181485 | +** For each such token, an entry is added to the SFinder.aFirst[] array. |
| 181486 | +*/ |
| 181487 | +static int fts5SentenceFinderCb( |
| 181488 | + void *pContext, /* Pointer to HighlightContext object */ |
| 181489 | + int tflags, /* Mask of FTS5_TOKEN_* flags */ |
| 181490 | + const char *pToken, /* Buffer containing token */ |
| 181491 | + int nToken, /* Size of token in bytes */ |
| 181492 | + int iStartOff, /* Start offset of token */ |
| 181493 | + int iEndOff /* End offset of token */ |
| 181494 | +){ |
| 181495 | + int rc = SQLITE_OK; |
| 181496 | + |
| 181497 | + if( (tflags & FTS5_TOKEN_COLOCATED)==0 ){ |
| 181498 | + Fts5SFinder *p = (Fts5SFinder*)pContext; |
| 181499 | + if( p->iPos>0 ){ |
| 181500 | + int i; |
| 181501 | + char c = 0; |
| 181502 | + for(i=iStartOff-1; i>=0; i--){ |
| 181503 | + c = p->zDoc[i]; |
| 181504 | + if( c!=' ' && c!='\t' && c!='\n' && c!='\r' ) break; |
| 181505 | + } |
| 181506 | + if( i!=iStartOff-1 && (c=='.' || c==':') ){ |
| 181507 | + rc = fts5SentenceFinderAdd(p, p->iPos); |
| 181508 | + } |
| 181509 | + }else{ |
| 181510 | + rc = fts5SentenceFinderAdd(p, 0); |
| 181511 | + } |
| 181512 | + p->iPos++; |
| 181513 | + } |
| 181514 | + return rc; |
| 181515 | +} |
| 181516 | + |
| 181517 | +static int fts5SnippetScore( |
| 181518 | + const Fts5ExtensionApi *pApi, /* API offered by current FTS version */ |
| 181519 | + Fts5Context *pFts, /* First arg to pass to pApi functions */ |
| 181520 | + int nDocsize, /* Size of column in tokens */ |
| 181521 | + unsigned char *aSeen, /* Array with one element per query phrase */ |
| 181522 | + int iCol, /* Column to score */ |
| 181523 | + int iPos, /* Starting offset to score */ |
| 181524 | + int nToken, /* Max tokens per snippet */ |
| 181525 | + int *pnScore, /* OUT: Score */ |
| 181526 | + int *piPos /* OUT: Adjusted offset */ |
| 181527 | +){ |
| 181528 | + int rc; |
| 181529 | + int i; |
| 181530 | + int ip = 0; |
| 181531 | + int ic = 0; |
| 181532 | + int iOff = 0; |
| 181533 | + int iFirst = -1; |
| 181534 | + int nInst; |
| 181535 | + int nScore = 0; |
| 181536 | + int iLast = 0; |
| 181537 | + |
| 181538 | + rc = pApi->xInstCount(pFts, &nInst); |
| 181539 | + for(i=0; i<nInst && rc==SQLITE_OK; i++){ |
| 181540 | + rc = pApi->xInst(pFts, i, &ip, &ic, &iOff); |
| 181541 | + if( rc==SQLITE_OK && ic==iCol && iOff>=iPos && iOff<(iPos+nToken) ){ |
| 181542 | + nScore += (aSeen[ip] ? 1 : 1000); |
| 181543 | + aSeen[ip] = 1; |
| 181544 | + if( iFirst<0 ) iFirst = iOff; |
| 181545 | + iLast = iOff + pApi->xPhraseSize(pFts, ip); |
| 181546 | + } |
| 181547 | + } |
| 181548 | + |
| 181549 | + *pnScore = nScore; |
| 181550 | + if( piPos ){ |
| 181551 | + int iAdj = iFirst - (nToken - (iLast-iFirst)) / 2; |
| 181552 | + if( (iAdj+nToken)>nDocsize ) iAdj = nDocsize - nToken; |
| 181553 | + if( iAdj<0 ) iAdj = 0; |
| 181554 | + *piPos = iAdj; |
| 181555 | + } |
| 181556 | + |
| 181557 | + return rc; |
| 181558 | +} |
| 180159 | 181559 | |
| 180160 | 181560 | /* |
| 180161 | 181561 | ** Implementation of snippet() function. |
| 180162 | 181562 | */ |
| 180163 | 181563 | static void fts5SnippetFunction( |
| | @@ -180176,87 +181576,111 @@ |
| 180176 | 181576 | int i; /* Used to iterate through instances */ |
| 180177 | 181577 | int nPhrase; /* Number of phrases in query */ |
| 180178 | 181578 | unsigned char *aSeen; /* Array of "seen instance" flags */ |
| 180179 | 181579 | int iBestCol; /* Column containing best snippet */ |
| 180180 | 181580 | int iBestStart = 0; /* First token of best snippet */ |
| 180181 | | - int iBestLast; /* Last token of best snippet */ |
| 180182 | 181581 | int nBestScore = 0; /* Score of best snippet */ |
| 180183 | 181582 | int nColSize = 0; /* Total size of iBestCol in tokens */ |
| 181583 | + Fts5SFinder sFinder; /* Used to find the beginnings of sentences */ |
| 181584 | + int nCol; |
| 180184 | 181585 | |
| 180185 | 181586 | if( nVal!=5 ){ |
| 180186 | 181587 | const char *zErr = "wrong number of arguments to function snippet()"; |
| 180187 | 181588 | sqlite3_result_error(pCtx, zErr, -1); |
| 180188 | 181589 | return; |
| 180189 | 181590 | } |
| 180190 | 181591 | |
| 181592 | + nCol = pApi->xColumnCount(pFts); |
| 180191 | 181593 | memset(&ctx, 0, sizeof(HighlightContext)); |
| 180192 | 181594 | iCol = sqlite3_value_int(apVal[0]); |
| 180193 | 181595 | ctx.zOpen = (const char*)sqlite3_value_text(apVal[1]); |
| 180194 | 181596 | ctx.zClose = (const char*)sqlite3_value_text(apVal[2]); |
| 180195 | 181597 | zEllips = (const char*)sqlite3_value_text(apVal[3]); |
| 180196 | 181598 | nToken = sqlite3_value_int(apVal[4]); |
| 180197 | | - iBestLast = nToken-1; |
| 180198 | 181599 | |
| 180199 | 181600 | iBestCol = (iCol>=0 ? iCol : 0); |
| 180200 | 181601 | nPhrase = pApi->xPhraseCount(pFts); |
| 180201 | 181602 | aSeen = sqlite3_malloc(nPhrase); |
| 180202 | 181603 | if( aSeen==0 ){ |
| 180203 | 181604 | rc = SQLITE_NOMEM; |
| 180204 | 181605 | } |
| 180205 | | - |
| 180206 | 181606 | if( rc==SQLITE_OK ){ |
| 180207 | 181607 | rc = pApi->xInstCount(pFts, &nInst); |
| 180208 | 181608 | } |
| 180209 | | - for(i=0; rc==SQLITE_OK && i<nInst; i++){ |
| 180210 | | - int ip, iSnippetCol, iStart; |
| 180211 | | - memset(aSeen, 0, nPhrase); |
| 180212 | | - rc = pApi->xInst(pFts, i, &ip, &iSnippetCol, &iStart); |
| 180213 | | - if( rc==SQLITE_OK && (iCol<0 || iSnippetCol==iCol) ){ |
| 180214 | | - int nScore = 1000; |
| 180215 | | - int iLast = iStart - 1 + pApi->xPhraseSize(pFts, ip); |
| 180216 | | - int j; |
| 180217 | | - aSeen[ip] = 1; |
| 180218 | | - |
| 180219 | | - for(j=i+1; rc==SQLITE_OK && j<nInst; j++){ |
| 180220 | | - int ic; int io; int iFinal; |
| 180221 | | - rc = pApi->xInst(pFts, j, &ip, &ic, &io); |
| 180222 | | - iFinal = io + pApi->xPhraseSize(pFts, ip) - 1; |
| 180223 | | - if( rc==SQLITE_OK && ic==iSnippetCol && iLast<iStart+nToken ){ |
| 180224 | | - nScore += aSeen[ip] ? 1000 : 1; |
| 180225 | | - aSeen[ip] = 1; |
| 180226 | | - if( iFinal>iLast ) iLast = iFinal; |
| 180227 | | - } |
| 180228 | | - } |
| 180229 | | - |
| 180230 | | - if( rc==SQLITE_OK && nScore>nBestScore ){ |
| 180231 | | - iBestCol = iSnippetCol; |
| 180232 | | - iBestStart = iStart; |
| 180233 | | - iBestLast = iLast; |
| 180234 | | - nBestScore = nScore; |
| 180235 | | - } |
| 180236 | | - } |
| 180237 | | - } |
| 180238 | | - |
| 180239 | | - if( rc==SQLITE_OK ){ |
| 180240 | | - rc = pApi->xColumnSize(pFts, iBestCol, &nColSize); |
| 180241 | | - } |
| 181609 | + |
| 181610 | + memset(&sFinder, 0, sizeof(Fts5SFinder)); |
| 181611 | + for(i=0; i<nCol; i++){ |
| 181612 | + if( iCol<0 || iCol==i ){ |
| 181613 | + int nDoc; |
| 181614 | + int nDocsize; |
| 181615 | + int ii; |
| 181616 | + sFinder.iPos = 0; |
| 181617 | + sFinder.nFirst = 0; |
| 181618 | + rc = pApi->xColumnText(pFts, i, &sFinder.zDoc, &nDoc); |
| 181619 | + if( rc!=SQLITE_OK ) break; |
| 181620 | + rc = pApi->xTokenize(pFts, |
| 181621 | + sFinder.zDoc, nDoc, (void*)&sFinder,fts5SentenceFinderCb |
| 181622 | + ); |
| 181623 | + if( rc!=SQLITE_OK ) break; |
| 181624 | + rc = pApi->xColumnSize(pFts, i, &nDocsize); |
| 181625 | + if( rc!=SQLITE_OK ) break; |
| 181626 | + |
| 181627 | + for(ii=0; rc==SQLITE_OK && ii<nInst; ii++){ |
| 181628 | + int ip, ic, io; |
| 181629 | + int iAdj; |
| 181630 | + int nScore; |
| 181631 | + int jj; |
| 181632 | + |
| 181633 | + rc = pApi->xInst(pFts, ii, &ip, &ic, &io); |
| 181634 | + if( ic!=i || rc!=SQLITE_OK ) continue; |
| 181635 | + memset(aSeen, 0, nPhrase); |
| 181636 | + rc = fts5SnippetScore(pApi, pFts, nDocsize, aSeen, i, |
| 181637 | + io, nToken, &nScore, &iAdj |
| 181638 | + ); |
| 181639 | + if( rc==SQLITE_OK && nScore>nBestScore ){ |
| 181640 | + nBestScore = nScore; |
| 181641 | + iBestCol = i; |
| 181642 | + iBestStart = iAdj; |
| 181643 | + nColSize = nDocsize; |
| 181644 | + } |
| 181645 | + |
| 181646 | + if( rc==SQLITE_OK && sFinder.nFirst && nDocsize>nToken ){ |
| 181647 | + for(jj=0; jj<(sFinder.nFirst-1); jj++){ |
| 181648 | + if( sFinder.aFirst[jj+1]>io ) break; |
| 181649 | + } |
| 181650 | + |
| 181651 | + if( sFinder.aFirst[jj]<io ){ |
| 181652 | + int nScore; |
| 181653 | + memset(aSeen, 0, nPhrase); |
| 181654 | + rc = fts5SnippetScore(pApi, pFts, nDocsize, aSeen, i, |
| 181655 | + sFinder.aFirst[jj], nToken, &nScore, 0 |
| 181656 | + ); |
| 181657 | + |
| 181658 | + nScore += (sFinder.aFirst[jj]==0 ? 120 : 100); |
| 181659 | + if( rc==SQLITE_OK && nScore>nBestScore ){ |
| 181660 | + nBestScore = nScore; |
| 181661 | + iBestCol = i; |
| 181662 | + iBestStart = sFinder.aFirst[jj]; |
| 181663 | + nColSize = nDocsize; |
| 181664 | + } |
| 181665 | + } |
| 181666 | + } |
| 181667 | + } |
| 181668 | + } |
| 181669 | + } |
| 181670 | + |
| 180242 | 181671 | if( rc==SQLITE_OK ){ |
| 180243 | 181672 | rc = pApi->xColumnText(pFts, iBestCol, &ctx.zIn, &ctx.nIn); |
| 180244 | 181673 | } |
| 181674 | + if( rc==SQLITE_OK && nColSize==0 ){ |
| 181675 | + rc = pApi->xColumnSize(pFts, iBestCol, &nColSize); |
| 181676 | + } |
| 180245 | 181677 | if( ctx.zIn ){ |
| 180246 | 181678 | if( rc==SQLITE_OK ){ |
| 180247 | 181679 | rc = fts5CInstIterInit(pApi, pFts, iBestCol, &ctx.iter); |
| 180248 | 181680 | } |
| 180249 | 181681 | |
| 180250 | | - if( (iBestStart+nToken-1)>iBestLast ){ |
| 180251 | | - iBestStart -= (iBestStart+nToken-1-iBestLast) / 2; |
| 180252 | | - } |
| 180253 | | - if( iBestStart+nToken>nColSize ){ |
| 180254 | | - iBestStart = nColSize - nToken; |
| 180255 | | - } |
| 180256 | | - if( iBestStart<0 ) iBestStart = 0; |
| 180257 | | - |
| 180258 | 181682 | ctx.iRangeStart = iBestStart; |
| 180259 | 181683 | ctx.iRangeEnd = iBestStart + nToken - 1; |
| 180260 | 181684 | |
| 180261 | 181685 | if( iBestStart>0 ){ |
| 180262 | 181686 | fts5HighlightAppend(&rc, &ctx, zEllips, -1); |
| | @@ -180274,19 +181698,19 @@ |
| 180274 | 181698 | if( ctx.iRangeEnd>=(nColSize-1) ){ |
| 180275 | 181699 | fts5HighlightAppend(&rc, &ctx, &ctx.zIn[ctx.iOff], ctx.nIn - ctx.iOff); |
| 180276 | 181700 | }else{ |
| 180277 | 181701 | fts5HighlightAppend(&rc, &ctx, zEllips, -1); |
| 180278 | 181702 | } |
| 180279 | | - |
| 180280 | | - if( rc==SQLITE_OK ){ |
| 180281 | | - sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); |
| 180282 | | - }else{ |
| 180283 | | - sqlite3_result_error_code(pCtx, rc); |
| 180284 | | - } |
| 180285 | | - sqlite3_free(ctx.zOut); |
| 180286 | | - } |
| 181703 | + } |
| 181704 | + if( rc==SQLITE_OK ){ |
| 181705 | + sqlite3_result_text(pCtx, (const char*)ctx.zOut, -1, SQLITE_TRANSIENT); |
| 181706 | + }else{ |
| 181707 | + sqlite3_result_error_code(pCtx, rc); |
| 181708 | + } |
| 181709 | + sqlite3_free(ctx.zOut); |
| 180287 | 181710 | sqlite3_free(aSeen); |
| 181711 | + sqlite3_free(sFinder.aFirst); |
| 180288 | 181712 | } |
| 180289 | 181713 | |
| 180290 | 181714 | /************************************************************************/ |
| 180291 | 181715 | |
| 180292 | 181716 | /* |
| | @@ -194153,11 +195577,11 @@ |
| 194153 | 195577 | int nArg, /* Number of args */ |
| 194154 | 195578 | sqlite3_value **apUnused /* Function arguments */ |
| 194155 | 195579 | ){ |
| 194156 | 195580 | assert( nArg==0 ); |
| 194157 | 195581 | UNUSED_PARAM2(nArg, apUnused); |
| 194158 | | - sqlite3_result_text(pCtx, "fts5: 2016-08-20 18:06:14 9041ee4a6f0e8389297f887f1431ab5cfe783390", -1, SQLITE_TRANSIENT); |
| 195582 | + sqlite3_result_text(pCtx, "fts5: 2016-08-08 14:21:10 c3cd543f3380475509d7bab9bb6c7858a8402457", -1, SQLITE_TRANSIENT); |
| 194159 | 195583 | } |
| 194160 | 195584 | |
| 194161 | 195585 | static int fts5Init(sqlite3 *db){ |
| 194162 | 195586 | static const sqlite3_module fts5Mod = { |
| 194163 | 195587 | /* iVersion */ 2, |
| 194164 | 195588 | |