[tracker/cursor: 14/15] libtracker-data: Remove unused TrackerDBResultSet



commit 89fec97c6185af177997dea52b33bb748a2af489
Author: Jürg Billeter <j bitron ch>
Date:   Tue Jan 18 17:13:21 2011 +0100

    libtracker-data: Remove unused TrackerDBResultSet

 src/libtracker-data/libtracker-data.vapi          |    7 -
 src/libtracker-data/tracker-db-interface-sqlite.c |  100 +-------
 src/libtracker-data/tracker-db-interface.c        |  275 +--------------------
 src/libtracker-data/tracker-db-interface.h        |   35 +---
 src/libtracker-data/tracker-db-manager.c          |   16 +-
 tests/libtracker-data/tracker-db-manager-common.c |    7 +-
 6 files changed, 24 insertions(+), 416 deletions(-)
---
diff --git a/src/libtracker-data/libtracker-data.vapi b/src/libtracker-data/libtracker-data.vapi
index e850da4..0caf4b6 100644
--- a/src/libtracker-data/libtracker-data.vapi
+++ b/src/libtracker-data/libtracker-data.vapi
@@ -67,12 +67,6 @@ namespace Tracker {
 	}
 
 	[CCode (cheader_filename = "libtracker-data/tracker-db-interface.h")]
-	public class DBResultSet : GLib.Object {
-		public void _get_value (uint column, out GLib.Value value);
-		public bool iter_next ();
-	}
-
-	[CCode (cheader_filename = "libtracker-data/tracker-db-interface.h")]
 	public class DBCursor : Sparql.Cursor {
 	}
 
@@ -81,7 +75,6 @@ namespace Tracker {
 		public abstract void bind_double (int index, double value);
 		public abstract void bind_int (int index, int value);
 		public abstract void bind_text (int index, string value);
-		public abstract DBResultSet execute () throws DBInterfaceError;
 		public abstract DBCursor start_cursor () throws DBInterfaceError;
 		public abstract DBCursor start_sparql_cursor (PropertyType[] types, string[] variable_names, bool threadsafe) throws DBInterfaceError;
 	}
diff --git a/src/libtracker-data/tracker-db-interface-sqlite.c b/src/libtracker-data/tracker-db-interface-sqlite.c
index adb7de6..1afbf53 100644
--- a/src/libtracker-data/tracker-db-interface-sqlite.c
+++ b/src/libtracker-data/tracker-db-interface-sqlite.c
@@ -816,65 +816,6 @@ tracker_db_interface_init (TrackerDBInterface *db_interface)
 	prepare_database (db_interface);
 }
 
