diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/attach.c | 29 | ||||
-rw-r--r-- | src/pragma.c | 6 | ||||
-rw-r--r-- | src/util.c | 6 |
3 files changed, 21 insertions, 20 deletions
diff --git a/src/attach.c b/src/attach.c index 8b9782328..bd2c48f0e 100644 --- a/src/attach.c +++ b/src/attach.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the ATTACH and DETACH commands. ** -** $Id: attach.c,v 1.26 2004/08/01 03:52:18 drh Exp $ +** $Id: attach.c,v 1.27 2004/09/05 23:23:42 drh Exp $ */ #include "sqliteInt.h" @@ -28,7 +28,7 @@ void sqlite3Attach( Token *pFilename, /* Name of database file */ Token *pDbname, /* Name of the database to use internally */ int keyType, /* 0: no key. 1: TEXT, 2: BLOB */ - Token *pKey /* Text of the key for keytype 2 and 3 */ + Token *pKey /* Text of the key for keytype 1 and 2 */ ){ Db *aNew; int rc, i; @@ -202,7 +202,7 @@ void sqlite3Detach(Parse *pParse, Token *pDbname){ int sqlite3FixInit( DbFixer *pFix, /* The fixer to be initialized */ Parse *pParse, /* Error messages will be written here */ - int iDb, /* This is the database that must must be used */ + int iDb, /* This is the database that must be used */ const char *zType, /* "view", "trigger", or "index" */ const Token *pName /* Name of the view, trigger, or index */ ){ @@ -238,21 +238,21 @@ int sqlite3FixSrcList( ){ int i; const char *zDb; + struct SrcList_item *pItem; if( pList==0 ) return 0; zDb = pFix->zDb; - for(i=0; i<pList->nSrc; i++){ - if( pList->a[i].zDatabase==0 ){ - pList->a[i].zDatabase = sqliteStrDup(zDb); - }else if( sqlite3StrICmp(pList->a[i].zDatabase,zDb)!=0 ){ + for(i=0, pItem=pList->a; i<pList->nSrc; i++, pItem++){ + if( pItem->zDatabase==0 ){ + pItem->zDatabase = sqliteStrDup(zDb); + }else if( sqlite3StrICmp(pItem->zDatabase,zDb)!=0 ){ sqlite3ErrorMsg(pFix->pParse, - "%s %z cannot reference objects in database %s", - pFix->zType, sqliteStrNDup(pFix->pName->z, pFix->pName->n), - pList->a[i].zDatabase); + "%s %T cannot reference objects in database %s", + pFix->zType, pFix->pName, pItem->zDatabase); return 1; } - if( sqlite3FixSelect(pFix, pList->a[i].pSelect) ) return 1; - if( sqlite3FixExpr(pFix, pList->a[i].pOn) ) return 1; + if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; + if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1; } return 0; } @@ -300,9 +300,10 @@ int sqlite3FixExprList( ExprList *pList /* The expression to be fixed to one database */ ){ int i; + struct ExprList_item *pItem; if( pList==0 ) return 0; - for(i=0; i<pList->nExpr; i++){ - if( sqlite3FixExpr(pFix, pList->a[i].pExpr) ){ + for(i=0, pItem=pList->a; i<pList->nExpr; i++, pItem++){ + if( sqlite3FixExpr(pFix, pItem->pExpr) ){ return 1; } } diff --git a/src/pragma.c b/src/pragma.c index 4c94c0fd7..d21f7699b 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -11,7 +11,7 @@ ************************************************************************* ** This file contains code used to implement the PRAGMA command. ** -** $Id: pragma.c,v 1.62 2004/09/02 15:14:01 drh Exp $ +** $Id: pragma.c,v 1.63 2004/09/05 23:23:42 drh Exp $ */ #include "sqliteInt.h" #include <ctype.h> @@ -28,7 +28,7 @@ static int getBoolean(const u8 *z){ static const u8 *azTrue[] = { "yes", "on", "true" }; int i; if( z[0]==0 ) return 0; - if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){ + if( sqlite3IsNumber(z, 0, SQLITE_UTF8) ){ return atoi(z); } for(i=0; i<sizeof(azTrue)/sizeof(azTrue[0]); i++){ @@ -62,7 +62,7 @@ static int getSafetyLevel(u8 *z){ }; int i; if( z[0]==0 ) return 1; - if( isdigit(z[0]) || (z[0]=='-' && isdigit(z[1])) ){ + if( sqlite3IsNumber(z, 0, SQLITE_UTF8) ){ return atoi(z); } for(i=0; i<sizeof(aKey)/sizeof(aKey[0]); i++){ diff --git a/src/util.c b/src/util.c index f31359620..0ce4e7db1 100644 --- a/src/util.c +++ b/src/util.c @@ -14,7 +14,7 @@ ** This file contains functions for allocating memory, comparing ** strings, and stuff like that. ** -** $Id: util.c,v 1.114 2004/08/31 00:52:37 drh Exp $ +** $Id: util.c,v 1.115 2004/09/05 23:23:42 drh Exp $ */ #include "sqliteInt.h" #include <stdarg.h> @@ -591,7 +591,7 @@ int sqlite3StrNICmp(const char *zLeft, const char *zRight, int N){ ** the string is numeric and contains the '.' character, set *realnum ** to TRUE (otherwise FALSE). ** -** Am empty string is considered non-numeric. +** An empty string is considered non-numeric. */ int sqlite3IsNumber(const char *z, int *realnum, u8 enc){ int incr = (enc==SQLITE_UTF8?1:2); @@ -722,7 +722,7 @@ int sqlite3atoi64(const char *zNum, i64 *pNum){ ** 32-bit signed integer, return TRUE. Otherwise return FALSE. ** ** This routine returns FALSE for the string -2147483648 even that -** that number will, in theory fit in a 32-bit integer. But positive +** that number will in fact fit in a 32-bit integer. But positive ** 2147483648 will not fit in 32 bits. So it seems safer to return ** false. */ |