/ Check-in [4b22e4b8]
Login

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

Overview
Comment:Remove unused parameters on internal APIs. Suppress warnings from CodeWarrior. (CVS 3110)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4b22e4b847f8d5c29830baea541194ef3a0c4811
User & Date: drh 2006-02-24 02:53:50
Context
2006-02-24
03:09
Additional compiler warnings suppressed. (CVS 3111) check-in: a359b181 user: drh tags: trunk
02:53
Remove unused parameters on internal APIs. Suppress warnings from CodeWarrior. (CVS 3110) check-in: 4b22e4b8 user: drh tags: trunk
2006-02-23
21:51
Make sure the random() function always returns a value that can be passed to abs(). (CVS 3109) check-in: 5d2e7ea0 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/btree.c.

     5      5   ** a legal notice, here is a blessing:
     6      6   **
     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         -** $Id: btree.c,v 1.315 2006/02/22 03:08:33 drh Exp $
           12  +** $Id: btree.c,v 1.316 2006/02/24 02:53:50 drh Exp $
    13     13   **
    14     14   ** This file implements a external (disk-based) database using BTrees.
    15     15   ** For a detailed discussion of BTrees, refer to
    16     16   **
    17     17   **     Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3:
    18     18   **     "Sorting And Searching", pages 473-480. Addison-Wesley
    19     19   **     Publishing Company, Reading, Massachusetts.
................................................................................
  1746   1746     */
  1747   1747     pTsd = (ThreadData *)sqlite3ThreadDataReadOnly();
  1748   1748     if( pTsd->pBtree==pBt ){
  1749   1749       assert( pTsd==sqlite3ThreadData() );
  1750   1750       pTsd->pBtree = pBt->pNext;
  1751   1751     }else{
  1752   1752       BtShared *pPrev;
  1753         -    for(pPrev=pTsd->pBtree; pPrev && pPrev->pNext!=pBt; pPrev=pPrev->pNext);
         1753  +    for(pPrev=pTsd->pBtree; pPrev && pPrev->pNext!=pBt; pPrev=pPrev->pNext){}
  1754   1754       if( pPrev ){
  1755   1755         assert( pTsd==sqlite3ThreadData() );
  1756   1756         pPrev->pNext = pBt->pNext;
  1757   1757       }
  1758   1758     }
  1759   1759   #endif
  1760   1760   
................................................................................
  6217   6217   **      8.  Make sure this page is at least 33% full or else it is
  6218   6218   **          the root of the tree.
  6219   6219   */
  6220   6220   static int checkTreePage(
  6221   6221     IntegrityCk *pCheck,  /* Context for the sanity check */
  6222   6222     int iPage,            /* Page number of the page to check */
  6223   6223     MemPage *pParent,     /* Parent page */
  6224         -  char *zParentContext, /* Parent context */
  6225         -  char *zLowerBound,    /* All keys should be greater than this, if not NULL */
  6226         -  int nLower,           /* Number of characters in zLowerBound */
  6227         -  char *zUpperBound,    /* All keys should be less than this, if not NULL */
  6228         -  int nUpper            /* Number of characters in zUpperBound */
         6224  +  char *zParentContext  /* Parent context */
  6229   6225   ){
  6230   6226     MemPage *pPage;
  6231   6227     int i, rc, depth, d2, pgno, cnt;
  6232   6228     int hdr, cellStart;
  6233   6229     int nCell;
  6234   6230     u8 *data;
  6235   6231     BtShared *pBt;
................................................................................
  6287   6283       if( !pPage->leaf ){
  6288   6284         pgno = get4byte(pCell);
  6289   6285   #ifndef SQLITE_OMIT_AUTOVACUUM
  6290   6286         if( pBt->autoVacuum ){
  6291   6287           checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext);
  6292   6288         }
  6293   6289   #endif
  6294         -      d2 = checkTreePage(pCheck,pgno,pPage,zContext,0,0,0,0);
         6290  +      d2 = checkTreePage(pCheck,pgno,pPage,zContext);
  6295   6291         if( i>0 && d2!=depth ){
  6296   6292           checkAppendMsg(pCheck, zContext, "Child page depth differs");
  6297   6293         }
  6298   6294         depth = d2;
  6299   6295       }
  6300   6296     }
  6301   6297     if( !pPage->leaf ){
................................................................................
  6302   6298       pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
  6303   6299       sprintf(zContext, "On page %d at right child: ", iPage);
  6304   6300   #ifndef SQLITE_OMIT_AUTOVACUUM
  6305   6301       if( pBt->autoVacuum ){
  6306   6302         checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, 0);
  6307   6303       }
  6308   6304   #endif
  6309         -    checkTreePage(pCheck, pgno, pPage, zContext,0,0,0,0);
         6305  +    checkTreePage(pCheck, pgno, pPage, zContext);
  6310   6306     }
  6311   6307    
  6312   6308     /* Check for complete coverage of the page
  6313   6309     */
  6314   6310     data = pPage->aData;
  6315   6311     hdr = pPage->hdrOffset;
  6316   6312     hit = sqliteMalloc( usableSize );
