mirror of
https://github.com/sqlite/sqlite.git
synced 2025-08-08 14:02:16 +03:00
Continuing work toward supporting unsigned 32-bit page numbers.
FossilOrigin-Name: 9ce1710aad43cebe5ad50859c7685fb83e40cdd4a60913bd2b7e659bc59942fd
This commit is contained in:
25
manifest
25
manifest
@@ -1,8 +1,23 @@
|
|||||||
B d2aac001204621062e6cb3230ce2ac1b4545cb83b3ebb6bfebccee4d51162e97
|
B d2aac001204621062e6cb3230ce2ac1b4545cb83b3ebb6bfebccee4d51162e97
|
||||||
C Enhance\sshowdb\sto\sbe\s32-bit\sclean.
|
C Continuing\swork\stoward\ssupporting\sunsigned\s32-bit\spage\snumbers.
|
||||||
D 2020-07-22T11:42:50.494
|
D 2020-07-22T13:38:04.291
|
||||||
|
F src/analyze.c 5cffff3d355858cd22bfc6e20ac7203510d2e1cc935086eb06f4abb2f579f628
|
||||||
|
F src/btree.c 7c8eec7364491b07481cdce83c42a00adbfd8a1c4c3af85351cd37f666946711
|
||||||
|
F src/btree.h 7d4384cfa8cb7b7c389ae7572e8c1815eaf6a628bc8799b9cb6d9073bfbd7a47
|
||||||
|
F src/btreeInt.h 83166f6daeb91062b6ae9ee6247b3ad07e40eba58f3c05ba9e8dedad4ab1ea38
|
||||||
|
F src/build.c f2b73fbb2197fb6e6a35ff2e1750085f023dc50542185f1a2dfccd632223eb14
|
||||||
|
F src/pager.c a5f65ff2cd73b8d381cc7b338cac382ca6978d578fa0b84fdaa11d3cdc3c3e18
|
||||||
|
F src/prepare.c bf7c91ade36365a428e1f2a2daa56e45c5245d78390c9daa3550cc29a85d8ddc
|
||||||
|
F src/select.c 0e75d64091200a2a8fdc02abafe176a0c2e9b2654c4cc34564f25f0b408e91de
|
||||||
|
F src/sqliteInt.h eb4f7746ca2f90dfd5ccaa182960daafccd63f3f7be83589f4257b41e0e5f70f
|
||||||
|
F src/util.c 58bf59fb0923017619c9c53957a676ff2322314b2547f6a223e0707e7ba505de
|
||||||
|
F src/vdbe.c 44ac1776fa89e54dd49e71838aed17ceb316d993378d0d71818f7e853e934d0e
|
||||||
|
F src/vdbe.h 83603854bfa5851af601fc0947671eb260f4363e62e960e8a994fb9bbcd2aaa1
|
||||||
|
F src/vdbeInt.h 762abffb7709f19c2cb74af1bba73a900f762e64f80d69c31c9ae89ed1066b60
|
||||||
|
F src/vdbeaux.c 1cbbbffdb874c6f3e7aab40f3deb48abac4a71df1043cd95bb0d652d4e053871
|
||||||
|
F src/wherecode.c 8064fe5c042824853a9b1fda670054a51a49033a6c79059988c97751ccf8088e
|
||||||
F tool/showdb.c 49e810f5c414c792b5bf38cd5557ca9639713ebfef32aaff32faf7cb7ccce513
|
F tool/showdb.c 49e810f5c414c792b5bf38cd5557ca9639713ebfef32aaff32faf7cb7ccce513
|
||||||
P d2aac001204621062e6cb3230ce2ac1b4545cb83b3ebb6bfebccee4d51162e97
|
P a8200327d4e8e78abef09c64345e0036f730fbbb20ae88935ef6c9972e6c7d5e
|
||||||
R b4a9d9ac47a2df8104423524365f06a3
|
R c66299fcf6b32707c92eb02ae42601b9
|
||||||
U drh
|
U drh
|
||||||
Z 5ffbe463723cf57117080dd90d8531a6
|
Z 576c578c8e2c423100cf2841ed177ce2
|
||||||
|
@@ -1 +1 @@
|
|||||||
a8200327d4e8e78abef09c64345e0036f730fbbb20ae88935ef6c9972e6c7d5e
|
9ce1710aad43cebe5ad50859c7685fb83e40cdd4a60913bd2b7e659bc59942fd
|
@@ -186,7 +186,7 @@ static void openStatTable(
|
|||||||
sqlite3 *db = pParse->db;
|
sqlite3 *db = pParse->db;
|
||||||
Db *pDb;
|
Db *pDb;
|
||||||
Vdbe *v = sqlite3GetVdbe(pParse);
|
Vdbe *v = sqlite3GetVdbe(pParse);
|
||||||
int aRoot[ArraySize(aTable)];
|
u32 aRoot[ArraySize(aTable)];
|
||||||
u8 aCreateTbl[ArraySize(aTable)];
|
u8 aCreateTbl[ArraySize(aTable)];
|
||||||
#ifdef SQLITE_ENABLE_STAT4
|
#ifdef SQLITE_ENABLE_STAT4
|
||||||
const int nToOpen = OptimizationEnabled(db,SQLITE_Stat4) ? 2 : 1;
|
const int nToOpen = OptimizationEnabled(db,SQLITE_Stat4) ? 2 : 1;
|
||||||
@@ -215,7 +215,7 @@ static void openStatTable(
|
|||||||
sqlite3NestedParse(pParse,
|
sqlite3NestedParse(pParse,
|
||||||
"CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols
|
"CREATE TABLE %Q.%s(%s)", pDb->zDbSName, zTab, aTable[i].zCols
|
||||||
);
|
);
|
||||||
aRoot[i] = pParse->regRoot;
|
aRoot[i] = (u32)pParse->regRoot;
|
||||||
aCreateTbl[i] = OPFLAG_P2ISREG;
|
aCreateTbl[i] = OPFLAG_P2ISREG;
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@@ -235,7 +235,7 @@ static void openStatTable(
|
|||||||
#endif
|
#endif
|
||||||
}else{
|
}else{
|
||||||
/* The sqlite_stat[134] table already exists. Delete all rows. */
|
/* The sqlite_stat[134] table already exists. Delete all rows. */
|
||||||
sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb);
|
sqlite3VdbeAddOp2(v, OP_Clear, (int)aRoot[i], iDb);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,7 +243,7 @@ static void openStatTable(
|
|||||||
/* Open the sqlite_stat[134] tables for writing. */
|
/* Open the sqlite_stat[134] tables for writing. */
|
||||||
for(i=0; i<nToOpen; i++){
|
for(i=0; i<nToOpen; i++){
|
||||||
assert( i<ArraySize(aTable) );
|
assert( i<ArraySize(aTable) );
|
||||||
sqlite3VdbeAddOp4Int(v, OP_OpenWrite, iStatCur+i, aRoot[i], iDb, 3);
|
sqlite3VdbeAddOp4Int(v, OP_OpenWrite, iStatCur+i, (int)aRoot[i], iDb, 3);
|
||||||
sqlite3VdbeChangeP5(v, aCreateTbl[i]);
|
sqlite3VdbeChangeP5(v, aCreateTbl[i]);
|
||||||
VdbeComment((v, aTable[i].zName));
|
VdbeComment((v, aTable[i].zName));
|
||||||
}
|
}
|
||||||
|
36
src/btree.c
36
src/btree.c
@@ -4372,7 +4372,7 @@ int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
|
|||||||
*/
|
*/
|
||||||
static int btreeCursor(
|
static int btreeCursor(
|
||||||
Btree *p, /* The btree */
|
Btree *p, /* The btree */
|
||||||
int iTable, /* Root page of table to open */
|
Pgno iTable, /* Root page of table to open */
|
||||||
int wrFlag, /* 1 to write. 0 read-only */
|
int wrFlag, /* 1 to write. 0 read-only */
|
||||||
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
||||||
BtCursor *pCur /* Space for new cursor */
|
BtCursor *pCur /* Space for new cursor */
|
||||||
@@ -4415,7 +4415,7 @@ static int btreeCursor(
|
|||||||
|
|
||||||
/* Now that no other errors can occur, finish filling in the BtCursor
|
/* Now that no other errors can occur, finish filling in the BtCursor
|
||||||
** variables and link the cursor into the BtShared list. */
|
** variables and link the cursor into the BtShared list. */
|
||||||
pCur->pgnoRoot = (Pgno)iTable;
|
pCur->pgnoRoot = iTable;
|
||||||
pCur->iPage = -1;
|
pCur->iPage = -1;
|
||||||
pCur->pKeyInfo = pKeyInfo;
|
pCur->pKeyInfo = pKeyInfo;
|
||||||
pCur->pBtree = p;
|
pCur->pBtree = p;
|
||||||
@@ -4425,7 +4425,7 @@ static int btreeCursor(
|
|||||||
/* If there are two or more cursors on the same btree, then all such
|
/* If there are two or more cursors on the same btree, then all such
|
||||||
** cursors *must* have the BTCF_Multiple flag set. */
|
** cursors *must* have the BTCF_Multiple flag set. */
|
||||||
for(pX=pBt->pCursor; pX; pX=pX->pNext){
|
for(pX=pBt->pCursor; pX; pX=pX->pNext){
|
||||||
if( pX->pgnoRoot==(Pgno)iTable ){
|
if( pX->pgnoRoot==iTable ){
|
||||||
pX->curFlags |= BTCF_Multiple;
|
pX->curFlags |= BTCF_Multiple;
|
||||||
pCur->curFlags |= BTCF_Multiple;
|
pCur->curFlags |= BTCF_Multiple;
|
||||||
}
|
}
|
||||||
@@ -4437,7 +4437,7 @@ static int btreeCursor(
|
|||||||
}
|
}
|
||||||
static int btreeCursorWithLock(
|
static int btreeCursorWithLock(
|
||||||
Btree *p, /* The btree */
|
Btree *p, /* The btree */
|
||||||
int iTable, /* Root page of table to open */
|
Pgno iTable, /* Root page of table to open */
|
||||||
int wrFlag, /* 1 to write. 0 read-only */
|
int wrFlag, /* 1 to write. 0 read-only */
|
||||||
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
struct KeyInfo *pKeyInfo, /* First arg to comparison function */
|
||||||
BtCursor *pCur /* Space for new cursor */
|
BtCursor *pCur /* Space for new cursor */
|
||||||
@@ -4450,7 +4450,7 @@ static int btreeCursorWithLock(
|
|||||||
}
|
}
|
||||||
int sqlite3BtreeCursor(
|
int sqlite3BtreeCursor(
|
||||||
Btree *p, /* The btree */
|
Btree *p, /* The btree */
|
||||||
int iTable, /* Root page of table to open */
|
Pgno iTable, /* Root page of table to open */
|
||||||
int wrFlag, /* 1 to write. 0 read-only */
|
int wrFlag, /* 1 to write. 0 read-only */
|
||||||
struct KeyInfo *pKeyInfo, /* First arg to xCompare() */
|
struct KeyInfo *pKeyInfo, /* First arg to xCompare() */
|
||||||
BtCursor *pCur /* Write new cursor here */
|
BtCursor *pCur /* Write new cursor here */
|
||||||
@@ -9094,7 +9094,7 @@ int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
|
|||||||
** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
|
** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys
|
||||||
** BTREE_ZERODATA Used for SQL indices
|
** BTREE_ZERODATA Used for SQL indices
|
||||||
*/
|
*/
|
||||||
static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
|
static int btreeCreateTable(Btree *p, Pgno *piTable, int createTabFlags){
|
||||||
BtShared *pBt = p->pBt;
|
BtShared *pBt = p->pBt;
|
||||||
MemPage *pRoot;
|
MemPage *pRoot;
|
||||||
Pgno pgnoRoot;
|
Pgno pgnoRoot;
|
||||||
@@ -9234,10 +9234,10 @@ static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
|
|||||||
zeroPage(pRoot, ptfFlags);
|
zeroPage(pRoot, ptfFlags);
|
||||||
sqlite3PagerUnref(pRoot->pDbPage);
|
sqlite3PagerUnref(pRoot->pDbPage);
|
||||||
assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );
|
assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 );
|
||||||
*piTable = (int)pgnoRoot;
|
*piTable = pgnoRoot;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){
|
int sqlite3BtreeCreateTable(Btree *p, Pgno *piTable, int flags){
|
||||||
int rc;
|
int rc;
|
||||||
sqlite3BtreeEnter(p);
|
sqlite3BtreeEnter(p);
|
||||||
rc = btreeCreateTable(p, piTable, flags);
|
rc = btreeCreateTable(p, piTable, flags);
|
||||||
@@ -9721,7 +9721,7 @@ static void checkPtrmap(
|
|||||||
static void checkList(
|
static void checkList(
|
||||||
IntegrityCk *pCheck, /* Integrity checking context */
|
IntegrityCk *pCheck, /* Integrity checking context */
|
||||||
int isFreeList, /* True for a freelist. False for overflow page list */
|
int isFreeList, /* True for a freelist. False for overflow page list */
|
||||||
int iPage, /* Page number for first page in the list */
|
Pgno iPage, /* Page number for first page in the list */
|
||||||
u32 N /* Expected number of pages in the list */
|
u32 N /* Expected number of pages in the list */
|
||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
@@ -9853,7 +9853,7 @@ static int btreeHeapPull(u32 *aHeap, u32 *pOut){
|
|||||||
*/
|
*/
|
||||||
static int checkTreePage(
|
static int checkTreePage(
|
||||||
IntegrityCk *pCheck, /* Context for the sanity check */
|
IntegrityCk *pCheck, /* Context for the sanity check */
|
||||||
int iPage, /* Page number of the page to check */
|
Pgno iPage, /* Page number of the page to check */
|
||||||
i64 *piMinKey, /* Write minimum integer primary key here */
|
i64 *piMinKey, /* Write minimum integer primary key here */
|
||||||
i64 maxKey /* Error if integer primary key greater than this */
|
i64 maxKey /* Error if integer primary key greater than this */
|
||||||
){
|
){
|
||||||
@@ -9889,9 +9889,9 @@ static int checkTreePage(
|
|||||||
usableSize = pBt->usableSize;
|
usableSize = pBt->usableSize;
|
||||||
if( iPage==0 ) return 0;
|
if( iPage==0 ) return 0;
|
||||||
if( checkRef(pCheck, iPage) ) return 0;
|
if( checkRef(pCheck, iPage) ) return 0;
|
||||||
pCheck->zPfx = "Page %d: ";
|
pCheck->zPfx = "Page %u: ";
|
||||||
pCheck->v1 = iPage;
|
pCheck->v1 = iPage;
|
||||||
if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){
|
if( (rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0 ){
|
||||||
checkAppendMsg(pCheck,
|
checkAppendMsg(pCheck,
|
||||||
"unable to get the page. error code=%d", rc);
|
"unable to get the page. error code=%d", rc);
|
||||||
goto end_of_check;
|
goto end_of_check;
|
||||||
@@ -9916,7 +9916,7 @@ static int checkTreePage(
|
|||||||
hdr = pPage->hdrOffset;
|
hdr = pPage->hdrOffset;
|
||||||
|
|
||||||
/* Set up for cell analysis */
|
/* Set up for cell analysis */
|
||||||
pCheck->zPfx = "On tree page %d cell %d: ";
|
pCheck->zPfx = "On tree page %u cell %d: ";
|
||||||
contentOffset = get2byteNotZero(&data[hdr+5]);
|
contentOffset = get2byteNotZero(&data[hdr+5]);
|
||||||
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
|
assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */
|
||||||
|
|
||||||
@@ -9936,7 +9936,7 @@ static int checkTreePage(
|
|||||||
pgno = get4byte(&data[hdr+8]);
|
pgno = get4byte(&data[hdr+8]);
|
||||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||||
if( pBt->autoVacuum ){
|
if( pBt->autoVacuum ){
|
||||||
pCheck->zPfx = "On page %d at right child: ";
|
pCheck->zPfx = "On page %u at right child: ";
|
||||||
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
|
checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -10077,7 +10077,7 @@ static int checkTreePage(
|
|||||||
while( btreeHeapPull(heap,&x) ){
|
while( btreeHeapPull(heap,&x) ){
|
||||||
if( (prev&0xffff)>=(x>>16) ){
|
if( (prev&0xffff)>=(x>>16) ){
|
||||||
checkAppendMsg(pCheck,
|
checkAppendMsg(pCheck,
|
||||||
"Multiple uses for byte %u of page %d", x>>16, iPage);
|
"Multiple uses for byte %u of page %u", x>>16, iPage);
|
||||||
break;
|
break;
|
||||||
}else{
|
}else{
|
||||||
nFrag += (x>>16) - (prev&0xffff) - 1;
|
nFrag += (x>>16) - (prev&0xffff) - 1;
|
||||||
@@ -10092,7 +10092,7 @@ static int checkTreePage(
|
|||||||
*/
|
*/
|
||||||
if( heap[0]==0 && nFrag!=data[hdr+7] ){
|
if( heap[0]==0 && nFrag!=data[hdr+7] ){
|
||||||
checkAppendMsg(pCheck,
|
checkAppendMsg(pCheck,
|
||||||
"Fragmentation of %d bytes reported as %d on page %d",
|
"Fragmentation of %d bytes reported as %d on page %u",
|
||||||
nFrag, data[hdr+7], iPage);
|
nFrag, data[hdr+7], iPage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10124,7 +10124,7 @@ end_of_check:
|
|||||||
char *sqlite3BtreeIntegrityCheck(
|
char *sqlite3BtreeIntegrityCheck(
|
||||||
sqlite3 *db, /* Database connection that is running the check */
|
sqlite3 *db, /* Database connection that is running the check */
|
||||||
Btree *p, /* The btree to be checked */
|
Btree *p, /* The btree to be checked */
|
||||||
int *aRoot, /* An array of root pages numbers for individual trees */
|
Pgno *aRoot, /* An array of root pages numbers for individual trees */
|
||||||
int nRoot, /* Number of entries in aRoot[] */
|
int nRoot, /* Number of entries in aRoot[] */
|
||||||
int mxErr, /* Stop reporting errors after this many */
|
int mxErr, /* Stop reporting errors after this many */
|
||||||
int *pnErr /* Write number of errors seen to this variable */
|
int *pnErr /* Write number of errors seen to this variable */
|
||||||
@@ -10183,7 +10183,7 @@ char *sqlite3BtreeIntegrityCheck(
|
|||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||||
if( pBt->autoVacuum ){
|
if( pBt->autoVacuum ){
|
||||||
int mx = 0;
|
Pgno mx = 0;
|
||||||
int mxInHdr;
|
int mxInHdr;
|
||||||
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
|
for(i=0; (int)i<nRoot; i++) if( mx<aRoot[i] ) mx = aRoot[i];
|
||||||
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
|
mxInHdr = get4byte(&pBt->pPage1->aData[52]);
|
||||||
|
@@ -84,7 +84,7 @@ int sqlite3BtreeCommitPhaseTwo(Btree*, int);
|
|||||||
int sqlite3BtreeCommit(Btree*);
|
int sqlite3BtreeCommit(Btree*);
|
||||||
int sqlite3BtreeRollback(Btree*,int,int);
|
int sqlite3BtreeRollback(Btree*,int,int);
|
||||||
int sqlite3BtreeBeginStmt(Btree*,int);
|
int sqlite3BtreeBeginStmt(Btree*,int);
|
||||||
int sqlite3BtreeCreateTable(Btree*, int*, int flags);
|
int sqlite3BtreeCreateTable(Btree*, Pgno*, int flags);
|
||||||
int sqlite3BtreeIsInTrans(Btree*);
|
int sqlite3BtreeIsInTrans(Btree*);
|
||||||
int sqlite3BtreeIsInReadTrans(Btree*);
|
int sqlite3BtreeIsInReadTrans(Btree*);
|
||||||
int sqlite3BtreeIsInBackup(Btree*);
|
int sqlite3BtreeIsInBackup(Btree*);
|
||||||
@@ -225,7 +225,7 @@ int sqlite3BtreeNewDb(Btree *p);
|
|||||||
|
|
||||||
int sqlite3BtreeCursor(
|
int sqlite3BtreeCursor(
|
||||||
Btree*, /* BTree containing table to open */
|
Btree*, /* BTree containing table to open */
|
||||||
int iTable, /* Index of root page */
|
Pgno iTable, /* Index of root page */
|
||||||
int wrFlag, /* 1 for writing. 0 for read-only */
|
int wrFlag, /* 1 for writing. 0 for read-only */
|
||||||
struct KeyInfo*, /* First argument to compare function */
|
struct KeyInfo*, /* First argument to compare function */
|
||||||
BtCursor *pCursor /* Space to write cursor structure */
|
BtCursor *pCursor /* Space to write cursor structure */
|
||||||
@@ -316,7 +316,7 @@ const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
|
|||||||
u32 sqlite3BtreePayloadSize(BtCursor*);
|
u32 sqlite3BtreePayloadSize(BtCursor*);
|
||||||
sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor*);
|
sqlite3_int64 sqlite3BtreeMaxRecordSize(BtCursor*);
|
||||||
|
|
||||||
char *sqlite3BtreeIntegrityCheck(sqlite3*,Btree*,int*aRoot,int nRoot,int,int*);
|
char *sqlite3BtreeIntegrityCheck(sqlite3*,Btree*,Pgno*aRoot,int nRoot,int,int*);
|
||||||
struct Pager *sqlite3BtreePager(Btree*);
|
struct Pager *sqlite3BtreePager(Btree*);
|
||||||
i64 sqlite3BtreeRowCountEst(BtCursor*);
|
i64 sqlite3BtreeRowCountEst(BtCursor*);
|
||||||
|
|
||||||
|
@@ -681,7 +681,8 @@ struct IntegrityCk {
|
|||||||
int nErr; /* Number of messages written to zErrMsg so far */
|
int nErr; /* Number of messages written to zErrMsg so far */
|
||||||
int bOomFault; /* A memory allocation error has occurred */
|
int bOomFault; /* A memory allocation error has occurred */
|
||||||
const char *zPfx; /* Error message prefix */
|
const char *zPfx; /* Error message prefix */
|
||||||
int v1, v2; /* Values for up to two %d fields in zPfx */
|
Pgno v1; /* Value for first %u substitution in zPfx */
|
||||||
|
int v2; /* Value for second %d substitution in zPfx */
|
||||||
StrAccum errMsg; /* Accumulate the error message text here */
|
StrAccum errMsg; /* Accumulate the error message text here */
|
||||||
u32 *heap; /* Min-heap used for analyzing cell coverage */
|
u32 *heap; /* Min-heap used for analyzing cell coverage */
|
||||||
sqlite3 *db; /* Database connection running the check */
|
sqlite3 *db; /* Database connection running the check */
|
||||||
|
22
src/build.c
22
src/build.c
@@ -31,7 +31,7 @@
|
|||||||
*/
|
*/
|
||||||
struct TableLock {
|
struct TableLock {
|
||||||
int iDb; /* The database containing the table to be locked */
|
int iDb; /* The database containing the table to be locked */
|
||||||
int iTab; /* The root page of the table to be locked */
|
Pgno iTab; /* The root page of the table to be locked */
|
||||||
u8 isWriteLock; /* True for write lock. False for a read lock */
|
u8 isWriteLock; /* True for write lock. False for a read lock */
|
||||||
const char *zLockName; /* Name of the table */
|
const char *zLockName; /* Name of the table */
|
||||||
};
|
};
|
||||||
@@ -49,7 +49,7 @@ struct TableLock {
|
|||||||
void sqlite3TableLock(
|
void sqlite3TableLock(
|
||||||
Parse *pParse, /* Parsing context */
|
Parse *pParse, /* Parsing context */
|
||||||
int iDb, /* Index of the database containing the table to lock */
|
int iDb, /* Index of the database containing the table to lock */
|
||||||
int iTab, /* Root page number of the table to be locked */
|
Pgno iTab, /* Root page number of the table to be locked */
|
||||||
u8 isWriteLock, /* True for a write lock */
|
u8 isWriteLock, /* True for a write lock */
|
||||||
const char *zName /* Name of the table to be locked */
|
const char *zName /* Name of the table to be locked */
|
||||||
){
|
){
|
||||||
@@ -2114,7 +2114,7 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
|
|||||||
** a database schema). */
|
** a database schema). */
|
||||||
if( v && pPk->tnum>0 ){
|
if( v && pPk->tnum>0 ){
|
||||||
assert( db->init.busy==0 );
|
assert( db->init.busy==0 );
|
||||||
sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
|
sqlite3VdbeChangeOpcode(v, (int)pPk->tnum, OP_Goto);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The root page of the PRIMARY KEY is the table root page */
|
/* The root page of the PRIMARY KEY is the table root page */
|
||||||
@@ -2810,7 +2810,7 @@ static void sqliteViewResetAll(sqlite3 *db, int idx){
|
|||||||
** in order to be certain that we got the right one.
|
** in order to be certain that we got the right one.
|
||||||
*/
|
*/
|
||||||
#ifndef SQLITE_OMIT_AUTOVACUUM
|
#ifndef SQLITE_OMIT_AUTOVACUUM
|
||||||
void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){
|
void sqlite3RootPageMoved(sqlite3 *db, int iDb, Pgno iFrom, Pgno iTo){
|
||||||
HashElem *pElem;
|
HashElem *pElem;
|
||||||
Hash *pHash;
|
Hash *pHash;
|
||||||
Db *pDb;
|
Db *pDb;
|
||||||
@@ -2887,7 +2887,7 @@ static void destroyTable(Parse *pParse, Table *pTab){
|
|||||||
** "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit
|
** "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit
|
||||||
** a free-list page.
|
** a free-list page.
|
||||||
*/
|
*/
|
||||||
int iTab = pTab->tnum;
|
Pgno iTab = pTab->tnum;
|
||||||
int iDestroyed = 0;
|
int iDestroyed = 0;
|
||||||
|
|
||||||
while( 1 ){
|
while( 1 ){
|
||||||
@@ -2898,7 +2898,7 @@ static void destroyTable(Parse *pParse, Table *pTab){
|
|||||||
iLargest = iTab;
|
iLargest = iTab;
|
||||||
}
|
}
|
||||||
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
|
||||||
int iIdx = pIdx->tnum;
|
Pgno iIdx = pIdx->tnum;
|
||||||
assert( pIdx->pSchema==pTab->pSchema );
|
assert( pIdx->pSchema==pTab->pSchema );
|
||||||
if( (iDestroyed==0 || (iIdx<iDestroyed)) && iIdx>iLargest ){
|
if( (iDestroyed==0 || (iIdx<iDestroyed)) && iIdx>iLargest ){
|
||||||
iLargest = iIdx;
|
iLargest = iIdx;
|
||||||
@@ -3321,7 +3321,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
|
|||||||
int iSorter; /* Cursor opened by OpenSorter (if in use) */
|
int iSorter; /* Cursor opened by OpenSorter (if in use) */
|
||||||
int addr1; /* Address of top of loop */
|
int addr1; /* Address of top of loop */
|
||||||
int addr2; /* Address to jump to for next iteration */
|
int addr2; /* Address to jump to for next iteration */
|
||||||
int tnum; /* Root page of index */
|
Pgno tnum; /* Root page of index */
|
||||||
int iPartIdxLabel; /* Jump to this label to skip a row */
|
int iPartIdxLabel; /* Jump to this label to skip a row */
|
||||||
Vdbe *v; /* Generate code into this virtual machine */
|
Vdbe *v; /* Generate code into this virtual machine */
|
||||||
KeyInfo *pKey; /* KeyInfo for index */
|
KeyInfo *pKey; /* KeyInfo for index */
|
||||||
@@ -3342,7 +3342,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
|
|||||||
v = sqlite3GetVdbe(pParse);
|
v = sqlite3GetVdbe(pParse);
|
||||||
if( v==0 ) return;
|
if( v==0 ) return;
|
||||||
if( memRootPage>=0 ){
|
if( memRootPage>=0 ){
|
||||||
tnum = memRootPage;
|
tnum = (Pgno)memRootPage;
|
||||||
}else{
|
}else{
|
||||||
tnum = pIndex->tnum;
|
tnum = pIndex->tnum;
|
||||||
}
|
}
|
||||||
@@ -3367,7 +3367,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
|
|||||||
sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v);
|
sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); VdbeCoverage(v);
|
||||||
sqlite3VdbeJumpHere(v, addr1);
|
sqlite3VdbeJumpHere(v, addr1);
|
||||||
if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);
|
if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb);
|
||||||
sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb,
|
sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, (int)tnum, iDb,
|
||||||
(char *)pKey, P4_KEYINFO);
|
(char *)pKey, P4_KEYINFO);
|
||||||
sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));
|
sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0));
|
||||||
|
|
||||||
@@ -3976,7 +3976,7 @@ void sqlite3CreateIndex(
|
|||||||
** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In
|
** PRIMARY KEY and the table is actually a WITHOUT ROWID table. In
|
||||||
** that case the convertToWithoutRowidTable() routine will replace
|
** that case the convertToWithoutRowidTable() routine will replace
|
||||||
** the Noop with a Goto to jump over the VDBE code generated below. */
|
** the Noop with a Goto to jump over the VDBE code generated below. */
|
||||||
pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);
|
pIndex->tnum = (Pgno)sqlite3VdbeAddOp0(v, OP_Noop);
|
||||||
sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY);
|
sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY);
|
||||||
|
|
||||||
/* Gather the complete text of the CREATE INDEX statement into
|
/* Gather the complete text of the CREATE INDEX statement into
|
||||||
@@ -4018,7 +4018,7 @@ void sqlite3CreateIndex(
|
|||||||
sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
|
sqlite3VdbeAddOp2(v, OP_Expire, 0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3VdbeJumpHere(v, pIndex->tnum);
|
sqlite3VdbeJumpHere(v, (int)pIndex->tnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( db->init.busy || pTblName==0 ){
|
if( db->init.busy || pTblName==0 ){
|
||||||
|
11
src/pager.c
11
src/pager.c
@@ -786,11 +786,6 @@ static const unsigned char aJournalMagic[] = {
|
|||||||
# define USEFETCH(x) 0
|
# define USEFETCH(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
** The maximum legal page number is (2^31 - 1).
|
|
||||||
*/
|
|
||||||
#define PAGER_MAX_PGNO 2147483647
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The argument to this macro is a file descriptor (type sqlite3_file*).
|
** The argument to this macro is a file descriptor (type sqlite3_file*).
|
||||||
** Return 0 if it is not open, or non-zero (but not 1) if it is.
|
** Return 0 if it is not open, or non-zero (but not 1) if it is.
|
||||||
@@ -5490,7 +5485,7 @@ static int getPageNormal(
|
|||||||
if( pPg->pPager && !noContent ){
|
if( pPg->pPager && !noContent ){
|
||||||
/* In this case the pcache already contains an initialized copy of
|
/* In this case the pcache already contains an initialized copy of
|
||||||
** the page. Return without further ado. */
|
** the page. Return without further ado. */
|
||||||
assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) );
|
assert( pgno!=PAGER_MJ_PGNO(pPager) );
|
||||||
pPager->aStat[PAGER_STAT_HIT]++;
|
pPager->aStat[PAGER_STAT_HIT]++;
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
|
|
||||||
@@ -5498,10 +5493,10 @@ static int getPageNormal(
|
|||||||
/* The pager cache has created a new page. Its content needs to
|
/* The pager cache has created a new page. Its content needs to
|
||||||
** be initialized. But first some error checks:
|
** be initialized. But first some error checks:
|
||||||
**
|
**
|
||||||
** (1) The maximum page number is 2^31
|
** (*) obsolete. Was: maximum page number is 2^31
|
||||||
** (2) Never try to fetch the locking page
|
** (2) Never try to fetch the locking page
|
||||||
*/
|
*/
|
||||||
if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){
|
if( pgno==PAGER_MJ_PGNO(pPager) ){
|
||||||
rc = SQLITE_CORRUPT_BKPT;
|
rc = SQLITE_CORRUPT_BKPT;
|
||||||
goto pager_acquire_err;
|
goto pager_acquire_err;
|
||||||
}
|
}
|
||||||
|
@@ -149,7 +149,7 @@ int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){
|
|||||||
Index *pIndex;
|
Index *pIndex;
|
||||||
pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
|
pIndex = sqlite3FindIndex(db, argv[1], db->aDb[iDb].zDbSName);
|
||||||
if( pIndex==0
|
if( pIndex==0
|
||||||
|| sqlite3GetInt32(argv[3],&pIndex->tnum)==0
|
|| sqlite3GetUInt32(argv[3],&pIndex->tnum)==0
|
||||||
|| pIndex->tnum<2
|
|| pIndex->tnum<2
|
||||||
|| sqlite3IndexHasDuplicateRootPage(pIndex)
|
|| sqlite3IndexHasDuplicateRootPage(pIndex)
|
||||||
){
|
){
|
||||||
|
@@ -3186,7 +3186,7 @@ static int multiSelectOrderBy(
|
|||||||
sqlite3 *db; /* Database connection */
|
sqlite3 *db; /* Database connection */
|
||||||
ExprList *pOrderBy; /* The ORDER BY clause */
|
ExprList *pOrderBy; /* The ORDER BY clause */
|
||||||
int nOrderBy; /* Number of terms in the ORDER BY clause */
|
int nOrderBy; /* Number of terms in the ORDER BY clause */
|
||||||
int *aPermute; /* Mapping from ORDER BY terms to result set columns */
|
u32 *aPermute; /* Mapping from ORDER BY terms to result set columns */
|
||||||
|
|
||||||
assert( p->pOrderBy!=0 );
|
assert( p->pOrderBy!=0 );
|
||||||
assert( pKeyDup==0 ); /* "Managed" code needs this. Ticket #3382. */
|
assert( pKeyDup==0 ); /* "Managed" code needs this. Ticket #3382. */
|
||||||
@@ -3235,7 +3235,7 @@ static int multiSelectOrderBy(
|
|||||||
** to the right and the left are evaluated, they use the correct
|
** to the right and the left are evaluated, they use the correct
|
||||||
** collation.
|
** collation.
|
||||||
*/
|
*/
|
||||||
aPermute = sqlite3DbMallocRawNN(db, sizeof(int)*(nOrderBy + 1));
|
aPermute = sqlite3DbMallocRawNN(db, sizeof(u32)*(nOrderBy + 1));
|
||||||
if( aPermute ){
|
if( aPermute ){
|
||||||
struct ExprList_item *pItem;
|
struct ExprList_item *pItem;
|
||||||
aPermute[0] = nOrderBy;
|
aPermute[0] = nOrderBy;
|
||||||
|
@@ -1482,7 +1482,7 @@ struct sqlite3 {
|
|||||||
int aLimit[SQLITE_N_LIMIT]; /* Limits */
|
int aLimit[SQLITE_N_LIMIT]; /* Limits */
|
||||||
int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */
|
int nMaxSorterMmap; /* Maximum size of regions mapped by sorter */
|
||||||
struct sqlite3InitInfo { /* Information used during initialization */
|
struct sqlite3InitInfo { /* Information used during initialization */
|
||||||
int newTnum; /* Rootpage of table being initialized */
|
Pgno newTnum; /* Rootpage of table being initialized */
|
||||||
u8 iDb; /* Which db file is being initialized */
|
u8 iDb; /* Which db file is being initialized */
|
||||||
u8 busy; /* TRUE if currently initializing */
|
u8 busy; /* TRUE if currently initializing */
|
||||||
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
|
unsigned orphanTrigger : 1; /* Last statement is orphaned TEMP trigger */
|
||||||
@@ -2121,7 +2121,7 @@ struct Table {
|
|||||||
char *zColAff; /* String defining the affinity of each column */
|
char *zColAff; /* String defining the affinity of each column */
|
||||||
ExprList *pCheck; /* All CHECK constraints */
|
ExprList *pCheck; /* All CHECK constraints */
|
||||||
/* ... also used as column name list in a VIEW */
|
/* ... also used as column name list in a VIEW */
|
||||||
int tnum; /* Root BTree page for this table */
|
Pgno tnum; /* Root BTree page for this table */
|
||||||
u32 nTabRef; /* Number of pointers to this Table */
|
u32 nTabRef; /* Number of pointers to this Table */
|
||||||
u32 tabFlags; /* Mask of TF_* values */
|
u32 tabFlags; /* Mask of TF_* values */
|
||||||
i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
|
i16 iPKey; /* If not negative, use aCol[iPKey] as the rowid */
|
||||||
@@ -2414,7 +2414,7 @@ struct Index {
|
|||||||
const char **azColl; /* Array of collation sequence names for index */
|
const char **azColl; /* Array of collation sequence names for index */
|
||||||
Expr *pPartIdxWhere; /* WHERE clause for partial indices */
|
Expr *pPartIdxWhere; /* WHERE clause for partial indices */
|
||||||
ExprList *aColExpr; /* Column expressions */
|
ExprList *aColExpr; /* Column expressions */
|
||||||
int tnum; /* DB Page containing root of this index */
|
Pgno tnum; /* DB Page containing root of this index */
|
||||||
LogEst szIdxRow; /* Estimated average row size in bytes */
|
LogEst szIdxRow; /* Estimated average row size in bytes */
|
||||||
u16 nKeyCol; /* Number of columns forming the key */
|
u16 nKeyCol; /* Number of columns forming the key */
|
||||||
u16 nColumn; /* Number of columns stored in the index */
|
u16 nColumn; /* Number of columns stored in the index */
|
||||||
@@ -4465,6 +4465,7 @@ int sqlite3RealSameAsInt(double,sqlite3_int64);
|
|||||||
void sqlite3Int64ToText(i64,char*);
|
void sqlite3Int64ToText(i64,char*);
|
||||||
int sqlite3AtoF(const char *z, double*, int, u8);
|
int sqlite3AtoF(const char *z, double*, int, u8);
|
||||||
int sqlite3GetInt32(const char *, int*);
|
int sqlite3GetInt32(const char *, int*);
|
||||||
|
int sqlite3GetUInt32(const char*, u32*);
|
||||||
int sqlite3Atoi(const char*);
|
int sqlite3Atoi(const char*);
|
||||||
#ifndef SQLITE_OMIT_UTF16
|
#ifndef SQLITE_OMIT_UTF16
|
||||||
int sqlite3Utf16ByteLen(const void *pData, int nChar);
|
int sqlite3Utf16ByteLen(const void *pData, int nChar);
|
||||||
@@ -4592,7 +4593,7 @@ extern int sqlite3PendingByte;
|
|||||||
#ifdef VDBE_PROFILE
|
#ifdef VDBE_PROFILE
|
||||||
extern sqlite3_uint64 sqlite3NProfileCnt;
|
extern sqlite3_uint64 sqlite3NProfileCnt;
|
||||||
#endif
|
#endif
|
||||||
void sqlite3RootPageMoved(sqlite3*, int, int, int);
|
void sqlite3RootPageMoved(sqlite3*, int, Pgno, Pgno);
|
||||||
void sqlite3Reindex(Parse*, Token*, Token*);
|
void sqlite3Reindex(Parse*, Token*, Token*);
|
||||||
void sqlite3AlterFunctions(void);
|
void sqlite3AlterFunctions(void);
|
||||||
void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
|
void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
|
||||||
@@ -4706,7 +4707,7 @@ void sqlite3AutoLoadExtensions(sqlite3*);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef SQLITE_OMIT_SHARED_CACHE
|
#ifndef SQLITE_OMIT_SHARED_CACHE
|
||||||
void sqlite3TableLock(Parse *, int, int, u8, const char *);
|
void sqlite3TableLock(Parse *, int, Pgno, u8, const char *);
|
||||||
#else
|
#else
|
||||||
#define sqlite3TableLock(v,w,x,y,z)
|
#define sqlite3TableLock(v,w,x,y,z)
|
||||||
#endif
|
#endif
|
||||||
|
18
src/util.c
18
src/util.c
@@ -863,6 +863,24 @@ int sqlite3Atoi(const char *z){
|
|||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Try to convert z into an unsigned 32-bit integer. Return true on
|
||||||
|
** success and false if there is an error.
|
||||||
|
**
|
||||||
|
** Only decimal notation is accepted.
|
||||||
|
*/
|
||||||
|
int sqlite3GetUInt32(const char *z, u32 *pI){
|
||||||
|
u64 v = 0;
|
||||||
|
int i;
|
||||||
|
for(i=0; sqlite3Isdigit(z[i]); i++){
|
||||||
|
v = v*10 + z[i] - '0';
|
||||||
|
if( v>4294967296LL ) return 0;
|
||||||
|
}
|
||||||
|
if( i==0 || z[i]!=0 ) return 0;
|
||||||
|
*pI = (u32)v;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** The variable-length integer encoding is as follows:
|
** The variable-length integer encoding is as follows:
|
||||||
**
|
**
|
||||||
|
24
src/vdbe.c
24
src/vdbe.c
@@ -2250,10 +2250,10 @@ case OP_Compare: {
|
|||||||
int p1;
|
int p1;
|
||||||
int p2;
|
int p2;
|
||||||
const KeyInfo *pKeyInfo;
|
const KeyInfo *pKeyInfo;
|
||||||
int idx;
|
u32 idx;
|
||||||
CollSeq *pColl; /* Collating sequence to use on this term */
|
CollSeq *pColl; /* Collating sequence to use on this term */
|
||||||
int bRev; /* True for DESCENDING sort order */
|
int bRev; /* True for DESCENDING sort order */
|
||||||
int *aPermute; /* The permutation */
|
u32 *aPermute; /* The permutation */
|
||||||
|
|
||||||
if( (pOp->p5 & OPFLAG_PERMUTE)==0 ){
|
if( (pOp->p5 & OPFLAG_PERMUTE)==0 ){
|
||||||
aPermute = 0;
|
aPermute = 0;
|
||||||
@@ -2593,7 +2593,7 @@ case OP_Offset: { /* out3 */
|
|||||||
** skipped for length() and all content loading can be skipped for typeof().
|
** skipped for length() and all content loading can be skipped for typeof().
|
||||||
*/
|
*/
|
||||||
case OP_Column: {
|
case OP_Column: {
|
||||||
int p2; /* column number to retrieve */
|
u32 p2; /* column number to retrieve */
|
||||||
VdbeCursor *pC; /* The VDBE cursor */
|
VdbeCursor *pC; /* The VDBE cursor */
|
||||||
BtCursor *pCrsr; /* The BTree cursor */
|
BtCursor *pCrsr; /* The BTree cursor */
|
||||||
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
|
u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */
|
||||||
@@ -2611,7 +2611,7 @@ case OP_Column: {
|
|||||||
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
|
||||||
pC = p->apCsr[pOp->p1];
|
pC = p->apCsr[pOp->p1];
|
||||||
assert( pC!=0 );
|
assert( pC!=0 );
|
||||||
p2 = pOp->p2;
|
p2 = (u32)pOp->p2;
|
||||||
|
|
||||||
/* If the cursor cache is stale (meaning it is not currently point at
|
/* If the cursor cache is stale (meaning it is not currently point at
|
||||||
** the correct row) then bring it up-to-date by doing the necessary
|
** the correct row) then bring it up-to-date by doing the necessary
|
||||||
@@ -3762,7 +3762,7 @@ case OP_SetCookie: {
|
|||||||
case OP_ReopenIdx: {
|
case OP_ReopenIdx: {
|
||||||
int nField;
|
int nField;
|
||||||
KeyInfo *pKeyInfo;
|
KeyInfo *pKeyInfo;
|
||||||
int p2;
|
u32 p2;
|
||||||
int iDb;
|
int iDb;
|
||||||
int wrFlag;
|
int wrFlag;
|
||||||
Btree *pX;
|
Btree *pX;
|
||||||
@@ -3793,7 +3793,7 @@ case OP_OpenWrite:
|
|||||||
|
|
||||||
nField = 0;
|
nField = 0;
|
||||||
pKeyInfo = 0;
|
pKeyInfo = 0;
|
||||||
p2 = pOp->p2;
|
p2 = (u32)pOp->p2;
|
||||||
iDb = pOp->p3;
|
iDb = pOp->p3;
|
||||||
assert( iDb>=0 && iDb<db->nDb );
|
assert( iDb>=0 && iDb<db->nDb );
|
||||||
assert( DbMaskTest(p->btreeMask, iDb) );
|
assert( DbMaskTest(p->btreeMask, iDb) );
|
||||||
@@ -3965,7 +3965,7 @@ case OP_OpenEphemeral: {
|
|||||||
*/
|
*/
|
||||||
if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
|
if( (pCx->pKeyInfo = pKeyInfo = pOp->p4.pKeyInfo)!=0 ){
|
||||||
assert( pOp->p4type==P4_KEYINFO );
|
assert( pOp->p4type==P4_KEYINFO );
|
||||||
rc = sqlite3BtreeCreateTable(pCx->pBtx, (int*)&pCx->pgnoRoot,
|
rc = sqlite3BtreeCreateTable(pCx->pBtx, &pCx->pgnoRoot,
|
||||||
BTREE_BLOBKEY | pOp->p5);
|
BTREE_BLOBKEY | pOp->p5);
|
||||||
if( rc==SQLITE_OK ){
|
if( rc==SQLITE_OK ){
|
||||||
assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
|
assert( pCx->pgnoRoot==SCHEMA_ROOT+1 );
|
||||||
@@ -5229,10 +5229,6 @@ case OP_RowData: {
|
|||||||
*/
|
*/
|
||||||
assert( pC->deferredMoveto==0 );
|
assert( pC->deferredMoveto==0 );
|
||||||
assert( sqlite3BtreeCursorIsValid(pCrsr) );
|
assert( sqlite3BtreeCursorIsValid(pCrsr) );
|
||||||
#if 0 /* Not required due to the previous to assert() statements */
|
|
||||||
rc = sqlite3VdbeCursorMoveto(pC);
|
|
||||||
if( rc!=SQLITE_OK ) goto abort_due_to_error;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
n = sqlite3BtreePayloadSize(pCrsr);
|
n = sqlite3BtreePayloadSize(pCrsr);
|
||||||
if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
|
if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
|
||||||
@@ -6002,7 +5998,7 @@ case OP_Clear: {
|
|||||||
assert( p->readOnly==0 );
|
assert( p->readOnly==0 );
|
||||||
assert( DbMaskTest(p->btreeMask, pOp->p2) );
|
assert( DbMaskTest(p->btreeMask, pOp->p2) );
|
||||||
rc = sqlite3BtreeClearTable(
|
rc = sqlite3BtreeClearTable(
|
||||||
db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &nChange : 0)
|
db->aDb[pOp->p2].pBt, (u32)pOp->p1, (pOp->p3 ? &nChange : 0)
|
||||||
);
|
);
|
||||||
if( pOp->p3 ){
|
if( pOp->p3 ){
|
||||||
p->nChange += nChange;
|
p->nChange += nChange;
|
||||||
@@ -6051,7 +6047,7 @@ case OP_ResetSorter: {
|
|||||||
** The root page number of the new b-tree is stored in register P2.
|
** The root page number of the new b-tree is stored in register P2.
|
||||||
*/
|
*/
|
||||||
case OP_CreateBtree: { /* out2 */
|
case OP_CreateBtree: { /* out2 */
|
||||||
int pgno;
|
Pgno pgno;
|
||||||
Db *pDb;
|
Db *pDb;
|
||||||
|
|
||||||
sqlite3VdbeIncrWriteCounter(p, 0);
|
sqlite3VdbeIncrWriteCounter(p, 0);
|
||||||
@@ -6239,7 +6235,7 @@ case OP_DropTrigger: {
|
|||||||
*/
|
*/
|
||||||
case OP_IntegrityCk: {
|
case OP_IntegrityCk: {
|
||||||
int nRoot; /* Number of tables to check. (Number of root pages.) */
|
int nRoot; /* Number of tables to check. (Number of root pages.) */
|
||||||
int *aRoot; /* Array of rootpage numbers for tables to be checked */
|
Pgno *aRoot; /* Array of rootpage numbers for tables to be checked */
|
||||||
int nErr; /* Number of errors reported */
|
int nErr; /* Number of errors reported */
|
||||||
char *z; /* Text of the error report */
|
char *z; /* Text of the error report */
|
||||||
Mem *pnErr; /* Register keeping track of errors remaining */
|
Mem *pnErr; /* Register keeping track of errors remaining */
|
||||||
|
@@ -57,7 +57,7 @@ struct VdbeOp {
|
|||||||
Mem *pMem; /* Used when p4type is P4_MEM */
|
Mem *pMem; /* Used when p4type is P4_MEM */
|
||||||
VTable *pVtab; /* Used when p4type is P4_VTAB */
|
VTable *pVtab; /* Used when p4type is P4_VTAB */
|
||||||
KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
|
KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
|
||||||
int *ai; /* Used when p4type is P4_INTARRAY */
|
u32 *ai; /* Used when p4type is P4_INTARRAY */
|
||||||
SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
|
SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
|
||||||
Table *pTab; /* Used when p4type is P4_TABLE */
|
Table *pTab; /* Used when p4type is P4_TABLE */
|
||||||
#ifdef SQLITE_ENABLE_CURSOR_HINTS
|
#ifdef SQLITE_ENABLE_CURSOR_HINTS
|
||||||
|
@@ -89,7 +89,7 @@ struct VdbeCursor {
|
|||||||
Bool seekHit:1; /* See the OP_SeekHit and OP_IfNoHope opcodes */
|
Bool seekHit:1; /* See the OP_SeekHit and OP_IfNoHope opcodes */
|
||||||
Btree *pBtx; /* Separate file holding temporary table */
|
Btree *pBtx; /* Separate file holding temporary table */
|
||||||
i64 seqCount; /* Sequence counter */
|
i64 seqCount; /* Sequence counter */
|
||||||
int *aAltMap; /* Mapping from table to index column numbers */
|
u32 *aAltMap; /* Mapping from table to index column numbers */
|
||||||
|
|
||||||
/* Cached OP_Column parse information is only valid if cacheStatus matches
|
/* Cached OP_Column parse information is only valid if cacheStatus matches
|
||||||
** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
|
** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of
|
||||||
@@ -485,7 +485,7 @@ void sqlite3VdbeError(Vdbe*, const char *, ...);
|
|||||||
void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);
|
void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*);
|
||||||
void sqliteVdbePopStack(Vdbe*,int);
|
void sqliteVdbePopStack(Vdbe*,int);
|
||||||
int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor*);
|
int SQLITE_NOINLINE sqlite3VdbeFinishMoveto(VdbeCursor*);
|
||||||
int sqlite3VdbeCursorMoveto(VdbeCursor**, int*);
|
int sqlite3VdbeCursorMoveto(VdbeCursor**, u32*);
|
||||||
int sqlite3VdbeCursorRestore(VdbeCursor*);
|
int sqlite3VdbeCursorRestore(VdbeCursor*);
|
||||||
u32 sqlite3VdbeSerialTypeLen(u32);
|
u32 sqlite3VdbeSerialTypeLen(u32);
|
||||||
u8 sqlite3VdbeOneByteSerialTypeLen(u8);
|
u8 sqlite3VdbeOneByteSerialTypeLen(u8);
|
||||||
|
@@ -1712,12 +1712,12 @@ char *sqlite3VdbeDisplayP4(sqlite3 *db, Op *pOp){
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
case P4_INTARRAY: {
|
case P4_INTARRAY: {
|
||||||
int i;
|
u32 i;
|
||||||
int *ai = pOp->p4.ai;
|
u32 *ai = pOp->p4.ai;
|
||||||
int n = ai[0]; /* The first element of an INTARRAY is always the
|
u32 n = ai[0]; /* The first element of an INTARRAY is always the
|
||||||
** count of the number of elements to follow */
|
** count of the number of elements to follow */
|
||||||
for(i=1; i<=n; i++){
|
for(i=1; i<=n; i++){
|
||||||
sqlite3_str_appendf(&x, "%c%d", (i==1 ? '[' : ','), ai[i]);
|
sqlite3_str_appendf(&x, "%c%u", (i==1 ? '[' : ','), ai[i]);
|
||||||
}
|
}
|
||||||
sqlite3_str_append(&x, "]", 1);
|
sqlite3_str_append(&x, "]", 1);
|
||||||
break;
|
break;
|
||||||
@@ -3561,11 +3561,11 @@ int sqlite3VdbeCursorRestore(VdbeCursor *p){
|
|||||||
** If the cursor is already pointing to the correct row and that row has
|
** If the cursor is already pointing to the correct row and that row has
|
||||||
** not been deleted out from under the cursor, then this routine is a no-op.
|
** not been deleted out from under the cursor, then this routine is a no-op.
|
||||||
*/
|
*/
|
||||||
int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){
|
int sqlite3VdbeCursorMoveto(VdbeCursor **pp, u32 *piCol){
|
||||||
VdbeCursor *p = *pp;
|
VdbeCursor *p = *pp;
|
||||||
assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
|
assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
|
||||||
if( p->deferredMoveto ){
|
if( p->deferredMoveto ){
|
||||||
int iMap;
|
u32 iMap;
|
||||||
if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
|
if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 && !p->nullRow ){
|
||||||
*pp = p->pAltCursor;
|
*pp = p->pAltCursor;
|
||||||
*piCol = iMap - 1;
|
*piCol = iMap - 1;
|
||||||
|
@@ -1052,7 +1052,7 @@ static void codeDeferredSeek(
|
|||||||
){
|
){
|
||||||
int i;
|
int i;
|
||||||
Table *pTab = pIdx->pTable;
|
Table *pTab = pIdx->pTable;
|
||||||
int *ai = (int*)sqlite3DbMallocZero(pParse->db, sizeof(int)*(pTab->nCol+1));
|
u32 *ai = (u32*)sqlite3DbMallocZero(pParse->db, sizeof(u32)*(pTab->nCol+1));
|
||||||
if( ai ){
|
if( ai ){
|
||||||
ai[0] = pTab->nCol;
|
ai[0] = pTab->nCol;
|
||||||
for(i=0; i<pIdx->nColumn-1; i++){
|
for(i=0; i<pIdx->nColumn-1; i++){
|
||||||
|
Reference in New Issue
Block a user