Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the names of the PushList and PopList opcodes to ListPush and ListPop so that they will appear together with the other List opcodes in the documentation. (CVS 583) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
c53b0b9283c5c34def87d58b03fd979d |
User & Date: | drh 2002-05-23 22:07:03.000 |
Context
2002-05-24
| ||
02:04 | Split the IdList structure into IdList and SrcList. SrcList is used to represent a FROM clause and IdList is used for everything else. This change allows SrcList to grow to support outer joins without burdening the other uses of IdList. (CVS 584) (check-in: a167b71d8c user: drh tags: trunk) | |
2002-05-23
| ||
22:07 | Change the names of the PushList and PopList opcodes to ListPush and ListPop so that they will appear together with the other List opcodes in the documentation. (CVS 583) (check-in: c53b0b9283 user: drh tags: trunk) | |
13:15 | Fix for ticket #50. (CVS 582) (check-in: 82b74a494a user: drh tags: trunk) | |
Changes
Changes to src/trigger.c.
︙ | ︙ | |||
475 476 477 478 479 480 481 | sqliteSelect(pParse, pTriggerStep->pSelect, SRT_Union, tmp_tbl, 0, 0, 0); sqliteVdbeAddOp(pParse->pVdbe, OP_Close, tmp_tbl, 0); pParse->nTab--; break; } case TK_UPDATE: { | | | | | | 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | sqliteSelect(pParse, pTriggerStep->pSelect, SRT_Union, tmp_tbl, 0, 0, 0); sqliteVdbeAddOp(pParse->pVdbe, OP_Close, tmp_tbl, 0); pParse->nTab--; break; } case TK_UPDATE: { sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0); sqliteUpdate(pParse, &pTriggerStep->target, sqliteExprListDup(pTriggerStep->pExprList), sqliteExprDup(pTriggerStep->pWhere), orconf); sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0); break; } case TK_INSERT: { sqliteInsert(pParse, &pTriggerStep->target, sqliteExprListDup(pTriggerStep->pExprList), sqliteSelectDup(pTriggerStep->pSelect), sqliteIdListDup(pTriggerStep->pIdList), orconf); break; } case TK_DELETE: { sqliteVdbeAddOp(pParse->pVdbe, OP_ListPush, 0, 0); sqliteDeleteFrom(pParse, &pTriggerStep->target, sqliteExprDup(pTriggerStep->pWhere)); sqliteVdbeAddOp(pParse->pVdbe, OP_ListPop, 0, 0); break; } default: assert(0); } pParse->nTab = saveNTab; pTriggerStep = pTriggerStep->pNext; |
︙ | ︙ |
Changes to src/update.c.
︙ | ︙ | |||
8 9 10 11 12 13 14 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. ** | | | 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** This file contains C code routines that are called by the parser ** to handle UPDATE statements. ** ** $Id: update.c,v 1.42 2002/05/23 22:07:03 drh Exp $ */ #include "sqliteInt.h" /* ** Process an UPDATE statement. */ void sqliteUpdate( |
︙ | ︙ | |||
278 279 280 281 282 283 284 | /* Loop over every record that needs updating. We have to load ** the old data for each record to be updated because some columns ** might not change and we will need to copy the old value. ** Also, the old data is needed to delete the old index entires. ** So make the cursor point at the old record. */ if( !row_triggers_exist ){ | < | 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | /* Loop over every record that needs updating. We have to load ** the old data for each record to be updated because some columns ** might not change and we will need to copy the old value. ** Also, the old data is needed to delete the old index entires. ** So make the cursor point at the old record. */ if( !row_triggers_exist ){ sqliteVdbeAddOp(v, OP_ListRewind, 0, 0); addr = sqliteVdbeAddOp(v, OP_ListRead, 0, 0); sqliteVdbeAddOp(v, OP_Dup, 0, 0); } sqliteVdbeAddOp(v, OP_NotExists, base, addr); /* If the record number will change, push the record number as it |
︙ | ︙ |
Changes to src/vdbe.c.
︙ | ︙ | |||
26 27 28 29 30 31 32 | ** type to the other occurs as necessary. ** ** Most of the code in this file is taken up by the sqliteVdbeExec() ** function which does the work of interpreting a VDBE program. ** But other routines are also provided to help in building up ** a program instruction by instruction. ** | | | 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | ** type to the other occurs as necessary. ** ** Most of the code in this file is taken up by the sqliteVdbeExec() ** function which does the work of interpreting a VDBE program. ** But other routines are also provided to help in building up ** a program instruction by instruction. ** ** $Id: vdbe.c,v 1.146 2002/05/23 22:07:03 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> /* ** The following global variable is incremented every time a cursor ** moves, either by the OP_MoveTo or the OP_Next opcode. The test |
︙ | ︙ | |||
246 247 248 249 250 251 252 | Agg agg; /* Aggregate information */ int nSet; /* Number of sets allocated */ Set *aSet; /* An array of sets */ int nCallback; /* Number of callbacks invoked so far */ int iLimit; /* Limit on the number of callbacks remaining */ int iOffset; /* Offset before beginning to do callbacks */ int keylistStackDepth; /* The size of the "keylist" stack */ | | | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 | Agg agg; /* Aggregate information */ int nSet; /* Number of sets allocated */ Set *aSet; /* An array of sets */ int nCallback; /* Number of callbacks invoked so far */ int iLimit; /* Limit on the number of callbacks remaining */ int iOffset; /* Offset before beginning to do callbacks */ int keylistStackDepth; /* The size of the "keylist" stack */ Keylist **keylistStack; /* The stack used by opcodes ListPush & ListPop */ }; /* ** Create a new virtual database engine. */ Vdbe *sqliteVdbeCreate(sqlite *db){ Vdbe *p; |
︙ | ︙ | |||
1056 1057 1058 1059 1060 1061 1062 | "PutStrKey", "Distinct", "Found", "NotFound", "IsUnique", "NotExists", "Delete", "Column", "KeyAsData", "Recno", "FullKey", "NullRow", "Last", "Rewind", "Next", "Destroy", "Clear", "CreateIndex", "CreateTable", "IntegrityCk", "IdxPut", "IdxDelete", "IdxRecno", "IdxGT", "IdxGE", "MemLoad", "MemStore", "ListWrite", | | > | | | | | | 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 | "PutStrKey", "Distinct", "Found", "NotFound", "IsUnique", "NotExists", "Delete", "Column", "KeyAsData", "Recno", "FullKey", "NullRow", "Last", "Rewind", "Next", "Destroy", "Clear", "CreateIndex", "CreateTable", "IntegrityCk", "IdxPut", "IdxDelete", "IdxRecno", "IdxGT", "IdxGE", "MemLoad", "MemStore", "ListWrite", "ListRewind", "ListRead", "ListReset", "ListPush", "ListPop", "SortPut", "SortMakeRec", "SortMakeKey", "Sort", "SortNext", "SortCallback", "SortReset", "FileOpen", "FileRead", "FileColumn", "AggReset", "AggFocus", "AggNext", "AggSet", "AggGet", "AggFunc", "AggInit", "AggPush", "AggPop", "SetInsert", "SetFound", "SetNotFound", "MakeRecord", "MakeKey", "MakeIdxKey", "IncrKey", "Goto", "If", "Halt", "ColumnCount", "ColumnName", "Callback", "NullCallback", "Integer", "String", "Pop", "Dup", "Pull", "Push", "MustBeInt", "Add", "AddImm", "Subtract", "Multiply", "Divide", "Remainder", "BitAnd", "BitOr", "BitNot", "ShiftLeft", "ShiftRight", "AbsValue", "Eq", "Ne", "Lt", "Le", "Gt", "Ge", "IsNull", "NotNull", "Negative", "And", "Or", "Not", "Concat", "Noop", "Function", "Limit", }; /* ** Given the name of an opcode, return its number. Return 0 if ** there is no match. ** ** This routine is used for testing and debugging. |
︙ | ︙ | |||
3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 | case OP_ListReset: { if( p->pList ){ KeylistFree(p->pList); p->pList = 0; } break; } /* Opcode: SortPut * * * ** ** The TOS is the key and the NOS is the data. Pop both from the stack ** and put them on the sorter. The key and data should have been ** made using SortMakeKey and SortMakeRec, respectively. */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 | case OP_ListReset: { if( p->pList ){ KeylistFree(p->pList); p->pList = 0; } break; } /* Opcode: ListPush * * * ** ** Save the current Vdbe list such that it can be restored by a PopList ** opcode. The list is empty after this is executed. */ case OP_ListPush: { p->keylistStackDepth++; assert(p->keylistStackDepth > 0); p->keylistStack = sqliteRealloc(p->keylistStack, sizeof(Keylist *) * p->keylistStackDepth); p->keylistStack[p->keylistStackDepth - 1] = p->pList; p->pList = 0; break; } /* Opcode: ListPop * * * ** ** Restore the Vdbe list to the state it was in when PushList was last ** executed. */ case OP_ListPop: { assert(p->keylistStackDepth > 0); p->keylistStackDepth--; KeylistFree(p->pList); p->pList = p->keylistStack[p->keylistStackDepth]; p->keylistStack[p->keylistStackDepth] = 0; if( p->keylistStackDepth == 0 ){ sqliteFree(p->keylistStack); p->keylistStack = 0; } break; } /* Opcode: SortPut * * * ** ** The TOS is the key and the NOS is the data. Pop both from the stack ** and put them on the sorter. The key and data should have been ** made using SortMakeKey and SortMakeRec, respectively. */ |
︙ | ︙ | |||
4547 4548 4549 4550 4551 4552 4553 | VERIFY( if( tos<0 ) goto not_enough_stack; ) if( Stringify(p, tos) ) goto no_mem; if( VERIFY( i>=0 && i<p->nSet &&) sqliteHashFind(&p->aSet[i].hash, zStack[tos], aStack[tos].n)){ pc = pOp->p2 - 1; } POPSTACK; | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 | VERIFY( if( tos<0 ) goto not_enough_stack; ) if( Stringify(p, tos) ) goto no_mem; if( VERIFY( i>=0 && i<p->nSet &&) sqliteHashFind(&p->aSet[i].hash, zStack[tos], aStack[tos].n)){ pc = pOp->p2 - 1; } POPSTACK; break; } /* Opcode: SetNotFound P1 P2 * ** ** Pop the stack once and compare the value popped off with the ** contents of set P1. If the element popped does not exists in |
︙ | ︙ |
Changes to src/vdbe.h.
︙ | ︙ | |||
11 12 13 14 15 16 17 | ************************************************************************* ** Header file for the Virtual DataBase Engine (VDBE) ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** | | | 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ************************************************************************* ** Header file for the Virtual DataBase Engine (VDBE) ** ** This header defines the interface to the virtual database engine ** or VDBE. The VDBE implements an abstract machine that runs a ** simple program to access and modify the underlying database. ** ** $Id: vdbe.h,v 1.52 2002/05/23 22:07:03 drh Exp $ */ #ifndef _SQLITE_VDBE_H_ #define _SQLITE_VDBE_H_ #include <stdio.h> /* ** A single VDBE is an opaque structure named "Vdbe". Only routines |
︙ | ︙ | |||
117 118 119 120 121 122 123 124 | #define OP_MemLoad 42 #define OP_MemStore 43 #define OP_ListWrite 44 #define OP_ListRewind 45 #define OP_ListRead 46 #define OP_ListReset 47 | > > | | | | | | | | | | | | | | | | | > > | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | < < | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | #define OP_MemLoad 42 #define OP_MemStore 43 #define OP_ListWrite 44 #define OP_ListRewind 45 #define OP_ListRead 46 #define OP_ListReset 47 #define OP_ListPush 48 #define OP_ListPop 49 #define OP_SortPut 50 #define OP_SortMakeRec 51 #define OP_SortMakeKey 52 #define OP_Sort 53 #define OP_SortNext 54 #define OP_SortCallback 55 #define OP_SortReset 56 #define OP_FileOpen 57 #define OP_FileRead 58 #define OP_FileColumn 59 #define OP_AggReset 60 #define OP_AggFocus 61 #define OP_AggNext 62 #define OP_AggSet 63 #define OP_AggGet 64 #define OP_AggFunc 65 #define OP_AggInit 66 #define OP_AggPush 67 #define OP_AggPop 68 #define OP_SetInsert 69 #define OP_SetFound 70 #define OP_SetNotFound 71 #define OP_MakeRecord 72 #define OP_MakeKey 73 #define OP_MakeIdxKey 74 #define OP_IncrKey 75 #define OP_Goto 76 #define OP_If 77 #define OP_Halt 78 #define OP_ColumnCount 79 #define OP_ColumnName 80 #define OP_Callback 81 #define OP_NullCallback 82 #define OP_Integer 83 #define OP_String 84 #define OP_Pop 85 #define OP_Dup 86 #define OP_Pull 87 #define OP_Push 88 #define OP_MustBeInt 89 #define OP_Add 90 #define OP_AddImm 91 #define OP_Subtract 92 #define OP_Multiply 93 #define OP_Divide 94 #define OP_Remainder 95 #define OP_BitAnd 96 #define OP_BitOr 97 #define OP_BitNot 98 #define OP_ShiftLeft 99 #define OP_ShiftRight 100 #define OP_AbsValue 101 #define OP_Eq 102 #define OP_Ne 103 #define OP_Lt 104 #define OP_Le 105 #define OP_Gt 106 #define OP_Ge 107 #define OP_IsNull 108 #define OP_NotNull 109 #define OP_Negative 110 #define OP_And 111 #define OP_Or 112 #define OP_Not 113 #define OP_Concat 114 #define OP_Noop 115 #define OP_Function 116 #define OP_Limit 117 #define OP_MAX 117 /* ** Prototypes for the VDBE interface. See comments on the implementation ** for a description of what each of these routines does. */ Vdbe *sqliteVdbeCreate(sqlite*); void sqliteVdbeCreateCallback(Vdbe*, int*); |
︙ | ︙ |