................................................................................
  6414   6410     for(i=0; i<nRoot; i++){
  6415   6411       if( aRoot[i]==0 ) continue;
  6416   6412   #ifndef SQLITE_OMIT_AUTOVACUUM
  6417   6413       if( pBt->autoVacuum && aRoot[i]>1 ){
  6418   6414         checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0);
  6419   6415       }
  6420   6416   #endif
  6421         -    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ", 0,0,0,0);
         6417  +    checkTreePage(&sCheck, aRoot[i], 0, "List of tree roots: ");
  6422   6418     }
  6423   6419   
  6424   6420     /* Make sure every page in the file is referenced
  6425   6421     */
  6426   6422     for(i=1; i<=sCheck.nPage; i++){
  6427   6423   #ifdef SQLITE_OMIT_AUTOVACUUM
  6428   6424       if( sCheck.anRef[i]==0 ){

Changes to src/build.c.

    18     18   **     CREATE INDEX
    19     19   **     DROP INDEX
    20     20   **     creating ID lists
    21     21   **     BEGIN TRANSACTION
    22     22   **     COMMIT
    23     23   **     ROLLBACK
    24     24   **
    25         -** $Id: build.c,v 1.388 2006/02/18 16:36:45 drh Exp $
           25  +** $Id: build.c,v 1.389 2006/02/24 02:53:50 drh Exp $
    26     26   */
    27     27   #include "sqliteInt.h"
    28     28   #include <ctype.h>
    29     29   
    30     30   /*
    31     31   ** This routine is called when a new SQL statement is beginning to
    32     32   ** be parsed.  Initialize the pParse structure as needed.
................................................................................
   334    334   ** Remove the given index from the index hash table, and free
   335    335   ** its memory structures.
   336    336   **
   337    337   ** The index is removed from the database hash tables but
   338    338   ** it is not unlinked from the Table that it indexes.
   339    339   ** Unlinking from the Table must be done by the calling function.
   340    340   */
   341         -static void sqliteDeleteIndex(sqlite3 *db, Index *p){
          341  +static void sqliteDeleteIndex(Index *p){
   342    342     Index *pOld;
   343    343     const char *zName = p->zName;
   344    344   
   345    345     pOld = sqlite3HashInsert(&p->pSchema->idxHash, zName, strlen( zName)+1, 0);
   346    346     assert( pOld==0 || pOld==p );
   347    347     freeIndex(p);
   348    348   }
................................................................................
   503    503     assert( pTable->nRef==0 );
   504    504   
   505    505     /* Delete all indices associated with this table
   506    506     */
   507    507     for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
   508    508       pNext = pIndex->pNext;
   509    509       assert( pIndex->pSchema==pTable->pSchema );
   510         -    sqliteDeleteIndex(db, pIndex);
          510  +    sqliteDeleteIndex(pIndex);
   511    511     }
   512    512   
   513    513   #ifndef SQLITE_OMIT_FOREIGN_KEY
   514    514     /* Delete all foreign keys associated with this table.  The keys
   515    515     ** should have already been unlinked from the db->aFKey hash table 
   516    516     */
   517    517     for(pFKey=pTable->pFKey; pFKey; pFKey=pNextFKey){
................................................................................
   686    686     return SQLITE_OK;
   687    687   }
   688    688   
   689    689   /*
   690    690   ** Begin constructing a new table representation in memory.  This is
   691    691   ** the first of several action routines that get called in response
   692    692   ** to a CREATE TABLE statement.  In particular, this routine is called
   693         -** after seeing tokens "CREATE" and "TABLE" and the table name.  The
   694         -** pStart token is the CREATE and pName is the table name.  The isTemp
          693  +** after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp
   695    694   ** flag is true if the table should be stored in the auxiliary database
   696    695   ** file instead of in the main database file.  This is normally the case
   697    696   ** when the "TEMP" or "TEMPORARY" keyword occurs in between
   698    697   ** CREATE and TABLE.
   699    698   **
   700    699   ** The new table record is initialized and put in pParse->pNewTable.
   701    700   ** As more of the CREATE TABLE statement is parsed, additional action
   702    701   ** routines will be called to add more information to this record.
   703    702   ** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine
   704    703   ** is called to complete the construction of the new table record.
   705    704   */
   706    705   void sqlite3StartTable(
   707    706     Parse *pParse,   /* Parser context */
   708         -  Token *pStart,   /* The "CREATE" token */
   709    707     Token *pName1,   /* First part of the name of the table or view */
   710    708     Token *pName2,   /* Second part of the name of the table or view */
   711    709     int isTemp,      /* True if this is a TEMP table */
   712    710     int isView,      /* True if this is a VIEW */
   713    711     int noErr        /* Do nothing if table already exists */
   714    712   ){
   715    713     Table *pTable;
................................................................................
  1580   1578     int iDb;
  1581   1579   
  1582   1580     if( pParse->nVar>0 ){
  1583   1581       sqlite3ErrorMsg(pParse, "parameters are not allowed in views");
  1584   1582       sqlite3SelectDelete(pSelect);
  1585   1583       return;
  1586   1584     }
  1587         -  sqlite3StartTable(pParse, pBegin, pName1, pName2, isTemp, 1, 0);
         1585  +  sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0);
  1588   1586     p = pParse->pNewTable;
  1589   1587     if( p==0 || pParse->nErr ){
  1590   1588       sqlite3SelectDelete(pSelect);
  1591   1589       return;
  1592   1590     }
  1593   1591     sqlite3TwoPartName(pParse, pName1, pName2, &pName);
  1594   1592     iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema);
................................................................................
  1921   1919       ** is generated to remove entries from sqlite_master and/or
  1922   1920       ** sqlite_temp_master if required.
  1923   1921       */
  1924   1922       pTrigger = pTab->pTrigger;
  1925   1923       while( pTrigger ){
  1926   1924         assert( pTrigger->pSchema==pTab->pSchema || 
  1927   1925             pTrigger->pSchema==db->aDb[1].pSchema );
  1928         -      sqlite3DropTriggerPtr(pParse, pTrigger, 1);
         1926  +      sqlite3DropTriggerPtr(pParse, pTrigger);
  1929   1927         pTrigger = pTrigger->pNext;
  1930   1928       }
  1931   1929   
  1932   1930   #ifndef SQLITE_OMIT_AUTOINCREMENT
  1933   1931       /* Remove any entries of the sqlite_sequence table associated with
  1934   1932       ** the table being dropped. This is done before the table is dropped
  1935   1933       ** at the btree level, in case the sqlite_sequence table needs to

Changes to src/delete.c.

     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   ** This file contains C code routines that are called by the parser
    13     13   ** in order to generate code for DELETE FROM statements.
    14     14   **
    15         -** $Id: delete.c,v 1.121 2006/02/10 02:27:43 danielk1977 Exp $
           15  +** $Id: delete.c,v 1.122 2006/02/24 02:53:50 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Look up every table that is named in pSrc.  If any table is not found,
    21     21   ** add an error message to pParse->zErrMsg and return NULL.  If all tables
    22     22   ** are found, return a pointer to the last table.
................................................................................
   378    378     Vdbe *v,           /* Generate code into this VDBE */
   379    379     Table *pTab,       /* Table containing the row to be deleted */
   380    380     int iCur,          /* Cursor number for the table */
   381    381     int count          /* Increment the row change counter */
   382    382   ){
   383    383     int addr;
   384    384     addr = sqlite3VdbeAddOp(v, OP_NotExists, iCur, 0);
   385         -  sqlite3GenerateRowIndexDelete(db, v, pTab, iCur, 0);
          385  +  sqlite3GenerateRowIndexDelete(v, pTab, iCur, 0);
   386    386     sqlite3VdbeAddOp(v, OP_Delete, iCur, (count?OPFLAG_NCHANGE:0));
   387    387     if( count ){
   388    388       sqlite3VdbeChangeP3(v, -1, pTab->zName, P3_STATIC);
   389    389     }
   390    390     sqlite3VdbeJumpHere(v, addr);
   391    391   }
   392    392   
