aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main.c7
-rw-r--r--src/shell.c6
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,