[tracker/wip/carlosg/unrestricted-predicates: 16/18] libtracker-data: Initialize "tracker_triples" virtual table on all interfaces
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker/wip/carlosg/unrestricted-predicates: 16/18] libtracker-data: Initialize "tracker_triples" virtual table on all interfaces
- Date: Tue, 5 Feb 2019 23:18:32 +0000 (UTC)
commit a27b7b289cc9fd1b452d6e855d03a6c2cc093b8a
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Jan 6 19:21:33 2019 +0100
libtracker-data: Initialize "tracker_triples" virtual table on all interfaces
This table may be used in either select or update queries, so make sure it
gets initialized in all paths.
src/libtracker-data/tracker-data-manager.c | 6 ++++++
src/libtracker-data/tracker-db-interface-sqlite.c | 9 +++++++++
src/libtracker-data/tracker-db-interface-sqlite.h | 3 ++-
src/libtracker-data/tracker-db-manager.c | 11 +++++++++++
src/libtracker-data/tracker-db-manager.h | 3 +++
5 files changed, 31 insertions(+), 1 deletion(-)
---
diff --git a/src/libtracker-data/tracker-data-manager.c b/src/libtracker-data/tracker-data-manager.c
index e7acab22e..a474e18dc 100644
--- a/src/libtracker-data/tracker-data-manager.c
+++ b/src/libtracker-data/tracker-data-manager.c
@@ -4209,6 +4209,9 @@ tracker_data_manager_initable_init (GInitable *initable,
return FALSE;
}
+ tracker_db_manager_set_vtab_user_data (manager->db_manager,
+ manager->ontologies);
+
manager->first_time_index = is_first_time_index;
tracker_data_manager_update_status (manager, "Initializing data manager");
@@ -4802,6 +4805,9 @@ tracker_data_manager_initable_init (GInitable *initable,
}
}
+ tracker_db_manager_set_vtab_user_data (manager->db_manager,
+ manager->ontologies);
+
skip_ontology_check:
#ifndef DISABLE_JOURNAL
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c
b/src/libtracker-data/tracker-db-interface-sqlite.c
index d0e8f7adf..a06b71d4a 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -56,6 +56,7 @@
#include "tracker-db-manager.h"
#include "tracker-data-enum-types.h"
#include "tracker-uuid.h"
+#include "tracker-vtab-triples.h"
typedef struct {
TrackerDBStatement *head;
@@ -3082,3 +3083,11 @@ tracker_db_interface_get_is_used (TrackerDBInterface *db_interface)
{
return g_atomic_int_get (&db_interface->n_active_cursors) > 0;
}
+
+gboolean
+tracker_db_interface_init_vtabs (TrackerDBInterface *db_interface,
+ TrackerOntologies *ontologies)
+{
+ tracker_vtab_triples_init (db_interface->db, ontologies);
+ return TRUE;
+}
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.h
b/src/libtracker-data/tracker-db-interface-sqlite.h
index 45eb5fd7c..4608bac94 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.h
+++ b/src/libtracker-data/tracker-db-interface-sqlite.h
@@ -58,7 +58,8 @@ void tracker_db_interface_sqlite_wal_hook (TrackerD
gboolean tracker_db_interface_sqlite_wal_checkpoint (TrackerDBInterface *interface,
gboolean blocking,
GError **error);
-
+gboolean tracker_db_interface_init_vtabs (TrackerDBInterface *interface,
+ TrackerOntologies
*ontologies);
#if HAVE_TRACKER_FTS
void tracker_db_interface_sqlite_fts_delete_table (TrackerDBInterface *interface);
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 417903803..09cb94b5b 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -140,6 +140,8 @@ struct _TrackerDBManager {
guint s_cache_size;
guint u_cache_size;
+ gpointer vtab_data;
+
GWeakRef iface_data;
GAsyncQueue *interfaces;
@@ -1010,6 +1012,8 @@ tracker_db_manager_create_db_interface (TrackerDBManager *db_manager,
g_weak_ref_get (&db_manager->iface_data),
g_object_unref);
+ tracker_db_interface_init_vtabs (connection, db_manager->vtab_data);
+
db_set_params (connection,
db_manager->db.cache_size,
db_manager->db.page_size,
@@ -1259,3 +1263,10 @@ tracker_db_manager_check_perform_vacuum (TrackerDBManager *db_manager)
iface = tracker_db_manager_get_writable_db_interface (db_manager);
tracker_db_interface_execute_query (iface, NULL, "VACUUM");
}
+
+void
+tracker_db_manager_set_vtab_user_data (TrackerDBManager *db_manager,
+ gpointer user_data)
+{
+ db_manager->vtab_data = user_data;
+}
diff --git a/src/libtracker-data/tracker-db-manager.h b/src/libtracker-data/tracker-db-manager.h
index 18fe4b711..63d7dc546 100644
--- a/src/libtracker-data/tracker-db-manager.h
+++ b/src/libtracker-data/tracker-db-manager.h
@@ -95,6 +95,9 @@ void tracker_db_manager_tokenizer_update (TrackerDBManager
void tracker_db_manager_check_perform_vacuum (TrackerDBManager *db_manager);
+void tracker_db_manager_set_vtab_user_data (TrackerDBManager *db_manager,
+ gpointer user_data);
+
G_END_DECLS
#endif /* __LIBTRACKER_DB_MANAGER_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]