................................................................................
   403    403   **   2.  Read/write cursors for all indices of pTab must be open as
   404    404   **       cursor number iCur+i for the i-th index.
   405    405   **
   406    406   **   3.  The "iCur" cursor must be pointing to the row that is to be
   407    407   **       deleted.
   408    408   */
   409    409   void sqlite3GenerateRowIndexDelete(
   410         -  sqlite3 *db,       /* The database containing the index */
   411    410     Vdbe *v,           /* Generate code into this VDBE */
   412    411     Table *pTab,       /* Table containing the row to be deleted */
   413    412     int iCur,          /* Cursor number for the table */
   414    413     char *aIdxUsed     /* Only delete if aIdxUsed!=0 && aIdxUsed[i]!=0 */
   415    414   ){
   416    415     int i;
   417    416     Index *pIdx;

Changes to src/insert.c.

     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   ** This file contains C code routines that are called by the parser
    13     13   ** to handle INSERT statements in SQLite.
    14     14   **
    15         -** $Id: insert.c,v 1.161 2006/02/10 02:27:43 danielk1977 Exp $
           15  +** $Id: insert.c,v 1.162 2006/02/24 02:53:50 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** Set P3 of the most recently inserted opcode to a column affinity
    21     21   ** string for index pIdx. A column affinity string has one character
    22     22   ** for each column in the table, according to the affinity of the column:
................................................................................
   907    907         case OE_Abort:
   908    908         case OE_Fail: {
   909    909           sqlite3VdbeOp3(v, OP_Halt, SQLITE_CONSTRAINT, onError,
   910    910                            "PRIMARY KEY must be unique", P3_STATIC);
   911    911           break;
   912    912         }
   913    913         case OE_Replace: {
   914         -        sqlite3GenerateRowIndexDelete(pParse->db, v, pTab, base, 0);
          914  +        sqlite3GenerateRowIndexDelete(v, pTab, base, 0);
   915    915           if( isUpdate ){
   916    916             sqlite3VdbeAddOp(v, OP_Dup, nCol+hasTwoRowids, 1);
   917    917             sqlite3VdbeAddOp(v, OP_MoveGe, base, 0);
   918    918           }
   919    919           seenReplace = 1;
   920    920           break;
   921    921         }

Changes to src/pager.c.

    14     14   ** The pager is used to access a database disk file.  It implements
    15     15   ** atomic commit and rollback through the use of a journal file that
    16     16   ** is separate from the database file.  The pager also implements file
    17     17   ** locking to prevent two processes from writing the same database
    18     18   ** file simultaneously, or one process from reading the database while
    19     19   ** another is writing.
    20     20   **
    21         -** @(#) $Id: pager.c,v 1.258 2006/02/11 01:25:51 drh Exp $
           21  +** @(#) $Id: pager.c,v 1.259 2006/02/24 02:53:50 drh Exp $
    22     22   */
    23     23   #ifndef SQLITE_OMIT_DISKIO
    24     24   #include "sqliteInt.h"
    25     25   #include "os.h"
    26     26   #include "pager.h"
    27     27   #include <assert.h>
    28     28   #include <string.h>
................................................................................
   931    931   ** though fast and simple, catches the mostly likely kind of corruption.
   932    932   **
   933    933   ** FIX ME:  Consider adding every 200th (or so) byte of the data to the
   934    934   ** checksum.  That way if a single page spans 3 or more disk sectors and
   935    935   ** only the middle sector is corrupt, we will still have a reasonable
   936    936   ** chance of failing the checksum and thus detecting the problem.
   937    937   */
   938         -static u32 pager_cksum(Pager *pPager, Pgno pgno, const u8 *aData){
          938  +static u32 pager_cksum(Pager *pPager, const u8 *aData){
   939    939     u32 cksum = pPager->cksumInit;
   940    940     int i = pPager->pageSize-200;
   941    941     while( i>0 ){
   942    942       cksum += aData[i];
   943    943       i -= 200;
   944    944     }
   945    945     return cksum;
................................................................................
   983    983     if( pgno>(unsigned)pPager->dbSize ){
   984    984       return SQLITE_OK;
   985    985     }
   986    986     if( useCksum ){
   987    987       rc = read32bits(jfd, &cksum);
   988    988       if( rc ) return rc;
   989    989       pPager->journalOff += 4;
   990         -    if( pager_cksum(pPager, pgno, aData)!=cksum ){
          990  +    if( pager_cksum(pPager, aData)!=cksum ){
   991    991         return SQLITE_DONE;
   992    992       }
   993    993     }
   994    994   
   995    995     assert( pPager->state==PAGER_RESERVED || pPager->state>=PAGER_EXCLUSIVE );
   996    996   
   997    997     /* If the pager is in RESERVED state, then there must be a copy of this
................................................................................
  2066   2066     /* Remove the pager from the linked list of pagers starting at 
  2067   2067     ** ThreadData.pPager if memory-management is enabled.
  2068   2068     */
  2069   2069     if( pPager==pTsd->pPager ){
  2070   2070       pTsd->pPager = pPager->pNext;
  2071   2071     }else{
  2072   2072       Pager *pTmp;
  2073         -    for(pTmp = pTsd->pPager; pTmp->pNext!=pPager; pTmp=pTmp->pNext);
         2073  +    for(pTmp = pTsd->pPager; pTmp->pNext!=pPager; pTmp=pTmp->pNext){}
  2074   2074       pTmp->pNext = pPager->pNext;
  2075   2075     }
  2076   2076   #endif
  2077   2077   
  2078   2078     sqliteFree(pPager);
  2079   2079     return SQLITE_OK;
  2080   2080   }
................................................................................
  2473   2473           */
  2474   2474           PgHdr *pTmp;
  2475   2475           assert( pPg );
  2476   2476           page_remove_from_stmt_list(pPg);
  2477   2477           if( pPg==p->pAll ){
  2478   2478              p->pAll = pPg->pNextAll;
  2479   2479           }else{
  2480         -          for( pTmp=p->pAll; pTmp->pNextAll!=pPg; pTmp=pTmp->pNextAll );
         2480  +          for( pTmp=p->pAll; pTmp->pNextAll!=pPg; pTmp=pTmp->pNextAll ){}
  2481   2481             pTmp->pNextAll = pPg->pNextAll;
  2482   2482           }
  2483   2483           nReleased += sqliteAllocSize(pPg);
  2484   2484           sqliteFree(pPg);
  2485   2485         }
  2486   2486   
  2487   2487         if( rc!=SQLITE_OK ){
................................................................................
  3019   3019           }else{
  3020   3020             u32 cksum;
  3021   3021             /* We should never write to the journal file the page that
  3022   3022             ** contains the database locks.  The following assert verifies
  3023   3023             ** that we do not. */
  3024   3024             assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) );
  3025   3025             CODEC(pPager, pData, pPg->pgno, 7);
  3026         -          cksum = pager_cksum(pPager, pPg->pgno, pData);
         3026  +          cksum = pager_cksum(pPager, pData);
  3027   3027             saved = *(u32*)PGHDR_TO_EXTRA(pPg, pPager);
  3028   3028             store32bits(cksum, pPg, pPager->pageSize);
  3029   3029             szPg = pPager->pageSize+8;
  3030   3030             store32bits(pPg->pgno, pPg, -4);
  3031   3031   
  3032   3032             rc = sqlite3OsWrite(pPager->jfd, &((char*)pData)[-4], szPg);
  3033   3033             pPager->journalOff += szPg;

Changes to src/parse.y.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains SQLite's grammar for SQL.  Process this file
    13     13   ** using the lemon parser generator to generate C code that runs
    14     14   ** the parser.  Lemon will also generate a header file containing
    15     15   ** numeric codes for all of the tokens.
    16     16   **
    17         -** @(#) $Id: parse.y,v 1.195 2006/02/10 02:27:43 danielk1977 Exp $
           17  +** @(#) $Id: parse.y,v 1.196 2006/02/24 02:53:50 drh Exp $
    18     18   */
    19     19   
    20     20   // All token codes are small integers with #defines that begin with "TK_"
    21     21   %token_prefix TK_
    22     22   
    23     23   // The type of the data attached to each token is Token.  This is also the
    24     24   // default type for non-terminals.
................................................................................
   116    116   cmd ::= COMMIT trans_opt.      {sqlite3CommitTransaction(pParse);}
   117    117   cmd ::= END trans_opt.         {sqlite3CommitTransaction(pParse);}
   118    118   cmd ::= ROLLBACK trans_opt.    {sqlite3RollbackTransaction(pParse);}
   119    119   
   120    120   ///////////////////// The CREATE TABLE statement ////////////////////////////
   121    121   //
   122    122   cmd ::= create_table create_table_args.
   123         -create_table ::= CREATE(X) temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
   124         -   sqlite3StartTable(pParse,&X,&Y,&Z,T,0,E);
          123  +create_table ::= CREATE temp(T) TABLE ifnotexists(E) nm(Y) dbnm(Z). {
          124  +   sqlite3StartTable(pParse,&Y,&Z,T,0,E);
   125    125   }
   126    126   %type ifnotexists {int}
   127    127   ifnotexists(A) ::= .              {A = 0;}
   128    128   ifnotexists(A) ::= IF NOT EXISTS. {A = 1;}
   129    129   %type temp {int}
   130    130   %ifndef SQLITE_OMIT_TEMPDB
   131    131   temp(A) ::= TEMP.  {A = 1;}
................................................................................
   880    880   
   881    881   ///////////////////////////// The DROP INDEX command /////////////////////////
   882    882   //
   883    883   cmd ::= DROP INDEX ifexists(E) fullname(X).   {sqlite3DropIndex(pParse, X, E);}
   884    884   
   885    885   ///////////////////////////// The VACUUM command /////////////////////////////
   886    886   //
   887         -cmd ::= VACUUM.                {sqlite3Vacuum(pParse,0);}
   888         -cmd ::= VACUUM nm.             {sqlite3Vacuum(pParse,0);}
          887  +cmd ::= VACUUM.                {sqlite3Vacuum(pParse);}
          888  +cmd ::= VACUUM nm.             {sqlite3Vacuum(pParse);}
   889    889   
   890    890   ///////////////////////////// The PRAGMA command /////////////////////////////
   891    891   //
   892    892   %ifndef SQLITE_OMIT_PRAGMA
   893    893   cmd ::= PRAGMA nm(X) dbnm(Z) EQ nm(Y).  {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
   894    894   cmd ::= PRAGMA nm(X) dbnm(Z) EQ ON(Y).  {sqlite3Pragma(pParse,&X,&Z,&Y,0);}
   895    895   cmd ::= PRAGMA nm(X) dbnm(Z) EQ plus_num(Y). {sqlite3Pragma(pParse,&X,&Z,&Y,0);}

Changes to src/printf.c.

   440    440           }
   441    441           if( xtype==etGENERIC && precision>0 ) precision--;
   442    442   #if 0
   443    443           /* Rounding works like BSD when the constant 0.4999 is used.  Wierd! */
   444    444           for(idx=precision, rounder=0.4999; idx>0; idx--, rounder*=0.1);
   445    445   #else
   446    446           /* It makes more sense to use 0.5 */
   447         -        for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1);
          447  +        for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){}
   448    448   #endif
   449    449           if( xtype==etFLOAT ) realvalue += rounder;
   450    450           /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
   451    451           exp = 0;
   452    452           if( realvalue>0.0 ){
   453    453             while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; }
   454    454             while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; }

Changes to src/select.c.

     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   ** This file contains C code routines that are called by the parser
    13     13   ** to handle SELECT statements in SQLite.
    14     14   **
    15         -** $Id: select.c,v 1.304 2006/02/10 07:07:16 danielk1977 Exp $
           15  +** $Id: select.c,v 1.305 2006/02/24 02:53:50 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   
    20     20   /*
    21     21   ** Delete all the content of a Select structure but do not deallocate
    22     22   ** the select structure itself.
................................................................................
   676    676   /*
   677    677   ** If the inner loop was generated using a non-null pOrderBy argument,
   678    678   ** then the results were placed in a sorter.  After the loop is terminated
   679    679   ** we need to run the sorter and output the results.  The following
   680    680   ** routine generates the code needed to do that.
   681    681   */
   682    682   static void generateSortTail(
   683         -  Parse *pParse,   /* The parsing context */
   684    683     Select *p,       /* The SELECT statement */
   685    684     Vdbe *v,         /* Generate code into this VDBE */
   686    685     int nColumn,     /* Number of columns of data */
   687    686     int eDest,       /* Write the sorted results here */
   688    687     int iParm        /* Optional parameter associated with eDest */
   689    688   ){
   690    689     int brk = sqlite3VdbeMakeLabel(v);
................................................................................
  1961   1960         assert( p->pRightmost==p );
  1962   1961         assert( p->addrOpenVirt[2]>=0 );
  1963   1962         addr = p->addrOpenVirt[2];
  1964   1963         sqlite3VdbeChangeP2(v, addr, p->pEList->nExpr+2);
  1965   1964         pKeyInfo->nField = nOrderByExpr;
  1966   1965         sqlite3VdbeChangeP3(v, addr, (char*)pKeyInfo, P3_KEYINFO_HANDOFF);
  1967   1966         pKeyInfo = 0;
  1968         -      generateSortTail(pParse, p, v, p->pEList->nExpr, eDest, iParm);
         1967  +      generateSortTail(p, v, p->pEList->nExpr, eDest, iParm);
  1969   1968       }
  1970   1969   
  1971   1970       sqliteFree(pKeyInfo);
  1972   1971     }
  1973   1972   
  1974   1973   multi_select_end:
  1975   1974     return rc;
................................................................................
  2113   2112   ** If flattening is not attempted, this routine is a no-op and returns 0.
  2114   2113   ** If flattening is attempted this routine returns 1.
  2115   2114   **
  2116   2115   ** All of the expression analysis must occur on both the outer query and
  2117   2116   ** the subquery before this routine runs.
  2118   2117   */
  2119   2118   static int flattenSubquery(
  2120         -  Parse *pParse,       /* The parsing context */
  2121   2119     Select *p,           /* The parent or outer SELECT statement */
  2122   2120     int iFrom,           /* Index in p->pSrc->a[] of the inner subquery */
  2123   2121     int isAgg,           /* True if outer SELECT uses aggregate functions */
  2124   2122     int subqueryIsAgg    /* True if the subquery uses aggregate functions */
  2125   2123   ){
  2126   2124     Select *pSub;       /* The inner query or "subquery" */
  2127   2125     SrcList *pSrc;      /* The FROM clause of the outer query */
................................................................................
  2898   2896     }
  2899   2897   
  2900   2898     /* Check to see if this is a subquery that can be "flattened" into its parent.
  2901   2899     ** If flattening is a possiblity, do so and return immediately.  
  2902   2900     */
  2903   2901   #ifndef SQLITE_OMIT_VIEW
  2904   2902     if( pParent && pParentAgg &&
  2905         -      flattenSubquery(pParse, pParent, parentTab, *pParentAgg, isAgg) ){
         2903  +      flattenSubquery(pParent, parentTab, *pParentAgg, isAgg) ){
  2906   2904       if( isAgg ) *pParentAgg = 1;
  2907   2905       goto select_end;
  2908   2906     }
  2909   2907   #endif
  2910   2908   
  2911   2909     /* If there is an ORDER BY clause, resolve any collation sequences
  2912   2910     ** names that have been explicitly specified and create a sorting index.
................................................................................
  3250   3248       
  3251   3249     } /* endif aggregate query */
  3252   3250   
  3253   3251     /* If there is an ORDER BY clause, then we need to sort the results
  3254   3252     ** and send them to the callback one by one.
  3255   3253     */
  3256   3254     if( pOrderBy ){
  3257         -    generateSortTail(pParse, p, v, pEList->nExpr, eDest, iParm);
         3255  +    generateSortTail(p, v, pEList->nExpr, eDest, iParm);
  3258   3256     }
  3259   3257   
  3260   3258   #ifndef SQLITE_OMIT_SUBQUERY
  3261   3259     /* If this was a subquery, we have now converted the subquery into a
  3262   3260     ** temporary table.  So set the SrcList_item.isPopulated flag to prevent
  3263   3261     ** this subquery from being evaluated again and to force the use of
  3264   3262     ** the temporary table.

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.486 2006/02/17 15:01:36 danielk1977 Exp $
           14  +** @(#) $Id: sqliteInt.h,v 1.487 2006/02/24 02:53:50 drh Exp $
    15     15   */
    16     16   #ifndef _SQLITEINT_H_
    17     17   #define _SQLITEINT_H_
    18     18   
    19     19   /*
    20     20   ** Extra interface definitions for those who need them
    21     21   */
................................................................................
  1515   1515   void sqlite3Pragma(Parse*,Token*,Token*,Token*,int);
  1516   1516   void sqlite3ResetInternalSchema(sqlite3*, int);
  1517   1517   void sqlite3BeginParse(Parse*,int);
  1518   1518   void sqlite3RollbackInternalChanges(sqlite3*);
  1519   1519   void sqlite3CommitInternalChanges(sqlite3*);
  1520   1520   Table *sqlite3ResultSetOfSelect(Parse*,char*,Select*);
  1521   1521   void sqlite3OpenMasterTable(Parse *, int);
  1522         -void sqlite3StartTable(Parse*,Token*,Token*,Token*,int,int,int);
         1522  +void sqlite3StartTable(Parse*,Token*,Token*,int,int,int);
  1523   1523   void sqlite3AddColumn(Parse*,Token*);
  1524   1524   void sqlite3AddNotNull(Parse*, int);
  1525   1525   void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int);
  1526   1526   void sqlite3AddCheckConstraint(Parse*, Expr*);
  1527   1527   void sqlite3AddColumnType(Parse*,Token*);
  1528   1528   void sqlite3AddDefaultValue(Parse*,Expr*);
  1529   1529   void sqlite3AddCollateType(Parse*, const char*, int);
