SQLite

Check-in [c0d5626e27]
Login

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

Overview
Comment:In the command-line shell, improve the formatting to the ".databases" command and on the ".tables" command, only show the schema prefix for databases past the first ("main") database.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c0d5626e274cbf8c2d2167183c4d6835d72dae57
User & Date: drh 2016-12-24 18:04:28.394
Context
2016-12-24
18:18
Change the output format of the ".databases" command in the command-line shell so that it shows the schema name, a colon, and the corresponding filename. (check-in: 8558512e9c user: drh tags: trunk)
18:04
In the command-line shell, improve the formatting to the ".databases" command and on the ".tables" command, only show the schema prefix for databases past the first ("main") database. (check-in: c0d5626e27 user: drh tags: trunk)
2016-12-23
16:05
Fill in missing opcode documentation entries for OP_SorterNext and OP_SorterSort. (check-in: 2940661b8c user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/shell.c.
3703
3704
3705
3706
3707
3708
3709
3710
3711


3712
3713
3714
3715
3716
3717
3718
3703
3704
3705
3706
3707
3708
3709


3710
3711
3712
3713
3714
3715
3716
3717
3718







-
-
+
+







    ShellState data;
    char *zErrMsg = 0;
    open_db(p, 0);
    memcpy(&data, p, sizeof(data));
    data.showHeader = 1;
    data.cMode = data.mode = MODE_Column;
    data.colWidth[0] = 3;
    data.colWidth[1] = 15;
    data.colWidth[2] = 58;
    data.colWidth[1] = 0;
    data.colWidth[2] = 0;
    data.cnt = 0;
    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
    if( zErrMsg ){
      utf8_printf(stderr,"Error: %s\n", zErrMsg);
      sqlite3_free(zErrMsg);
      rc = 1;
    }
4974
4975
4976
4977
4978
4979
4980
4981

4982
4983

4984
4985
4986
4987
4988
4989
4990
4974
4975
4976
4977
4978
4979
4980

4981
4982

4983
4984
4985
4986
4987
4988
4989
4990







-
+

-
+







    ** main and all attached databases where the table name matches the
    ** LIKE pattern bound to variable "?1". */
    zSql = sqlite3_mprintf(
        "SELECT name FROM sqlite_master"
        " WHERE type IN ('table','view')"
        "   AND name NOT LIKE 'sqlite_%%'"
        "   AND name LIKE ?1");
    while( zSql && sqlite3_step(pStmt)==SQLITE_ROW ){
    for(ii=0; zSql && sqlite3_step(pStmt)==SQLITE_ROW; ii++){
      const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1);
      if( zDbName==0 || strcmp(zDbName,"main")==0 ) continue;
      if( zDbName==0 || ii==0 ) continue;
      if( strcmp(zDbName,"temp")==0 ){
        zSql = sqlite3_mprintf(
                 "%z UNION ALL "
                 "SELECT 'temp.' || name FROM sqlite_temp_master"
                 " WHERE type IN ('table','view')"
                 "   AND name NOT LIKE 'sqlite_%%'"
                 "   AND name LIKE ?1", zSql);