/ Check-in [65d2100d]
Login

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

Overview
Comment::-) (CVS 63)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 65d2100d33350e6bce30d4d75f3cead9fcab3efb
User & Date: drh 2000-06-06 22:13:55
Context
2000-06-06
22:19
:-) (CVS 64) check-in: 3a2f4dca user: drh tags: trunk
22:13
:-) (CVS 63) check-in: 65d2100d user: drh tags: trunk
21:56
:-) (CVS 62) check-in: f4d9089c user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/select.c.

    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** This file contains C code routines that are called by the parser
    25     25   ** to handle SELECT statements.
    26     26   **
    27         -** $Id: select.c,v 1.13 2000/06/06 21:56:08 drh Exp $
           27  +** $Id: select.c,v 1.14 2000/06/06 22:13:55 drh Exp $
    28     28   */
    29     29   #include "sqliteInt.h"
    30     30   
    31     31   /*
    32     32   ** Allocate a new Select structure and return a pointer to that
    33     33   ** structure.
    34     34   */
................................................................................
   157    157     }else 
   158    158   
   159    159     /* Construct a record from the query result, but instead of
   160    160     ** saving that record, use it as a key to delete elements from
   161    161     ** the temporary table iParm.
   162    162     */
   163    163     if( eDest==SRT_Except ){
   164         -    assert( pEList->nExpr==1 );
   165         -    sqliteVdbeAddOp(v, OP_String, 0, 0, "", 0);
   166         -    sqliteVdbeAddOp(v, OP_Put, iParm, 0, 0, 0);
          164  +    sqliteVdbeAddOp(v, OP_MakeRecord, nField, 0, 0, 0);
          165  +    sqliteVdbeAddOp(v, OP_Delete, iParm, 0, 0, 0);
   167    166     }else 
   168    167   
   169    168     /* If we are creating a set for an "expr IN (SELECT ...)" construct,
   170    169     ** then there should be a single item on the stack.  Write this
   171    170     ** item into the set table with bogus data.
   172    171     */
   173    172     if( eDest==SRT_Set ){
................................................................................
   178    177   
   179    178   
   180    179     /* If this is a scalar select that is part of an expression, then
   181    180     ** store the results in the appropriate memory cell and break out
   182    181     ** of the scan loop.
   183    182     */
   184    183     if( eDest==SRT_Mem ){
          184  +    assert( pEList->nExpr==1 );
   185    185       sqliteVdbeAddOp(v, OP_MemStore, iParm, 0, 0, 0);
   186    186       sqliteVdbeAddOp(v, OP_Goto, 0, iBreak, 0, 0);
   187    187     }else
   188    188   
   189    189     /* If none of the above, send the data to the callback function.
   190    190     */
   191    191     {
................................................................................
   302    302           sqliteVdbeAddOp(v, OP_Goto, 0, iCont, 0, 0);
   303    303           sqliteVdbeAddOp(v, OP_Close, unionTab, 0, 0, iBreak);
   304    304         }
   305    305         break;
   306    306       }
   307    307       case TK_INTERSECT: {
   308    308         int tab1, tab2;
   309         -      Select *pPrior;
   310    309         int iCont, iBreak;
   311    310   
   312    311         tab1 = pParse->nTab++;
   313    312         tab2 = pParse->nTab++;
   314    313         sqliteVdbeAddOp(v, OP_Open, tab1, 1, 0, 0);
   315    314         sqliteVdbeAddOp(v, OP_KeyAsData, tab1, 1, 0, 0);
   316    315         rc = sqliteSelect(pParse, pPrior, SRT_Union, tab1);

Changes to src/vdbe.c.

    37     37   ** inplicit conversion from one type to the other occurs as necessary.
    38     38   ** 
    39     39   ** Most of the code in this file is taken up by the sqliteVdbeExec()
    40     40   ** function which does the work of interpreting a VDBE program.
    41     41   ** But other routines are also provided to help in building up
    42     42   ** a program instruction by instruction.
    43     43   **
    44         -** $Id: vdbe.c,v 1.23 2000/06/06 21:56:08 drh Exp $
           44  +** $Id: vdbe.c,v 1.24 2000/06/06 22:13:55 drh Exp $
    45     45   */
    46     46   #include "sqliteInt.h"
    47     47   #include <unistd.h>
    48     48   
    49     49   /*
    50     50   ** SQL is translated into a sequence of instructions to be
    51     51   ** executed by a virtual machine.  Each instruction is an instance
................................................................................
  1962   1962           int i = pOp->p1;
  1963   1963           int tos = ++p->tos;
  1964   1964           DbbeTable *pTab;
  1965   1965   
  1966   1966           if( NeedStack(p, p->tos) ) goto no_mem;
  1967   1967           if( i>=0 && i<p->nTable && (pTab = p->aTab[i].pTable)!=0 ){
  1968   1968             char *z = sqliteDbbeReadKey(pTab, 0);
  1969         -          memcpy(&p->aStack[tos].i, z, sizeof(int));
  1970         -          p->aStack[tos].flags = STK_Int;
         1969  +          if( p->aTab[i].keyAsData ){
         1970  +            p->zStack[tos] = z;
         1971  +            p->aStack[tos].flags = STK_Str;
         1972  +            p->aStack[tos].n = sqliteDbbeKeyLength(pTab);
         1973  +          }else{
         1974  +            memcpy(&p->aStack[tos].i, z, sizeof(int));
         1975  +            p->aStack[tos].flags = STK_Int;
         1976  +          }
  1971   1977           }
  1972   1978           break;
  1973   1979         }
  1974   1980   
  1975   1981         /* Opcode: Rewind P1 * *
  1976   1982         **
  1977   1983         ** The next use of the Key or Field or Next instruction for P1