aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2020-07-06 12:13:05 +0000
committerdrh <drh@noemail.net>2020-07-06 12:13:05 +0000
commitd1d89140c037d3d7c7641da37ca3bff8df146bed (patch)
treedbde3179df8613a70a52e21fd43b2173e1e75ab8 /src
parenta78d2c052837f9eac464c175a8924fbe173f7643 (diff)
downloadsqlite-d1d89140c037d3d7c7641da37ca3bff8df146bed.tar.gz
sqlite-d1d89140c037d3d7c7641da37ca3bff8df146bed.zip
Increase the resolution of the vdbe opcode counters to 64 bits, as
apparently some users run single prepared statements that go for longer than 4 billion instructions. See forum post "[https://sqlite.org/forum/forumpost/d07949dc94|Possible freeze in the progress loop]" FossilOrigin-Name: 612eb590ea44fd402e630f2d62558beb7ce57d7d0ba113c8b72ea60a895c5a43
Diffstat (limited to 'src')
-rw-r--r--src/sqliteInt.h1
-rw-r--r--src/vdbe.c10
2 files changed, 6 insertions, 5 deletions
diff --git a/src/sqliteInt.h b/src/sqliteInt.h
index 9fcca1181..a862f4a6c 100644
--- a/src/sqliteInt.h
+++ b/src/sqliteInt.h
@@ -902,6 +902,7 @@ typedef INT16_TYPE LogEst;
** compilers.
*/
#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32))
+#define LARGEST_UINT64 (0xffffffff|(((u64)0xffffffff)<<32))
#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64)
/*
diff --git a/src/vdbe.c b/src/vdbe.c
index 51b48aa5a..f093b3a56 100644
--- a/src/vdbe.c
+++ b/src/vdbe.c
@@ -671,9 +671,9 @@ int sqlite3VdbeExec(
u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
u8 encoding = ENC(db); /* The database encoding */
int iCompare = 0; /* Result of last comparison */
- unsigned nVmStep = 0; /* Number of virtual machine steps */
+ u64 nVmStep = 0; /* Number of virtual machine steps */
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
- unsigned nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */
+ u64 nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */
#endif
Mem *aMem = p->aMem; /* Copy of p->aMem */
Mem *pIn1 = 0; /* 1st input operand */
@@ -693,7 +693,7 @@ int sqlite3VdbeExec(
assert( 0 < db->nProgressOps );
nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
}else{
- nProgressLimit = 0xffffffff;
+ nProgressLimit = LARGEST_UINT64;
}
#endif
if( p->rc==SQLITE_NOMEM ){
@@ -905,7 +905,7 @@ check_for_interrupt:
assert( db->nProgressOps!=0 );
nProgressLimit += db->nProgressOps;
if( db->xProgress(db->pProgressArg) ){
- nProgressLimit = 0xffffffff;
+ nProgressLimit = LARGEST_UINT64;
rc = SQLITE_INTERRUPT;
goto abort_due_to_error;
}
@@ -8001,7 +8001,7 @@ vdbe_return:
while( nVmStep>=nProgressLimit && db->xProgress!=0 ){
nProgressLimit += db->nProgressOps;
if( db->xProgress(db->pProgressArg) ){
- nProgressLimit = 0xffffffff;
+ nProgressLimit = LARGEST_UINT64;
rc = SQLITE_INTERRUPT;
goto abort_due_to_error;
}