Rename SQL extension methods

pull/6054/head
cvium 4 years ago
parent 652909e8a5
commit be4aeb5c2c

@ -171,7 +171,7 @@ namespace Emby.Server.Implementations.Data
return true;
}
public static bool TryGetInt(this IReadOnlyList<IResultSetValue> reader, int index, out int? result)
public static bool TryGetInt32(this IReadOnlyList<IResultSetValue> reader, int index, [NotNullWhen(true)] out int? result)
{
result = null;
var item = reader[index];
@ -189,7 +189,7 @@ namespace Emby.Server.Implementations.Data
return result[index].ToInt64();
}
public static bool TryGetLong(this IReadOnlyList<IResultSetValue> reader, int index, out long? result)
public static bool TryGetInt64(this IReadOnlyList<IResultSetValue> reader, int index, [NotNullWhen(true)] out long? result)
{
result = null;
var item = reader[index];
@ -202,7 +202,7 @@ namespace Emby.Server.Implementations.Data
return true;
}
public static bool TryGetFloat(this IReadOnlyList<IResultSetValue> reader, int index, out float? result)
public static bool TryGetSingle(this IReadOnlyList<IResultSetValue> reader, int index, [NotNullWhen(true)] out float? result)
{
result = null;
var item = reader[index];
@ -215,7 +215,7 @@ namespace Emby.Server.Implementations.Data
return true;
}
public static bool TryGetDouble(this IReadOnlyList<IResultSetValue> reader, int index, out double? result)
public static bool TryGetDouble(this IReadOnlyList<IResultSetValue> reader, int index, [NotNullWhen(true)] out double? result)
{
result = null;
var item = reader[index];

@ -1390,7 +1390,7 @@ namespace Emby.Server.Implementations.Data
}
}
if (reader.TryGetFloat(index++, out var communityRating))
if (reader.TryGetSingle(index++, out var communityRating))
{
item.CommunityRating = communityRating;
}
@ -1403,7 +1403,7 @@ namespace Emby.Server.Implementations.Data
}
}
if (reader.TryGetInt(index++, out var indexNumber))
if (reader.TryGetInt32(index++, out var indexNumber))
{
item.IndexNumber = indexNumber;
}
@ -1428,7 +1428,7 @@ namespace Emby.Server.Implementations.Data
if (HasField(query, ItemFields.Width))
{
if (reader.TryGetInt(index++, out var width))
if (reader.TryGetInt32(index++, out var width))
{
item.Width = width.Value;
}
@ -1436,7 +1436,7 @@ namespace Emby.Server.Implementations.Data
if (HasField(query, ItemFields.Height))
{
if (reader.TryGetInt(index++, out var height))
if (reader.TryGetInt32(index++, out var height))
{
item.Height = height.Value;
}
@ -1473,12 +1473,12 @@ namespace Emby.Server.Implementations.Data
}
}
if (reader.TryGetInt(index++, out var parentIndexNumber))
if (reader.TryGetInt32(index++, out var parentIndexNumber))
{
item.ParentIndexNumber = parentIndexNumber;
}
if (reader.TryGetInt(index++, out var productionYear))
if (reader.TryGetInt32(index++, out var productionYear))
{
item.ProductionYear = productionYear;
}
@ -1496,12 +1496,12 @@ namespace Emby.Server.Implementations.Data
}
}
if (reader.TryGetLong(index++, out var runTimeTicks))
if (reader.TryGetInt64(index++, out var runTimeTicks))
{
item.RunTimeTicks = runTimeTicks;
}
if (reader.TryGetLong(index++, out var size))
if (reader.TryGetInt64(index++, out var size))
{
item.Size = size;
}
@ -1662,7 +1662,7 @@ namespace Emby.Server.Implementations.Data
item.Album = album;
}
if (reader.TryGetFloat(index++, out var criticRating))
if (reader.TryGetSingle(index++, out var criticRating))
{
item.CriticRating = criticRating;
}
@ -1729,7 +1729,7 @@ namespace Emby.Server.Implementations.Data
if (HasField(query, ItemFields.InheritedParentalRatingValue))
{
if (reader.TryGetInt(index++, out var parentalRating))
if (reader.TryGetInt32(index++, out var parentalRating))
{
item.InheritedParentalRatingValue = parentalRating.Value;
}
@ -1784,7 +1784,7 @@ namespace Emby.Server.Implementations.Data
}
}
if (reader.TryGetInt(index++, out var totalBitrate))
if (reader.TryGetInt32(index++, out var totalBitrate))
{
item.TotalBitrate = totalBitrate;
}
@ -5749,7 +5749,7 @@ AND Type = @InternalPersonType)");
item.Type = type;
}
if (reader.TryGetInt(4, out var sortOrder))
if (reader.TryGetInt32(4, out var sortOrder))
{
item.SortOrder = sortOrder;
}
@ -5979,17 +5979,17 @@ AND Type = @InternalPersonType)");
item.IsInterlaced = reader.GetBoolean(9);
if (reader.TryGetInt(10, out var bitrate))
if (reader.TryGetInt32(10, out var bitrate))
{
item.BitRate = bitrate;
}
if (reader.TryGetInt(11, out var channels))
if (reader.TryGetInt32(11, out var channels))
{
item.Channels = channels;
}
if (reader.TryGetInt(12, out var sampleRate))
if (reader.TryGetInt32(12, out var sampleRate))
{
item.SampleRate = sampleRate;
}
@ -5998,27 +5998,27 @@ AND Type = @InternalPersonType)");
item.IsForced = reader.GetBoolean(14);
item.IsExternal = reader.GetBoolean(15);
if (reader.TryGetInt(16, out var width))
if (reader.TryGetInt32(16, out var width))
{
item.Width = width;
}
if (reader.TryGetInt(17, out var height))
if (reader.TryGetInt32(17, out var height))
{
item.Height = height;
}
if (reader.TryGetFloat(18, out var averageFrameRate))
if (reader.TryGetSingle(18, out var averageFrameRate))
{
item.AverageFrameRate = averageFrameRate;
}
if (reader.TryGetFloat(19, out var realFrameRate))
if (reader.TryGetSingle(19, out var realFrameRate))
{
item.RealFrameRate = realFrameRate;
}
if (reader.TryGetFloat(20, out var level))
if (reader.TryGetSingle(20, out var level))
{
item.Level = level;
}
@ -6028,7 +6028,7 @@ AND Type = @InternalPersonType)");
item.PixelFormat = pixelFormat;
}
if (reader.TryGetInt(22, out var bitDepth))
if (reader.TryGetInt32(22, out var bitDepth))
{
item.BitDepth = bitDepth;
}
@ -6038,7 +6038,7 @@ AND Type = @InternalPersonType)");
item.IsAnamorphic = isAnamorphic;
}
if (reader.TryGetInt(24, out var refFrames))
if (reader.TryGetInt32(24, out var refFrames))
{
item.RefFrames = refFrames;
}

@ -370,12 +370,12 @@ namespace Emby.Server.Implementations.Data
userData.LastPlayedDate = lastPlayedDate;
}
if (reader.TryGetInt(8, out var audioStreamIndex))
if (reader.TryGetInt32(8, out var audioStreamIndex))
{
userData.AudioStreamIndex = audioStreamIndex;
}
if (reader.TryGetInt(9, out var subtitleStreamIndex))
if (reader.TryGetInt32(9, out var subtitleStreamIndex))
{
userData.SubtitleStreamIndex = subtitleStreamIndex;
}

Loading…
Cancel
Save