From db2765aae5556fd4e05e1c310027bdbd699327d2 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Wed, 3 Apr 2019 18:02:43 +0200 Subject: [PATCH] Last bit of cleanup --- .../Data/BaseSqliteRepository.cs | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index 4da6665c2c..7938d6b7e0 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -107,6 +107,33 @@ namespace Emby.Server.Implementations.Data }, ReadTransactionMode); } + protected List GetColumnNames(IDatabaseConnection connection, string table) + { + var list = new List(); + + foreach (var row in connection.Query("PRAGMA table_info(" + table + ")")) + { + if (row[1].SQLiteType != SQLiteType.Null) + { + var name = row[1].ToString(); + + list.Add(name); + } + } + + return list; + } + + protected void AddColumn(IDatabaseConnection connection, string table, string columnName, string type, List existingColumnNames) + { + if (existingColumnNames.Contains(columnName, StringComparer.OrdinalIgnoreCase)) + { + return; + } + + connection.Execute("alter table " + table + " add column " + columnName + " " + type + " NULL"); + } + protected void CheckDisposed() { if (_disposed) @@ -121,8 +148,6 @@ namespace Emby.Server.Implementations.Data GC.SuppressFinalize(this); } - private readonly object _disposeLock = new object(); - /// /// Releases unmanaged and - optionally - managed resources. /// @@ -154,33 +179,6 @@ namespace Emby.Server.Implementations.Data _disposed = true; } - - protected List GetColumnNames(IDatabaseConnection connection, string table) - { - var list = new List(); - - foreach (var row in connection.Query("PRAGMA table_info(" + table + ")")) - { - if (row[1].SQLiteType != SQLiteType.Null) - { - var name = row[1].ToString(); - - list.Add(name); - } - } - - return list; - } - - protected void AddColumn(IDatabaseConnection connection, string table, string columnName, string type, List existingColumnNames) - { - if (existingColumnNames.Contains(columnName, StringComparer.OrdinalIgnoreCase)) - { - return; - } - - connection.Execute("alter table " + table + " add column " + columnName + " " + type + " NULL"); - } } public enum SynchronousMode