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

FossilOrigin-Name: d86f18a4277ebffb644ba2e574e0b697c8bbf8e4
diff --git a/src/attach.c b/src/attach.c
index 26fc531..c66b212 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.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"
 
@@ -33,7 +33,7 @@
 **
 ** 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;
   if( pExpr ){
@@ -176,15 +176,15 @@
     sqlite3SafetyOff(db);
   }
   if( rc ){
-    int i = db->nDb - 1;
-    assert( i>=2 );
-    if( db->aDb[i].pBt ){
-      sqlite3BtreeClose(db->aDb[i].pBt);
-      db->aDb[i].pBt = 0;
-      db->aDb[i].pSchema = 0;
+    int iDb = db->nDb - 1;
+    assert( iDb>=2 );
+    if( db->aDb[iDb].pBt ){
+      sqlite3BtreeClose(db->aDb[iDb].pBt);
+      db->aDb[iDb].pBt = 0;
+      db->aDb[iDb].pSchema = 0;
     }
     sqlite3ResetInternalSchema(db, 0);
-    db->nDb = i;
+    db->nDb = iDb;
     sqlite3_snprintf(127, zErr, "unable to open database: %s", zFile);
     goto attach_error;
   }
diff --git a/src/build.c b/src/build.c
index 56be58d..a253812 100644
--- a/src/build.c
+++ b/src/build.c
@@ -22,7 +22,7 @@
 **     COMMIT
 **     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 <ctype.h>
@@ -3157,10 +3157,10 @@
     assert( pName1->z );
     pColl = sqlite3FindCollSeq(db, ENC(db), (char*)pName1->z, pName1->n, 0);
     if( pColl ){
-      char *z = sqliteStrNDup((const char *)pName1->z, pName1->n);
-      if( z ){
-        reindexDatabases(pParse, z);
-        sqliteFree(z);
+      char *zColl = sqliteStrNDup((const char *)pName1->z, pName1->n);
+      if( zColl ){
+        reindexDatabases(pParse, zColl);
+        sqliteFree(zColl);
       }
       return;
     }
diff --git a/src/date.c b/src/date.c
index bd62e20..4a09a4f 100644
--- a/src/date.c
+++ b/src/date.c
@@ -16,7 +16,7 @@
 ** sqlite3RegisterDateTimeFunctions() found at the bottom of the file.
 ** 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:
 **
@@ -818,20 +818,20 @@
         case 'H':  sprintf(&z[j],"%02d",x.h); j+=2; break;
         case 'W': /* Fall thru */
         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;
           y.validJD = 0;
           y.M = 1;
           y.D = 1;
           computeJD(&y);
-          n = x.rJD - y.rJD;
+          nDay = x.rJD - y.rJD;
           if( zFmt[i]=='W' ){
             int wd;   /* 0=Monday, 1=Tuesday, ... 6=Sunday */
             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;
           }else{
-            sprintf(&z[j],"%03d",n+1);
+            sprintf(&z[j],"%03d",nDay+1);
             j += 3;
           }
           break;
diff --git a/src/delete.c b/src/delete.c
index c742bc4..f1b73a9 100644
--- a/src/delete.c
+++ b/src/delete.c
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -210,13 +210,13 @@
       /* If counting rows deleted, just count the total number of
       ** entries in the table. */
       int endOfLoop = sqlite3VdbeMakeLabel(v);
-      int addr;
+      int addr2;
       if( !isView ){
         sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead);
       }
       sqlite3VdbeAddOp(v, OP_Rewind, iCur, sqlite3VdbeCurrentAddr(v)+2);
-      addr = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
-      sqlite3VdbeAddOp(v, OP_Next, iCur, addr);
+      addr2 = sqlite3VdbeAddOp(v, OP_AddImm, 1, 0);
+      sqlite3VdbeAddOp(v, OP_Next, iCur, addr2);
       sqlite3VdbeResolveLabel(v, endOfLoop);
       sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
     }
diff --git a/src/expr.c b/src/expr.c
index 169fdf9..7de7583 100644
--- a/src/expr.c
+++ b/src/expr.c
@@ -12,7 +12,7 @@
 ** This file contains routines used for analyzing expressions and
 ** 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 <ctype.h>
