From: Jens Georg Date: Sun, 16 May 2010 11:20:36 +0000 (+0200) Subject: media-export: Locally cache parent in search X-Git-Tag: RYGEL_0_7_0~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e27bc88f22c86b098206d336fa45042850771645;p=profile%2Fivi%2Frygel.git media-export: Locally cache parent in search This reduces the number of additional queries necessary in searches. --- 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 de47da6..0a5967f 100644 --- a/src/plugins/media-export/rygel-media-export-media-cache.vala +++ b/src/plugins/media-export/rygel-media-export-media-cache.vala @@ -175,7 +175,8 @@ public class Rygel.MediaExport.MediaCache : Object { "LEFT OUTER JOIN meta_data m " + "ON o.upnp_id = m.object_fk " + "WHERE %s " + - "ORDER BY o.type_fk ASC, " + + "ORDER BY o.parent ASC, " + + "o.type_fk ASC, " + "m.class ASC, " + "m.track ASC, " + "o.title ASC " + @@ -427,7 +428,6 @@ public class Rygel.MediaExport.MediaCache : Object { args.append (v); long count = 0; - debug ("%s %ld %ld", container_id, offset, max_count); debug ("Parameters to bind: %u", args.n_values); Database.RowCallback callback = (statement) => { @@ -458,6 +458,8 @@ public class Rygel.MediaExport.MediaCache : Object { args.append (v); v = max_count; args.append (v); + var last_parent = ""; + MediaContainer parent = null; debug ("Parameters to bind: %u", args.n_values); @@ -465,7 +467,11 @@ public class Rygel.MediaExport.MediaCache : Object { var child_id = statement.column_text (17); var parent_id = statement.column_text (18); try { - var parent = get_object (parent_id) as MediaContainer; + if (parent_id != last_parent) { + parent = get_object (parent_id) as MediaContainer; + last_parent = parent_id; + } + if (parent != null) { children.add (get_object_from_statement (parent, child_id,