|
|
@ -82,7 +82,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
|
|
|
|
|
|
|
private IDbCommand _updateInheritedRatingCommand;
|
|
|
|
private IDbCommand _updateInheritedRatingCommand;
|
|
|
|
|
|
|
|
|
|
|
|
private const int LatestSchemaVersion = 32;
|
|
|
|
private const int LatestSchemaVersion = 37;
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
|
|
|
/// Initializes a new instance of the <see cref="SqliteItemRepository"/> class.
|
|
|
@ -223,6 +223,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "IsFolder", "BIT");
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "IsFolder", "BIT");
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "InheritedParentalRatingValue", "INT");
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "InheritedParentalRatingValue", "INT");
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "UnratedType", "Text");
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "UnratedType", "Text");
|
|
|
|
|
|
|
|
_connection.AddColumn(_logger, "TypedBaseItems", "TopParentId", "Text");
|
|
|
|
|
|
|
|
|
|
|
|
PrepareStatements();
|
|
|
|
PrepareStatements();
|
|
|
|
|
|
|
|
|
|
|
@ -451,7 +452,8 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
"ExternalServiceId",
|
|
|
|
"ExternalServiceId",
|
|
|
|
"Tags",
|
|
|
|
"Tags",
|
|
|
|
"IsFolder",
|
|
|
|
"IsFolder",
|
|
|
|
"UnratedType"
|
|
|
|
"UnratedType",
|
|
|
|
|
|
|
|
"TopParentId"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
_saveItemCommand = _connection.CreateCommand();
|
|
|
|
_saveItemCommand = _connection.CreateCommand();
|
|
|
|
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
|
|
|
_saveItemCommand.CommandText = "replace into TypedBaseItems (" + string.Join(",", saveColumns.ToArray()) + ") values (";
|
|
|
@ -726,6 +728,16 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
|
|
|
|
|
|
|
|
_saveItemCommand.GetParameter(index++).Value = item.GetBlockUnratedType().ToString();
|
|
|
|
_saveItemCommand.GetParameter(index++).Value = item.GetBlockUnratedType().ToString();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var topParent = item.GetTopParent();
|
|
|
|
|
|
|
|
if (topParent != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_saveItemCommand.GetParameter(index++).Value = topParent.Id.ToString("N");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_saveItemCommand.GetParameter(index++).Value = null;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_saveItemCommand.Transaction = transaction;
|
|
|
|
_saveItemCommand.Transaction = transaction;
|
|
|
|
|
|
|
|
|
|
|
|
_saveItemCommand.ExecuteNonQuery();
|
|
|
|
_saveItemCommand.ExecuteNonQuery();
|
|
|
@ -1940,6 +1952,18 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
|
|
|
whereClauses.Add("LocationType not in (" + val + ")");
|
|
|
|
whereClauses.Add("LocationType not in (" + val + ")");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (query.TopParentIds.Length == 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
whereClauses.Add("(TopParentId is null or TopParentId=@TopParentId)");
|
|
|
|
|
|
|
|
cmd.Parameters.Add(cmd, "@TopParentId", DbType.String).Value = query.TopParentIds[0];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (query.TopParentIds.Length > 1)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
var val = string.Join(",", query.TopParentIds.Select(i => "'" + i + "'").ToArray());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
whereClauses.Add("(TopParentId is null or TopParentId in (" + val + "))");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (query.AncestorIds.Length == 1)
|
|
|
|
if (query.AncestorIds.Length == 1)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
whereClauses.Add("Guid in (select itemId from AncestorIds where AncestorId=@AncestorId)");
|
|
|
|
whereClauses.Add("Guid in (select itemId from AncestorIds where AncestorId=@AncestorId)");
|
|
|
|