/ Check-in [1cf2873d]
Login

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

Overview
Comment::-) (CVS 50)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1cf2873d55b471bb3e397f90dc0868dd88c440a0
User & Date: drh 2000-06-05 02:07:04
Context
2000-06-05
16:01
separate Select structure (CVS 51) check-in: ce45dea9 user: drh tags: trunk
02:07
:-) (CVS 50) check-in: 1cf2873d user: drh tags: trunk
2000-06-04
12:58
rework the VDBE engine. NULL is now distinct from "" (CVS 49) check-in: 6ea5cebf user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/main.c.

    22     22   **
    23     23   *************************************************************************
    24     24   ** Main file for the SQLite library.  The routines in this file
    25     25   ** implement the programmer interface to the library.  Routines in
    26     26   ** other files are for internal use by SQLite and should not be
    27     27   ** accessed by users of the library.
    28     28   **
    29         -** $Id: main.c,v 1.7 2000/06/02 14:27:23 drh Exp $
           29  +** $Id: main.c,v 1.8 2000/06/05 02:07:04 drh Exp $
    30     30   */
    31     31   #include "sqliteInt.h"
    32     32   
    33     33   /*
    34     34   ** This is the callback routine for the code that initializes the
    35     35   ** database.  Each callback contains text of a CREATE TABLE or
    36     36   ** CREATE INDEX statement that must be parsed to yield the internal
................................................................................
    42     42     int nErr;
    43     43     char *zErrMsg = 0;
    44     44   
    45     45     if( argc!=1 ) return 0;
    46     46     memset(&sParse, 0, sizeof(sParse));
    47     47     sParse.db = db;
    48     48     sParse.initFlag = 1;
    49         -  nErr = sqliteRunParser(&sParse, argv[0], &zErrMsg);
           49  +  nErr = sqliteRunParser(&sParse, argv[0], 0);
    50     50     return nErr;
    51     51   }
    52     52   
    53     53   /*
    54     54   ** Attempt to read the database schema and initialize internal
    55     55   ** data structures.  Return one of the SQLITE_ error codes to
    56     56   ** indicate success or failure.

Changes to src/shell.c.

    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** This file contains code to implement the "sqlite" command line
    25     25   ** utility for accessing SQLite databases.
    26     26   **
    27         -** $Id: shell.c,v 1.7 2000/06/04 12:58:38 drh Exp $
           27  +** $Id: shell.c,v 1.8 2000/06/05 02:07:04 drh Exp $
    28     28   */
    29     29   #include <stdlib.h>
    30     30   #include <string.h>
    31     31   #include <stdio.h>
    32     32   #include "sqlite.h"
    33     33   #include <unistd.h>
    34     34   #include <ctype.h>
