update extensions
This commit is contained in:
parent
a385ab5142
commit
7f62a99ab5
|
@ -59,16 +59,16 @@ namespace Emby.Server.Implementations.Activity
|
||||||
{
|
{
|
||||||
using (var statement = db.PrepareStatement("replace into ActivityLogEntries (Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Id, @Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)"))
|
using (var statement = db.PrepareStatement("replace into ActivityLogEntries (Id, Name, Overview, ShortOverview, Type, ItemId, UserId, DateCreated, LogSeverity) values (@Id, @Name, @Overview, @ShortOverview, @Type, @ItemId, @UserId, @DateCreated, @LogSeverity)"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@Id", entry.Id.ToGuidParamValue());
|
statement.TryBind("@Id", entry.Id.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@Name", entry.Name);
|
statement.TryBind("@Name", entry.Name);
|
||||||
|
|
||||||
statement.BindParameters.TryBind("@Overview", entry.Overview);
|
statement.TryBind("@Overview", entry.Overview);
|
||||||
statement.BindParameters.TryBind("@ShortOverview", entry.ShortOverview);
|
statement.TryBind("@ShortOverview", entry.ShortOverview);
|
||||||
statement.BindParameters.TryBind("@Type", entry.Type);
|
statement.TryBind("@Type", entry.Type);
|
||||||
statement.BindParameters.TryBind("@ItemId", entry.ItemId);
|
statement.TryBind("@ItemId", entry.ItemId);
|
||||||
statement.BindParameters.TryBind("@UserId", entry.UserId);
|
statement.TryBind("@UserId", entry.UserId);
|
||||||
statement.BindParameters.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
|
statement.TryBind("@DateCreated", entry.Date.ToDateTimeParamValue());
|
||||||
statement.BindParameters.TryBind("@LogSeverity", entry.Severity.ToString());
|
statement.TryBind("@LogSeverity", entry.Severity.ToString());
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,10 +104,10 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
var serialized = _jsonSerializer.SerializeToBytes(displayPreferences, _memoryStreamProvider);
|
var serialized = _jsonSerializer.SerializeToBytes(displayPreferences, _memoryStreamProvider);
|
||||||
|
|
||||||
statement.BindParameters.TryBind("@id", displayPreferences.Id.ToGuidParamValue());
|
statement.TryBind("@id", displayPreferences.Id.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@userId", userId.ToGuidParamValue());
|
statement.TryBind("@userId", userId.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@client", client);
|
statement.TryBind("@client", client);
|
||||||
statement.BindParameters.TryBind("@data", serialized);
|
statement.TryBind("@data", serialized);
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
|
@ -168,9 +168,9 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"))
|
using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where id = @id and userId=@userId and client=@client"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@id", guidId.ToGuidParamValue());
|
statement.TryBind("@id", guidId.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@userId", userId.ToGuidParamValue());
|
statement.TryBind("@userId", userId.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@client", client);
|
statement.TryBind("@client", client);
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
|
@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where userId=@userId"))
|
using (var statement = connection.PrepareStatement("select data from userdisplaypreferences where userId=@userId"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@userId", userId.ToGuidParamValue());
|
statement.TryBind("@userId", userId.ToGuidParamValue());
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
|
|
|
@ -173,69 +173,156 @@ namespace Emby.Server.Implementations.Data
|
||||||
return result[index].ReadGuid();
|
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;
|
IBindParameter bindParam;
|
||||||
if (bindParameters.TryGetValue(name, out bindParam))
|
if (statement.BindParameters.TryGetValue(name, out bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value);
|
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;
|
IBindParameter bindParam;
|
||||||
if (bindParameters.TryGetValue(name, out bindParam))
|
if (statement.BindParameters.TryGetValue(name, out bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value);
|
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;
|
IBindParameter bindParam;
|
||||||
if (bindParameters.TryGetValue(name, out bindParam))
|
if (statement.BindParameters.TryGetValue(name, out bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value);
|
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;
|
IBindParameter bindParam;
|
||||||
if (bindParameters.TryGetValue(name, out bindParam))
|
if (statement.BindParameters.TryGetValue(name, out bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value);
|
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;
|
IBindParameter bindParam;
|
||||||
if (bindParameters.TryGetValue(name, out bindParam))
|
if (statement.BindParameters.TryGetValue(name, out bindParam))
|
||||||
{
|
{
|
||||||
bindParam.Bind(value);
|
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;
|
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);
|
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;
|
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();
|
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(
|
public static IEnumerable<IReadOnlyList<IResultSetValue>> ExecuteQuery(
|
||||||
this IStatement This)
|
this IStatement This)
|
||||||
{
|
{
|
||||||
|
|
|
@ -152,48 +152,48 @@
|
||||||
// {
|
// {
|
||||||
// using (var statement = _connection.PrepareStatement("replace into userdata (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
|
// using (var statement = _connection.PrepareStatement("replace into userdata (key, userId, rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex) values (@key, @userId, @rating,@played,@playCount,@isFavorite,@playbackPositionTicks,@lastPlayedDate,@AudioStreamIndex,@SubtitleStreamIndex)"))
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
// statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
// statement.BindParameters.TryBind("@Key", key);
|
// statement.TryBind("@Key", key);
|
||||||
|
|
||||||
// if (userData.Rating.HasValue)
|
// if (userData.Rating.HasValue)
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@rating", userData.Rating.Value);
|
// statement.TryBind("@rating", userData.Rating.Value);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBindNull("@rating");
|
// statement.TryBindNull("@rating");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// statement.BindParameters.TryBind("@played", userData.Played);
|
// statement.TryBind("@played", userData.Played);
|
||||||
// statement.BindParameters.TryBind("@playCount", userData.PlayCount);
|
// statement.TryBind("@playCount", userData.PlayCount);
|
||||||
// statement.BindParameters.TryBind("@isFavorite", userData.IsFavorite);
|
// statement.TryBind("@isFavorite", userData.IsFavorite);
|
||||||
// statement.BindParameters.TryBind("@playbackPositionTicks", userData.PlaybackPositionTicks);
|
// statement.TryBind("@playbackPositionTicks", userData.PlaybackPositionTicks);
|
||||||
|
|
||||||
// if (userData.LastPlayedDate.HasValue)
|
// if (userData.LastPlayedDate.HasValue)
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@lastPlayedDate", userData.LastPlayedDate.Value.ToDateTimeParamValue());
|
// statement.TryBind("@lastPlayedDate", userData.LastPlayedDate.Value.ToDateTimeParamValue());
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBindNull("@lastPlayedDate");
|
// statement.TryBindNull("@lastPlayedDate");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (userData.AudioStreamIndex.HasValue)
|
// if (userData.AudioStreamIndex.HasValue)
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@AudioStreamIndex", userData.AudioStreamIndex.Value);
|
// statement.TryBind("@AudioStreamIndex", userData.AudioStreamIndex.Value);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBindNull("@AudioStreamIndex");
|
// statement.TryBindNull("@AudioStreamIndex");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// if (userData.SubtitleStreamIndex.HasValue)
|
// if (userData.SubtitleStreamIndex.HasValue)
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@SubtitleStreamIndex", userData.SubtitleStreamIndex.Value);
|
// statement.TryBind("@SubtitleStreamIndex", userData.SubtitleStreamIndex.Value);
|
||||||
// }
|
// }
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBindNull("@SubtitleStreamIndex");
|
// statement.TryBindNull("@SubtitleStreamIndex");
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// statement.MoveNext();
|
// statement.MoveNext();
|
||||||
|
@ -243,8 +243,8 @@
|
||||||
|
|
||||||
// using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key =@Key and userId=@UserId"))
|
// using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where key =@Key and userId=@UserId"))
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
// statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
// statement.BindParameters.TryBind("@Key", key);
|
// statement.TryBind("@Key", key);
|
||||||
|
|
||||||
// foreach (var row in statement.ExecuteQuery())
|
// foreach (var row in statement.ExecuteQuery())
|
||||||
// {
|
// {
|
||||||
|
@ -292,7 +292,7 @@
|
||||||
// {
|
// {
|
||||||
// using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where userId=@UserId"))
|
// using (var statement = _connection.PrepareStatement("select key,userid,rating,played,playCount,isFavorite,playbackPositionTicks,lastPlayedDate,AudioStreamIndex,SubtitleStreamIndex from userdata where userId=@UserId"))
|
||||||
// {
|
// {
|
||||||
// statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
// statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
|
|
||||||
// foreach (var row in statement.ExecuteQuery())
|
// foreach (var row in statement.ExecuteQuery())
|
||||||
// {
|
// {
|
||||||
|
|
|
@ -91,8 +91,8 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var statement = db.PrepareStatement("replace into users (guid, data) values (@guid, @data)"))
|
using (var statement = db.PrepareStatement("replace into users (guid, data) values (@guid, @data)"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@guid", user.Id.ToGuidParamValue());
|
statement.TryBind("@guid", user.Id.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@data", serialized);
|
statement.TryBind("@data", serialized);
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -154,7 +154,7 @@ namespace Emby.Server.Implementations.Data
|
||||||
{
|
{
|
||||||
using (var statement = db.PrepareStatement("delete from users where guid=@id"))
|
using (var statement = db.PrepareStatement("delete from users where guid=@id"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@id", user.Id.ToGuidParamValue());
|
statement.TryBind("@id", user.Id.ToGuidParamValue());
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -109,8 +109,8 @@ namespace Emby.Server.Implementations.Notifications
|
||||||
{
|
{
|
||||||
using (var statement = connection.PrepareStatement("select Level from Notifications where UserId=@UserId and IsRead=@IsRead"))
|
using (var statement = connection.PrepareStatement("select Level from Notifications where UserId=@UserId and IsRead=@IsRead"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@IsRead", false);
|
statement.TryBind("@IsRead", false);
|
||||||
statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
{
|
{
|
||||||
|
@ -228,16 +228,16 @@ namespace Emby.Server.Implementations.Notifications
|
||||||
{
|
{
|
||||||
using (var statement = conn.PrepareStatement("replace into Notifications (Id, UserId, Date, Name, Description, Url, Level, IsRead, Category, RelatedId) values (@Id, @UserId, @Date, @Name, @Description, @Url, @Level, @IsRead, @Category, @RelatedId)"))
|
using (var statement = conn.PrepareStatement("replace into Notifications (Id, UserId, Date, Name, Description, Url, Level, IsRead, Category, RelatedId) values (@Id, @UserId, @Date, @Name, @Description, @Url, @Level, @IsRead, @Category, @RelatedId)"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@Id", notification.Id.ToGuidParamValue());
|
statement.TryBind("@Id", notification.Id.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@UserId", notification.UserId.ToGuidParamValue());
|
statement.TryBind("@UserId", notification.UserId.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@Date", notification.Date.ToDateTimeParamValue());
|
statement.TryBind("@Date", notification.Date.ToDateTimeParamValue());
|
||||||
statement.BindParameters.TryBind("@Name", notification.Name);
|
statement.TryBind("@Name", notification.Name);
|
||||||
statement.BindParameters.TryBind("@Description", notification.Description);
|
statement.TryBind("@Description", notification.Description);
|
||||||
statement.BindParameters.TryBind("@Url", notification.Url);
|
statement.TryBind("@Url", notification.Url);
|
||||||
statement.BindParameters.TryBind("@Level", notification.Level.ToString());
|
statement.TryBind("@Level", notification.Level.ToString());
|
||||||
statement.BindParameters.TryBind("@IsRead", notification.IsRead);
|
statement.TryBind("@IsRead", notification.IsRead);
|
||||||
statement.BindParameters.TryBind("@Category", string.Empty);
|
statement.TryBind("@Category", string.Empty);
|
||||||
statement.BindParameters.TryBind("@RelatedId", string.Empty);
|
statement.TryBind("@RelatedId", string.Empty);
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
|
@ -291,8 +291,8 @@ namespace Emby.Server.Implementations.Notifications
|
||||||
{
|
{
|
||||||
using (var statement = conn.PrepareStatement("update Notifications set IsRead=@IsRead where UserId=@UserId"))
|
using (var statement = conn.PrepareStatement("update Notifications set IsRead=@IsRead where UserId=@UserId"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@IsRead", isRead);
|
statement.TryBind("@IsRead", isRead);
|
||||||
statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
|
@ -313,14 +313,14 @@ namespace Emby.Server.Implementations.Notifications
|
||||||
{
|
{
|
||||||
using (var statement = conn.PrepareStatement("update Notifications set IsRead=@IsRead where UserId=@UserId and Id=@Id"))
|
using (var statement = conn.PrepareStatement("update Notifications set IsRead=@IsRead where UserId=@UserId and Id=@Id"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@IsRead", isRead);
|
statement.TryBind("@IsRead", isRead);
|
||||||
statement.BindParameters.TryBind("@UserId", userId.ToGuidParamValue());
|
statement.TryBind("@UserId", userId.ToGuidParamValue());
|
||||||
|
|
||||||
foreach (var id in notificationIdList)
|
foreach (var id in notificationIdList)
|
||||||
{
|
{
|
||||||
statement.Reset();
|
statement.Reset();
|
||||||
|
|
||||||
statement.BindParameters.TryBind("@Id", id.ToGuidParamValue());
|
statement.TryBind("@Id", id.ToGuidParamValue());
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,24 +71,24 @@ namespace Emby.Server.Implementations.Security
|
||||||
{
|
{
|
||||||
using (var statement = db.PrepareStatement("replace into AccessTokens (Id, AccessToken, DeviceId, AppName, AppVersion, DeviceName, UserId, IsActive, DateCreated, DateRevoked) values (@Id, @AccessToken, @DeviceId, @AppName, @AppVersion, @DeviceName, @UserId, @IsActive, @DateCreated, @DateRevoked)"))
|
using (var statement = db.PrepareStatement("replace into AccessTokens (Id, AccessToken, DeviceId, AppName, AppVersion, DeviceName, UserId, IsActive, DateCreated, DateRevoked) values (@Id, @AccessToken, @DeviceId, @AppName, @AppVersion, @DeviceName, @UserId, @IsActive, @DateCreated, @DateRevoked)"))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@Id", info.Id.ToGuidParamValue());
|
statement.TryBind("@Id", info.Id.ToGuidParamValue());
|
||||||
statement.BindParameters.TryBind("@AccessToken", info.AccessToken);
|
statement.TryBind("@AccessToken", info.AccessToken);
|
||||||
|
|
||||||
statement.BindParameters.TryBind("@DeviceId", info.DeviceId);
|
statement.TryBind("@DeviceId", info.DeviceId);
|
||||||
statement.BindParameters.TryBind("@AppName", info.AppName);
|
statement.TryBind("@AppName", info.AppName);
|
||||||
statement.BindParameters.TryBind("@AppVersion", info.AppVersion);
|
statement.TryBind("@AppVersion", info.AppVersion);
|
||||||
statement.BindParameters.TryBind("@DeviceName", info.DeviceName);
|
statement.TryBind("@DeviceName", info.DeviceName);
|
||||||
statement.BindParameters.TryBind("@UserId", info.UserId);
|
statement.TryBind("@UserId", info.UserId);
|
||||||
statement.BindParameters.TryBind("@IsActive", info.IsActive);
|
statement.TryBind("@IsActive", info.IsActive);
|
||||||
statement.BindParameters.TryBind("@DateCreated", info.DateCreated.ToDateTimeParamValue());
|
statement.TryBind("@DateCreated", info.DateCreated.ToDateTimeParamValue());
|
||||||
|
|
||||||
if (info.DateRevoked.HasValue)
|
if (info.DateRevoked.HasValue)
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@DateRevoked", info.DateRevoked.Value.ToDateTimeParamValue());
|
statement.TryBind("@DateRevoked", info.DateRevoked.Value.ToDateTimeParamValue());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBindNull("@DateRevoked");
|
statement.TryBindNull("@DateRevoked");
|
||||||
}
|
}
|
||||||
|
|
||||||
statement.MoveNext();
|
statement.MoveNext();
|
||||||
|
@ -104,22 +104,22 @@ namespace Emby.Server.Implementations.Security
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(query.AccessToken))
|
if (!string.IsNullOrWhiteSpace(query.AccessToken))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@AccessToken", query.AccessToken);
|
statement.TryBind("@AccessToken", query.AccessToken);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.UserId))
|
if (!string.IsNullOrWhiteSpace(query.UserId))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@UserId", query.UserId);
|
statement.TryBind("@UserId", query.UserId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(query.DeviceId))
|
if (!string.IsNullOrWhiteSpace(query.DeviceId))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@DeviceId", query.DeviceId);
|
statement.TryBind("@DeviceId", query.DeviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (query.IsActive.HasValue)
|
if (query.IsActive.HasValue)
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@IsActive", query.IsActive.Value);
|
statement.TryBind("@IsActive", query.IsActive.Value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -515,7 +515,7 @@ namespace Emby.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@TargetId", query.TargetId);
|
statement.TryBind("@TargetId", query.TargetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
|
@ -535,7 +535,7 @@ namespace Emby.Server.Implementations.Sync
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
if (!string.IsNullOrWhiteSpace(query.TargetId))
|
||||||
{
|
{
|
||||||
statement.BindParameters.TryBind("@TargetId", query.TargetId);
|
statement.TryBind("@TargetId", query.TargetId);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var row in statement.ExecuteQuery())
|
foreach (var row in statement.ExecuteQuery())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user