SQLite

Check-in [6c716f4b55]
Login

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

Overview
Comment:If the argument to the ".read" command in the CLI begins with "|" then run the remainder of the argument as a command and read input from the output of that command.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6c716f4b556ea8f9c9f15cffd81cb970488eadf1d5da2ba6b366d3bdeb36e492
User & Date: drh 2020-08-26 10:50:48.952
References
2020-08-26
14:12 New ticket [be31cf009c] Unexpected result for % and '1E1'. (artifact: 3102412d99 user: mrigger)
Context
2020-08-26
19:07
Enhance the ".databases" command in the CLI so that it shows the result of sqlite3_db_readonly() and sqlite3_txn_state() for each database file. (check-in: 0ffd16d23d user: drh tags: trunk)
10:50
If the argument to the ".read" command in the CLI begins with "|" then run the remainder of the argument as a command and read input from the output of that command. (check-in: 6c716f4b55 user: drh tags: trunk)
2020-08-25
19:09
Add support for the sqlite3_txn_state() interface. (check-in: ad195e3dd8 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/shell.c.in.
8958
8959
8960
8961
8962
8963
8964
8965








8966
8967
8968
8969
8970
8971
8972
8973
8974
    FILE *inSaved = p->in;
    int savedLineno = p->lineno;
    if( nArg!=2 ){
      raw_printf(stderr, "Usage: .read FILE\n");
      rc = 1;
      goto meta_command_exit;
    }
    if( notNormalFile(azArg[1])








     || (p->in = fopen(azArg[1], "rb"))==0
    ){
      utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
      rc = 1;
    }else{
      rc = process_input(p);
      fclose(p->in);
    }
    p->in = inSaved;







|
>
>
>
>
>
>
>
>
|
<







8958
8959
8960
8961
8962
8963
8964
8965
8966
8967
8968
8969
8970
8971
8972
8973
8974

8975
8976
8977
8978
8979
8980
8981
    FILE *inSaved = p->in;
    int savedLineno = p->lineno;
    if( nArg!=2 ){
      raw_printf(stderr, "Usage: .read FILE\n");
      rc = 1;
      goto meta_command_exit;
    }
    if( azArg[1][0]=='|' ){
      p->in = popen(azArg[1]+1, "r");
      if( p->in==0 ){
        utf8_printf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
        rc = 1;
      }else{
        rc = process_input(p);
        pclose(p->in);
      }
    }else if( notNormalFile(azArg[1]) || (p->in = fopen(azArg[1], "rb"))==0 ){

      utf8_printf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
      rc = 1;
    }else{
      rc = process_input(p);
      fclose(p->in);
    }
    p->in = inSaved;