aboutsummaryrefslogtreecommitdiff
path: root/src/test1.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/test1.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/test1.c')
-rw-r--r--src/test1.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/test1.c b/src/test1.c
index dcbc9e613..13b6d6015 100644
--- a/src/test1.c
+++ b/src/test1.c
@@ -5478,6 +5478,33 @@ static int SQLITE_TCLAPI test_soft_heap_limit(
}
/*
+** Usage: sqlite3_hard_heap_limit ?N?
+**
+** Query or set the hard heap limit for the current thread. The
+** limit is only changed if the N is present. The previous limit
+** is returned.
+*/
+static int SQLITE_TCLAPI test_hard_heap_limit(
+ void * clientData,
+ Tcl_Interp *interp,
+ int objc,
+ Tcl_Obj *CONST objv[]
+){
+ sqlite3_int64 amt;
+ Tcl_WideInt N = -1;
+ if( objc!=1 && objc!=2 ){
+ Tcl_WrongNumArgs(interp, 1, objv, "?N?");
+ return TCL_ERROR;
+ }
+ if( objc==2 ){
+ if( Tcl_GetWideIntFromObj(interp, objv[1], &N) ) return TCL_ERROR;
+ }
+ amt = sqlite3_hard_heap_limit64(N);
+ Tcl_SetObjResult(interp, Tcl_NewWideIntObj(amt));
+ return TCL_OK;
+}
+
+/*
** Usage: sqlite3_thread_cleanup
**
** Call the sqlite3_thread_cleanup API.
@@ -7880,6 +7907,8 @@ int Sqlitetest1_Init(Tcl_Interp *interp){
{ "sqlite3_db_filename", test_db_filename, 0},
{ "sqlite3_db_readonly", test_db_readonly, 0},
{ "sqlite3_soft_heap_limit", test_soft_heap_limit, 0},
+ { "sqlite3_soft_heap_limit64", test_soft_heap_limit, 0},
+ { "sqlite3_hard_heap_limit64", test_hard_heap_limit, 0},
{ "sqlite3_thread_cleanup", test_thread_cleanup, 0},
{ "sqlite3_pager_refcounts", test_pager_refcounts, 0},