SQLite

Check-in [7ed86dd3b8]
Login

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

Overview
Comment:Add code to the shell to optionally initialize the dbstat virtual table.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | stat-vtab-in-shell
Files: files | file ages | folders
SHA1: 7ed86dd3b85ee092a19fe5d1e2fba39ce0166a2a
User & Date: drh 2015-04-28 12:27:22.858
Context
2015-04-30
20:35
Enhance the CLI to initialize the dbstat virtual table if compiled using SQLITE_ENABLE_STAT_VTAB. (check-in: 822dfc0017 user: drh tags: trunk)
2015-04-28
12:27
Add code to the shell to optionally initialize the dbstat virtual table. (Closed-Leaf check-in: 7ed86dd3b8 user: drh tags: stat-vtab-in-shell)
01:28
Fix comment typos. No code changes. (check-in: 60174cf572 user: drh tags: trunk)
Changes
Side-by-Side Diff Ignore Whitespace Patch
Changes to src/shell.c.
1905
1906
1907
1908
1909
1910
1911






1912
1913
1914
1915
1916
1917
1918
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924







+
+
+
+
+
+







** Make sure the database is open.  If it is not, then open it.  If
** the database fails to open, print an error message and exit.
*/
static void open_db(ShellState *p, int keepAlive){
  if( p->db==0 ){
    sqlite3_initialize();
    sqlite3_open(p->zDbFilename, &p->db);
#ifdef SQLITE_ENABLE_STAT_VTAB_EXPERIMENTAL
    if( p->db ){
      int sqlite3_dbstat_register(sqlite3*);
      sqlite3_dbstat_register(p->db);
    }
#endif
    globalDb = p->db;
    if( p->db && sqlite3_errcode(p->db)==SQLITE_OK ){
      sqlite3_create_function(p->db, "shellstatic", 0, SQLITE_UTF8, 0,
          shellstaticFunc, 0, 0);
    }
    if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
      fprintf(stderr,"Error: unable to open database \"%s\": %s\n",