[rygel-gst-0-10-plugins] Cleanup.



commit dc717ae77edbeeffe4519fe8e1ba056d6a3e7b21
Author: Krzesimir Nowak <krnowak openismus com>
Date:   Mon Jan 14 14:52:45 2013 +0100

    Cleanup.

 .../rygel-media-export-database-cursor.c           |  707 ++++----------------
 .../rygel-media-export-database-cursor.h           |    9 +
 src/media-export/rygel-media-export-database.c     |    6 -
 src/media-export/rygel-media-export-errors.c       |    7 +-
 src/media-export/rygel-media-export-errors.h       |   10 +
 .../rygel-media-export-media-cache-upgrader.c      |   53 +--
 src/media-export/rygel-media-export-media-cache.c  |  139 +----
 src/media-export/rygel-media-export-media-cache.h  |   14 +-
 8 files changed, 191 insertions(+), 754 deletions(-)
---
diff --git a/src/media-export/rygel-media-export-database-cursor.c b/src/media-export/rygel-media-export-database-cursor.c
index 74bb994..3759c3a 100644
--- a/src/media-export/rygel-media-export-database-cursor.c
+++ b/src/media-export/rygel-media-export-database-cursor.c
@@ -21,600 +21,171 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
-
 #include "rygel-media-export-database-cursor.h"
 #include "rygel-media-export-database.h"
-#include <gobject/gvaluecollector.h>
-
-
-G_DEFINE_TYPE (RygelMediaExportDatabaseCursor, rygel_media_export_database_cursor, RYGEL_MEDIA_EXPORT_TYPE_SQLITE_WRAPPER)
 
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR (rygel_media_export_database_cursor_iterator_get_type ())
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIterator))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-
-typedef struct _RygelMediaExportDatabaseCursorIterator RygelMediaExportDatabaseCursorIterator;
-typedef struct _RygelMediaExportDatabaseCursorIteratorClass RygelMediaExportDatabaseCursorIteratorClass;
-typedef struct _RygelMediaExportDatabaseCursorIteratorPrivate RygelMediaExportDatabaseCursorIteratorPrivate;
-typedef struct _RygelMediaExportDatabaseCursorParamSpecIterator RygelMediaExportDatabaseCursorParamSpecIterator;
+G_DEFINE_TYPE (RygelMediaExportDatabaseCursor,
+               rygel_media_export_database_cursor,
+               RYGEL_MEDIA_EXPORT_TYPE_SQLITE_WRAPPER)
 
 struct _RygelMediaExportDatabaseCursorPrivate {
-	sqlite3_stmt* statement;
-	gint current_state;
-	gboolean dirty;
-};
-
-struct _RygelMediaExportDatabaseCursorIterator {
-	GTypeInstance parent_instance;
-	volatile int ref_count;
-	RygelMediaExportDatabaseCursorIteratorPrivate * priv;
-	RygelMediaExportDatabaseCursor* cursor;
+  sqlite3_stmt *statement;
+  gint current_state;
+  gboolean dirty;
 };
 
