[tracker] libtracker-data: Recreate database if it is empty
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-data: Recreate database if it is empty
- Date: Tue, 8 Feb 2011 11:21:52 +0000 (UTC)
commit e8759ea791b00217ef10373af7b4101542b0e51e
Author: Jürg Billeter <j bitron ch>
Date: Tue Feb 8 11:59:01 2011 +0100
libtracker-data: Recreate database if it is empty
If tracker-store is terminated while initializing the database, it will
abort on subsequent starts due to empty database. With this commit the
database will be recreated instead.
Fixes NB#225910.
src/libtracker-data/tracker-db-manager.c | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 920148b..bbf9aee 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -1076,6 +1076,19 @@ tracker_db_manager_init (TrackerDBManagerFlags flags,
}
}
+ /* ensure that database has been initialized by an earlier tracker-store start
+ by checking whether Resource table exists */
+ stmt = tracker_db_interface_create_statement (dbs[i].iface, TRACKER_DB_STATEMENT_CACHE_TYPE_NONE,
+ &internal_error,
+ "SELECT 1 FROM Resource");
+ if (internal_error != NULL) {
+ must_recreate = TRUE;
+ g_error_free (internal_error);
+ internal_error = NULL;
+ } else {
+ g_object_unref (stmt);
+ }
+
tracker_db_interface_set_busy_handler (dbs[i].iface, NULL, NULL, NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]