mirror of https://github.com/sqlite/sqlite
Enhance the ".filectrl" command in the CLI to support the --schema option.
FossilOrigin-Name: 698d40db58b76f4094687d46b5c6292702a62168054f9e6a70ee86650a6635f7
This commit is contained in:
parent
45248de39a
commit
541ef2c36c
14
manifest
14
manifest
|
@ -1,5 +1,5 @@
|
|||
C The\sSQLITE_TESTCTRL_RESERVE\soperator\sis\sremoved.\s\sIn\sits\splace\sis\sthe\nmore\sgenerate\sSQLITE_FCNTL_RESERVE_BYTES\swhich\sis\san\sAPI\sand\swhich\scan\noperator\son\smore\sthan\sjust\sthe\smain\sschema.
|
||||
D 2020-04-20T15:18:43.124
|
||||
C Enhance\sthe\s".filectrl"\scommand\sin\sthe\sCLI\sto\ssupport\sthe\s--schema\soption.
|
||||
D 2020-04-20T16:21:30.906
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
|
@ -533,7 +533,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
|||
F src/resolve.c d36a2b1639e1c33d7b508abfd3452a63e7fd81737f6f3940bfef085fca6f21f4
|
||||
F src/rowset.c ba9515a922af32abe1f7d39406b9d35730ed65efab9443dc5702693b60854c92
|
||||
F src/select.c ab4eb1aee1bd066feea5b6eff264220ae54459019654264e9f688368a7d0c0b5
|
||||
F src/shell.c.in c21ce88a16c04c46741ee04373992ad9982bd2fe83217e9c77012e63af0dde73
|
||||
F src/shell.c.in 5402d3a7281576c96d788569778483746859c5e47052facfc4a4ccfac025d5da
|
||||
F src/sqlite.h.in d4430b302155f757f0fbce33c5afe136525827ddfbe532a79fd7fe85b127ea29
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h 9c5269260409eb3275324ccace6a13a96f4ad330c708415f70ca6097901ff4ee
|
||||
|
@ -1334,7 +1334,7 @@ F test/sharedA.test 49d87ec54ab640fbbc3786ee3c01de94aaa482a3a9f834ad3fe92770eb69
|
|||
F test/sharedB.test 16cc7178e20965d75278f410943109b77b2e645e
|
||||
F test/shared_err.test 32634e404a3317eeb94abc7a099c556a346fdb8fb3858dbe222a4cbb8926a939
|
||||
F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
|
||||
F test/shell1.test 1796b7f76d09ffd2b2dc0ff5ad89428e9892f237d4f4e33ef2278f064a2d94a4
|
||||
F test/shell1.test 5bd10014ec494744f5e966a1521334e9d612119a0afcfa5251684a4e1f2ffc66
|
||||
F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
|
||||
F test/shell3.test ac8c2b744014c3e9a0e26bfd829ab65f00923dc1a91ffd044863e9423cc91494
|
||||
F test/shell4.test 1c6aef11daaa2d6830acaba3ac9cbec93fbc1c3d5530743a637f39b3987d08ce
|
||||
|
@ -1861,7 +1861,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 4135cb024456288d9c85aef5fb572dbb591527dd33d9a60ca5946b712c269941
|
||||
R 1d205cbee16938d3cfb21de74a2e62b1
|
||||
P abc1aad74f7b6a1e72fb09936239f2224aa942d16296c6a3de0b8daef4bc8471
|
||||
R 0b689458032aceec4d998f84188e0ee8
|
||||
U drh
|
||||
Z db2ebefa734c86f2ca8a25996eb4de7d
|
||||
Z af548dcf210abacdeac04040d9882947
|
||||
|
|
|
@ -1 +1 @@
|
|||
abc1aad74f7b6a1e72fb09936239f2224aa942d16296c6a3de0b8daef4bc8471
|
||||
698d40db58b76f4094687d46b5c6292702a62168054f9e6a70ee86650a6635f7
|
|
@ -3588,7 +3588,8 @@ static const char *(azHelp[]) = {
|
|||
".expert EXPERIMENTAL. Suggest indexes for queries",
|
||||
".explain ?on|off|auto? Change the EXPLAIN formatting mode. Default: auto",
|
||||
".filectrl CMD ... Run various sqlite3_file_control() operations",
|
||||
" Run \".filectrl\" with no arguments for details",
|
||||
" --schema SCHEMA Use SCHEMA instead of \"main\"",
|
||||
" --help Show CMD details",
|
||||
".fullschema ?--indent? Show schema and the content of sqlite_stat tables",
|
||||
".headers on|off Turn display of headers on or off",
|
||||
".help ?-all? ?PATTERN? Show help text for PATTERN",
|
||||
|
@ -7489,6 +7490,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
{ "tempfilename", SQLITE_FCNTL_TEMPFILENAME, "" },
|
||||
{ "has_moved", SQLITE_FCNTL_HAS_MOVED, "" },
|
||||
{ "lock_timeout", SQLITE_FCNTL_LOCK_TIMEOUT, "MILLISEC" },
|
||||
{ "reserve_bytes", SQLITE_FCNTL_RESERVE_BYTES, "[N]" },
|
||||
};
|
||||
int filectrl = -1;
|
||||
int iCtrl = -1;
|
||||
|
@ -7496,10 +7498,21 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
int isOk = 0; /* 0: usage 1: %lld 2: no-result */
|
||||
int n2, i;
|
||||
const char *zCmd = 0;
|
||||
const char *zSchema = 0;
|
||||
|
||||
open_db(p, 0);
|
||||
zCmd = nArg>=2 ? azArg[1] : "help";
|
||||
|
||||
if( zCmd[0]=='-'
|
||||
&& (strcmp(zCmd,"--schema")==0 || strcmp(zCmd,"-schema")==0)
|
||||
&& nArg>=4
|
||||
){
|
||||
zSchema = azArg[2];
|
||||
for(i=3; i<nArg; i++) azArg[i-2] = azArg[i];
|
||||
nArg -= 2;
|
||||
zCmd = azArg[1];
|
||||
}
|
||||
|
||||
/* The argument can optionally begin with "-" or "--" */
|
||||
if( zCmd[0]=='-' && zCmd[1] ){
|
||||
zCmd++;
|
||||
|
@ -7541,7 +7554,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
case SQLITE_FCNTL_SIZE_LIMIT: {
|
||||
if( nArg!=2 && nArg!=3 ) break;
|
||||
iRes = nArg==3 ? integerValue(azArg[2]) : -1;
|
||||
sqlite3_file_control(p->db, 0, SQLITE_FCNTL_SIZE_LIMIT, &iRes);
|
||||
sqlite3_file_control(p->db, zSchema, SQLITE_FCNTL_SIZE_LIMIT, &iRes);
|
||||
isOk = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -7550,7 +7563,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
int x;
|
||||
if( nArg!=3 ) break;
|
||||
x = (int)integerValue(azArg[2]);
|
||||
sqlite3_file_control(p->db, 0, filectrl, &x);
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &x);
|
||||
isOk = 2;
|
||||
break;
|
||||
}
|
||||
|
@ -7559,7 +7572,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
int x;
|
||||
if( nArg!=2 && nArg!=3 ) break;
|
||||
x = nArg==3 ? booleanValue(azArg[2]) : -1;
|
||||
sqlite3_file_control(p->db, 0, filectrl, &x);
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &x);
|
||||
iRes = x;
|
||||
isOk = 1;
|
||||
break;
|
||||
|
@ -7567,7 +7580,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
case SQLITE_FCNTL_HAS_MOVED: {
|
||||
int x;
|
||||
if( nArg!=2 ) break;
|
||||
sqlite3_file_control(p->db, 0, filectrl, &x);
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &x);
|
||||
iRes = x;
|
||||
isOk = 1;
|
||||
break;
|
||||
|
@ -7575,7 +7588,7 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
case SQLITE_FCNTL_TEMPFILENAME: {
|
||||
char *z = 0;
|
||||
if( nArg!=2 ) break;
|
||||
sqlite3_file_control(p->db, 0, filectrl, &z);
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &z);
|
||||
if( z ){
|
||||
utf8_printf(p->out, "%s\n", z);
|
||||
sqlite3_free(z);
|
||||
|
@ -7583,6 +7596,18 @@ static int do_meta_command(char *zLine, ShellState *p){
|
|||
isOk = 2;
|
||||
break;
|
||||
}
|
||||
case SQLITE_FCNTL_RESERVE_BYTES: {
|
||||
int x;
|
||||
if( nArg>=3 ){
|
||||
x = atoi(azArg[2]);
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &x);
|
||||
}
|
||||
x = -1;
|
||||
sqlite3_file_control(p->db, zSchema, filectrl, &x);
|
||||
utf8_printf(p->out,"%d\n", x);
|
||||
isOk = 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if( isOk==0 && iCtrl>=0 ){
|
||||
|
|
|
@ -493,7 +493,14 @@ do_test shell1-3.15.2 {
|
|||
do_test shell1-3.15.3 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".output FOO BAD"
|
||||
} {1 {Usage: .output [-e|-x|FILE]}}
|
||||
} {1 {ERROR: extra parameter: "BAD". Usage:
|
||||
.output ?FILE? Send output to FILE or stdout if FILE is omitted
|
||||
If FILE begins with '|' then open it as a pipe.
|
||||
Options:
|
||||
--bom Prefix output with a UTF8 byte-order mark
|
||||
-e Send output to the system text editor
|
||||
-x Send output as CSV to a spreadsheet
|
||||
child process exited abnormally}}
|
||||
|
||||
# .output stdout Send output to the screen
|
||||
do_test shell1-3.16.1 {
|
||||
|
@ -502,7 +509,14 @@ do_test shell1-3.16.1 {
|
|||
do_test shell1-3.16.2 {
|
||||
# too many arguments
|
||||
catchcmd "test.db" ".output stdout BAD"
|
||||
} {1 {Usage: .output [-e|-x|FILE]}}
|
||||
} {1 {ERROR: extra parameter: "BAD". Usage:
|
||||
.output ?FILE? Send output to FILE or stdout if FILE is omitted
|
||||
If FILE begins with '|' then open it as a pipe.
|
||||
Options:
|
||||
--bom Prefix output with a UTF8 byte-order mark
|
||||
-e Send output to the system text editor
|
||||
-x Send output as CSV to a spreadsheet
|
||||
child process exited abnormally}}
|
||||
|
||||
# .prompt MAIN CONTINUE Replace the standard prompts
|
||||
do_test shell1-3.17.1 {
|
||||
|
|
Loading…
Reference in New Issue