| | @@ -452,11 +452,11 @@ |
| 452 | 452 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 453 | 453 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 454 | 454 | */ |
| 455 | 455 | #define SQLITE_VERSION "3.39.0" |
| 456 | 456 | #define SQLITE_VERSION_NUMBER 3039000 |
| 457 | | -#define SQLITE_SOURCE_ID "2022-03-02 01:02:16 6497997aa80419688890ed5dbbb7d6acc26bf3732305ff4a728cba1fe4d1626b" |
| 457 | +#define SQLITE_SOURCE_ID "2022-03-07 18:32:08 ae464a18d74bf44fc95bc335e75e6a57dc974f6d6a3d603133594039fb589af2" |
| 458 | 458 | |
| 459 | 459 | /* |
| 460 | 460 | ** CAPI3REF: Run-Time Library Version Numbers |
| 461 | 461 | ** KEYWORDS: sqlite3_version sqlite3_sourceid |
| 462 | 462 | ** |
| | @@ -15569,41 +15569,41 @@ |
| 15569 | 15569 | #define OP_Function 66 /* synopsis: r[P3]=func(r[P2@NP]) */ |
| 15570 | 15570 | #define OP_Return 67 |
| 15571 | 15571 | #define OP_EndCoroutine 68 |
| 15572 | 15572 | #define OP_HaltIfNull 69 /* synopsis: if r[P3]=null halt */ |
| 15573 | 15573 | #define OP_Halt 70 |
| 15574 | | -#define OP_Integer 71 /* synopsis: r[P2]=P1 */ |
| 15575 | | -#define OP_Int64 72 /* synopsis: r[P2]=P4 */ |
| 15576 | | -#define OP_String 73 /* synopsis: r[P2]='P4' (len=P1) */ |
| 15577 | | -#define OP_Null 74 /* synopsis: r[P2..P3]=NULL */ |
| 15578 | | -#define OP_SoftNull 75 /* synopsis: r[P1]=NULL */ |
| 15579 | | -#define OP_Blob 76 /* synopsis: r[P2]=P4 (len=P1) */ |
| 15580 | | -#define OP_Variable 77 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 15581 | | -#define OP_Move 78 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 15582 | | -#define OP_Copy 79 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 15583 | | -#define OP_SCopy 80 /* synopsis: r[P2]=r[P1] */ |
| 15584 | | -#define OP_IntCopy 81 /* synopsis: r[P2]=r[P1] */ |
| 15585 | | -#define OP_FkCheck 82 |
| 15586 | | -#define OP_ResultRow 83 /* synopsis: output=r[P1@P2] */ |
| 15587 | | -#define OP_CollSeq 84 |
| 15588 | | -#define OP_AddImm 85 /* synopsis: r[P1]=r[P1]+P2 */ |
| 15589 | | -#define OP_RealAffinity 86 |
| 15590 | | -#define OP_Cast 87 /* synopsis: affinity(r[P1]) */ |
| 15591 | | -#define OP_Permutation 88 |
| 15592 | | -#define OP_Compare 89 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 15593 | | -#define OP_IsTrue 90 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 15594 | | -#define OP_ZeroOrNull 91 /* synopsis: r[P2] = 0 OR NULL */ |
| 15595 | | -#define OP_Offset 92 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 15596 | | -#define OP_Column 93 /* synopsis: r[P3]=PX */ |
| 15597 | | -#define OP_TypeCheck 94 /* synopsis: typecheck(r[P1@P2]) */ |
| 15598 | | -#define OP_Affinity 95 /* synopsis: affinity(r[P1@P2]) */ |
| 15599 | | -#define OP_MakeRecord 96 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 15600 | | -#define OP_Count 97 /* synopsis: r[P2]=count() */ |
| 15601 | | -#define OP_ReadCookie 98 |
| 15602 | | -#define OP_SetCookie 99 |
| 15603 | | -#define OP_ReopenIdx 100 /* synopsis: root=P2 iDb=P3 */ |
| 15604 | | -#define OP_OpenRead 101 /* synopsis: root=P2 iDb=P3 */ |
| 15574 | +#define OP_BeginSubrtn 71 /* synopsis: r[P2]=P1 */ |
| 15575 | +#define OP_Integer 72 /* synopsis: r[P2]=P1 */ |
| 15576 | +#define OP_Int64 73 /* synopsis: r[P2]=P4 */ |
| 15577 | +#define OP_String 74 /* synopsis: r[P2]='P4' (len=P1) */ |
| 15578 | +#define OP_Null 75 /* synopsis: r[P2..P3]=NULL */ |
| 15579 | +#define OP_SoftNull 76 /* synopsis: r[P1]=NULL */ |
| 15580 | +#define OP_Blob 77 /* synopsis: r[P2]=P4 (len=P1) */ |
| 15581 | +#define OP_Variable 78 /* synopsis: r[P2]=parameter(P1,P4) */ |
| 15582 | +#define OP_Move 79 /* synopsis: r[P2@P3]=r[P1@P3] */ |
| 15583 | +#define OP_Copy 80 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ |
| 15584 | +#define OP_SCopy 81 /* synopsis: r[P2]=r[P1] */ |
| 15585 | +#define OP_IntCopy 82 /* synopsis: r[P2]=r[P1] */ |
| 15586 | +#define OP_FkCheck 83 |
| 15587 | +#define OP_ResultRow 84 /* synopsis: output=r[P1@P2] */ |
| 15588 | +#define OP_CollSeq 85 |
| 15589 | +#define OP_AddImm 86 /* synopsis: r[P1]=r[P1]+P2 */ |
| 15590 | +#define OP_RealAffinity 87 |
| 15591 | +#define OP_Cast 88 /* synopsis: affinity(r[P1]) */ |
| 15592 | +#define OP_Permutation 89 |
| 15593 | +#define OP_Compare 90 /* synopsis: r[P1@P3] <-> r[P2@P3] */ |
| 15594 | +#define OP_IsTrue 91 /* synopsis: r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4 */ |
| 15595 | +#define OP_ZeroOrNull 92 /* synopsis: r[P2] = 0 OR NULL */ |
| 15596 | +#define OP_Offset 93 /* synopsis: r[P3] = sqlite_offset(P1) */ |
| 15597 | +#define OP_Column 94 /* synopsis: r[P3]=PX */ |
| 15598 | +#define OP_TypeCheck 95 /* synopsis: typecheck(r[P1@P2]) */ |
| 15599 | +#define OP_Affinity 96 /* synopsis: affinity(r[P1@P2]) */ |
| 15600 | +#define OP_MakeRecord 97 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ |
| 15601 | +#define OP_Count 98 /* synopsis: r[P2]=count() */ |
| 15602 | +#define OP_ReadCookie 99 |
| 15603 | +#define OP_SetCookie 100 |
| 15604 | +#define OP_ReopenIdx 101 /* synopsis: root=P2 iDb=P3 */ |
| 15605 | 15605 | #define OP_BitAnd 102 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ |
| 15606 | 15606 | #define OP_BitOr 103 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ |
| 15607 | 15607 | #define OP_ShiftLeft 104 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */ |
| 15608 | 15608 | #define OP_ShiftRight 105 /* same as TK_RSHIFT, synopsis: r[P3]=r[P2]>>r[P1] */ |
| 15609 | 15609 | #define OP_Add 106 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ |
| | @@ -15610,83 +15610,84 @@ |
| 15610 | 15610 | #define OP_Subtract 107 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ |
| 15611 | 15611 | #define OP_Multiply 108 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ |
| 15612 | 15612 | #define OP_Divide 109 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ |
| 15613 | 15613 | #define OP_Remainder 110 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ |
| 15614 | 15614 | #define OP_Concat 111 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ |
| 15615 | | -#define OP_OpenWrite 112 /* synopsis: root=P2 iDb=P3 */ |
| 15616 | | -#define OP_OpenDup 113 |
| 15615 | +#define OP_OpenRead 112 /* synopsis: root=P2 iDb=P3 */ |
| 15616 | +#define OP_OpenWrite 113 /* synopsis: root=P2 iDb=P3 */ |
| 15617 | 15617 | #define OP_BitNot 114 /* same as TK_BITNOT, synopsis: r[P2]= ~r[P1] */ |
| 15618 | | -#define OP_OpenAutoindex 115 /* synopsis: nColumn=P2 */ |
| 15619 | | -#define OP_OpenEphemeral 116 /* synopsis: nColumn=P2 */ |
| 15618 | +#define OP_OpenDup 115 |
| 15619 | +#define OP_OpenAutoindex 116 /* synopsis: nColumn=P2 */ |
| 15620 | 15620 | #define OP_String8 117 /* same as TK_STRING, synopsis: r[P2]='P4' */ |
| 15621 | | -#define OP_SorterOpen 118 |
| 15622 | | -#define OP_SequenceTest 119 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 15623 | | -#define OP_OpenPseudo 120 /* synopsis: P3 columns in r[P2] */ |
| 15624 | | -#define OP_Close 121 |
| 15625 | | -#define OP_ColumnsUsed 122 |
| 15626 | | -#define OP_SeekScan 123 /* synopsis: Scan-ahead up to P1 rows */ |
| 15627 | | -#define OP_SeekHit 124 /* synopsis: set P2<=seekHit<=P3 */ |
| 15628 | | -#define OP_Sequence 125 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 15629 | | -#define OP_NewRowid 126 /* synopsis: r[P2]=rowid */ |
| 15630 | | -#define OP_Insert 127 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 15631 | | -#define OP_RowCell 128 |
| 15632 | | -#define OP_Delete 129 |
| 15633 | | -#define OP_ResetCount 130 |
| 15634 | | -#define OP_SorterCompare 131 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 15635 | | -#define OP_SorterData 132 /* synopsis: r[P2]=data */ |
| 15636 | | -#define OP_RowData 133 /* synopsis: r[P2]=data */ |
| 15637 | | -#define OP_Rowid 134 /* synopsis: r[P2]=rowid */ |
| 15638 | | -#define OP_NullRow 135 |
| 15639 | | -#define OP_SeekEnd 136 |
| 15640 | | -#define OP_IdxInsert 137 /* synopsis: key=r[P2] */ |
| 15641 | | -#define OP_SorterInsert 138 /* synopsis: key=r[P2] */ |
| 15642 | | -#define OP_IdxDelete 139 /* synopsis: key=r[P2@P3] */ |
| 15643 | | -#define OP_DeferredSeek 140 /* synopsis: Move P3 to P1.rowid if needed */ |
| 15644 | | -#define OP_IdxRowid 141 /* synopsis: r[P2]=rowid */ |
| 15645 | | -#define OP_FinishSeek 142 |
| 15646 | | -#define OP_Destroy 143 |
| 15647 | | -#define OP_Clear 144 |
| 15648 | | -#define OP_ResetSorter 145 |
| 15649 | | -#define OP_CreateBtree 146 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 15650 | | -#define OP_SqlExec 147 |
| 15651 | | -#define OP_ParseSchema 148 |
| 15652 | | -#define OP_LoadAnalysis 149 |
| 15653 | | -#define OP_DropTable 150 |
| 15654 | | -#define OP_DropIndex 151 |
| 15655 | | -#define OP_DropTrigger 152 |
| 15621 | +#define OP_OpenEphemeral 118 /* synopsis: nColumn=P2 */ |
| 15622 | +#define OP_SorterOpen 119 |
| 15623 | +#define OP_SequenceTest 120 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */ |
| 15624 | +#define OP_OpenPseudo 121 /* synopsis: P3 columns in r[P2] */ |
| 15625 | +#define OP_Close 122 |
| 15626 | +#define OP_ColumnsUsed 123 |
| 15627 | +#define OP_SeekScan 124 /* synopsis: Scan-ahead up to P1 rows */ |
| 15628 | +#define OP_SeekHit 125 /* synopsis: set P2<=seekHit<=P3 */ |
| 15629 | +#define OP_Sequence 126 /* synopsis: r[P2]=cursor[P1].ctr++ */ |
| 15630 | +#define OP_NewRowid 127 /* synopsis: r[P2]=rowid */ |
| 15631 | +#define OP_Insert 128 /* synopsis: intkey=r[P3] data=r[P2] */ |
| 15632 | +#define OP_RowCell 129 |
| 15633 | +#define OP_Delete 130 |
| 15634 | +#define OP_ResetCount 131 |
| 15635 | +#define OP_SorterCompare 132 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */ |
| 15636 | +#define OP_SorterData 133 /* synopsis: r[P2]=data */ |
| 15637 | +#define OP_RowData 134 /* synopsis: r[P2]=data */ |
| 15638 | +#define OP_Rowid 135 /* synopsis: r[P2]=rowid */ |
| 15639 | +#define OP_NullRow 136 |
| 15640 | +#define OP_SeekEnd 137 |
| 15641 | +#define OP_IdxInsert 138 /* synopsis: key=r[P2] */ |
| 15642 | +#define OP_SorterInsert 139 /* synopsis: key=r[P2] */ |
| 15643 | +#define OP_IdxDelete 140 /* synopsis: key=r[P2@P3] */ |
| 15644 | +#define OP_DeferredSeek 141 /* synopsis: Move P3 to P1.rowid if needed */ |
| 15645 | +#define OP_IdxRowid 142 /* synopsis: r[P2]=rowid */ |
| 15646 | +#define OP_FinishSeek 143 |
| 15647 | +#define OP_Destroy 144 |
| 15648 | +#define OP_Clear 145 |
| 15649 | +#define OP_ResetSorter 146 |
| 15650 | +#define OP_CreateBtree 147 /* synopsis: r[P2]=root iDb=P1 flags=P3 */ |
| 15651 | +#define OP_SqlExec 148 |
| 15652 | +#define OP_ParseSchema 149 |
| 15653 | +#define OP_LoadAnalysis 150 |
| 15654 | +#define OP_DropTable 151 |
| 15655 | +#define OP_DropIndex 152 |
| 15656 | 15656 | #define OP_Real 153 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ |
| 15657 | | -#define OP_IntegrityCk 154 |
| 15658 | | -#define OP_RowSetAdd 155 /* synopsis: rowset(P1)=r[P2] */ |
| 15659 | | -#define OP_Param 156 |
| 15660 | | -#define OP_FkCounter 157 /* synopsis: fkctr[P1]+=P2 */ |
| 15661 | | -#define OP_MemMax 158 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 15662 | | -#define OP_OffsetLimit 159 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 15663 | | -#define OP_AggInverse 160 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 15664 | | -#define OP_AggStep 161 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15665 | | -#define OP_AggStep1 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15666 | | -#define OP_AggValue 163 /* synopsis: r[P3]=value N=P2 */ |
| 15667 | | -#define OP_AggFinal 164 /* synopsis: accum=r[P1] N=P2 */ |
| 15668 | | -#define OP_Expire 165 |
| 15669 | | -#define OP_CursorLock 166 |
| 15670 | | -#define OP_CursorUnlock 167 |
| 15671 | | -#define OP_TableLock 168 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 15672 | | -#define OP_VBegin 169 |
| 15673 | | -#define OP_VCreate 170 |
| 15674 | | -#define OP_VDestroy 171 |
| 15675 | | -#define OP_VOpen 172 |
| 15676 | | -#define OP_VInitIn 173 /* synopsis: r[P2]=ValueList(P1,P3) */ |
| 15677 | | -#define OP_VColumn 174 /* synopsis: r[P3]=vcolumn(P2) */ |
| 15678 | | -#define OP_VRename 175 |
| 15679 | | -#define OP_Pagecount 176 |
| 15680 | | -#define OP_MaxPgcnt 177 |
| 15681 | | -#define OP_FilterAdd 178 /* synopsis: filter(P1) += key(P3@P4) */ |
| 15682 | | -#define OP_Trace 179 |
| 15683 | | -#define OP_CursorHint 180 |
| 15684 | | -#define OP_ReleaseReg 181 /* synopsis: release r[P1@P2] mask P3 */ |
| 15685 | | -#define OP_Noop 182 |
| 15686 | | -#define OP_Explain 183 |
| 15687 | | -#define OP_Abortable 184 |
| 15657 | +#define OP_DropTrigger 154 |
| 15658 | +#define OP_IntegrityCk 155 |
| 15659 | +#define OP_RowSetAdd 156 /* synopsis: rowset(P1)=r[P2] */ |
| 15660 | +#define OP_Param 157 |
| 15661 | +#define OP_FkCounter 158 /* synopsis: fkctr[P1]+=P2 */ |
| 15662 | +#define OP_MemMax 159 /* synopsis: r[P1]=max(r[P1],r[P2]) */ |
| 15663 | +#define OP_OffsetLimit 160 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */ |
| 15664 | +#define OP_AggInverse 161 /* synopsis: accum=r[P3] inverse(r[P2@P5]) */ |
| 15665 | +#define OP_AggStep 162 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15666 | +#define OP_AggStep1 163 /* synopsis: accum=r[P3] step(r[P2@P5]) */ |
| 15667 | +#define OP_AggValue 164 /* synopsis: r[P3]=value N=P2 */ |
| 15668 | +#define OP_AggFinal 165 /* synopsis: accum=r[P1] N=P2 */ |
| 15669 | +#define OP_Expire 166 |
| 15670 | +#define OP_CursorLock 167 |
| 15671 | +#define OP_CursorUnlock 168 |
| 15672 | +#define OP_TableLock 169 /* synopsis: iDb=P1 root=P2 write=P3 */ |
| 15673 | +#define OP_VBegin 170 |
| 15674 | +#define OP_VCreate 171 |
| 15675 | +#define OP_VDestroy 172 |
| 15676 | +#define OP_VOpen 173 |
| 15677 | +#define OP_VInitIn 174 /* synopsis: r[P2]=ValueList(P1,P3) */ |
| 15678 | +#define OP_VColumn 175 /* synopsis: r[P3]=vcolumn(P2) */ |
| 15679 | +#define OP_VRename 176 |
| 15680 | +#define OP_Pagecount 177 |
| 15681 | +#define OP_MaxPgcnt 178 |
| 15682 | +#define OP_FilterAdd 179 /* synopsis: filter(P1) += key(P3@P4) */ |
| 15683 | +#define OP_Trace 180 |
| 15684 | +#define OP_CursorHint 181 |
| 15685 | +#define OP_ReleaseReg 182 /* synopsis: release r[P1@P2] mask P3 */ |
| 15686 | +#define OP_Noop 183 |
| 15687 | +#define OP_Explain 184 |
| 15688 | +#define OP_Abortable 185 |
| 15688 | 15689 | |
| 15689 | 15690 | /* Properties such as "out2" or "jump" that are specified in |
| 15690 | 15691 | ** comments following the "case" for each opcode in the vdbe.c |
| 15691 | 15692 | ** are encoded into bitvectors as follows: |
| 15692 | 15693 | */ |
| | @@ -15703,26 +15704,26 @@ |
| 15703 | 15704 | /* 24 */ 0x01, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x01,\ |
| 15704 | 15705 | /* 32 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\ |
| 15705 | 15706 | /* 40 */ 0x01, 0x01, 0x01, 0x26, 0x26, 0x23, 0x0b, 0x01,\ |
| 15706 | 15707 | /* 48 */ 0x01, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\ |
| 15707 | 15708 | /* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x03, 0x01, 0x01, 0x01,\ |
| 15708 | | -/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x10,\ |
| 15709 | | -/* 72 */ 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, 0x00,\ |
| 15710 | | -/* 80 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02,\ |
| 15711 | | -/* 88 */ 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00, 0x00,\ |
| 15712 | | -/* 96 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\ |
| 15709 | +/* 64 */ 0x01, 0x00, 0x00, 0x02, 0x02, 0x08, 0x00, 0x00,\ |
| 15710 | +/* 72 */ 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00,\ |
| 15711 | +/* 80 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02,\ |
| 15712 | +/* 88 */ 0x02, 0x00, 0x00, 0x12, 0x1e, 0x20, 0x00, 0x00,\ |
| 15713 | +/* 96 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x26, 0x26,\ |
| 15713 | 15714 | /* 104 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\ |
| 15714 | 15715 | /* 112 */ 0x00, 0x00, 0x12, 0x00, 0x00, 0x10, 0x00, 0x00,\ |
| 15715 | | -/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00,\ |
| 15716 | | -/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\ |
| 15717 | | -/* 136 */ 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00, 0x10,\ |
| 15718 | | -/* 144 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15719 | | -/* 152 */ 0x00, 0x10, 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a,\ |
| 15720 | | -/* 160 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15721 | | -/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00,\ |
| 15722 | | -/* 176 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15723 | | -/* 184 */ 0x00,} |
| 15716 | +/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\ |
| 15717 | +/* 128 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\ |
| 15718 | +/* 136 */ 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x10, 0x00,\ |
| 15719 | +/* 144 */ 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\ |
| 15720 | +/* 152 */ 0x00, 0x10, 0x00, 0x00, 0x06, 0x10, 0x00, 0x04,\ |
| 15721 | +/* 160 */ 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15722 | +/* 168 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,\ |
| 15723 | +/* 176 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\ |
| 15724 | +/* 184 */ 0x00, 0x00,} |
| 15724 | 15725 | |
| 15725 | 15726 | /* The resolve3P2Values() routine is able to run faster if it knows |
| 15726 | 15727 | ** the value of the largest JUMP opcode. The smaller the maximum |
| 15727 | 15728 | ** JUMP opcode the better, so the mkopcodeh.tcl script that |
| 15728 | 15729 | ** generated this include file strives to group all JUMP opcodes |
| | @@ -22622,10 +22623,11 @@ |
| 22622 | 22623 | SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*); |
| 22623 | 22624 | SQLITE_PRIVATE int sqlite3VdbeMemCast(Mem*,u8,u8); |
| 22624 | 22625 | SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,Mem*); |
| 22625 | 22626 | SQLITE_PRIVATE int sqlite3VdbeMemFromBtreeZeroOffset(BtCursor*,u32,Mem*); |
| 22626 | 22627 | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p); |
| 22628 | +SQLITE_PRIVATE void sqlite3VdbeMemReleaseMalloc(Mem*p); |
| 22627 | 22629 | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); |
| 22628 | 22630 | #ifndef SQLITE_OMIT_WINDOWFUNC |
| 22629 | 22631 | SQLITE_PRIVATE int sqlite3VdbeMemAggValue(Mem*, Mem*, FuncDef*); |
| 22630 | 22632 | #endif |
| 22631 | 22633 | #if !defined(SQLITE_OMIT_EXPLAIN) || defined(SQLITE_ENABLE_BYTECODE_VTAB) |
| | @@ -23688,11 +23690,11 @@ |
| 23688 | 23690 | p->Y = sLocal.tm_year + 1900 - iYearDiff; |
| 23689 | 23691 | p->M = sLocal.tm_mon + 1; |
| 23690 | 23692 | p->D = sLocal.tm_mday; |
| 23691 | 23693 | p->h = sLocal.tm_hour; |
| 23692 | 23694 | p->m = sLocal.tm_min; |
| 23693 | | - p->s = sLocal.tm_sec; |
| 23695 | + p->s = sLocal.tm_sec + (p->iJD%1000)*0.001; |
| 23694 | 23696 | p->validYMD = 1; |
| 23695 | 23697 | p->validHMS = 1; |
| 23696 | 23698 | p->validJD = 0; |
| 23697 | 23699 | p->rawS = 0; |
| 23698 | 23700 | p->validTZ = 0; |
| | @@ -34683,41 +34685,41 @@ |
| 34683 | 34685 | /* 66 */ "Function" OpHelp("r[P3]=func(r[P2@NP])"), |
| 34684 | 34686 | /* 67 */ "Return" OpHelp(""), |
| 34685 | 34687 | /* 68 */ "EndCoroutine" OpHelp(""), |
| 34686 | 34688 | /* 69 */ "HaltIfNull" OpHelp("if r[P3]=null halt"), |
| 34687 | 34689 | /* 70 */ "Halt" OpHelp(""), |
| 34688 | | - /* 71 */ "Integer" OpHelp("r[P2]=P1"), |
| 34689 | | - /* 72 */ "Int64" OpHelp("r[P2]=P4"), |
| 34690 | | - /* 73 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 34691 | | - /* 74 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 34692 | | - /* 75 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 34693 | | - /* 76 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 34694 | | - /* 77 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 34695 | | - /* 78 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 34696 | | - /* 79 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 34697 | | - /* 80 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 34698 | | - /* 81 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 34699 | | - /* 82 */ "FkCheck" OpHelp(""), |
| 34700 | | - /* 83 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 34701 | | - /* 84 */ "CollSeq" OpHelp(""), |
| 34702 | | - /* 85 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 34703 | | - /* 86 */ "RealAffinity" OpHelp(""), |
| 34704 | | - /* 87 */ "Cast" OpHelp("affinity(r[P1])"), |
| 34705 | | - /* 88 */ "Permutation" OpHelp(""), |
| 34706 | | - /* 89 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 34707 | | - /* 90 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 34708 | | - /* 91 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), |
| 34709 | | - /* 92 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 34710 | | - /* 93 */ "Column" OpHelp("r[P3]=PX"), |
| 34711 | | - /* 94 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"), |
| 34712 | | - /* 95 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 34713 | | - /* 96 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 34714 | | - /* 97 */ "Count" OpHelp("r[P2]=count()"), |
| 34715 | | - /* 98 */ "ReadCookie" OpHelp(""), |
| 34716 | | - /* 99 */ "SetCookie" OpHelp(""), |
| 34717 | | - /* 100 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 34718 | | - /* 101 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 34690 | + /* 71 */ "BeginSubrtn" OpHelp("r[P2]=P1"), |
| 34691 | + /* 72 */ "Integer" OpHelp("r[P2]=P1"), |
| 34692 | + /* 73 */ "Int64" OpHelp("r[P2]=P4"), |
| 34693 | + /* 74 */ "String" OpHelp("r[P2]='P4' (len=P1)"), |
| 34694 | + /* 75 */ "Null" OpHelp("r[P2..P3]=NULL"), |
| 34695 | + /* 76 */ "SoftNull" OpHelp("r[P1]=NULL"), |
| 34696 | + /* 77 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), |
| 34697 | + /* 78 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), |
| 34698 | + /* 79 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), |
| 34699 | + /* 80 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), |
| 34700 | + /* 81 */ "SCopy" OpHelp("r[P2]=r[P1]"), |
| 34701 | + /* 82 */ "IntCopy" OpHelp("r[P2]=r[P1]"), |
| 34702 | + /* 83 */ "FkCheck" OpHelp(""), |
| 34703 | + /* 84 */ "ResultRow" OpHelp("output=r[P1@P2]"), |
| 34704 | + /* 85 */ "CollSeq" OpHelp(""), |
| 34705 | + /* 86 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), |
| 34706 | + /* 87 */ "RealAffinity" OpHelp(""), |
| 34707 | + /* 88 */ "Cast" OpHelp("affinity(r[P1])"), |
| 34708 | + /* 89 */ "Permutation" OpHelp(""), |
| 34709 | + /* 90 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"), |
| 34710 | + /* 91 */ "IsTrue" OpHelp("r[P2] = coalesce(r[P1]==TRUE,P3) ^ P4"), |
| 34711 | + /* 92 */ "ZeroOrNull" OpHelp("r[P2] = 0 OR NULL"), |
| 34712 | + /* 93 */ "Offset" OpHelp("r[P3] = sqlite_offset(P1)"), |
| 34713 | + /* 94 */ "Column" OpHelp("r[P3]=PX"), |
| 34714 | + /* 95 */ "TypeCheck" OpHelp("typecheck(r[P1@P2])"), |
| 34715 | + /* 96 */ "Affinity" OpHelp("affinity(r[P1@P2])"), |
| 34716 | + /* 97 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), |
| 34717 | + /* 98 */ "Count" OpHelp("r[P2]=count()"), |
| 34718 | + /* 99 */ "ReadCookie" OpHelp(""), |
| 34719 | + /* 100 */ "SetCookie" OpHelp(""), |
| 34720 | + /* 101 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"), |
| 34719 | 34721 | /* 102 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), |
| 34720 | 34722 | /* 103 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), |
| 34721 | 34723 | /* 104 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"), |
| 34722 | 34724 | /* 105 */ "ShiftRight" OpHelp("r[P3]=r[P2]>>r[P1]"), |
| 34723 | 34725 | /* 106 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), |
| | @@ -34724,83 +34726,84 @@ |
| 34724 | 34726 | /* 107 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), |
| 34725 | 34727 | /* 108 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), |
| 34726 | 34728 | /* 109 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), |
| 34727 | 34729 | /* 110 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), |
| 34728 | 34730 | /* 111 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), |
| 34729 | | - /* 112 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 34730 | | - /* 113 */ "OpenDup" OpHelp(""), |
| 34731 | + /* 112 */ "OpenRead" OpHelp("root=P2 iDb=P3"), |
| 34732 | + /* 113 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), |
| 34731 | 34733 | /* 114 */ "BitNot" OpHelp("r[P2]= ~r[P1]"), |
| 34732 | | - /* 115 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 34733 | | - /* 116 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 34734 | + /* 115 */ "OpenDup" OpHelp(""), |
| 34735 | + /* 116 */ "OpenAutoindex" OpHelp("nColumn=P2"), |
| 34734 | 34736 | /* 117 */ "String8" OpHelp("r[P2]='P4'"), |
| 34735 | | - /* 118 */ "SorterOpen" OpHelp(""), |
| 34736 | | - /* 119 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 34737 | | - /* 120 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 34738 | | - /* 121 */ "Close" OpHelp(""), |
| 34739 | | - /* 122 */ "ColumnsUsed" OpHelp(""), |
| 34740 | | - /* 123 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"), |
| 34741 | | - /* 124 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"), |
| 34742 | | - /* 125 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 34743 | | - /* 126 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 34744 | | - /* 127 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 34745 | | - /* 128 */ "RowCell" OpHelp(""), |
| 34746 | | - /* 129 */ "Delete" OpHelp(""), |
| 34747 | | - /* 130 */ "ResetCount" OpHelp(""), |
| 34748 | | - /* 131 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 34749 | | - /* 132 */ "SorterData" OpHelp("r[P2]=data"), |
| 34750 | | - /* 133 */ "RowData" OpHelp("r[P2]=data"), |
| 34751 | | - /* 134 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 34752 | | - /* 135 */ "NullRow" OpHelp(""), |
| 34753 | | - /* 136 */ "SeekEnd" OpHelp(""), |
| 34754 | | - /* 137 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 34755 | | - /* 138 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 34756 | | - /* 139 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 34757 | | - /* 140 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 34758 | | - /* 141 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 34759 | | - /* 142 */ "FinishSeek" OpHelp(""), |
| 34760 | | - /* 143 */ "Destroy" OpHelp(""), |
| 34761 | | - /* 144 */ "Clear" OpHelp(""), |
| 34762 | | - /* 145 */ "ResetSorter" OpHelp(""), |
| 34763 | | - /* 146 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 34764 | | - /* 147 */ "SqlExec" OpHelp(""), |
| 34765 | | - /* 148 */ "ParseSchema" OpHelp(""), |
| 34766 | | - /* 149 */ "LoadAnalysis" OpHelp(""), |
| 34767 | | - /* 150 */ "DropTable" OpHelp(""), |
| 34768 | | - /* 151 */ "DropIndex" OpHelp(""), |
| 34769 | | - /* 152 */ "DropTrigger" OpHelp(""), |
| 34737 | + /* 118 */ "OpenEphemeral" OpHelp("nColumn=P2"), |
| 34738 | + /* 119 */ "SorterOpen" OpHelp(""), |
| 34739 | + /* 120 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"), |
| 34740 | + /* 121 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"), |
| 34741 | + /* 122 */ "Close" OpHelp(""), |
| 34742 | + /* 123 */ "ColumnsUsed" OpHelp(""), |
| 34743 | + /* 124 */ "SeekScan" OpHelp("Scan-ahead up to P1 rows"), |
| 34744 | + /* 125 */ "SeekHit" OpHelp("set P2<=seekHit<=P3"), |
| 34745 | + /* 126 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"), |
| 34746 | + /* 127 */ "NewRowid" OpHelp("r[P2]=rowid"), |
| 34747 | + /* 128 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), |
| 34748 | + /* 129 */ "RowCell" OpHelp(""), |
| 34749 | + /* 130 */ "Delete" OpHelp(""), |
| 34750 | + /* 131 */ "ResetCount" OpHelp(""), |
| 34751 | + /* 132 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"), |
| 34752 | + /* 133 */ "SorterData" OpHelp("r[P2]=data"), |
| 34753 | + /* 134 */ "RowData" OpHelp("r[P2]=data"), |
| 34754 | + /* 135 */ "Rowid" OpHelp("r[P2]=rowid"), |
| 34755 | + /* 136 */ "NullRow" OpHelp(""), |
| 34756 | + /* 137 */ "SeekEnd" OpHelp(""), |
| 34757 | + /* 138 */ "IdxInsert" OpHelp("key=r[P2]"), |
| 34758 | + /* 139 */ "SorterInsert" OpHelp("key=r[P2]"), |
| 34759 | + /* 140 */ "IdxDelete" OpHelp("key=r[P2@P3]"), |
| 34760 | + /* 141 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"), |
| 34761 | + /* 142 */ "IdxRowid" OpHelp("r[P2]=rowid"), |
| 34762 | + /* 143 */ "FinishSeek" OpHelp(""), |
| 34763 | + /* 144 */ "Destroy" OpHelp(""), |
| 34764 | + /* 145 */ "Clear" OpHelp(""), |
| 34765 | + /* 146 */ "ResetSorter" OpHelp(""), |
| 34766 | + /* 147 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"), |
| 34767 | + /* 148 */ "SqlExec" OpHelp(""), |
| 34768 | + /* 149 */ "ParseSchema" OpHelp(""), |
| 34769 | + /* 150 */ "LoadAnalysis" OpHelp(""), |
| 34770 | + /* 151 */ "DropTable" OpHelp(""), |
| 34771 | + /* 152 */ "DropIndex" OpHelp(""), |
| 34770 | 34772 | /* 153 */ "Real" OpHelp("r[P2]=P4"), |
| 34771 | | - /* 154 */ "IntegrityCk" OpHelp(""), |
| 34772 | | - /* 155 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 34773 | | - /* 156 */ "Param" OpHelp(""), |
| 34774 | | - /* 157 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 34775 | | - /* 158 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 34776 | | - /* 159 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 34777 | | - /* 160 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 34778 | | - /* 161 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34779 | | - /* 162 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34780 | | - /* 163 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 34781 | | - /* 164 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 34782 | | - /* 165 */ "Expire" OpHelp(""), |
| 34783 | | - /* 166 */ "CursorLock" OpHelp(""), |
| 34784 | | - /* 167 */ "CursorUnlock" OpHelp(""), |
| 34785 | | - /* 168 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 34786 | | - /* 169 */ "VBegin" OpHelp(""), |
| 34787 | | - /* 170 */ "VCreate" OpHelp(""), |
| 34788 | | - /* 171 */ "VDestroy" OpHelp(""), |
| 34789 | | - /* 172 */ "VOpen" OpHelp(""), |
| 34790 | | - /* 173 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), |
| 34791 | | - /* 174 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 34792 | | - /* 175 */ "VRename" OpHelp(""), |
| 34793 | | - /* 176 */ "Pagecount" OpHelp(""), |
| 34794 | | - /* 177 */ "MaxPgcnt" OpHelp(""), |
| 34795 | | - /* 178 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), |
| 34796 | | - /* 179 */ "Trace" OpHelp(""), |
| 34797 | | - /* 180 */ "CursorHint" OpHelp(""), |
| 34798 | | - /* 181 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), |
| 34799 | | - /* 182 */ "Noop" OpHelp(""), |
| 34800 | | - /* 183 */ "Explain" OpHelp(""), |
| 34801 | | - /* 184 */ "Abortable" OpHelp(""), |
| 34773 | + /* 154 */ "DropTrigger" OpHelp(""), |
| 34774 | + /* 155 */ "IntegrityCk" OpHelp(""), |
| 34775 | + /* 156 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), |
| 34776 | + /* 157 */ "Param" OpHelp(""), |
| 34777 | + /* 158 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), |
| 34778 | + /* 159 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), |
| 34779 | + /* 160 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"), |
| 34780 | + /* 161 */ "AggInverse" OpHelp("accum=r[P3] inverse(r[P2@P5])"), |
| 34781 | + /* 162 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34782 | + /* 163 */ "AggStep1" OpHelp("accum=r[P3] step(r[P2@P5])"), |
| 34783 | + /* 164 */ "AggValue" OpHelp("r[P3]=value N=P2"), |
| 34784 | + /* 165 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), |
| 34785 | + /* 166 */ "Expire" OpHelp(""), |
| 34786 | + /* 167 */ "CursorLock" OpHelp(""), |
| 34787 | + /* 168 */ "CursorUnlock" OpHelp(""), |
| 34788 | + /* 169 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), |
| 34789 | + /* 170 */ "VBegin" OpHelp(""), |
| 34790 | + /* 171 */ "VCreate" OpHelp(""), |
| 34791 | + /* 172 */ "VDestroy" OpHelp(""), |
| 34792 | + /* 173 */ "VOpen" OpHelp(""), |
| 34793 | + /* 174 */ "VInitIn" OpHelp("r[P2]=ValueList(P1,P3)"), |
| 34794 | + /* 175 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), |
| 34795 | + /* 176 */ "VRename" OpHelp(""), |
| 34796 | + /* 177 */ "Pagecount" OpHelp(""), |
| 34797 | + /* 178 */ "MaxPgcnt" OpHelp(""), |
| 34798 | + /* 179 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"), |
| 34799 | + /* 180 */ "Trace" OpHelp(""), |
| 34800 | + /* 181 */ "CursorHint" OpHelp(""), |
| 34801 | + /* 182 */ "ReleaseReg" OpHelp("release r[P1@P2] mask P3"), |
| 34802 | + /* 183 */ "Noop" OpHelp(""), |
| 34803 | + /* 184 */ "Explain" OpHelp(""), |
| 34804 | + /* 185 */ "Abortable" OpHelp(""), |
| 34802 | 34805 | }; |
| 34803 | 34806 | return azName[i]; |
| 34804 | 34807 | } |
| 34805 | 34808 | #endif |
| 34806 | 34809 | |
| | @@ -58724,10 +58727,11 @@ |
| 58724 | 58727 | assert( pPager->errCode==SQLITE_OK ); |
| 58725 | 58728 | assert( pPager->eState>=PAGER_READER ); |
| 58726 | 58729 | assert( assert_pager_state(pPager) ); |
| 58727 | 58730 | assert( pPager->hasHeldSharedLock==1 ); |
| 58728 | 58731 | |
| 58732 | + if( pgno==0 ) return SQLITE_CORRUPT_BKPT; |
| 58729 | 58733 | pBase = sqlite3PcacheFetch(pPager->pPCache, pgno, 3); |
| 58730 | 58734 | if( pBase==0 ){ |
| 58731 | 58735 | pPg = 0; |
| 58732 | 58736 | rc = sqlite3PcacheFetchStress(pPager->pPCache, pgno, &pBase); |
| 58733 | 58737 | if( rc!=SQLITE_OK ) goto pager_acquire_err; |
| | @@ -58751,14 +58755,14 @@ |
| 58751 | 58755 | |
| 58752 | 58756 | }else{ |
| 58753 | 58757 | /* The pager cache has created a new page. Its content needs to |
| 58754 | 58758 | ** be initialized. But first some error checks: |
| 58755 | 58759 | ** |
| 58756 | | - ** (1) Never try to fetch the locking page |
| 58757 | | - ** (2) Never try to fetch page 0, which does not exist |
| 58760 | + ** (*) obsolete. Was: maximum page number is 2^31 |
| 58761 | + ** (2) Never try to fetch the locking page |
| 58758 | 58762 | */ |
| 58759 | | - if( pgno==PAGER_SJ_PGNO(pPager) || pgno==0 ){ |
| 58763 | + if( pgno==PAGER_SJ_PGNO(pPager) ){ |
| 58760 | 58764 | rc = SQLITE_CORRUPT_BKPT; |
| 58761 | 58765 | goto pager_acquire_err; |
| 58762 | 58766 | } |
| 58763 | 58767 | |
| 58764 | 58768 | pPg->pPager = pPager; |
| | @@ -66978,11 +66982,11 @@ |
| 66978 | 66982 | } |
| 66979 | 66983 | |
| 66980 | 66984 | /* |
| 66981 | 66985 | ** In this version of BtreeMoveto, pKey is a packed index record |
| 66982 | 66986 | ** such as is generated by the OP_MakeRecord opcode. Unpack the |
| 66983 | | -** record and then call BtreeMovetoUnpacked() to do the work. |
| 66987 | +** record and then call sqlite3BtreeIndexMoveto() to do the work. |
| 66984 | 66988 | */ |
| 66985 | 66989 | static int btreeMoveto( |
| 66986 | 66990 | BtCursor *pCur, /* Cursor open on the btree to be searched */ |
| 66987 | 66991 | const void *pKey, /* Packed key if the btree is an index */ |
| 66988 | 66992 | i64 nKey, /* Integer key for tables. Size of pKey for indices */ |
| | @@ -68085,11 +68089,10 @@ |
| 68085 | 68089 | assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) ); |
| 68086 | 68090 | assert( sqlite3_mutex_held(pPage->pBt->mutex) ); |
| 68087 | 68091 | pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 ); |
| 68088 | 68092 | flagByte &= ~PTF_LEAF; |
| 68089 | 68093 | pPage->childPtrSize = 4-4*pPage->leaf; |
| 68090 | | - pPage->xCellSize = cellSizePtr; |
| 68091 | 68094 | pBt = pPage->pBt; |
| 68092 | 68095 | if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){ |
| 68093 | 68096 | /* EVIDENCE-OF: R-07291-35328 A value of 5 (0x05) means the page is an |
| 68094 | 68097 | ** interior table b-tree page. */ |
| 68095 | 68098 | assert( (PTF_LEAFDATA|PTF_INTKEY)==5 ); |
| | @@ -68115,16 +68118,21 @@ |
| 68115 | 68118 | /* EVIDENCE-OF: R-59615-42828 A value of 10 (0x0a) means the page is a |
| 68116 | 68119 | ** leaf index b-tree page. */ |
| 68117 | 68120 | assert( (PTF_ZERODATA|PTF_LEAF)==10 ); |
| 68118 | 68121 | pPage->intKey = 0; |
| 68119 | 68122 | pPage->intKeyLeaf = 0; |
| 68123 | + pPage->xCellSize = cellSizePtr; |
| 68120 | 68124 | pPage->xParseCell = btreeParseCellPtrIndex; |
| 68121 | 68125 | pPage->maxLocal = pBt->maxLocal; |
| 68122 | 68126 | pPage->minLocal = pBt->minLocal; |
| 68123 | 68127 | }else{ |
| 68124 | 68128 | /* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is |
| 68125 | 68129 | ** an error. */ |
| 68130 | + pPage->intKey = 0; |
| 68131 | + pPage->intKeyLeaf = 0; |
| 68132 | + pPage->xCellSize = cellSizePtr; |
| 68133 | + pPage->xParseCell = btreeParseCellPtrIndex; |
| 68126 | 68134 | return SQLITE_CORRUPT_PAGE(pPage); |
| 68127 | 68135 | } |
| 68128 | 68136 | pPage->max1bytePayload = pBt->max1bytePayload; |
| 68129 | 68137 | return SQLITE_OK; |
| 68130 | 68138 | } |
| | @@ -71544,11 +71552,11 @@ |
| 71544 | 71552 | } |
| 71545 | 71553 | pCur->iPage = 0; |
| 71546 | 71554 | pCur->curIntKey = pCur->pPage->intKey; |
| 71547 | 71555 | } |
| 71548 | 71556 | pRoot = pCur->pPage; |
| 71549 | | - assert( pRoot->pgno==pCur->pgnoRoot ); |
| 71557 | + assert( pRoot->pgno==pCur->pgnoRoot || CORRUPT_DB ); |
| 71550 | 71558 | |
| 71551 | 71559 | /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor |
| 71552 | 71560 | ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is |
| 71553 | 71561 | ** NULL, the caller expects a table b-tree. If this is not the case, |
| 71554 | 71562 | ** return an SQLITE_CORRUPT error. |
| | @@ -71864,10 +71872,73 @@ |
| 71864 | 71872 | moveto_table_finish: |
| 71865 | 71873 | pCur->info.nSize = 0; |
| 71866 | 71874 | assert( (pCur->curFlags & BTCF_ValidOvfl)==0 ); |
| 71867 | 71875 | return rc; |
| 71868 | 71876 | } |
| 71877 | + |
| 71878 | +/* |
| 71879 | +** Compare the "idx"-th cell on the page the cursor pCur is currently |
| 71880 | +** pointing to to pIdxKey using xRecordCompare. Return negative or |
| 71881 | +** zero if the cell is less than or equal pIdxKey. Return positive |
| 71882 | +** if unknown. |
| 71883 | +** |
| 71884 | +** Return value negative: Cell at pCur[idx] less than pIdxKey |
| 71885 | +** |
| 71886 | +** Return value is zero: Cell at pCur[idx] equals pIdxKey |
| 71887 | +** |
| 71888 | +** Return value positive: Nothing is known about the relationship |
| 71889 | +** of the cell at pCur[idx] and pIdxKey. |
| 71890 | +** |
| 71891 | +** This routine is part of an optimization. It is always safe to return |
| 71892 | +** a positive value as that will cause the optimization to be skipped. |
| 71893 | +*/ |
| 71894 | +static int indexCellCompare( |
| 71895 | + BtCursor *pCur, |
| 71896 | + int idx, |
| 71897 | + UnpackedRecord *pIdxKey, |
| 71898 | + RecordCompare xRecordCompare |
| 71899 | +){ |
| 71900 | + MemPage *pPage = pCur->pPage; |
| 71901 | + int c; |
| 71902 | + int nCell; /* Size of the pCell cell in bytes */ |
| 71903 | + u8 *pCell = findCellPastPtr(pPage, idx); |
| 71904 | + |
| 71905 | + nCell = pCell[0]; |
| 71906 | + if( nCell<=pPage->max1bytePayload ){ |
| 71907 | + /* This branch runs if the record-size field of the cell is a |
| 71908 | + ** single byte varint and the record fits entirely on the main |
| 71909 | + ** b-tree page. */ |
| 71910 | + testcase( pCell+nCell+1==pPage->aDataEnd ); |
| 71911 | + c = xRecordCompare(nCell, (void*)&pCell[1], pIdxKey); |
| 71912 | + }else if( !(pCell[1] & 0x80) |
| 71913 | + && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal |
| 71914 | + ){ |
| 71915 | + /* The record-size field is a 2 byte varint and the record |
| 71916 | + ** fits entirely on the main b-tree page. */ |
| 71917 | + testcase( pCell+nCell+2==pPage->aDataEnd ); |
| 71918 | + c = xRecordCompare(nCell, (void*)&pCell[2], pIdxKey); |
| 71919 | + }else{ |
| 71920 | + /* If the record extends into overflow pages, do not attempt |
| 71921 | + ** the optimization. */ |
| 71922 | + c = 99; |
| 71923 | + } |
| 71924 | + return c; |
| 71925 | +} |
| 71926 | + |
| 71927 | +/* |
| 71928 | +** Return true (non-zero) if pCur is current pointing to the last |
| 71929 | +** page of a table. |
| 71930 | +*/ |
| 71931 | +static int cursorOnLastPage(BtCursor *pCur){ |
| 71932 | + int i; |
| 71933 | + assert( pCur->eState==CURSOR_VALID ); |
| 71934 | + for(i=0; i<pCur->iPage; i++){ |
| 71935 | + MemPage *pPage = pCur->apPage[i]; |
| 71936 | + if( pCur->aiIdx[i]<pPage->nCell ) return 0; |
| 71937 | + } |
| 71938 | + return 1; |
| 71939 | +} |
| 71869 | 71940 | |
| 71870 | 71941 | /* Move the cursor so that it points to an entry in an index table |
| 71871 | 71942 | ** near the key pIdxKey. Return a success code. |
| 71872 | 71943 | ** |
| 71873 | 71944 | ** If an exact match is not found, then the cursor is always |
| | @@ -71915,25 +71986,58 @@ |
| 71915 | 71986 | assert( pIdxKey->default_rc==1 |
| 71916 | 71987 | || pIdxKey->default_rc==0 |
| 71917 | 71988 | || pIdxKey->default_rc==-1 |
| 71918 | 71989 | ); |
| 71919 | 71990 | |
| 71991 | + |
| 71992 | + /* Check to see if we can skip a lot of work. Two cases: |
| 71993 | + ** |
| 71994 | + ** (1) If the cursor is already pointing to the very last cell |
| 71995 | + ** in the table and the pIdxKey search key is greater than or |
| 71996 | + ** equal to that last cell, then no movement is required. |
| 71997 | + ** |
| 71998 | + ** (2) If the cursor is on the last page of the table and the first |
| 71999 | + ** cell on that last page is less than or equal to the pIdxKey |
| 72000 | + ** search key, then we can start the search on the current page |
| 72001 | + ** without needing to go back to root. |
| 72002 | + */ |
| 72003 | + if( pCur->eState==CURSOR_VALID |
| 72004 | + && pCur->pPage->leaf |
| 72005 | + && cursorOnLastPage(pCur) |
| 72006 | + ){ |
| 72007 | + int c; |
| 72008 | + if( pCur->ix==pCur->pPage->nCell-1 |
| 72009 | + && (c = indexCellCompare(pCur, pCur->ix, pIdxKey, xRecordCompare))<=0 |
| 72010 | + ){ |
| 72011 | + *pRes = c; |
| 72012 | + return SQLITE_OK; /* Cursor already pointing at the correct spot */ |
| 72013 | + } |
| 72014 | + if( pCur->iPage>0 |
| 72015 | + && (c = indexCellCompare(pCur, 0, pIdxKey, xRecordCompare))<=0 |
| 72016 | + ){ |
| 72017 | + pCur->curFlags &= ~BTCF_ValidOvfl; |
| 72018 | + goto bypass_moveto_root; /* Start search on the current page */ |
| 72019 | + } |
| 72020 | + } |
| 72021 | + |
| 71920 | 72022 | rc = moveToRoot(pCur); |
| 71921 | 72023 | if( rc ){ |
| 71922 | 72024 | if( rc==SQLITE_EMPTY ){ |
| 71923 | 72025 | assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 ); |
| 71924 | 72026 | *pRes = -1; |
| 71925 | 72027 | return SQLITE_OK; |
| 71926 | 72028 | } |
| 71927 | 72029 | return rc; |
| 71928 | 72030 | } |
| 72031 | + |
| 72032 | +bypass_moveto_root: |
| 71929 | 72033 | assert( pCur->pPage ); |
| 71930 | 72034 | assert( pCur->pPage->isInit ); |
| 71931 | 72035 | assert( pCur->eState==CURSOR_VALID ); |
| 71932 | 72036 | assert( pCur->pPage->nCell > 0 ); |
| 71933 | | - assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey ); |
| 71934 | | - assert( pCur->curIntKey || pIdxKey ); |
| 72037 | + assert( pCur->curIntKey==0 ); |
| 72038 | + assert( pIdxKey!=0 ); |
| 71935 | 72039 | for(;;){ |
| 71936 | 72040 | int lwr, upr, idx, c; |
| 71937 | 72041 | Pgno chldPg; |
| 71938 | 72042 | MemPage *pPage = pCur->pPage; |
| 71939 | 72043 | u8 *pCell; /* Pointer to current cell in pPage */ |
| | @@ -71943,11 +72047,11 @@ |
| 71943 | 72047 | ** not run. If this is not the root-page, then the moveToChild() routine |
| 71944 | 72048 | ** would have already detected db corruption. Similarly, pPage must |
| 71945 | 72049 | ** be the right kind (index or table) of b-tree page. Otherwise |
| 71946 | 72050 | ** a moveToChild() or moveToRoot() call would have detected corruption. */ |
| 71947 | 72051 | assert( pPage->nCell>0 ); |
| 71948 | | - assert( pPage->intKey==(pIdxKey==0) ); |
| 72052 | + assert( pPage->intKey==0 ); |
| 71949 | 72053 | lwr = 0; |
| 71950 | 72054 | upr = pPage->nCell-1; |
| 71951 | 72055 | idx = upr>>1; /* idx = (lwr+upr)/2; */ |
| 71952 | 72056 | for(;;){ |
| 71953 | 72057 | int nCell; /* Size of the pCell cell in bytes */ |
| | @@ -75042,11 +75146,11 @@ |
| 75042 | 75146 | ** For an index btree (used for indexes and WITHOUT ROWID tables), the |
| 75043 | 75147 | ** key is an arbitrary byte sequence stored in pX.pKey,nKey. The |
| 75044 | 75148 | ** pX.pData,nData,nZero fields must be zero. |
| 75045 | 75149 | ** |
| 75046 | 75150 | ** If the seekResult parameter is non-zero, then a successful call to |
| 75047 | | -** MovetoUnpacked() to seek cursor pCur to (pKey,nKey) has already |
| 75151 | +** sqlite3BtreeIndexMoveto() to seek cursor pCur to (pKey,nKey) has already |
| 75048 | 75152 | ** been performed. In other words, if seekResult!=0 then the cursor |
| 75049 | 75153 | ** is currently pointing to a cell that will be adjacent to the cell |
| 75050 | 75154 | ** to be inserted. If seekResult<0 then pCur points to a cell that is |
| 75051 | 75155 | ** smaller then (pKey,nKey). If seekResult>0 then pCur points to a cell |
| 75052 | 75156 | ** that is larger than (pKey,nKey). |
| | @@ -75060,11 +75164,11 @@ |
| 75060 | 75164 | */ |
| 75061 | 75165 | SQLITE_PRIVATE int sqlite3BtreeInsert( |
| 75062 | 75166 | BtCursor *pCur, /* Insert data into the table of this cursor */ |
| 75063 | 75167 | const BtreePayload *pX, /* Content of the row to be inserted */ |
| 75064 | 75168 | int flags, /* True if this is likely an append */ |
| 75065 | | - int seekResult /* Result of prior MovetoUnpacked() call */ |
| 75169 | + int seekResult /* Result of prior IndexMoveto() call */ |
| 75066 | 75170 | ){ |
| 75067 | 75171 | int rc; |
| 75068 | 75172 | int loc = seekResult; /* -1: before desired location +1: after */ |
| 75069 | 75173 | int szNew = 0; |
| 75070 | 75174 | int idx; |
| | @@ -78471,10 +78575,18 @@ |
| 78471 | 78575 | assert( sqlite3VdbeCheckMemInvariants(p) ); |
| 78472 | 78576 | if( VdbeMemDynamic(p) || p->szMalloc ){ |
| 78473 | 78577 | vdbeMemClear(p); |
| 78474 | 78578 | } |
| 78475 | 78579 | } |
| 78580 | + |
| 78581 | +/* Like sqlite3VdbeMemRelease() but faster for cases where we |
| 78582 | +** know in advance that the Mem is not MEM_Dyn or MEM_Agg. |
| 78583 | +*/ |
| 78584 | +SQLITE_PRIVATE void sqlite3VdbeMemReleaseMalloc(Mem *p){ |
| 78585 | + assert( !VdbeMemDynamic(p) ); |
| 78586 | + if( p->szMalloc ) vdbeMemClear(p); |
| 78587 | +} |
| 78476 | 78588 | |
| 78477 | 78589 | /* |
| 78478 | 78590 | ** Convert a 64-bit IEEE double into a 64-bit signed integer. |
| 78479 | 78591 | ** If the double is out of range of a 64-bit signed integer then |
| 78480 | 78592 | ** return the closest available 64-bit signed integer. |
| | @@ -78833,10 +78945,11 @@ |
| 78833 | 78945 | void *pPtr, |
| 78834 | 78946 | const char *zPType, |
| 78835 | 78947 | void (*xDestructor)(void*) |
| 78836 | 78948 | ){ |
| 78837 | 78949 | assert( pMem->flags==MEM_Null ); |
| 78950 | + vdbeMemClear(pMem); |
| 78838 | 78951 | pMem->u.zPType = zPType ? zPType : ""; |
| 78839 | 78952 | pMem->z = pPtr; |
| 78840 | 78953 | pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term; |
| 78841 | 78954 | pMem->eSubtype = 'p'; |
| 78842 | 78955 | pMem->xDel = xDestructor ? xDestructor : sqlite3NoopDestructor; |
| | @@ -81728,11 +81841,16 @@ |
| 81728 | 81841 | }while( (--N)>0 ); |
| 81729 | 81842 | } |
| 81730 | 81843 | } |
| 81731 | 81844 | |
| 81732 | 81845 | /* |
| 81733 | | -** Release an array of N Mem elements |
| 81846 | +** Release auxiliary memory held in an array of N Mem elements. |
| 81847 | +** |
| 81848 | +** After this routine returns, all Mem elements in the array will still |
| 81849 | +** be valid. Those Mem elements that were not holding auxiliary resources |
| 81850 | +** will be unchanged. Mem elements which had something freed will be |
| 81851 | +** set to MEM_Undefined. |
| 81734 | 81852 | */ |
| 81735 | 81853 | static void releaseMemArray(Mem *p, int N){ |
| 81736 | 81854 | if( p && N ){ |
| 81737 | 81855 | Mem *pEnd = &p[N]; |
| 81738 | 81856 | sqlite3 *db = p->db; |
| | @@ -81761,16 +81879,21 @@ |
| 81761 | 81879 | testcase( p->flags & MEM_Agg ); |
| 81762 | 81880 | testcase( p->flags & MEM_Dyn ); |
| 81763 | 81881 | if( p->flags&(MEM_Agg|MEM_Dyn) ){ |
| 81764 | 81882 | testcase( (p->flags & MEM_Dyn)!=0 && p->xDel==sqlite3VdbeFrameMemDel ); |
| 81765 | 81883 | sqlite3VdbeMemRelease(p); |
| 81884 | + p->flags = MEM_Undefined; |
| 81766 | 81885 | }else if( p->szMalloc ){ |
| 81767 | 81886 | sqlite3DbFreeNN(db, p->zMalloc); |
| 81768 | 81887 | p->szMalloc = 0; |
| 81888 | + p->flags = MEM_Undefined; |
| 81769 | 81889 | } |
| 81770 | | - |
| 81771 | | - p->flags = MEM_Undefined; |
| 81890 | +#ifdef SQLITE_DEBUG |
| 81891 | + else{ |
| 81892 | + p->flags = MEM_Undefined; |
| 81893 | + } |
| 81894 | +#endif |
| 81772 | 81895 | }while( (++p)<pEnd ); |
| 81773 | 81896 | } |
| 81774 | 81897 | } |
| 81775 | 81898 | |
| 81776 | 81899 | #ifdef SQLITE_DEBUG |
| | @@ -84061,12 +84184,12 @@ |
| 84061 | 84184 | if( prcErr ) *prcErr = SQLITE_NOMEM_BKPT; |
| 84062 | 84185 | rc = 0; |
| 84063 | 84186 | }else{ |
| 84064 | 84187 | rc = pColl->xCmp(pColl->pUser, c1.n, v1, c2.n, v2); |
| 84065 | 84188 | } |
| 84066 | | - sqlite3VdbeMemRelease(&c1); |
| 84067 | | - sqlite3VdbeMemRelease(&c2); |
| 84189 | + sqlite3VdbeMemReleaseMalloc(&c1); |
| 84190 | + sqlite3VdbeMemReleaseMalloc(&c2); |
| 84068 | 84191 | return rc; |
| 84069 | 84192 | } |
| 84070 | 84193 | } |
| 84071 | 84194 | |
| 84072 | 84195 | /* |
| | @@ -84794,18 +84917,18 @@ |
| 84794 | 84917 | } |
| 84795 | 84918 | |
| 84796 | 84919 | /* Fetch the integer off the end of the index record */ |
| 84797 | 84920 | sqlite3VdbeSerialGet((u8*)&m.z[m.n-lenRowid], typeRowid, &v); |
| 84798 | 84921 | *rowid = v.u.i; |
| 84799 | | - sqlite3VdbeMemRelease(&m); |
| 84922 | + sqlite3VdbeMemReleaseMalloc(&m); |
| 84800 | 84923 | return SQLITE_OK; |
| 84801 | 84924 | |
| 84802 | 84925 | /* Jump here if database corruption is detected after m has been |
| 84803 | 84926 | ** allocated. Free the m object and return SQLITE_CORRUPT. */ |
| 84804 | 84927 | idx_rowid_corruption: |
| 84805 | 84928 | testcase( m.szMalloc!=0 ); |
| 84806 | | - sqlite3VdbeMemRelease(&m); |
| 84929 | + sqlite3VdbeMemReleaseMalloc(&m); |
| 84807 | 84930 | return SQLITE_CORRUPT_BKPT; |
| 84808 | 84931 | } |
| 84809 | 84932 | |
| 84810 | 84933 | /* |
| 84811 | 84934 | ** Compare the key of the index entry that cursor pC is pointing to against |
| | @@ -84843,11 +84966,11 @@ |
| 84843 | 84966 | rc = sqlite3VdbeMemFromBtreeZeroOffset(pCur, (u32)nCellKey, &m); |
| 84844 | 84967 | if( rc ){ |
| 84845 | 84968 | return rc; |
| 84846 | 84969 | } |
| 84847 | 84970 | *res = sqlite3VdbeRecordCompareWithSkip(m.n, m.z, pUnpacked, 0); |
| 84848 | | - sqlite3VdbeMemRelease(&m); |
| 84971 | + sqlite3VdbeMemReleaseMalloc(&m); |
| 84849 | 84972 | return SQLITE_OK; |
| 84850 | 84973 | } |
| 84851 | 84974 | |
| 84852 | 84975 | /* |
| 84853 | 84976 | ** This routine sets the value to be returned by subsequent calls to |
| | @@ -85010,11 +85133,11 @@ |
| 85010 | 85133 | static void vdbeFreeUnpacked(sqlite3 *db, int nField, UnpackedRecord *p){ |
| 85011 | 85134 | if( p ){ |
| 85012 | 85135 | int i; |
| 85013 | 85136 | for(i=0; i<nField; i++){ |
| 85014 | 85137 | Mem *pMem = &p->aMem[i]; |
| 85015 | | - if( pMem->zMalloc ) sqlite3VdbeMemRelease(pMem); |
| 85138 | + if( pMem->zMalloc ) sqlite3VdbeMemReleaseMalloc(pMem); |
| 85016 | 85139 | } |
| 85017 | 85140 | sqlite3DbFreeNN(db, p); |
| 85018 | 85141 | } |
| 85019 | 85142 | } |
| 85020 | 85143 | #endif /* SQLITE_ENABLE_PREUPDATE_HOOK */ |
| | @@ -88419,14 +88542,18 @@ |
| 88419 | 88542 | jump_to_p2: |
| 88420 | 88543 | pOp = &aOp[pOp->p2 - 1]; |
| 88421 | 88544 | break; |
| 88422 | 88545 | } |
| 88423 | 88546 | |
| 88424 | | -/* Opcode: Return P1 * * * * |
| 88547 | +/* Opcode: Return P1 * P3 * * |
| 88425 | 88548 | ** |
| 88426 | 88549 | ** Jump to the next instruction after the address in register P1. After |
| 88427 | 88550 | ** the jump, register P1 becomes undefined. |
| 88551 | +** |
| 88552 | +** P3 is not used by the byte-code engine. However, the code generator |
| 88553 | +** sets P3 to address of the associated OP_BeginSubrtn opcode, if there is |
| 88554 | +** one. |
| 88428 | 88555 | */ |
| 88429 | 88556 | case OP_Return: { /* in1 */ |
| 88430 | 88557 | pIn1 = &aMem[pOp->p1]; |
| 88431 | 88558 | assert( pIn1->flags==MEM_Int ); |
| 88432 | 88559 | pOp = &aOp[pIn1->u.i]; |
| | @@ -88610,15 +88737,26 @@ |
| 88610 | 88737 | rc = p->rc ? SQLITE_ERROR : SQLITE_DONE; |
| 88611 | 88738 | } |
| 88612 | 88739 | goto vdbe_return; |
| 88613 | 88740 | } |
| 88614 | 88741 | |
| 88742 | +/* Opcode: BeginSubrtn P1 P2 * * * |
| 88743 | +** Synopsis: r[P2]=P1 |
| 88744 | +** |
| 88745 | +** Mark the beginning of a subroutine by loading the integer value P1 |
| 88746 | +** into register r[P2]. The P2 register is used to store the return |
| 88747 | +** address of the subroutine call. |
| 88748 | +** |
| 88749 | +** This opcode is identical to OP_Integer. It has a different name |
| 88750 | +** only to make the byte code easier to read and verify. |
| 88751 | +*/ |
| 88615 | 88752 | /* Opcode: Integer P1 P2 * * * |
| 88616 | 88753 | ** Synopsis: r[P2]=P1 |
| 88617 | 88754 | ** |
| 88618 | 88755 | ** The 32-bit integer value P1 is written into register P2. |
| 88619 | 88756 | */ |
| 88757 | +case OP_BeginSubrtn: |
| 88620 | 88758 | case OP_Integer: { /* out2 */ |
| 88621 | 88759 | pOut = out2Prerelease(p, pOp); |
| 88622 | 88760 | pOut->u.i = pOp->p1; |
| 88623 | 88761 | break; |
| 88624 | 88762 | } |
| | @@ -90055,14 +90193,22 @@ |
| 90055 | 90193 | case OP_Offset: { /* out3 */ |
| 90056 | 90194 | VdbeCursor *pC; /* The VDBE cursor */ |
| 90057 | 90195 | assert( pOp->p1>=0 && pOp->p1<p->nCursor ); |
| 90058 | 90196 | pC = p->apCsr[pOp->p1]; |
| 90059 | 90197 | pOut = &p->aMem[pOp->p3]; |
| 90060 | | - if( NEVER(pC==0) || pC->eCurType!=CURTYPE_BTREE ){ |
| 90198 | + if( pC==0 || pC->eCurType!=CURTYPE_BTREE ){ |
| 90061 | 90199 | sqlite3VdbeMemSetNull(pOut); |
| 90062 | 90200 | }else{ |
| 90063 | | - sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor)); |
| 90201 | + if( pC->deferredMoveto ){ |
| 90202 | + rc = sqlite3VdbeFinishMoveto(pC); |
| 90203 | + if( rc ) goto abort_due_to_error; |
| 90204 | + } |
| 90205 | + if( sqlite3BtreeEof(pC->uc.pCursor) ){ |
| 90206 | + sqlite3VdbeMemSetNull(pOut); |
| 90207 | + }else{ |
| 90208 | + sqlite3VdbeMemSetInt64(pOut, sqlite3BtreeOffset(pC->uc.pCursor)); |
| 90209 | + } |
| 90064 | 90210 | } |
| 90065 | 90211 | break; |
| 90066 | 90212 | } |
| 90067 | 90213 | #endif /* SQLITE_ENABLE_OFFSET_SQL_FUNC */ |
| 90068 | 90214 | |
| | @@ -93773,11 +93919,11 @@ |
| 93773 | 93919 | } |
| 93774 | 93920 | sqlite3VdbeMemInit(&m, db, 0); |
| 93775 | 93921 | rc = sqlite3VdbeMemFromBtreeZeroOffset(pCur, (u32)nCellKey, &m); |
| 93776 | 93922 | if( rc ) goto abort_due_to_error; |
| 93777 | 93923 | res = sqlite3VdbeRecordCompareWithSkip(m.n, m.z, &r, 0); |
| 93778 | | - sqlite3VdbeMemRelease(&m); |
| 93924 | + sqlite3VdbeMemReleaseMalloc(&m); |
| 93779 | 93925 | } |
| 93780 | 93926 | /* End of inlined sqlite3VdbeIdxKeyCompare() */ |
| 93781 | 93927 | |
| 93782 | 93928 | assert( (OP_IdxLE&1)==(OP_IdxLT&1) && (OP_IdxGE&1)==(OP_IdxGT&1) ); |
| 93783 | 93929 | if( (pOp->opcode&1)==(OP_IdxLT&1) ){ |
| | @@ -105554,12 +105700,11 @@ |
| 105554 | 105700 | assert( !ExprUseYWin(pExpr) ); |
| 105555 | 105701 | ExprSetProperty(pExpr, EP_Subrtn); |
| 105556 | 105702 | assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); |
| 105557 | 105703 | pExpr->y.sub.regReturn = ++pParse->nMem; |
| 105558 | 105704 | pExpr->y.sub.iAddr = |
| 105559 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; |
| 105560 | | - VdbeComment((v, "return address")); |
| 105705 | + sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1; |
| 105561 | 105706 | |
| 105562 | 105707 | addrOnce = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v); |
| 105563 | 105708 | } |
| 105564 | 105709 | |
| 105565 | 105710 | /* Check to see if this is a vector IN operator */ |
| | @@ -105657,10 +105802,11 @@ |
| 105657 | 105802 | ** disable the test that was generated above that makes sure |
| 105658 | 105803 | ** this code only executes once. Because for a non-constant |
| 105659 | 105804 | ** expression we need to rerun this code each time. |
| 105660 | 105805 | */ |
| 105661 | 105806 | if( addrOnce && !sqlite3ExprIsConstant(pE2) ){ |
| 105807 | + sqlite3VdbeChangeToNoop(v, addrOnce-1); |
| 105662 | 105808 | sqlite3VdbeChangeToNoop(v, addrOnce); |
| 105663 | 105809 | ExprClearProperty(pExpr, EP_Subrtn); |
| 105664 | 105810 | addrOnce = 0; |
| 105665 | 105811 | } |
| 105666 | 105812 | |
| | @@ -105677,11 +105823,14 @@ |
| 105677 | 105823 | } |
| 105678 | 105824 | if( addrOnce ){ |
| 105679 | 105825 | sqlite3VdbeJumpHere(v, addrOnce); |
| 105680 | 105826 | /* Subroutine return */ |
| 105681 | 105827 | assert( ExprUseYSub(pExpr) ); |
| 105682 | | - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); |
| 105828 | + assert( sqlite3VdbeGetOp(v,pExpr->y.sub.iAddr-1)->opcode==OP_BeginSubrtn |
| 105829 | + || pParse->nErr ); |
| 105830 | + sqlite3VdbeAddOp3(v, OP_Return, pExpr->y.sub.regReturn, 0, |
| 105831 | + pExpr->y.sub.iAddr-1); |
| 105683 | 105832 | sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); |
| 105684 | 105833 | sqlite3ClearTempRegCache(pParse); |
| 105685 | 105834 | } |
| 105686 | 105835 | } |
| 105687 | 105836 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| | @@ -105732,13 +105881,11 @@ |
| 105732 | 105881 | assert( !ExprUseYWin(pExpr) ); |
| 105733 | 105882 | assert( !ExprHasProperty(pExpr, EP_Reduced|EP_TokenOnly) ); |
| 105734 | 105883 | ExprSetProperty(pExpr, EP_Subrtn); |
| 105735 | 105884 | pExpr->y.sub.regReturn = ++pParse->nMem; |
| 105736 | 105885 | pExpr->y.sub.iAddr = |
| 105737 | | - sqlite3VdbeAddOp2(v, OP_Integer, 0, pExpr->y.sub.regReturn) + 1; |
| 105738 | | - VdbeComment((v, "return address")); |
| 105739 | | - |
| 105886 | + sqlite3VdbeAddOp2(v, OP_BeginSubrtn, 0, pExpr->y.sub.regReturn) + 1; |
| 105740 | 105887 | |
| 105741 | 105888 | /* The evaluation of the EXISTS/SELECT must be repeated every time it |
| 105742 | 105889 | ** is encountered if any of the following is true: |
| 105743 | 105890 | ** |
| 105744 | 105891 | ** * The right-hand side is a correlated subquery |
| | @@ -105807,11 +105954,14 @@ |
| 105807 | 105954 | sqlite3VdbeJumpHere(v, addrOnce); |
| 105808 | 105955 | } |
| 105809 | 105956 | |
| 105810 | 105957 | /* Subroutine return */ |
| 105811 | 105958 | assert( ExprUseYSub(pExpr) ); |
| 105812 | | - sqlite3VdbeAddOp1(v, OP_Return, pExpr->y.sub.regReturn); |
| 105959 | + assert( sqlite3VdbeGetOp(v,pExpr->y.sub.iAddr-1)->opcode==OP_BeginSubrtn |
| 105960 | + || pParse->nErr ); |
| 105961 | + sqlite3VdbeAddOp3(v, OP_Return, pExpr->y.sub.regReturn, 0, |
| 105962 | + pExpr->y.sub.iAddr-1); |
| 105813 | 105963 | sqlite3VdbeChangeP1(v, pExpr->y.sub.iAddr-1, sqlite3VdbeCurrentAddr(v)-1); |
| 105814 | 105964 | sqlite3ClearTempRegCache(pParse); |
| 105815 | 105965 | return rReg; |
| 105816 | 105966 | } |
| 105817 | 105967 | #endif /* SQLITE_OMIT_SUBQUERY */ |
| | @@ -123338,12 +123488,12 @@ |
| 123338 | 123488 | #endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ |
| 123339 | 123489 | INLINE_FUNC(unlikely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 123340 | 123490 | INLINE_FUNC(likelihood, 2, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 123341 | 123491 | INLINE_FUNC(likely, 1, INLINEFUNC_unlikely, SQLITE_FUNC_UNLIKELY), |
| 123342 | 123492 | #ifdef SQLITE_ENABLE_OFFSET_SQL_FUNC |
| 123343 | | - FUNCTION2(sqlite_offset, 1, 0, 0, noopFunc, SQLITE_FUNC_OFFSET| |
| 123344 | | - SQLITE_FUNC_TYPEOF), |
| 123493 | + {1, SQLITE_FUNC_BUILTIN|SQLITE_UTF8|SQLITE_FUNC_OFFSET|SQLITE_FUNC_TYPEOF, |
| 123494 | + 0, 0, noopFunc, 0, 0, 0, "sqlite_offset", {0} }, |
| 123345 | 123495 | #endif |
| 123346 | 123496 | FUNCTION(ltrim, 1, 1, 0, trimFunc ), |
| 123347 | 123497 | FUNCTION(ltrim, 2, 1, 0, trimFunc ), |
| 123348 | 123498 | FUNCTION(rtrim, 1, 2, 0, trimFunc ), |
| 123349 | 123499 | FUNCTION(rtrim, 2, 2, 0, trimFunc ), |
| | @@ -142452,10 +142602,11 @@ |
| 142452 | 142602 | const char *zEnd /* End of SQL text */ |
| 142453 | 142603 | ){ |
| 142454 | 142604 | sqlite3 *db = pParse->db; |
| 142455 | 142605 | TriggerStep *pTriggerStep; |
| 142456 | 142606 | |
| 142607 | + if( pParse->nErr ) return 0; |
| 142457 | 142608 | pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n + 1); |
| 142458 | 142609 | if( pTriggerStep ){ |
| 142459 | 142610 | char *z = (char*)&pTriggerStep[1]; |
| 142460 | 142611 | memcpy(z, pName->z, pName->n); |
| 142461 | 142612 | sqlite3Dequote(z); |
| | @@ -148265,10 +148416,11 @@ |
| 148265 | 148416 | sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur); |
| 148266 | 148417 | VdbeCoverageIf(v, bRev==0); |
| 148267 | 148418 | VdbeCoverageIf(v, bRev!=0); |
| 148268 | 148419 | VdbeComment((v, "begin skip-scan on %s", pIdx->zName)); |
| 148269 | 148420 | j = sqlite3VdbeAddOp0(v, OP_Goto); |
| 148421 | + assert( pLevel->addrSkip==0 ); |
| 148270 | 148422 | pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLT:OP_SeekGT), |
| 148271 | 148423 | iIdxCur, 0, regBase, nSkip); |
| 148272 | 148424 | VdbeCoverageIf(v, bRev==0); |
| 148273 | 148425 | VdbeCoverageIf(v, bRev!=0); |
| 148274 | 148426 | sqlite3VdbeJumpHere(v, j); |
| | @@ -148870,10 +149022,11 @@ |
| 148870 | 149022 | ){ |
| 148871 | 149023 | while( ++iLevel < pWInfo->nLevel ){ |
| 148872 | 149024 | WhereLevel *pLevel = &pWInfo->a[iLevel]; |
| 148873 | 149025 | WhereLoop *pLoop = pLevel->pWLoop; |
| 148874 | 149026 | if( pLevel->regFilter==0 ) continue; |
| 149027 | + if( pLevel->pWLoop->nSkip ) continue; |
| 148875 | 149028 | /* ,--- Because sqlite3ConstructBloomFilter() has will not have set |
| 148876 | 149029 | ** vvvvv--' pLevel->regFilter if this were true. */ |
| 148877 | 149030 | if( NEVER(pLoop->prereq & notReady) ) continue; |
| 148878 | 149031 | if( pLoop->wsFlags & WHERE_IPK ){ |
| 148879 | 149032 | WhereTerm *pTerm = pLoop->aLTerm[0]; |
| | @@ -149004,11 +149157,10 @@ |
| 149004 | 149157 | ** to access the data. |
| 149005 | 149158 | */ |
| 149006 | 149159 | int iReg; /* P3 Value for OP_VFilter */ |
| 149007 | 149160 | int addrNotFound; |
| 149008 | 149161 | int nConstraint = pLoop->nLTerm; |
| 149009 | | - int iIn; /* Counter for IN constraints */ |
| 149010 | 149162 | |
| 149011 | 149163 | iReg = sqlite3GetTempRange(pParse, nConstraint+2); |
| 149012 | 149164 | addrNotFound = pLevel->addrBrk; |
| 149013 | 149165 | for(j=0; j<nConstraint; j++){ |
| 149014 | 149166 | int iTarget = iReg+j+2; |
| | @@ -149050,67 +149202,71 @@ |
| 149050 | 149202 | if( db->mallocFailed ) pLoop->u.vtab.idxStr = 0; |
| 149051 | 149203 | pLevel->p1 = iCur; |
| 149052 | 149204 | pLevel->op = pWInfo->eOnePass ? OP_Noop : OP_VNext; |
| 149053 | 149205 | pLevel->p2 = sqlite3VdbeCurrentAddr(v); |
| 149054 | 149206 | assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); |
| 149055 | | - if( pLoop->wsFlags & WHERE_IN_ABLE ){ |
| 149056 | | - iIn = pLevel->u.in.nIn; |
| 149057 | | - }else{ |
| 149058 | | - iIn = 0; |
| 149059 | | - } |
| 149060 | | - for(j=nConstraint-1; j>=0; j--){ |
| 149061 | | - int bIn; /* True to generate byte code to loop over RHS IN values */ |
| 149207 | + |
| 149208 | + for(j=0; j<nConstraint; j++){ |
| 149062 | 149209 | pTerm = pLoop->aLTerm[j]; |
| 149210 | + if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ |
| 149211 | + disableTerm(pLevel, pTerm); |
| 149212 | + continue; |
| 149213 | + } |
| 149063 | 149214 | if( (pTerm->eOperator & WO_IN)!=0 |
| 149064 | 149215 | && (SMASKBIT32(j) & pLoop->u.vtab.mHandleIn)==0 |
| 149216 | + && !db->mallocFailed |
| 149065 | 149217 | ){ |
| 149066 | | - bIn = 1; |
| 149067 | | - }else{ |
| 149068 | | - bIn = 0; |
| 149069 | | - } |
| 149070 | | - if( bIn ) iIn--; |
| 149071 | | - if( j<16 && (pLoop->u.vtab.omitMask>>j)&1 ){ |
| 149072 | | - disableTerm(pLevel, pTerm); |
| 149073 | | - }else if( bIn && sqlite3ExprVectorSize(pTerm->pExpr->pLeft)==1 ){ |
| 149074 | 149218 | Expr *pCompare; /* The comparison operator */ |
| 149075 | 149219 | Expr *pRight; /* RHS of the comparison */ |
| 149076 | 149220 | VdbeOp *pOp; /* Opcode to access the value of the IN constraint */ |
| 149221 | + int iIn; /* IN loop corresponding to the j-th constraint */ |
| 149077 | 149222 | |
| 149078 | 149223 | /* Reload the constraint value into reg[iReg+j+2]. The same value |
| 149079 | 149224 | ** was loaded into the same register prior to the OP_VFilter, but |
| 149080 | 149225 | ** the xFilter implementation might have changed the datatype or |
| 149081 | | - ** encoding of the value in the register, so it *must* be reloaded. */ |
| 149082 | | - assert( pLevel->u.in.aInLoop!=0 || db->mallocFailed ); |
| 149083 | | - if( !db->mallocFailed ){ |
| 149084 | | - assert( iIn>=0 && iIn<pLevel->u.in.nIn ); |
| 149226 | + ** encoding of the value in the register, so it *must* be reloaded. |
| 149227 | + */ |
| 149228 | + for(iIn=0; ALWAYS(iIn<pLevel->u.in.nIn); iIn++){ |
| 149085 | 149229 | pOp = sqlite3VdbeGetOp(v, pLevel->u.in.aInLoop[iIn].addrInTop); |
| 149086 | | - assert( pOp->opcode==OP_Column || pOp->opcode==OP_Rowid ); |
| 149087 | | - assert( pOp->opcode!=OP_Column || pOp->p3==iReg+j+2 ); |
| 149088 | | - assert( pOp->opcode!=OP_Rowid || pOp->p2==iReg+j+2 ); |
| 149089 | | - testcase( pOp->opcode==OP_Rowid ); |
| 149090 | | - sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); |
| 149230 | + if( (pOp->opcode==OP_Column && pOp->p3==iReg+j+2) |
| 149231 | + || (pOp->opcode==OP_Rowid && pOp->p2==iReg+j+2) |
| 149232 | + ){ |
| 149233 | + testcase( pOp->opcode==OP_Rowid ); |
| 149234 | + sqlite3VdbeAddOp3(v, pOp->opcode, pOp->p1, pOp->p2, pOp->p3); |
| 149235 | + break; |
| 149236 | + } |
| 149091 | 149237 | } |
| 149092 | 149238 | |
| 149093 | 149239 | /* Generate code that will continue to the next row if |
| 149094 | | - ** the IN constraint is not satisfied */ |
| 149240 | + ** the IN constraint is not satisfied |
| 149241 | + */ |
| 149095 | 149242 | pCompare = sqlite3PExpr(pParse, TK_EQ, 0, 0); |
| 149096 | | - assert( pCompare!=0 || db->mallocFailed ); |
| 149097 | | - if( pCompare ){ |
| 149098 | | - pCompare->pLeft = pTerm->pExpr->pLeft; |
| 149243 | + if( !db->mallocFailed ){ |
| 149244 | + int iFld = pTerm->u.x.iField; |
| 149245 | + Expr *pLeft = pTerm->pExpr->pLeft; |
| 149246 | + assert( pLeft!=0 ); |
| 149247 | + if( iFld>0 ){ |
| 149248 | + assert( pLeft->op==TK_VECTOR ); |
| 149249 | + assert( ExprUseXList(pLeft) ); |
| 149250 | + assert( iFld<=pLeft->x.pList->nExpr ); |
| 149251 | + pCompare->pLeft = pLeft->x.pList->a[iFld-1].pExpr; |
| 149252 | + }else{ |
| 149253 | + pCompare->pLeft = pLeft; |
| 149254 | + } |
| 149099 | 149255 | pCompare->pRight = pRight = sqlite3Expr(db, TK_REGISTER, 0); |
| 149100 | 149256 | if( pRight ){ |
| 149101 | 149257 | pRight->iTable = iReg+j+2; |
| 149102 | 149258 | sqlite3ExprIfFalse( |
| 149103 | 149259 | pParse, pCompare, pLevel->addrCont, SQLITE_JUMPIFNULL |
| 149104 | 149260 | ); |
| 149105 | 149261 | } |
| 149106 | 149262 | pCompare->pLeft = 0; |
| 149107 | | - sqlite3ExprDelete(db, pCompare); |
| 149108 | 149263 | } |
| 149264 | + sqlite3ExprDelete(db, pCompare); |
| 149109 | 149265 | } |
| 149110 | 149266 | } |
| 149111 | | - assert( iIn==0 || db->mallocFailed ); |
| 149267 | + |
| 149112 | 149268 | /* These registers need to be preserved in case there is an IN operator |
| 149113 | 149269 | ** loop. So we could deallocate the registers here (and potentially |
| 149114 | 149270 | ** reuse them later) if (pLoop->wsFlags & WHERE_IN_ABLE)==0. But it seems |
| 149115 | 149271 | ** simpler and safer to simply not reuse the registers. |
| 149116 | 149272 | ** |
| | @@ -149816,10 +149972,18 @@ |
| 149816 | 149972 | ** 2022-02-04: Do not push down slices of a row-value comparison. |
| 149817 | 149973 | ** In other words, "w" or "y" may not be a slice of a vector. Otherwise, |
| 149818 | 149974 | ** the initialization of the right-hand operand of the vector comparison |
| 149819 | 149975 | ** might not occur, or might occur only in an OR branch that is not |
| 149820 | 149976 | ** taken. dbsqlfuzz 80a9fade844b4fb43564efc972bcb2c68270f5d1. |
| 149977 | + ** |
| 149978 | + ** 2022-03-03: Do not push down expressions that involve subqueries. |
| 149979 | + ** The subquery might get coded as a subroutine. Any table-references |
| 149980 | + ** in the subquery might be resolved to index-references for the index on |
| 149981 | + ** the OR branch in which the subroutine is coded. But if the subroutine |
| 149982 | + ** is invoked from a different OR branch that uses a different index, such |
| 149983 | + ** index-references will not work. tag-20220303a |
| 149984 | + ** https://sqlite.org/forum/forumpost/36937b197273d403 |
| 149821 | 149985 | */ |
| 149822 | 149986 | if( pWC->nTerm>1 ){ |
| 149823 | 149987 | int iTerm; |
| 149824 | 149988 | for(iTerm=0; iTerm<pWC->nTerm; iTerm++){ |
| 149825 | 149989 | Expr *pExpr = pWC->a[iTerm].pExpr; |
| | @@ -149829,11 +149993,11 @@ |
| 149829 | 149993 | testcase( pWC->a[iTerm].wtFlags & TERM_SLICE ); |
| 149830 | 149994 | if( (pWC->a[iTerm].wtFlags & (TERM_VIRTUAL|TERM_CODED|TERM_SLICE))!=0 ){ |
| 149831 | 149995 | continue; |
| 149832 | 149996 | } |
| 149833 | 149997 | if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; |
| 149834 | | - testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); |
| 149998 | + if( ExprHasProperty(pExpr, EP_Subquery) ) continue; /* tag-20220303a */ |
| 149835 | 149999 | pExpr = sqlite3ExprDup(db, pExpr, 0); |
| 149836 | 150000 | pAndExpr = sqlite3ExprAnd(pParse, pAndExpr, pExpr); |
| 149837 | 150001 | } |
| 149838 | 150002 | if( pAndExpr ){ |
| 149839 | 150003 | /* The extra 0x10000 bit on the opcode is masked off and does not |
| | @@ -153106,11 +153270,14 @@ |
| 153106 | 153270 | VdbeCoverage(v); |
| 153107 | 153271 | sqlite3VdbeJumpHere(v, addrTop); |
| 153108 | 153272 | pLoop->wsFlags &= ~WHERE_BLOOMFILTER; |
| 153109 | 153273 | if( OptimizationDisabled(pParse->db, SQLITE_BloomPulldown) ) break; |
| 153110 | 153274 | while( ++iLevel < pWInfo->nLevel ){ |
| 153275 | + const SrcItem *pTabItem; |
| 153111 | 153276 | pLevel = &pWInfo->a[iLevel]; |
| 153277 | + pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; |
| 153278 | + if( pTabItem->fg.jointype & JT_LEFT ) continue; |
| 153112 | 153279 | pLoop = pLevel->pWLoop; |
| 153113 | 153280 | if( NEVER(pLoop==0) ) continue; |
| 153114 | 153281 | if( pLoop->prereq & notReady ) continue; |
| 153115 | 153282 | if( (pLoop->wsFlags & (WHERE_BLOOMFILTER|WHERE_COLUMN_IN)) |
| 153116 | 153283 | ==WHERE_BLOOMFILTER |
| | @@ -234388,11 +234555,11 @@ |
| 234388 | 234555 | int nArg, /* Number of args */ |
| 234389 | 234556 | sqlite3_value **apUnused /* Function arguments */ |
| 234390 | 234557 | ){ |
| 234391 | 234558 | assert( nArg==0 ); |
| 234392 | 234559 | UNUSED_PARAM2(nArg, apUnused); |
| 234393 | | - sqlite3_result_text(pCtx, "fts5: 2022-03-02 01:02:16 6497997aa80419688890ed5dbbb7d6acc26bf3732305ff4a728cba1fe4d1626b", -1, SQLITE_TRANSIENT); |
| 234560 | + sqlite3_result_text(pCtx, "fts5: 2022-03-07 18:32:08 ae464a18d74bf44fc95bc335e75e6a57dc974f6d6a3d603133594039fb589af2", -1, SQLITE_TRANSIENT); |
| 234394 | 234561 | } |
| 234395 | 234562 | |
| 234396 | 234563 | /* |
| 234397 | 234564 | ** Return true if zName is the extension on one of the shadow tables used |
| 234398 | 234565 | ** by this module. |
| 234399 | 234566 | |