From b20dece00b63d83b15c2bbd8b4806effdd385d90 Mon Sep 17 00:00:00 2001 From: Ron Pedde Date: Fri, 20 Jan 2006 15:55:51 +0000 Subject: [PATCH] Only use transactions on reload to avoid busy errors --- src/db-sql-sqlite2.c | 6 +++--- src/db-sql-sqlite3.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/db-sql-sqlite2.c b/src/db-sql-sqlite2.c index 8039b4ce..18262ddc 100644 --- a/src/db-sql-sqlite2.c +++ b/src/db-sql-sqlite2.c @@ -364,13 +364,13 @@ int db_sqlite2_event(int event_type) { break; case DB_SQL_EVENT_PLSCANSTART: - db_sqlite2_exec(NULL,E_FATAL,"begin transaction"); + if(db_sqlite2_reload) + db_sqlite2_exec(NULL,E_FATAL,"begin transaction"); break; case DB_SQL_EVENT_PLSCANEND: - db_sqlite2_exec(NULL,E_FATAL,"end transaction"); - if(db_sqlite2_reload) { + db_sqlite2_exec(NULL,E_FATAL,"end transaction"); db_sqlite2_exec(NULL,E_FATAL,"pragma synchronous=normal"); 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)"); diff --git a/src/db-sql-sqlite3.c b/src/db-sql-sqlite3.c index 6a244009..08b26773 100644 --- a/src/db-sql-sqlite3.c +++ b/src/db-sql-sqlite3.c @@ -383,13 +383,13 @@ int db_sqlite3_event(int event_type) { break; case DB_SQL_EVENT_PLSCANSTART: - db_sqlite3_exec(NULL,E_FATAL,"begin transaction"); + if(db_sqlite3_reload) + db_sqlite3_exec(NULL,E_FATAL,"begin transaction"); break; case DB_SQL_EVENT_PLSCANEND: - db_sqlite3_exec(NULL,E_FATAL,"end transaction"); - if(db_sqlite3_reload) { + db_sqlite3_exec(NULL,E_FATAL,"end transaction"); db_sqlite3_exec(NULL,E_FATAL,"pragma synchronous=normal"); 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)");