mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
simplify extension methods
This commit is contained in:
parent
fb511dbae2
commit
cf04b43fa4
@ -134,6 +134,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
connection.Execute("PRAGMA temp_store=" + (int)TempStore);
|
connection.Execute("PRAGMA temp_store=" + (int)TempStore);
|
||||||
|
|
||||||
|
connection.Open();
|
||||||
return connection;
|
return connection;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
"yy-MM-dd"
|
"yy-MM-dd"
|
||||||
};
|
};
|
||||||
|
|
||||||
private static void EnsureOpen(this SqliteConnection sqliteConnection)
|
|
||||||
{
|
|
||||||
if (sqliteConnection.State == ConnectionState.Closed)
|
|
||||||
{
|
|
||||||
sqliteConnection.Open();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<SqliteDataReader> Query(this SqliteConnection sqliteConnection, string commandText)
|
public static IEnumerable<SqliteDataReader> Query(this SqliteConnection sqliteConnection, string commandText)
|
||||||
{
|
{
|
||||||
if (sqliteConnection.State != ConnectionState.Open)
|
if (sqliteConnection.State != ConnectionState.Open)
|
||||||
@ -81,29 +73,11 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
public static void Execute(this SqliteConnection sqliteConnection, string commandText)
|
public static void Execute(this SqliteConnection sqliteConnection, string commandText)
|
||||||
{
|
{
|
||||||
sqliteConnection.EnsureOpen();
|
|
||||||
using var command = sqliteConnection.CreateCommand();
|
using var command = sqliteConnection.CreateCommand();
|
||||||
command.CommandText = commandText;
|
command.CommandText = commandText;
|
||||||
command.ExecuteNonQuery();
|
command.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ExecuteAll(this SqliteConnection sqliteConnection, string commandText)
|
|
||||||
{
|
|
||||||
sqliteConnection.EnsureOpen();
|
|
||||||
|
|
||||||
using var command = sqliteConnection.CreateCommand();
|
|
||||||
command.CommandText = commandText;
|
|
||||||
command.ExecuteNonQuery();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void RunQueries(this SqliteConnection connection, string[] queries)
|
|
||||||
{
|
|
||||||
ArgumentNullException.ThrowIfNull(queries);
|
|
||||||
using var transaction = connection.BeginTransaction();
|
|
||||||
connection.ExecuteAll(string.Join(';', queries));
|
|
||||||
transaction.Commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToDateTimeParamValue(this DateTime dateValue)
|
public static string ToDateTimeParamValue(this DateTime dateValue)
|
||||||
{
|
{
|
||||||
var kind = DateTimeKind.Utc;
|
var kind = DateTimeKind.Utc;
|
||||||
@ -239,6 +213,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
// Blobs aren't always detected automatically
|
||||||
if (isBlob)
|
if (isBlob)
|
||||||
{
|
{
|
||||||
statement.Parameters.Add(new SqliteParameter(name, SqliteType.Blob) { Value = value });
|
statement.Parameters.Add(new SqliteParameter(name, SqliteType.Blob) { Value = value });
|
||||||
@ -250,18 +225,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void TryBind(this SqliteCommand statement, string name, byte[] value)
|
|
||||||
{
|
|
||||||
if (statement.Parameters.Contains(name))
|
|
||||||
{
|
|
||||||
statement.Parameters[name].Value = value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
statement.Parameters.Add(new SqliteParameter(name, SqliteType.Blob, value.Length) { Value = value });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void TryBindNull(this SqliteCommand statement, string name)
|
public static void TryBindNull(this SqliteCommand statement, string name)
|
||||||
{
|
{
|
||||||
statement.TryBind(name, DBNull.Value);
|
statement.TryBind(name, DBNull.Value);
|
||||||
@ -286,7 +249,6 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
public static SqliteCommand PrepareStatement(this SqliteConnection sqliteConnection, string sql)
|
public static SqliteCommand PrepareStatement(this SqliteConnection sqliteConnection, string sql)
|
||||||
{
|
{
|
||||||
sqliteConnection.EnsureOpen();
|
|
||||||
var command = sqliteConnection.CreateCommand();
|
var command = sqliteConnection.CreateCommand();
|
||||||
command.CommandText = sql;
|
command.CommandText = sql;
|
||||||
return command;
|
return command;
|
||||||
|
@ -437,128 +437,126 @@ namespace Emby.Server.Implementations.Data
|
|||||||
};
|
};
|
||||||
|
|
||||||
using (var connection = GetConnection())
|
using (var connection = GetConnection())
|
||||||
|
using (var transaction = connection.BeginTransaction())
|
||||||
{
|
{
|
||||||
connection.RunQueries(queries);
|
connection.Execute(string.Join(';', queries));
|
||||||
|
|
||||||
using (var transaction = connection.BeginTransaction())
|
var existingColumnNames = GetColumnNames(connection, "AncestorIds");
|
||||||
{
|
AddColumn(connection, "AncestorIds", "AncestorIdText", "Text", existingColumnNames);
|
||||||
var existingColumnNames = GetColumnNames(connection, "AncestorIds");
|
|
||||||
AddColumn(connection, "AncestorIds", "AncestorIdText", "Text", existingColumnNames);
|
|
||||||
|
|
||||||
existingColumnNames = GetColumnNames(connection, "TypedBaseItems");
|
existingColumnNames = GetColumnNames(connection, "TypedBaseItems");
|
||||||
|
|
||||||
AddColumn(connection, "TypedBaseItems", "Path", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Path", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "StartDate", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "EndDate", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ChannelId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ChannelId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsMovie", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "CommunityRating", "Float", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "CustomRating", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "CustomRating", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IndexNumber", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsLocked", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Name", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Name", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "OfficialRating", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "MediaType", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "MediaType", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Overview", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Overview", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ParentIndexNumber", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "PremiereDate", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ProductionYear", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ParentId", "GUID", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Genres", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Genres", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SortName", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SortName", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ForcedSortName", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "RunTimeTicks", "BIGINT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "DateCreated", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "DateModified", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsSeries", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "EpisodeTitle", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsRepeat", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "PreferredMetadataLanguage", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "PreferredMetadataCountryCode", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "DateLastRefreshed", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "DateLastSaved", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsInMixedFolder", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "LockedFields", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "LockedFields", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Studios", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Studios", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Audio", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Audio", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ExternalServiceId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Tags", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Tags", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsFolder", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "InheritedParentalRatingValue", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "UnratedType", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "TopParentId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "TrailerTypes", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "CriticRating", "Float", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "CleanName", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "CleanName", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "PresentationUniqueKey", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "OriginalTitle", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "PrimaryVersionId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "DateLastMediaAdded", "DATETIME", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Album", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Album", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "LUFS", "Float", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "LUFS", "Float", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "IsVirtualItem", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SeriesName", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SeriesName", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "UserDataKey", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SeasonName", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SeasonName", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SeasonId", "GUID", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SeriesId", "GUID", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ExternalSeriesId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Tagline", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Tagline", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ProviderIds", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Images", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Images", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ProductionLocations", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ExtraIds", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ExtraIds", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "TotalBitrate", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ExtraType", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ExtraType", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Artists", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Artists", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "AlbumArtists", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ExternalId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "SeriesPresentationUniqueKey", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "ShowId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "ShowId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "OwnerId", "Text", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "OwnerId", "Text", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Width", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Width", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Height", "INT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Height", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "TypedBaseItems", "Size", "BIGINT", existingColumnNames);
|
AddColumn(connection, "TypedBaseItems", "Size", "BIGINT", existingColumnNames);
|
||||||
|
|
||||||
existingColumnNames = GetColumnNames(connection, "ItemValues");
|
existingColumnNames = GetColumnNames(connection, "ItemValues");
|
||||||
AddColumn(connection, "ItemValues", "CleanValue", "Text", existingColumnNames);
|
AddColumn(connection, "ItemValues", "CleanValue", "Text", existingColumnNames);
|
||||||
|
|
||||||
existingColumnNames = GetColumnNames(connection, ChaptersTableName);
|
existingColumnNames = GetColumnNames(connection, ChaptersTableName);
|
||||||
AddColumn(connection, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames);
|
AddColumn(connection, ChaptersTableName, "ImageDateModified", "DATETIME", existingColumnNames);
|
||||||
|
|
||||||
existingColumnNames = GetColumnNames(connection, "MediaStreams");
|
existingColumnNames = GetColumnNames(connection, "MediaStreams");
|
||||||
AddColumn(connection, "MediaStreams", "IsAvc", "BIT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "IsAvc", "BIT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "TimeBase", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "TimeBase", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "CodecTimeBase", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "Title", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "Title", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "NalLengthSize", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "Comment", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "Comment", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "CodecTag", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "CodecTag", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "PixelFormat", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "BitDepth", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "BitDepth", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "RefFrames", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "RefFrames", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "KeyFrames", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "IsAnamorphic", "BIT", existingColumnNames);
|
||||||
|
|
||||||
AddColumn(connection, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "ColorPrimaries", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "ColorSpace", "TEXT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "ColorTransfer", "TEXT", existingColumnNames);
|
||||||
|
|
||||||
AddColumn(connection, "MediaStreams", "DvVersionMajor", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "DvVersionMajor", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "DvVersionMinor", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "DvVersionMinor", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "DvProfile", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "DvProfile", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "DvLevel", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "DvLevel", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "RpuPresentFlag", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "RpuPresentFlag", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "ElPresentFlag", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "ElPresentFlag", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "BlPresentFlag", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "BlPresentFlag", "INT", existingColumnNames);
|
||||||
AddColumn(connection, "MediaStreams", "DvBlSignalCompatibilityId", "INT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "DvBlSignalCompatibilityId", "INT", existingColumnNames);
|
||||||
|
|
||||||
AddColumn(connection, "MediaStreams", "IsHearingImpaired", "BIT", existingColumnNames);
|
AddColumn(connection, "MediaStreams", "IsHearingImpaired", "BIT", existingColumnNames);
|
||||||
|
|
||||||
transaction.Commit();
|
connection.Execute(string.Join(';', postQueries));
|
||||||
}
|
|
||||||
|
|
||||||
connection.RunQueries(postQueries);
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -674,7 +672,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
if (TypeRequiresDeserialization(type))
|
if (TypeRequiresDeserialization(type))
|
||||||
{
|
{
|
||||||
saveItemStatement.TryBind("@data", JsonSerializer.SerializeToUtf8Bytes(item, type, _jsonOptions));
|
saveItemStatement.TryBind("@data", JsonSerializer.SerializeToUtf8Bytes(item, type, _jsonOptions), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4656,7 +4654,7 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
|||||||
""";
|
""";
|
||||||
using var connection = GetConnection();
|
using var connection = GetConnection();
|
||||||
using var transaction = connection.BeginTransaction();
|
using var transaction = connection.BeginTransaction();
|
||||||
connection.ExecuteAll(Statements);
|
connection.Execute(Statements);
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
var users = userDatasTableExists ? null : _userManager.Users;
|
var users = userDatasTableExists ? null : _userManager.Users;
|
||||||
using var transaction = connection.BeginTransaction();
|
using var transaction = connection.BeginTransaction();
|
||||||
connection.ExecuteAll(string.Join(';', new[]
|
connection.Execute(string.Join(';', new[]
|
||||||
{
|
{
|
||||||
"create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)",
|
"create table if not exists UserDatas (key nvarchar not null, userId INT not null, rating float null, played bit not null, playCount int not null, isFavorite bit not null, playbackPositionTicks bigint not null, lastPlayedDate datetime null, AudioStreamIndex INT, SubtitleStreamIndex INT)",
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ namespace Emby.Server.Implementations.Data
|
|||||||
|
|
||||||
ImportUserIds(connection, users);
|
ImportUserIds(connection, users);
|
||||||
|
|
||||||
connection.ExecuteAll("INSERT INTO UserDatas (key, userId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex) SELECT key, InternalUserId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex from userdata where InternalUserId not null");
|
connection.Execute("INSERT INTO UserDatas (key, userId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex) SELECT key, InternalUserId, rating, played, playCount, isFavorite, playbackPositionTicks, lastPlayedDate, AudioStreamIndex, SubtitleStreamIndex from userdata where InternalUserId not null");
|
||||||
|
|
||||||
transaction.Commit();
|
transaction.Commit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user