-static TrackerDBResultSet *
-ensure_result_set_state (TrackerDBResultSet *result_set)
-{
-	if (!result_set)
-		return NULL;
-
-	if (tracker_db_result_set_get_n_rows (result_set) == 0) {
-		g_object_unref (result_set);
-		return NULL;
-	}
-
-	/* ensure that it's at the first item */
-	tracker_db_result_set_rewind (result_set);
-
-	return result_set;
-}
-
-static void
-add_row (TrackerDBResultSet *result_set,
-         sqlite3_stmt       *stmt)
-{
-	gint cols, i;
-
-	cols = sqlite3_column_count (stmt);
-	_tracker_db_result_set_append (result_set);
-
-	for (i = 0; i < cols; i++) {
-		GValue value = { 0, };
-		gint col_type;
-
-		col_type = sqlite3_column_type (stmt, i);
-
-		switch (col_type) {
-		case SQLITE_TEXT:
-			g_value_init (&value, G_TYPE_STRING);
-			g_value_set_string (&value, (gchar *) sqlite3_column_text (stmt, i));
-			break;
-		case SQLITE_INTEGER:
-			g_value_init (&value, G_TYPE_INT64);
-			g_value_set_int64 (&value, sqlite3_column_int64 (stmt, i));
-			break;
-		case SQLITE_FLOAT:
-			g_value_init (&value, G_TYPE_DOUBLE);
-			g_value_set_double (&value, sqlite3_column_double (stmt, i));
-			break;
-		case SQLITE_NULL:
-			/* just ignore NULLs */
-			break;
-		default:
-			g_critical ("Unknown sqlite3 database column type:%d", col_type);
-		}
-
-		if (G_VALUE_TYPE (&value) != G_TYPE_INVALID) {
-			_tracker_db_result_set_set_value (result_set, i, &value);
-			g_value_unset (&value);
-		}
-	}
-}
-
 void
 tracker_db_interface_set_max_stmt_cache_size (TrackerDBInterface         *db_interface,
                                               TrackerDBStatementCacheType cache_type,
@@ -1083,13 +1024,12 @@ tracker_db_interface_create_statement (TrackerDBInterface           *db_interfac
 	return (cache_type != TRACKER_DB_STATEMENT_CACHE_TYPE_NONE) ? g_object_ref (stmt) : stmt;
 }
 
-static TrackerDBResultSet *
-create_result_set_from_stmt (TrackerDBInterface  *interface,
-                             sqlite3_stmt        *stmt,
-                             GCancellable        *cancellable,
-                             GError             **error)
+static void
+execute_stmt (TrackerDBInterface  *interface,
+              sqlite3_stmt        *stmt,
+              GCancellable        *cancellable,
+              GError             **error)
 {
-	TrackerDBResultSet *result_set = NULL;
 	gint columns, result;
 
 	columns = sqlite3_column_count (stmt);
@@ -1121,11 +1061,6 @@ create_result_set_from_stmt (TrackerDBInterface  *interface,
 			sqlite3_reset (stmt);
 			break;
 		case SQLITE_ROW:
-			if (G_UNLIKELY (!result_set)) {
-				result_set = _tracker_db_result_set_new (columns);
-			}
-
-			add_row (result_set, stmt);
 			break;
 		default:
 			break;
@@ -1165,7 +1100,7 @@ create_result_set_from_stmt (TrackerDBInterface  *interface,
 			         "Shutting down now.",
 			         interface->filename);
 
-			return NULL;
+			return;
 		}
 
 		if (!error) {
@@ -1186,26 +1121,16 @@ create_result_set_from_stmt (TrackerDBInterface  *interface,
 				             sqlite3_errmsg (interface->db));
 			}
 		}
-
-		/* If there was an error, result set may be invalid or incomplete */
-		if (result_set) {
-			g_object_unref (result_set);
-		}
-
-		return NULL;
 	}
-
-	return ensure_result_set_state (result_set);
 }
 
-TrackerDBResultSet *
+void
 tracker_db_interface_execute_vquery (TrackerDBInterface  *db_interface,
                                      GError             **error,
                                      const gchar         *query,
                                      va_list              args)
 {
 	gchar *full_query;
-	TrackerDBResultSet *result_set;
 	sqlite3_stmt *stmt;
 	int retval;
 
@@ -1221,7 +1146,7 @@ tracker_db_interface_execute_vquery (TrackerDBInterface  *db_interface,
 		             "%s",
 		             sqlite3_errmsg (db_interface->db));
 		g_free (full_query);
-		return NULL;
+		return;
 	} else if (stmt == NULL) {
 		g_set_error (error,
 		             TRACKER_DB_INTERFACE_ERROR,
@@ -1230,14 +1155,13 @@ tracker_db_interface_execute_vquery (TrackerDBInterface  *db_interface,
 		             full_query);
 
 		g_free (full_query);
-		return NULL;
+		return;
 	}
 
-	result_set = create_result_set_from_stmt (db_interface, stmt, NULL, error);
+	execute_stmt (db_interface, stmt, NULL, error);
 	sqlite3_finalize (stmt);
 
 	g_free (full_query);
-	return result_set;
 }
 
 TrackerDBInterface *