@@ -918,17 +918,17 @@
       }
 
       if( pTab ){ 
-        int j;
+        int iCol;
         Column *pCol = pTab->aCol;
 
         pExpr->pSchema = pTab->pSchema;
         cntTab++;
-        for(j=0; j < pTab->nCol; j++, pCol++) {
+        for(iCol=0; iCol < pTab->nCol; iCol++, pCol++) {
           if( sqlite3StrICmp(pCol->zName, zCol)==0 ){
-            const char *zColl = pTab->aCol[j].zColl;
+            const char *zColl = pTab->aCol[iCol].zColl;
             cnt++;
-            pExpr->iColumn = j==pTab->iPKey ? -1 : j;
-            pExpr->affinity = pTab->aCol[j].affinity;
+            pExpr->iColumn = iCol==pTab->iPKey ? -1 : iCol;
+            pExpr->affinity = pTab->aCol[iCol].affinity;
             pExpr->pColl = sqlite3FindCollSeq(db, ENC(db), zColl,-1, 0);
             pExpr->pTab = pTab;
             break;
@@ -1077,20 +1077,19 @@
 */
 static int nameResolverStep(void *pArg, Expr *pExpr){
   NameContext *pNC = (NameContext*)pArg;
-  SrcList *pSrcList;
   Parse *pParse;
 
   if( pExpr==0 ) return 1;
   assert( pNC!=0 );
-  pSrcList = pNC->pSrcList;
   pParse = pNC->pParse;
 
   if( ExprHasAnyProperty(pExpr, EP_Resolved) ) return 1;
   ExprSetProperty(pExpr, EP_Resolved);
 #ifndef NDEBUG
-  if( pSrcList && pSrcList->nAlloc>0 ){
+  if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
+    SrcList *pSrcList = pNC->pSrcList;
     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);
     }
   }
@@ -1380,9 +1379,9 @@
           */
           if( testAddr>0 && !sqlite3ExprIsConstant(pE2) ){
             VdbeOp *aOp = sqlite3VdbeGetOp(v, testAddr-1);
-            int i;
-            for(i=0; i<3; i++){
-              aOp[i].opcode = OP_Noop;
+            int j;
+            for(j=0; j<3; j++){
+              aOp[j].opcode = OP_Noop;
             }
             testAddr = 0;
           }
@@ -1548,16 +1547,16 @@
 #ifndef SQLITE_OMIT_CAST
     case TK_CAST: {
       /* Expressions of the form:   CAST(pLeft AS token) */
-      int aff, op;
+      int aff, to_op;
       sqlite3ExprCode(pParse, pExpr->pLeft);
       aff = sqlite3AffinityType(&pExpr->token);
-      op = aff - SQLITE_AFF_TEXT + OP_ToText;
-      assert( op==OP_ToText    || aff!=SQLITE_AFF_TEXT    );
-      assert( op==OP_ToBlob    || aff!=SQLITE_AFF_NONE    );
-      assert( op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC );
-      assert( op==OP_ToInt     || aff!=SQLITE_AFF_INTEGER );
-      assert( op==OP_ToReal    || aff!=SQLITE_AFF_REAL    );
-      sqlite3VdbeAddOp(v, op, 0, 0);
+      to_op = aff - SQLITE_AFF_TEXT + OP_ToText;
+      assert( to_op==OP_ToText    || aff!=SQLITE_AFF_TEXT    );
+      assert( to_op==OP_ToBlob    || aff!=SQLITE_AFF_NONE    );
+      assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC );
+      assert( to_op==OP_ToInt     || aff!=SQLITE_AFF_INTEGER );
+      assert( to_op==OP_ToReal    || aff!=SQLITE_AFF_REAL    );
+      sqlite3VdbeAddOp(v, to_op, 0, 0);
       stackChng = 0;
       break;
     }
diff --git a/src/insert.c b/src/insert.c
index 993da99..7899610 100644
--- a/src/insert.c
+++ b/src/insert.c
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -297,20 +297,20 @@
   */
   if( pTab->autoInc ){
     int iCur = pParse->nTab;
-    int base = sqlite3VdbeCurrentAddr(v);
+    int addr = sqlite3VdbeCurrentAddr(v);
     counterRowid = pParse->nMem++;
     counterMem = pParse->nMem++;
     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);
     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_MemStore, counterRowid, 1);
     sqlite3VdbeAddOp(v, OP_Column, iCur, 1);
     sqlite3VdbeAddOp(v, OP_MemStore, counterMem, 1);
-    sqlite3VdbeAddOp(v, OP_Goto, 0, base+13);
-    sqlite3VdbeAddOp(v, OP_Next, iCur, base+4);
+    sqlite3VdbeAddOp(v, OP_Goto, 0, addr+13);
+    sqlite3VdbeAddOp(v, OP_Next, iCur, addr+4);
     sqlite3VdbeAddOp(v, OP_Close, iCur, 0);
   }
 #endif /* SQLITE_OMIT_AUTOINCREMENT */
@@ -680,10 +680,10 @@
   */
   if( pTab->autoInc ){
     int iCur = pParse->nTab;
-    int base = sqlite3VdbeCurrentAddr(v);
+    int addr = sqlite3VdbeCurrentAddr(v);
     sqlite3OpenTable(pParse, iCur, iDb, pDb->pSchema->pSeqTab, OP_OpenWrite);
     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_NewRowid, iCur, 0);
     sqlite3VdbeOp3(v, OP_String8, 0, 0, pTab->zName, 0);
diff --git a/src/os_win.c b/src/os_win.c
index 0446186..944d6e2 100644
--- a/src/os_win.c
+++ b/src/os_win.c
@@ -514,7 +514,7 @@
 }
 
 /* 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
@@ -1289,7 +1289,7 @@
 ** 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.
 */
