aboutsummaryrefslogtreecommitdiff
path: root/src/pragma.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-04-25 18:15:38 +0000
committerdrh <drh@noemail.net>2019-04-25 18:15:38 +0000
commit10c0e7115b2ed28a2af6f3b59a9c2862b1b25f9d (patch)
treec70d09692d22d9acb6a875c095ba36bb35455c43 /src/pragma.c
parentdbdd93b7e1b6f4e129df36309868a4c1fb002207 (diff)
downloadsqlite-10c0e7115b2ed28a2af6f3b59a9c2862b1b25f9d.tar.gz
sqlite-10c0e7115b2ed28a2af6f3b59a9c2862b1b25f9d.zip
Add the sqlite3_hard_heap_limit64() interface and the corresponding
"PRAGMA hard_heap_limit=N" command. FossilOrigin-Name: b0ccef61a7f92d20228becbf4f997bf0f4e46dad2deaf0896dc63b976ad1dd11
Diffstat (limited to 'src/pragma.c')
-rw-r--r--src/pragma.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/pragma.c b/src/pragma.c
index 1dcd21400..30be87544 100644
--- a/src/pragma.c
+++ b/src/pragma.c
@@ -2065,6 +2065,27 @@ void sqlite3Pragma(
}
/*
+ ** PRAGMA hard_heap_limit
+ ** PRAGMA hard_heap_limit = N
+ **
+ ** Invoke sqlite3_hard_heap_limit64() to query or set the hard heap
+ ** limit. The hard heap limit can be activated or lowered by this
+ ** pragma, but not raised or deactivated. Only the
+ ** sqlite3_hard_heap_limit64() C-language API can raise or deactivate
+ ** the hard heap limit. This allows an application to set a heap limit
+ ** constraint that cannot be relaxed by an untrusted SQL script.
+ */
+ case PragTyp_HARD_HEAP_LIMIT: {
+ sqlite3_int64 N;
+ if( zRight && sqlite3DecOrHexToI64(zRight, &N)==SQLITE_OK ){
+ sqlite3_int64 iPrior = sqlite3_hard_heap_limit64(-1);
+ if( N>0 && (iPrior==0 || iPrior>N) ) sqlite3_hard_heap_limit64(N);
+ }
+ returnSingleInt(v, sqlite3_soft_heap_limit64(-1));
+ break;
+ }
+
+ /*
** PRAGMA threads
** PRAGMA threads = N
**