@@ -1683,13 +1607,13 @@ tracker_db_cursor_get_string (TrackerDBCursor *cursor,
 	}
 }
 
-TrackerDBResultSet *
+void
 tracker_db_statement_execute (TrackerDBStatement  *stmt,
                               GError             **error)
 {
 	g_return_val_if_fail (!stmt->stmt_is_sunk, NULL);
 
-	return create_result_set_from_stmt (stmt->db_interface, stmt->stmt, NULL, error);
+	execute_stmt (stmt->db_interface, stmt->stmt, NULL, error);
 }
 
 TrackerDBCursor *
diff --git a/src/libtracker-data/tracker-db-interface.c b/src/libtracker-data/tracker-db-interface.c
index d3c8275..249e67c 100644
--- a/src/libtracker-data/tracker-db-interface.c
+++ b/src/libtracker-data/tracker-db-interface.c
@@ -23,91 +23,26 @@
 
 #include "tracker-db-interface.h"
 
-struct TrackerDBResultSet {
-	GObject parent_class;
-	GType *col_types;
-	GPtrArray *array;
-	guint columns;
-	guint current_row;
-};
-
-struct TrackerDBResultSetClass {
-	GObjectClass parent_class;
-};
-
-G_DEFINE_TYPE (TrackerDBResultSet, tracker_db_result_set, G_TYPE_OBJECT)
-
 GQuark
 tracker_db_interface_error_quark (void)
 {
 	return g_quark_from_static_string ("tracker-db-interface-error-quark");
 }
 
-static void
-free_row (gpointer *row,
-          gpointer  data)
-{
-	guint columns = GPOINTER_TO_UINT (data);
-	guint i;
-
-	if (!row)
-		return;
-
-	for (i = 0; i < columns; i++) {
-		g_free (row[i]);
-	}
-
-	g_free (row);
-}
-
-static void
-tracker_db_result_set_finalize (GObject *object)
-{
-	TrackerDBResultSet *result_set;
-
-	result_set = TRACKER_DB_RESULT_SET (object);
-
-	if (result_set->array) {
-		g_ptr_array_foreach (result_set->array, (GFunc) free_row,
-		                     GUINT_TO_POINTER (result_set->columns));
-		g_ptr_array_free (result_set->array, TRUE);
-	}
-
-	g_free (result_set->col_types);
-
-	G_OBJECT_CLASS (tracker_db_result_set_parent_class)->finalize (object);
-}
-
-static void
-tracker_db_result_set_class_init (TrackerDBResultSetClass *class)
-{
-	GObjectClass *object_class = G_OBJECT_CLASS (class);
-
-	object_class->finalize = tracker_db_result_set_finalize;
-}
-
-static void
-tracker_db_result_set_init (TrackerDBResultSet *result_set)
-{
-}
-
-TrackerDBResultSet *
+void
 tracker_db_interface_execute_query (TrackerDBInterface  *interface,
                                     GError             **error,
                                     const gchar         *query,
                                     ...)
 {
-	TrackerDBResultSet *result_set;
 	va_list args;
 
 	va_start (args, query);
-	result_set = tracker_db_interface_execute_vquery (interface,
+	tracker_db_interface_execute_vquery (interface,
 	                                                  error,
 	                                                  query,
 	                                                  args);
 	va_end (args);
-
-	return result_set;
 }
 
 gboolean
@@ -146,209 +81,3 @@ tracker_db_interface_end_db_transaction (TrackerDBInterface *interface)
 
 	return TRUE;
 }
