]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Fix the ".read" command in the command-line shell so that it understands
authordrh <drh@noemail.net>
Wed, 7 Sep 2016 13:20:29 +0000 (13:20 +0000)
committerdrh <drh@noemail.net>
Wed, 7 Sep 2016 13:20:29 +0000 (13:20 +0000)
that the input is not interactive.

FossilOrigin-Name: 7c2c0d1dceb6b49822e5f5c5e531744d2a4fd12c

manifest
manifest.uuid
src/shell.c
test/shell4.test

index cc89aecb0f20f2b269ee8cab688c8017477781a5..fca724b98acf8e72089253662957adff74165b9d 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Version\snumber\sto\s3.14.2.
-D 2016-09-07T12:47:46.925
+C Fix\sthe\s".read"\scommand\sin\sthe\scommand-line\sshell\sso\sthat\sit\sunderstands\nthat\sthe\sinput\sis\snot\sinteractive.
+D 2016-09-07T13:20:29.424
 F Makefile.in cfd8fb987cd7a6af046daa87daa146d5aad0e088
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 50e36f9aa2c4f8e0a02ba1984d7e81001827d97d
@@ -384,7 +384,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
 F src/resolve.c 0392c6686586b1d4dac9a4106959f03ddd70e9aa
 F src/rowset.c 7b7e7e479212e65b723bf40128c7b36dc5afdfac
 F src/select.c f3c6e9065fb34f6a23af27ec7f1f717ffbfc2ee4
-F src/shell.c 79dda477be6c96eba6e952a934957ad36f87acc7
+F src/shell.c de7c7e98846cacbfbe062cbd98bca899dfb720e3
 F src/sqlite.h.in 0f7580280d1b009b507d8beec1ff0f197ba0cc99
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h 8648034aa702469afb553231677306cc6492a1ae
@@ -1068,7 +1068,7 @@ F test/sharedlock.test 5ede3c37439067c43b0198f580fd374ebf15d304
 F test/shell1.test 65b10cd8a90cda9b5af9100a45689a57dcc01a31
 F test/shell2.test e242a9912f44f4c23c3d1d802a83e934e84c853b
 F test/shell3.test da513d522ef6f01cee8475dcf8332bff8982b3dd
-F test/shell4.test 69995ee1cc278eb149aa8746ce1f935f4eaf98b9
+F test/shell4.test 89ad573879a745974ff2df20ff97c5d6ffffbd5d
 F test/shell5.test 50a732c1c2158b1cd62cf53975ce1ea7ce6b9dc9
 F test/shortread1.test bb591ef20f0fd9ed26d0d12e80eee6d7ac8897a3
 F test/show_speedtest1_rtree.tcl 32e6c5f073d7426148a6936a0408f4b5b169aba5
@@ -1509,7 +1509,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P af951e036ec7480d04656364fef1c6e24a24b1b2
-R 6e41e85a0ca61605de9fe30d463feb12
+P 925ef2f915c99fa358d988081497dc3a55515816
+Q +d8451fe84d09db6ec7e1bd5f0708ea1b5e85f3d6
+R bb7c8d1dff91c6564d07fbf38ac877d7
 U drh
-Z ea2fcd0cc2c47cd3cbd22b517a17e16f
+Z dcc6177e9e864b7646528523888367fd
index e069620323416a63f1320f6f6a80a31b1c0cb28f..e50a39daad99cfabb935f60ffd6a26a35b746853 100644 (file)
@@ -1 +1 @@
-925ef2f915c99fa358d988081497dc3a55515816
\ No newline at end of file
+7c2c0d1dceb6b49822e5f5c5e531744d2a4fd12c
\ No newline at end of file
index 18c6ef719759fe105b4b4b17f8c1853e0ec9a55b..21cba66b1c29a8d1c4ac8c66e617bd17dd77f99d 100644 (file)
@@ -524,7 +524,7 @@ static char *local_getline(char *zLine, FILE *in){
 #if defined(_WIN32) || defined(WIN32)
   /* For interactive input on Windows systems, translate the
   ** multi-byte characterset characters into UTF-8. */
-  if( stdin_is_interactive ){
+  if( stdin_is_interactive && in==stdin ){
     char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
     if( zTrans ){
       int nTrans = strlen30(zTrans)+1;
@@ -4905,7 +4905,7 @@ static int process_input(ShellState *p, FILE *in){
     zLine = one_input_line(in, zLine, nSql>0);
     if( zLine==0 ){
       /* End of input */
-      if( stdin_is_interactive ) printf("\n");
+      if( in==0 && stdin_is_interactive ) printf("\n");
       break;
     }
     if( seenInterrupt ){
index 3e4ae558166dbe3faa08af922dfdc10e70562daf..88e5e69a288fef4393c4b401272d4791a5161004 100644 (file)
@@ -18,6 +18,7 @@
 #
 #   shell4-1.*: Basic tests specific to the "stats" command.
 #   shell4-2.*: Basic tests for ".trace"
+#   shell4-3.*: The ".read" command takes the shell out of interactive mode
 #
 set testdir [file dirname $argv0]
 source $testdir/tester.tcl
@@ -124,5 +125,17 @@ do_test shell4-2.5 {
 } {0 {SELECT * FROM t1;}}
 }
 
+do_test shell4-3.1 {
+  set fd [open t1.txt wb]
+  puts $fd "SELECT 'squirrel';"
+  close $fd
+  exec $::CLI :memory: --interactive ".read t1.txt"
+} {squirrel}
+do_test shell4-3.2 {
+  set fd [open t1.txt wb]
+  puts $fd "SELECT 'pound: \302\243';"
+  close $fd
+  exec $::CLI :memory: --interactive ".read t1.txt"
+} {pound: £}
 
 finish_test