aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs')
-rw-r--r--MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs30
1 files changed, 29 insertions, 1 deletions
diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
index 70362654e..cd7928290 100644
--- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
+++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
@@ -257,7 +257,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
_writeLock.Release();
}
}
-
+
/// <summary>
/// Internal retrieve from items or users table
/// </summary>
@@ -473,6 +473,34 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
+ public IEnumerable<BaseItem> GetChildrenItems(Guid parentId)
+ {
+ if (parentId == Guid.Empty)
+ {
+ throw new ArgumentNullException("parentId");
+ }
+
+ using (var cmd = _connection.CreateCommand())
+ {
+ cmd.CommandText = "select type,data from TypedBaseItems where guid in (select ItemId from ChildrenIds where ParentId = @ParentId)";
+
+ cmd.Parameters.Add(cmd, "@ParentId", DbType.Guid).Value = parentId;
+
+ using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
+ {
+ while (reader.Read())
+ {
+ var item = GetItem(reader);
+
+ if (item != null)
+ {
+ yield return item;
+ }
+ }
+ }
+ }
+ }
+
public IEnumerable<BaseItem> GetItemsOfType(Type type)
{
if (type == null)