update extensions

This commit is contained in:
Luke Pulverenti
2016-11-20 02:10:07 -05:00
parent a385ab5142
commit 7f62a99ab5
8 changed files with 172 additions and 85 deletions

View File

@@ -173,69 +173,156 @@ namespace Emby.Server.Implementations.Data
return result[index].ReadGuid();
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, double value)
public static void TryBind(this IStatement statement, string name, double value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, string value)
public static void TryBind(this IStatement statement, string name, string value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, bool value)
public static void TryBind(this IStatement statement, string name, bool value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, int value)
public static void TryBind(this IStatement statement, string name, float value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, long value)
public static void TryBind(this IStatement statement, string name, int value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBind(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name, byte[] value)
public static void TryBind(this IStatement statement, string name, Guid value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value.ToGuidParamValue());
}
}
public static void TryBind(this IStatement statement, string name, DateTime value)
{
IBindParameter bindParam;
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value.ToDateTimeParamValue());
}
}
public static void TryBind(this IStatement statement, string name, long value)
{
IBindParameter bindParam;
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBindNull(this IReadOnlyDictionary<string, IBindParameter> bindParameters, string name)
public static void TryBind(this IStatement statement, string name, byte[] value)
{
IBindParameter bindParam;
if (bindParameters.TryGetValue(name, out bindParam))
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.Bind(value);
}
}
public static void TryBindNull(this IStatement statement, string name)
{
IBindParameter bindParam;
if (statement.BindParameters.TryGetValue(name, out bindParam))
{
bindParam.BindNull();
}
}
public static void TryBind(this IStatement statement, string name, DateTime? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static void TryBind(this IStatement statement, string name, Guid? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static void TryBind(this IStatement statement, string name, int? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static void TryBind(this IStatement statement, string name, float? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static void TryBind(this IStatement statement, string name, bool? value)
{
if (value.HasValue)
{
TryBind(statement, name, value.Value);
}
else
{
TryBindNull(statement, name);
}
}
public static IEnumerable<IReadOnlyList<IResultSetValue>> ExecuteQuery(
this IStatement This)
{