Save and restore the output mode when doing ".once -x" or ".excel".
FossilOrigin-Name: f697c164518d36f2a63c87d9f2708d0f9481fad3ded2de61f3f48c393cf7a500
This commit is contained in:
parent
a92a01a77e
commit
3c484e8c1f
12
manifest
12
manifest
@ -1,5 +1,5 @@
|
||||
C An\sattempt\sto\sget\s".once\s-e"\sworking\sreliably\son\sWindows.
|
||||
D 2018-01-10T22:15:37.810
|
||||
C Save\sand\srestore\sthe\soutput\smode\swhen\sdoing\s".once\s-x"\sor\s".excel".
|
||||
D 2018-01-10T22:27:21.115
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F Makefile.in 38f84f301cbef443b2d269f67a74b8cc536469831f70df7c3e912acc04932cc2
|
||||
@ -484,7 +484,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384
|
||||
F src/resolve.c bbee7e31d369a18a2f4836644769882e9c5d40ef4a3af911db06410b65cb3730
|
||||
F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
|
||||
F src/select.c 8b22abe193e4d8243befa2038e4ae2405802fed1c446e5e502d11f652e09ba74
|
||||
F src/shell.c.in 8ac56c0e57d87f04c7c021d17d541063fd4cd9e5cd558caf40a63bf42875b8a9
|
||||
F src/shell.c.in 0baa3d017e3e46ed935413f7e8d09b8c77a8f870c84cf8b2d8b81528517bf485
|
||||
F src/sqlite.h.in 1f1a2da222ec57465794e8984d77f32d0bd0da80cdc136beadda461a0be9d80c
|
||||
F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
|
||||
F src/sqlite3ext.h c02d628cca67f3889c689d82d25c3eb45e2c155db08e4c6089b5840d64687d34
|
||||
@ -1697,7 +1697,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 9b95ff1abfb8d49bbe5a727f5c917a455e4289b4d69196377dc9294409341d70
|
||||
R 0c911dcb6179b38e957861df043bdcc3
|
||||
P 9b97f9d2c876162139dbd9485fcf68412d1572d9ddc179b08938b8a602e895d6
|
||||
R d864377b5e3ba9e6ed72c01bab712abd
|
||||
U drh
|
||||
Z 8c9fcb0a09d556e95bbd5b8371ae82b1
|
||||
Z 372298188cf6cc90b3d7d11dd46f07c5
|
||||
|
@ -1 +1 @@
|
||||
9b97f9d2c876162139dbd9485fcf68412d1572d9ddc179b08938b8a602e895d6
|
||||
f697c164518d36f2a63c87d9f2708d0f9481fad3ded2de61f3f48c393cf7a500
|
@ -1019,6 +1019,7 @@ struct ShellState {
|
||||
FILE *traceOut; /* Output for sqlite3_trace() */
|
||||
int nErr; /* Number of errors seen */
|
||||
int mode; /* An output mode setting */
|
||||
int modePrior; /* Saved mode */
|
||||
int cMode; /* temporary output mode for the current query */
|
||||
int normalMode; /* Output mode before ".explain on" */
|
||||
int writableSchema; /* True if PRAGMA writable_schema=ON */
|
||||
@ -1030,6 +1031,8 @@ struct ShellState {
|
||||
char zTestcase[30]; /* Name of current test case */
|
||||
char colSeparator[20]; /* Column separator character for several modes */
|
||||
char rowSeparator[20]; /* Row separator character for MODE_Ascii */
|
||||
char colSepPrior[20]; /* Saved column separator */
|
||||
char rowSepPrior[20]; /* Saved row separator */
|
||||
int colWidth[100]; /* Requested width of each column when in column mode*/
|
||||
int actualWidth[100]; /* Actual width of each column */
|
||||
char nullValue[20]; /* The text to print when a NULL comes back from
|
||||
@ -1153,6 +1156,20 @@ static void shellPutsFunc(
|
||||
sqlite3_result_value(pCtx, apVal[0]);
|
||||
}
|
||||
|
||||
/*
|
||||
** Save or restore the current output mode
|
||||
*/
|
||||
static void outputModePush(ShellState *p){
|
||||
p->modePrior = p->mode;
|
||||
memcpy(p->colSepPrior, p->colSeparator, sizeof(p->colSeparator));
|
||||
memcpy(p->rowSepPrior, p->rowSeparator, sizeof(p->rowSeparator));
|
||||
}
|
||||
static void outputModePop(ShellState *p){
|
||||
p->mode = p->modePrior;
|
||||
memcpy(p->colSeparator, p->colSepPrior, sizeof(p->colSeparator));
|
||||
memcpy(p->rowSeparator, p->rowSepPrior, sizeof(p->rowSeparator));
|
||||
}
|
||||
|
||||
/*
|
||||
** Output the given string as a hex-encoded blob (eg. X'1234' )
|
||||
*/
|
||||
@ -3957,7 +3974,7 @@ static void output_reset(ShellState *p){
|
||||
utf8_printf(stderr, "Failed: [%s]\n", zCmd);
|
||||
}
|
||||
sqlite3_free(zCmd);
|
||||
p->mode = p->doXdgOpen - 1;
|
||||
outputModePop(p);
|
||||
p->doXdgOpen = 0;
|
||||
}
|
||||
}
|
||||
@ -6200,7 +6217,8 @@ static int do_meta_command(char *zLine, ShellState *p){
|
||||
output_reset(p);
|
||||
if( zFile[0]=='-' && zFile[1]=='-' ) zFile++;
|
||||
if( strcmp(zFile, "-e")==0 || strcmp(zFile, "-x")==0 ){
|
||||
p->doXdgOpen = p->mode + 1;
|
||||
p->doXdgOpen = 1;
|
||||
outputModePush(p);
|
||||
if( zFile[1]=='x' ){
|
||||
newTempFile(p, "csv");
|
||||
p->mode = MODE_Csv;
|
||||
|
Loading…
x
Reference in New Issue
Block a user