SQLite

Check-in [2ab256bc]
Login

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

Overview
Comment:Fix output redirect bug reported in the forum.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | branch-3.44
Files: files | file ages | folders
SHA3-256: 2ab256bc0bb351c16feaf0d4917ad9c3f55e39821cc7d319d86c6f0752188af7
User & Date: larrybr 2023-11-23 07:06:21
Original Comment: Fix output redirect bug reported in the forum.
Context
2023-11-23
11:21
Increase the version number to 3.44.2. (check-in: 73d3cb79 user: drh tags: branch-3.44)
07:10
Fix output redirect bug reported in the forum. (check-in: 60bdd5c3 user: larrybr tags: console-io-lib)
07:08
Fix output redirect bug reported in the forum. (check-in: ce542fee user: larrybr tags: trunk)
07:06
Fix output redirect bug reported in the forum. (check-in: 2ab256bc user: larrybr tags: branch-3.44)
2023-11-22
17:13
Correct the URL for loading sqlite3-worker1-bundler-friendly.mjs from sqlite3-worker1-promiser-bundler-friendly.js, so that the promiser can be used in bundler-using environments. Problem reported via email. (check-in: b1128838 user: stephan tags: branch-3.44)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ext/consio/console_io.c.

339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
}
# endif

/* Get stream info, either for designated output or error stream when
** chix equals 1 or 2, or for an arbitrary stream when chix == 0.
** In either case, ppst references a caller-owned PerStreamTags
** struct which may be filled in if none of the known writable
** streams is being held by consoleInfo. The ppf parameter is an
** output when chix!=0 and an input when chix==0.
 */
static PerStreamTags *
getEmitStreamInfo(unsigned chix, PerStreamTags *ppst,
                  /* in/out */ FILE **ppf){
  PerStreamTags *ppstTry;
  FILE *pfEmit;
  if( chix > 0 ){
    ppstTry = &consoleInfo.pstDesignated[chix];
    if( !isValidStreamInfo(ppstTry) ){
      ppstTry = &consoleInfo.pstSetup[chix];
      pfEmit = ppst->pf;
    }else pfEmit = ppstTry->pf;
    if( !isValidStreamInfo(ppst) ){
      pfEmit = (chix > 1)? stderr : stdout;
      ppstTry = ppst;
      streamOfConsole(pfEmit, ppstTry);
    }
    *ppf = pfEmit;
  }else{
    ppstTry = isKnownWritable(*ppf);







|
|












|







339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
}
# endif

/* Get stream info, either for designated output or error stream when
** chix equals 1 or 2, or for an arbitrary stream when chix == 0.
** In either case, ppst references a caller-owned PerStreamTags
** struct which may be filled in if none of the known writable
** streams is being held by consoleInfo. The ppf parameter is a
** byref output when chix!=0 and a byref input when chix==0.
 */
static PerStreamTags *
getEmitStreamInfo(unsigned chix, PerStreamTags *ppst,
                  /* in/out */ FILE **ppf){
  PerStreamTags *ppstTry;
  FILE *pfEmit;
  if( chix > 0 ){
    ppstTry = &consoleInfo.pstDesignated[chix];
    if( !isValidStreamInfo(ppstTry) ){
      ppstTry = &consoleInfo.pstSetup[chix];
      pfEmit = ppst->pf;
    }else pfEmit = ppstTry->pf;
    if( !isValidStreamInfo(ppstTry) ){
      pfEmit = (chix > 1)? stderr : stdout;
      ppstTry = ppst;
      streamOfConsole(pfEmit, ppstTry);
    }
    *ppf = pfEmit;
  }else{
    ppstTry = isKnownWritable(*ppf);

Changes to test/shell1.test.

492
493
494
495
496
497
498
499

500
501
502



503

504
505
506
507
508
509
510
do_test shell1-3.14.3 {
  # too many arguments
  catchcmd "test.db" ".nullvalue FOO BAD"
} {1 {Usage: .nullvalue STRING}}

# .output FILENAME       Send output to FILENAME
do_test shell1-3.15.1 {
  catchcmd "test.db" ".output"

} {0 {}}
do_test shell1-3.15.2 {
  catchcmd "test.db" ".output FOO"



} {0 {}}

do_test shell1-3.15.3 {
  # too many arguments
  catchcmd "test.db" ".output FOO BAD"
} {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:







|
>
|

|
>
>
>
|
>







492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
do_test shell1-3.14.3 {
  # too many arguments
  catchcmd "test.db" ".nullvalue FOO BAD"
} {1 {Usage: .nullvalue STRING}}

# .output FILENAME       Send output to FILENAME
do_test shell1-3.15.1 {
  catchcmd "test.db" ".output
.print x"
} {0 x}
do_test shell1-3.15.2 {
  catchcmd "test.db" ".output FOO
.print x
.output
SELECT readfile('FOO');"
} {0 {x
}}
do_test shell1-3.15.3 {
  # too many arguments
  catchcmd "test.db" ".output FOO BAD"
} {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: