1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Rename some variables to avoid hiding others. Also add "static" to two function signatures that were missing it. (CVS 3024)

FossilOrigin-Name: d86f18a4277ebffb644ba2e574e0b697c8bbf8e4
This commit is contained in:
danielk1977
2006-01-24 12:09:17 +00:00
parent 7246f5b9cb
commit f011300000
14 changed files with 105 additions and 107 deletions

View File

@@ -1,5 +1,5 @@
C Coverage\simprovements\sfor\smain.c.\s(CVS\s3023) C Rename\ssome\svariables\sto\savoid\shiding\sothers.\sAlso\sadd\s"static"\sto\stwo\sfunction\ssignatures\sthat\swere\smissing\sit.\s(CVS\s3024)
D 2006-01-24T11:30:27 D 2006-01-24T12:09:18
F Makefile.in 53841eb72e9eeb6030a8ce28c2595a92f440fd10 F Makefile.in 53841eb72e9eeb6030a8ce28c2595a92f440fd10
F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec F Makefile.linux-gcc 74ba0eadf88748a9ce3fd03d2a3ede2e6715baec
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
@@ -32,21 +32,21 @@ F sqlite3.def f756049b1bf3e8442baf6862db393ca423225262
F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a F sqlite3.pc.in 985b9bf34192a549d7d370e0f0b6b34a4f61369a
F src/alter.c 90b779cf00489535cab6490df6dc050f40e4e874 F src/alter.c 90b779cf00489535cab6490df6dc050f40e4e874
F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a F src/analyze.c 7d2b7ab9a9c2fd6e55700f69064dfdd3e36d7a8a
F src/attach.c 0081040e9a5d13669b6712e947688c10f030bfc1 F src/attach.c d73a3505de3fb9e373d0a158978116c4212031d0
F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2 F src/auth.c 9ae84d2d94eb96195e04515715e08e85963e96c2
F src/btree.c e3cb390f7da8ebe9d81ffb59df2a9f9b65f9d344 F src/btree.c e3cb390f7da8ebe9d81ffb59df2a9f9b65f9d344
F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184 F src/btree.h 5663c4f43e8521546ccebc8fc95acb013b8f3184
F src/build.c 15224e2fd348ad32b9044aaa5bdc912e4067da15 F src/build.c feaa61e769d7887ffeaa060d746638c7b3e994ef
F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2 F src/callback.c 1bf497306c32229114f826707054df7ebe10abf2
F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675 F src/complete.c 7d1a44be8f37de125fcafd3d3a018690b3799675
F src/date.c 2f148728b53675266cd9e1a873fd702929d3f4ee F src/date.c c70a4f88e495ae2c523f6ef3848c26a021c96de8
F src/delete.c d92db30012503e0b1db45ff95dd0efd7118eaae7 F src/delete.c 56ab34c3a384caa5d5ea06f5739944957e2e4213
F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d F src/experimental.c 50c1e3b34f752f4ac10c36f287db095c2b61766d
F src/expr.c 62f044ebff77bd7f486e3f214a963f0bfffd5d1b F src/expr.c cda707cc5e55394b1597493b8e2456aa18bdaaa0
F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a F src/func.c 96b26601c092b7b43a13e440e3f988b32a385f6a
F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863 F src/hash.c 8747cf51d12de46512880dfcf1b68b4e24072863
F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84 F src/hash.h 1b0c445e1c89ff2aaad9b4605ba61375af001e84
F src/insert.c 4d37e285459af9bc2ff92ae237285b12cd5e8a71 F src/insert.c 7e931b7f06afbcefcbbaab175c02eff8268db33f
F src/legacy.c 86b669707b3cefd570e34154e2f6457547d1df4f F src/legacy.c 86b669707b3cefd570e34154e2f6457547d1df4f
F src/main.c 439168db0a830efd0b9e7325aff39adc5524a1b5 F src/main.c 439168db0a830efd0b9e7325aff39adc5524a1b5
F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217 F src/md5.c c5fdfa5c2593eaee2e32a5ce6c6927c986eaf217
@@ -57,16 +57,16 @@ F src/os_test.c 49833426101f99aee4bb5f6a44b7c4b2029fda1c
F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3 F src/os_test.h 903c93554c23d88f34f667f1979e4a1cee792af3
F src/os_unix.c b25eca667f926d24b542fb20378b3665feccfe2b F src/os_unix.c b25eca667f926d24b542fb20378b3665feccfe2b
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 63718af58c981734058881db307349839d3ba48a F src/os_win.c 566bf7b41b72556fd7dca390bceaa2769dc395e9
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c b101634a093451017068c4fd80af966bd5042edc F src/pager.c c4d18015a4eadebe91cffe2a9e08011c134e5aa2
F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f F src/pager.h e0acb095b3ad0bca48f2ab00c87346665643f64f
F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029 F src/parse.y 4285cd2d0f31a8db4c4d54325f88e500452fa029
F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3 F src/pragma.c 4496cc77dc35824e1c978c3d1413b8a5a4c777d3
F src/prepare.c 6349208568d7967a3d1b6625e5af736fd0d5d264 F src/prepare.c 6349208568d7967a3d1b6625e5af736fd0d5d264
F src/printf.c f47a2f4b5387cd2ebb12e9117a1a5d6bd9a2b812 F src/printf.c c7d6ad9efb71c466305297a448308f467b6e2b6e
F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261 F src/random.c d40f8d356cecbd351ccfab6eaedd7ec1b54f5261
F src/select.c 8b3ffcb68f05e88b7f1a3089161511ea8ed0f21a F src/select.c daee9b20702ba51cf3807fc1b130edd8846e3e48
F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96 F src/server.c 087b92a39d883e3fa113cae259d64e4c7438bc96
F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da F src/shell.c 66b073375efbdee19045e7e0cd38b85f9aff71da
F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3 F src/sqlite.h.in 492580f7e3ff71eb43193eb7bb98e2d549889ce3
@@ -87,14 +87,14 @@ F src/update.c 14be4ba2f438919b4217085c02feff569e6cf1f2
F src/utf.c 1199766bbb0157931a83aa6eede6b6381177be64 F src/utf.c 1199766bbb0157931a83aa6eede6b6381177be64
F src/util.c 82ee598519b8193184bdeab06b51a4ffa05ad60b F src/util.c 82ee598519b8193184bdeab06b51a4ffa05ad60b
F src/vacuum.c 3865673cc66acd0717ecd517f6b8fdb2a5e7924b F src/vacuum.c 3865673cc66acd0717ecd517f6b8fdb2a5e7924b
F src/vdbe.c 484a724611113426744caa295be6ee947cc51317 F src/vdbe.c bda7131d98f2a742f864f9bbbb5249f3c0c6b432
F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13 F src/vdbe.h 8729a4ee16ff9aeab2af9667df3cf300ff978e13
F src/vdbeInt.h eb3f86ab08ef11635bc78eb88c3ff13f923c233b F src/vdbeInt.h eb3f86ab08ef11635bc78eb88c3ff13f923c233b
F src/vdbeapi.c dcb2636f49b4807e34960d52a2fc257b3a751140 F src/vdbeapi.c dcb2636f49b4807e34960d52a2fc257b3a751140
F src/vdbeaux.c 0c27d3b3bd8dda7ed73eb8fcfa74350ca6633895 F src/vdbeaux.c 0c27d3b3bd8dda7ed73eb8fcfa74350ca6633895
F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5 F src/vdbefifo.c 9efb94c8c3f4c979ebd0028219483f88e57584f5
F src/vdbemem.c 2034e93b32c14bda6e306bb54e3a8e930b963027 F src/vdbemem.c 2034e93b32c14bda6e306bb54e3a8e930b963027
F src/where.c f79bc17f6228f69181da3dfc97986a690bce25ce F src/where.c 8409e00fa2cb5fce873b4c911165cfed097e9c49
F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42 F tclinstaller.tcl 046e3624671962dc50f0481d7c25b38ef803eb42
F test/aggerror.test b854de90f530ae37be68fbfe6de40e111358cbb2 F test/aggerror.test b854de90f530ae37be68fbfe6de40e111358cbb2
F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4 F test/all.test 5df90d015ca63fcef2a4b62c24f7316b66c4bfd4
@@ -344,7 +344,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b F www/version3.tcl a99cf5f6d8bd4d5537584a2b342f0fb9fa601d8b
F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513
P 153940af5af4f775fa3b1784931d3fd1e41764c5 P 50964ef9b0159bfdcd7eae88b0806957cab184dc
R 808f7cf1b6819c6083583a3c88c10faa R fc67d17ec10c28fa4fe646ce8c0e9586
U danielk1977 U danielk1977
Z 0d98e456d7f981b2795b996f007cd430 Z 38f8621f1508c75b5e0809f898b0dbd0

