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.cs34
1 files changed, 32 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
index 12ce60d45..61432d00f 100644
--- a/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
+++ b/MediaBrowser.Server.Implementations/Persistence/SqliteItemRepository.cs
@@ -522,7 +522,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
}
- public IEnumerable<Guid> GetItemsOfType(Type type)
+ public IEnumerable<BaseItem> GetItemsOfType(Type type)
{
if (type == null)
{
@@ -530,7 +530,37 @@ namespace MediaBrowser.Server.Implementations.Persistence
}
CheckDisposed();
-
+
+ using (var cmd = _connection.CreateCommand())
+ {
+ cmd.CommandText = "select type,data from TypedBaseItems where type = @type";
+
+ cmd.Parameters.Add(cmd, "@type", DbType.String).Value = type.FullName;
+
+ using (var reader = cmd.ExecuteReader(CommandBehavior.SequentialAccess | CommandBehavior.SingleResult))
+ {
+ while (reader.Read())
+ {
+ var item = GetItem(reader);
+
+ if (item != null)
+ {
+ yield return item;
+ }
+ }
+ }
+ }
+ }
+
+ public IEnumerable<Guid> GetItemIdsOfType(Type type)
+ {
+ if (type == null)
+ {
+ throw new ArgumentNullException("type");
+ }
+
+ CheckDisposed();
+
using (var cmd = _connection.CreateCommand())
{
cmd.CommandText = "select guid from TypedBaseItems where type = @type";