From: drh Date: Sat, 2 May 2015 17:40:23 +0000 (+0000) Subject: Add the ".limit" command to the command-line shell. X-Git-Tag: version-3.8.10~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1a51337af831b65b61934e4b26ca8cd8dc63a947;p=thirdparty%2Fsqlite.git Add the ".limit" command to the command-line shell. FossilOrigin-Name: 803cb60e75e0b09a526eefec11139cb3e8ae8c7c --- diff --git a/manifest b/manifest index a0d606c0ed..dc584aea02 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Reorganize\ssome\smulti-threaded\scode\sin\svdbesort.c\sso\sthat\sfull\sMC/DC\stest\scoverage\sdoes\snot\sdepend\son\sthe\soutcome\sof\sa\srace\scondition. -D 2015-05-02T12:40:12.793 +C Add\sthe\s".limit"\scommand\sto\sthe\scommand-line\sshell. +D 2015-05-02T17:40:23.555 F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f F Makefile.in e628c50e237251fc7e768bef14ee7e822ad69e69 F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23 @@ -231,7 +231,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696 F src/resolve.c 13109bc3b5ab404446296efa17039640de5bc35d F src/rowset.c eccf6af6d620aaa4579bd3b72c1b6395d9e9fa1e F src/select.c 5e83049a0be1caf88921e815d0118bce49cba827 -F src/shell.c 0b68e745dff6fc7b9f86c330d401fd572a5bbbc2 +F src/shell.c b1e17be8565b5ce4138707d2808df077bf9750d9 F src/sqlite.h.in ca27603a36fcacdaac5a19d8ee35aaff8ce8516f F src/sqlite3.rc 992c9f5fb8285ae285d6be28240a7e8d3a7f2bad F src/sqlite3ext.h 17d487c3c91b0b8c584a32fbeb393f6f795eea7d @@ -1256,7 +1256,7 @@ F tool/vdbe_profile.tcl 67746953071a9f8f2f668b73fe899074e2c6d8c1 F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 0abfd78ceb09b7f7c27c688c8e3fe93268a13b32 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 7952c32268aa650d9ee946d5bfe190f712e3bbe6 -R b89595a534f421de5f0d98acb44972ee -U dan -Z 22691f754ec0b999bb5069d3c75c8ca1 +P 78c7ec95931265b89a92f6a799fc9b1a9f0476bf +R b4e016ae5f2b9a1c3d3b22b5f2592000 +U drh +Z d46a3572f454bea0b6b400466ab43088 diff --git a/manifest.uuid b/manifest.uuid index ecefd3710e..940f87c4fd 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -78c7ec95931265b89a92f6a799fc9b1a9f0476bf \ No newline at end of file +803cb60e75e0b09a526eefec11139cb3e8ae8c7c \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index d8b537f424..8b5695ac18 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1793,6 +1793,7 @@ static char zHelp[] = #ifdef SQLITE_ENABLE_IOTRACE ".iotrace FILE Enable I/O diagnostic logging to FILE\n" #endif + ".limit ?LIMIT? ?VAL? Display or change the value of an SQLITE_LIMIT\n" #ifndef SQLITE_OMIT_LOAD_EXTENSION ".load FILE ?ENTRY? Load an extension library\n" #endif @@ -3171,6 +3172,63 @@ static int do_meta_command(char *zLine, ShellState *p){ } }else #endif + if( c=='l' && n>=5 && strncmp(azArg[0], "limits", n)==0 ){ + static const struct { + const char *zLimitName; /* Name of a limit */ + int limitCode; /* Integer code for that limit */ + } aLimit[] = { + { "length", SQLITE_LIMIT_LENGTH }, + { "sql_length", SQLITE_LIMIT_SQL_LENGTH }, + { "column", SQLITE_LIMIT_COLUMN }, + { "expr_depth", SQLITE_LIMIT_EXPR_DEPTH }, + { "compound_select", SQLITE_LIMIT_COMPOUND_SELECT }, + { "vdbe_op", SQLITE_LIMIT_VDBE_OP }, + { "function_arg", SQLITE_LIMIT_FUNCTION_ARG }, + { "attached", SQLITE_LIMIT_ATTACHED }, + { "like_pattern_length", SQLITE_LIMIT_LIKE_PATTERN_LENGTH }, + { "variable_number", SQLITE_LIMIT_VARIABLE_NUMBER }, + { "trigger_depth", SQLITE_LIMIT_TRIGGER_DEPTH }, + { "worker_threads", SQLITE_LIMIT_WORKER_THREADS }, + }; + int i, n2; + open_db(p, 0); + if( nArg==1 ){ + for(i=0; idb, aLimit[i].limitCode, -1)); + } + }else if( nArg>3 ){ + fprintf(stderr, "Usage: .limit NAME ?NEW-VALUE?\n"); + rc = 1; + goto meta_command_exit; + }else{ + int iLimit = -1; + n2 = strlen30(azArg[1]); + for(i=0; idb, aLimit[iLimit].limitCode, integerValue(azArg[2])); + } + printf("%20s %d\n", aLimit[iLimit].zLimitName, + sqlite3_limit(p->db, aLimit[iLimit].limitCode, -1)); + } + }else #ifndef SQLITE_OMIT_LOAD_EXTENSION if( c=='l' && strncmp(azArg[0], "load", n)==0 ){