The Free Software Media System - Server Backend & API
update activity log
Luke Pulverenti24dc91160d33
diff --git a/Emby.Server.Implementations/Activity/ActivityRepository.cs b/Emby.Server.Implementations/Activity/ActivityRepository.csindex ebf93fa336..d730e420a8 100644--- a/Emby.Server.Implementations/Activity/ActivityRepository.cs+++ b/Emby.Server.Implementations/Activity/ActivityRepository.cs@@ -84,19 +84,16 @@ namespace Emby.Server.Implementations.Activityusing (var connection = CreateConnection(true)){var commandText = BaseActivitySelectText;-var whereClauses = new List<string>();- var paramList = new List<object>();if (minDate.HasValue){- whereClauses.Add("DateCreated>=?");- paramList.Add(minDate.Value.ToDateTimeParamValue());+ whereClauses.Add("DateCreated>=@DateCreated");}var whereTextWithoutPaging = whereClauses.Count == 0 ?- string.Empty :- " where " + string.Join(" AND ", whereClauses.ToArray());+ string.Empty :+ " where " + string.Join(" AND ", whereClauses.ToArray());if (startIndex.HasValue && startIndex.Value > 0){@@ -122,13 +119,31 @@ namespace Emby.Server.Implementations.ActivitycommandText += " LIMIT " + limit.Value.ToString(_usCulture);}- var totalRecordCount = connection.Query("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging, paramList.ToArray()).SelectScalarInt().First();-var list = new List<ActivityLogEntry>();- foreach (var row in connection.Query(commandText, paramList.ToArray()))+ using (var statement = connection.PrepareStatement(commandText))+ {+ if (minDate.HasValue)+ {+ statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());+ }++ foreach (var row in statement.ExecuteQuery())+ {+ list.Add(GetEntry(row));+ }+ }++ int totalRecordCount;++ using (var statement = connection.PrepareStatement("select count (Id) from ActivityLogEntries" + whereTextWithoutPaging)){- list.Add(GetEntry(row));+ if (minDate.HasValue)+ {+ statement.TryBind("@DateCreated", minDate.Value.ToDateTimeParamValue());+ }++ totalRecordCount = statement.ExecuteQuery().SelectScalarInt().First();}return new QueryResult<ActivityLogEntry>()diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex e4ceca2679..255235cc7b 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -3860,7 +3860,7 @@ namespace Emby.Server.Implementations.DatawhereClauses.Add("LocationType=@LocationType");if (statement != null){- statement.TryBind("LocationType", query.LocationTypes[0].ToString());+ statement.TryBind("@LocationType", query.LocationTypes[0].ToString());}}}@@ -3881,7 +3881,7 @@ namespace Emby.Server.Implementations.DatawhereClauses.Add("LocationType<>@ExcludeLocationTypes");if (statement != null){- statement.TryBind("ExcludeLocationTypes", query.ExcludeLocationTypes[0].ToString());+ statement.TryBind("@ExcludeLocationTypes", query.ExcludeLocationTypes[0].ToString());}}}