-
-
-/* TrackerDBResultSet semiprivate API */
-TrackerDBResultSet *
-_tracker_db_result_set_new (guint columns)
-{
-	TrackerDBResultSet *result_set;
-
-	result_set = g_object_new (TRACKER_TYPE_DB_RESULT_SET, NULL);
-
-	result_set->columns = columns;
-	result_set->col_types = g_new0 (GType, result_set->columns);
-
-	return result_set;
-}
-
-void
-_tracker_db_result_set_append (TrackerDBResultSet *result_set)
-{
-	g_return_if_fail (TRACKER_IS_DB_RESULT_SET (result_set));
-
-	if (G_UNLIKELY (!result_set->array)) {
-		result_set->array = g_ptr_array_sized_new (100);
-	}
-
-	g_ptr_array_add (result_set->array, NULL);
-	result_set->current_row = result_set->array->len - 1;
-}
-
-void
-_tracker_db_result_set_set_value (TrackerDBResultSet *result_set,
-                                  guint               column,
-                                  const GValue       *value)
-{
-	gpointer *row = NULL;
-
-	g_return_if_fail (TRACKER_IS_DB_RESULT_SET (result_set));
-
-	/* just return if the value doesn't contain anything */
-	if (G_VALUE_TYPE (value) == 0)
-		return;
-
-	g_return_if_fail (column < result_set->columns);
-
-	/* Assign a GType if it didn't have any */
-	/* if (G_UNLIKELY (result_set->col_types[column] == 0)) */
-	result_set->col_types[column] = G_VALUE_TYPE (value);
-
-	row = g_ptr_array_index (result_set->array, result_set->current_row);
-
-	/* Allocate space for the row, if it wasn't allocated previously */
-	if (G_UNLIKELY (!row)) {
-		row = g_new0 (gpointer, result_set->columns);
-		g_ptr_array_index (result_set->array, result_set->current_row) = row;
-	}
-
-	switch (result_set->col_types [column]) {
-	case G_TYPE_INT64: {
-		gint64 *val;
-
-		val = g_new (gint64, 1);
-		*val = g_value_get_int64 (value);
-		row[column] = val;
-		break;
-	}
-	case G_TYPE_DOUBLE: {
-		gdouble *val;
-
-		val = g_new (gdouble, 1);
-		*val = g_value_get_double (value);
-		row[column] = val;
-		break;
-	}
-	case G_TYPE_STRING:
-		row[column] = (gpointer) g_value_dup_string (value);
-		break;
-	default:
-		g_warning ("Unknown type for resultset: %s\n", G_VALUE_TYPE_NAME (value));
-	}
-}
-
-static void
-fill_in_value (GValue   *value,
-               gpointer  data)
-{
-	switch (G_VALUE_TYPE (value)) {
-	case G_TYPE_INT64:
-		g_value_set_int64 (value, *((gint64*) data));
-		break;
-	case G_TYPE_DOUBLE:
-		g_value_set_double (value, *((gdouble *) data));
-		break;
-	case G_TYPE_STRING:
-		g_value_set_string (value, data);
-		break;
-	default:
-		g_warning ("Unknown type for resultset: %s\n", G_VALUE_TYPE_NAME (value));
-		break;
-	}
-}
-
-void
-_tracker_db_result_set_get_value (TrackerDBResultSet *result_set,
-                                  guint               column,
-                                  GValue             *value)
-{
-	gpointer *row;
-
-	g_return_if_fail (TRACKER_IS_DB_RESULT_SET (result_set));
-
-	row = g_ptr_array_index (result_set->array, result_set->current_row);
-
-	if (result_set->col_types[column] != G_TYPE_INVALID && row && row[column]) {
-		g_value_init (value, result_set->col_types[column]);
-		fill_in_value (value, row[column]);
-	} else {
-		/* NULL, keep value unset */
-	}
-}
-
-/* TrackerDBResultSet API */
-void
-tracker_db_result_set_get (TrackerDBResultSet *result_set,
-                           ...)
-{
-	va_list args;
-	gint n_col;
-	GValue value = { 0, };
-	gpointer *row;
-	gchar *error = NULL;
-
-	g_return_if_fail (TRACKER_IS_DB_RESULT_SET (result_set));
-
-	g_return_if_fail (result_set->array != NULL);
-
-	row = g_ptr_array_index (result_set->array, result_set->current_row);
-	va_start (args, result_set);
-
-	while ((n_col = va_arg (args, gint)) >= 0) {
-		if ((guint) n_col >= result_set->columns) {
-			g_critical ("Result set has %d columns, trying to access column %d, "
-			            "maybe -1 is missing at the end of the arguments?",
-			            result_set->columns, n_col);
-			break;
-		}
-
-		if (result_set->col_types[n_col] != G_TYPE_INVALID) {
-			g_value_init (&value, result_set->col_types[n_col]);
-			fill_in_value (&value, row[n_col]);
-			G_VALUE_LCOPY (&value, args, 0, &error);
-			g_value_unset (&value);
-		} else {
-			gpointer *pointer;
-
-			/* No valid type, set to NULL/0 */
-			pointer = va_arg (args, gpointer *);
-			*pointer = NULL;
-		}
-
-		if (error) {
-			g_warning ("%s", error);
-			g_free (error);
-		}
-	}
-
-	va_end (args);
-}
-
-void
-tracker_db_result_set_rewind (TrackerDBResultSet *result_set)
-{
-	g_return_if_fail (TRACKER_IS_DB_RESULT_SET (result_set));
-
-	result_set->current_row = 0;
-}
-
-gboolean
-tracker_db_result_set_iter_next (TrackerDBResultSet *result_set)
-{
-	g_return_val_if_fail (TRACKER_IS_DB_RESULT_SET (result_set), FALSE);
-
-	if (result_set->current_row + 1 >= result_set->array->len)
-		return FALSE;
-
-	result_set->current_row++;
-	return TRUE;
-}
-
-guint
-tracker_db_result_set_get_n_columns (TrackerDBResultSet *result_set)
-{
-	g_return_val_if_fail (TRACKER_IS_DB_RESULT_SET (result_set), 0);
-
-	return result_set->columns;
-}
-
-guint
-tracker_db_result_set_get_n_rows (TrackerDBResultSet *result_set)
-{
-	g_return_val_if_fail (TRACKER_IS_DB_RESULT_SET (result_set), 0);
-
-	if (!result_set->array)
-		return 0;
-
-	return result_set->array->len;
-}
diff --git a/src/libtracker-data/tracker-db-interface.h b/src/libtracker-data/tracker-db-interface.h
index 1a19171..a636bcd 100644
--- a/src/libtracker-data/tracker-db-interface.h
+++ b/src/libtracker-data/tracker-db-interface.h
@@ -54,13 +54,6 @@ G_BEGIN_DECLS
 #define TRACKER_IS_DB_CURSOR_CLASS(c)       (G_TYPE_CHECK_CLASS_TYPE ((o),      TRACKER_TYPE_DB_CURSOR))
 #define TRACKER_DB_CURSOR_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj),  TRACKER_TYPE_DB_CURSOR, TrackerDBCursorClass))
 