................................................................................
  1571   1571   void sqlite3ExprIfFalse(Parse*, Expr*, int, int);
  1572   1572   void sqlite3NextedParse(Parse*, const char*, ...);
  1573   1573   Table *sqlite3FindTable(sqlite3*,const char*, const char*);
  1574   1574   Table *sqlite3LocateTable(Parse*,const char*, const char*);
  1575   1575   Index *sqlite3FindIndex(sqlite3*,const char*, const char*);
  1576   1576   void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*);
  1577   1577   void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
  1578         -void sqlite3Vacuum(Parse*, Token*);
         1578  +void sqlite3Vacuum(Parse*);
  1579   1579   int sqlite3RunVacuum(char**, sqlite3*);
  1580   1580   char *sqlite3NameFromToken(Token*);
  1581   1581   int sqlite3ExprCheck(Parse*, Expr*, int, int*);
  1582   1582   int sqlite3ExprCompare(Expr*, Expr*);
  1583   1583   int sqliteFuncId(Token*);
  1584   1584   int sqlite3ExprResolveNames(NameContext *, Expr *);
  1585   1585   int sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
................................................................................
  1592   1592   void sqlite3CommitTransaction(Parse*);
  1593   1593   void sqlite3RollbackTransaction(Parse*);
  1594   1594   int sqlite3ExprIsConstant(Expr*);
  1595   1595   int sqlite3ExprIsConstantOrFunction(Expr*);
  1596   1596   int sqlite3ExprIsInteger(Expr*, int*);
  1597   1597   int sqlite3IsRowid(const char*);
  1598   1598   void sqlite3GenerateRowDelete(sqlite3*, Vdbe*, Table*, int, int);
  1599         -void sqlite3GenerateRowIndexDelete(sqlite3*, Vdbe*, Table*, int, char*);
         1599  +void sqlite3GenerateRowIndexDelete(Vdbe*, Table*, int, char*);
  1600   1600   void sqlite3GenerateIndexKey(Vdbe*, Index*, int);
  1601   1601   void sqlite3GenerateConstraintChecks(Parse*,Table*,int,char*,int,int,int,int);
  1602   1602   void sqlite3CompleteInsertion(Parse*, Table*, int, char*, int, int, int);
  1603   1603   void sqlite3OpenTableAndIndices(Parse*, Table*, int, int);
  1604   1604   void sqlite3BeginWriteOperation(Parse*, int, int);
  1605   1605   Expr *sqlite3ExprDup(Expr*);
  1606   1606   void sqlite3TokenCopy(Token*, Token*);
