From: drh Date: Fri, 13 Sep 2013 21:01:56 +0000 (+0000) Subject: Add the soft_heap_limit pragma. X-Git-Tag: version-3.8.1~75 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=55e85ca5f560bf5e937c8f3fbf7bab1328a177c8;p=thirdparty%2Fsqlite.git Add the soft_heap_limit pragma. FossilOrigin-Name: c326356f9a18bff5cf36bd59331e2cc207e349fa --- diff --git a/manifest b/manifest index fbf529828e..bb34ccc2e5 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Tweak\sthe\snew\sPRAGMA\sname\sparser\sto\sachieve\sfull\sbranch\stest\scoverage. -D 2013-09-13T19:00:06.116 +C Add\sthe\ssoft_heap_limit\spragma. +D 2013-09-13T21:01:56.467 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in 5e41da95d92656a5004b03d3576e8b226858a28e F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -210,7 +210,7 @@ F src/parse.y a97566d6da75075589a7c716d1bda14b586cf8da F src/pcache.c f8043b433a57aba85384a531e3937a804432a346 F src/pcache.h a5e4f5d9f5d592051d91212c5949517971ae6222 F src/pcache1.c a467393909a4ed7ca9de066d85ba5c5b04a5be63 -F src/pragma.c 249742bd762770e5e6e5b67cfcb2fa33339b1049 +F src/pragma.c d3d93be2c810b7bba9b10022b82bf1a4ecce4750 F src/prepare.c fa6988589f39af8504a61731614cd4f6ae71554f F src/printf.c da9119eb31a187a4b99f60aa4a225141c0ebb74b F src/random.c 0b2dbc37fdfbfa6bd455b091dfcef5bdb32dba68 @@ -791,7 +791,7 @@ F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3 F test/shrink.test 8c70f62b6e8eb4d54533de6d65bd06b1b9a17868 F test/sidedelete.test f0ad71abe6233e3b153100f3b8d679b19a488329 F test/soak.test 0b5b6375c9f4110c828070b826b3b4b0bb65cd5f -F test/softheap1.test c16709a16ad79fa43b32929b2e623d1d117ccf53 +F test/softheap1.test 40562fe6cac6d9827b7b42b86d45aedf12c15e24 F test/sort.test 0e4456e729e5a92a625907c63dcdedfbe72c5dc5 F test/speed1.test f2974a91d79f58507ada01864c0e323093065452 F test/speed1p.explain d841e650a04728b39e6740296b852dccdca9b2cb @@ -1081,7 +1081,7 @@ F tool/lempar.c 01ca97f87610d1dac6d8cd96ab109ab1130e76dc F tool/mkautoconfamal.sh f8d8dbf7d62f409ebed5134998bf5b51d7266383 F tool/mkkeywordhash.c bb52064aa614e1426445e4b2b9b00eeecd23cc79 F tool/mkopts.tcl 66ac10d240cc6e86abd37dc908d50382f84ff46e -F tool/mkpragmatab.tcl bf0979c5b55c54377b51ce27f7563473f30cf58d +F tool/mkpragmatab.tcl 8f50568b7f994c3db08267009927bc9e0f684204 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 8bce31074e4cbe631bb7676526a048335f4c9f02 F tool/mksqlite3c.tcl d344cc3144a0271cd853c5e3df36e9f31d78d619 @@ -1114,7 +1114,7 @@ F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381 F tool/wherecosttest.c f407dc4c79786982a475261866a161cd007947ae F tool/win/sqlite.vsix 97894c2790eda7b5bce3cc79cb2a8ec2fde9b3ac -P 86ad358b5a7567857f2f998fbb8266b7de9ec87e -R 2ecd64f96f0a8ab26198c346df0dbd22 +P c82e05c4b8e000684d95ac8417afaef5e4d633e6 +R ba1e9bfd4329e5207aeb95ad15bc0bc6 U drh -Z e3c428ae532d24cd33e04415d0b72bf7 +Z 6017bc3f72f825d3266b1ab91e26a42a diff --git a/manifest.uuid b/manifest.uuid index 2f0a4b6694..6280f4130e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c82e05c4b8e000684d95ac8417afaef5e4d633e6 \ No newline at end of file +c326356f9a18bff5cf36bd59331e2cc207e349fa \ No newline at end of file diff --git a/src/pragma.c b/src/pragma.c index 5d34fdb58b..a53c891186 100644 --- a/src/pragma.c +++ b/src/pragma.c @@ -55,18 +55,19 @@ #define PragTyp_PAGE_SIZE 24 #define PragTyp_SECURE_DELETE 25 #define PragTyp_SHRINK_MEMORY 26 -#define PragTyp_SYNCHRONOUS 27 -#define PragTyp_TABLE_INFO 28 -#define PragTyp_TEMP_STORE 29 -#define PragTyp_TEMP_STORE_DIRECTORY 30 -#define PragTyp_WAL_AUTOCHECKPOINT 31 -#define PragTyp_WAL_CHECKPOINT 32 -#define PragTyp_ACTIVATE_EXTENSIONS 33 -#define PragTyp_HEXKEY 34 -#define PragTyp_KEY 35 -#define PragTyp_REKEY 36 -#define PragTyp_LOCK_STATUS 37 -#define PragTyp_PARSER_TRACE 38 +#define PragTyp_SOFT_HEAP_LIMIT 27 +#define PragTyp_SYNCHRONOUS 28 +#define PragTyp_TABLE_INFO 29 +#define PragTyp_TEMP_STORE 30 +#define PragTyp_TEMP_STORE_DIRECTORY 31 +#define PragTyp_WAL_AUTOCHECKPOINT 32 +#define PragTyp_WAL_CHECKPOINT 33 +#define PragTyp_ACTIVATE_EXTENSIONS 34 +#define PragTyp_HEXKEY 35 +#define PragTyp_KEY 36 +#define PragTyp_REKEY 37 +#define PragTyp_LOCK_STATUS 38 +#define PragTyp_PARSER_TRACE 39 static const struct sPragmaNames { const char const *zName; /* Name of pragma */ u8 ePragTyp; /* PragTyp_XXX value */ @@ -202,6 +203,7 @@ static const struct sPragmaNames { { "short_column_names", PragTyp_FLAG, SQLITE_ShortColNames }, { "shrink_memory", PragTyp_SHRINK_MEMORY, 0 }, + { "soft_heap_limit", PragTyp_SOFT_HEAP_LIMIT, 0 }, #if defined(SQLITE_DEBUG) { "sql_trace", PragTyp_FLAG, SQLITE_SqlTrace }, @@ -236,7 +238,7 @@ static const struct sPragmaNames { { "writable_schema", PragTyp_FLAG, SQLITE_WriteSchema|SQLITE_RecoveryMode }, }; -/* Number of pragmas: 54 on by default, 65 total. */ +/* Number of pragmas: 55 on by default, 66 total. */ /* End of the automatically generated pragma table. ***************************************************************************/ @@ -1966,6 +1968,22 @@ void sqlite3Pragma( break; } + /* + ** PRAGMA soft_heap_limit + ** PRAGMA soft_heap_limit = N + ** + ** Call sqlite3_soft_heap_limit64(N). Return the result. If N is omitted, + ** use -1. + */ + case PragTyp_SOFT_HEAP_LIMIT: { + sqlite3_int64 N; + if( zRight && sqlite3Atoi64(zRight, &N, 1000000, SQLITE_UTF8)==SQLITE_OK ){ + sqlite3_soft_heap_limit64(N); + } + returnSingleInt(pParse, "soft_heap_limit", sqlite3_soft_heap_limit64(-1)); + break; + } + #if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) /* ** Report the current state of file logs for all databases diff --git a/test/softheap1.test b/test/softheap1.test index 685555366e..522e455e33 100644 --- a/test/softheap1.test +++ b/test/softheap1.test @@ -24,10 +24,27 @@ ifcapable !integrityck { return } -sqlite3_soft_heap_limit -1 -sqlite3_soft_heap_limit 0 -sqlite3_soft_heap_limit 5000 +do_test softheap1-1.0 { + execsql {PRAGMA soft_heap_limit} +} [sqlite3_soft_heap_limit -1] do_test softheap1-1.1 { + execsql {PRAGMA soft_heap_limit=123456; PRAGMA soft_heap_limit;} +} {123456 123456} +do_test softheap1-1.2 { + sqlite3_soft_heap_limit -1 +} {123456} +do_test softheap1-1.3 { + execsql {PRAGMA soft_heap_limit(-1); PRAGMA soft_heap_limit;} +} {123456 123456} +do_test softheap1-1.4 { + execsql {PRAGMA soft_heap_limit(0); PRAGMA soft_heap_limit;} +} {0 0} + +sqlite3_soft_heap_limit 5000 +do_test softheap1-2.0 { + execsql {PRAGMA soft_heap_limit} +} {5000} +do_test softheap1-2.1 { execsql { PRAGMA auto_vacuum=1; CREATE TABLE t1(x); diff --git a/tool/mkpragmatab.tcl b/tool/mkpragmatab.tcl index 5887114307..262703f663 100644 --- a/tool/mkpragmatab.tcl +++ b/tool/mkpragmatab.tcl @@ -239,6 +239,8 @@ set pragma_def { NAME: activate_extensions IF: defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) + + NAME: soft_heap_limit } set name {} set type {}