diff options
author | drh <drh@noemail.net> | 2015-05-04 20:25:05 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2015-05-04 20:25:05 +0000 |
commit | a3ab9d0c6187230290cf8063e98d13c866224f13 (patch) | |
tree | d6d3939c1c8fdf490996d4f14e90100dcf1d7806 /src | |
parent | d1055b1bd52c7d6c810a8179106444d8fa555765 (diff) | |
download | sqlite-a3ab9d0c6187230290cf8063e98d13c866224f13.tar.gz sqlite-a3ab9d0c6187230290cf8063e98d13c866224f13.zip |
Automatically enable the dbstat virtual table on all new database
connections with the SQLITE_ENABLE_DBSTAT_VTAB compile-time option is used.
FossilOrigin-Name: 1c9c6eaa9f75fd7b90fbf8b057656fd9e50b5060
Diffstat (limited to 'src')
-rw-r--r-- | src/main.c | 7 | ||||
-rw-r--r-- | src/shell.c | 6 |
2 files changed, 7 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c index 69365b784..cc819c3fa 100644 --- a/src/main.c +++ b/src/main.c @@ -2876,6 +2876,13 @@ static int openDatabase( } #endif +#ifdef SQLITE_ENABLE_DBSTAT_VTAB + if( !db->mallocFailed && rc==SQLITE_OK){ + int sqlite3_dbstat_register(sqlite3*); + rc = sqlite3_dbstat_register(db); + } +#endif + /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking ** mode. Doing nothing at all also makes NORMAL the default. diff --git a/src/shell.c b/src/shell.c index b04820613..542381a8c 100644 --- a/src/shell.c +++ b/src/shell.c @@ -1920,12 +1920,6 @@ static void open_db(ShellState *p, int keepAlive){ if( p->db==0 ){ sqlite3_initialize(); sqlite3_open(p->zDbFilename, &p->db); -#ifdef SQLITE_ENABLE_DBSTAT_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, |