updated to sqlite-3.3.5
This commit is contained in:
		| @@ -535,9 +535,9 @@ static int saveCursorPosition(BtCursor *pCur){ | |||||||
|   ** data. |   ** data. | ||||||
|   */ |   */ | ||||||
|   if( rc==SQLITE_OK && 0==pCur->pPage->intKey){ |   if( rc==SQLITE_OK && 0==pCur->pPage->intKey){ | ||||||
|     void *pKey = sqliteMalloc((int)pCur->nKey); |     void *pKey = sqliteMalloc(pCur->nKey); | ||||||
|     if( pKey ){ |     if( pKey ){ | ||||||
|       rc = sqlite3BtreeKey(pCur, 0, (u32)pCur->nKey, pKey); |       rc = sqlite3BtreeKey(pCur, 0, pCur->nKey, pKey); | ||||||
|       if( rc==SQLITE_OK ){ |       if( rc==SQLITE_OK ){ | ||||||
|         pCur->pKey = pKey; |         pCur->pKey = pKey; | ||||||
|       }else{ |       }else{ | ||||||
| @@ -2399,7 +2399,7 @@ static int autoVacuumCommit(BtShared *pBt, Pgno *nTrunc){ | |||||||
|   } |   } | ||||||
|   nPtrMap = (nFreeList-origSize+PTRMAP_PAGENO(pBt, origSize)+pgsz/5)/(pgsz/5); |   nPtrMap = (nFreeList-origSize+PTRMAP_PAGENO(pBt, origSize)+pgsz/5)/(pgsz/5); | ||||||
|   finSize = origSize - nFreeList - nPtrMap; |   finSize = origSize - nFreeList - nPtrMap; | ||||||
|   if( origSize>(Pgno)PENDING_BYTE_PAGE(pBt) && finSize<=(Pgno)PENDING_BYTE_PAGE(pBt) ){ |   if( origSize>PENDING_BYTE_PAGE(pBt) && finSize<=PENDING_BYTE_PAGE(pBt) ){ | ||||||
|     finSize--; |     finSize--; | ||||||
|   } |   } | ||||||
|   while( PTRMAP_ISPAGE(pBt, finSize) || finSize==PENDING_BYTE_PAGE(pBt) ){ |   while( PTRMAP_ISPAGE(pBt, finSize) || finSize==PENDING_BYTE_PAGE(pBt) ){ | ||||||
| @@ -2987,13 +2987,13 @@ static int getPayload( | |||||||
|   if( pPage->intKey ){ |   if( pPage->intKey ){ | ||||||
|     nKey = 0; |     nKey = 0; | ||||||
|   }else{ |   }else{ | ||||||
|     nKey = (u32)pCur->info.nKey; |     nKey = pCur->info.nKey; | ||||||
|   } |   } | ||||||
|   assert( offset>=0 ); |   assert( offset>=0 ); | ||||||
|   if( skipKey ){ |   if( skipKey ){ | ||||||
|     offset += nKey; |     offset += nKey; | ||||||
|   } |   } | ||||||
|   if( (u32)(offset+amt) > nKey+pCur->info.nData ){ |   if( offset+amt > nKey+pCur->info.nData ){ | ||||||
|     return SQLITE_ERROR; |     return SQLITE_ERROR; | ||||||
|   } |   } | ||||||
|   if( offset<pCur->info.nLocal ){ |   if( offset<pCur->info.nLocal ){ | ||||||
| @@ -3126,14 +3126,14 @@ static const unsigned char *fetchPayload( | |||||||
|   if( pPage->intKey ){ |   if( pPage->intKey ){ | ||||||
|     nKey = 0; |     nKey = 0; | ||||||
|   }else{ |   }else{ | ||||||
|     nKey = (u32)pCur->info.nKey; |     nKey = pCur->info.nKey; | ||||||
|   } |   } | ||||||
|   if( skipKey ){ |   if( skipKey ){ | ||||||
|     aPayload += nKey; |     aPayload += nKey; | ||||||
|     nLocal = pCur->info.nLocal - nKey; |     nLocal = pCur->info.nLocal - nKey; | ||||||
|   }else{ |   }else{ | ||||||
|     nLocal = pCur->info.nLocal; |     nLocal = pCur->info.nLocal; | ||||||
|     if( (u32)nLocal>nKey ){ |     if( nLocal>nKey ){ | ||||||
|       nLocal = nKey; |       nLocal = nKey; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @@ -3445,12 +3445,12 @@ int sqlite3BtreeMoveto(BtCursor *pCur, const void *pKey, i64 nKey, int *pRes){ | |||||||
|         pCellKey = (void *)fetchPayload(pCur, &available, 0); |         pCellKey = (void *)fetchPayload(pCur, &available, 0); | ||||||
|         nCellKey = pCur->info.nKey; |         nCellKey = pCur->info.nKey; | ||||||
|         if( available>=nCellKey ){ |         if( available>=nCellKey ){ | ||||||
|           c = pCur->xCompare(pCur->pArg, (int)nCellKey, pCellKey, (int)nKey, pKey); |           c = pCur->xCompare(pCur->pArg, nCellKey, pCellKey, nKey, pKey); | ||||||
|         }else{ |         }else{ | ||||||
|           pCellKey = sqliteMallocRaw( (int)nCellKey ); |           pCellKey = sqliteMallocRaw( nCellKey ); | ||||||
|           if( pCellKey==0 ) return SQLITE_NOMEM; |           if( pCellKey==0 ) return SQLITE_NOMEM; | ||||||
|           rc = sqlite3BtreeKey(pCur, 0, (u32)nCellKey, (void *)pCellKey); |           rc = sqlite3BtreeKey(pCur, 0, nCellKey, (void *)pCellKey); | ||||||
|           c = pCur->xCompare(pCur->pArg, (int)nCellKey, pCellKey, (int)nKey, pKey); |           c = pCur->xCompare(pCur->pArg, nCellKey, pCellKey, nKey, pKey); | ||||||
|           sqliteFree(pCellKey); |           sqliteFree(pCellKey); | ||||||
|           if( rc ) return rc; |           if( rc ) return rc; | ||||||
|         } |         } | ||||||
| @@ -3814,7 +3814,7 @@ static int allocatePage( | |||||||
|         iPage = get4byte(&aData[8+closest*4]); |         iPage = get4byte(&aData[8+closest*4]); | ||||||
|         if( !searchList || iPage==nearby ){ |         if( !searchList || iPage==nearby ){ | ||||||
|           *pPgno = iPage; |           *pPgno = iPage; | ||||||
|           if( *pPgno>(Pgno)sqlite3pager_pagecount(pBt->pPager) ){ |           if( *pPgno>sqlite3pager_pagecount(pBt->pPager) ){ | ||||||
|             /* Free page off the end of the file */ |             /* Free page off the end of the file */ | ||||||
|             return SQLITE_CORRUPT_BKPT; |             return SQLITE_CORRUPT_BKPT; | ||||||
|           } |           } | ||||||
| @@ -3967,7 +3967,7 @@ static int clearCell(MemPage *pPage, unsigned char *pCell){ | |||||||
|   ovflPgno = get4byte(&pCell[info.iOverflow]); |   ovflPgno = get4byte(&pCell[info.iOverflow]); | ||||||
|   while( ovflPgno!=0 ){ |   while( ovflPgno!=0 ){ | ||||||
|     MemPage *pOvfl; |     MemPage *pOvfl; | ||||||
|     if( ovflPgno>(Pgno)sqlite3pager_pagecount(pBt->pPager) ){ |     if( ovflPgno>sqlite3pager_pagecount(pBt->pPager) ){ | ||||||
|       return SQLITE_CORRUPT_BKPT; |       return SQLITE_CORRUPT_BKPT; | ||||||
|     } |     } | ||||||
|     rc = getPage(pBt, ovflPgno, &pOvfl); |     rc = getPage(pBt, ovflPgno, &pOvfl); | ||||||
| @@ -4035,9 +4035,9 @@ static int fillInCell( | |||||||
|     nSrc = nData; |     nSrc = nData; | ||||||
|     nData = 0; |     nData = 0; | ||||||
|   }else{ |   }else{ | ||||||
|     nPayload += (int)nKey; |     nPayload += nKey; | ||||||
|     pSrc = pKey; |     pSrc = pKey; | ||||||
|     nSrc = (int)nKey; |     nSrc = nKey; | ||||||
|   } |   } | ||||||
|   *pnSize = info.nSize; |   *pnSize = info.nSize; | ||||||
|   spaceLeft = info.nLocal; |   spaceLeft = info.nLocal; | ||||||
| @@ -5588,7 +5588,7 @@ static int clearDatabasePage( | |||||||
|   unsigned char *pCell; |   unsigned char *pCell; | ||||||
|   int i; |   int i; | ||||||
|  |  | ||||||
|   if( pgno>(Pgno)sqlite3pager_pagecount(pBt->pPager) ){ |   if( pgno>sqlite3pager_pagecount(pBt->pPager) ){ | ||||||
|     return SQLITE_CORRUPT_BKPT; |     return SQLITE_CORRUPT_BKPT; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -6278,7 +6278,7 @@ static int checkTreePage( | |||||||
|     pCell = findCell(pPage,i); |     pCell = findCell(pPage,i); | ||||||
|     parseCellPtr(pPage, pCell, &info); |     parseCellPtr(pPage, pCell, &info); | ||||||
|     sz = info.nData; |     sz = info.nData; | ||||||
|     if( !pPage->intKey ) sz += (int)info.nKey; |     if( !pPage->intKey ) sz += info.nKey; | ||||||
|     if( sz>info.nLocal ){ |     if( sz>info.nLocal ){ | ||||||
|       int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4); |       int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4); | ||||||
|       Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]); |       Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]); | ||||||
|   | |||||||
| @@ -230,8 +230,8 @@ static void computeJD(DateTime *p){ | |||||||
|   } |   } | ||||||
|   A = Y/100; |   A = Y/100; | ||||||
|   B = 2 - A + (A/4); |   B = 2 - A + (A/4); | ||||||
|   X1 = (int)(365.25*(Y+4716)); |   X1 = 365.25*(Y+4716); | ||||||
|   X2 = (int)30.6001*(M+1); |   X2 = 30.6001*(M+1); | ||||||
|   p->rJD = X1 + X2 + D + B - 1524.5; |   p->rJD = X1 + X2 + D + B - 1524.5; | ||||||
|   p->validJD = 1; |   p->validJD = 1; | ||||||
|   p->validYMD = 0; |   p->validYMD = 0; | ||||||
| @@ -336,14 +336,14 @@ static void computeYMD(DateTime *p){ | |||||||
|     p->M = 1; |     p->M = 1; | ||||||
|     p->D = 1; |     p->D = 1; | ||||||
|   }else{ |   }else{ | ||||||
|     Z = (int)(p->rJD + 0.5); |     Z = p->rJD + 0.5; | ||||||
|     A = (int)((Z - 1867216.25)/36524.25); |     A = (Z - 1867216.25)/36524.25; | ||||||
|     A = Z + 1 + A - (A/4); |     A = Z + 1 + A - (A/4); | ||||||
|     B = A + 1524; |     B = A + 1524; | ||||||
|     C = (int)((B - 122.1)/365.25); |     C = (B - 122.1)/365.25; | ||||||
|     D = (int)(365.25*C); |     D = 365.25*C; | ||||||
|     E = (int)((B-D)/30.6001); |     E = (B-D)/30.6001; | ||||||
|     X1 = (int)(30.6001*E); |     X1 = 30.6001*E; | ||||||
|     p->D = B - D - X1; |     p->D = B - D - X1; | ||||||
|     p->M = E<14 ? E-1 : E-13; |     p->M = E<14 ? E-1 : E-13; | ||||||
|     p->Y = p->M>2 ? C - 4716 : C - 4715; |     p->Y = p->M>2 ? C - 4716 : C - 4715; | ||||||
| @@ -357,10 +357,10 @@ static void computeYMD(DateTime *p){ | |||||||
| static void computeHMS(DateTime *p){ | static void computeHMS(DateTime *p){ | ||||||
|   int Z, s; |   int Z, s; | ||||||
|   if( p->validHMS ) return; |   if( p->validHMS ) return; | ||||||
|   Z = (int)(p->rJD + 0.5); |   Z = p->rJD + 0.5; | ||||||
|   s = (int)((p->rJD + 0.5 - Z)*86400000.0 + 0.5); |   s = (p->rJD + 0.5 - Z)*86400000.0 + 0.5; | ||||||
|   p->s = 0.001*s; |   p->s = 0.001*s; | ||||||
|   s = (int)(p->s); |   s = p->s; | ||||||
|   p->s -= s; |   p->s -= s; | ||||||
|   p->h = s/3600; |   p->h = s/3600; | ||||||
|   s -= p->h*3600; |   s -= p->h*3600; | ||||||
| @@ -404,13 +404,13 @@ static double localtimeOffset(DateTime *p){ | |||||||
|     x.m = 0; |     x.m = 0; | ||||||
|     x.s = 0.0; |     x.s = 0.0; | ||||||
|   } else { |   } else { | ||||||
|     int s = (int)(x.s + 0.5); |     int s = x.s + 0.5; | ||||||
|     x.s = s; |     x.s = s; | ||||||
|   } |   } | ||||||
|   x.tz = 0; |   x.tz = 0; | ||||||
|   x.validJD = 0; |   x.validJD = 0; | ||||||
|   computeJD(&x); |   computeJD(&x); | ||||||
|   t = (time_t)((x.rJD-2440587.5)*86400.0 + 0.5); |   t = (x.rJD-2440587.5)*86400.0 + 0.5; | ||||||
|   sqlite3OsEnterMutex(); |   sqlite3OsEnterMutex(); | ||||||
|   pTm = localtime(&t); |   pTm = localtime(&t); | ||||||
|   y.Y = pTm->tm_year + 1900; |   y.Y = pTm->tm_year + 1900; | ||||||
| @@ -505,13 +505,13 @@ static int parseModifier(const char *zMod, DateTime *p){ | |||||||
|       ** date is already on the appropriate weekday, this is a no-op. |       ** date is already on the appropriate weekday, this is a no-op. | ||||||
|       */ |       */ | ||||||
|       if( strncmp(z, "weekday ", 8)==0 && getValue(&z[8],&r)>0 |       if( strncmp(z, "weekday ", 8)==0 && getValue(&z[8],&r)>0 | ||||||
|                  && (n=(int)r)==r && n>=0 && r<7 ){ |                  && (n=r)==r && n>=0 && r<7 ){ | ||||||
|         int Z; |         int Z; | ||||||
|         computeYMD_HMS(p); |         computeYMD_HMS(p); | ||||||
|         p->validTZ = 0; |         p->validTZ = 0; | ||||||
|         p->validJD = 0; |         p->validJD = 0; | ||||||
|         computeJD(p); |         computeJD(p); | ||||||
|         Z = (int)(p->rJD + 1.5); |         Z = p->rJD + 1.5; | ||||||
|         Z %= 7; |         Z %= 7; | ||||||
|         if( Z>n ) Z -= 7; |         if( Z>n ) Z -= 7; | ||||||
|         p->rJD += n - Z; |         p->rJD += n - Z; | ||||||
| @@ -603,19 +603,19 @@ static int parseModifier(const char *zMod, DateTime *p){ | |||||||
|       }else if( n==5 && strcmp(z,"month")==0 ){ |       }else if( n==5 && strcmp(z,"month")==0 ){ | ||||||
|         int x, y; |         int x, y; | ||||||
|         computeYMD_HMS(p); |         computeYMD_HMS(p); | ||||||
|         p->M += (int)r; |         p->M += r; | ||||||
|         x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; |         x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; | ||||||
|         p->Y += x; |         p->Y += x; | ||||||
|         p->M -= x*12; |         p->M -= x*12; | ||||||
|         p->validJD = 0; |         p->validJD = 0; | ||||||
|         computeJD(p); |         computeJD(p); | ||||||
|         y = (int)r; |         y = r; | ||||||
|         if( y!=r ){ |         if( y!=r ){ | ||||||
|           p->rJD += (r - y)*30.0; |           p->rJD += (r - y)*30.0; | ||||||
|         } |         } | ||||||
|       }else if( n==4 && strcmp(z,"year")==0 ){ |       }else if( n==4 && strcmp(z,"year")==0 ){ | ||||||
|         computeYMD_HMS(p); |         computeYMD_HMS(p); | ||||||
|         p->Y += (int)r; |         p->Y += r; | ||||||
|         p->validJD = 0; |         p->validJD = 0; | ||||||
|         computeJD(p); |         computeJD(p); | ||||||
|       }else{ |       }else{ | ||||||
| @@ -809,8 +809,8 @@ static void strftimeFunc( | |||||||
|       switch( zFmt[i] ){ |       switch( zFmt[i] ){ | ||||||
|         case 'd':  sprintf(&z[j],"%02d",x.D); j+=2; break; |         case 'd':  sprintf(&z[j],"%02d",x.D); j+=2; break; | ||||||
|         case 'f': { |         case 'f': { | ||||||
|           int s = (int)x.s; |           int s = x.s; | ||||||
|           int ms = (int)((x.s - s)*1000.0); |           int ms = (x.s - s)*1000.0; | ||||||
|           sprintf(&z[j],"%02d.%03d",s,ms); |           sprintf(&z[j],"%02d.%03d",s,ms); | ||||||
|           j += strlen(&z[j]); |           j += strlen(&z[j]); | ||||||
|           break; |           break; | ||||||
| @@ -824,7 +824,7 @@ static void strftimeFunc( | |||||||
|           y.M = 1; |           y.M = 1; | ||||||
|           y.D = 1; |           y.D = 1; | ||||||
|           computeJD(&y); |           computeJD(&y); | ||||||
|           nDay = (int)(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; | ||||||
|   | |||||||
| @@ -863,9 +863,9 @@ static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ | |||||||
|       p->rSum += v; |       p->rSum += v; | ||||||
|       if( (p->approx|p->overflow)==0 ){ |       if( (p->approx|p->overflow)==0 ){ | ||||||
|         i64 iNewSum = p->iSum + v; |         i64 iNewSum = p->iSum + v; | ||||||
|         int s1 = (int)(p->iSum >> (sizeof(i64)*8-1)); |         int s1 = p->iSum >> (sizeof(i64)*8-1); | ||||||
|         int s2 = (int)(v >> (sizeof(i64)*8-1)); |         int s2 = v       >> (sizeof(i64)*8-1); | ||||||
|         int s3 = (int)(iNewSum >> (sizeof(i64)*8-1)); |         int s3 = iNewSum >> (sizeof(i64)*8-1); | ||||||
|         p->overflow = (s1&s2&~s3) | (~s1&~s2&s3); |         p->overflow = (s1&s2&~s3) | (~s1&~s2&s3); | ||||||
|         p->iSum = iNewSum; |         p->iSum = iNewSum; | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -870,8 +870,8 @@ static int winWrite(OsFile *id, const void *pBuf, int amt){ | |||||||
| ** Move the read/write pointer in a file. | ** Move the read/write pointer in a file. | ||||||
| */ | */ | ||||||
| static int winSeek(OsFile *id, i64 offset){ | static int winSeek(OsFile *id, i64 offset){ | ||||||
|   LONG upperBits = (LONG)(offset>>32); |   LONG upperBits = offset>>32; | ||||||
|   LONG lowerBits = (LONG)(offset) & 0xffffffff; |   LONG lowerBits = offset & 0xffffffff; | ||||||
|   DWORD rc; |   DWORD rc; | ||||||
|   assert( id!=0 ); |   assert( id!=0 ); | ||||||
| #ifdef SQLITE_TEST | #ifdef SQLITE_TEST | ||||||
| @@ -912,11 +912,11 @@ int sqlite3WinSyncDirectory(const char *zDirname){ | |||||||
| ** Truncate an open file to a specified size | ** Truncate an open file to a specified size | ||||||
| */ | */ | ||||||
| static int winTruncate(OsFile *id, i64 nByte){ | static int winTruncate(OsFile *id, i64 nByte){ | ||||||
|   LONG upperBits = (LONG)(nByte>>32); |   LONG upperBits = nByte>>32; | ||||||
|   assert( id!=0 ); |   assert( id!=0 ); | ||||||
|   TRACE3("TRUNCATE %d %lld\n", ((winFile*)id)->h, nByte); |   TRACE3("TRUNCATE %d %lld\n", ((winFile*)id)->h, nByte); | ||||||
|   SimulateIOError(SQLITE_IOERR); |   SimulateIOError(SQLITE_IOERR); | ||||||
|   SetFilePointer(((winFile*)id)->h, (LONG)nByte, &upperBits, FILE_BEGIN); |   SetFilePointer(((winFile*)id)->h, nByte, &upperBits, FILE_BEGIN); | ||||||
|   SetEndOfFile(((winFile*)id)->h); |   SetEndOfFile(((winFile*)id)->h); | ||||||
|   return SQLITE_OK; |   return SQLITE_OK; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -551,7 +551,7 @@ static int readMasterJournal(OsFile *pJrnl, char **pzMaster){ | |||||||
|   } |   } | ||||||
|  |  | ||||||
|   /* See if the checksum matches the master journal name */ |   /* See if the checksum matches the master journal name */ | ||||||
|   for(i=0; (u32)i<len; i++){ |   for(i=0; i<len; i++){ | ||||||
|     cksum -= (*pzMaster)[i]; |     cksum -= (*pzMaster)[i]; | ||||||
|   } |   } | ||||||
|   if( cksum ){ |   if( cksum ){ | ||||||
| @@ -1072,12 +1072,12 @@ static int pager_delmaster(const char *zMaster){ | |||||||
|     /* Load the entire master journal file into space obtained from |     /* Load the entire master journal file into space obtained from | ||||||
|     ** sqliteMalloc() and pointed to by zMasterJournal.  |     ** sqliteMalloc() and pointed to by zMasterJournal.  | ||||||
|     */ |     */ | ||||||
|     zMasterJournal = (char *)sqliteMalloc((int)nMasterJournal); |     zMasterJournal = (char *)sqliteMalloc(nMasterJournal); | ||||||
|     if( !zMasterJournal ){ |     if( !zMasterJournal ){ | ||||||
|       rc = SQLITE_NOMEM; |       rc = SQLITE_NOMEM; | ||||||
|       goto delmaster_out; |       goto delmaster_out; | ||||||
|     } |     } | ||||||
|     rc = sqlite3OsRead(master, zMasterJournal, (int)nMasterJournal); |     rc = sqlite3OsRead(master, zMasterJournal, nMasterJournal); | ||||||
|     if( rc!=SQLITE_OK ) goto delmaster_out; |     if( rc!=SQLITE_OK ) goto delmaster_out; | ||||||
|  |  | ||||||
|     zJournal = zMasterJournal; |     zJournal = zMasterJournal; | ||||||
| @@ -1286,7 +1286,7 @@ static int pager_playback(Pager *pPager){ | |||||||
|     */ |     */ | ||||||
|     if( nRec==0xffffffff ){ |     if( nRec==0xffffffff ){ | ||||||
|       assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ); |       assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ); | ||||||
|       nRec = (u32)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager)); |       nRec = (szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /* If this is the first header read from the journal, truncate the |     /* If this is the first header read from the journal, truncate the | ||||||
| @@ -1304,7 +1304,7 @@ static int pager_playback(Pager *pPager){ | |||||||
|  |  | ||||||
|     /* Copy original pages out of the journal and back into the database file. |     /* Copy original pages out of the journal and back into the database file. | ||||||
|     */ |     */ | ||||||
|     for(i=0; (u32)i<nRec; i++){ |     for(i=0; i<nRec; i++){ | ||||||
|       rc = pager_playback_one_page(pPager, pPager->jfd, 1); |       rc = pager_playback_one_page(pPager, pPager->jfd, 1); | ||||||
|       if( rc!=SQLITE_OK ){ |       if( rc!=SQLITE_OK ){ | ||||||
|         if( rc==SQLITE_DONE ){ |         if( rc==SQLITE_DONE ){ | ||||||
| @@ -1420,7 +1420,7 @@ static int pager_stmt_playback(Pager *pPager){ | |||||||
|     goto end_stmt_playback; |     goto end_stmt_playback; | ||||||
|   } |   } | ||||||
|   pPager->journalOff = pPager->stmtJSize; |   pPager->journalOff = pPager->stmtJSize; | ||||||
|   pPager->cksumInit = (u32)pPager->stmtCksum; |   pPager->cksumInit = pPager->stmtCksum; | ||||||
|   assert( JOURNAL_HDR_SZ(pPager)<(pPager->pageSize+8) ); |   assert( JOURNAL_HDR_SZ(pPager)<(pPager->pageSize+8) ); | ||||||
|   while( pPager->journalOff <= (hdrOff-(pPager->pageSize+8)) ){ |   while( pPager->journalOff <= (hdrOff-(pPager->pageSize+8)) ){ | ||||||
|     rc = pager_playback_one_page(pPager, pPager->jfd, 1); |     rc = pager_playback_one_page(pPager, pPager->jfd, 1); | ||||||
| @@ -1437,7 +1437,7 @@ static int pager_stmt_playback(Pager *pPager){ | |||||||
|       goto end_stmt_playback; |       goto end_stmt_playback; | ||||||
|     } |     } | ||||||
|     if( nJRec==0 ){ |     if( nJRec==0 ){ | ||||||
|       nJRec = (u32)((szJ - pPager->journalOff) / (pPager->pageSize+8)); |       nJRec = (szJ - pPager->journalOff) / (pPager->pageSize+8); | ||||||
|     } |     } | ||||||
|     for(i=nJRec-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); | ||||||
| @@ -1796,13 +1796,13 @@ int sqlite3pager_pagecount(Pager *pPager){ | |||||||
|       n /= pPager->pageSize; |       n /= pPager->pageSize; | ||||||
|     } |     } | ||||||
|     if( pPager->state!=PAGER_UNLOCK ){ |     if( pPager->state!=PAGER_UNLOCK ){ | ||||||
|       pPager->dbSize = (int)n; |       pPager->dbSize = n; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   if( n==(PENDING_BYTE/pPager->pageSize) ){ |   if( n==(PENDING_BYTE/pPager->pageSize) ){ | ||||||
|     n++; |     n++; | ||||||
|   } |   } | ||||||
|   return (int)n; |   return n; | ||||||
| } | } | ||||||
|  |  | ||||||
| /* | /* | ||||||
| @@ -1887,7 +1887,7 @@ static void memoryTruncate(Pager *pPager){ | |||||||
|  |  | ||||||
|   ppPg = &pPager->pAll; |   ppPg = &pPager->pAll; | ||||||
|   while( (pPg = *ppPg)!=0 ){ |   while( (pPg = *ppPg)!=0 ){ | ||||||
|     if( pPg->pgno<=(Pgno)dbSize ){ |     if( pPg->pgno<=dbSize ){ | ||||||
|       ppPg = &pPg->pNextAll; |       ppPg = &pPg->pNextAll; | ||||||
|     }else if( pPg->nRef>0 ){ |     }else if( pPg->nRef>0 ){ | ||||||
|       memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize); |       memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize); | ||||||
| @@ -2265,7 +2265,7 @@ static int pager_write_pagelist(PgHdr *pList){ | |||||||
|     ** make the file smaller (presumably by auto-vacuum code). Do not write |     ** make the file smaller (presumably by auto-vacuum code). Do not write | ||||||
|     ** any such pages to the file. |     ** any such pages to the file. | ||||||
|     */ |     */ | ||||||
|     if( pList->pgno<=(Pgno)pPager->dbSize ){ |     if( pList->pgno<=pPager->dbSize ){ | ||||||
|       char *pData = CODEC2(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6); |       char *pData = CODEC2(pPager, PGHDR_TO_DATA(pList), pList->pgno, 6); | ||||||
|       TRACE3("STORE %d page %d\n", PAGERID(pPager), pList->pgno); |       TRACE3("STORE %d page %d\n", PAGERID(pPager), pList->pgno); | ||||||
|       rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize); |       rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize); | ||||||
| @@ -3625,7 +3625,7 @@ int sqlite3pager_sync(Pager *pPager, const char *zMaster, Pgno nTrunc){ | |||||||
|         Pgno i; |         Pgno i; | ||||||
|         void *pPage; |         void *pPage; | ||||||
|         int iSkip = PAGER_MJ_PGNO(pPager); |         int iSkip = PAGER_MJ_PGNO(pPager); | ||||||
|         for( i=nTrunc+1; i<=(Pgno)pPager->origDbSize; i++ ){ |         for( i=nTrunc+1; i<=pPager->origDbSize; i++ ){ | ||||||
|           if( !(pPager->aInJournal[i/8] & (1<<(i&7))) && i!=iSkip ){ |           if( !(pPager->aInJournal[i/8] & (1<<(i&7))) && i!=iSkip ){ | ||||||
|             rc = sqlite3pager_get(pPager, i, &pPage); |             rc = sqlite3pager_get(pPager, i, &pPage); | ||||||
|             if( rc!=SQLITE_OK ) goto sync_exit; |             if( rc!=SQLITE_OK ) goto sync_exit; | ||||||
|   | |||||||
| @@ -16,10 +16,6 @@ | |||||||
| #ifndef _SQLITEINT_H_ | #ifndef _SQLITEINT_H_ | ||||||
| #define _SQLITEINT_H_ | #define _SQLITEINT_H_ | ||||||
|  |  | ||||||
| #if defined _MSC_VER && _MSC_VER >= 1400 |  | ||||||
| 	#define _CRT_SECURE_NO_DEPRECATE |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /* | /* | ||||||
| ** Extra interface definitions for those who need them | ** Extra interface definitions for those who need them | ||||||
| */ | */ | ||||||
|   | |||||||
| @@ -1223,17 +1223,17 @@ int sqlite3PutVarint(unsigned char *p, u64 v){ | |||||||
|   int i, j, n; |   int i, j, n; | ||||||
|   u8 buf[10]; |   u8 buf[10]; | ||||||
|   if( v & (((u64)0xff000000)<<32) ){ |   if( v & (((u64)0xff000000)<<32) ){ | ||||||
|     p[8] = (unsigned char)v; |     p[8] = v; | ||||||
|     v >>= 8; |     v >>= 8; | ||||||
|     for(i=7; i>=0; i--){ |     for(i=7; i>=0; i--){ | ||||||
|       p[i] = (unsigned char)((v & 0x7f) | 0x80); |       p[i] = (v & 0x7f) | 0x80; | ||||||
|       v >>= 7; |       v >>= 7; | ||||||
|     } |     } | ||||||
|     return 9; |     return 9; | ||||||
|   }     |   }     | ||||||
|   n = 0; |   n = 0; | ||||||
|   do{ |   do{ | ||||||
|     buf[n++] = (u8)((v & 0x7f) | 0x80); |     buf[n++] = (v & 0x7f) | 0x80; | ||||||
|     v >>= 7; |     v >>= 7; | ||||||
|   }while( v!=0 ); |   }while( v!=0 ); | ||||||
|   buf[0] &= 0x7f; |   buf[0] &= 0x7f; | ||||||
|   | |||||||
| @@ -1928,7 +1928,7 @@ case OP_Column: { | |||||||
|     }else if( pC->isIndex ){ |     }else if( pC->isIndex ){ | ||||||
|       i64 payloadSize64; |       i64 payloadSize64; | ||||||
|       sqlite3BtreeKeySize(pCrsr, &payloadSize64); |       sqlite3BtreeKeySize(pCrsr, &payloadSize64); | ||||||
|       payloadSize = (u32)payloadSize64; |       payloadSize = payloadSize64; | ||||||
|     }else{ |     }else{ | ||||||
|       sqlite3BtreeDataSize(pCrsr, &payloadSize); |       sqlite3BtreeDataSize(pCrsr, &payloadSize); | ||||||
|     } |     } | ||||||
| @@ -1994,7 +1994,7 @@ case OP_Column: { | |||||||
|       ** having to make additional calls to fetch the content portion of |       ** having to make additional calls to fetch the content portion of | ||||||
|       ** the record. |       ** the record. | ||||||
|       */ |       */ | ||||||
|       if( (u32)avail>=payloadSize ){ |       if( avail>=payloadSize ){ | ||||||
|         zRec = zData; |         zRec = zData; | ||||||
|         pC->aRow = (u8*)zData; |         pC->aRow = (u8*)zData; | ||||||
|       }else{ |       }else{ | ||||||
| @@ -2010,7 +2010,7 @@ case OP_Column: { | |||||||
|     ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to |     ** in the B-Tree.  When that happens, use sqlite3VdbeMemFromBtree() to | ||||||
|     ** acquire the complete header text. |     ** acquire the complete header text. | ||||||
|     */ |     */ | ||||||
|     if( !zRec && (u32)avail<offset ){ |     if( !zRec && avail<offset ){ | ||||||
|       rc = sqlite3VdbeMemFromBtree(pCrsr, 0, offset, pC->isIndex, &sMem); |       rc = sqlite3VdbeMemFromBtree(pCrsr, 0, offset, pC->isIndex, &sMem); | ||||||
|       if( rc!=SQLITE_OK ){ |       if( rc!=SQLITE_OK ){ | ||||||
|         goto op_column_out; |         goto op_column_out; | ||||||
| @@ -2025,7 +2025,7 @@ case OP_Column: { | |||||||
|     ** column and aOffset[i] will contain the offset from the beginning |     ** column and aOffset[i] will contain the offset from the beginning | ||||||
|     ** of the record to the start of the data for the i-th column |     ** of the record to the start of the data for the i-th column | ||||||
|     */ |     */ | ||||||
|     for(i=0; (u32)i<nField; i++){ |     for(i=0; i<nField; i++){ | ||||||
|       if( zIdx<zEndHdr ){ |       if( zIdx<zEndHdr ){ | ||||||
|         aOffset[i] = offset; |         aOffset[i] = offset; | ||||||
|         zIdx += GetVarint(zIdx, aType[i]); |         zIdx += GetVarint(zIdx, aType[i]); | ||||||
| @@ -2447,11 +2447,11 @@ case OP_SetCookie: {       /* no-push */ | |||||||
|   rc = sqlite3BtreeUpdateMeta(pDb->pBt, 1+pOp->p2, (int)pTos->i); |   rc = sqlite3BtreeUpdateMeta(pDb->pBt, 1+pOp->p2, (int)pTos->i); | ||||||
|   if( pOp->p2==0 ){ |   if( pOp->p2==0 ){ | ||||||
|     /* When the schema cookie changes, record the new cookie internally */ |     /* When the schema cookie changes, record the new cookie internally */ | ||||||
|     pDb->pSchema->schema_cookie = (int)pTos->i; |     pDb->pSchema->schema_cookie = pTos->i; | ||||||
|     db->flags |= SQLITE_InternChanges; |     db->flags |= SQLITE_InternChanges; | ||||||
|   }else if( pOp->p2==1 ){ |   }else if( pOp->p2==1 ){ | ||||||
|     /* Record changes in the file format */ |     /* Record changes in the file format */ | ||||||
|     pDb->pSchema->file_format = (u8)pTos->i; |     pDb->pSchema->file_format = pTos->i; | ||||||
|   } |   } | ||||||
|   assert( (pTos->flags & MEM_Dyn)==0 ); |   assert( (pTos->flags & MEM_Dyn)==0 ); | ||||||
|   pTos--; |   pTos--; | ||||||
| @@ -2551,7 +2551,7 @@ case OP_OpenWrite: {       /* no-push */ | |||||||
|    |    | ||||||
|   assert( pTos>=p->aStack ); |   assert( pTos>=p->aStack ); | ||||||
|   sqlite3VdbeMemIntegerify(pTos); |   sqlite3VdbeMemIntegerify(pTos); | ||||||
|   iDb = (int)pTos->i; |   iDb = pTos->i; | ||||||
|   assert( (pTos->flags & MEM_Dyn)==0 ); |   assert( (pTos->flags & MEM_Dyn)==0 ); | ||||||
|   pTos--; |   pTos--; | ||||||
|   assert( iDb>=0 && iDb<db->nDb ); |   assert( iDb>=0 && iDb<db->nDb ); | ||||||
| @@ -2569,7 +2569,7 @@ case OP_OpenWrite: {       /* no-push */ | |||||||
|   if( p2<=0 ){ |   if( p2<=0 ){ | ||||||
|     assert( pTos>=p->aStack ); |     assert( pTos>=p->aStack ); | ||||||
|     sqlite3VdbeMemIntegerify(pTos); |     sqlite3VdbeMemIntegerify(pTos); | ||||||
|     p2 = (int)pTos->i; |     p2 = pTos->i; | ||||||
|     assert( (pTos->flags & MEM_Dyn)==0 ); |     assert( (pTos->flags & MEM_Dyn)==0 ); | ||||||
|     pTos--; |     pTos--; | ||||||
|     assert( p2>=2 ); |     assert( p2>=2 ); | ||||||
| @@ -3442,7 +3442,7 @@ case OP_RowData: { | |||||||
|       i64 n64; |       i64 n64; | ||||||
|       assert( !pC->isTable ); |       assert( !pC->isTable ); | ||||||
|       sqlite3BtreeKeySize(pCrsr, &n64); |       sqlite3BtreeKeySize(pCrsr, &n64); | ||||||
|       n = (u32)n64; |       n = n64; | ||||||
|     }else{ |     }else{ | ||||||
|       sqlite3BtreeDataSize(pCrsr, &n); |       sqlite3BtreeDataSize(pCrsr, &n); | ||||||
|     } |     } | ||||||
| @@ -4115,7 +4115,7 @@ case OP_IntegrityCk: { | |||||||
|   if( aRoot==0 ) goto no_mem; |   if( aRoot==0 ) goto no_mem; | ||||||
|   for(j=0; j<nRoot; j++){ |   for(j=0; j<nRoot; j++){ | ||||||
|     Mem *pMem = &pTos[-j]; |     Mem *pMem = &pTos[-j]; | ||||||
|     aRoot[j] = (int)pMem->i; |     aRoot[j] = pMem->i; | ||||||
|   } |   } | ||||||
|   aRoot[j] = 0; |   aRoot[j] = 0; | ||||||
|   popStack(&pTos, nRoot); |   popStack(&pTos, nRoot); | ||||||
|   | |||||||
| @@ -52,7 +52,7 @@ double sqlite3_value_double(sqlite3_value *pVal){ | |||||||
|   return sqlite3VdbeRealValue((Mem*)pVal); |   return sqlite3VdbeRealValue((Mem*)pVal); | ||||||
| } | } | ||||||
| int sqlite3_value_int(sqlite3_value *pVal){ | int sqlite3_value_int(sqlite3_value *pVal){ | ||||||
|   return (int)sqlite3VdbeIntValue((Mem*)pVal); |   return sqlite3VdbeIntValue((Mem*)pVal); | ||||||
| } | } | ||||||
| sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ | sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ | ||||||
|   return sqlite3VdbeIntValue((Mem*)pVal); |   return sqlite3VdbeIntValue((Mem*)pVal); | ||||||
| @@ -198,7 +198,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){ | |||||||
|     if( db->xProfile && !db->init.busy ){ |     if( db->xProfile && !db->init.busy ){ | ||||||
|       double rNow; |       double rNow; | ||||||
|       sqlite3OsCurrentTime(&rNow); |       sqlite3OsCurrentTime(&rNow); | ||||||
|       p->startTime = (int)((rNow - (int)rNow)*3600.0*24.0*1000000000.0); |       p->startTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0; | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -235,7 +235,7 @@ int sqlite3_step(sqlite3_stmt *pStmt){ | |||||||
|     u64 elapseTime; |     u64 elapseTime; | ||||||
|  |  | ||||||
|     sqlite3OsCurrentTime(&rNow); |     sqlite3OsCurrentTime(&rNow); | ||||||
|     elapseTime = (u64)((rNow - (int)rNow)*3600.0*24.0*1000000000.0 - p->startTime); |     elapseTime = (rNow - (int)rNow)*3600.0*24.0*1000000000.0 - p->startTime; | ||||||
|     assert( p->nOp>0 ); |     assert( p->nOp>0 ); | ||||||
|     assert( p->aOp[p->nOp-1].opcode==OP_Noop ); |     assert( p->aOp[p->nOp-1].opcode==OP_Noop ); | ||||||
|     assert( p->aOp[p->nOp-1].p3!=0 ); |     assert( p->aOp[p->nOp-1].p3!=0 ); | ||||||
|   | |||||||
| @@ -561,7 +561,7 @@ static char *displayP3(Op *pOp, char *zTemp, int nTemp){ | |||||||
|       char zNum[30]; |       char zNum[30]; | ||||||
|       sprintf(zTemp, "%.*s", nTemp, pDef->zName); |       sprintf(zTemp, "%.*s", nTemp, pDef->zName); | ||||||
|       sprintf(zNum,"(%d)", pDef->nArg); |       sprintf(zNum,"(%d)", pDef->nArg); | ||||||
|       if( strlen(zTemp)+strlen(zNum)+1<=(size_t)nTemp ){ |       if( strlen(zTemp)+strlen(zNum)+1<=nTemp ){ | ||||||
|         strcat(zTemp, zNum); |         strcat(zTemp, zNum); | ||||||
|       } |       } | ||||||
|       zP3 = zTemp; |       zP3 = zTemp; | ||||||
| @@ -1592,7 +1592,7 @@ u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){ | |||||||
|     i64 i = pMem->i; |     i64 i = pMem->i; | ||||||
|     u64 u; |     u64 u; | ||||||
|     if( file_format>=4 && (i&1)==i ){ |     if( file_format>=4 && (i&1)==i ){ | ||||||
|       return 8+(u32)i; |       return 8+i; | ||||||
|     } |     } | ||||||
|     u = i<0 ? -i : i; |     u = i<0 ? -i : i; | ||||||
|     if( u<=127 ) return 1; |     if( u<=127 ) return 1; | ||||||
| @@ -1648,7 +1648,7 @@ int sqlite3VdbeSerialPut(unsigned char *buf, Mem *pMem, int file_format){ | |||||||
|     } |     } | ||||||
|     len = i = sqlite3VdbeSerialTypeLen(serial_type); |     len = i = sqlite3VdbeSerialTypeLen(serial_type); | ||||||
|     while( i-- ){ |     while( i-- ){ | ||||||
|       buf[i] = (char)(v&0xFF); |       buf[i] = (v&0xFF); | ||||||
|       v >>= 8; |       v >>= 8; | ||||||
|     } |     } | ||||||
|     return len; |     return len; | ||||||
| @@ -1810,9 +1810,9 @@ int sqlite3VdbeRecordCompare( | |||||||
|  |  | ||||||
|     /* Read the serial types for the next element in each key. */ |     /* Read the serial types for the next element in each key. */ | ||||||
|     idx1 += GetVarint( aKey1+idx1, serial_type1 ); |     idx1 += GetVarint( aKey1+idx1, serial_type1 ); | ||||||
|     if( d1>=(u32)nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break; |     if( d1>=nKey1 && sqlite3VdbeSerialTypeLen(serial_type1)>0 ) break; | ||||||
|     idx2 += GetVarint( aKey2+idx2, serial_type2 ); |     idx2 += GetVarint( aKey2+idx2, serial_type2 ); | ||||||
|     if( d2>=(u32)nKey2 && sqlite3VdbeSerialTypeLen(serial_type2)>0 ) break; |     if( d2>=nKey2 && sqlite3VdbeSerialTypeLen(serial_type2)>0 ) break; | ||||||
|  |  | ||||||
|     /* Assert that there is enough space left in each key for the blob of |     /* Assert that there is enough space left in each key for the blob of | ||||||
|     ** data to go with the serial type just read. This assert may fail if |     ** data to go with the serial type just read. This assert may fail if | ||||||
| @@ -1838,9 +1838,9 @@ int sqlite3VdbeRecordCompare( | |||||||
|   if( rc==0 ){ |   if( rc==0 ){ | ||||||
|     if( pKeyInfo->incrKey ){ |     if( pKeyInfo->incrKey ){ | ||||||
|       rc = -1; |       rc = -1; | ||||||
|     }else if( d1<(u32)nKey1 ){ |     }else if( d1<nKey1 ){ | ||||||
|       rc = 1; |       rc = 1; | ||||||
|     }else if( d2<(u32)nKey2 ){ |     }else if( d2<nKey2 ){ | ||||||
|       rc = -1; |       rc = -1; | ||||||
|     } |     } | ||||||
|   }else if( pKeyInfo->aSortOrder && i<pKeyInfo->nField |   }else if( pKeyInfo->aSortOrder && i<pKeyInfo->nField | ||||||
| @@ -1884,7 +1884,7 @@ int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){ | |||||||
|   if( nCellKey<=0 ){ |   if( nCellKey<=0 ){ | ||||||
|     return SQLITE_CORRUPT_BKPT; |     return SQLITE_CORRUPT_BKPT; | ||||||
|   } |   } | ||||||
|   rc = sqlite3VdbeMemFromBtree(pCur, 0, (int)nCellKey, 1, &m); |   rc = sqlite3VdbeMemFromBtree(pCur, 0, nCellKey, 1, &m); | ||||||
|   if( rc ){ |   if( rc ){ | ||||||
|     return rc; |     return rc; | ||||||
|   } |   } | ||||||
| @@ -1923,7 +1923,7 @@ int sqlite3VdbeIdxKeyCompare( | |||||||
|     *res = 0; |     *res = 0; | ||||||
|     return SQLITE_OK; |     return SQLITE_OK; | ||||||
|   } |   } | ||||||
|   rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (int)nCellKey, 1, &m); |   rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, nCellKey, 1, &m); | ||||||
|   if( rc ){ |   if( rc ){ | ||||||
|     return rc; |     return rc; | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -316,7 +316,7 @@ double sqlite3VdbeRealValue(Mem *pMem){ | |||||||
| */ | */ | ||||||
| void sqlite3VdbeIntegerAffinity(Mem *pMem){ | void sqlite3VdbeIntegerAffinity(Mem *pMem){ | ||||||
|   assert( pMem->flags & MEM_Real ); |   assert( pMem->flags & MEM_Real ); | ||||||
|   pMem->i = (i64)pMem->r; |   pMem->i = pMem->r; | ||||||
|   if( ((double)pMem->i)==pMem->r ){ |   if( ((double)pMem->i)==pMem->r ){ | ||||||
|     pMem->flags |= MEM_Int; |     pMem->flags |= MEM_Int; | ||||||
|   } |   } | ||||||
| @@ -554,12 +554,12 @@ int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){ | |||||||
|     if( (f1 & f2 & MEM_Int)==0 ){ |     if( (f1 & f2 & MEM_Int)==0 ){ | ||||||
|       double r1, r2; |       double r1, r2; | ||||||
|       if( (f1&MEM_Real)==0 ){ |       if( (f1&MEM_Real)==0 ){ | ||||||
|         r1 = (double)pMem1->i; |         r1 = pMem1->i; | ||||||
|       }else{ |       }else{ | ||||||
|         r1 = pMem1->r; |         r1 = pMem1->r; | ||||||
|       } |       } | ||||||
|       if( (f2&MEM_Real)==0 ){ |       if( (f2&MEM_Real)==0 ){ | ||||||
|         r2 = (double)pMem2->i; |         r2 = pMem2->i; | ||||||
|       }else{ |       }else{ | ||||||
|         r2 = pMem2->r; |         r2 = pMem2->r; | ||||||
|       } |       } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user