/ Check-in [dfa9ea89]
Login

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

Overview
Comment:Comment changes and minor code cleanup. (CVS 1940)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dfa9ea89c473e1fea804ad07e8e58a9af1e92f6c
User & Date: drh 2004-09-05 23:23:42
Context
2004-09-06
17:24
Fix a naming conflict between sqlite versions 2 and 3. An open sqlite3 connection now *must* be called "sqlite3". You cannot call it "sqlite". This might break existing code. (CVS 1941) check-in: 3ddf5a9d user: drh tags: trunk
2004-09-05
23:23
Comment changes and minor code cleanup. (CVS 1940) check-in: dfa9ea89 user: drh tags: trunk
00:33
Make VACUUM work when the page size is different than the default 1024. Ticket #890. (CVS 1939) check-in: fa82beca user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/attach.c.

     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   ** This file contains code used to implement the ATTACH and DETACH commands.
    13     13   **
    14         -** $Id: attach.c,v 1.26 2004/08/01 03:52:18 drh Exp $
           14  +** $Id: attach.c,v 1.27 2004/09/05 23:23:42 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   
    18     18   /*
    19     19   ** This routine is called by the parser to process an ATTACH statement:
    20     20   **
    21     21   **     ATTACH DATABASE filename AS dbname
................................................................................
    24     24   ** filename and dbname in the ATTACH statement.
    25     25   */
    26     26   void sqlite3Attach(
    27     27     Parse *pParse,       /* The parser context */
    28     28     Token *pFilename,    /* Name of database file */
    29     29     Token *pDbname,      /* Name of the database to use internally */
    30     30     int keyType,         /* 0: no key.  1: TEXT,  2: BLOB */
    31         -  Token *pKey          /* Text of the key for keytype 2 and 3 */
           31  +  Token *pKey          /* Text of the key for keytype 1 and 2 */
    32     32   ){
    33     33     Db *aNew;
    34     34     int rc, i;
    35     35     char *zFile, *zName;
    36     36     sqlite *db;
    37     37     Vdbe *v;
    38     38   
................................................................................
   198    198   **
   199    199   ** The return value indicates whether or not fixation is required.  TRUE
   200    200   ** means we do need to fix the database references, FALSE means we do not.
   201    201   */
   202    202   int sqlite3FixInit(
   203    203     DbFixer *pFix,      /* The fixer to be initialized */
   204    204     Parse *pParse,      /* Error messages will be written here */
   205         -  int iDb,            /* This is the database that must must be used */
          205  +  int iDb,            /* This is the database that must be used */
   206    206     const char *zType,  /* "view", "trigger", or "index" */
   207    207     const Token *pName  /* Name of the view, trigger, or index */
   208    208   ){
   209    209     sqlite *db;
   210    210   
   211    211     if( iDb<0 || iDb==1 ) return 0;
   212    212     db = pParse->db;
................................................................................
   234    234   */
   235    235   int sqlite3FixSrcList(
   236    236     DbFixer *pFix,       /* Context of the fixation */
   237    237     SrcList *pList       /* The Source list to check and modify */
   238    238   ){
   239    239     int i;
   240    240     const char *zDb;
          241  +  struct SrcList_item *pItem;
   241    242   
   242    243     if( pList==0 ) return 0;
   243    244     zDb = pFix->zDb;
   244         -  for(i=0; i<pList->nSrc; i++){
   245         -    if( pList->a[i].zDatabase==0 ){
   246         -      pList->a[i].zDatabase = sqliteStrDup(zDb);
   247         -    }else if( sqlite3StrICmp(pList->a[i].zDatabase,zDb)!=0 ){
          245  +  for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){
          246  +    if( pItem->zDatabase==0 ){
          247  +      pItem->zDatabase = sqliteStrDup(zDb);
          248  +    }else if( sqlite3StrICmp(pItem->zDatabase,zDb)!=0 ){
   248    249         sqlite3ErrorMsg(pFix->pParse,
   249         -         "%s %z cannot reference objects in database %s",
   250         -         pFix->zType, sqliteStrNDup(pFix->pName->z, pFix->pName->n),
   251         -         pList->a[i].zDatabase);
          250  +         "%s %T cannot reference objects in database %s",
          251  +         pFix->zType, pFix->pName, pItem->zDatabase);
   252    252         return 1;
   253    253       }
   254         -    if( sqlite3FixSelect(pFix, pList->a[i].pSelect) ) return 1;
   255         -    if( sqlite3FixExpr(pFix, pList->a[i].pOn) ) return 1;
          254  +    if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1;
          255  +    if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1;
   256    256     }
   257    257     return 0;
   258    258   }
   259    259   int sqlite3FixSelect(
   260    260     DbFixer *pFix,       /* Context of the fixation */
   261    261     Select *pSelect      /* The SELECT statement to be fixed to one database */
   262    262   ){
................................................................................
   296    296     return 0;
   297    297   }
   298    298   int sqlite3FixExprList(
   299    299     DbFixer *pFix,     /* Context of the fixation */
   300    300     ExprList *pList    /* The expression to be fixed to one database */
   301    301   ){
   302    302     int i;
          303  +  struct ExprList_item *pItem;
   303    304     if( pList==0 ) return 0;
   304         -  for(i=0; i<pList->nExpr; i++){
   305         -    if( sqlite3FixExpr(pFix, pList->a[i].pExpr) ){
          305  +  for(i=0, pItem=pList->a; i<pList->nExpr; i++, pItem++){
          306  +    if( sqlite3FixExpr(pFix, pItem->pExpr) ){
   306    307         return 1;
   307    308       }
   308    309     }
   309    310     return 0;
   310    311   }
   311    312   int sqlite3FixTriggerStep(
   312    313     DbFixer *pFix,     /* Context of the fixation */

Changes to src/pragma.c.

     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   ** This file contains code used to implement the PRAGMA command.
    13     13   **
    14         -** $Id: pragma.c,v 1.62 2004/09/02 15:14:01 drh Exp $
           14  +** $Id: pragma.c,v 1.63 2004/09/05 23:23:42 drh Exp $
    15     15   */
    16     16   #include "sqliteInt.h"
    17     17   #include <ctype.h>
    18     18   
    19     19   #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST)
    20     20   # include "pager.h"
    21     21   # include "btree.h"
................................................................................
    24     24   /*
    25     25   ** Interpret the given string as a boolean value.
    26     26   */
    27     27   static int getBoolean(const u8 *z){
    28     28     static const u8 *azTrue[] = { "yes", "on", "true" };
    29     29     int i;
    30     30     if( z[0]==0 ) return 0;
    31         -  if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){
           31  +  if( sqlite3IsNumber(z, 0, SQLITE_UTF8) ){
    32     32       return atoi(z);
    33     33     }
    34     34     for(i=0; i<sizeof(azTrue)/sizeof(azTrue[0]); i++){
    35     35       if( sqlite3StrICmp(z,azTrue[i])==0 ) return 1;
    36     36     }
    37     37     return 0;
    38     38   }
................................................................................
    58     58       { "yes",   1 },
    59     59       { "on",    1 },
    60     60       { "true",  1 },
    61     61       { "full",  2 },
    62     62     };
    63     63     int i;
    64     64     if( z[0]==0 ) return 1;
    65         -  if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){
           65  +  if( sqlite3IsNumber(z, 0, SQLITE_UTF8) ){
    66     66       return atoi(z);
    67     67     }
    68     68     for(i=0; i<sizeof(aKey)/sizeof(aKey[0]); i++){
    69     69       if( sqlite3StrICmp(z,aKey[i].zWord)==0 ) return aKey[i].val;
    70     70     }
    71     71     return 1;
    72     72   }

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.114 2004/08/31 00:52:37 drh Exp $
           17  +** $Id: util.c,v 1.115 2004/09/05 23:23:42 drh Exp $
    18     18   */
    19     19   #include "sqliteInt.h"
    20     20   #include <stdarg.h>
    21     21   #include <ctype.h>
    22     22   
    23     23   #if SQLITE_DEBUG>2 && defined(__GLIBC__)
    24     24   #include <execinfo.h>
................................................................................
   587    587   
   588    588   /*
   589    589   ** Return TRUE if z is a pure numeric string.  Return FALSE if the
   590    590   ** string contains any character which is not part of a number. If
   591    591   ** the string is numeric and contains the '.' character, set *realnum
   592    592   ** to TRUE (otherwise FALSE).
   593    593   **
   594         -** Am empty string is considered non-numeric.
          594  +** An empty string is considered non-numeric.
   595    595   */
   596    596   int sqlite3IsNumber(const char *z, int *realnum, u8 enc){
   597    597     int incr = (enc==SQLITE_UTF8?1:2);
   598    598     if( enc==SQLITE_UTF16BE ) z++;
   599    599     if( *z=='-' || *z=='+' ) z += incr;
   600    600     if( !isdigit(*(u8*)z) ){
   601    601       return 0;
................................................................................
   718    718   /*
   719    719   ** The string zNum represents an integer.  There might be some other
   720    720   ** information following the integer too, but that part is ignored.
   721    721   ** If the integer that the prefix of zNum represents will fit in a
   722    722   ** 32-bit signed integer, return TRUE.  Otherwise return FALSE.
   723    723   **
   724    724   ** This routine returns FALSE for the string -2147483648 even that
   725         -** that number will, in theory fit in a 32-bit integer.  But positive
          725  +** that number will in fact fit in a 32-bit integer.  But positive
   726    726   ** 2147483648 will not fit in 32 bits.  So it seems safer to return
   727    727   ** false.
   728    728   */
   729    729   static int sqlite3FitsIn32Bits(const char *zNum){
   730    730     int i, c;
   731    731     if( *zNum=='-' || *zNum=='+' ) zNum++;
   732    732     for(i=0; (c=zNum[i])>='0' && c<='9'; i++){}