-#define TRACKER_TYPE_DB_RESULT_SET          (tracker_db_result_set_get_type ())
-#define TRACKER_DB_RESULT_SET(o)            (G_TYPE_CHECK_INSTANCE_CAST ((o), TRACKER_TYPE_DB_RESULT_SET, TrackerDBResultSet))
-#define TRACKER_DB_RESULT_SET_CLASS(c)      (G_TYPE_CHECK_CLASS_CAST ((c),    TRACKER_TYPE_DB_RESULT_SET, TrackerDBResultSetClass))
-#define TRACKER_IS_DB_RESULT_SET(o)         (G_TYPE_CHECK_INSTANCE_TYPE ((o), TRACKER_TYPE_DB_RESULT_SET))
-#define TRACKER_IS_DB_RESULT_SET_CLASS(c)   (G_TYPE_CHECK_CLASS_TYPE ((o),    TRACKER_TYPE_DB_RESULT_SET))
-#define TRACKER_DB_RESULT_SET_GET_CLASS(o)  (G_TYPE_INSTANCE_GET_CLASS ((o),  TRACKER_TYPE_DB_RESULT_SET, TrackerDBResultSetClass))
-
 #define TRACKER_DB_INTERFACE_ERROR          (tracker_db_interface_error_quark ())
 
 typedef void (*TrackerBusyCallback)      (const gchar *status,
@@ -83,18 +76,14 @@ typedef struct TrackerDBInterface      TrackerDBInterface;
 typedef struct TrackerDBInterfaceClass TrackerDBInterfaceClass;
 typedef struct TrackerDBStatement      TrackerDBStatement;
 typedef struct TrackerDBStatementClass TrackerDBStatementClass;
-typedef struct TrackerDBResultSet      TrackerDBResultSet;
-typedef struct TrackerDBResultSetClass TrackerDBResultSetClass;
 typedef struct TrackerDBCursor         TrackerDBCursor;
 typedef struct TrackerDBCursorClass    TrackerDBCursorClass;
-typedef struct TrackerDBResultSetPrivate TrackerDBResultSetPrivate;
 
 GQuark                  tracker_db_interface_error_quark             (void);
 
 GType                   tracker_db_interface_get_type                (void);
 GType                   tracker_db_statement_get_type                (void);
 GType                   tracker_db_cursor_get_type                   (void);
-GType                   tracker_db_result_set_get_type               (void);
 
 void                    tracker_db_interface_set_max_stmt_cache_size (TrackerDBInterface         *db_interface,
                                                                       TrackerDBStatementCacheType cache_type,
@@ -106,11 +95,11 @@ TrackerDBStatement *    tracker_db_interface_create_statement        (TrackerDBI
                                                                       GError                     **error,
                                                                       const gchar                 *query,
                                                                       ...) G_GNUC_PRINTF (4, 5);
-TrackerDBResultSet *    tracker_db_interface_execute_vquery          (TrackerDBInterface          *interface,
+void                    tracker_db_interface_execute_vquery          (TrackerDBInterface          *interface,
                                                                       GError                     **error,
                                                                       const gchar                 *query,
                                                                       va_list                      args);
-TrackerDBResultSet *    tracker_db_interface_execute_query           (TrackerDBInterface          *interface,
+void                    tracker_db_interface_execute_query           (TrackerDBInterface          *interface,
                                                                       GError                     **error,
                                                                       const gchar                 *query,
                                                                        ...) G_GNUC_PRINTF (3, 4);
@@ -128,7 +117,7 @@ void                    tracker_db_statement_bind_null               (TrackerDBS
 void                    tracker_db_statement_bind_text               (TrackerDBStatement         *stmt,
                                                                       int                         index,
                                                                       const gchar                *value);
-TrackerDBResultSet *    tracker_db_statement_execute                 (TrackerDBStatement         *stmt,
+void                    tracker_db_statement_execute                 (TrackerDBStatement         *stmt,
                                                                       GError                    **error);
 TrackerDBCursor *       tracker_db_statement_start_cursor            (TrackerDBStatement         *stmt,
                                                                       GError                    **error);
@@ -144,24 +133,6 @@ void                    tracker_db_interface_set_busy_handler        (TrackerDBI
                                                                       const gchar                *busy_status,
                                                                       gpointer                    busy_user_data);
 
-/* Semi private TrackerDBResultSet functions */
-TrackerDBResultSet *    _tracker_db_result_set_new                   (guint                       cols);
-void                    _tracker_db_result_set_append                (TrackerDBResultSet         *result_set);
-void                    _tracker_db_result_set_set_value             (TrackerDBResultSet         *result_set,
-                                                                      guint                       column,
-                                                                      const GValue               *value);
-void                    _tracker_db_result_set_get_value             (TrackerDBResultSet         *result_set,
-                                                                      guint                       column,
-                                                                      GValue                     *value);
-
-/* Functions to deal with the resultset */
-void                    tracker_db_result_set_get                    (TrackerDBResultSet         *result_set,
-                                                                      ...);
-void                    tracker_db_result_set_rewind                 (TrackerDBResultSet         *result_set);
-gboolean                tracker_db_result_set_iter_next              (TrackerDBResultSet         *result_set);
-guint                   tracker_db_result_set_get_n_columns          (TrackerDBResultSet         *result_set);
-guint                   tracker_db_result_set_get_n_rows             (TrackerDBResultSet         *result_set);
-
 /* Functions to deal with a cursor */
 void                    tracker_db_cursor_rewind                     (TrackerDBCursor            *cursor);
 gboolean                tracker_db_cursor_iter_next                  (TrackerDBCursor            *cursor,
diff --git a/src/libtracker-data/tracker-db-manager.c b/src/libtracker-data/tracker-db-manager.c
index 3556bec..38f3d6c 100644
--- a/src/libtracker-data/tracker-db-manager.c
+++ b/src/libtracker-data/tracker-db-manager.c
@@ -183,17 +183,12 @@ db_exec_no_reply (TrackerDBInterface *iface,
                   const gchar        *query,
                   ...)
 {
-	TrackerDBResultSet *result_set;
 	va_list                     args;
 
 	va_start (args, query);
-	result_set = tracker_db_interface_execute_vquery (iface, NULL, query, args);
+	tracker_db_interface_execute_vquery (iface, NULL, query, args);
 	va_end (args);
 
-	if (result_set) {
-		g_object_unref (result_set);
-	}
-
 	return TRUE;
 }
 
@@ -230,7 +225,6 @@ db_set_params (TrackerDBInterface *iface,
 		g_free (queries);
 	} else {
 		GError *error = NULL;
-		TrackerDBResultSet *result_set;
 
 		tracker_db_interface_execute_query (iface, NULL, "PRAGMA synchronous = OFF;");
 		tracker_db_interface_execute_query (iface, NULL, "PRAGMA count_changes = 0;");
@@ -238,14 +232,12 @@ db_set_params (TrackerDBInterface *iface,
 		tracker_db_interface_execute_query (iface, NULL, "PRAGMA encoding = \"UTF-8\"");
 		tracker_db_interface_execute_query (iface, NULL, "PRAGMA auto_vacuum = 0;");
 
-		result_set = tracker_db_interface_execute_query (iface, &error, "PRAGMA journal_mode = WAL;");
-		if (result_set == NULL) {
+		tracker_db_interface_execute_query (iface, &error, "PRAGMA journal_mode = WAL;");
+		if (error) {
 			/* Don't just silence the problem. This pragma must return 'WAL' */
 			g_message ("Can't set journal mode to WAL: '%s'",
-			           error ? error->message : "unknown error");
+			           error->message);
 			g_clear_error (&error);
-		} else {
-			g_object_unref (result_set);
 		}
 
 		if (page_size != TRACKER_DB_PAGE_SIZE_DONT_SET) {
diff --git a/tests/libtracker-data/tracker-db-manager-common.c b/tests/libtracker-data/tracker-db-manager-common.c
index 12017a5..3765988 100644
--- a/tests/libtracker-data/tracker-db-manager-common.c
+++ b/tests/libtracker-data/tracker-db-manager-common.c
@@ -32,12 +32,11 @@ test_assert_query_run (TrackerDB db, const gchar *query)
 gboolean
 test_assert_query_run_on_iface (TrackerDBInterface *iface, const gchar *query)
 {
-	TrackerDBResultSet *result_set;
 	GError *error = NULL;
 
-	result_set = tracker_db_interface_execute_query (iface,
-	                                                 &error,
-	                                                 query);
+	tracker_db_interface_execute_query (iface,
+	                                    &error,
+	                                    query);
 
 	if (error && error->message) {
 		g_warning ("Error loading query:'%s' - %s", query, error->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]