/ Check-in [3399b012]
Login

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

Overview
Comment:Clean up some compiler warnings. (CVS 575)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3399b01219b9e75b93587b5634d199d9e6fb6e42
User & Date: drh 2002-05-21 13:18:26
Context
2002-05-21
13:43
Double-quoted strings resolve to column names if possible. Single-quoted strings continue to be interpreted as string literals. (CVS 576) check-in: 55e7d654 user: drh tags: trunk
13:18
Clean up some compiler warnings. (CVS 575) check-in: 3399b012 user: drh tags: trunk
13:02
Modify the shell so that when it is doing a ".dump" it always uses single quotes and not double quotes for quoting literal strings. This is for portability to other databases that only support single quote string literals. (CVS 574) check-in: f795afd6 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/sqliteInt.h.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** Internal interface definitions for SQLite.
    13     13   **
    14         -** @(#) $Id: sqliteInt.h,v 1.111 2002/05/21 11:38:12 drh Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.112 2002/05/21 13:18:26 drh Exp $
    15     15   */
    16     16   #include "sqlite.h"
    17     17   #include "hash.h"
    18     18   #include "vdbe.h"
    19     19   #include "parse.h"
    20     20   #include "btree.h"
    21     21   #include <stdio.h>
................................................................................
   819    819   int sqliteTriggersExist(Parse* , Trigger* , int , int , int, ExprList*);
   820    820   int sqliteCodeRowTrigger(Parse*, int, ExprList*, int, Table *, int, int, int);
   821    821   void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
   822    822   TriggerStep *sqliteTriggerSelectStep(Select*);
   823    823   TriggerStep *sqliteTriggerInsertStep(Token*, IdList*, ExprList*, Select*, int);
   824    824   TriggerStep *sqliteTriggerUpdateStep(Token*, ExprList*, Expr*, int);
   825    825   TriggerStep *sqliteTriggerDeleteStep(Token*, Expr*);
          826  +void sqliteDeleteTrigger(Trigger*);

Changes to src/trigger.c.

   243    243   
   244    244     return pTriggerStep;
   245    245   }
   246    246   
   247    247   /* 
   248    248   ** Recursively delete a Trigger structure
   249    249   */
   250         -void sqliteDeleteTrigger(Trigger *pTrigger)
   251         -{
          250  +void sqliteDeleteTrigger(Trigger *pTrigger){
   252    251     TriggerStep *pTriggerStep;
   253    252   
   254    253     pTriggerStep = pTrigger->step_list;
   255    254     while( pTriggerStep ){
   256    255       TriggerStep * pTmp = pTriggerStep;
   257    256       pTriggerStep = pTriggerStep->pNext;
   258    257   
................................................................................
   669    668     sqliteVdbeAddOp(v, OP_Rewind, oldIdx, endOfLoop);
   670    669   
   671    670     /* Loop thru the view snapshot, executing triggers for each row */
   672    671     startOfLoop = sqliteVdbeCurrentAddr(v);
   673    672   
   674    673     /* Build the updated row if required */
   675    674     if( pChanges ){
   676         -    int ii, jj;
          675  +    int ii;
   677    676   
   678    677       aXRef = sqliteMalloc( sizeof(int) * pTab->nCol );
   679    678       if( aXRef==0 ) goto trigger_cleanup;
   680    679       for(ii = 0; ii < pTab->nCol; ii++){
   681    680         aXRef[ii] = -1;
   682    681       }
   683    682   

Changes to src/where.c.

     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  Also found here are subroutines
    14     14   ** to generate VDBE code to evaluate expressions.
    15     15   **
    16         -** $Id: where.c,v 1.44 2002/05/19 23:43:14 danielk1977 Exp $
           16  +** $Id: where.c,v 1.45 2002/05/21 13:18:26 drh Exp $
    17     17   */
    18     18   #include "sqliteInt.h"
    19     19   
    20     20   /*
    21     21   ** The query generator uses an array of instances of this structure to
    22     22   ** help it analyze the subexpressions of the WHERE clause.  Each WHERE
    23     23   ** clause subexpression is separated from the others by an AND operator.
................................................................................
   212    212     memset(aExpr, 0, sizeof(aExpr));
   213    213     nExpr = exprSplit(ARRAYSIZE(aExpr), aExpr, pWhere);
   214    214   
   215    215     /* Analyze all of the subexpressions.
   216    216     */
   217    217     for(i=0; i<nExpr; i++){
   218    218       exprAnalyze(base, &aExpr[i]);
   219         -    if( pParse->trigStack && pParse->trigStack->newIdx >= 0 ){
   220         -        aExpr[i].prereqRight = 
   221         -            aExpr[i].prereqRight & ~(1 << pParse->trigStack->newIdx - base);
   222         -        aExpr[i].prereqLeft = 
   223         -            aExpr[i].prereqLeft & ~(1 << pParse->trigStack->newIdx - base);
   224         -        aExpr[i].prereqAll = 
   225         -            aExpr[i].prereqAll & ~(1 << pParse->trigStack->newIdx - base);
   226         -    }
   227         -    if( pParse->trigStack && pParse->trigStack->oldIdx >= 0 ){
   228         -        aExpr[i].prereqRight = 
   229         -            aExpr[i].prereqRight & ~(1 << pParse->trigStack->oldIdx - base);
   230         -        aExpr[i].prereqLeft = 
   231         -            aExpr[i].prereqLeft & ~(1 << pParse->trigStack->oldIdx - base);
   232         -        aExpr[i].prereqAll = 
   233         -            aExpr[i].prereqAll & ~(1 << pParse->trigStack->oldIdx - base);
          219  +
          220  +    /* If we are executing a trigger body, remove all references to
          221  +    ** new.* and old.* tables from the prerequisite masks.
          222  +    */
          223  +    if( pParse->trigStack ){
          224  +      int x;
          225  +      if( (x = pParse->trigStack->newIdx) >= 0 ){
          226  +        int mask = ~(1 << (x - base));
          227  +        aExpr[i].prereqRight &= mask;
          228  +        aExpr[i].prereqLeft &= mask;
          229  +        aExpr[i].prereqAll &= mask;
          230  +      }
          231  +      if( (x = pParse->trigStack->oldIdx) >= 0 ){
          232  +        int mask = ~(1 << (x - base));
          233  +        aExpr[i].prereqRight &= mask;
          234  +        aExpr[i].prereqLeft &= mask;
          235  +        aExpr[i].prereqAll &= mask;
          236  +      }
   234    237       }
   235    238     }
   236    239   
   237    240     /* Figure out a good nesting order for the tables.  aOrder[0] will
   238    241     ** be the index in pTabList of the outermost table.  aOrder[1] will
   239    242     ** be the first nested loop and so on.  aOrder[pTabList->nId-1] will
   240    243     ** be the innermost loop.
   241    244     **
   242         -  ** Someday will put in a good algorithm here to reorder the loops
          245  +  ** Someday we will put in a good algorithm here to reorder the loops
   243    246     ** for an effiecient query.  But for now, just use whatever order the
   244    247     ** tables appear in in the pTabList.
   245    248     */
   246    249     for(i=0; i<pTabList->nId; i++){
   247    250       aOrder[i] = i;
   248    251     }
   249    252