View File

@@ -1 +1 @@
50964ef9b0159bfdcd7eae88b0806957cab184dc d86f18a4277ebffb644ba2e574e0b697c8bbf8e4

View File

@@ -11,7 +11,7 @@
************************************************************************* *************************************************************************
** This file contains code used to implement the ATTACH and DETACH commands. ** This file contains code used to implement the ATTACH and DETACH commands.
** **
** $Id: attach.c,v 1.48 2006/01/18 16:51:35 danielk1977 Exp $ ** $Id: attach.c,v 1.49 2006/01/24 12:09:18 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -33,7 +33,7 @@
** **
** will fail because neither abc or def can be resolved. ** will fail because neither abc or def can be resolved.
*/ */
int resolveAttachExpr(NameContext *pName, Expr *pExpr) static int resolveAttachExpr(NameContext *pName, Expr *pExpr)
{ {
int rc = SQLITE_OK; int rc = SQLITE_OK;
if( pExpr ){ if( pExpr ){
@@ -176,15 +176,15 @@ static void attachFunc(
sqlite3SafetyOff(db); sqlite3SafetyOff(db);
} }
if( rc ){ if( rc ){
int i = db->nDb - 1; int iDb = db->nDb - 1;
assert( i>=2 ); assert( iDb>=2 );
if( db->aDb[i].pBt ){ if( db->aDb[iDb].pBt ){
sqlite3BtreeClose(db->aDb[i].pBt); sqlite3BtreeClose(db->aDb[iDb].pBt);
db->aDb[i].pBt = 0; db->aDb[iDb].pBt = 0;
db->aDb[i].pSchema = 0; db->aDb[iDb].pSchema = 0;
} }
sqlite3ResetInternalSchema(db, 0); sqlite3ResetInternalSchema(db, 0);
db->nDb = i; db->nDb = iDb;
sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile); sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
goto attach_error; goto attach_error;
} }

View File

@@ -22,7 +22,7 @@
** COMMIT ** COMMIT
** ROLLBACK ** ROLLBACK
** **
** $Id: build.c,v 1.382 2006/01/18 16:51:35 danielk1977 Exp $ ** $Id: build.c,v 1.383 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -3157,10 +3157,10 @@ void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){
assert( pName1->z ); assert( pName1->z );
pColl = sqlite3FindCollSeq(db, ENC(db), (char*)pName1->z, pName1->n, 0); pColl = sqlite3FindCollSeq(db, ENC(db), (char*)pName1->z, pName1->n, 0);
if( pColl ){ if( pColl ){
char *z = sqliteStrNDup((const char *)pName1->z, pName1->n); char *zColl = sqliteStrNDup((const char *)pName1->z, pName1->n);
if( z ){ if( zColl ){
reindexDatabases(pParse, z); reindexDatabases(pParse, zColl);
sqliteFree(z); sqliteFree(zColl);
} }
return; return;
} }

View File

@@ -16,7 +16,7 @@
** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
** All other code has file scope. ** All other code has file scope.
** **
** $Id: date.c,v 1.52 2006/01/17 13:21:40 danielk1977 Exp $ ** $Id: date.c,v 1.53 2006/01/24 12:09:19 danielk1977 Exp $
** **
** NOTES: ** NOTES:
** **
@@ -818,20 +818,20 @@ static void strftimeFunc(
case 'H': sprintf(&z[j],"%02d",x.h); j+=2; break; case 'H': sprintf(&z[j],"%02d",x.h); j+=2; break;
case 'W': /* Fall thru */ case 'W': /* Fall thru */
case 'j': { case 'j': {
int n; /* Number of days since 1st day of year */ int nDay; /* Number of days since 1st day of year */
DateTime y = x; DateTime y = x;
y.validJD = 0; y.validJD = 0;
y.M = 1; y.M = 1;
y.D = 1; y.D = 1;
computeJD(&y); computeJD(&y);
n = x.rJD - y.rJD; nDay = x.rJD - y.rJD;
if( zFmt[i]=='W' ){ if( zFmt[i]=='W' ){
int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */
wd = ((int)(x.rJD+0.5)) % 7; wd = ((int)(x.rJD+0.5)) % 7;
sprintf(&z[j],"%02d",(n+7-wd)/7); sprintf(&z[j],"%02d",(nDay+7-wd)/7);
j += 2; j += 2;
}else{ }else{
sprintf(&z[j],"%03d",n+1); sprintf(&z[j],"%03d",nDay+1);
j += 3; j += 3;
} }
break; break;

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** in order to generate code for DELETE FROM statements. ** in order to generate code for DELETE FROM statements.
** **
** $Id: delete.c,v 1.119 2006/01/18 16:51:35 danielk1977 Exp $ ** $Id: delete.c,v 1.120 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -210,13 +210,13 @@ void sqlite3DeleteFrom(
/* If counting rows deleted, just count the total number of /* If counting rows deleted, just count the total number of
** entries in the table. */ ** entries in the table. */
int endOfLoop = sqlite3VdbeMakeLabel(v); int endOfLoop = sqlite3VdbeMakeLabel(v);
int addr; int addr2;
if( !isView ){ if( !isView ){
sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead); sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
} }
sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2); sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
addr = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0); addr2 = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
sqlite3VdbeAddOp(v, OP_Next, iCur, addr); sqlite3VdbeAddOp(v, OP_Next, iCur, addr2);
sqlite3VdbeResolveLabel(v, endOfLoop); sqlite3VdbeResolveLabel(v, endOfLoop);
sqlite3VdbeAddOp(v, OP_Close, iCur, 0); sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
} }

View File

@@ -12,7 +12,7 @@
** This file contains routines used for analyzing expressions and ** This file contains routines used for analyzing expressions and
** for generating VDBE code that evaluates expressions in SQLite. ** for generating VDBE code that evaluates expressions in SQLite.
** **
** $Id: expr.c,v 1.251 2006/01/23 05:50:58 danielk1977 Exp $ ** $Id: expr.c,v 1.252 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include <ctype.h> #include <ctype.h>
@@ -918,17 +918,17 @@ static int lookupName(
} }
if( pTab ){ if( pTab ){
int j; int iCol;
Column *pCol = pTab->aCol; Column *pCol = pTab->aCol;
pExpr->pSchema = pTab->pSchema; pExpr->pSchema = pTab->pSchema;
cntTab++; cntTab++;
for(j=0; j < pTab->nCol; j++, pCol++) { for(iCol=0; iCol < pTab->nCol; iCol++, pCol++) {
if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
const char *zColl = pTab->aCol[j].zColl; const char *zColl = pTab->aCol[iCol].zColl;
cnt++; cnt++;
pExpr->iColumn = j==pTab->iPKey ? -1 : j; pExpr->iColumn = iCol==pTab->iPKey ? -1 : iCol;
pExpr->affinity = pTab->aCol[j].affinity; pExpr->affinity = pTab->aCol[iCol].affinity;
pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0); pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
pExpr->pTab = pTab; pExpr->pTab = pTab;
break; break;
@@ -1077,20 +1077,19 @@ lookupname_end_2:
*/ */
static int nameResolverStep(void *pArg, Expr *pExpr){ static int nameResolverStep(void *pArg, Expr *pExpr){
NameContext *pNC = (NameContext*)pArg; NameContext *pNC = (NameContext*)pArg;
SrcList *pSrcList;
Parse *pParse; Parse *pParse;
if( pExpr==0 ) return 1; if( pExpr==0 ) return 1;
assert( pNC!=0 ); assert( pNC!=0 );
pSrcList = pNC->pSrcList;
pParse = pNC->pParse; pParse = pNC->pParse;
if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return 1; if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return 1;
ExprSetProperty(pExpr, EP_Resolved); ExprSetProperty(pExpr, EP_Resolved);
#ifndef NDEBUG #ifndef NDEBUG
if( pSrcList && pSrcList->nAlloc>0 ){ if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
SrcList *pSrcList = pNC->pSrcList;
int i; int i;
for(i=0; i<pSrcList->nSrc; i++){ for(i=0; i<pNC->pSrcList->nSrc; i++){
assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab); assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursor<pParse->nTab);
} }
} }
@@ -1380,9 +1379,9 @@ void sqlite3CodeSubselect(Parse *pParse, Expr *pExpr){
*/ */
if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){ if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){
VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1); VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1);
int i; int j;
for(i=0; i<3; i++){ for(j=0; j<3; j++){
aOp[i].opcode = OP_Noop; aOp[j].opcode = OP_Noop;
} }
testAddr = 0; testAddr = 0;
} }
@@ -1548,16 +1547,16 @@ void sqlite3ExprCode(Parse *pParse, Expr *pExpr){
#ifndef SQLITE_OMIT_CAST #ifndef SQLITE_OMIT_CAST
case TK_CAST: { case TK_CAST: {
/* Expressions of the form: CAST(pLeft AS token) */ /* Expressions of the form: CAST(pLeft AS token) */
int aff, op; int aff, to_op;
sqlite3ExprCode(pParse, pExpr->pLeft); sqlite3ExprCode(pParse, pExpr->pLeft);
aff = sqlite3AffinityType(&pExpr->token); aff = sqlite3AffinityType(&pExpr->token);
op = aff - SQLITE_AFF_TEXT + OP_ToText; to_op = aff - SQLITE_AFF_TEXT + OP_ToText;
assert( op==OP_ToText || aff!=SQLITE_AFF_TEXT ); assert( to_op==OP_ToText || aff!=SQLITE_AFF_TEXT );
assert( op==OP_ToBlob || aff!=SQLITE_AFF_NONE ); assert( to_op==OP_ToBlob || aff!=SQLITE_AFF_NONE );
assert( op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC ); assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC );
assert( op==OP_ToInt || aff!=SQLITE_AFF_INTEGER ); assert( to_op==OP_ToInt || aff!=SQLITE_AFF_INTEGER );
assert( op==OP_ToReal || aff!=SQLITE_AFF_REAL ); assert( to_op==OP_ToReal || aff!=SQLITE_AFF_REAL );
sqlite3VdbeAddOp(v, op, 0, 0); sqlite3VdbeAddOp(v, to_op, 0, 0);
stackChng = 0; stackChng = 0;
break; break;
} }

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle INSERT statements in SQLite. ** to handle INSERT statements in SQLite.
** **
** $Id: insert.c,v 1.159 2006/01/20 18:10:57 drh Exp $ ** $Id: insert.c,v 1.160 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -297,20 +297,20 @@ void sqlite3Insert(
*/ */
if( pTab->autoInc ){ if( pTab->autoInc ){
int iCur = pParse->nTab; int iCur = pParse->nTab;
int base = sqlite3VdbeCurrentAddr(v); int addr = sqlite3VdbeCurrentAddr(v);
counterRowid = pParse->nMem++; counterRowid = pParse->nMem++;
counterMem = pParse->nMem++; counterMem = pParse->nMem++;
sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenRead); sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenRead);
sqlite3VdbeAddOp(v, OP_Rewind, iCur, base+13); sqlite3VdbeAddOp(v, OP_Rewind, iCur, addr+13);
sqlite3VdbeAddOp(v, OP_Column, iCur, 0); sqlite3VdbeAddOp(v, OP_Column, iCur, 0);
sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);
sqlite3VdbeAddOp(v, OP_Ne, 0x100, base+12); sqlite3VdbeAddOp(v, OP_Ne, 0x100, addr+12);
sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0); sqlite3VdbeAddOp(v, OP_Rowid, iCur, 0);
sqlite3VdbeAddOp(v, OP_MemStore, counterRowid, 1); sqlite3VdbeAddOp(v, OP_MemStore, counterRowid, 1);
sqlite3VdbeAddOp(v, OP_Column, iCur, 1); sqlite3VdbeAddOp(v, OP_Column, iCur, 1);
sqlite3VdbeAddOp(v, OP_MemStore, counterMem, 1); sqlite3VdbeAddOp(v, OP_MemStore, counterMem, 1);
sqlite3VdbeAddOp(v, OP_Goto, 0, base+13); sqlite3VdbeAddOp(v, OP_Goto, 0, addr+13);
sqlite3VdbeAddOp(v, OP_Next, iCur, base+4); sqlite3VdbeAddOp(v, OP_Next, iCur, addr+4);
sqlite3VdbeAddOp(v, OP_Close, iCur, 0); sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
} }
#endif /* SQLITE_OMIT_AUTOINCREMENT */ #endif /* SQLITE_OMIT_AUTOINCREMENT */
@@ -680,10 +680,10 @@ void sqlite3Insert(
*/ */
if( pTab->autoInc ){ if( pTab->autoInc ){
int iCur = pParse->nTab; int iCur = pParse->nTab;
int base = sqlite3VdbeCurrentAddr(v); int addr = sqlite3VdbeCurrentAddr(v);
sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenWrite); sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
sqlite3VdbeAddOp(v, OP_MemLoad, counterRowid, 0); sqlite3VdbeAddOp(v, OP_MemLoad, counterRowid, 0);
sqlite3VdbeAddOp(v, OP_NotNull, -1, base+7); sqlite3VdbeAddOp(v, OP_NotNull, -1, addr+7);
sqlite3VdbeAddOp(v, OP_Pop, 1, 0); sqlite3VdbeAddOp(v, OP_Pop, 1, 0);
sqlite3VdbeAddOp(v, OP_NewRowid, iCur, 0); sqlite3VdbeAddOp(v, OP_NewRowid, iCur, 0);
sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0); sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);

