/ Check-in [9ba0df4d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix up a couple of little things in the vdbe. select1.test passes now. (CVS 1351)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9ba0df4d7792dccb67782113751c0e5807348d62
User & Date: danielk1977 2004-05-11 04:54:49
Context
2004-05-11
06:17
Minor changes to the vdbe so that more tests pass. (CVS 1352) check-in: 16078fe0 user: danielk1977 tags: trunk
04:54
Fix up a couple of little things in the vdbe. select1.test passes now. (CVS 1351) check-in: 9ba0df4d user: danielk1977 tags: trunk
03:11
Internal symbols MEM_Dyn and MEM_AggCtx were defined as the same bit pattern. Change MEM_AggCtx to 0x1000. (CVS 1350) check-in: 2fffd133 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

    39     39   **
    40     40   ** Various scripts scan this source file in order to generate HTML
    41     41   ** documentation, headers files, or other derived files.  The formatting
    42     42   ** of the code in this file is, therefore, important.  See other comments
    43     43   ** in this file for details.  If in doubt, do not deviate from existing
    44     44   ** commenting and indentation practices when changing or adding code.
    45     45   **
    46         -** $Id: vdbe.c,v 1.276 2004/05/11 02:10:07 danielk1977 Exp $
           46  +** $Id: vdbe.c,v 1.277 2004/05/11 04:54:49 danielk1977 Exp $
    47     47   */
    48     48   #include "sqliteInt.h"
    49     49   #include "os.h"
    50     50   #include <ctype.h>
    51     51   #include "vdbeInt.h"
    52     52   
    53     53   /*
................................................................................
  2730   2730     if( rc==SQLITE_OK ){
  2731   2731       rc = sqlite3BtreeBeginTrans(pCx->pBt);
  2732   2732     }
  2733   2733     if( rc==SQLITE_OK ){
  2734   2734       /* If a transient index is required, create it by calling
  2735   2735       ** sqlite3BtreeCreateTable() with the BTREE_ZERODATA flag before
  2736   2736       ** opening it. If a transient table is required, just use the
  2737         -    ** automatically created table with root-page 1.
         2737  +    ** automatically created table with root-page 1 (an INTKEY table).
  2738   2738       */
  2739   2739       if( pOp->p2 ){
  2740   2740         int pgno;
  2741   2741         rc = sqlite3BtreeCreateTable(pCx->pBt, &pgno, BTREE_ZERODATA); 
  2742   2742         if( rc==SQLITE_OK ){
  2743   2743           assert( pgno==MASTER_ROOT+1 );
  2744   2744           rc = sqlite3BtreeCursor(pCx->pBt, pgno, 1, 0, 0, &pCx->pCursor);
  2745   2745         }
  2746   2746       }else{
  2747   2747         rc = sqlite3BtreeCursor(pCx->pBt, MASTER_ROOT, 1, 0, 0, &pCx->pCursor);
         2748  +      pCx->intKey = 1;
  2748   2749       }
  2749   2750     }
  2750   2751     break;
  2751   2752   }
  2752   2753   
  2753   2754   /* Opcode: OpenPseudo P1 * *
  2754   2755   **
................................................................................
  3204   3205         Stringify(pNos);
  3205   3206         nKey = pNos->n;
  3206   3207         zKey = pNos->z;
  3207   3208       }else{
  3208   3209         assert( pNos->flags & MEM_Int );
  3209   3210   
  3210   3211         /* If the table is an INTKEY table, set nKey to the value of
  3211         -      ** the integer key, and zKey to NULL.
         3212  +      ** the integer key, and zKey to NULL. Otherwise, set nKey to
         3213  +      ** sizeof(i64) and point zKey at iKey. iKey contains the integer
         3214  +      ** key in the on-disk byte order.
  3212   3215         */
         3216  +      iKey = intToKey(pNos->i);
  3213   3217         if( pC->intKey ){
  3214   3218           nKey = intToKey(pNos->i);
  3215         -        assert( keyToInt(nKey)==pNos->i );
  3216   3219           zKey = 0;
  3217   3220         }else{
  3218         -        /* TODO: can this happen? zKey is not correctly byte-ordered here! */
  3219         -        assert(!"TODO");
  3220   3221           nKey = sizeof(i64);
  3221   3222           zKey = (char*)&iKey;
  3222   3223         }
  3223         -      iKey = pNos->i;
  3224   3224   
  3225   3225         if( pOp->p2 & OPFLAG_NCHANGE ) db->nChange++;
  3226   3226         if( pOp->p2 & OPFLAG_LASTROWID ) db->lastRowid = pNos->i;
  3227   3227         if( pOp->p2 & OPFLAG_CSCHANGE ) db->csChange++;
  3228   3228         if( pC->nextRowidValid && pTos->i>=pC->nextRowid ){
  3229   3229           pC->nextRowidValid = 0;
  3230   3230         }
................................................................................
  3423   3423     }else if( (pC = &p->aCsr[i])->pCursor!=0 ){
  3424   3424       sqlite3VdbeCursorMoveto(pC);
  3425   3425       zRec = 0;
  3426   3426       pCrsr = pC->pCursor;
  3427   3427       if( pC->nullRow ){
  3428   3428         payloadSize = 0;
  3429   3429       }else if( pC->keyAsData ){
  3430         -      /* TODO: sqlite3BtreeKeySize(pCrsr, &payloadSize); */
         3430  +      assert( !pC->intKey );
         3431  +      u64 pl64;
         3432  +      sqlite3BtreeKeySize(pCrsr, &pl64);
         3433  +      payloadSize = pl64;
  3431   3434       }else{
  3432   3435         sqlite3BtreeDataSize(pCrsr, &payloadSize);
  3433   3436       }
  3434   3437     }else if( pC->pseudoTable ){
  3435   3438       payloadSize = pC->nData;
  3436   3439       zRec = pC->pData;
  3437   3440       assert( payloadSize==0 || zRec!=0 );