[rygel] core: Add function to get list of child ids
- From: Zeeshan Ali Khattak <zeeshanak src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [rygel] core: Add function to get list of child ids
- Date: Wed, 9 Sep 2009 20:39:28 +0000 (UTC)
commit ba4d54676619fb7559c1498398152d69c6b8b12d
Author: Jens Georg <mail jensge org>
Date: Sun Jun 28 21:02:41 2009 +0200
core: Add function to get list of child ids
src/rygel/rygel-media-db.vala | 25 +++++++++++++++++++++++++
1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/src/rygel/rygel-media-db.vala b/src/rygel/rygel-media-db.vala
index 5fa2edf..595e759 100644
--- a/src/rygel/rygel-media-db.vala
+++ b/src/rygel/rygel-media-db.vala
@@ -186,6 +186,9 @@ public class Rygel.MediaDB : Object {
private const string SWEEPER_STRING =
"DELETE FROM Object WHERE parent IS NULL";
+ private const string GET_CHILD_ID_STRING =
+ "SELECT upnp_id FROM OBJECT WHERE parent = ?";
+
private void open_db (string name) {
var dirname = Path.build_filename (Environment.get_user_cache_dir (),
Environment.get_prgname ());
@@ -639,6 +642,28 @@ public class Rygel.MediaDB : Object {
item.color_depth = statement.column_int (15);
}
+ public ArrayList<string> get_child_ids (string object_id) {
+ ArrayList<string> children = new ArrayList<string> (str_equal);
+ Statement statement;
+
+ var rc = db.prepare_v2 (GET_CHILD_ID_STRING,
+ -1,
+ out statement,
+ null);
+ if (rc == Sqlite.OK) {
+ statement.bind_text (1, object_id);
+ while ((rc = statement.step ()) == Sqlite.ROW) {
+ children.add (statement.column_text (0));
+ }
+ } else {
+ warning ("Failed to get children for obj %s: %s",
+ object_id,
+ db.errmsg ());
+ }
+
+ return children;
+ }
+
public int get_child_count (string object_id) {
Statement statement;
int count = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]