[rygel/wip/create-reference: 11/11] WIP
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/create-reference: 11/11] WIP
- Date: Wed, 6 Mar 2013 16:20:39 +0000 (UTC)
commit 4a9fcfd7e03d85a64f99b7e20b159de4d3b22e00
Author: Jens Georg <jensg openismus com>
Date: Wed Mar 6 17:19:59 2013 +0100
WIP
.../rygel-media-export-media-cache.vala | 4 +++-
.../rygel-media-export-sql-factory.vala | 18 ++++++++++++++----
2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala
b/src/plugins/media-export/rygel-media-export-media-cache.vala
index 5ef75dc..b106e05 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -720,7 +720,8 @@ public class Rygel.MediaExport.MediaCache : Object {
object.object_update_id,
-1,
-1,
- is_guarded ? 1 : 0
+ is_guarded ? 1 : 0,
+ object.ref_id ?? null
};
if (object is MediaContainer) {
var container = object as MediaContainer;
@@ -761,6 +762,7 @@ public class Rygel.MediaExport.MediaCache : Object {
db.exec (this.sql.make (SQLString.TABLE_CLOSURE));
db.exec (this.sql.make (SQLString.INDEX_COMMON));
db.exec (this.sql.make (SQLString.TRIGGER_CLOSURE));
+ db.exec (this.sql.make (SQLString.TRIGGER_REFERENCE));
db.commit ();
db.analyze ();
this.save_reset_token (UUID.get ());
diff --git a/src/plugins/media-export/rygel-media-export-sql-factory.vala
b/src/plugins/media-export/rygel-media-export-sql-factory.vala
index 1affd3f..2d8e6fb 100644
--- a/src/plugins/media-export/rygel-media-export-sql-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-sql-factory.vala
@@ -77,7 +77,8 @@ internal enum Rygel.MediaExport.SQLString {
MAX_UPDATE_ID,
MAKE_GUARDED,
IS_GUARDED,
- UPDATE_GUARDED_OBJECT
+ UPDATE_GUARDED_OBJECT,
+ TRIGGER_REFERENCE
}
internal class Rygel.MediaExport.SQLFactory : Object {
@@ -94,8 +95,8 @@ internal class Rygel.MediaExport.SQLFactory : Object {
"INSERT OR REPLACE INTO Object " +
"(upnp_id, title, type_fk, parent, timestamp, uri, " +
"object_update_id, deleted_child_count, container_update_id, " +
- "is_guarded) VALUES " +
- "(?,?,?,?,?,?,?,?,?,?)";
+ "is_guarded, reference_id) VALUES " +
+ "(?,?,?,?,?,?,?,?,?,?,?)";
private const string UPDATE_GUARDED_OBJECT_STRING =
"REPLACE INTO Object " +
@@ -181,7 +182,7 @@ internal class Rygel.MediaExport.SQLFactory : Object {
"WHERE _column IS NOT NULL %s ORDER BY _column COLLATE CASEFOLD " +
"LIMIT ?,?";
- internal const string SCHEMA_VERSION = "13";
+ internal const string SCHEMA_VERSION = "14";
internal const string CREATE_META_DATA_TABLE_STRING =
"CREATE TABLE meta_data (size INTEGER NOT NULL, " +
"mime_type TEXT NOT NULL, " +
@@ -256,6 +257,13 @@ internal class Rygel.MediaExport.SQLFactory : Object {
"DELETE FROM meta_data WHERE meta_data.object_fk = OLD.upnp_id; "+
"END;";
+ private const string DELETE_REFERENCE_TRIGGER_STRING =
+ "CREATE TRIGGER trgr_delete_references " +
+ "BEFORE DELETE ON Object " +
+ "FOR EACH ROW BEGIN " +
+ "DELETE FROM Object WHERE OLD.upnp_id = Object.reference_id; " +
+ "END;";
+
private const string CREATE_INDICES_STRING =
"CREATE INDEX IF NOT EXISTS idx_parent on Object(parent);" +
"CREATE INDEX IF NOT EXISTS idx_object_upnp_id on Object(upnp_id);" +
@@ -345,6 +353,8 @@ internal class Rygel.MediaExport.SQLFactory : Object {
return IS_GUARDED_STRING;
case SQLString.UPDATE_GUARDED_OBJECT:
return UPDATE_GUARDED_OBJECT_STRING;
+ case SQLString.TRIGGER_REFERENCE:
+ return DELETE_REFERENCE_TRIGGER_STRING;
default:
assert_not_reached ();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]