-struct _RygelMediaExportDatabaseCursorIteratorClass {
-	GTypeClass parent_class;
-	void (*finalize) (RygelMediaExportDatabaseCursorIterator *self);
-};
-
-struct _RygelMediaExportDatabaseCursorParamSpecIterator {
-	GParamSpec parent_instance;
-};
-
-
-static gpointer rygel_media_export_database_cursor_iterator_parent_class = NULL;
-
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, RygelMediaExportDatabaseCursorPrivate))
-enum  {
-	RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_DUMMY_PROPERTY
-};
-GQuark rygel_media_export_database_error_quark (void);
-
-RygelMediaExportDatabaseCursor* rygel_media_export_database_cursor_construct (GType object_type, sqlite3* db, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
-RygelMediaExportSqliteWrapper* rygel_media_export_sqlite_wrapper_new_wrap (sqlite3* db);
-void rygel_media_export_sqlite_wrapper_throw_if_code_is_error (RygelMediaExportSqliteWrapper* self, gint sqlite_error, GError** error);
-void rygel_media_export_sqlite_wrapper_throw_if_db_has_error (RygelMediaExportSqliteWrapper* self, GError** error);
-gboolean rygel_media_export_database_cursor_has_next (RygelMediaExportDatabaseCursor* self);
-sqlite3_stmt* rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor* self, GError** error);
-gpointer rygel_media_export_database_cursor_iterator_ref (gpointer instance);
-void rygel_media_export_database_cursor_iterator_unref (gpointer instance);
-GParamSpec* rygel_media_export_database_cursor_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void rygel_media_export_database_cursor_value_set_iterator (GValue* value, gpointer v_object);
-void rygel_media_export_database_cursor_value_take_iterator (GValue* value, gpointer v_object);
-gpointer rygel_media_export_database_cursor_value_get_iterator (const GValue* value);
-GType rygel_media_export_database_cursor_iterator_get_type (void) G_GNUC_CONST;
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator (RygelMediaExportDatabaseCursor* self);
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator_new (RygelMediaExportDatabaseCursor* cursor);
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator_construct (GType object_type, RygelMediaExportDatabaseCursor* cursor);
-enum  {
-	RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_DUMMY_PROPERTY
-};
-gboolean rygel_media_export_database_cursor_iterator_next (RygelMediaExportDatabaseCursorIterator* self);
-sqlite3_stmt* rygel_media_export_database_cursor_iterator_get (RygelMediaExportDatabaseCursorIterator* self, GError** error);
-static void rygel_media_export_database_cursor_iterator_finalize (RygelMediaExportDatabaseCursorIterator* obj);
-static void rygel_media_export_database_cursor_finalize (GObject* obj);
-
+#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_GET_PRIVATE(o) \
+  (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+                                RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, \
+                                RygelMediaExportDatabaseCursorPrivate))
 
 /**
-     * Prepare a SQLite statement from a SQL string
-     *
-     * This function uses the type of the GValue passed in values to determine
-     * which _bind function to use.
-     *
-     * Supported types are: int, long, int64, uint64, string and pointer.
-     * @note the only pointer supported is the null pointer as provided by
-     * Database  null  This is a special value to bind a column to NULL
-     *
-     * @param db SQLite database this cursor belongs to
-     * @param sql statement to execute
-     * @param values array of values to bind to the SQL statement or null if
-     * none
-     */
-RygelMediaExportDatabaseCursor* rygel_media_export_database_cursor_construct (GType object_type, sqlite3* db, const gchar* sql, GValue* arguments, int arguments_length1, GError** error) {
-	RygelMediaExportDatabaseCursor * self = NULL;
-	sqlite3* _tmp0_;
-	sqlite3* _tmp1_;
-	const gchar* _tmp2_;
-	sqlite3_stmt* _tmp3_ = NULL;
-	gint _tmp4_ = 0;
-	GValue* _tmp5_;
-	gint _tmp5__length1;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (db != NULL, NULL);
-	g_return_val_if_fail (sql != NULL, NULL);
-	_tmp0_ = db;
-	self = (RygelMediaExportDatabaseCursor*) g_object_new (object_type, "db", _tmp0_, NULL);
-	_tmp1_ = db;
-	_tmp2_ = sql;
-	_tmp4_ = sqlite3_prepare_v2 (_tmp1_, _tmp2_, -1, &_tmp3_, NULL);
-	sqlite3_finalize (self->priv->statement);
-	self->priv->statement = _tmp3_;
-	rygel_media_export_sqlite_wrapper_throw_if_code_is_error ((RygelMediaExportSqliteWrapper*) self, _tmp4_, &_inner_error_);
-	if (_inner_error_ != NULL) {
-		if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
-			g_propagate_error (error, _inner_error_);
-			g_object_unref (self);
-			return NULL;
-		} else {
-			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-			g_clear_error (&_inner_error_);
-			return NULL;
-		}
-	}
-	_tmp5_ = arguments;
-	_tmp5__length1 = arguments_length1;
-	if (_tmp5_ == NULL) {
-		return self;
-	}
-	{
-		gint i;
-		i = 1;
-		{
-			gboolean _tmp6_;
-			_tmp6_ = TRUE;
-			while (TRUE) {
-				gboolean _tmp7_;
-				gint _tmp9_;
-				GValue* _tmp10_;
-				gint _tmp10__length1;
-				GValue* _tmp11_;
-				gint _tmp11__length1;
-				gint _tmp12_;
-				GValue _tmp13_;
-				GValue current_value;
-				gboolean _tmp14_ = FALSE;
-				_tmp7_ = _tmp6_;
-				if (!_tmp7_) {
-					gint _tmp8_;
-					_tmp8_ = i;
-					i = _tmp8_ + 1;
-				}
-				_tmp6_ = FALSE;
-				_tmp9_ = i;
-				_tmp10_ = arguments;
-				_tmp10__length1 = arguments_length1;
-				if (!(_tmp9_ <= _tmp10__length1)) {
-					break;
-				}
-				_tmp11_ = arguments;
-				_tmp11__length1 = arguments_length1;
-				_tmp12_ = i;
-				_tmp13_ = _tmp11_[_tmp12_ - 1];
-				current_value = _tmp13_;
-				_tmp14_ = G_VALUE_HOLDS (&current_value, G_TYPE_INT);
-				if (_tmp14_) {
-					sqlite3_stmt* _tmp15_;
-					gint _tmp16_;
-					gint _tmp17_ = 0;
-					_tmp15_ = self->priv->statement;
-					_tmp16_ = i;
-					_tmp17_ = g_value_get_int (&current_value);
-					sqlite3_bind_int (_tmp15_, _tmp16_, _tmp17_);
-				} else {
-					gboolean _tmp18_ = FALSE;
-					_tmp18_ = G_VALUE_HOLDS (&current_value, G_TYPE_INT64);
-					if (_tmp18_) {
-						sqlite3_stmt* _tmp19_;
-						gint _tmp20_;
-						gint64 _tmp21_ = 0LL;
-						_tmp19_ = self->priv->statement;
-						_tmp20_ = i;
-						_tmp21_ = g_value_get_int64 (&current_value);
-						sqlite3_bind_int64 (_tmp19_, _tmp20_, _tmp21_);
-					} else {
-						gboolean _tmp22_ = FALSE;
-						_tmp22_ = G_VALUE_HOLDS (&current_value, G_TYPE_UINT64);
-						if (_tmp22_) {
-							sqlite3_stmt* _tmp23_;
-							gint _tmp24_;
-							guint64 _tmp25_ = 0ULL;
-							_tmp23_ = self->priv->statement;
-							_tmp24_ = i;
-							_tmp25_ = g_value_get_uint64 (&current_value);
-							sqlite3_bind_int64 (_tmp23_, _tmp24_, (gint64) _tmp25_);
-						} else {
-							gboolean _tmp26_ = FALSE;
-							_tmp26_ = G_VALUE_HOLDS (&current_value, G_TYPE_LONG);
-							if (_tmp26_) {
-								sqlite3_stmt* _tmp27_;
-								gint _tmp28_;
-								glong _tmp29_ = 0L;
-								_tmp27_ = self->priv->statement;
-								_tmp28_ = i;
-								_tmp29_ = g_value_get_long (&current_value);
-								sqlite3_bind_int64 (_tmp27_, _tmp28_, (gint64) _tmp29_);
-							} else {
-								gboolean _tmp30_ = FALSE;
-								_tmp30_ = G_VALUE_HOLDS (&current_value, G_TYPE_STRING);
-								if (_tmp30_) {
-									sqlite3_stmt* _tmp31_;
-									gint _tmp32_;
-									const gchar* _tmp33_ = NULL;
-									gchar* _tmp34_;
-									GDestroyNotify _tmp35_;
-									_tmp31_ = self->priv->statement;
-									_tmp32_ = i;
-									_tmp33_ = g_value_get_string (&current_value);
-									_tmp34_ = g_strdup (_tmp33_);
-									_tmp35_ = g_free;
-									sqlite3_bind_text (_tmp31_, _tmp32_, _tmp34_, -1, _tmp35_);
-								} else {
-									gboolean _tmp36_ = FALSE;
-									_tmp36_ = G_VALUE_HOLDS (&current_value, G_TYPE_POINTER);
-									if (_tmp36_) {
-										void* _tmp37_ = NULL;
-										_tmp37_ = g_value_peek_pointer (&current_value);
-										if (_tmp37_ == NULL) {
-											sqlite3_stmt* _tmp38_;
-											gint _tmp39_;
-											_tmp38_ = self->priv->statement;
-											_tmp39_ = i;
-											sqlite3_bind_null (_tmp38_, _tmp39_);
-										} else {
-											g_assert_not_reached ();
-										}
-									} else {
-										GType _tmp40_ = 0UL;
-										GType type;
-										const gchar* _tmp41_ = NULL;
-										const gchar* _tmp42_ = NULL;
-										_tmp40_ = G_VALUE_TYPE (&current_value);
-										type = _tmp40_;
-										_tmp41_ = _ ("Unsupported type %s");
-										_tmp42_ = g_type_name (type);
-										g_warning (_tmp41_, _tmp42_);
-										g_assert_not_reached ();
-									}
-								}
-							}
-						}
-					}
-				}
-				rygel_media_export_sqlite_wrapper_throw_if_db_has_error ((RygelMediaExportSqliteWrapper*) self, &_inner_error_);
-				if (_inner_error_ != NULL) {
-					if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
-						g_propagate_error (error, _inner_error_);
-						g_object_unref (self);
-						return NULL;
-					} else {
-						g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-						g_clear_error (&_inner_error_);
-						return NULL;
-					}
-				}
-			}
-		}
-	}
-	return self;
-}
-
-
-RygelMediaExportDatabaseCursor* rygel_media_export_database_cursor_new (sqlite3* db, const gchar* sql, GValue* arguments, int arguments_length1, GError** error) {
-	return rygel_media_export_database_cursor_construct (RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, db, sql, arguments, arguments_length1, error);
+ * Prepare a SQLite statement from a SQL string
+ *
+ * This function uses the type of the GValue passed in values to determine
+ * which _bind function to use.
+ *
+ * Supported types are: int, long, int64, uint64, string and pointer.
+ * @note the only pointer supported is the null pointer as provided by
+ * Database  null  This is a special value to bind a column to NULL
+ *
+ * @param db SQLite database this cursor belongs to
+ * @param sql statement to execute
+ * @param values array of values to bind to the SQL statement or null if
+ * none
+ */
+RygelMediaExportDatabaseCursor *
+rygel_media_export_database_cursor_new (sqlite3      *db,
+                                        const gchar  *sql,
+                                        GValue       *arguments,
+                                        int           arguments_length,
+                                        GError      **error) {
+  RygelMediaExportDatabaseCursor *self;
+  RygelMediaExportSqliteWrapper *self_wrapper;
+  GError *inner_error = NULL;
+  gint iter;
+
+  g_return_val_if_fail (db != NULL, NULL);
+  g_return_val_if_fail (sql != NULL, NULL);
+
+  self = RYGEL_MEDIA_EXPORT_DATABASE_CURSOR (g_object_new (RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR,
+                                                           "db", db,
+                                                           NULL));
+  _tmp4_ = ;
+  rygel_media_export_sqlite_wrapper_throw_if_code_is_error (self_wrapper,
+                                                            sqlite3_prepare_v2 (db, sql, -1, &self->priv->statement, NULL),
+                                                            &inner_error);
+  if (inner_error) {
+    g_propagate_error (error, inner_error);
+    g_object_unref (self);
+    return NULL;
+  }
+  if (!arguments) {
+    return self;
+  }
+  for (iter = 1; iter <= arguments_length; ++iter) {
+    GValue *current_value = &(arguments[iter - 1]);
+    sqlite3_stmt* stmt;
+
+    if (G_VALUE_HOLDS (current_value, G_TYPE_INT)) {
+      sqlite3_bind_int (stmt, iter, g_value_get_int (current_value));
+    } else if (G_VALUE_HOLDS (current_value, G_TYPE_INT64)) {
+      sqlite3_bind_int64 (stmt, iter, g_value_get_int64 (current_value));
+    } else if (G_VALUE_HOLDS (current_value, G_TYPE_UINT64)) {
+      sqlite3_bind_int64 (stmt, iter, (gint64) g_value_get_uint64 (current_value));
+    } else if (G_VALUE_HOLDS (current_value, G_TYPE_LONG)) {
+      sqlite3_bind_int64 (stmt, iter, (gint64) g_value_get_long (current_value));
+    } else if (G_VALUE_HOLDS (current_value, G_TYPE_STRING)) {
+      sqlite3_bind_text (stmt, iter, g_value_dup_string (current_value), -1, g_free);
+    } else if (G_VALUE_HOLDS (current_value, G_TYPE_POINTER)) {
+      if (g_value_peek_pointer (current_value) == NULL) {
+        sqlite3_bind_null (stmt, iter);
+      } else {
+        g_assert_not_reached ();
+      }
+    } else {
+      g_warning (_("Unsupported type %s"), G_VALUE_TYPE_NAME (current_value));
+      g_assert_not_reached ();
+    }
+
+    rygel_media_export_sqlite_wrapper_throw_if_db_has_error (self_wrapper,
+                                                             &inner_error);
+    if (inner_error != NULL) {
+      g_propagate_error (error, inner_error);
+      g_object_unref (self);
+      return NULL;
+    }
+  }
+
+  return self;
 }
 
-
 /**
-     * Check if the cursor has more rows left
-     *
-     * @return true if more rows left, false otherwise
-     */
-gboolean rygel_media_export_database_cursor_has_next (RygelMediaExportDatabaseCursor* self) {
-	gboolean result = FALSE;
-	gboolean _tmp0_;
-	gboolean _tmp3_ = FALSE;
-	gint _tmp4_;
-	gboolean _tmp6_;
-	g_return_val_if_fail (self != NULL, FALSE);
-	_tmp0_ = self->priv->dirty;
-	if (_tmp0_) {
-		sqlite3_stmt* _tmp1_;
-		gint _tmp2_ = 0;
-		_tmp1_ = self->priv->statement;
-		_tmp2_ = sqlite3_step (_tmp1_);
-		self->priv->current_state = _tmp2_;
-		self->priv->dirty = FALSE;
-	}
-	_tmp4_ = self->priv->current_state;
-	if (_tmp4_ == SQLITE_ROW) {
-		_tmp3_ = TRUE;
-	} else {
-		gint _tmp5_;
-		_tmp5_ = self->priv->current_state;
-		_tmp3_ = _tmp5_ == (-1);
-	}
-	_tmp6_ = _tmp3_;
-	result = _tmp6_;
-	return result;
-}
+ * Check if the cursor has more rows left
+ *
+ * @return true if more rows left, false otherwise
+ */
+gboolean
+rygel_media_export_database_cursor_has_next (RygelMediaExportDatabaseCursor *self) {
+  RygelMediaExportDatabaseCursorPrivate *priv;
 
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_DATABASE_CURSOR (self), FALSE);
 
-/**
-     * Get the next row of this cursor.
-     *
-     * This function uses pointers instead of unowned because var doesn't work
-     * with unowned.
-     *
-     * @return a pointer to the current row
-     */
-sqlite3_stmt* rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor* self, GError** error) {
-	sqlite3_stmt* result = NULL;
-	gint _tmp0_;
-	sqlite3_stmt* _tmp1_;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (self != NULL, NULL);
-	rygel_media_export_database_cursor_has_next (self);
-	_tmp0_ = self->priv->current_state;
-	rygel_media_export_sqlite_wrapper_throw_if_code_is_error ((RygelMediaExportSqliteWrapper*) self, _tmp0_, &_inner_error_);
-	if (_inner_error_ != NULL) {
-		if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
-			g_propagate_error (error, _inner_error_);
-			return NULL;
-		} else {
-			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-			g_clear_error (&_inner_error_);
-			return NULL;
-		}
-	}
-	self->priv->dirty = TRUE;
-	_tmp1_ = self->priv->statement;
-	result = _tmp1_;
-	return result;
+  priv = self->priv;
+  if (priv->dirty) {
+    priv->current_state = sqlite3_step (priv->statement);
+    priv->dirty = FALSE;
+  }
+  return ((priv->current_state == SQLITE_ROW) || (priv->current_state == -1));
 }
 
 
 /**
-     * Return a iterator to the cursor to use with foreach
-     *
-     * @return an iterator wrapping the cursor
-     */
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator (RygelMediaExportDatabaseCursor* self) {
-	RygelMediaExportDatabaseCursorIterator* result = NULL;
-	RygelMediaExportDatabaseCursorIterator* _tmp0_;
-	g_return_val_if_fail (self != NULL, NULL);
-	_tmp0_ = rygel_media_export_database_cursor_iterator_new (self);
-	result = _tmp0_;
-	return result;
-}
-
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator_construct (GType object_type, RygelMediaExportDatabaseCursor* cursor) {
-	RygelMediaExportDatabaseCursorIterator* self = NULL;
-	RygelMediaExportDatabaseCursor* _tmp0_;
-	RygelMediaExportDatabaseCursor* _tmp1_;
-	g_return_val_if_fail (cursor != NULL, NULL);
-	self = (RygelMediaExportDatabaseCursorIterator*) g_type_create_instance (object_type);
-	_tmp0_ = cursor;
-	_tmp1_ = g_object_ref (_tmp0_);
-	g_object_unref (self->cursor);
-	self->cursor = _tmp1_;
-	return self;
-}
-
-
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator_new (RygelMediaExportDatabaseCursor* cursor) {
-	return rygel_media_export_database_cursor_iterator_construct (RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, cursor);
-}
-
-
-gboolean rygel_media_export_database_cursor_iterator_next (RygelMediaExportDatabaseCursorIterator* self) {
-	gboolean result = FALSE;
-	RygelMediaExportDatabaseCursor* _tmp0_;
-	gboolean _tmp1_ = FALSE;
-	g_return_val_if_fail (self != NULL, FALSE);
-	_tmp0_ = self->cursor;
-	_tmp1_ = rygel_media_export_database_cursor_has_next (_tmp0_);
-	result = _tmp1_;
-	return result;
-}
-
-
-sqlite3_stmt* rygel_media_export_database_cursor_iterator_get (RygelMediaExportDatabaseCursorIterator* self, GError** error) {
-	sqlite3_stmt* result = NULL;
-	RygelMediaExportDatabaseCursor* _tmp0_;
-	sqlite3_stmt* _tmp1_ = NULL;
-	sqlite3_stmt* _tmp2_;
-	GError * _inner_error_ = NULL;
-	g_return_val_if_fail (self != NULL, NULL);
-	_tmp0_ = self->cursor;
-	_tmp1_ = rygel_media_export_database_cursor_next (_tmp0_, &_inner_error_);
-	_tmp2_ = _tmp1_;
-	if (_inner_error_ != NULL) {
-		if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
-			g_propagate_error (error, _inner_error_);
-			return NULL;
-		} else {
-			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
-			g_clear_error (&_inner_error_);
-			return NULL;
-		}
-	}
-	result = _tmp2_;
-	return result;
-}
-
-
-static void rygel_media_export_database_cursor_value_iterator_init (GValue* value) {
-	value->data[0].v_pointer = NULL;
-}
-
-
-static void rygel_media_export_database_cursor_value_iterator_free_value (GValue* value) {
-	if (value->data[0].v_pointer) {
-		rygel_media_export_database_cursor_iterator_unref (value->data[0].v_pointer);
-	}
-}
-
-
-static void rygel_media_export_database_cursor_value_iterator_copy_value (const GValue* src_value, GValue* dest_value) {
-	if (src_value->data[0].v_pointer) {
-		dest_value->data[0].v_pointer = rygel_media_export_database_cursor_iterator_ref (src_value->data[0].v_pointer);
-	} else {
-		dest_value->data[0].v_pointer = NULL;
-	}
-}
-
-
-static gpointer rygel_media_export_database_cursor_value_iterator_peek_pointer (const GValue* value) {
-	return value->data[0].v_pointer;
-}
-
-
-static gchar* rygel_media_export_database_cursor_value_iterator_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-	if (collect_values[0].v_pointer) {
-		RygelMediaExportDatabaseCursorIterator* object;
-		object = collect_values[0].v_pointer;
-		if (object->parent_instance.g_class == NULL) {
-			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
-			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
-		}
-		value->data[0].v_pointer = rygel_media_export_database_cursor_iterator_ref (object);
-	} else {
-		value->data[0].v_pointer = NULL;
-	}
-	return NULL;
-}
-
-
-static gchar* rygel_media_export_database_cursor_value_iterator_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
-	RygelMediaExportDatabaseCursorIterator** object_p;
-	object_p = collect_values[0].v_pointer;
-	if (!object_p) {
-		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
-	}
-	if (!value->data[0].v_pointer) {
-		*object_p = NULL;
-	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
-		*object_p = value->data[0].v_pointer;
-	} else {
-		*object_p = rygel_media_export_database_cursor_iterator_ref (value->data[0].v_pointer);
-	}
-	return NULL;
-}
-
-
-GParamSpec* rygel_media_export_database_cursor_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
-	RygelMediaExportDatabaseCursorParamSpecIterator* spec;
-	g_return_val_if_fail (g_type_is_a (object_type, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR), NULL);
-	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
-	G_PARAM_SPEC (spec)->value_type = object_type;
-	return G_PARAM_SPEC (spec);
-}
-
-
-gpointer rygel_media_export_database_cursor_value_get_iterator (const GValue* value) {
-	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR), NULL);
-	return value->data[0].v_pointer;
-}
-
-
-void rygel_media_export_database_cursor_value_set_iterator (GValue* value, gpointer v_object) {
-	RygelMediaExportDatabaseCursorIterator* old;
-	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR));
-	old = value->data[0].v_pointer;
-	if (v_object) {
-		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR));
-		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-		value->data[0].v_pointer = v_object;
-		rygel_media_export_database_cursor_iterator_ref (value->data[0].v_pointer);
-	} else {
-		value->data[0].v_pointer = NULL;
-	}
-	if (old) {
-		rygel_media_export_database_cursor_iterator_unref (old);
-	}
-}
-
-
-void rygel_media_export_database_cursor_value_take_iterator (GValue* value, gpointer v_object) {
-	RygelMediaExportDatabaseCursorIterator* old;
-	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR));
-	old = value->data[0].v_pointer;
-	if (v_object) {
-		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR));
-		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
-		value->data[0].v_pointer = v_object;
-	} else {
-		value->data[0].v_pointer = NULL;
-	}
-	if (old) {
-		rygel_media_export_database_cursor_iterator_unref (old);
-	}
-}
-
-
-static void rygel_media_export_database_cursor_iterator_class_init (RygelMediaExportDatabaseCursorIteratorClass * klass) {
-	rygel_media_export_database_cursor_iterator_parent_class = g_type_class_peek_parent (klass);
-	RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_CLASS (klass)->finalize = rygel_media_export_database_cursor_iterator_finalize;
-}
-
-
-static void rygel_media_export_database_cursor_iterator_init (RygelMediaExportDatabaseCursorIterator * self) {
-	self->ref_count = 1;
-}
-
-
-static void rygel_media_export_database_cursor_iterator_finalize (RygelMediaExportDatabaseCursorIterator* obj) {
-	RygelMediaExportDatabaseCursorIterator * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIterator);
-	g_object_unref (self->cursor);
-}
-
-
-GType rygel_media_export_database_cursor_iterator_get_type (void) {
-	static volatile gsize rygel_media_export_database_cursor_iterator_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_media_export_database_cursor_iterator_type_id__volatile)) {
-		static const GTypeValueTable g_define_type_value_table = { rygel_media_export_database_cursor_value_iterator_init, rygel_media_export_database_cursor_value_iterator_free_value, rygel_media_export_database_cursor_value_iterator_copy_value, rygel_media_export_database_cursor_value_iterator_peek_pointer, "p", rygel_media_export_database_cursor_value_iterator_collect_value, "p", rygel_media_export_database_cursor_value_iterator_lcopy_value };
-		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportDatabaseCursorIteratorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_database_cursor_iterator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportDatabaseCursorIterator), 0, (GInstanceInitFunc) rygel_media_export_database_cursor_iterator_init, &g_define_type_value_table };
-		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
-		GType rygel_media_export_database_cursor_iterator_type_id;
-		rygel_media_export_database_cursor_iterator_type_id = g_type_register_fundamental (g_type_fundamental_next (), "RygelMediaExportDatabaseCursorIterator", &g_define_type_info, &g_define_type_fundamental_info, 0);
-		g_once_init_leave (&rygel_media_export_database_cursor_iterator_type_id__volatile, rygel_media_export_database_cursor_iterator_type_id);
-	}
-	return rygel_media_export_database_cursor_iterator_type_id__volatile;
-}
-
-
-gpointer rygel_media_export_database_cursor_iterator_ref (gpointer instance) {
-	RygelMediaExportDatabaseCursorIterator* self;
-	self = instance;
-	g_atomic_int_inc (&self->ref_count);
-	return instance;
-}
+ * Get the next row of this cursor.
+ *
+ * This function uses pointers instead of unowned because var doesn't work
+ * with unowned.
+ *
+ * @return a pointer to the current row
+ */
+sqlite3_stmt *
+rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor  *self,
+                                         GError                         **error) {
+  GError *inner_error = NULL;
 
+  g_return_val_if_fail (RYGEL_MEDIA_EXPORT_IS_DATABASE_CURSOR (self), NULL);
 
-void rygel_media_export_database_cursor_iterator_unref (gpointer instance) {
-	RygelMediaExportDatabaseCursorIterator* self;
-	self = instance;
-	if (g_atomic_int_dec_and_test (&self->ref_count)) {
-		RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_GET_CLASS (self)->finalize (self);
-		g_type_free_instance ((GTypeInstance *) self);
-	}
+  rygel_media_export_database_cursor_has_next (self);
+  rygel_media_export_sqlite_wrapper_throw_if_code_is_error (RYGEL_MEDIA_EXPORT_SQLITE_WRAPPER (self),
+                                                            self->priv->current_state,
+                                                            &inner_error);
+  if (inner_error != NULL) {
+    g_propagate_error (error, inner_error);
+    return NULL;
+  }
+  self->priv->dirty = TRUE;
+  return self->priv->statement;
 }
 
+static void rygel_media_export_database_cursor_finalize (GObject *object) {
+  RygelMediaExportDatabaseCursor *self = RYGEL_MEDIA_EXPORT_DATABASE_CURSOR (object);
 
-static void rygel_media_export_database_cursor_class_init (RygelMediaExportDatabaseCursorClass * klass) {
-	rygel_media_export_database_cursor_parent_class = g_type_class_peek_parent (klass);
-	g_type_class_add_private (klass, sizeof (RygelMediaExportDatabaseCursorPrivate));
-	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_database_cursor_finalize;
+  sqlite3_finalize (self->priv->statement);
+  G_OBJECT_CLASS (rygel_media_export_database_cursor_parent_class)->finalize (object);
 }
 
+static void
+rygel_media_export_database_cursor_class_init (RygelMediaExportDatabaseCursorClass *cursor_class) {
+  GObjectClass *object_class = G_OBJECT_CLASS (cursor_class);
 
-static void rygel_media_export_database_cursor_init (RygelMediaExportDatabaseCursor * self) {
-	self->priv = RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_GET_PRIVATE (self);
-	self->priv->current_state = -1;
-	self->priv->dirty = TRUE;
+  object_class->finalize = rygel_media_export_database_cursor_finalize;
+  g_type_class_add_private (cursor_class,
+                            sizeof (RygelMediaExportDatabaseCursorPrivate));
 }
 
-
-static void rygel_media_export_database_cursor_finalize (GObject* obj) {
-	RygelMediaExportDatabaseCursor * self;
-	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_DATABASE_CURSOR, RygelMediaExportDatabaseCursor);
-	sqlite3_finalize (self->priv->statement);
-	G_OBJECT_CLASS (rygel_media_export_database_cursor_parent_class)->finalize (obj);
+static void
+rygel_media_export_database_cursor_init (RygelMediaExportDatabaseCursor *self) {
+  self->priv = RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_GET_PRIVATE (self);
+  self->priv->current_state = -1;
+  self->priv->dirty = TRUE;
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-database-cursor.h b/src/media-export/rygel-media-export-database-cursor.h
index b4f6ba9..e1cb77b 100644
--- a/src/media-export/rygel-media-export-database-cursor.h
+++ b/src/media-export/rygel-media-export-database-cursor.h
@@ -57,6 +57,15 @@ rygel_media_export_database_cursor_new (sqlite3      *db,
                                         int           arguments_length,
                                         GError      **error);
 
+gboolean
+rygel_media_export_database_cursor_has_next (RygelMediaExportDatabaseCursor *self);
+
+sqlite3_stmt *
+rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor  *self,
+                                         GError                         **error);
+
+
+
 G_END_DECLS
 
 #endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_DATABASE_CURSOR_H__ */
diff --git a/src/media-export/rygel-media-export-database.c b/src/media-export/rygel-media-export-database.c
index db54bc5..a57ee9c 100644
--- a/src/media-export/rygel-media-export-database.c
+++ b/src/media-export/rygel-media-export-database.c
@@ -40,12 +40,6 @@ static void rygel_media_export_database_utf8_contains (sqlite3_context* context,
 static gint rygel_media_export_database_utf8_collate (gint alen, void* a, gint blen, void* b);
 static void _rygel_media_export_database_utf8_contains_sqlite_user_func_callback (sqlite3_context* context, int values_length1, sqlite3_value** values);
 static gint _rygel_media_export_database_utf8_collate_sqlite_compare_callback (gpointer self, gint alen, void* a, gint blen, void* b);
-GType rygel_media_export_database_cursor_get_type (void) G_GNUC_CONST;
-RygelMediaExportDatabaseCursor* rygel_media_export_database_cursor_new (sqlite3* db, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
-gboolean rygel_media_export_database_cursor_has_next (RygelMediaExportDatabaseCursor* self);
-sqlite3_stmt* rygel_media_export_database_cursor_next (RygelMediaExportDatabaseCursor* self, GError** error);
-
-
 
 /**
  * Function to implement the custom SQL function 'contains'
diff --git a/src/media-export/rygel-media-export-errors.c b/src/media-export/rygel-media-export-errors.c
index 8d59ff3..6f494d3 100644
--- a/src/media-export/rygel-media-export-errors.c
+++ b/src/media-export/rygel-media-export-errors.c
@@ -23,5 +23,10 @@
 
 GQuark
 rygel_media_export_database_error_quark (void) {
-  return g_quark_from_static_string ("rygel_media_export_database_error-quark");
+  return g_quark_from_static_string ("rygel-media-export-database-error-quark");
+}
+
+GQuark
+rygel_media_export_media_cache_error_quark (void) {
+  return g_quark_from_static_string ("rygel-media-export-media-cache-error-quark");
 }
diff --git a/src/media-export/rygel-media-export-errors.h b/src/media-export/rygel-media-export-errors.h
index eb951f9..93dfb43 100644
--- a/src/media-export/rygel-media-export-errors.h
+++ b/src/media-export/rygel-media-export-errors.h
@@ -35,6 +35,16 @@ typedef enum  {
 GQuark
 rygel_media_export_database_error_quark (void);
 
+typedef enum  {
+	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_SQLITE_ERROR,
+	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_GENERAL_ERROR,
+	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_INVALID_TYPE,
+	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH
+} RygelMediaExportMediaCacheError;
+#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR rygel_media_export_media_cache_error_quark ()
+GQuark
+rygel_media_export_media_cache_error_quark (void);
+
 G_END_DECLS
 
 #endif /* __RYGEL_0_10_PLUGINS_MEDIA_EXPORT_ERRORS_H__ */
diff --git a/src/media-export/rygel-media-export-media-cache-upgrader.c b/src/media-export/rygel-media-export-media-cache-upgrader.c
index 52a9675..ea52ca2 100644
--- a/src/media-export/rygel-media-export-media-cache-upgrader.c
+++ b/src/media-export/rygel-media-export-media-cache-upgrader.c
@@ -1,6 +1,3 @@
-/* rygel-media-export-media-cache-upgrader.c generated by valac 0.18.1, the Vala compiler
- * generated from rygel-media-export-media-cache-upgrader.vala, do not modify */
-
 /*
  * Copyright (C) 2010 Jens Georg <mail jensge org>.
  * Copyright (C) 2012 Intel Corporation.
@@ -45,16 +42,6 @@ typedef struct _RygelMediaExportSQLFactoryClass RygelMediaExportSQLFactoryClass;
 
 #define RYGEL_MEDIA_EXPORT_TYPE_SQL_STRING (rygel_media_export_sql_string_get_type ())
 
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR (rygel_media_export_database_cursor_iterator_get_type ())
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIterator))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-
-typedef struct _RygelMediaExportDatabaseCursorIterator RygelMediaExportDatabaseCursorIterator;
-typedef struct _RygelMediaExportDatabaseCursorIteratorClass RygelMediaExportDatabaseCursorIteratorClass;
-#define _rygel_media_export_database_cursor_iterator_unref0(var) ((var == NULL) ? NULL : (var = (rygel_media_export_database_cursor_iterator_unref (var), NULL)))
 typedef struct _RygelMediaExportParamSpecMediaCacheUpgrader RygelMediaExportParamSpecMediaCacheUpgrader;
 
 struct _RygelMediaExportMediaCacheUpgraderPrivate {
@@ -136,16 +123,6 @@ static void rygel_media_export_media_cache_upgrader_force_reindex (RygelMediaExp
 GType rygel_media_export_database_cursor_get_type (void) G_GNUC_CONST;
 RygelMediaExportDatabaseCursor* rygel_media_export_database_exec_cursor (RygelMediaExportDatabase* self, const gchar* sql, GValue* arguments, int arguments_length1, GError** error);
 static void _vala_GValue_array_free (GValue* array, gint array_length);
-gpointer rygel_media_export_database_cursor_iterator_ref (gpointer instance);
-void rygel_media_export_database_cursor_iterator_unref (gpointer instance);
-GParamSpec* rygel_media_export_database_cursor_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void rygel_media_export_database_cursor_value_set_iterator (GValue* value, gpointer v_object);
-void rygel_media_export_database_cursor_value_take_iterator (GValue* value, gpointer v_object);
-gpointer rygel_media_export_database_cursor_value_get_iterator (const GValue* value);
-GType rygel_media_export_database_cursor_iterator_get_type (void) G_GNUC_CONST;
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator (RygelMediaExportDatabaseCursor* self);
-gboolean rygel_media_export_database_cursor_iterator_next (RygelMediaExportDatabaseCursorIterator* self);
-sqlite3_stmt* rygel_media_export_database_cursor_iterator_get (RygelMediaExportDatabaseCursorIterator* self, GError** error);
 #define RYGEL_MEDIA_EXPORT_QUERY_CONTAINER_PREFIX "virtual-container:"
 #define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_ID "Filesystem"
 #define RYGEL_MEDIA_EXPORT_ROOT_CONTAINER_FILESYSTEM_FOLDER_NAME "Files & Folders"
@@ -777,36 +754,26 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 			}
 			{
 				RygelMediaExportDatabaseCursor* _tmp25_;
-				RygelMediaExportDatabaseCursorIterator* _tmp26_ = NULL;
-				RygelMediaExportDatabaseCursorIterator* _statement_it;
 				_tmp25_ = cursor;
-				_tmp26_ = rygel_media_export_database_cursor_iterator (_tmp25_);
-				_statement_it = _tmp26_;
 				while (TRUE) {
-					RygelMediaExportDatabaseCursorIterator* _tmp27_;
 					gboolean _tmp28_ = FALSE;
-					RygelMediaExportDatabaseCursorIterator* _tmp29_;
 					sqlite3_stmt* _tmp30_ = NULL;
 					sqlite3_stmt* statement;
 					GeeQueue* _tmp31_;
 					sqlite3_stmt* _tmp32_;
 					const gchar* _tmp33_ = NULL;
-					_tmp27_ = _statement_it;
-					_tmp28_ = rygel_media_export_database_cursor_iterator_next (_tmp27_);
+					_tmp28_ = rygel_media_export_database_cursor_has_next (cursor);
 					if (!_tmp28_) {
 						break;
 					}
-					_tmp29_ = _statement_it;
-					_tmp30_ = rygel_media_export_database_cursor_iterator_get (_tmp29_, &_inner_error_);
+					_tmp30_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 					statement = _tmp30_;
 					if (_inner_error_ != NULL) {
-						_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 						g_object_unref (cursor);
 						args = (_vala_GValue_array_free (args, args_length1), NULL);
 						if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 							goto __catch15_rygel_media_export_database_error;
 						}
-						_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 						g_object_unref (cursor);
 						args = (_vala_GValue_array_free (args, args_length1), NULL);
 						g_object_unref (queue);
@@ -819,7 +786,6 @@ static void rygel_media_export_media_cache_upgrader_update_v4_v5 (RygelMediaExpo
 					_tmp33_ = sqlite3_column_text (_tmp32_, 0);
 					gee_queue_offer (_tmp31_, _tmp33_);
 				}
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 			}
 			_tmp34_ = self->priv->database;
 			_tmp35_ = args;
@@ -1789,37 +1755,27 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 			}
 			{
 				RygelMediaExportDatabaseCursor* _tmp38_;
-				RygelMediaExportDatabaseCursorIterator* _tmp39_ = NULL;
-				RygelMediaExportDatabaseCursorIterator* _statement_it;
 				_tmp38_ = cursor;
-				_tmp39_ = rygel_media_export_database_cursor_iterator (_tmp38_);
-				_statement_it = _tmp39_;
 				while (TRUE) {
-					RygelMediaExportDatabaseCursorIterator* _tmp40_;
 					gboolean _tmp41_ = FALSE;
-					RygelMediaExportDatabaseCursorIterator* _tmp42_;
 					sqlite3_stmt* _tmp43_ = NULL;
 					sqlite3_stmt* statement;
 					GeeLinkedList* _tmp44_;
 					sqlite3_stmt* _tmp45_;
 					const gchar* _tmp46_ = NULL;
-					_tmp40_ = _statement_it;
-					_tmp41_ = rygel_media_export_database_cursor_iterator_next (_tmp40_);
+					_tmp41_ = rygel_media_export_database_cursor_has_next (cursor);
 					if (!_tmp41_) {
 						break;
 					}
-					_tmp42_ = _statement_it;
-					_tmp43_ = rygel_media_export_database_cursor_iterator_get (_tmp42_, &_inner_error_);
+					_tmp43_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 					statement = _tmp43_;
 					if (_inner_error_ != NULL) {
-						_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 						g_object_unref (cursor);
 						args = (_vala_GValue_array_free (args, args_length1), NULL);
 						g_object_unref (queue);
 						if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 							goto __catch20_rygel_media_export_database_error;
 						}
-						_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 						g_object_unref (cursor);
 						args = (_vala_GValue_array_free (args, args_length1), NULL);
 						g_object_unref (queue);
@@ -1832,7 +1788,6 @@ static void rygel_media_export_media_cache_upgrader_update_v9_v10 (RygelMediaExp
 					_tmp46_ = sqlite3_column_text (_tmp45_, 0);
 					gee_queue_offer ((GeeQueue*) _tmp44_, _tmp46_);
 				}
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 			}
 			_tmp47_ = self->priv->database;
 			_tmp48_ = args;
diff --git a/src/media-export/rygel-media-export-media-cache.c b/src/media-export/rygel-media-export-media-cache.c
index 9423888..330b707 100644
--- a/src/media-export/rygel-media-export-media-cache.c
+++ b/src/media-export/rygel-media-export-media-cache.c
@@ -30,7 +30,9 @@
  *  MediaExportDB is a sqlite3 backed persistent storage of media objects
  */
 
-G_DEFINE_TYPE (RygelMediaExportMediaCache, rygel_media_export_media_cache, G_TYPE_OBJECT)
+G_DEFINE_TYPE (RygelMediaExportMediaCache,
+	       rygel_media_export_media_cache,
+	       G_TYPE_OBJECT)
 
 
 
@@ -71,16 +73,6 @@ typedef struct _RygelMediaExportSQLFactoryClass RygelMediaExportSQLFactoryClass;
 typedef struct _RygelMediaExportDatabaseCursor RygelMediaExportDatabaseCursor;
 typedef struct _RygelMediaExportDatabaseCursorClass RygelMediaExportDatabaseCursorClass;
 
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR (rygel_media_export_database_cursor_iterator_get_type ())
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIterator))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_IS_ITERATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR))
-#define RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_ITERATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_DATABASE_CURSOR_TYPE_ITERATOR, RygelMediaExportDatabaseCursorIteratorClass))
-
-typedef struct _RygelMediaExportDatabaseCursorIterator RygelMediaExportDatabaseCursorIterator;
-typedef struct _RygelMediaExportDatabaseCursorIteratorClass RygelMediaExportDatabaseCursorIteratorClass;
-#define _rygel_media_export_database_cursor_iterator_unref0(var) ((var == NULL) ? NULL : (var = (rygel_media_export_database_cursor_iterator_unref (var), NULL)))
 #define _rygel_media_export_exists_cache_entry_free0(var) ((var == NULL) ? NULL : (var = (rygel_media_export_exists_cache_entry_free (var), NULL)))
 #define _g_value_array_free0(var) ((var == NULL) ? NULL : (var = (g_value_array_free (var), NULL)))
 #define __vala_GValue_free0(var) ((var == NULL) ? NULL : (var = (_vala_GValue_free (var), NULL)))
@@ -282,16 +274,6 @@ static void rygel_media_export_media_cache_save_metadata (RygelMediaExportMediaC
 RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMediaCache* self, const gchar* object_id, GError** error);
 GType rygel_media_export_database_cursor_get_type (void) G_GNUC_CONST;
 static RygelMediaExportDatabaseCursor* rygel_media_export_media_cache_exec_cursor (RygelMediaExportMediaCache* self, RygelMediaExportSQLString id, GValue* values, int values_length1, GError** error);
-gpointer rygel_media_export_database_cursor_iterator_ref (gpointer instance);
-void rygel_media_export_database_cursor_iterator_unref (gpointer instance);
-GParamSpec* rygel_media_export_database_cursor_param_spec_iterator (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
-void rygel_media_export_database_cursor_value_set_iterator (GValue* value, gpointer v_object);
-void rygel_media_export_database_cursor_value_take_iterator (GValue* value, gpointer v_object);
-gpointer rygel_media_export_database_cursor_value_get_iterator (const GValue* value);
-GType rygel_media_export_database_cursor_iterator_get_type (void) G_GNUC_CONST;
-RygelMediaExportDatabaseCursorIterator* rygel_media_export_database_cursor_iterator (RygelMediaExportDatabaseCursor* self);
-gboolean rygel_media_export_database_cursor_iterator_next (RygelMediaExportDatabaseCursorIterator* self);
-sqlite3_stmt* rygel_media_export_database_cursor_iterator_get (RygelMediaExportDatabaseCursorIterator* self, GError** error);
 static RygelMediaObject* rygel_media_export_media_cache_get_object_from_statement (RygelMediaExportMediaCache* self, RygelMediaContainer* parent, sqlite3_stmt* statement);
 RygelMediaContainer* rygel_media_export_media_cache_get_container (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
 gint rygel_media_export_media_cache_get_child_count (RygelMediaExportMediaCache* self, const gchar* container_id, GError** error);
@@ -749,15 +731,9 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp5_;
-		RygelMediaExportDatabaseCursorIterator* _tmp6_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp5_ = cursor;
-		_tmp6_ = rygel_media_export_database_cursor_iterator (_tmp5_);
-		_statement_it = _tmp6_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp7_;
 			gboolean _tmp8_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp9_;
 			sqlite3_stmt* _tmp10_ = NULL;
 			sqlite3_stmt* statement;
 			RygelMediaObject* _tmp11_;
@@ -771,24 +747,20 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 			RygelMediaContainer* _tmp17_;
 			RygelMediaObject* _tmp18_;
 			RygelMediaObject* _tmp19_;
-			_tmp7_ = _statement_it;
-			_tmp8_ = rygel_media_export_database_cursor_iterator_next (_tmp7_);
+			_tmp8_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp8_) {
 				break;
 			}
-			_tmp9_ = _statement_it;
-			_tmp10_ = rygel_media_export_database_cursor_iterator_get (_tmp9_, &_inner_error_);
+			_tmp10_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp10_;
 			if (_inner_error_ != NULL) {
 				if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 					g_propagate_error (error, _inner_error_);
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					g_object_unref (parent);
 					values = (_vala_GValue_array_free (values, values_length1), NULL);
 					return NULL;
 				} else {
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					g_object_unref (parent);
 					values = (_vala_GValue_array_free (values, values_length1), NULL);
@@ -814,7 +786,6 @@ RygelMediaObject* rygel_media_export_media_cache_get_object (RygelMediaExportMed
 			g_object_unref (object);
 			g_object_unref (parent_container);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = parent;
 	g_object_unref (cursor);
@@ -1150,15 +1121,9 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp23_;
-		RygelMediaExportDatabaseCursorIterator* _tmp24_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp23_ = cursor;
-		_tmp24_ = rygel_media_export_database_cursor_iterator (_tmp23_);
-		_statement_it = _tmp24_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp25_;
 			gboolean _tmp26_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp27_;
 			sqlite3_stmt* _tmp28_ = NULL;
 			sqlite3_stmt* statement;
 			RygelMediaObjects* _tmp29_;
@@ -1170,17 +1135,14 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 			gpointer _tmp35_ = NULL;
 			RygelMediaObject* _tmp36_;
 			RygelMediaContainer* _tmp37_;
-			_tmp25_ = _statement_it;
-			_tmp26_ = rygel_media_export_database_cursor_iterator_next (_tmp25_);
+			_tmp26_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp26_) {
 				break;
 			}
-			_tmp27_ = _statement_it;
-			_tmp28_ = rygel_media_export_database_cursor_iterator_get (_tmp27_, &_inner_error_);
+			_tmp28_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp28_;
 			if (_inner_error_ != NULL) {
 				g_propagate_error (error, _inner_error_);
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 				g_object_unref (cursor);
 				g_free (sort_order);
 				g_free (sql);
@@ -1202,7 +1164,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_children (RygelMediaExport
 			rygel_media_object_set_parent_ref (_tmp36_, _tmp37_);
 			g_object_unref (_tmp36_);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = children;
 	g_object_unref (cursor);
@@ -1686,15 +1647,9 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp48_;
-		RygelMediaExportDatabaseCursorIterator* _tmp49_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp48_ = cursor;
-		_tmp49_ = rygel_media_export_database_cursor_iterator (_tmp48_);
-		_statement_it = _tmp49_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp50_;
 			gboolean _tmp51_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp52_;
 			sqlite3_stmt* _tmp53_ = NULL;
 			sqlite3_stmt* statement;
 			sqlite3_stmt* _tmp54_;
@@ -1704,17 +1659,14 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 			RygelMediaContainer* _tmp57_;
 			gboolean _tmp62_;
 			RygelMediaContainer* _tmp66_;
-			_tmp50_ = _statement_it;
-			_tmp51_ = rygel_media_export_database_cursor_iterator_next (_tmp50_);
+			_tmp51_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp51_) {
 				break;
 			}
-			_tmp52_ = _statement_it;
-			_tmp53_ = rygel_media_export_database_cursor_iterator_get (_tmp52_, &_inner_error_);
+			_tmp53_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp53_;
 			if (_inner_error_ != NULL) {
 				g_propagate_error (error, _inner_error_);
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 				g_object_unref (cursor);
 				g_free (sort_order);
 				g_object_unref (parent);
@@ -1785,7 +1737,6 @@ RygelMediaObjects* rygel_media_export_media_cache_get_objects_by_filter (RygelMe
 				g_warning ("Inconsistent database: item %s " "has no parent %s", _tmp77_, _tmp78_);
 			}
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = children;
 	g_object_unref (cursor);
@@ -1810,31 +1761,22 @@ void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache
 		}
 		{
 			RygelMediaExportDatabaseCursor* _tmp1_;
-			RygelMediaExportDatabaseCursorIterator* _tmp2_ = NULL;
-			RygelMediaExportDatabaseCursorIterator* _statement_it;
 			_tmp1_ = cursor;
-			_tmp2_ = rygel_media_export_database_cursor_iterator (_tmp1_);
-			_statement_it = _tmp2_;
 			while (TRUE) {
-				RygelMediaExportDatabaseCursorIterator* _tmp3_;
 				gboolean _tmp4_ = FALSE;
-				RygelMediaExportDatabaseCursorIterator* _tmp5_;
 				sqlite3_stmt* _tmp6_ = NULL;
 				sqlite3_stmt* statement;
 				sqlite3_stmt* _tmp7_;
 				const gchar* _tmp8_ = NULL;
 				sqlite3_stmt* _tmp9_;
 				gint _tmp10_ = 0;
-				_tmp3_ = _statement_it;
-				_tmp4_ = rygel_media_export_database_cursor_iterator_next (_tmp3_);
+				_tmp4_ = rygel_media_export_database_cursor_has_next (cursor);
 				if (!_tmp4_) {
 					break;
 				}
-				_tmp5_ = _statement_it;
-				_tmp6_ = rygel_media_export_database_cursor_iterator_get (_tmp5_, &_inner_error_);
+				_tmp6_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 				statement = _tmp6_;
 				if (_inner_error_ != NULL) {
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					goto __catch7_g_error;
 				}
@@ -1844,7 +1786,6 @@ void rygel_media_export_media_cache_debug_statistics (RygelMediaExportMediaCache
 				_tmp10_ = sqlite3_column_int (_tmp9_, 1);
 				g_debug ("rygel-media-export-media-cache.vala:342: %s: %d", _tmp8_, _tmp10_);
 			}
-			_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 		}
 		g_object_unref (cursor);
 	}
@@ -1912,38 +1853,28 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp6_;
-		RygelMediaExportDatabaseCursorIterator* _tmp7_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp6_ = cursor;
-		_tmp7_ = rygel_media_export_database_cursor_iterator (_tmp6_);
-		_statement_it = _tmp7_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp8_;
 			gboolean _tmp9_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp10_;
 			sqlite3_stmt* _tmp11_ = NULL;
 			sqlite3_stmt* statement;
 			GeeArrayList* _tmp12_;
 			sqlite3_stmt* _tmp13_;
 			const gchar* _tmp14_ = NULL;
-			_tmp8_ = _statement_it;
-			_tmp9_ = rygel_media_export_database_cursor_iterator_next (_tmp8_);
+			_tmp9_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp9_) {
 				break;
 			}
-			_tmp10_ = _statement_it;
-			_tmp11_ = rygel_media_export_database_cursor_iterator_get (_tmp10_, &_inner_error_);
+			_tmp11_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp11_;
 			if (_inner_error_ != NULL) {
 				if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 					g_propagate_error (error, _inner_error_);
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					values = (_vala_GValue_array_free (values, values_length1), NULL);
 					g_object_unref (children);
 					return NULL;
 				} else {
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					values = (_vala_GValue_array_free (values, values_length1), NULL);
 					g_object_unref (children);
@@ -1957,7 +1888,6 @@ GeeArrayList* rygel_media_export_media_cache_get_child_ids (RygelMediaExportMedi
 			_tmp14_ = sqlite3_column_text (_tmp13_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp12_, _tmp14_);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = children;
 	g_object_unref (cursor);
@@ -2040,31 +1970,23 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp21_;
-		RygelMediaExportDatabaseCursorIterator* _tmp22_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp21_ = cursor;
-		_tmp22_ = rygel_media_export_database_cursor_iterator (_tmp21_);
-		_statement_it = _tmp22_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp23_;
 			gboolean _tmp24_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp25_;
 			sqlite3_stmt* _tmp26_ = NULL;
 			sqlite3_stmt* statement;
 			GeeArrayList* _tmp27_;
 			sqlite3_stmt* _tmp28_;
 			const gchar* _tmp29_ = NULL;
 			_tmp23_ = _statement_it;
-			_tmp24_ = rygel_media_export_database_cursor_iterator_next (_tmp23_);
+			_tmp24_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp24_) {
 				break;
 			}
-			_tmp25_ = _statement_it;
-			_tmp26_ = rygel_media_export_database_cursor_iterator_get (_tmp25_, &_inner_error_);
+			_tmp26_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp26_;
 			if (_inner_error_ != NULL) {
 				g_propagate_error (error, _inner_error_);
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 				g_object_unref (cursor);
 				g_object_unref (data);
 				G_IS_VALUE (&v) ? (g_value_unset (&v), NULL) : NULL;
@@ -2075,7 +1997,6 @@ GeeList* rygel_media_export_media_cache_get_meta_data_column_by_filter (RygelMed
 			_tmp29_ = sqlite3_column_text (_tmp28_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp27_, _tmp29_);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = (GeeList*) data;
 	g_object_unref (cursor);
@@ -2237,31 +2158,22 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp7_;
-		RygelMediaExportDatabaseCursorIterator* _tmp8_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp7_ = cursor;
-		_tmp8_ = rygel_media_export_database_cursor_iterator (_tmp7_);
-		_statement_it = _tmp8_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp9_;
 			gboolean _tmp10_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp11_;
 			sqlite3_stmt* _tmp12_ = NULL;
 			sqlite3_stmt* statement;
 			GeeArrayList* _tmp13_;
 			sqlite3_stmt* _tmp14_;
 			const gchar* _tmp15_ = NULL;
-			_tmp9_ = _statement_it;
-			_tmp10_ = rygel_media_export_database_cursor_iterator_next (_tmp9_);
+			_tmp10_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp10_) {
 				break;
 			}
-			_tmp11_ = _statement_it;
-			_tmp12_ = rygel_media_export_database_cursor_iterator_get (_tmp11_, &_inner_error_);
+			_tmp12_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp12_;
 			if (_inner_error_ != NULL) {
 				g_propagate_error (error, _inner_error_);
-				_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 				g_object_unref (cursor);
 				args = (_vala_GValue_array_free (args, args_length1), NULL);
 				g_object_unref (uris);
@@ -2272,7 +2184,6 @@ GeeList* rygel_media_export_media_cache_get_flagged_uris (RygelMediaExportMediaC
 			_tmp15_ = sqlite3_column_text (_tmp14_, 0);
 			gee_abstract_collection_add ((GeeAbstractCollection*) _tmp13_, _tmp15_);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	result = (GeeList*) uris;
 	g_object_unref (cursor);
@@ -2304,15 +2215,9 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 	}
 	{
 		RygelMediaExportDatabaseCursor* _tmp2_;
-		RygelMediaExportDatabaseCursorIterator* _tmp3_ = NULL;
-		RygelMediaExportDatabaseCursorIterator* _statement_it;
 		_tmp2_ = cursor;
-		_tmp3_ = rygel_media_export_database_cursor_iterator (_tmp2_);
-		_statement_it = _tmp3_;
 		while (TRUE) {
-			RygelMediaExportDatabaseCursorIterator* _tmp4_;
 			gboolean _tmp5_ = FALSE;
-			RygelMediaExportDatabaseCursorIterator* _tmp6_;
 			sqlite3_stmt* _tmp7_ = NULL;
 			sqlite3_stmt* statement;
 			RygelMediaExportExistsCacheEntry entry = {0};
@@ -2325,21 +2230,19 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 			const gchar* _tmp14_ = NULL;
 			RygelMediaExportExistsCacheEntry _tmp15_;
 			_tmp4_ = _statement_it;
-			_tmp5_ = rygel_media_export_database_cursor_iterator_next (_tmp4_);
+			_tmp5_ = rygel_media_export_database_cursor_has_next (cursor);
 			if (!_tmp5_) {
 				break;
 			}
 			_tmp6_ = _statement_it;
-			_tmp7_ = rygel_media_export_database_cursor_iterator_get (_tmp6_, &_inner_error_);
+			_tmp7_ = rygel_media_export_database_cursor_next (cursor, &_inner_error_);
 			statement = _tmp7_;
 			if (_inner_error_ != NULL) {
 				if (_inner_error_->domain == RYGEL_MEDIA_EXPORT_DATABASE_ERROR) {
 					g_propagate_error (error, _inner_error_);
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					return;
 				} else {
-					_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 					g_object_unref (cursor);
 					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
 					g_clear_error (&_inner_error_);
@@ -2359,7 +2262,6 @@ static void rygel_media_export_media_cache_get_exists_cache (RygelMediaExportMed
 			_tmp15_ = entry;
 			gee_abstract_map_set ((GeeAbstractMap*) _tmp12_, _tmp14_, &_tmp15_);
 		}
-		_rygel_media_export_database_cursor_iterator_unref0 (_statement_it);
 	}
 	g_object_unref (cursor);
 }
@@ -4456,6 +4358,3 @@ static gint _vala_array_length (gpointer array) {
 	}
 	return length;
 }
-
-
-
diff --git a/src/media-export/rygel-media-export-media-cache.h b/src/media-export/rygel-media-export-media-cache.h
index 7b34dc3..0088831 100644
--- a/src/media-export/rygel-media-export-media-cache.h
+++ b/src/media-export/rygel-media-export-media-cache.h
@@ -52,17 +52,11 @@ struct _RygelMediaExportMediaCacheClass {
   GObjectClass parent_class;
 };
 
-GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
+GType
+rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
 
-RygelMediaExportMediaCache* rygel_media_export_media_cache_new (GError** error);
-
-typedef enum  {
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_SQLITE_ERROR,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_GENERAL_ERROR,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_INVALID_TYPE,
-	RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR_UNSUPPORTED_SEARCH
-} RygelMediaExportMediaCacheError;
-#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_ERROR rygel_media_export_media_cache_error_quark ()
+RygelMediaExportMediaCache *
+rygel_media_export_media_cache_new (GError **error);
 
 G_END_DECLS
 



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