/ Check-in [b36dfdff]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Refinements to the previous check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | altShellFix
Files: files | file ages | folders
SHA1: b36dfdff787dc4a107b2c3fcbb98bfc4922872d8
User & Date: mistachkin 2016-04-04 02:33:34
Context
2016-04-04
15:47
Add and enhance the new tests. Closed-Leaf check-in: f4cbd18d user: mistachkin tags: altShellFix
02:33
Refinements to the previous check-in. check-in: b36dfdff user: mistachkin tags: altShellFix
02:16
Experimental changes to the command line shell to make it work better with Unicode on Windows. check-in: 74183a5f user: mistachkin tags: altShellFix
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  4995   4995   #  endif
  4996   4996   #endif
  4997   4997   
  4998   4998   #if SQLITE_SHELL_IS_UTF8
  4999   4999   int SQLITE_CDECL main(int argc, char **argv){
  5000   5000   #else
  5001   5001   int SQLITE_CDECL wmain(int argc, wchar_t **wargv){
  5002         -  char **argv = 0;
         5002  +  char **argv;
  5003   5003   #endif
  5004   5004     char *zErrMsg = 0;
  5005   5005     ShellState data;
  5006   5006     const char *zInitFile = 0;
  5007   5007     int i;
  5008   5008     int rc = 0;
  5009   5009     int warnInmemoryDb = 0;
  5010   5010     int readStdin = 1;
  5011   5011     int nCmd = 0;
  5012   5012     char **azCmd = 0;
  5013   5013   
  5014   5014     setBinaryMode(stdin, 0);
  5015   5015     setvbuf(stderr, 0, _IONBF, 0); /* Make sure stderr is unbuffered */
         5016  +  stdin_is_interactive = isatty(0);
         5017  +  stdout_is_console = isatty(1);
  5016   5018   
  5017   5019   #if USE_SYSTEM_SQLITE+0!=1
  5018   5020     if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){
  5019   5021       utf8_printf(stderr, "SQLite header and source version mismatch\n%s\n%s\n",
  5020   5022               sqlite3_sourceid(), SQLITE_SOURCE_ID);
  5021   5023       exit(1);
  5022   5024     }
................................................................................
  5033   5035       argv[i] = sqlite3_win32_unicode_to_utf8(wargv[i]);
  5034   5036       if( argv[i]==0 ){
  5035   5037         raw_printf(stderr, "out of memory\n");
  5036   5038         exit(1);
  5037   5039       }
  5038   5040     }
  5039   5041   #endif
         5042  +  assert( argc>=1 && argv && argv[0] );
  5040   5043     Argv0 = argv[0];
  5041         -  stdin_is_interactive = isatty(0);
  5042         -  stdout_is_console = isatty(1);
  5043   5044   
  5044   5045     /* Make sure we have a valid signal handler early, before anything
  5045   5046     ** else is done.
  5046   5047     */
  5047   5048   #ifdef SIGINT
  5048   5049     signal(SIGINT, interrupt_handler);
  5049   5050   #endif

Changes to test/shell1.test.

   907    907       if {$res ne "$oldChar\n"} {
   908    908         error "failed with byte $hex mismatch"
   909    909       }
   910    910     }
   911    911   } {}
   912    912   
   913    913   do_test shell1-6.0 {
   914         -  # The file name here is the word "test" in Chinese.
          914  +  # The base file name here is the word "test" in Chinese.
   915    915     # In UTF-8, it is encoded as: \xE6\xB5\x8B\xE8\xAF\x95
   916    916     set fileName \u6D4B\u8BD5; append fileName .db
   917    917     set x [catchcmdex $fileName "CREATE TABLE t1(x);\n.schema\n"]
   918    918     set code [lindex $x 0]
   919    919     set res [string trim [lindex $x 1]]
   920    920     if {$code ne "0"} {
   921    921       error "failed with error: $res"
   922    922     }
   923    923     if {$res ne "CREATE TABLE t1(x);"} {
   924    924       error "failed with mismatch: $res"
   925    925     }
   926    926     if {![file exists $fileName]} {
   927         -    error "file \"$fileName\" (MBCS) does not exist"
          927  +    error "file \"$fileName\" (Unicode) does not exist"
   928    928     }
   929    929     forcedelete $fileName
   930    930   } {}
   931    931   
   932    932   finish_test