From: drh Date: Sat, 8 Apr 2017 00:55:13 +0000 (+0000) Subject: Fix the ".dump" command so that it works with ".headers on". Also fix the X-Git-Tag: version-3.19.0~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=72507d431b2a25a574b340d8f05f379922b360d5;p=thirdparty%2Fsqlite.git Fix the ".dump" command so that it works with ".headers on". Also fix the display of ".mode insert" with ".headers on". FossilOrigin-Name: a6ce57ee3c7f3527554a75cc1dd5ebcd33c944d4dca07b134d103596a2ae5b32 --- diff --git a/manifest b/manifest index 17be6d0663..4e3b8e1575 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Use\sreplace()\sinstead\sof\schar()\sto\squote\snewline\sand\sreturn\scharacters\sin\nstrings\sin\sthe\soutput\sof\s.dump,\sto\savoid\sexcess\sexpression\scomplexity. -D 2017-04-07T20:20:08.441 +C Fix\sthe\s".dump"\scommand\sso\sthat\sit\sworks\swith\s".headers\son".\s\sAlso\sfix\sthe\ndisplay\sof\s".mode\sinsert"\swith\s".headers\son". +D 2017-04-08T00:55:13.524 F Makefile.in 1cc758ce3374a32425e4d130c2fe7b026b20de5b8843243de75f087c0a2661fb F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc a4c0613a18663bda56d8cf76079ab6590a7c3602e54befb4bbdef76bcaa38b6a @@ -402,7 +402,7 @@ F src/random.c 80f5d666f23feb3e6665a6ce04c7197212a88384 F src/resolve.c 3e518b962d932a997fae373366880fc028c75706 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac F src/select.c afcf31d8ed7c890328a31d3f350467ccd273af345b24562382b398d6d9cd0664 -F src/shell.c 3680725485ce5022dc683d593e8a4b95f973597d843ddb8be788d7dc24d16de9 +F src/shell.c 13512de3e9862c1c2df0b034b1f54810e0b885fcf25475b7c61b7e7ef0a28d33 F src/sqlite.h.in ab77e511620eebbd4ed7e4f52fae697b6870dda66c945acd2d3066f99c98e17e F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8 F src/sqlite3ext.h 58fd0676d3111d02e62e5a35992a7d3da5d3f88753acc174f2d37b774fbbdd28 @@ -1570,8 +1570,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 48826b222c110a90996a84605318ea6b1e502b8c5129f4d561f8350dbdbcd264 4c2b572969ea2ed2a925444ecfa356aa877018cbb9c4f57d081ab4b535cd1dd0 -R 33164644836f84aff2e4df2bff5189e1 -T +closed 4c2b572969ea2ed2a925444ecfa356aa877018cbb9c4f57d081ab4b535cd1dd0 +P 7307352988174a6c2756dbbe200bf62a45fb4cc1da7faa2c6b0f75e229eab703 +R c90966020932134529ac766bef984a02 U drh -Z b74a0247eea28681dd3f2667b402dd90 +Z e8c368ee65564e309cb032faeb68575a diff --git a/manifest.uuid b/manifest.uuid index 35e56e96e3..53d4b77bf8 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -7307352988174a6c2756dbbe200bf62a45fb4cc1da7faa2c6b0f75e229eab703 \ No newline at end of file +a6ce57ee3c7f3527554a75cc1dd5ebcd33c944d4dca07b134d103596a2ae5b32 \ No newline at end of file diff --git a/src/shell.c b/src/shell.c index 5562fd61c2..9ddd11706d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -2039,8 +2039,14 @@ static int shell_callback( if( p->showHeader ){ raw_printf(p->out,"("); for(i=0; i0 ? ",": ""; - utf8_printf(p->out, "%s%s", zSep, azCol[i]); + if( i>0 ) raw_printf(p->out, ","); + if( quoteChar(azCol[i]) ){ + char *z = sqlite3_mprintf("\"%w\"", azCol[i]); + utf8_printf(p->out, "%s", z); + sqlite3_free(z); + }else{ + raw_printf(p->out, "%s", azCol[i]); + } } raw_printf(p->out,")"); } @@ -4717,6 +4723,7 @@ static int do_meta_command(char *zLine, ShellState *p){ if( c=='d' && strncmp(azArg[0], "dump", n)==0 ){ const char *zLike = 0; int i; + int savedShowHeader = p->showHeader; ShellClearFlag(p, SHFLG_PreserveRowid); for(i=1; iout, "PRAGMA foreign_keys=OFF;\n"); raw_printf(p->out, "BEGIN TRANSACTION;\n"); p->writableSchema = 0; + p->showHeader = 0; /* Set writable_schema=ON since doing so forces SQLite to initialize ** as much of the schema as it can even if the sqlite_master table is ** corrupt. */ @@ -4793,6 +4801,7 @@ static int do_meta_command(char *zLine, ShellState *p){ sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0); raw_printf(p->out, p->nErr ? "ROLLBACK; -- due to errors\n" : "COMMIT;\n"); + p->showHeader = savedShowHeader; }else if( c=='e' && strncmp(azArg[0], "echo", n)==0 ){