aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Data/SqliteExtensions.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-20 00:59:36 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-11-20 00:59:36 -0500
commit64d15be8390c6174eb7ded067715c226038b38fc (patch)
tree39b48b388868dc514f1e452470c9b9f6ec773ebd /Emby.Server.Implementations/Data/SqliteExtensions.cs
parentb06d1851dafdcdbb2e4b43ef5c7759bbf17ad094 (diff)
update queries
Diffstat (limited to 'Emby.Server.Implementations/Data/SqliteExtensions.cs')
-rw-r--r--Emby.Server.Implementations/Data/SqliteExtensions.cs48
1 files changed, 44 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteExtensions.cs b/Emby.Server.Implementations/Data/SqliteExtensions.cs
index 014211924..1cc8a8a93 100644
--- a/Emby.Server.Implementations/Data/SqliteExtensions.cs
+++ b/Emby.Server.Implementations/Data/SqliteExtensions.cs
@@ -168,14 +168,54 @@ namespace Emby.Server.Implementations.Data
return result[index].ToFloat();
}
- public static DateTime GetDateTime(this IReadOnlyList<IResultSetValue> result, int index)
+ public static Guid GetGuid(this IReadOnlyList<IResultSetValue> result, int index)
{
- return result[index].ReadDateTime();
+ return result[index].ReadGuid();
}
- public static Guid GetGuid(this IReadOnlyList<IResultSetValue> result, int index)
+ public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, string value)
{
- return result[index].ReadGuid();
+ IBindParameter bindParam;
+ if (bindParameters.TryGetValue(name, out bindParam))
+ {
+ bindParam.Bind(value);
+ }
+ }
+
+ public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, bool value)
+ {
+ IBindParameter bindParam;
+ if (bindParameters.TryGetValue(name, out bindParam))
+ {
+ bindParam.Bind(value);
+ }
+ }
+
+ public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, byte[] value)
+ {
+ IBindParameter bindParam;
+ if (bindParameters.TryGetValue(name, out bindParam))
+ {
+ bindParam.Bind(value);
+ }
+ }
+
+ public static void TryBindNull(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name)
+ {
+ IBindParameter bindParam;
+ if (bindParameters.TryGetValue(name, out bindParam))
+ {
+ bindParam.BindNull();
+ }
+ }
+
+ public static IEnumerable<IReadOnlyList<IResultSetValue>> ExecuteQuery(
+ this IStatement This)
+ {
+ while (This.MoveNext())
+ {
+ yield return This.Current;
+ }
}
}
}