/ Check-in [822dfc00]
Login

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

Overview
Comment:Enhance the CLI to initialize the dbstat virtual table if compiled using SQLITE_ENABLE_STAT_VTAB.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 822dfc00173dad7703aa6413bb94f72f0da8e2c6
User & Date: drh 2015-04-30 20:35:33
Context
2015-05-01
14:07
Use the sqlite3Fts3ErrMsg() function to set error message text in FTS3, and to ensure that error messages are not overwritten and thus leaked. check-in: 605347e0 user: drh tags: trunk
2015-04-30
20:35
Enhance the CLI to initialize the dbstat virtual table if compiled using SQLITE_ENABLE_STAT_VTAB. check-in: 822dfc00 user: drh tags: trunk
20:33
Fix a harmless comment typo. check-in: 012a0c4e 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: 7ed86dd3 user: drh tags: stat-vtab-in-shell
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/shell.c.

1905
1906
1907
1908
1909
1910
1911






1912
1913
1914
1915
1916
1917
1918
** 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);






    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", 







>
>
>
>
>
>







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
    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",