................................................................................
  1617   1617   void sqlite3ChangeCookie(sqlite3*, Vdbe*, int);
  1618   1618   
  1619   1619   #ifndef SQLITE_OMIT_TRIGGER
  1620   1620     void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*,
  1621   1621                              int,Expr*,int);
  1622   1622     void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*);
  1623   1623     void sqlite3DropTrigger(Parse*, SrcList*);
  1624         -  void sqlite3DropTriggerPtr(Parse*, Trigger*, int);
         1624  +  void sqlite3DropTriggerPtr(Parse*, Trigger*);
  1625   1625     int sqlite3TriggersExist(Parse*, Table*, int, ExprList*);
  1626   1626     int sqlite3CodeRowTrigger(Parse*, int, ExprList*, int, Table *, int, int, 
  1627   1627                              int, int);
  1628   1628     void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*);
  1629   1629     void sqlite3DeleteTriggerStep(TriggerStep*);
  1630   1630     TriggerStep *sqlite3TriggerSelectStep(Select*);
  1631   1631     TriggerStep *sqlite3TriggerInsertStep(Token*, IdList*, ExprList*,Select*,int);

Changes to src/trigger.c.

   456    456       pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName+1);
   457    457       if( pTrigger ) break;
   458    458     }
   459    459     if( !pTrigger ){
   460    460       sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0);
   461    461       goto drop_trigger_cleanup;
   462    462     }
   463         -  sqlite3DropTriggerPtr(pParse, pTrigger, 0);
          463  +  sqlite3DropTriggerPtr(pParse, pTrigger);
   464    464   
   465    465   drop_trigger_cleanup:
   466    466     sqlite3SrcListDelete(pName);
   467    467   }
   468    468   
   469    469   /*
   470    470   ** Return a pointer to the Table structure for the table that a trigger
   471    471   ** is set on.
   472    472   */
   473         -static Table *tableOfTrigger(sqlite3 *db, Trigger *pTrigger){
          473  +static Table *tableOfTrigger(Trigger *pTrigger){
   474    474     int n = strlen(pTrigger->table) + 1;
   475    475     return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table, n);
   476    476   }
   477    477   
   478    478   
   479    479   /*
   480         -** Drop a trigger given a pointer to that trigger.  If nested is false,
   481         -** then also generate code to remove the trigger from the SQLITE_MASTER
   482         -** table.
          480  +** Drop a trigger given a pointer to that trigger. 
   483    481   */
   484         -void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger, int nested){
          482  +void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){
   485    483     Table   *pTable;
   486    484     Vdbe *v;
   487    485     sqlite3 *db = pParse->db;
   488    486     int iDb;
   489    487   
   490    488     iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema);
   491    489     assert( iDb>=0 && iDb<db->nDb );
   492         -  pTable = tableOfTrigger(db, pTrigger);
          490  +  pTable = tableOfTrigger(pTrigger);
   493    491     assert(pTable);
   494    492     assert( pTable->pSchema==pTrigger->pSchema || iDb==1 );
   495    493   #ifndef SQLITE_OMIT_AUTHORIZATION
   496    494     {
   497    495       int code = SQLITE_DROP_TRIGGER;
   498    496       const char *zDb = db->aDb[iDb].zName;
   499    497       const char *zTab = SCHEMA_TABLE(iDb);
................................................................................
   535    533   ** Remove a trigger from the hash tables of the sqlite* pointer.
   536    534   */
   537    535   void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){
   538    536     Trigger *pTrigger;
   539    537     int nName = strlen(zName);
   540    538     pTrigger = sqlite3HashInsert(&(db->aDb[iDb].pSchema->trigHash), zName, nName+1, 0);
   541    539     if( pTrigger ){
   542         -    Table *pTable = tableOfTrigger(db, pTrigger);
          540  +    Table *pTable = tableOfTrigger(pTrigger);
   543    541       assert( pTable!=0 );
   544    542       if( pTable->pTrigger == pTrigger ){
   545    543         pTable->pTrigger = pTrigger->pNext;
   546    544       }else{
   547    545         Trigger *cc = pTable->pTrigger;
   548    546         while( cc ){ 
   549    547           if( cc->pNext == pTrigger ){
................................................................................
   757    755       if( 
   758    756         p->op==op && 
   759    757         p->tr_tm==tr_tm && 
   760    758         (p->pSchema==p->pTabSchema || p->pSchema==pParse->db->aDb[1].pSchema) &&
   761    759         (op!=TK_UPDATE||!p->pColumns||checkColumnOverLap(p->pColumns,pChanges))
   762    760       ){
   763    761         TriggerStack *pS;      /* Pointer to trigger-stack entry */
   764         -      for(pS=pParse->trigStack; pS && p!=pS->pTrigger; pS=pS->pNext);
          762  +      for(pS=pParse->trigStack; pS && p!=pS->pTrigger; pS=pS->pNext){}
   765    763         if( !pS ){
   766    764           fire_this = 1;
   767    765         }
   768    766       }
   769    767    
   770    768       if( fire_this ){
   771    769         int endTrigger;

Changes to src/update.c.

     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   ** This file contains C code routines that are called by the parser
    13     13   ** to handle UPDATE statements.
    14     14   **
    15         -** $Id: update.c,v 1.122 2006/02/10 02:27:43 danielk1977 Exp $
           15  +** $Id: update.c,v 1.123 2006/02/24 02:53:50 drh Exp $
    16     16   */
    17     17   #include "sqliteInt.h"
    18     18   
    19     19   /*
    20     20   ** The most recently coded instruction was an OP_Column to retrieve the
    21     21   ** i-th column of table pTab. This routine sets the P3 parameter of the 
    22     22   ** OP_Column to the default value, if any.
................................................................................
   427    427       /* Do constraint checks
   428    428       */
   429    429       sqlite3GenerateConstraintChecks(pParse, pTab, iCur, aIdxUsed, chngRowid, 1,
   430    430                                      onError, addr);
   431    431   
   432    432       /* Delete the old indices for the current record.
   433    433       */
   434         -    sqlite3GenerateRowIndexDelete(db, v, pTab, iCur, aIdxUsed);
          434  +    sqlite3GenerateRowIndexDelete(v, pTab, iCur, aIdxUsed);
   435    435   
   436    436       /* If changing the record number, delete the old record.
   437    437       */
   438    438       if( chngRowid ){
   439    439         sqlite3VdbeAddOp(v, OP_Delete, iCur, 0);
   440    440       }
   441    441   

Changes to src/utf.c.

     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   ** This file contains routines used to translate between UTF-8, 
    13     13   ** UTF-16, UTF-16BE, and UTF-16LE.
    14     14   **
    15         -** $Id: utf.c,v 1.37 2006/01/24 10:58:22 danielk1977 Exp $
           15  +** $Id: utf.c,v 1.38 2006/02/24 02:53:50 drh Exp $
    16     16   **
    17     17   ** Notes on UTF-8:
    18     18   **
    19     19   **   Byte-0    Byte-1    Byte-2    Byte-3    Value
    20     20   **  0xxxxxxx                                 00000000 00000000 0xxxxxxx
    21     21   **  110yyyyy  10xxxxxx                       00000000 00000yyy yyxxxxxx
    22     22   **  1110zzzz  10yyyyyy  10xxxxxx             00000000 zzzzyyyy yyxxxxxx
................................................................................
   251    251     assert( pMem->enc!=desiredEnc );
   252    252     assert( pMem->enc!=0 );
   253    253     assert( pMem->n>=0 );
   254    254   
   255    255   #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
   256    256     {
   257    257       char zBuf[100];
   258         -    sqlite3VdbeMemPrettyPrint(pMem, zBuf, 100);
          258  +    sqlite3VdbeMemPrettyPrint(pMem, zBuf);
   259    259       fprintf(stderr, "INPUT:  %s\n", zBuf);
   260    260     }
   261    261   #endif
   262    262   
   263    263     /* If the translation is between UTF-16 little and big endian, then 
   264    264     ** all that is required is to swap the byte order. This case is handled
   265    265     ** differently from the others.
................................................................................
   367    367     }
   368    368     pMem->z = (char*)zOut;
   369    369   
   370    370   translate_out:
   371    371   #if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG)
   372    372     {
   373    373       char zBuf[100];
   374         -    sqlite3VdbeMemPrettyPrint(pMem, zBuf, 100);
          374  +    sqlite3VdbeMemPrettyPrint(pMem, zBuf);
   375    375       fprintf(stderr, "OUTPUT: %s\n", zBuf);
   376    376     }
   377    377   #endif
   378    378     return SQLITE_OK;
   379    379   }
   380    380   
   381    381   /*

Changes to src/util.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** Utility functions used throughout sqlite.
    13     13   **
    14     14   ** This file contains functions for allocating memory, comparing
    15     15   ** strings, and stuff like that.
    16     16   **
    17         -** $Id: util.c,v 1.185 2006/02/14 10:48:39 danielk1977 Exp $
           17  +** $Id: util.c,v 1.186 2006/02/24 02:53:50 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "os.h"
    21     21   #include <stdarg.h>
    22     22   #include <ctype.h>
    23     23   
    24     24   /*
................................................................................
   543    543   static int enforceSoftLimit(int n){
   544    544     ThreadData *pTsd = sqlite3ThreadData();
   545    545     if( pTsd==0 ){
   546    546       return 0;
   547    547     }
   548    548     assert( pTsd->nAlloc>=0 );
   549    549     if( n>0 && pTsd->nSoftHeapLimit>0 ){
   550         -    while( pTsd->nAlloc+n>pTsd->nSoftHeapLimit && sqlite3_release_memory(n) );
          550  +    while( pTsd->nAlloc+n>pTsd->nSoftHeapLimit && sqlite3_release_memory(n) ){}
   551    551     }
   552    552     return 1;
   553    553   }
   554    554   #else
   555    555   # define enforceSoftLimit(X)  1
   556    556   #endif
   557    557   
................................................................................
   582    582   ** Allocate and return N bytes of uninitialised memory by calling
   583    583   ** sqlite3OsMalloc(). If the Malloc() call fails, attempt to free memory 
   584    584   ** by calling sqlite3_release_memory().
   585    585   */
   586    586   void *sqlite3MallocRaw(int n, int doMemManage){
   587    587     void *p = 0;
   588    588     if( n>0 && !sqlite3MallocFailed() && (!doMemManage || enforceSoftLimit(n)) ){
   589         -    while( (p = OSMALLOC(n))==0 && sqlite3_release_memory(n) );
          589  +    while( (p = OSMALLOC(n))==0 && sqlite3_release_memory(n) ){}
   590    590       if( !p ){
   591    591         sqlite3FailedMalloc();
   592    592         OSMALLOC_FAILED();
   593    593       }else if( doMemManage ){
   594    594         updateMemoryUsedCount(OSSIZEOF(p));
   595    595       }
   596    596     }
................................................................................
   611    611       return sqlite3Malloc(n, 1);
   612    612     }else{
   613    613       void *np = 0;
   614    614   #ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT
   615    615       int origSize = OSSIZEOF(p);
   616    616   #endif
   617    617       if( enforceSoftLimit(n - origSize) ){
   618         -      while( (np = OSREALLOC(p, n))==0 && sqlite3_release_memory(n) );
          618  +      while( (np = OSREALLOC(p, n))==0 && sqlite3_release_memory(n) ){}
   619    619         if( !np ){
   620    620           sqlite3FailedMalloc();
   621    621           OSMALLOC_FAILED();
   622    622         }else{
   623    623           updateMemoryUsedCount(OSSIZEOF(np) - origSize);
   624    624         }
   625    625       }

Changes to src/vacuum.c.

    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code used to implement the VACUUM command.
    13     13   **
    14     14   ** Most of the code in this file may be omitted by defining the
    15     15   ** SQLITE_OMIT_VACUUM macro.
    16     16   **
    17         -** $Id: vacuum.c,v 1.58 2006/01/18 16:51:36 danielk1977 Exp $
           17  +** $Id: vacuum.c,v 1.59 2006/02/24 02:53:50 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include "vdbeInt.h"
    21     21   #include "os.h"
    22     22   
    23     23   #ifndef SQLITE_OMIT_VACUUM
    24     24   /*
................................................................................
    39     39   ** Execute zSql on database db. Return an error code.
    40     40   */
    41     41   static int execSql(sqlite3 *db, const char *zSql){
    42     42     sqlite3_stmt *pStmt;
    43     43     if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){
    44     44       return sqlite3_errcode(db);
    45     45     }
    46         -  while( SQLITE_ROW==sqlite3_step(pStmt) );
           46  +  while( SQLITE_ROW==sqlite3_step(pStmt) ){}
    47     47     return sqlite3_finalize(pStmt);
    48     48   }
    49     49   
    50     50   /*
    51     51   ** Execute zSql on database db. The statement returns exactly
    52     52   ** one column. Execute this as SQL on the same database.
    53     53   */
................................................................................
    77     77   ** in PostgreSQL.
    78     78   **
    79     79   ** In version 1.0.x of SQLite, the VACUUM command would call
    80     80   ** gdbm_reorganize() on all the database tables.  But beginning
    81     81   ** with 2.0.0, SQLite no longer uses GDBM so this command has
    82     82   ** become a no-op.
    83     83   */
    84         -void sqlite3Vacuum(Parse *pParse, Token *pTableName){
           84  +void sqlite3Vacuum(Parse *pParse){
    85     85     Vdbe *v = sqlite3GetVdbe(pParse);
    86     86     if( v ){
    87     87       sqlite3VdbeAddOp(v, OP_Vacuum, 0, 0);
    88     88     }
    89     89     return;
    90     90   }
    91     91   

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.543 2006/02/10 14:02:07 drh Exp $
           46  +** $Id: vdbe.c,v 1.544 2006/02/24 02:53:50 drh 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   /*
................................................................................
   276    276   }
   277    277   
   278    278   #ifdef SQLITE_DEBUG
   279    279   /*
   280    280   ** Write a nice string representation of the contents of cell pMem
   281    281   ** into buffer zBuf, length nBuf.
   282    282   */
   283         -void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf, int nBuf){
          283  +void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
   284    284     char *zCsr = zBuf;
   285    285     int f = pMem->flags;
   286    286   
   287    287     static const char *const encnames[] = {"(X)", "(8)", "(16LE)", "(16BE)"};
   288    288   
   289    289     if( f&MEM_Blob ){
   290    290       int i;
................................................................................
  3009   3009   
  3010   3010       /* Make sure K is a string and make zKey point to K
  3011   3011       */
  3012   3012       Stringify(pNos, encoding);
  3013   3013       zKey = pNos->z;
  3014   3014       nKey = pNos->n;
  3015   3015   
  3016         -    szRowid = sqlite3VdbeIdxRowidLen(nKey, (u8*)zKey);
         3016  +    szRowid = sqlite3VdbeIdxRowidLen((u8*)zKey);
  3017   3017       len = nKey-szRowid;
  3018   3018   
  3019   3019       /* Search for an entry in P1 where all but the last four bytes match K.
  3020   3020       ** If there is no such entry, jump immediately to P2.
  3021   3021       */
  3022   3022       assert( pCx->deferredMoveto==0 );
  3023   3023       pCx->cacheStatus = CACHE_STALE;
................................................................................
  4596   4596       ** of the program.  It is only here for testing and debugging.
  4597   4597       ** On the other hand, it does burn CPU cycles every time through
  4598   4598       ** the evaluator loop.  So we can leave it out when NDEBUG is defined.
  4599   4599       */
  4600   4600   #ifndef NDEBUG
  4601   4601       /* Sanity checking on the top element of the stack */
  4602   4602       if( pTos>=p->aStack ){
  4603         -      sqlite3VdbeMemSanity(pTos, encoding);
         4603  +      sqlite3VdbeMemSanity(pTos);
  4604   4604       }
  4605   4605       assert( pc>=-1 && pc<p->nOp );
  4606   4606   #ifdef SQLITE_DEBUG
  4607   4607       /* Code for tracing the vdbe stack. */
  4608   4608       if( p->trace && pTos>=p->aStack ){
  4609   4609         int i;
  4610   4610         fprintf(p->trace, "Stack:");
................................................................................
  4615   4615             fprintf(p->trace, " si:%lld", pTos[i].i);
  4616   4616           }else if( pTos[i].flags & MEM_Int ){
  4617   4617             fprintf(p->trace, " i:%lld", pTos[i].i);
  4618   4618           }else if( pTos[i].flags & MEM_Real ){
  4619   4619             fprintf(p->trace, " r:%g", pTos[i].r);
  4620   4620           }else{
  4621   4621             char zBuf[100];
  4622         -          sqlite3VdbeMemPrettyPrint(&pTos[i], zBuf, 100);
         4622  +          sqlite3VdbeMemPrettyPrint(&pTos[i], zBuf);
  4623   4623             fprintf(p->trace, " ");
  4624   4624             fprintf(p->trace, "%s", zBuf);
  4625   4625           }
  4626   4626         }
  4627   4627         if( rc!=0 ) fprintf(p->trace," rc=%d",rc);
  4628   4628         fprintf(p->trace,"\n");
  4629   4629       }

Changes to src/vdbeInt.h.

   346    346   void sqlite3VdbeDeleteAuxData(VdbeFunc*, int);
   347    347   
   348    348   int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *);
   349    349   int sqlite3VdbeIdxKeyCompare(Cursor*, int , const unsigned char*, int*);
   350    350   int sqlite3VdbeIdxRowid(BtCursor *, i64 *);
   351    351   int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
   352    352   int sqlite3VdbeRecordCompare(void*,int,const void*,int, const void*);
   353         -int sqlite3VdbeIdxRowidLen(int,const u8*);
          353  +int sqlite3VdbeIdxRowidLen(const u8*);
   354    354   int sqlite3VdbeExec(Vdbe*);
   355    355   int sqlite3VdbeList(Vdbe*);
   356    356   int sqlite3VdbeHalt(Vdbe*);
   357    357   int sqlite3VdbeChangeEncoding(Mem *, int);
   358    358   int sqlite3VdbeMemCopy(Mem*, const Mem*);
   359    359   void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
   360    360   int sqlite3VdbeMemMove(Mem*, Mem*);
................................................................................
   372    372   void sqlite3VdbeIntegerAffinity(Mem*);
   373    373   int sqlite3VdbeMemRealify(Mem*);
   374    374   int sqlite3VdbeMemNumerify(Mem*);
   375    375   int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
   376    376   void sqlite3VdbeMemRelease(Mem *p);
   377    377   int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
   378    378   #ifndef NDEBUG
   379         -void sqlite3VdbeMemSanity(Mem*, u8);
          379  +void sqlite3VdbeMemSanity(Mem*);
   380    380   int sqlite3VdbeOpcodeNoPush(u8);
   381    381   #endif
   382    382   int sqlite3VdbeMemTranslate(Mem*, u8);
   383         -void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf, int nBuf);
          383  +void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
   384    384   int sqlite3VdbeMemHandleBom(Mem *pMem);
   385    385   void sqlite3VdbeFifoInit(Fifo*);
   386    386   int sqlite3VdbeFifoPush(Fifo*, i64);
   387    387   int sqlite3VdbeFifoPop(Fifo*, i64*);
   388    388   void sqlite3VdbeFifoClear(Fifo*);

Changes to src/vdbeaux.c.

  1837   1837   
  1838   1838   /*
  1839   1839   ** The argument is an index entry composed using the OP_MakeRecord opcode.
  1840   1840   ** The last entry in this record should be an integer (specifically
  1841   1841   ** an integer rowid).  This routine returns the number of bytes in
  1842   1842   ** that integer.
  1843   1843   */
  1844         -int sqlite3VdbeIdxRowidLen(int nKey, const u8 *aKey){
         1844  +int sqlite3VdbeIdxRowidLen(const u8 *aKey){
  1845   1845     u32 szHdr;        /* Size of the header */
  1846   1846     u32 typeRowid;    /* Serial type of the rowid */
  1847   1847   
  1848   1848     sqlite3GetVarint32(aKey, &szHdr);
  1849   1849     sqlite3GetVarint32(&aKey[szHdr-1], &typeRowid);
  1850   1850     return sqlite3VdbeSerialTypeLen(typeRowid);
  1851   1851   }
................................................................................
  1907   1907       *res = 0;
  1908   1908       return SQLITE_OK;
  1909   1909     }
  1910   1910     rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, nCellKey, 1, &m);
  1911   1911     if( rc ){
  1912   1912       return rc;
  1913   1913     }
  1914         -  lenRowid = sqlite3VdbeIdxRowidLen(m.n, (u8*)m.z);
         1914  +  lenRowid = sqlite3VdbeIdxRowidLen((u8*)m.z);
  1915   1915     *res = sqlite3VdbeRecordCompare(pC->pKeyInfo, m.n-lenRowid, m.z, nKey, pKey);
  1916   1916     sqlite3VdbeMemRelease(&m);
  1917   1917     return SQLITE_OK;
  1918   1918   }
  1919   1919   
  1920   1920   /*
  1921   1921   ** This routine sets the value to be returned by subsequent calls to

Changes to src/vdbemem.c.

   707    707   }
   708    708   
   709    709   #ifndef NDEBUG
   710    710   /*
   711    711   ** Perform various checks on the memory cell pMem. An assert() will
   712    712   ** fail if pMem is internally inconsistent.
   713    713   */
   714         -void sqlite3VdbeMemSanity(Mem *pMem, u8 db_enc){
          714  +void sqlite3VdbeMemSanity(Mem *pMem){
   715    715     int flags = pMem->flags;
   716    716     assert( flags!=0 );  /* Must define some type */
   717    717     if( pMem->flags & (MEM_Str|MEM_Blob) ){
   718    718       int x = pMem->flags & (MEM_Static|MEM_Dyn|MEM_Ephem|MEM_Short);
   719    719       assert( x!=0 );            /* Strings must define a string subtype */
   720    720       assert( (x & (x-1))==0 );  /* Only one string subtype can be defined */
   721    721       assert( pMem->z!=0 );      /* Strings must have a value */

Changes to src/where.c.

    12     12   ** This module contains C code that generates VDBE code used to process
    13     13   ** the WHERE clause of SQL statements.  This module is reponsible for
    14     14   ** generating the code that loops through a table looking for applicable
    15     15   ** rows.  Indices are selected and used to speed the search when doing
    16     16   ** so is applicable.  Because this module is responsible for selecting
    17     17   ** indices, you might also think of this module as the "query optimizer".
    18     18   **
    19         -** $Id: where.c,v 1.204 2006/02/01 02:45:02 drh Exp $
           19  +** $Id: where.c,v 1.205 2006/02/24 02:53:51 drh Exp $
    20     20   */
    21     21   #include "sqliteInt.h"
    22     22   
    23     23   /*
    24     24   ** The number of bits in a Bitmask.  "BMS" means "BitMask Size".
    25     25   */
    26     26   #define BMS  (sizeof(Bitmask)*8)
................................................................................
   767    767   ** index do not need to satisfy this constraint.)  The *pbRev value is
   768    768   ** set to 1 if the ORDER BY clause is all DESC and it is set to 0 if
   769    769   ** the ORDER BY clause is all ASC.
   770    770   */
   771    771   static int isSortingIndex(
   772    772     Parse *pParse,          /* Parsing context */
   773    773     Index *pIdx,            /* The index we are testing */
   774         -  Table *pTab,            /* The table to be sorted */
   775         -  int base,               /* Cursor number for pTab */
          774  +  int base,               /* Cursor number for the table to be sorted */
   776    775     ExprList *pOrderBy,     /* The ORDER BY clause */
   777    776     int nEqCol,             /* Number of index columns with == constraints */
   778    777     int *pbRev              /* Set to 1 if ORDER BY is DESC */
   779    778   ){
   780    779     int i, j;                       /* Loop counters */
   781    780     int sortOrder = 0;              /* XOR of index and ORDER BY sort direction */
   782    781     int nTerm;                      /* Number of ORDER BY terms */
................................................................................
  1053   1052         }
  1054   1053       }
  1055   1054   
  1056   1055       /* Add the additional cost of sorting if that is a factor.
  1057   1056       */
  1058   1057       if( pOrderBy ){
  1059   1058         if( (flags & WHERE_COLUMN_IN)==0 &&
  1060         -           isSortingIndex(pParse,pProbe,pSrc->pTab,iCur,pOrderBy,nEq,&rev) ){
         1059  +           isSortingIndex(pParse,pProbe,iCur,pOrderBy,nEq,&rev) ){
  1061   1060           if( flags==0 ){
  1062   1061             flags = WHERE_COLUMN_RANGE;
  1063   1062           }
  1064   1063           flags |= WHERE_ORDERBY;
  1065   1064           if( rev ){
  1066   1065             flags |= WHERE_REVERSE;
  1067   1066           }
................................................................................
  1587   1586       iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
  1588   1587       if( pTab->isTransient || pTab->pSelect ) continue;
  1589   1588       if( (pLevel->flags & WHERE_IDX_ONLY)==0 ){
  1590   1589         sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, OP_OpenRead);
  1591   1590         if( pTab->nCol<(sizeof(Bitmask)*8) ){
  1592   1591           Bitmask b = pTabItem->colUsed;
  1593   1592           int n = 0;
  1594         -        for(; b; b=b>>1, n++);
         1593  +        for(; b; b=b>>1, n++){}
  1595   1594           sqlite3VdbeChangeP2(v, sqlite3VdbeCurrentAddr(v)-1, n);
  1596   1595           assert( n<=pTab->nCol );
  1597   1596         }
  1598   1597       }else{
  1599   1598         sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName);
  1600   1599       }
  1601   1600       pLevel->iTabCur = pTabItem->iCursor;