tracker r2458 - in branches/libtracker-data: . src/libtracker-data
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: tracker r2458 - in branches/libtracker-data: . src/libtracker-data
- Date: Wed, 5 Nov 2008 14:58:14 +0000 (UTC)
Author: juergbi
Date: Wed Nov 5 14:58:13 2008
New Revision: 2458
URL: http://svn.gnome.org/viewvc/tracker?rev=2458&view=rev
Log:
2008-11-05 JÃrg Billeter <j bitron ch>
* src/libtracker-data/Makefile.am:
* src/libtracker-data/tracker-data-manager.c:
* src/libtracker-data/tracker-data-manager.h:
* src/libtracker-data/tracker-data-query.c:
* src/libtracker-data/tracker-data-query.h:
* src/libtracker-data/tracker-data-update.c:
* src/libtracker-data/tracker-data-update.h:
Move Query API to tracker-data-query.[ch]
Added:
branches/libtracker-data/src/libtracker-data/tracker-data-query.c
branches/libtracker-data/src/libtracker-data/tracker-data-query.h
Modified:
branches/libtracker-data/ChangeLog
branches/libtracker-data/src/libtracker-data/Makefile.am
branches/libtracker-data/src/libtracker-data/tracker-data-manager.c
branches/libtracker-data/src/libtracker-data/tracker-data-manager.h
branches/libtracker-data/src/libtracker-data/tracker-data-update.c
branches/libtracker-data/src/libtracker-data/tracker-data-update.h
Modified: branches/libtracker-data/src/libtracker-data/Makefile.am
==============================================================================
--- branches/libtracker-data/src/libtracker-data/Makefile.am (original)
+++ branches/libtracker-data/src/libtracker-data/Makefile.am Wed Nov 5 14:58:13 2008
@@ -13,6 +13,7 @@
libtracker_data_la_SOURCES = \
tracker-data-manager.c \
tracker-data-metadata.c \
+ tracker-data-query.c \
tracker-data-search.c \
tracker-data-update.c \
tracker-query-tree.c \
@@ -22,6 +23,7 @@
noinst_HEADERS = \
tracker-data-manager.h \
tracker-data-metadata.h \
+ tracker-data-query.h \
tracker-data-search.h \
tracker-data-update.h \
tracker-query-tree.h \
Modified: branches/libtracker-data/src/libtracker-data/tracker-data-manager.c
==============================================================================
--- branches/libtracker-data/src/libtracker-data/tracker-data-manager.c (original)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-manager.c Wed Nov 5 14:58:13 2008
@@ -276,227 +276,6 @@
return NULL;
}
-TrackerDBResultSet *
-tracker_db_metadata_get (TrackerDBInterface *iface,
- const gchar *id,
- const gchar *key)
-{
- TrackerField *def;
- const gchar *proc = NULL;
-
- g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
- g_return_val_if_fail (id, NULL);
- g_return_val_if_fail (key, NULL);
-
- def = tracker_ontology_get_field_by_name (key);
-
- if (!def) {
- g_warning ("Metadata not found for id:'%s' and type:'%s'", id, key);
- return NULL;
- }
-
- switch (tracker_field_get_data_type (def)) {
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
- proc = "GetMetadata";
- break;
-
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
- proc = "GetMetadataNumeric";
- break;
-
- case TRACKER_FIELD_TYPE_FULLTEXT:
- proc = "GetContents";
- break;
-
- case TRACKER_FIELD_TYPE_KEYWORD:
- proc = "GetMetadataKeyword";
- break;
-
- default:
- g_warning ("Metadata could not be retrieved as type:%d is not supported",
- tracker_field_get_data_type (def));
- return NULL;
- }
-
- return tracker_data_manager_exec_proc (iface,
- proc,
- id,
- tracker_field_get_id (def),
- NULL);
-}
-
-static void
-db_result_set_to_ptr_array (TrackerDBResultSet *result_set,
- GPtrArray **previous)
-{
- gchar *prop_id_str;
- gchar *value;
- TrackerField *field;
- gboolean valid = result_set != NULL;
-
- while (valid) {
- /* Item is a pair (property_name, value) */
- gchar **item = g_new0 (gchar *, 2);
-
- tracker_db_result_set_get (result_set, 0, &prop_id_str, 1, &value, -1);
- item[1] = g_strdup (value);
-
- field = tracker_ontology_get_field_by_id (GPOINTER_TO_UINT (prop_id_str));
-
- item[0] = g_strdup (tracker_field_get_name (field));
-
- g_ptr_array_add (*previous, item);
-
- valid = tracker_db_result_set_iter_next (result_set);
- }
-}
-
-GPtrArray *
-tracker_db_metadata_get_all (const gchar *service_type,
- const gchar *service_id)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- GPtrArray *result;
-
- result = g_ptr_array_new ();
-
- iface = tracker_db_manager_get_db_interface_by_service (service_type);
- if (!iface) {
- g_warning ("Unable to obtain a DB connection for service type '%s'",
- service_type);
- return result;
- }
-
- result_set = tracker_data_manager_exec_proc (iface, "GetAllMetadata", service_id, service_id, service_id, NULL);
-
- if (result_set) {
- db_result_set_to_ptr_array (result_set, &result);
- g_object_unref (result_set);
- }
-
- return result;
-
-}
-
-
-TrackerDBResultSet *
-tracker_db_metadata_get_array (TrackerDBInterface *iface,
- const gchar *service_type,
- const gchar *service_id,
- gchar ** keys)
-{
- TrackerDBResultSet *result_set;
- GString *sql, *sql_join;
- gchar *query;
- guint i;
-
- /* Build SQL select clause */
- sql = g_string_new (" SELECT DISTINCT ");
- sql_join = g_string_new (" FROM Services S ");
-
- for (i = 0; i < g_strv_length (keys); i++) {
- TrackerFieldData *field_data;
-
- field_data = tracker_db_get_metadata_field (iface,
- service_type,
- keys[i],
- i,
- TRUE,
- FALSE);
-
- if (!field_data) {
- g_string_free (sql_join, TRUE);
- g_string_free (sql, TRUE);
- return NULL;
- }
-
- if (i == 0) {
- g_string_append_printf (sql, " %s",
- tracker_field_data_get_select_field (field_data));
- } else {
- g_string_append_printf (sql, ", %s",
- tracker_field_data_get_select_field (field_data));
- }
-
- if (tracker_field_data_get_needs_join (field_data)) {
- g_string_append_printf (sql_join,
- "\n LEFT OUTER JOIN %s %s ON (S.ID = %s.ServiceID and %s.MetaDataID = %s) ",
- tracker_field_data_get_table_name (field_data),
- tracker_field_data_get_alias (field_data),
- tracker_field_data_get_alias (field_data),
- tracker_field_data_get_alias (field_data),
- tracker_field_data_get_id_field (field_data));
- }
-
- g_object_unref (field_data);
- }
-
- g_string_append (sql, sql_join->str);
- g_string_free (sql_join, TRUE);
-
- /* Build SQL where clause */
- g_string_append_printf (sql, " WHERE S.ID = %s", service_id);
-
- query = g_string_free (sql, FALSE);
-
- g_debug (query);
-
- result_set = tracker_db_interface_execute_query (iface, NULL, query);
-
- g_free (query);
-
- return result_set;
-}
-
-
-/* Gets specified metadata value as a single row (multple values for a
- * metadata type are returned delimited by "|" )
- */
-gchar *
-tracker_db_metadata_get_delimited (TrackerDBInterface *iface,
- const gchar *id,
- const gchar *key)
-{
- TrackerDBResultSet *result_set;
- GString *s = NULL;
-
- g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
- g_return_val_if_fail (id != NULL, NULL);
- g_return_val_if_fail (key != NULL, NULL);
-
- result_set = tracker_db_metadata_get (iface, id, key);
-
- if (result_set) {
- gchar *str;
- gboolean valid = TRUE;
-
- while (valid) {
- tracker_db_result_set_get (result_set, 0, &str, -1);
-
- if (s) {
- g_string_append_printf (s, "|%s", str);
- } else {
- s = g_string_new (str);
- }
-
- g_free (str);
- valid = tracker_db_result_set_iter_next (result_set);
- }
-
- g_object_unref (result_set);
- }
-
- if (s) {
- return g_string_free (s, FALSE);
- } else {
- return NULL;
- }
-}
-
gchar *
tracker_db_metadata_get_related_names (TrackerDBInterface *iface,
const gchar *name)
@@ -984,91 +763,6 @@
tracker_data_manager_exec (iface, "DELETE FROM Events WHERE BeingHandled = 1");
}
-/*
- * Obtain the concrete service type name for the file id.
- */
-gchar *
-tracker_db_service_get_by_entity (TrackerDBInterface *iface,
- const gchar *id)
-{
- TrackerDBResultSet *result_set;
- gint service_type_id;
- gchar *result = NULL;
-
- g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
- result_set = tracker_data_manager_exec_proc (iface,
- "GetFileByID",
- id,
- NULL);
-
- if (result_set) {
- tracker_db_result_set_get (result_set, 3, &service_type_id, -1);
- g_object_unref (result_set);
-
- result = tracker_ontology_get_service_by_id (service_type_id);
- }
-
- return result;
-}
-
-
-guint32
-tracker_db_file_get_id (const gchar *service_type,
- const gchar *uri)
-{
- TrackerDBResultSet *result_set;
- TrackerDBInterface *iface;
- gchar *path, *name;
- guint32 id = 0;
-
- g_return_val_if_fail (uri != NULL, 0);
-
- iface = tracker_db_manager_get_db_interface_by_service (service_type);
-
- if (!iface) {
- g_warning ("Unable to obtain interface for service type '%s'",
- service_type);
- return 0;
- }
-
- tracker_file_get_path_and_name (uri, &path, &name);
-
- result_set = tracker_data_manager_exec_proc (iface,
- "GetServiceID",
- path,
- name,
- NULL);
-
- g_free (path);
- g_free (name);
-
- if (result_set) {
- tracker_db_result_set_get (result_set, 0, &id, -1);
- g_object_unref (result_set);
- }
-
- return id;
-}
-
-gchar *
-tracker_db_file_get_id_as_string (const gchar *service_type,
- const gchar *uri)
-{
- guint32 id;
-
- g_return_val_if_fail (uri != NULL, NULL);
-
- id = tracker_db_file_get_id (service_type, uri);
-
- if (id > 0) {
- return tracker_guint_to_string (id);
- }
-
- return NULL;
-}
-
TrackerFieldData *
tracker_db_get_metadata_field (TrackerDBInterface *iface,
const gchar *service,
Modified: branches/libtracker-data/src/libtracker-data/tracker-data-manager.h
==============================================================================
--- branches/libtracker-data/src/libtracker-data/tracker-data-manager.h (original)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-manager.h Wed Nov 5 14:58:13 2008
@@ -67,28 +67,6 @@
gchar * tracker_db_metadata_get_related_names (TrackerDBInterface *iface,
const gchar *name);
const gchar * tracker_db_metadata_get_table (TrackerFieldType type);
-TrackerDBResultSet *tracker_db_metadata_get (TrackerDBInterface *iface,
- const gchar *id,
- const gchar *key);
-GPtrArray * tracker_db_metadata_get_all (const gchar *service_type,
- const gchar *service_id);
-TrackerDBResultSet *tracker_db_metadata_get_array (TrackerDBInterface *iface,
- const gchar *service_type,
- const gchar *service_id,
- gchar **keys);
-gchar * tracker_db_metadata_get_delimited (TrackerDBInterface *iface,
- const gchar *id,
- const gchar *key);
-
-/* Service API */
-gchar * tracker_db_service_get_by_entity (TrackerDBInterface *iface,
- const gchar *id);
-
-/* Files API */
-guint32 tracker_db_file_get_id (const gchar *service_type,
- const gchar *uri);
-gchar * tracker_db_file_get_id_as_string (const gchar *service_type,
- const gchar *uri);
/* Miscellaneous API */
gchar * tracker_db_get_field_name (const gchar *service,
Added: branches/libtracker-data/src/libtracker-data/tracker-data-query.c
==============================================================================
--- (empty file)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-query.c Wed Nov 5 14:58:13 2008
@@ -0,0 +1,710 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2007, Jason Kivlighn (jkivlighn gmail com)
+ * Copyright (C) 2007, Creative Commons (http://creativecommons.org)
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#include "config.h"
+
+#include <string.h>
+#include <stdlib.h>
+
+#include <libtracker-common/tracker-file-utils.h>
+#include <libtracker-common/tracker-nfs-lock.h>
+#include <libtracker-common/tracker-parser.h>
+#include <libtracker-common/tracker-type-utils.h>
+#include <libtracker-common/tracker-utils.h>
+
+#include <libtracker-db/tracker-db-dbus.h>
+#include <libtracker-db/tracker-db-index.h>
+#include <libtracker-db/tracker-db-interface-sqlite.h>
+#include <libtracker-db/tracker-db-index-manager.h>
+#include <libtracker-db/tracker-db-manager.h>
+
+#include "tracker-data-manager.h"
+#include "tracker-data-query.h"
+
+TrackerDBResultSet *
+tracker_db_metadata_get (TrackerDBInterface *iface,
+ const gchar *id,
+ const gchar *key)
+{
+ TrackerField *def;
+ const gchar *proc = NULL;
+
+ g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
+ g_return_val_if_fail (id, NULL);
+ g_return_val_if_fail (key, NULL);
+
+ def = tracker_ontology_get_field_by_name (key);
+
+ if (!def) {
+ g_warning ("Metadata not found for id:'%s' and type:'%s'", id, key);
+ return NULL;
+ }
+
+ switch (tracker_field_get_data_type (def)) {
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ proc = "GetMetadata";
+ break;
+
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
+ proc = "GetMetadataNumeric";
+ break;
+
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ proc = "GetContents";
+ break;
+
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ proc = "GetMetadataKeyword";
+ break;
+
+ default:
+ g_warning ("Metadata could not be retrieved as type:%d is not supported",
+ tracker_field_get_data_type (def));
+ return NULL;
+ }
+
+ return tracker_data_manager_exec_proc (iface,
+ proc,
+ id,
+ tracker_field_get_id (def),
+ NULL);
+}
+
+static void
+db_result_set_to_ptr_array (TrackerDBResultSet *result_set,
+ GPtrArray **previous)
+{
+ gchar *prop_id_str;
+ gchar *value;
+ TrackerField *field;
+ gboolean valid = result_set != NULL;
+
+ while (valid) {
+ /* Item is a pair (property_name, value) */
+ gchar **item = g_new0 (gchar *, 2);
+
+ tracker_db_result_set_get (result_set, 0, &prop_id_str, 1, &value, -1);
+ item[1] = g_strdup (value);
+
+ field = tracker_ontology_get_field_by_id (GPOINTER_TO_UINT (prop_id_str));
+
+ item[0] = g_strdup (tracker_field_get_name (field));
+
+ g_ptr_array_add (*previous, item);
+
+ valid = tracker_db_result_set_iter_next (result_set);
+ }
+}
+
+GPtrArray *
+tracker_db_metadata_get_all (const gchar *service_type,
+ const gchar *service_id)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set;
+ GPtrArray *result;
+
+ result = g_ptr_array_new ();
+
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+ if (!iface) {
+ g_warning ("Unable to obtain a DB connection for service type '%s'",
+ service_type);
+ return result;
+ }
+
+ result_set = tracker_data_manager_exec_proc (iface, "GetAllMetadata", service_id, service_id, service_id, NULL);
+
+ if (result_set) {
+ db_result_set_to_ptr_array (result_set, &result);
+ g_object_unref (result_set);
+ }
+
+ return result;
+
+}
+
+
+TrackerDBResultSet *
+tracker_db_metadata_get_array (TrackerDBInterface *iface,
+ const gchar *service_type,
+ const gchar *service_id,
+ gchar ** keys)
+{
+ TrackerDBResultSet *result_set;
+ GString *sql, *sql_join;
+ gchar *query;
+ guint i;
+
+ /* Build SQL select clause */
+ sql = g_string_new (" SELECT DISTINCT ");
+ sql_join = g_string_new (" FROM Services S ");
+
+ for (i = 0; i < g_strv_length (keys); i++) {
+ TrackerFieldData *field_data;
+
+ field_data = tracker_db_get_metadata_field (iface,
+ service_type,
+ keys[i],
+ i,
+ TRUE,
+ FALSE);
+
+ if (!field_data) {
+ g_string_free (sql_join, TRUE);
+ g_string_free (sql, TRUE);
+ return NULL;
+ }
+
+ if (i == 0) {
+ g_string_append_printf (sql, " %s",
+ tracker_field_data_get_select_field (field_data));
+ } else {
+ g_string_append_printf (sql, ", %s",
+ tracker_field_data_get_select_field (field_data));
+ }
+
+ if (tracker_field_data_get_needs_join (field_data)) {
+ g_string_append_printf (sql_join,
+ "\n LEFT OUTER JOIN %s %s ON (S.ID = %s.ServiceID and %s.MetaDataID = %s) ",
+ tracker_field_data_get_table_name (field_data),
+ tracker_field_data_get_alias (field_data),
+ tracker_field_data_get_alias (field_data),
+ tracker_field_data_get_alias (field_data),
+ tracker_field_data_get_id_field (field_data));
+ }
+
+ g_object_unref (field_data);
+ }
+
+ g_string_append (sql, sql_join->str);
+ g_string_free (sql_join, TRUE);
+
+ /* Build SQL where clause */
+ g_string_append_printf (sql, " WHERE S.ID = %s", service_id);
+
+ query = g_string_free (sql, FALSE);
+
+ g_debug (query);
+
+ result_set = tracker_db_interface_execute_query (iface, NULL, query);
+
+ g_free (query);
+
+ return result_set;
+}
+
+
+/* Gets specified metadata value as a single row (multple values for a
+ * metadata type are returned delimited by "|" )
+ */
+gchar *
+tracker_db_metadata_get_delimited (TrackerDBInterface *iface,
+ const gchar *id,
+ const gchar *key)
+{
+ TrackerDBResultSet *result_set;
+ GString *s = NULL;
+
+ g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
+ g_return_val_if_fail (id != NULL, NULL);
+ g_return_val_if_fail (key != NULL, NULL);
+
+ result_set = tracker_db_metadata_get (iface, id, key);
+
+ if (result_set) {
+ gchar *str;
+ gboolean valid = TRUE;
+
+ while (valid) {
+ tracker_db_result_set_get (result_set, 0, &str, -1);
+
+ if (s) {
+ g_string_append_printf (s, "|%s", str);
+ } else {
+ s = g_string_new (str);
+ }
+
+ g_free (str);
+ valid = tracker_db_result_set_iter_next (result_set);
+ }
+
+ g_object_unref (result_set);
+ }
+
+ if (s) {
+ return g_string_free (s, FALSE);
+ } else {
+ return NULL;
+ }
+}
+
+/*
+ * Obtain the concrete service type name for the file id.
+ */
+gchar *
+tracker_db_service_get_by_entity (TrackerDBInterface *iface,
+ const gchar *id)
+{
+ TrackerDBResultSet *result_set;
+ gint service_type_id;
+ gchar *result = NULL;
+
+ g_return_val_if_fail (TRACKER_IS_DB_INTERFACE (iface), NULL);
+ g_return_val_if_fail (id != NULL, NULL);
+
+ result_set = tracker_data_manager_exec_proc (iface,
+ "GetFileByID",
+ id,
+ NULL);
+
+ if (result_set) {
+ tracker_db_result_set_get (result_set, 3, &service_type_id, -1);
+ g_object_unref (result_set);
+
+ result = tracker_ontology_get_service_by_id (service_type_id);
+ }
+
+ return result;
+}
+
+
+guint32
+tracker_db_file_get_id (const gchar *service_type,
+ const gchar *uri)
+{
+ TrackerDBResultSet *result_set;
+ TrackerDBInterface *iface;
+ gchar *path, *name;
+ guint32 id = 0;
+
+ g_return_val_if_fail (uri != NULL, 0);
+
+ iface = tracker_db_manager_get_db_interface_by_service (service_type);
+
+ if (!iface) {
+ g_warning ("Unable to obtain interface for service type '%s'",
+ service_type);
+ return 0;
+ }
+
+ tracker_file_get_path_and_name (uri, &path, &name);
+
+ result_set = tracker_data_manager_exec_proc (iface,
+ "GetServiceID",
+ path,
+ name,
+ NULL);
+
+ g_free (path);
+ g_free (name);
+
+ if (result_set) {
+ tracker_db_result_set_get (result_set, 0, &id, -1);
+ g_object_unref (result_set);
+ }
+
+ return id;
+}
+
+gchar *
+tracker_db_file_get_id_as_string (const gchar *service_type,
+ const gchar *uri)
+{
+ guint32 id;
+
+ g_return_val_if_fail (uri != NULL, NULL);
+
+ id = tracker_db_file_get_id (service_type, uri);
+
+ if (id > 0) {
+ return tracker_guint_to_string (id);
+ }
+
+ return NULL;
+}
+
+gboolean
+tracker_db_check_service (TrackerService *service,
+ const gchar *dirname,
+ const gchar *basename,
+ guint32 *id,
+ time_t *mtime)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set;
+ gchar *db_mtime_str;
+ guint db_id;
+ guint db_mtime;
+ gboolean found = FALSE;
+
+ db_id = db_mtime = 0;
+
+ iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+ TRACKER_DB_CONTENT_TYPE_METADATA);
+
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetServiceID",
+ dirname,
+ basename,
+ NULL);
+ if (result_set) {
+ tracker_db_result_set_get (result_set,
+ 0, &db_id,
+ 1, &db_mtime_str,
+ -1);
+ g_object_unref (result_set);
+ found = TRUE;
+
+ if (db_mtime_str) {
+ db_mtime = tracker_string_to_date (db_mtime_str);
+ g_free (db_mtime_str);
+ }
+ }
+
+ if (id) {
+ *id = (guint32) db_id;
+ }
+
+ if (mtime) {
+ *mtime = (time_t) db_mtime;
+ }
+
+ return found;
+}
+
+guint
+tracker_db_get_service_type (const gchar *dirname,
+ const gchar *basename)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set;
+ guint service_type_id;
+
+ /* We are asking this because the module cannot assign service_type -> probably it is files */
+ iface = tracker_db_manager_get_db_interface_by_type ("Files",
+ TRACKER_DB_CONTENT_TYPE_METADATA);
+
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetServiceID",
+ dirname,
+ basename,
+ NULL);
+ if (!result_set) {
+ return 0;
+ }
+
+ tracker_db_result_set_get (result_set, 3, &service_type_id, -1);
+ g_object_unref (result_set);
+
+ return service_type_id;
+}
+
+static void
+result_set_to_metadata (TrackerDBResultSet *result_set,
+ TrackerDataMetadata *metadata,
+ gboolean numeric,
+ gboolean only_embedded)
+{
+ TrackerField *field;
+ gchar *value;
+ gint numeric_value;
+ gint metadata_id;
+ gboolean valid = TRUE;
+
+ while (valid) {
+ if (numeric) {
+ tracker_db_result_set_get (result_set,
+ 0, &metadata_id,
+ 1, &numeric_value,
+ -1);
+ value = g_strdup_printf ("%d", numeric_value);
+ } else {
+ tracker_db_result_set_get (result_set,
+ 0, &metadata_id,
+ 1, &value,
+ -1);
+ }
+
+ field = tracker_ontology_get_field_by_id (metadata_id);
+ if (!field) {
+ g_critical ("Field id %d in database but not in tracker-ontology",
+ metadata_id);
+ g_free (value);
+ return;
+ }
+
+ if (tracker_field_get_embedded (field) || !only_embedded) {
+ if (tracker_field_get_multiple_values (field)) {
+ GList *new_values;
+ const GList *old_values;
+
+ new_values = NULL;
+ old_values = tracker_data_metadata_lookup_multiple_values (metadata,
+ tracker_field_get_name (field));
+ if (old_values) {
+ new_values = g_list_copy ((GList *) old_values);
+ }
+
+ new_values = g_list_prepend (new_values, value);
+ tracker_data_metadata_insert_multiple_values (metadata,
+ tracker_field_get_name (field),
+ new_values);
+ } else {
+ tracker_data_metadata_insert (metadata,
+ tracker_field_get_name (field),
+ value);
+ }
+ } else {
+ g_free (value);
+ }
+
+ valid = tracker_db_result_set_iter_next (result_set);
+ }
+}
+
+TrackerDataMetadata *
+tracker_db_get_all_metadata (TrackerService *service,
+ guint32 service_id,
+ gboolean only_embedded)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set = NULL;
+ gchar *service_id_str;
+ TrackerDataMetadata *metadata;
+
+ metadata = tracker_data_metadata_new ();
+
+ g_return_val_if_fail (TRACKER_IS_SERVICE (service), metadata);
+
+ service_id_str = g_strdup_printf ("%d", service_id);
+ iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+ TRACKER_DB_CONTENT_TYPE_METADATA);
+
+ result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValue", service_id_str, NULL);
+ if (result_set) {
+ result_set_to_metadata (result_set, metadata, FALSE, only_embedded);
+ g_object_unref (result_set);
+ }
+
+ result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValueKeyword", service_id_str, NULL);
+ if (result_set) {
+ result_set_to_metadata (result_set, metadata, FALSE, only_embedded);
+ g_object_unref (result_set);
+ }
+
+ result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValueNumeric", service_id_str, NULL);
+ if (result_set) {
+ result_set_to_metadata (result_set, metadata, TRUE, only_embedded);
+ g_object_unref (result_set);
+ }
+
+ g_free (service_id_str);
+
+ return metadata;
+}
+
+static gchar *
+db_get_metadata (TrackerService *service,
+ guint service_id,
+ gboolean keywords)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set;
+ gchar *query;
+ GString *result;
+ gchar *str = NULL;
+
+ iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+ TRACKER_DB_CONTENT_TYPE_METADATA);
+
+ result = g_string_new ("");
+
+ if (service_id < 1) {
+ return g_string_free (result, FALSE);
+ }
+
+ if (keywords) {
+ query = g_strdup_printf ("Select MetadataValue From ServiceKeywordMetadata WHERE serviceID = %d",
+ service_id);
+ } else {
+ query = g_strdup_printf ("Select MetadataValue From ServiceMetadata WHERE serviceID = %d",
+ service_id);
+ }
+
+ result_set = tracker_db_interface_execute_query (iface, NULL, query);
+ g_free (query);
+
+ if (result_set) {
+ gboolean valid = TRUE;
+
+ while (valid) {
+ tracker_db_result_set_get (result_set, 0, &str, -1);
+ result = g_string_append (result, str);
+ result = g_string_append (result, " ");
+ valid = tracker_db_result_set_iter_next (result_set);
+ g_free (str);
+ }
+
+ g_object_unref (result_set);
+ }
+
+ return g_string_free (result, FALSE);
+}
+
+gchar *
+tracker_db_get_unparsed_metadata (TrackerService *service,
+ guint service_id)
+{
+ return db_get_metadata (service, service_id, TRUE);
+}
+
+gchar *
+tracker_db_get_parsed_metadata (TrackerService *service,
+ guint service_id)
+{
+ return db_get_metadata (service, service_id, FALSE);
+}
+
+gchar **
+tracker_db_get_property_values (TrackerService *service_def,
+ guint32 id,
+ TrackerField *field)
+{
+ TrackerDBInterface *iface;
+ TrackerDBResultSet *result_set = NULL;
+ gint metadata_key;
+ gchar **final_result = NULL;
+ gboolean is_numeric = FALSE;
+
+ iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service_def),
+ TRACKER_DB_CONTENT_TYPE_METADATA);
+ metadata_key = tracker_ontology_service_get_key_metadata (tracker_service_get_name (service_def),
+ tracker_field_get_name (field));
+
+ if (metadata_key > 0) {
+ gchar *query;
+
+ query = g_strdup_printf ("SELECT KeyMetadata%d FROM Services WHERE id = '%d'",
+ metadata_key,
+ id);
+ result_set = tracker_db_interface_execute_query (iface,
+ NULL,
+ query,
+ NULL);
+ g_free (query);
+ } else {
+ gchar *id_str;
+
+ id_str = tracker_guint32_to_string (id);
+
+ switch (tracker_field_get_data_type (field)) {
+ case TRACKER_FIELD_TYPE_KEYWORD:
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetMetadataKeyword",
+ id_str,
+ tracker_field_get_id (field),
+ NULL);
+ break;
+ case TRACKER_FIELD_TYPE_INDEX:
+ case TRACKER_FIELD_TYPE_STRING:
+ case TRACKER_FIELD_TYPE_DOUBLE:
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetMetadata",
+ id_str,
+ tracker_field_get_id (field),
+ NULL);
+ break;
+ case TRACKER_FIELD_TYPE_INTEGER:
+ case TRACKER_FIELD_TYPE_DATE:
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetMetadataNumeric",
+ id_str,
+ tracker_field_get_id (field),
+ NULL);
+ is_numeric = TRUE;
+ break;
+ case TRACKER_FIELD_TYPE_FULLTEXT:
+ tracker_db_get_text (service_def, id);
+ break;
+ case TRACKER_FIELD_TYPE_BLOB:
+ case TRACKER_FIELD_TYPE_STRUCT:
+ case TRACKER_FIELD_TYPE_LINK:
+ /* not handled */
+ default:
+ break;
+ }
+ g_free (id_str);
+ }
+
+ if (result_set) {
+ if (tracker_db_result_set_get_n_rows (result_set) > 1) {
+ g_warning ("More than one result in tracker_db_get_property_value");
+ }
+
+ if (!is_numeric) {
+ final_result = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
+ } else {
+ final_result = tracker_dbus_query_result_numeric_to_strv (result_set, 0, NULL);
+ }
+
+ g_object_unref (result_set);
+ }
+
+ return final_result;
+}
+
+gchar *
+tracker_db_get_text (TrackerService *service,
+ guint32 id)
+{
+ TrackerDBInterface *iface;
+ TrackerField *field;
+ gchar *service_id_str, *contents = NULL;
+ TrackerDBResultSet *result_set;
+
+ service_id_str = tracker_guint32_to_string (id);
+ field = tracker_ontology_get_field_by_name ("File:Contents");
+ iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
+ TRACKER_DB_CONTENT_TYPE_CONTENTS);
+
+ /* Delete contents if it has! */
+ result_set = tracker_db_interface_execute_procedure (iface, NULL,
+ "GetContents",
+ service_id_str,
+ tracker_field_get_id (field),
+ NULL);
+
+ if (result_set) {
+ tracker_db_result_set_get (result_set, 0, &contents, -1);
+ g_object_unref (result_set);
+ }
+
+ g_free (service_id_str);
+
+ return contents;
+}
+
Added: branches/libtracker-data/src/libtracker-data/tracker-data-query.h
==============================================================================
--- (empty file)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-query.h Wed Nov 5 14:58:13 2008
@@ -0,0 +1,92 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * Copyright (C) 2006, Mr Jamie McCracken (jamiemcc gnome org)
+ * Copyright (C) 2007, Jason Kivlighn (jkivlighn gmail com)
+ * Copyright (C) 2007, Creative Commons (http://creativecommons.org)
+ * Copyright (C) 2008, Nokia
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __TRACKER_DATA_QUERY_H__
+#define __TRACKER_DATA_QUERY_H__
+
+#include <glib.h>
+
+#include <libtracker-common/tracker-config.h>
+#include <libtracker-common/tracker-field.h>
+#include <libtracker-common/tracker-field-data.h>
+#include <libtracker-common/tracker-language.h>
+#include <libtracker-common/tracker-ontology.h>
+
+#include <libtracker-db/tracker-db-interface.h>
+#include <libtracker-db/tracker-db-file-info.h>
+#include <libtracker-db/tracker-db-index.h>
+
+#include "tracker-data-metadata.h"
+
+G_BEGIN_DECLS
+
+/* Metadata API */
+TrackerDBResultSet *tracker_db_metadata_get (TrackerDBInterface *iface,
+ const gchar *id,
+ const gchar *key);
+GPtrArray * tracker_db_metadata_get_all (const gchar *service_type,
+ const gchar *service_id);
+TrackerDBResultSet *tracker_db_metadata_get_array (TrackerDBInterface *iface,
+ const gchar *service_type,
+ const gchar *service_id,
+ gchar **keys);
+gchar * tracker_db_metadata_get_delimited (TrackerDBInterface *iface,
+ const gchar *id,
+ const gchar *key);
+
+TrackerDataMetadata *tracker_db_get_all_metadata (TrackerService *service,
+ guint32 id,
+ gboolean only_embedded);
+gchar * tracker_db_get_parsed_metadata (TrackerService *service,
+ guint32 id);
+gchar * tracker_db_get_unparsed_metadata (TrackerService *service,
+ guint32 id);
+gchar ** tracker_db_get_property_values (TrackerService *service_def,
+ guint32 id,
+ TrackerField *field_def);
+
+/* Using path */
+gboolean tracker_db_check_service (TrackerService *service,
+ const gchar *dirname,
+ const gchar *basename,
+ guint32 *id,
+ time_t *mtime);
+guint tracker_db_get_service_type (const gchar *dirname,
+ const gchar *basename);
+
+/* Service API */
+gchar * tracker_db_service_get_by_entity (TrackerDBInterface *iface,
+ const gchar *id);
+
+/* Files API */
+guint32 tracker_db_file_get_id (const gchar *service_type,
+ const gchar *uri);
+gchar * tracker_db_file_get_id_as_string (const gchar *service_type,
+ const gchar *uri);
+
+gchar * tracker_db_get_text (TrackerService *service,
+ guint32 id);
+
+G_END_DECLS
+
+#endif /* __TRACKER_DATA_QUERY_H__ */
Modified: branches/libtracker-data/src/libtracker-data/tracker-data-update.c
==============================================================================
--- branches/libtracker-data/src/libtracker-data/tracker-data-update.c (original)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-update.c Wed Nov 5 14:58:13 2008
@@ -143,82 +143,6 @@
}
gboolean
-tracker_db_check_service (TrackerService *service,
- const gchar *dirname,
- const gchar *basename,
- guint32 *id,
- time_t *mtime)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- gchar *db_mtime_str;
- guint db_id;
- guint db_mtime;
- gboolean found = FALSE;
-
- db_id = db_mtime = 0;
-
- iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
- TRACKER_DB_CONTENT_TYPE_METADATA);
-
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetServiceID",
- dirname,
- basename,
- NULL);
- if (result_set) {
- tracker_db_result_set_get (result_set,
- 0, &db_id,
- 1, &db_mtime_str,
- -1);
- g_object_unref (result_set);
- found = TRUE;
-
- if (db_mtime_str) {
- db_mtime = tracker_string_to_date (db_mtime_str);
- g_free (db_mtime_str);
- }
- }
-
- if (id) {
- *id = (guint32) db_id;
- }
-
- if (mtime) {
- *mtime = (time_t) db_mtime;
- }
-
- return found;
-}
-
-guint
-tracker_db_get_service_type (const gchar *dirname,
- const gchar *basename)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- guint service_type_id;
-
- /* We are asking this because the module cannot assign service_type -> probably it is files */
- iface = tracker_db_manager_get_db_interface_by_type ("Files",
- TRACKER_DB_CONTENT_TYPE_METADATA);
-
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetServiceID",
- dirname,
- basename,
- NULL);
- if (!result_set) {
- return 0;
- }
-
- tracker_db_result_set_get (result_set, 3, &service_type_id, -1);
- g_object_unref (result_set);
-
- return service_type_id;
-}
-
-gboolean
tracker_data_update_create_service (TrackerService *service,
guint32 id,
const gchar *dirname,
@@ -276,158 +200,6 @@
return TRUE;
}
-static gchar *
-db_get_metadata (TrackerService *service,
- guint service_id,
- gboolean keywords)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set;
- gchar *query;
- GString *result;
- gchar *str = NULL;
-
- iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
- TRACKER_DB_CONTENT_TYPE_METADATA);
-
- result = g_string_new ("");
-
- if (service_id < 1) {
- return g_string_free (result, FALSE);
- }
-
- if (keywords) {
- query = g_strdup_printf ("Select MetadataValue From ServiceKeywordMetadata WHERE serviceID = %d",
- service_id);
- } else {
- query = g_strdup_printf ("Select MetadataValue From ServiceMetadata WHERE serviceID = %d",
- service_id);
- }
-
- result_set = tracker_db_interface_execute_query (iface, NULL, query);
- g_free (query);
-
- if (result_set) {
- gboolean valid = TRUE;
-
- while (valid) {
- tracker_db_result_set_get (result_set, 0, &str, -1);
- result = g_string_append (result, str);
- result = g_string_append (result, " ");
- valid = tracker_db_result_set_iter_next (result_set);
- g_free (str);
- }
-
- g_object_unref (result_set);
- }
-
- return g_string_free (result, FALSE);
-}
-
-static void
-result_set_to_metadata (TrackerDBResultSet *result_set,
- TrackerDataMetadata *metadata,
- gboolean numeric,
- gboolean only_embedded)
-{
- TrackerField *field;
- gchar *value;
- gint numeric_value;
- gint metadata_id;
- gboolean valid = TRUE;
-
- while (valid) {
- if (numeric) {
- tracker_db_result_set_get (result_set,
- 0, &metadata_id,
- 1, &numeric_value,
- -1);
- value = g_strdup_printf ("%d", numeric_value);
- } else {
- tracker_db_result_set_get (result_set,
- 0, &metadata_id,
- 1, &value,
- -1);
- }
-
- field = tracker_ontology_get_field_by_id (metadata_id);
- if (!field) {
- g_critical ("Field id %d in database but not in tracker-ontology",
- metadata_id);
- g_free (value);
- return;
- }
-
- if (tracker_field_get_embedded (field) || !only_embedded) {
- if (tracker_field_get_multiple_values (field)) {
- GList *new_values;
- const GList *old_values;
-
- new_values = NULL;
- old_values = tracker_data_metadata_lookup_multiple_values (metadata,
- tracker_field_get_name (field));
- if (old_values) {
- new_values = g_list_copy ((GList *) old_values);
- }
-
- new_values = g_list_prepend (new_values, value);
- tracker_data_metadata_insert_multiple_values (metadata,
- tracker_field_get_name (field),
- new_values);
- } else {
- tracker_data_metadata_insert (metadata,
- tracker_field_get_name (field),
- value);
- }
- } else {
- g_free (value);
- }
-
- valid = tracker_db_result_set_iter_next (result_set);
- }
-}
-
-TrackerDataMetadata *
-tracker_db_get_all_metadata (TrackerService *service,
- guint32 service_id,
- gboolean only_embedded)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set = NULL;
- gchar *service_id_str;
- TrackerDataMetadata *metadata;
-
- metadata = tracker_data_metadata_new ();
-
- g_return_val_if_fail (TRACKER_IS_SERVICE (service), metadata);
-
- service_id_str = g_strdup_printf ("%d", service_id);
- iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
- TRACKER_DB_CONTENT_TYPE_METADATA);
-
- result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValue", service_id_str, NULL);
- if (result_set) {
- result_set_to_metadata (result_set, metadata, FALSE, only_embedded);
- g_object_unref (result_set);
- }
-
- result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValueKeyword", service_id_str, NULL);
- if (result_set) {
- result_set_to_metadata (result_set, metadata, FALSE, only_embedded);
- g_object_unref (result_set);
- }
-
- result_set = tracker_db_interface_execute_procedure (iface, NULL, "GetMetadataIDValueNumeric", service_id_str, NULL);
- if (result_set) {
- result_set_to_metadata (result_set, metadata, TRUE, only_embedded);
- g_object_unref (result_set);
- }
-
- g_free (service_id_str);
-
- return metadata;
-}
-
void
tracker_data_update_delete_service (TrackerService *service,
guint32 service_id)
@@ -565,108 +337,6 @@
NULL);
}
-gchar *
-tracker_db_get_unparsed_metadata (TrackerService *service,
- guint service_id)
-{
- return db_get_metadata (service, service_id, TRUE);
-}
-
-gchar *
-tracker_db_get_parsed_metadata (TrackerService *service,
- guint service_id)
-{
- return db_get_metadata (service, service_id, FALSE);
-}
-
-gchar **
-tracker_db_get_property_values (TrackerService *service_def,
- guint32 id,
- TrackerField *field)
-{
- TrackerDBInterface *iface;
- TrackerDBResultSet *result_set = NULL;
- gint metadata_key;
- gchar **final_result = NULL;
- gboolean is_numeric = FALSE;
-
- iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service_def),
- TRACKER_DB_CONTENT_TYPE_METADATA);
- metadata_key = tracker_ontology_service_get_key_metadata (tracker_service_get_name (service_def),
- tracker_field_get_name (field));
-
- if (metadata_key > 0) {
- gchar *query;
-
- query = g_strdup_printf ("SELECT KeyMetadata%d FROM Services WHERE id = '%d'",
- metadata_key,
- id);
- result_set = tracker_db_interface_execute_query (iface,
- NULL,
- query,
- NULL);
- g_free (query);
- } else {
- gchar *id_str;
-
- id_str = tracker_guint32_to_string (id);
-
- switch (tracker_field_get_data_type (field)) {
- case TRACKER_FIELD_TYPE_KEYWORD:
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetMetadataKeyword",
- id_str,
- tracker_field_get_id (field),
- NULL);
- break;
- case TRACKER_FIELD_TYPE_INDEX:
- case TRACKER_FIELD_TYPE_STRING:
- case TRACKER_FIELD_TYPE_DOUBLE:
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetMetadata",
- id_str,
- tracker_field_get_id (field),
- NULL);
- break;
- case TRACKER_FIELD_TYPE_INTEGER:
- case TRACKER_FIELD_TYPE_DATE:
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetMetadataNumeric",
- id_str,
- tracker_field_get_id (field),
- NULL);
- is_numeric = TRUE;
- break;
- case TRACKER_FIELD_TYPE_FULLTEXT:
- tracker_db_get_text (service_def, id);
- break;
- case TRACKER_FIELD_TYPE_BLOB:
- case TRACKER_FIELD_TYPE_STRUCT:
- case TRACKER_FIELD_TYPE_LINK:
- /* not handled */
- default:
- break;
- }
- g_free (id_str);
- }
-
- if (result_set) {
- if (tracker_db_result_set_get_n_rows (result_set) > 1) {
- g_warning ("More than one result in tracker_db_get_property_value");
- }
-
- if (!is_numeric) {
- final_result = tracker_dbus_query_result_to_strv (result_set, 0, NULL);
- } else {
- final_result = tracker_dbus_query_result_numeric_to_strv (result_set, 0, NULL);
- }
-
- g_object_unref (result_set);
- }
-
- return final_result;
-}
-
void
tracker_data_update_set_metadata (TrackerService *service,
guint32 id,
@@ -852,37 +522,6 @@
g_free (id_str);
}
-gchar *
-tracker_db_get_text (TrackerService *service,
- guint32 id)
-{
- TrackerDBInterface *iface;
- TrackerField *field;
- gchar *service_id_str, *contents = NULL;
- TrackerDBResultSet *result_set;
-
- service_id_str = tracker_guint32_to_string (id);
- field = tracker_ontology_get_field_by_name ("File:Contents");
- iface = tracker_db_manager_get_db_interface_by_type (tracker_service_get_name (service),
- TRACKER_DB_CONTENT_TYPE_CONTENTS);
-
- /* Delete contents if it has! */
- result_set = tracker_db_interface_execute_procedure (iface, NULL,
- "GetContents",
- service_id_str,
- tracker_field_get_id (field),
- NULL);
-
- if (result_set) {
- tracker_db_result_set_get (result_set, 0, &contents, -1);
- g_object_unref (result_set);
- }
-
- g_free (service_id_str);
-
- return contents;
-}
-
void
tracker_data_update_delete_contents (TrackerService *service,
guint32 id)
Modified: branches/libtracker-data/src/libtracker-data/tracker-data-update.h
==============================================================================
--- branches/libtracker-data/src/libtracker-data/tracker-data-update.h (original)
+++ branches/libtracker-data/src/libtracker-data/tracker-data-update.h Wed Nov 5 14:58:13 2008
@@ -34,15 +34,6 @@
void tracker_data_update_decrement_stats (TrackerDBInterface *iface,
TrackerService *service);
-/* Using path */
-gboolean tracker_db_check_service (TrackerService *service,
- const gchar *dirname,
- const gchar *basename,
- guint32 *id,
- time_t *mtime);
-guint tracker_db_get_service_type (const gchar *dirname,
- const gchar *basename);
-
/* Services */
gboolean tracker_data_update_create_service (TrackerService *service,
guint32 id,
@@ -63,16 +54,6 @@
TrackerField *field,
const gchar *value,
const gchar *parsed_value);
-TrackerDataMetadata *tracker_db_get_all_metadata (TrackerService *service,
- guint32 id,
- gboolean only_embedded);
-gchar * tracker_db_get_parsed_metadata (TrackerService *service,
- guint32 id);
-gchar * tracker_db_get_unparsed_metadata (TrackerService *service,
- guint32 id);
-gchar ** tracker_db_get_property_values (TrackerService *service_def,
- guint32 id,
- TrackerField *field_def);
void tracker_data_update_delete_all_metadata (TrackerService *service,
guint32 id);
void tracker_data_update_delete_metadata (TrackerService *service,
@@ -84,8 +65,6 @@
void tracker_data_update_set_contents (TrackerService *service,
guint32 id,
const gchar *text);
-gchar * tracker_db_get_text (TrackerService *service,
- guint32 id);
void tracker_data_update_delete_contents (TrackerService *service,
guint32 id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]