View File

@@ -514,7 +514,7 @@ int sqlite3WinFileExists(const char *zFilename){
} }
/* Forward declaration */ /* Forward declaration */
int allocateWinFile(winFile *pInit, OsFile **pId); static int allocateWinFile(winFile *pInit, OsFile **pId);
/* /*
** Attempt to open a file for both reading and writing. If that ** Attempt to open a file for both reading and writing. If that
@@ -1289,7 +1289,7 @@ static const IoMethod sqlite3WinIoMethod = {
** to the value given in pInit and return a pointer to the new ** to the value given in pInit and return a pointer to the new
** OsFile. If we run out of memory, close the file and return NULL. ** OsFile. If we run out of memory, close the file and return NULL.
*/ */
int allocateWinFile(winFile *pInit, OsFile **pId){ static int allocateWinFile(winFile *pInit, OsFile **pId){
winFile *pNew; winFile *pNew;
pNew = sqliteMalloc( sizeof(*pNew) ); pNew = sqliteMalloc( sizeof(*pNew) );
if( pNew==0 ){ if( pNew==0 ){

View File

@@ -18,7 +18,7 @@
** file simultaneously, or one process from reading the database while ** file simultaneously, or one process from reading the database while
** another is writing. ** another is writing.
** **
** @(#) $Id: pager.c,v 1.254 2006/01/23 16:21:06 danielk1977 Exp $ ** @(#) $Id: pager.c,v 1.255 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#ifndef SQLITE_OMIT_DISKIO #ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -1444,17 +1444,17 @@ static int pager_stmt_playback(Pager *pPager){
} }
while( pPager->journalOff < szJ ){ while( pPager->journalOff < szJ ){
u32 nRec; u32 nJRec; /* Number of Journal Records */
u32 dummy; u32 dummy;
rc = readJournalHdr(pPager, szJ, &nRec, &dummy); rc = readJournalHdr(pPager, szJ, &nJRec, &dummy);
if( rc!=SQLITE_OK ){ if( rc!=SQLITE_OK ){
assert( rc!=SQLITE_DONE ); assert( rc!=SQLITE_DONE );
goto end_stmt_playback; goto end_stmt_playback;
} }
if( nRec==0 ){ if( nJRec==0 ){
nRec = (szJ - pPager->journalOff) / (pPager->pageSize+8); nJRec = (szJ - pPager->journalOff) / (pPager->pageSize+8);
} }
for(i=nRec-1; i>=0 && pPager->journalOff < szJ; i--){ for(i=nJRec-1; i>=0 && pPager->journalOff < szJ; i--){
rc = pager_playback_one_page(pPager, pPager->jfd, 1); rc = pager_playback_one_page(pPager, pPager->jfd, 1);
assert( rc!=SQLITE_DONE ); assert( rc!=SQLITE_DONE );
if( rc!=SQLITE_OK ) goto end_stmt_playback; if( rc!=SQLITE_OK ) goto end_stmt_playback;
@@ -2556,8 +2556,6 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
** database file, then it either needs to be played back or deleted. ** database file, then it either needs to be played back or deleted.
*/ */
if( hasHotJournal(pPager) ){ if( hasHotJournal(pPager) ){
int rc;
/* Get an EXCLUSIVE lock on the database file. At this point it is /* Get an EXCLUSIVE lock on the database file. At this point it is
** important that a RESERVED lock is not obtained on the way to the ** important that a RESERVED lock is not obtained on the way to the
** EXCLUSIVE lock. If it were, another process might open the ** EXCLUSIVE lock. If it were, another process might open the
@@ -2680,7 +2678,6 @@ int sqlite3pager_get(Pager *pPager, Pgno pgno, void **ppPage){
if( sqlite3pager_pagecount(pPager)<(int)pgno ){ if( sqlite3pager_pagecount(pPager)<(int)pgno ){
memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize); memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize);
}else{ }else{
int rc;
assert( MEMDB==0 ); assert( MEMDB==0 );
rc = sqlite3OsSeek(pPager->fd, (pgno-1)*(i64)pPager->pageSize); rc = sqlite3OsSeek(pPager->fd, (pgno-1)*(i64)pPager->pageSize);
if( rc==SQLITE_OK ){ if( rc==SQLITE_OK ){

View File

@@ -596,13 +596,13 @@ static int vxprintf(
break; break;
case etSQLESCAPE: case etSQLESCAPE:
case etSQLESCAPE2: { case etSQLESCAPE2: {
int i, j, n, c, isnull; int i, j, n, ch, isnull;
int needQuote; int needQuote;
char *arg = va_arg(ap,char*); char *escarg = va_arg(ap,char*);
isnull = arg==0; isnull = escarg==0;
if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)"); if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
for(i=n=0; (c=arg[i])!=0; i++){ for(i=n=0; (ch=escarg[i])!=0; i++){
if( c=='\'' ) n++; if( ch=='\'' ) n++;
} }
needQuote = !isnull && xtype==etSQLESCAPE2; needQuote = !isnull && xtype==etSQLESCAPE2;
n += i + 1 + needQuote*2; n += i + 1 + needQuote*2;
@@ -614,9 +614,9 @@ static int vxprintf(
} }
j = 0; j = 0;
if( needQuote ) bufpt[j++] = '\''; if( needQuote ) bufpt[j++] = '\'';
for(i=0; (c=arg[i])!=0; i++){ for(i=0; (ch=escarg[i])!=0; i++){
bufpt[j++] = c; bufpt[j++] = ch;
if( c=='\'' ) bufpt[j++] = c; if( ch=='\'' ) bufpt[j++] = ch;
} }
if( needQuote ) bufpt[j++] = '\''; if( needQuote ) bufpt[j++] = '\'';
bufpt[j] = 0; bufpt[j] = 0;

View File

@@ -12,7 +12,7 @@
** This file contains C code routines that are called by the parser ** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite. ** to handle SELECT statements in SQLite.
** **
** $Id: select.c,v 1.300 2006/01/23 18:42:21 drh Exp $ ** $Id: select.c,v 1.301 2006/01/24 12:09:19 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -21,7 +21,7 @@
** Delete all the content of a Select structure but do not deallocate ** Delete all the content of a Select structure but do not deallocate
** the select structure itself. ** the select structure itself.
*/ */
void clearSelect(Select *p){ static void clearSelect(Select *p){
sqlite3ExprListDelete(p->pEList); sqlite3ExprListDelete(p->pEList);
sqlite3SrcListDelete(p->pSrc); sqlite3SrcListDelete(p->pSrc);
sqlite3ExprDelete(p->pWhere); sqlite3ExprDelete(p->pWhere);
@@ -557,9 +557,9 @@ static int selectInnerLoop(
** case the order does matter */ ** case the order does matter */
pushOntoSorter(pParse, pOrderBy, p); pushOntoSorter(pParse, pOrderBy, p);
}else{ }else{
char aff = (iParm>>16)&0xFF; char affinity = (iParm>>16)&0xFF;
aff = sqlite3CompareAffinity(pEList->a[0].pExpr, aff); affinity = sqlite3CompareAffinity(pEList->a[0].pExpr, affinity);
sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &aff, 1); sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &affinity, 1);
sqlite3VdbeAddOp(v, OP_IdxInsert, (iParm&0x0000FFFF), 0); sqlite3VdbeAddOp(v, OP_IdxInsert, (iParm&0x0000FFFF), 0);
} }
sqlite3VdbeJumpHere(v, addr2); sqlite3VdbeJumpHere(v, addr2);
@@ -1078,7 +1078,6 @@ static int prepSelectStmt(Parse *pParse, Select *p){
int i, j, k, rc; int i, j, k, rc;
SrcList *pTabList; SrcList *pTabList;
ExprList *pEList; ExprList *pEList;
Table *pTab;
struct SrcList_item *pFrom; struct SrcList_item *pFrom;
if( p==0 || p->pSrc==0 || sqlite3MallocFailed() ){ if( p==0 || p->pSrc==0 || sqlite3MallocFailed() ){
@@ -1097,6 +1096,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){
** then create a transient table structure to describe the subquery. ** then create a transient table structure to describe the subquery.
*/ */
for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){ for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
Table *pTab;
if( pFrom->pTab!=0 ){ if( pFrom->pTab!=0 ){
/* This statement has already been prepared. There is no need /* This statement has already been prepared. There is no need
** to go further. */ ** to go further. */
@@ -1220,7 +1220,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){
} }
tableSeen = 1; tableSeen = 1;
for(j=0; j<pTab->nCol; j++){ for(j=0; j<pTab->nCol; j++){
Expr *pExpr, *pLeft, *pRight; Expr *pExpr, *pRight;
char *zName = pTab->aCol[j].zName; char *zName = pTab->aCol[j].zName;
if( i>0 ){ if( i>0 ){
@@ -1241,7 +1241,7 @@ static int prepSelectStmt(Parse *pParse, Select *p){
if( pRight==0 ) break; if( pRight==0 ) break;
setToken(&pRight->token, zName); setToken(&pRight->token, zName);
if( zTabName && (longNames || pTabList->nSrc>1) ){ if( zTabName && (longNames || pTabList->nSrc>1) ){
pLeft = sqlite3Expr(TK_ID, 0, 0, 0); Expr *pLeft = sqlite3Expr(TK_ID, 0, 0, 0);
pExpr = sqlite3Expr(TK_DOT, pLeft, pRight, 0); pExpr = sqlite3Expr(TK_DOT, pLeft, pRight, 0);
if( pExpr==0 ) break; if( pExpr==0 ) break;
setToken(&pLeft->token, zTabName); setToken(&pLeft->token, zTabName);

View File

@@ -43,7 +43,7 @@
** in this file for details. If in doubt, do not deviate from existing ** in this file for details. If in doubt, do not deviate from existing
** commenting and indentation practices when changing or adding code. ** commenting and indentation practices when changing or adding code.
** **
** $Id: vdbe.c,v 1.537 2006/01/23 17:43:53 drh Exp $ ** $Id: vdbe.c,v 1.538 2006/01/24 12:09:20 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
#include "os.h" #include "os.h"
@@ -2993,7 +2993,9 @@ case OP_IsUnique: { /* no-push */
assert( pCx->deferredMoveto==0 ); assert( pCx->deferredMoveto==0 );
pCx->cacheStatus = CACHE_STALE; pCx->cacheStatus = CACHE_STALE;
rc = sqlite3BtreeMoveto(pCrsr, zKey, len, &res); rc = sqlite3BtreeMoveto(pCrsr, zKey, len, &res);
if( rc!=SQLITE_OK ) goto abort_due_to_error; if( rc!=SQLITE_OK ){
goto abort_due_to_error;
}
if( res<0 ){ if( res<0 ){
rc = sqlite3BtreeNext(pCrsr, &res); rc = sqlite3BtreeNext(pCrsr, &res);
if( res ){ if( res ){

View File

@@ -16,7 +16,7 @@
** so is applicable. Because this module is responsible for selecting ** so is applicable. Because this module is responsible for selecting
** indices, you might also think of this module as the "query optimizer". ** indices, you might also think of this module as the "query optimizer".
** **
** $Id: where.c,v 1.202 2006/01/23 13:22:10 drh Exp $ ** $Id: where.c,v 1.203 2006/01/24 12:09:20 danielk1977 Exp $
*/ */
#include "sqliteInt.h" #include "sqliteInt.h"
@@ -424,7 +424,7 @@ static WhereTerm *findTerm(
Expr *pX = pTerm->pExpr; Expr *pX = pTerm->pExpr;
CollSeq *pColl; CollSeq *pColl;
char idxaff; char idxaff;
int k; int j;
Parse *pParse = pWC->pParse; Parse *pParse = pWC->pParse;
idxaff = pIdx->pTable->aCol[iColumn].affinity; idxaff = pIdx->pTable->aCol[iColumn].affinity;
@@ -438,9 +438,9 @@ static WhereTerm *findTerm(
pColl = pParse->db->pDfltColl; pColl = pParse->db->pDfltColl;
} }
} }
for(k=0; k<pIdx->nColumn && pIdx->aiColumn[k]!=iColumn; k++){} for(j=0; j<pIdx->nColumn && pIdx->aiColumn[j]!=iColumn; j++){}
assert( k<pIdx->nColumn ); assert( j<pIdx->nColumn );
if( sqlite3StrICmp(pColl->zName, pIdx->azColl[k]) ) continue; if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;
} }
return pTerm; return pTerm;
} }
@@ -2085,14 +2085,14 @@ void sqlite3WhereEnd(WhereInfo *pWInfo){
** reference the index. ** reference the index.
*/ */
if( pLevel->flags & WHERE_IDX_ONLY ){ if( pLevel->flags & WHERE_IDX_ONLY ){
int i, j, last; int k, j, last;
VdbeOp *pOp; VdbeOp *pOp;
Index *pIdx = pLevel->pIdx; Index *pIdx = pLevel->pIdx;
assert( pIdx!=0 ); assert( pIdx!=0 );
pOp = sqlite3VdbeGetOp(v, pWInfo->iTop); pOp = sqlite3VdbeGetOp(v, pWInfo->iTop);
last = sqlite3VdbeCurrentAddr(v); last = sqlite3VdbeCurrentAddr(v);
for(i=pWInfo->iTop; i<last; i++, pOp++){ for(k=pWInfo->iTop; k<last; k++, pOp++){
if( pOp->p1!=pLevel->iTabCur ) continue; if( pOp->p1!=pLevel->iTabCur ) continue;
if( pOp->opcode==OP_Column ){ if( pOp->opcode==OP_Column ){
pOp->p1 = pLevel->iIdxCur; pOp->p1 = pLevel->iIdxCur;