[epiphany/history-rewrite] ephy-history-service: Enable foreign keys in the database connection
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [epiphany/history-rewrite] ephy-history-service: Enable foreign keys in the database connection
- Date: Thu, 21 Jul 2011 09:38:41 +0000 (UTC)
commit a634fc63049d3a4e901f1a604265115ae30c458a
Author: Claudio Saavedra <csaavedra igalia com>
Date: Thu Jul 21 12:22:28 2011 +0300
ephy-history-service: Enable foreign keys in the database connection
We will use them to remove visits history automatically when removing
urls from the history.
lib/history/ephy-history-service.c | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/lib/history/ephy-history-service.c b/lib/history/ephy-history-service.c
index fccda0e..d60c347 100644
--- a/lib/history/ephy-history-service.c
+++ b/lib/history/ephy-history-service.c
@@ -216,6 +216,24 @@ ephy_history_service_commit (EphyHistoryService *self)
return FALSE;
}
+static void
+ephy_history_service_enable_foreign_keys (EphyHistoryService *self)
+{
+ EphyHistoryServicePrivate *priv = EPHY_HISTORY_SERVICE (self)->priv;
+ GError *error = NULL;
+
+ if (NULL == priv->history_database)
+ return;
+
+ ephy_sqlite_connection_execute (priv->history_database,
+ "PRAGMA foreign_keys = ON", &error);
+
+ if (error) {
+ g_error ("Could not enable foreign keys pragma: %s", error->message);
+ g_error_free (error);
+ }
+}
+
void
ephy_history_service_schedule_commit (EphyHistoryService *self)
{
@@ -240,6 +258,8 @@ ephy_history_service_open_database_connections (EphyHistoryService *self)
return FALSE;
}
+ ephy_history_service_enable_foreign_keys (self);
+
ephy_sqlite_connection_begin_transaction (priv->history_database, &error);
if (error) {
g_error ("Could not begin long running transaction in history database: %s", error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]