diff --git a/manifest b/manifest index ae0f2dfd13..c17c7ff5a1 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Modify\san\sassert()\sstatement\sto\sfix\s#3473.\sNo\sother\scode\schanges.\s(CVS\s5856) -D 2008-11-03T09:39:45 +C Change\sthe\sname\sof\sthe\sCursor\sobject\sto\sVdbeCursor.\s(CVS\s5857) +D 2008-11-03T20:55:07 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in da817da72422f9b876602c225fcd17d6ca4182f7 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -94,15 +94,15 @@ F sqlite3.1 6be1ad09113570e1fc8dcaff84c9b0b337db5ffc F sqlite3.def a1be7b9a4b8b51ac41c6ff6e8e44a14ef66b338b F sqlite3.pc.in ae6f59a76e862f5c561eb32a380228a02afc3cad F src/alter.c a03c9236476f0469eb830bcd16ac30b695e09b83 -F src/analyze.c 747ce8cb6b318bb0d0576cfb5277aed98cbbeb5c +F src/analyze.c 91b958435cbb423721ef2a841dbc459c1959bb3a F src/attach.c 208881c87160d9e2c73a46cf86116c5a6d66f9d7 F src/auth.c c8b2ab5c8bad4bd90ed7c294694f48269162c627 -F src/bitvec.c 95c86bd18d8fedf0533f5af196192546e10a7e7d +F src/bitvec.c bb0b12b258496ad1903732db55219dc46571fe09 F src/btmutex.c 3a90096c3080b9057dc570b8e16e46511e1c788a -F src/btree.c 5d72b67ee20afba92e95827fc9fc599d917f7f68 +F src/btree.c 4320c62609de61a64231e8dcfe857966120844cc F src/btree.h 179c3ea813780df78a289a8f5130db18e6d4616e F src/btreeInt.h e38e9b2b285f40f5bc0a6664f630d4a141622f16 -F src/build.c d6d55f97abcb6f17ac3e9e7a1dd8c0db67db34fd +F src/build.c 41464eb891eb3672b30a5188a352187cba038af9 F src/callback.c e970e5beddbdb23f89a6d05cb1a6419d9f755624 F src/complete.c cb14e06dbe79dee031031f0d9e686ff306afe07c F src/date.c 6f4277fa56d8c1b8e70c0bde838c9e99609f5ec0 @@ -114,7 +114,7 @@ F src/global.c 20a3fe46c8287a01ba3a7442558f0eb70c66b19a F src/hash.c 582c00618efe2051785e66ba1b6430d5a129de3f F src/hash.h 28f38ebb1006a5beedcb013bcdfe31befe7437ae F src/hwtime.h 4a1d45f4cae1f402ea19686acf24acf4f0cb53cb -F src/insert.c 1858f297892973b00a52848e76d0fed7a17677a3 +F src/insert.c d61998cb8d934bd42b77bd362f94cc3368c5d5f7 F src/journal.c cffd2cd214e58c0e99c3ff632b3bee6c7cbb260e F src/legacy.c aac57bd984e666059011ea01ec4383892a253be3 F src/loadext.c 3872457afdf25bb174fd383cb4e3e0d2a9e60552 @@ -138,7 +138,7 @@ F src/os_common.h 24525d8b7bce66c374dfc1810a6c9043f3359b60 F src/os_os2.c 24221ff5ab20cf3472e3ec7eec595f759de55298 F src/os_unix.c 5e3b3c9a54546249c1317cff5343e965192f7f2b F src/os_win.c a26292f39a73a446aa56b01871e73545da8ce3e4 -F src/pager.c 847de90e441beb9f8eaadb76d00814b8be20f5f6 +F src/pager.c e9103fc8ef7439db804425811a8d2b31fe3879b3 F src/pager.h 4a57b219c0765fe1870238064e3f46e4eb2cf5af F src/parse.y 2c4758b4c5ead6de8cf7112f5a7cce7561d313fe F src/pcache.c 5b80676e664019c1ebc8356cc25332dd69da6269 @@ -190,11 +190,11 @@ F src/update.c f22a6f4507f9a0ef082418919382f83b90fd2e63 F src/utf.c c63e6f69082f85c19ab88d62dedaf91d71ac1a50 F src/util.c afe659ccc05d1f8af9e8631dabfec3ee3a7144af F src/vacuum.c fd77433d0c26d3ff1eb96eab017a1787ac5aa642 -F src/vdbe.c e3629776ef4a49f997b271fbd83e54b6104d5607 +F src/vdbe.c d2c9b71d0a996d87508ec841583ae50d23c9a3db F src/vdbe.h 03516f28bf5aca00a53c4dccd6c313f96adb94f6 -F src/vdbeInt.h a20f479ec3bf41c61b0c2bd5176a9bad6b2a07ef +F src/vdbeInt.h 1fd87002786828b75046dcfbc942cf97036b8433 F src/vdbeapi.c 6798c70cf176d23594ec557db88190ca8c7fa860 -F src/vdbeaux.c eb95136983edf82148cbfaa4cd7e61f2cc9e08e0 +F src/vdbeaux.c 68ec5b5d6aaf48d24121a2ed6c23124dd001c735 F src/vdbeblob.c b0dcebfafedcf9c0addc7901ad98f6f986c08935 F src/vdbefifo.c 20fda2a7c4c0bcee1b90eb7e545fefcdbf2e1de7 F src/vdbemem.c c0e9d9947db8968762c7621369f821bb181c1c86 @@ -653,7 +653,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 6c918c4eb9362ebfdbe0486515679102b2862970 -R 11bd9c69353728d156cb2dc9d152508e -U danielk1977 -Z f1b9543c8bb76418daec73052774fa00 +P aca6b260c0dd1a1515b70f3567a0653b6bcdeea2 +R b9c53d3f4a7f5c2c3f4af9c477dc38c4 +U drh +Z 8343f2dbffff187aba2a74daa96aa1fc diff --git a/manifest.uuid b/manifest.uuid index ee80b1ec6a..80aaeea55d 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -aca6b260c0dd1a1515b70f3567a0653b6bcdeea2 \ No newline at end of file +fdb98fd8c1706085ebeef8e48ac6737839bed5e5 \ No newline at end of file diff --git a/src/analyze.c b/src/analyze.c index 2c57d7fd0b..088edda744 100644 --- a/src/analyze.c +++ b/src/analyze.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code associated with the ANALYZE command. ** -** @(#) $Id: analyze.c,v 1.43 2008/07/28 19:34:53 drh Exp $ +** @(#) $Id: analyze.c,v 1.44 2008/11/03 20:55:07 drh Exp $ */ #ifndef SQLITE_OMIT_ANALYZE #include "sqliteInt.h" @@ -86,11 +86,11 @@ static void openStatTable( static void analyzeOneTable( Parse *pParse, /* Parser context */ Table *pTab, /* Table whose indices are to be analyzed */ - int iStatCur, /* Cursor that writes to the sqlite_stat1 table */ + int iStatCur, /* Index of VdbeCursor that writes the sqlite_stat1 table */ int iMem /* Available memory locations begin here */ ){ Index *pIdx; /* An index to being analyzed */ - int iIdxCur; /* Cursor number for index being analyzed */ + int iIdxCur; /* Index of VdbeCursor for index being analyzed */ int nCol; /* Number of columns in the index */ Vdbe *v; /* The virtual machine being built up */ int i; /* Loop counter */ diff --git a/src/bitvec.c b/src/bitvec.c index e911315001..976d2ce82f 100644 --- a/src/bitvec.c +++ b/src/bitvec.c @@ -12,12 +12,14 @@ ** This file implements an object that represents a fixed-length ** bitmap. Bits are numbered starting with 1. ** -** A bitmap is used to record what pages a database file have been -** journalled during a transaction. Usually only a few pages are -** journalled. So the bitmap is usually sparse and has low cardinality. +** A bitmap is used to record which pages of a database file have been +** journalled during a transaction, or which pages have the "dont-write" +** property. Usually only a few pages are meet either condition. +** So the bitmap is usually sparse and has low cardinality. ** But sometimes (for example when during a DROP of a large table) most -** or all of the pages get journalled. In those cases, the bitmap becomes -** dense. The algorithm needs to handle both cases well. +** or all of the pages in a database can get journalled. In those cases, +** the bitmap becomes dense with high cardinality. The algorithm needs +** to handle both cases well. ** ** The size of the bitmap is fixed when the object is created. ** @@ -32,7 +34,7 @@ ** start of a transaction, and is thus usually less than a few thousand, ** but can be as large as 2 billion for a really big database. ** -** @(#) $Id: bitvec.c,v 1.6 2008/06/20 14:59:51 danielk1977 Exp $ +** @(#) $Id: bitvec.c,v 1.7 2008/11/03 20:55:07 drh Exp $ */ #include "sqliteInt.h" @@ -125,6 +127,14 @@ int sqlite3BitvecTest(Bitvec *p, u32 i){ /* ** Set the i-th bit. Return 0 on success and an error code if ** anything goes wrong. +** +** This routine might cause sub-bitmaps to be allocated. Failing +** to get the memory needed to hold the sub-bitmap is the only +** that can go wrong with an insert, assuming p and i are valid. +** +** The calling function must ensure that p is a valid Bitvec object +** and that the value for "i" is within range of the Bitvec object. +** Otherwise the behavior is undefined. */ int sqlite3BitvecSet(Bitvec *p, u32 i){ u32 h; diff --git a/src/btree.c b/src/btree.c index d94d9857a1..6ae18386b1 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.526 2008/10/27 13:59:34 danielk1977 Exp $ +** $Id: btree.c,v 1.527 2008/11/03 20:55:07 drh Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -406,7 +406,7 @@ int sqlite3BtreeRestoreCursorPosition(BtCursor *pCur){ /* ** Determine whether or not a cursor has moved from the position it -** was last placed at. Cursor can move when the row they are pointing +** was last placed at. Cursors can move when the row they are pointing ** at is deleted out from under them. ** ** This routine returns an error code if something goes wrong. The diff --git a/src/build.c b/src/build.c index 84fb23c3fa..d08627cd16 100644 --- a/src/build.c +++ b/src/build.c @@ -22,7 +22,7 @@ ** COMMIT ** ROLLBACK ** -** $Id: build.c,v 1.499 2008/10/22 10:45:38 danielk1977 Exp $ +** $Id: build.c,v 1.500 2008/11/03 20:55:07 drh Exp $ */ #include "sqliteInt.h" #include @@ -3057,7 +3057,7 @@ SrcList *sqlite3SrcListAppend( } /* -** Assign cursors to all tables in a SrcList +** Assign VdbeCursor index numbers to all tables in a SrcList */ void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ int i; diff --git a/src/insert.c b/src/insert.c index 225388edbd..4b413ec65f 100644 --- a/src/insert.c +++ b/src/insert.c @@ -12,7 +12,7 @@ ** This file contains C code routines that are called by the parser ** to handle INSERT statements in SQLite. ** -** $Id: insert.c,v 1.250 2008/10/31 10:53:23 danielk1977 Exp $ +** $Id: insert.c,v 1.251 2008/11/03 20:55:07 drh Exp $ */ #include "sqliteInt.h" @@ -1385,7 +1385,7 @@ void sqlite3CompleteInsertion( int sqlite3OpenTableAndIndices( Parse *pParse, /* Parsing context */ Table *pTab, /* Table to be opened */ - int baseCur, /* Cursor number assigned to the table */ + int baseCur, /* Cursor number assigned to the table */ int op /* OP_OpenRead or OP_OpenWrite */ ){ int i; diff --git a/src/pager.c b/src/pager.c index 40e74d91a4..ca4716e6ec 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.500 2008/10/29 07:01:57 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.501 2008/11/03 20:55:07 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -3401,7 +3401,9 @@ int sqlite3PagerIswriteable(DbPage *pPg){ /* ** A call to this routine tells the pager that it is not necessary to ** write the information on page pPg back to the disk, even though -** that page might be marked as dirty. +** that page might be marked as dirty. This happens, for example, when +** the page has been added as a leaf of the freelist and so its +** content no longer matters. ** ** The overlying software layer calls this routine when all of the data ** on the given page is unused. The pager marks the page as clean so diff --git a/src/vdbe.c b/src/vdbe.c index 9e175ce553..2343f89afd 100644 --- a/src/vdbe.c +++ b/src/vdbe.c @@ -43,7 +43,7 @@ ** in this file for details. If in doubt, do not deviate from existing ** commenting and indentation practices when changing or adding code. ** -** $Id: vdbe.c,v 1.784 2008/10/30 15:03:16 drh Exp $ +** $Id: vdbe.c,v 1.785 2008/11/03 20:55:07 drh Exp $ */ #include "sqliteInt.h" #include @@ -182,20 +182,20 @@ int sqlite3VdbeOpcodeHasProperty(int opcode, int mask){ } /* -** Allocate cursor number iCur. Return a pointer to it. Return NULL +** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL ** if we run out of memory. */ -static Cursor *allocateCursor( - Vdbe *p, - int iCur, - Op *pOp, - int iDb, - int isBtreeCursor +static VdbeCursor *allocateCursor( + Vdbe *p, /* The virtual machine */ + int iCur, /* Index of the new VdbeCursor */ + Op *pOp, /* */ + int iDb, /* */ + int isBtreeCursor /* */ ){ /* Find the memory cell that will be used to store the blob of memory - ** required for this Cursor structure. It is convenient to use a + ** required for this VdbeCursor structure. It is convenient to use a ** vdbe memory cell to manage the memory allocation required for a - ** Cursor structure for the following reasons: + ** VdbeCursor structure for the following reasons: ** ** * Sometimes cursor numbers are used for a couple of different ** purposes in a vdbe program. The different uses might require @@ -213,18 +213,18 @@ static Cursor *allocateCursor( Mem *pMem = &p->aMem[p->nMem-iCur]; int nByte; - Cursor *pCx = 0; + VdbeCursor *pCx = 0; /* If the opcode of pOp is OP_SetNumColumns, then pOp->p2 contains ** the number of fields in the records contained in the table or ** index being opened. Use this to reserve space for the - ** Cursor.aType[] array. + ** VdbeCursor.aType[] array. */ int nField = 0; if( pOp->opcode==OP_SetNumColumns || pOp->opcode==OP_OpenEphemeral ){ nField = pOp->p2; } nByte = - sizeof(Cursor) + + sizeof(VdbeCursor) + (isBtreeCursor?sqlite3BtreeCursorSize():0) + 2*nField*sizeof(u32); @@ -234,15 +234,16 @@ static Cursor *allocateCursor( p->apCsr[iCur] = 0; } if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){ - p->apCsr[iCur] = pCx = (Cursor *)pMem->z; + p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z; memset(pMem->z, 0, nByte); pCx->iDb = iDb; pCx->nField = nField; if( nField ){ - pCx->aType = (u32 *)&pMem->z[sizeof(Cursor)]; + pCx->aType = (u32 *)&pMem->z[sizeof(VdbeCursor)]; } if( isBtreeCursor ){ - pCx->pCursor = (BtCursor *)&pMem->z[sizeof(Cursor)+2*nField*sizeof(u32)]; + pCx->pCursor = (BtCursor*) + &pMem->z[sizeof(VdbeCursor)+2*nField*sizeof(u32)]; } } return pCx; @@ -1958,9 +1959,6 @@ case OP_SetNumColumns: { ** ** The value extracted is stored in register P3. ** -** If the KeyAsData opcode has previously executed on this cursor, then the -** field might be extracted from the key rather than the data. -** ** If the column contains fewer than P2 fields, then extract a NULL. Or, ** if the P4 argument is a P4_MEM use the value of the P4 argument as ** the result. @@ -1969,7 +1967,7 @@ case OP_Column: { u32 payloadSize; /* Number of bytes in the record */ int p1 = pOp->p1; /* P1 value of the opcode */ int p2 = pOp->p2; /* column number to retrieve */ - Cursor *pC = 0; /* The VDBE cursor */ + VdbeCursor *pC = 0;/* The VDBE cursor */ char *zRec; /* Pointer to complete record-data */ BtCursor *pCrsr; /* The BTree cursor */ u32 *aType; /* aType[i] holds the numeric type of the i-th column */ @@ -1999,7 +1997,7 @@ case OP_Column: { ** If the data is unavailable, zRec is set to NULL. ** ** We also compute the number of columns in the record. For cursors, - ** the number of columns is stored in the Cursor.nField element. + ** the number of columns is stored in the VdbeCursor.nField element. */ pC = p->apCsr[p1]; assert( pC!=0 ); @@ -2671,7 +2669,7 @@ case OP_OpenWrite: { int iDb = pOp->p3; int wrFlag; Btree *pX; - Cursor *pCur; + VdbeCursor *pCur; Db *pDb; assert( iDb>=0 && iDbnDb ); @@ -2771,7 +2769,7 @@ case OP_OpenWrite: { */ case OP_OpenEphemeral: { int i = pOp->p1; - Cursor *pCx; + VdbeCursor *pCx; static const int openFlags = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | @@ -2837,7 +2835,7 @@ case OP_OpenEphemeral: { */ case OP_OpenPseudo: { int i = pOp->p1; - Cursor *pCx; + VdbeCursor *pCx; assert( i>=0 ); pCx = allocateCursor(p, i, &pOp[-1], -1, 0); if( pCx==0 ) goto no_mem; @@ -2926,7 +2924,7 @@ case OP_MoveLe: /* jump, in3 */ case OP_MoveGe: /* jump, in3 */ case OP_MoveGt: { /* jump, in3 */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); pC = p->apCsr[i]; @@ -3043,7 +3041,7 @@ case OP_NotFound: /* jump, in3 */ case OP_Found: { /* jump, in3 */ int i = pOp->p1; int alreadyExists = 0; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); if( (pC = p->apCsr[i])->pCursor!=0 ){ @@ -3099,7 +3097,7 @@ case OP_Found: { /* jump, in3 */ */ case OP_IsUnique: { /* jump, in3 */ int i = pOp->p1; - Cursor *pCx; + VdbeCursor *pCx; BtCursor *pCrsr; Mem *pK; i64 R; @@ -3196,7 +3194,7 @@ case OP_IsUnique: { /* jump, in3 */ */ case OP_NotExists: { /* jump, in3 */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); @@ -3265,7 +3263,7 @@ case OP_Sequence: { /* out2-prerelease */ case OP_NewRowid: { /* out2-prerelease */ int i = pOp->p1; i64 v = 0; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); if( (pC = p->apCsr[i])->pCursor==0 ){ @@ -3433,7 +3431,7 @@ case OP_Insert: { i64 iKey; /* The integer ROWID or key for the record to be inserted */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); pC = p->apCsr[i]; assert( pC!=0 ); @@ -3527,7 +3525,7 @@ case OP_Insert: { case OP_Delete: { int i = pOp->p1; i64 iKey; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); pC = p->apCsr[i]; @@ -3598,7 +3596,7 @@ case OP_ResetCount: { case OP_RowKey: case OP_RowData: { int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; u32 n; @@ -3652,7 +3650,7 @@ case OP_RowData: { */ case OP_Rowid: { /* out2-prerelease */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; i64 v; assert( i>=0 && inCursor ); @@ -3685,7 +3683,7 @@ case OP_Rowid: { /* out2-prerelease */ */ case OP_NullRow: { int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); pC = p->apCsr[i]; @@ -3708,7 +3706,7 @@ case OP_NullRow: { */ case OP_Last: { /* jump */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -3758,7 +3756,7 @@ case OP_Sort: { /* jump */ */ case OP_Rewind: { /* jump */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -3803,7 +3801,7 @@ case OP_Rewind: { /* jump */ */ case OP_Prev: /* jump */ case OP_Next: { /* jump */ - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; int res; @@ -3846,7 +3844,7 @@ case OP_Next: { /* jump */ */ case OP_IdxInsert: { /* in2 */ int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); @@ -3873,7 +3871,7 @@ case OP_IdxInsert: { /* in2 */ */ case OP_IdxDelete: { int i = pOp->p1; - Cursor *pC; + VdbeCursor *pC; BtCursor *pCrsr; assert( pOp->p3>0 ); assert( pOp->p2>0 && pOp->p2+pOp->p3<=p->nMem ); @@ -3907,7 +3905,7 @@ case OP_IdxDelete: { case OP_IdxRowid: { /* out2-prerelease */ int i = pOp->p1; BtCursor *pCrsr; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); @@ -3957,7 +3955,7 @@ case OP_IdxRowid: { /* out2-prerelease */ case OP_IdxLT: /* jump, in3 */ case OP_IdxGE: { /* jump, in3 */ int i= pOp->p1; - Cursor *pC; + VdbeCursor *pC; assert( i>=0 && inCursor ); assert( p->apCsr[i]!=0 ); @@ -4640,7 +4638,7 @@ case OP_VDestroy: { ** table and stores that cursor in P1. */ case OP_VOpen: { - Cursor *pCur = 0; + VdbeCursor *pCur = 0; sqlite3_vtab_cursor *pVtabCursor = 0; sqlite3_vtab *pVtab = pOp->p4.pVtab; @@ -4699,7 +4697,7 @@ case OP_VFilter: { /* jump */ sqlite3_vtab_cursor *pVtabCursor; sqlite3_vtab *pVtab; - Cursor *pCur = p->apCsr[pOp->p1]; + VdbeCursor *pCur = p->apCsr[pOp->p1]; REGISTER_TRACE(pOp->p3, pQuery); assert( pCur->pVtabCursor ); @@ -4756,7 +4754,7 @@ case OP_VRowid: { /* out2-prerelease */ sqlite3_vtab *pVtab; const sqlite3_module *pModule; sqlite_int64 iRow; - Cursor *pCur = p->apCsr[pOp->p1]; + VdbeCursor *pCur = p->apCsr[pOp->p1]; assert( pCur->pVtabCursor ); if( pCur->nullRow ){ @@ -4790,7 +4788,7 @@ case OP_VColumn: { Mem *pDest; sqlite3_context sContext; - Cursor *pCur = p->apCsr[pOp->p1]; + VdbeCursor *pCur = p->apCsr[pOp->p1]; assert( pCur->pVtabCursor ); assert( pOp->p3>0 && pOp->p3<=p->nMem ); pDest = &p->aMem[pOp->p3]; @@ -4848,7 +4846,7 @@ case OP_VNext: { /* jump */ const sqlite3_module *pModule; int res = 0; - Cursor *pCur = p->apCsr[pOp->p1]; + VdbeCursor *pCur = p->apCsr[pOp->p1]; assert( pCur->pVtabCursor ); if( pCur->nullRow ){ break; diff --git a/src/vdbeInt.h b/src/vdbeInt.h index c4c1e22b5a..0826bf12d3 100644 --- a/src/vdbeInt.h +++ b/src/vdbeInt.h @@ -15,7 +15,7 @@ ** 6000 lines long) it was split up into several smaller files and ** this header information was factored out. ** -** $Id: vdbeInt.h,v 1.155 2008/10/07 23:46:38 drh Exp $ +** $Id: vdbeInt.h,v 1.156 2008/11/03 20:55:07 drh Exp $ */ #ifndef _VDBEINT_H_ #define _VDBEINT_H_ @@ -50,12 +50,12 @@ typedef unsigned char Bool; ** Every cursor that the virtual machine has open is represented by an ** instance of the following structure. ** -** If the Cursor.isTriggerRow flag is set it means that this cursor is +** If the VdbeCursor.isTriggerRow flag is set it means that this cursor is ** really a single row that represents the NEW or OLD pseudo-table of -** a row trigger. The data for the row is stored in Cursor.pData and -** the rowid is in Cursor.iKey. +** a row trigger. The data for the row is stored in VdbeCursor.pData and +** the rowid is in VdbeCursor.iKey. */ -struct Cursor { +struct VdbeCursor { BtCursor *pCursor; /* The cursor structure of the backend */ int iDb; /* Index of cursor database in db->aDb[] (or -1) */ i64 lastRowid; /* Last rowid from a Next or NextIdx operation */ @@ -93,10 +93,10 @@ struct Cursor { u32 *aOffset; /* Cached offsets to the start of each columns data */ u8 *aRow; /* Data for the current row, if all on one page */ }; -typedef struct Cursor Cursor; +typedef struct VdbeCursor VdbeCursor; /* -** A value for Cursor.cacheValid that means the cache is always invalid. +** A value for VdbeCursor.cacheValid that means the cache is always invalid. */ #define CACHE_STALE 0 @@ -291,7 +291,7 @@ struct Vdbe { Mem **apArg; /* Arguments to currently executing user function */ Mem *aColName; /* Column names to return */ int nCursor; /* Number of slots in apCsr[] */ - Cursor **apCsr; /* One element of this array for each open cursor */ + VdbeCursor **apCsr; /* One element of this array for each open cursor */ int nVar; /* Number of entries in aVar[] */ Mem *aVar; /* Values for the OP_Variable opcode. */ char **azVar; /* Name of variables */ @@ -300,7 +300,7 @@ struct Vdbe { int nMem; /* Number of memory locations currently allocated */ Mem *aMem; /* The memory locations */ int nCallback; /* Number of callbacks invoked so far */ - int cacheCtr; /* Cursor row cache generation counter */ + int cacheCtr; /* VdbeCursor row cache generation counter */ Fifo sFifo; /* A list of ROWIDs */ int contextStackTop; /* Index of top element in the context stack */ int contextStackDepth; /* The size of the "context" stack */ @@ -351,9 +351,9 @@ struct Vdbe { /* ** Function prototypes */ -void sqlite3VdbeFreeCursor(Vdbe *, Cursor*); +void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); void sqliteVdbePopStack(Vdbe*,int); -int sqlite3VdbeCursorMoveto(Cursor*); +int sqlite3VdbeCursorMoveto(VdbeCursor*); #if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) void sqlite3VdbePrintOp(FILE*, int, Op*); #endif @@ -364,7 +364,7 @@ int sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); void sqlite3VdbeDeleteAuxData(VdbeFunc*, int); int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); -int sqlite3VdbeIdxKeyCompare(Cursor*,UnpackedRecord*,int*); +int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); int sqlite3VdbeIdxRowid(BtCursor *, i64 *); int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); int sqlite3VdbeExec(Vdbe*); diff --git a/src/vdbeaux.c b/src/vdbeaux.c index 328aed782e..04d400614a 100644 --- a/src/vdbeaux.c +++ b/src/vdbeaux.c @@ -14,7 +14,7 @@ ** to version 2.8.7, all this code was combined into the vdbe.c source file. ** But that file was getting too big so this subroutines were split out. ** -** $Id: vdbeaux.c,v 1.414 2008/11/03 09:39:45 danielk1977 Exp $ +** $Id: vdbeaux.c,v 1.415 2008/11/03 20:55:07 drh Exp $ */ #include "sqliteInt.h" #include @@ -1021,7 +1021,7 @@ void sqlite3VdbeMakeReady( /* For each cursor required, also allocate a memory cell. Memory ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by ** the vdbe program. Instead they are used to allocate space for - ** Cursor/BtCursor structures. The blob of memory associated with + ** VdbeCursor/BtCursor structures. The blob of memory associated with ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1) ** stores the blob of memory associated with cursor 1, etc. ** @@ -1045,7 +1045,7 @@ void sqlite3VdbeMakeReady( + nVar*sizeof(Mem) /* aVar */ + nArg*sizeof(Mem*) /* apArg */ + nVar*sizeof(char*) /* azVar */ - + nCursor*sizeof(Cursor*) + 1 /* apCsr */ + + nCursor*sizeof(VdbeCursor*)+1 /* apCsr */ ); if( !db->mallocFailed ){ p->aMem--; /* aMem[] goes from 1..nMem */ @@ -1055,7 +1055,7 @@ void sqlite3VdbeMakeReady( p->okVar = 0; p->apArg = (Mem**)&p->aVar[nVar]; p->azVar = (char**)&p->apArg[nArg]; - p->apCsr = (Cursor**)&p->azVar[nVar]; + p->apCsr = (VdbeCursor**)&p->azVar[nVar]; p->nCursor = nCursor; for(n=0; naVar[n].flags = MEM_Null; @@ -1098,7 +1098,7 @@ void sqlite3VdbeMakeReady( ** Close a VDBE cursor and release all the resources that cursor ** happens to hold. */ -void sqlite3VdbeFreeCursor(Vdbe *p, Cursor *pCx){ +void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ if( pCx==0 ){ return; } @@ -1133,7 +1133,7 @@ static void closeAllCursorsExceptActiveVtabs(Vdbe *p){ int i; if( p->apCsr==0 ) return; for(i=0; inCursor; i++){ - Cursor *pC = p->apCsr[i]; + VdbeCursor *pC = p->apCsr[i]; if( pC && (!p->inVtabMethod || !pC->pVtabCursor) ){ sqlite3VdbeFreeCursor(p, pC); p->apCsr[i] = 0; @@ -1866,7 +1866,7 @@ void sqlite3VdbeDelete(Vdbe *p){ ** MoveTo now. Return an error code. If no MoveTo is pending, this ** routine does nothing and returns SQLITE_OK. */ -int sqlite3VdbeCursorMoveto(Cursor *p){ +int sqlite3VdbeCursorMoveto(VdbeCursor *p){ if( p->deferredMoveto ){ int res, rc; #ifdef SQLITE_TEST @@ -2433,7 +2433,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){ ** supplied it is used in place of pKey,nKey. */ int sqlite3VdbeIdxKeyCompare( - Cursor *pC, /* The cursor to compare against */ + VdbeCursor *pC, /* The cursor to compare against */ UnpackedRecord *pUnpacked, /* Unpacked version of pKey and nKey */ int *res /* Write the comparison result here */ ){