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