-int allocateWinFile(winFile *pInit, OsFile **pId){
+static int allocateWinFile(winFile *pInit, OsFile **pId){
   winFile *pNew;
   pNew = sqliteMalloc( sizeof(*pNew) );
   if( pNew==0 ){
diff --git a/src/pager.c b/src/pager.c
index 6d9857e..9681ab5 100644
--- a/src/pager.c
+++ b/src/pager.c
@@ -18,7 +18,7 @@
 ** file simultaneously, or one process from reading the database while
 ** 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
 #include "sqliteInt.h"
@@ -1444,17 +1444,17 @@
   }
 
   while( pPager->journalOff < szJ ){
-    u32 nRec;
+    u32 nJRec;         /* Number of Journal Records */
     u32 dummy;
-    rc = readJournalHdr(pPager, szJ, &nRec, &dummy);
+    rc = readJournalHdr(pPager, szJ, &nJRec, &dummy);
     if( rc!=SQLITE_OK ){
       assert( rc!=SQLITE_DONE );
       goto end_stmt_playback;
     }
-    if( nRec==0 ){
-      nRec = (szJ - pPager->journalOff) / (pPager->pageSize+8);
+    if( nJRec==0 ){
+      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);
       assert( rc!=SQLITE_DONE );
       if( rc!=SQLITE_OK ) goto end_stmt_playback;
@@ -2556,8 +2556,6 @@
     ** database file, then it either needs to be played back or deleted.
     */
     if( hasHotJournal(pPager) ){
-       int rc;
-
        /* 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
        ** EXCLUSIVE lock. If it were, another process might open the
@@ -2680,7 +2678,6 @@
     if( sqlite3pager_pagecount(pPager)<(int)pgno ){
       memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize);
     }else{
-      int rc;
       assert( MEMDB==0 );
       rc = sqlite3OsSeek(pPager->fd, (pgno-1)*(i64)pPager->pageSize);
       if( rc==SQLITE_OK ){
diff --git a/src/printf.c b/src/printf.c
index 8f1b2ac..261a554 100644
--- a/src/printf.c
+++ b/src/printf.c
@@ -596,13 +596,13 @@
         break;
       case etSQLESCAPE:
       case etSQLESCAPE2: {
-        int i, j, n, c, isnull;
+        int i, j, n, ch, isnull;
         int needQuote;
-        char *arg = va_arg(ap,char*);
-        isnull = arg==0;
-        if( isnull ) arg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
-        for(i=n=0; (c=arg[i])!=0; i++){
-          if( c=='\'' )  n++;
+        char *escarg = va_arg(ap,char*);
+        isnull = escarg==0;
+        if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
+        for(i=n=0; (ch=escarg[i])!=0; i++){
+          if( ch=='\'' )  n++;
         }
         needQuote = !isnull && xtype==etSQLESCAPE2;
         n += i + 1 + needQuote*2;
@@ -614,9 +614,9 @@
         }
         j = 0;
         if( needQuote ) bufpt[j++] = '\'';
-        for(i=0; (c=arg[i])!=0; i++){
-          bufpt[j++] = c;
-          if( c=='\'' ) bufpt[j++] = c;
+        for(i=0; (ch=escarg[i])!=0; i++){
+          bufpt[j++] = ch;
+          if( ch=='\'' ) bufpt[j++] = ch;
         }
         if( needQuote ) bufpt[j++] = '\'';
         bufpt[j] = 0;
diff --git a/src/select.c b/src/select.c
index d5c5254..14d8a00 100644
--- a/src/select.c
+++ b/src/select.c
@@ -12,7 +12,7 @@
 ** This file contains C code routines that are called by the parser
 ** 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"
 
@@ -21,7 +21,7 @@
 ** Delete all the content of a Select structure but do not deallocate
 ** the select structure itself.
 */
-void clearSelect(Select *p){
+static void clearSelect(Select *p){
   sqlite3ExprListDelete(p->pEList);
   sqlite3SrcListDelete(p->pSrc);
   sqlite3ExprDelete(p->pWhere);
@@ -557,9 +557,9 @@
         ** case the order does matter */
         pushOntoSorter(pParse, pOrderBy, p);
       }else{
-        char aff = (iParm>>16)&0xFF;
-        aff = sqlite3CompareAffinity(pEList->a[0].pExpr, aff);
-        sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &aff, 1);
+        char affinity = (iParm>>16)&0xFF;
+        affinity = sqlite3CompareAffinity(pEList->a[0].pExpr, affinity);
+        sqlite3VdbeOp3(v, OP_MakeRecord, 1, 0, &affinity, 1);
         sqlite3VdbeAddOp(v, OP_IdxInsert, (iParm&0x0000FFFF), 0);
       }
       sqlite3VdbeJumpHere(v, addr2);
@@ -1078,7 +1078,6 @@
   int i, j, k, rc;
   SrcList *pTabList;
   ExprList *pEList;
-  Table *pTab;
   struct SrcList_item *pFrom;
 
   if( p==0 || p->pSrc==0 || sqlite3MallocFailed() ){
@@ -1097,6 +1096,7 @@
   ** then create a transient table structure to describe the subquery.
   */
   for(i=0, pFrom=pTabList->a; i<pTabList->nSrc; i++, pFrom++){
+    Table *pTab;
     if( pFrom->pTab!=0 ){
       /* This statement has already been prepared.  There is no need
       ** to go further. */
@@ -1220,7 +1220,7 @@
           }
           tableSeen = 1;
           for(j=0; j<pTab->nCol; j++){
-            Expr *pExpr, *pLeft, *pRight;
+            Expr *pExpr, *pRight;
             char *zName = pTab->aCol[j].zName;
 
             if( i>0 ){
@@ -1241,7 +1241,7 @@
             if( pRight==0 ) break;
             setToken(&pRight->token, zName);
             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);
               if( pExpr==0 ) break;
               setToken(&pLeft->token, zTabName);
diff --git a/src/vdbe.c b/src/vdbe.c
index f3b1a11..8b08507 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -43,7 +43,7 @@
 ** in this file for details.  If in doubt, do not deviate from existing
 ** 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 "os.h"
@@ -2993,7 +2993,9 @@
     assert( pCx->deferredMoveto==0 );
     pCx->cacheStatus = CACHE_STALE;
     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 ){
       rc = sqlite3BtreeNext(pCrsr, &res);
       if( res ){
diff --git a/src/where.c b/src/where.c
index 9d21b5f..31eeaee 100644
--- a/src/where.c
+++ b/src/where.c
@@ -16,7 +16,7 @@
 ** so is applicable.  Because this module is responsible for selecting
 ** 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"
 
@@ -424,7 +424,7 @@
         Expr *pX = pTerm->pExpr;
         CollSeq *pColl;
         char idxaff;
-        int k;
+        int j;
         Parse *pParse = pWC->pParse;
 
         idxaff = pIdx->pTable->aCol[iColumn].affinity;
@@ -438,9 +438,9 @@
             pColl = pParse->db->pDfltColl;
           }
         }
-        for(k=0; k<pIdx->nColumn && pIdx->aiColumn[k]!=iColumn; k++){}
-        assert( k<pIdx->nColumn );
-        if( sqlite3StrICmp(pColl->zName, pIdx->azColl[k]) ) continue;
+        for(j=0; j<pIdx->nColumn && pIdx->aiColumn[j]!=iColumn; j++){}
+        assert( j<pIdx->nColumn );
+        if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ) continue;
       }
       return pTerm;
     }
@@ -2085,14 +2085,14 @@
     ** reference the index.
     */
     if( pLevel->flags & WHERE_IDX_ONLY ){
-      int i, j, last;
+      int k, j, last;
       VdbeOp *pOp;
       Index *pIdx = pLevel->pIdx;
 
       assert( pIdx!=0 );
       pOp = sqlite3VdbeGetOp(v, pWInfo->iTop);
       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->opcode==OP_Column ){
           pOp->p1 = pLevel->iIdxCur;