Commit a27b7b28 authored by Carlos Garnacho's avatar Carlos Garnacho

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.
parent ab3c6d7e
......@@ -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
......
......@@ -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;
}
......@@ -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);
......
......@@ -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;
}
......@@ -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__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment