/ Check-in [8558512e]
Login

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

Overview
Comment: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.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:8558512e9ca343300a767ef23810f2d7b50fd925
User & Date: drh 2016-12-24 18:18:58
Context
2016-12-24
19:37
The schema name "main" is always an acceptable alias for the primary database even if the primary database is renamed using SQLITE_DBCONFIG_MAINDBNAME. check-in: 2f481b85 user: drh tags: trunk
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: 8558512e 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: c0d5626e user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

  3700   3700     }else
  3701   3701   
  3702   3702     if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 ){
  3703   3703       ShellState data;
  3704   3704       char *zErrMsg = 0;
  3705   3705       open_db(p, 0);
  3706   3706       memcpy(&data, p, sizeof(data));
  3707         -    data.showHeader = 1;
  3708         -    data.cMode = data.mode = MODE_Column;
  3709         -    data.colWidth[0] = 3;
  3710         -    data.colWidth[1] = 0;
  3711         -    data.colWidth[2] = 0;
         3707  +    data.showHeader = 0;
         3708  +    data.cMode = data.mode = MODE_List;
         3709  +    sqlite3_snprintf(sizeof(data.colSeparator),data.colSeparator,": ");
  3712   3710       data.cnt = 0;
  3713         -    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
         3711  +    sqlite3_exec(p->db, "SELECT name, file FROM pragma_database_list",
         3712  +                 callback, &data, &zErrMsg);
  3714   3713       if( zErrMsg ){
  3715   3714         utf8_printf(stderr,"Error: %s\n", zErrMsg);
  3716   3715         sqlite3_free(zErrMsg);
  3717   3716         rc = 1;
  3718   3717       }
  3719   3718     }else
  3720   3719