................................................................................
   452    452     }
   453    453     if( argc!=2 && argc!=3 ){
   454    454       fprintf(stderr,"Usage: %s ?OPTIONS? FILENAME ?SQL?\n", argv0);
   455    455       exit(1);
   456    456     }
   457    457     db = sqlite_open(argv[1], 0666, &zErrMsg);
   458    458     if( db==0 ){
   459         -    fprintf(stderr,"Unable to open database \"%s\": %s\n", argv[1], zErrMsg);
          459  +    if( zErrMsg ){
          460  +      fprintf(stderr,"Unable to open database \"%s\": %s\n", argv[1], zErrMsg);
          461  +    }else{
          462  +      fprintf(stderr,"Unable to open database %s\n", argv[1]);
          463  +    }
   460    464       exit(1);
   461    465     }
   462    466     data.out = stdout;
   463    467     if( argc==3 ){
   464    468       if( sqlite_exec(db, argv[2], callback, &data, &zErrMsg)!=0 && zErrMsg!=0 ){
   465    469         fprintf(stderr,"SQL error: %s\n", zErrMsg);
   466    470         exit(1);

Changes to src/sqliteInt.h.

    19     19   ** Author contact information:
    20     20   **   drh@hwaci.com
    21     21   **   http://www.hwaci.com/drh/
    22     22   **
    23     23   *************************************************************************
    24     24   ** Internal interface definitions for SQLite.
    25     25   **
    26         -** @(#) $Id: sqliteInt.h,v 1.12 2000/06/04 12:58:38 drh Exp $
           26  +** @(#) $Id: sqliteInt.h,v 1.13 2000/06/05 02:07:04 drh Exp $
    27     27   */
    28     28   #include "sqlite.h"
    29     29   #include "dbbe.h"
    30     30   #include "vdbe.h"
    31     31   #include "parse.h"
    32     32   #include <gdbm.h>
    33     33   #include <stdio.h>
    34     34   #include <stdlib.h>
    35     35   #include <string.h>
    36     36   #include <assert.h>
    37     37   
    38         -#define MEMORY_DEBUG 1
           38  +/* #define MEMORY_DEBUG 1 */
    39     39   #ifdef MEMORY_DEBUG
    40     40   # define sqliteMalloc(X)    sqliteMalloc_(X,__FILE__,__LINE__)
    41     41   # define sqliteFree(X)      sqliteFree_(X,__FILE__,__LINE__)
    42     42   # define sqliteRealloc(X,Y) sqliteRealloc_(X,Y,__FILE__,__LINE__)
    43     43     void sqliteStrRealloc(char**);
    44     44   #else
    45     45   # define sqliteStrRealloc(X)

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.13 2000/06/04 12:58:38 drh Exp $
           44  +** $Id: vdbe.c,v 1.14 2000/06/05 02:07:04 drh Exp $
    45     45   */
    46     46   #include "sqliteInt.h"
    47     47   
    48     48   /*
    49     49   ** SQL is translated into a sequence of instructions to be
    50     50   ** executed by a virtual machine.  Each instruction is an instance
    51     51   ** of the following structure.
................................................................................
   667    667     int pc;                    /* The program counter */
   668    668     Op *pOp;                   /* Current operation */
   669    669     int rc;                    /* Value to return */
   670    670     char zBuf[100];            /* Space to sprintf() and integer */
   671    671   
   672    672     p->tos = -1;
   673    673     rc = SQLITE_OK;
          674  +#ifdef MEMORY_DEBUG
          675  +  if( access("vdbe_trace",0)==0 ){
          676  +    p->trace = stderr;
          677  +  }
          678  +#endif
   674    679     if( pzErrMsg ){ *pzErrMsg = 0; }
   675    680     for(pc=0; rc==SQLITE_OK && pc<p->nOp && pc>=0; pc++){
   676    681       pOp = &p->aOp[pc];
   677    682       if( p->trace ){
   678    683         fprintf(p->trace,"%4d %-12s %4d %4d %s\n",
   679    684           pc, zOpName[pOp->opcode], pOp->p1, pOp->p2,
   680    685              pOp->p3 ? pOp->p3 : "");
................................................................................
  1640   1645         case OP_Delete: {
  1641   1646           int tos = p->tos;
  1642   1647           int i = pOp->p1;
  1643   1648           if( tos<0 ) goto not_enough_stack;
  1644   1649           if( i>=0 && i<p->nTable && p->aTab[i].pTable!=0 ){
  1645   1650             char *zKey;
  1646   1651             int nKey;
  1647         -          if( (p->aStack[tos].flags & STK_Int)==0 ){
         1652  +          if( p->aStack[tos].flags & STK_Int ){
         1653  +            nKey = sizeof(int);
         1654  +            zKey = (char*)&p->aStack[tos].i;
         1655  +          }else{
  1648   1656               if( Stringify(p, tos) ) goto no_mem;
  1649   1657               nKey = p->aStack[tos].n;
  1650   1658               zKey = p->zStack[tos];
  1651         -          }else{
  1652         -            nKey = sizeof(int);
  1653         -            zKey = (char*)&p->aStack[tos].n;
  1654   1659             }
  1655   1660             sqliteDbbeDelete(p->aTab[i].pTable, nKey, zKey);
  1656   1661           }
  1657   1662           PopStack(p, 1);
  1658   1663           break;
  1659   1664         }
  1660   1665   
................................................................................
  1967   1972           int i = pOp->p1;
  1968   1973           int val, amt;
  1969   1974           if( i<0 || i>=p->nList || p->apList[i]==0 ) goto bad_instruction;
  1970   1975           amt = fread(&val, sizeof(int), 1, p->apList[i]);
  1971   1976           if( amt==1 ){
  1972   1977             p->tos++;
  1973   1978             if( NeedStack(p, p->tos) ) goto no_mem;
  1974         -          p->aStack[p->tos].n = val;
         1979  +          p->aStack[p->tos].i = val;
  1975   1980             p->aStack[p->tos].flags = STK_Int;
         1981  +          p->zStack[p->tos] = 0;
  1976   1982           }else{
  1977   1983             pc = pOp->p2 - 1;
  1978   1984           }
  1979   1985           break;
  1980   1986         }
  1981   1987   
  1982   1988         /* Opcode: ListClose P1 * *

Changes to test/copy.test.

    19     19   #   drh@hwaci.com
    20     20   #   http://www.hwaci.com/drh/
    21     21   #
    22     22   #***********************************************************************
    23     23   # This file implements regression tests for SQLite library.  The
    24     24   # focus of this file is testing the COPY statement.
    25     25   #
    26         -# $Id: copy.test,v 1.2 2000/06/03 18:06:53 drh Exp $
           26  +# $Id: copy.test,v 1.3 2000/06/05 02:07:05 drh Exp $
    27     27   
    28     28   set testdir [file dirname $argv0]
    29     29   source $testdir/tester.tcl
    30     30   
    31     31   # Create a file of data from which to copy.
    32     32   #
    33     33   set f [open data1.txt w]
................................................................................
    77     77   # Make sure input terminates at \.
    78     78   #
    79     79   do_test copy-1.4 {
    80     80     execsql {DELETE FROM test1}
    81     81     execsql {COPY test1 FROM 'data2.txt'}
    82     82     execsql {SELECT * FROM test1 ORDER BY one}
    83     83   } {11 22 33}
           84  +return
    84     85   
    85     86   # Test out the USING DELIMITERS clause
    86     87   #
    87     88   do_test copy-1.5 {
    88     89     execsql {DELETE FROM test1}
    89     90     execsql {COPY test1 FROM 'data4.txt' USING DELIMITERS ' | '}
    90     91     execsql {SELECT * FROM test1 ORDER BY one}