]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Code and comment cleanup for the sorting optimization of the previous check-in. ...
authordrh <drh@noemail.net>
Fri, 17 Mar 2006 00:25:59 +0000 (00:25 +0000)
committerdrh <drh@noemail.net>
Fri, 17 Mar 2006 00:25:59 +0000 (00:25 +0000)
FossilOrigin-Name: f3fbe72733b49264a6e0a91bf65c7fd80c7b65ea

manifest
manifest.uuid
src/vdbe.c

index 1212a6771217241b4b19f2ac1ecd738fd0deba79..9e561eb5c203ca537da1a2c028ead308ea924b61 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Much\sfaster\ssorting\swhen\sthere\sare\sa\slarge\snumber\sof\scolumns\sin\sthe\nresult\sset.\s(CVS\s3141)
-D 2006-03-17T00:04:03
+C Code\sand\scomment\scleanup\sfor\sthe\ssorting\soptimization\sof\sthe\sprevious\scheck-in.\s(CVS\s3142)
+D 2006-03-17T00:26:00
 F Makefile.in 5d8dff443383918b700e495de42ec65bc1c8865b
 F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -89,7 +89,7 @@ F src/update.c 34add66fcd3301b33b6e4c4c813f4e408f7ee4a0
 F src/utf.c 1d51225bce1ea8d1978e8ab28e862a0c12c7a8e8
 F src/util.c 59389ed717f0fa9d8023b3f482ba09dcf41343a8
 F src/vacuum.c 5b37d0f436f8e1ffacd17934e44720b38d2247f9
-F src/vdbe.c 0d19124eeb6c38bbc960f2676048652bb9134e99
+F src/vdbe.c dcc469dabef9462b3e8bc77193f83a57f3084363
 F src/vdbe.h 80ba1c391ec28180dd07a630577f50b22c2062da
 F src/vdbeInt.h 85cd5f81d38edb1b8f4786f407c77a7a3ba636fb
 F src/vdbeapi.c 7dc662e7c905ce666bb506dced932e0307115cbf
@@ -355,7 +355,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
-P 6c5175bc0f98e4ce715b099394f3fdc878ed82e8
-R 33078041ea680509db177f2f08180f2d
+P 6b3717aeb4ac45a433f2a30bdd0264ed728676e1
+R f6f3e7e6d067c9a94240a0959ac790cf
 U drh
-Z d6f3682faa4b50ddafbdf0b8d9e74c43
+Z 6dcf6a197f2543f12524c83228a1e433
index 213b57f2344d61c2ddfeb3965dd9a004dfd57633..55710c070b99545b527bf83fc2c6522fe4a81003 100644 (file)
@@ -1 +1 @@
-6b3717aeb4ac45a433f2a30bdd0264ed728676e1
\ No newline at end of file
+f3fbe72733b49264a6e0a91bf65c7fd80c7b65ea
\ No newline at end of file
index c878de823634fa2b981a01bcefcd4953a9145ea9..165ba2554b0a753c12dea6de9b1bbf76495836d0 100644 (file)
@@ -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.546 2006/03/17 00:04:04 drh Exp $
+** $Id: vdbe.c,v 1.547 2006/03/17 00:26:00 drh Exp $
 */
 #include "sqliteInt.h"
 #include "os.h"
@@ -1871,13 +1871,6 @@ case OP_SetNumColumns: {       /* no-push */
 ** If the KeyAsData opcode has previously executed on this cursor, then the
 ** field might be extracted from the key rather than the data.
 **
-** If P1 is negative, then the record is stored on the stack rather than in
-** a table.  For P1==-1, the top of the stack is used.  For P1==-2, the
-** next on the stack is used.  And so forth.  The value pushed is always
-** just a pointer into the record which is stored further down on the
-** stack.  The column value is not copied. The number of columns in the
-** record is stored on the stack just above the record itself.
-**
 ** If the column contains fewer than P2 fields, then push a NULL.  Or
 ** if P3 is of type P3_MEM, then push the P3 value.  The P3 value will
 ** be default value for a column that has been added using the ALTER TABLE
@@ -1909,34 +1902,19 @@ case OP_Column: {
   ** bytes in the record.
   **
   ** zRec is set to be the complete text of the record if it is available.
-  ** The complete record text is always available for pseudo-tables and
-  ** when we are decoded a record from the stack.  If the record is stored
-  ** in a cursor, the complete record text might be available in the 
-  ** pC->aRow cache.  Or it might not be.  If the data is unavailable,
-  ** zRec is set to NULL.
+  ** The complete record text is always available for pseudo-tables
+  ** If the record is stored in a cursor, the complete record text
+  ** might be available in the  pC->aRow cache.  Or it might not be.
+  ** 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.  For
   ** records on the stack, the next entry down on the stack is an integer
   ** which is the number of records.
   */
-  assert( p1<0 || p->apCsr[p1]!=0 );
-#if 0
-  if( p1<0 ){
-    /* Take the record off of the stack */
-    Mem *pRec = &pTos[p1];
-    Mem *pCnt = &pRec[-1];
-    assert( pRec>=p->aStack );
-    assert( pRec->flags & MEM_Blob );
-    payloadSize = pRec->n;
-    zRec = pRec->z;
-    assert( pCnt>=p->aStack );
-    assert( pCnt->flags & MEM_Int );
-    nField = pCnt->i;
-    pCrsr = 0;
-  }else
-#endif
-  if( (pC = p->apCsr[p1])->pCursor!=0 ){
+  pC = p->apCsr[p1];
+  assert( pC!=0 );
+  if( pC->pCursor!=0 ){
     /* The record is stored in a B-Tree */
     rc = sqlite3VdbeCursorMoveto(pC);
     if( rc ) goto abort_due_to_error;
@@ -1990,15 +1968,17 @@ case OP_Column: {
     u32 offset;      /* Offset into the data */
     int szHdrSz;     /* Size of the header size field at start of record */
     int avail;       /* Number of bytes of available data */
-    if( pC && pC->aType ){
-      aType = pC->aType;
-    }else{
-      aType = sqliteMallocRaw( 2*nField*sizeof(aType) );
+
+    aType = pC->aType;
+    if( aType==0 ){
+      pC->aType = aType = sqliteMallocRaw( 2*nField*sizeof(aType) );
     }
-    aOffset = &aType[nField];
     if( aType==0 ){
       goto no_mem;
     }
+    pC->aOffset = aOffset = &aType[nField];
+    pC->payloadSize = payloadSize;
+    pC->cacheStatus = p->cacheCtr;
 
     /* Figure out how many bytes are in the header */
     if( zRec ){
@@ -2071,15 +2051,6 @@ case OP_Column: {
       rc = SQLITE_CORRUPT_BKPT;
       goto op_column_out;
     }
-
-    /* Remember all aType and aColumn information if we have a cursor
-    ** to remember it in. */
-    if( pC ){
-      pC->payloadSize = payloadSize;
-      pC->aType = aType;
-      pC->aOffset = aOffset;
-      pC->cacheStatus = p->cacheCtr;
-    }
   }
 
   /* Get the column information. If aOffset[p2] is non-zero, then 
@@ -2129,10 +2100,6 @@ case OP_Column: {
   rc = sqlite3VdbeMemMakeWriteable(pTos);
 
 op_column_out:
-  /* Release the aType[] memory if we are not dealing with cursor */
-  if( !pC || !pC->aType ){
-    sqliteFree(aType);
-  }
   break;
 }