[tracker/rss-enclosures] libtracker-data: Move SQLite threading mode setting to open call



commit 8c5689b3cd97034543d417e429a026bf421b8f99
Author: Jürg Billeter <j bitron ch>
Date:   Mon Aug 16 12:07:06 2010 +0200

    libtracker-data: Move SQLite threading mode setting to open call

 src/libtracker-data/tracker-db-interface-sqlite.c |   21 ++++++++++-----------
 1 files changed, 10 insertions(+), 11 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index 391ed0f..e942c2d 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -98,7 +98,6 @@ G_DEFINE_TYPE (TrackerDBCursor, tracker_db_cursor, G_TYPE_OBJECT)
 void
 tracker_db_interface_sqlite_enable_shared_cache (void)
 {
-	sqlite3_config (SQLITE_CONFIG_MULTITHREAD);
 	sqlite3_enable_shared_cache (1);
 }
 
@@ -482,20 +481,20 @@ check_interrupt (void *user_data)
 static void
 open_database (TrackerDBInterface *db_interface)
 {
+	int mode;
+
 	g_assert (db_interface->filename != NULL);
 
 	if (!db_interface->ro) {
-		if (sqlite3_open (db_interface->filename, &db_interface->db) != SQLITE_OK) {
-			g_critical ("Could not open sqlite3 database:'%s'", db_interface->filename);
-		} else {
-			g_message ("Opened sqlite3 database:'%s'", db_interface->filename);
-		}
+		mode = SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE;
 	} else {
-		if (sqlite3_open_v2 (db_interface->filename, &db_interface->db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
-			g_critical ("Could not open sqlite3 database:'%s'", db_interface->filename);
-		} else {
-			g_message ("Opened sqlite3 database:'%s'", db_interface->filename);
-		}
+		mode = SQLITE_OPEN_READONLY;
+	}
+
+	if (sqlite3_open_v2 (db_interface->filename, &db_interface->db, mode | SQLITE_OPEN_NOMUTEX, NULL) != SQLITE_OK) {
+		g_critical ("Could not open sqlite3 database:'%s'", db_interface->filename);
+	} else {
+		g_message ("Opened sqlite3 database:'%s'", db_interface->filename);
 	}
 
 	sqlite3_progress_handler (db_interface->db, 100,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]