aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Security/AuthenticationRepository.cs
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-05-20 22:40:25 +0200
committerGitHub <noreply@github.com>2021-05-20 22:40:25 +0200
commite8790bfa963284863dc1126a83df72309ec30561 (patch)
tree519501b93593e3bbbf1551c1de95afb21bbfd624 /Emby.Server.Implementations/Security/AuthenticationRepository.cs
parentc6ca722e57c7b83c5105bbf9b0de63b616d556de (diff)
parente0f793799afccd4e2d640dbf5554f72d8a8f8b02 (diff)
Merge pull request #6054 from cvium/allocationz_2_extreme_db_plsdonthurtme
Diffstat (limited to 'Emby.Server.Implementations/Security/AuthenticationRepository.cs')
-rw-r--r--Emby.Server.Implementations/Security/AuthenticationRepository.cs41
1 files changed, 20 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/Security/AuthenticationRepository.cs b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
index 4bc12f44a..76f863c95 100644
--- a/Emby.Server.Implementations/Security/AuthenticationRepository.cs
+++ b/Emby.Server.Implementations/Security/AuthenticationRepository.cs
@@ -297,50 +297,49 @@ namespace Emby.Server.Implementations.Security
AccessToken = reader[1].ToString()
};
- if (reader[2].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(2, out var deviceId))
{
- info.DeviceId = reader[2].ToString();
+ info.DeviceId = deviceId;
}
- if (reader[3].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(3, out var appName))
{
- info.AppName = reader[3].ToString();
+ info.AppName = appName;
}
- if (reader[4].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(4, out var appVersion))
{
- info.AppVersion = reader[4].ToString();
+ info.AppVersion = appVersion;
}
- if (reader[5].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(6, out var userId))
{
- info.DeviceName = reader[5].ToString();
+ info.UserId = new Guid(userId);
}
- if (reader[6].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(7, out var userName))
{
- info.UserId = new Guid(reader[6].ToString());
- }
-
- if (reader[7].SQLiteType != SQLiteType.Null)
- {
- info.UserName = reader[7].ToString();
+ info.UserName = userName;
}
info.DateCreated = reader[8].ReadDateTime();
- if (reader[9].SQLiteType != SQLiteType.Null)
+ if (reader.TryReadDateTime(9, out var dateLastActivity))
{
- info.DateLastActivity = reader[9].ReadDateTime();
+ info.DateLastActivity = dateLastActivity;
}
else
{
info.DateLastActivity = info.DateCreated;
}
- if (reader[10].SQLiteType != SQLiteType.Null)
+ if (reader.TryGetString(10, out var customName))
+ {
+ info.DeviceName = customName;
+ }
+ else if (reader.TryGetString(5, out var deviceName))
{
- info.DeviceName = reader[10].ToString();
+ info.DeviceName = deviceName;
}
return info;
@@ -361,9 +360,9 @@ namespace Emby.Server.Implementations.Security
foreach (var row in statement.ExecuteQuery())
{
- if (row[0].SQLiteType != SQLiteType.Null)
+ if (row.TryGetString(0, out var customName))
{
- result.CustomName = row[0].ToString();
+ result.CustomName = customName;
}
}