diff --git a/src/db-sql-sqlite2.c b/src/db-sql-sqlite2.c index 8b06e4b6..b43dea29 100644 --- a/src/db-sql-sqlite2.c +++ b/src/db-sql-sqlite2.c @@ -374,16 +374,15 @@ int db_sqlite2_event(int event_type) { break; case DB_SQL_EVENT_PLSCANSTART: - if(db_sqlite2_reload) { - db_sqlite2_exec(NULL,E_FATAL,"begin transaction"); - db_sqlite2_exec(NULL,E_FATAL,"pragma synchronous = off"); - } + db_sqlite2_exec(NULL,E_FATAL,"begin transaction"); + db_sqlite2_exec(NULL,E_FATAL,"pragma synchronous = off"); break; case DB_SQL_EVENT_PLSCANEND: + db_sqlite2_exec(NULL,E_FATAL,"pragma synchronous=normal"); + db_sqlite2_exec(NULL,E_FATAL,"end transaction"); + if(db_sqlite2_reload) { - db_sqlite2_exec(NULL,E_FATAL,"pragma synchronous=normal"); - db_sqlite2_exec(NULL,E_FATAL,"end transaction"); db_sqlite2_exec(NULL,E_FATAL,"create index idx_songid on playlistitems(songid)"); db_sqlite2_exec(NULL,E_FATAL,"create index idx_playlistid on playlistitems(playlistid,songid)"); diff --git a/src/db-sql-sqlite3.c b/src/db-sql-sqlite3.c index 404c80ba..54eb206d 100644 --- a/src/db-sql-sqlite3.c +++ b/src/db-sql-sqlite3.c @@ -406,16 +406,15 @@ int db_sqlite3_event(int event_type) { break; case DB_SQL_EVENT_PLSCANSTART: - if(db_sqlite3_reload) { - db_sqlite3_exec(NULL,E_FATAL,"begin transaction"); - db_sqlite3_exec(NULL,E_FATAL,"pragma synchronous = off"); - } + db_sqlite3_exec(NULL,E_FATAL,"begin transaction"); + db_sqlite3_exec(NULL,E_FATAL,"pragma synchronous = off"); break; case DB_SQL_EVENT_PLSCANEND: + db_sqlite3_exec(NULL,E_FATAL,"pragma synchronous=normal"); + db_sqlite3_exec(NULL,E_FATAL,"end transaction"); + if(db_sqlite3_reload) { - db_sqlite3_exec(NULL,E_FATAL,"pragma synchronous=normal"); - db_sqlite3_exec(NULL,E_FATAL,"end transaction"); db_sqlite3_exec(NULL,E_FATAL,"create index idx_songid on playlistitems(songid)"); db_sqlite3_exec(NULL,E_FATAL,"create index idx_playlistid on playlistitems(playlistid,songid)");