From: drh Date: Wed, 15 Nov 2017 17:07:22 +0000 (+0000) Subject: UI improvements on the .testctrl dot-command in the shell. X-Git-Tag: version-3.22.0~197 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=35f51a4460f8548021ef1c709197622172a9e496;p=thirdparty%2Fsqlite.git UI improvements on the .testctrl dot-command in the shell. FossilOrigin-Name: 5d66219c4706e11a9c2a1290224e7c17b19f74657e8239accfb4c6f6be6af9b5 --- diff --git a/manifest b/manifest index 1475fea8d1..959866cf88 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C In\sthe\sparse\stree,\scombine\sLIMIT\sand\sOFFSET\sinto\sa\ssingle\sexpression\srooted\non\sa\sTK_LIMIT\snode,\sfor\sa\ssmall\scode\ssize\sreduction\sand\sperformance\sincrease,\nand\sa\sreduction\sin\scode\scomplexity. -D 2017-11-14T23:48:23.099 +C UI\simprovements\son\sthe\s.testctrl\sdot-command\sin\sthe\sshell. +D 2017-11-15T17:07:22.982 F Makefile.in b142eb20482922153ebc77b261cdfd0a560ed05a81e9f6d9a2b0e8192922a1d2 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc a55372a22454e742ba7c8f6edf05b83213ec01125166ad7dcee0567e2f7fc81b @@ -471,7 +471,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c bbee7e31d369a18a2f4836644769882e9c5d40ef4a3af911db06410b65cb3730 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c 17e220191860a64a18c084141e1a8b7309e166a6f2d42c02021af27ea080d157 -F src/shell.c.in 08cbffc31900359fea85896342a46147e9772c370d8a5079b7be26e3a1f50e8a +F src/shell.c.in e261e3c2f39edbabfdea00ef8f50adf7b2fd7d84fc6d78d8c2a06b335bd1916f F src/sqlite.h.in 8fd97993d48b50b9bade38c52f12d175942c9497c960905610c7b03a3e4b5818 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34 @@ -1677,7 +1677,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 00ec95fcd02bb415dabd7f25fee24856d45d6916c18b2728e97e9bb9b8322ba3 -R 9fe4e3d4453a36374c8a196662e2c5b0 +P 3925facd942c9df663f9b29b1e6f94f6be14af8c2b99eb691bfc836b4c220826 +R 837aef86d6c701c4be924bf38f742114 U drh -Z 3ab594fe26a5b432ce6d9e25b1b1040f +Z 657eeee0b34954f0ac1c7bdc4eb3dc1b diff --git a/manifest.uuid b/manifest.uuid index 41cb7f1619..7a1cc65c2e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -3925facd942c9df663f9b29b1e6f94f6be14af8c2b99eb691bfc836b4c220826 \ No newline at end of file +5d66219c4706e11a9c2a1290224e7c17b19f74657e8239accfb4c6f6be6af9b5 \ No newline at end of file diff --git a/src/shell.c.in b/src/shell.c.in index e85ebd3c93..1b5adc0734 100644 --- a/src/shell.c.in +++ b/src/shell.c.in @@ -5922,49 +5922,68 @@ static int do_meta_command(char *zLine, ShellState *p){ }else #ifndef SQLITE_UNTESTABLE - if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){ + if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 ){ static const struct { const char *zCtrlName; /* Name of a test-control option */ int ctrlCode; /* Integer code for that option */ } aCtrl[] = { - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET }, + { "always", SQLITE_TESTCTRL_ALWAYS }, + { "assert", SQLITE_TESTCTRL_ASSERT }, + { "benign_malloc_hooks", SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS }, { "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST }, + { "byteorder", SQLITE_TESTCTRL_BYTEORDER }, { "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL }, - { "benign_malloc_hooks", SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS }, - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE }, - { "assert", SQLITE_TESTCTRL_ASSERT }, - { "always", SQLITE_TESTCTRL_ALWAYS }, - { "reserve", SQLITE_TESTCTRL_RESERVE }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS }, + { "imposter", SQLITE_TESTCTRL_IMPOSTER }, { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD }, - { "byteorder", SQLITE_TESTCTRL_BYTEORDER }, { "never_corrupt", SQLITE_TESTCTRL_NEVER_CORRUPT }, - { "imposter", SQLITE_TESTCTRL_IMPOSTER }, + { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS }, + { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE }, + { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET }, + { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE }, + { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE }, + { "reserve", SQLITE_TESTCTRL_RESERVE }, }; int testctrl = -1; int rc2 = 0; int i, n2; open_db(p, 0); + const char *zCmd = nArg>=2 ? azArg[1] : "help"; + + /* The argument can optionally begin with "-" or "--" */ + if( zCmd[0]=='-' && zCmd[1] ){ + zCmd++; + if( zCmd[0]=='-' && zCmd[1] ) zCmd++; + } + + /* --help lists all test-controls */ + if( strcmp(zCmd,"help")==0 ){ + utf8_printf(p->out, "Available test-controls:\n"); + for(i=0; iout, " .testctrl %s\n", aCtrl[i].zCtrlName); + } + rc = 1; + goto meta_command_exit; + } /* convert testctrl text option to value. allow any unique prefix ** of the option name, or a numerical value. */ - n2 = strlen30(azArg[1]); + n2 = strlen30(zCmd); for(i=0; iSQLITE_TESTCTRL_LAST) ){ - utf8_printf(stderr,"Error: invalid testctrl option: %s\n", azArg[1]); + utf8_printf(stderr,"Error: unknown test-control: %s\n" + "Use \".testctrl --help\" for help\n", zCmd); }else{ switch(testctrl){