2
0
Bond_009 6 жил өмнө
parent
commit
db2765aae5

+ 27 - 29
Emby.Server.Implementations/Data/BaseSqliteRepository.cs

@@ -107,6 +107,33 @@ namespace Emby.Server.Implementations.Data
             }, ReadTransactionMode);
         }
 
+        protected List<string> GetColumnNames(IDatabaseConnection connection, string table)
+        {
+            var list = new List<string>();
+
+            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<string> 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();
-
         /// <summary>
         /// Releases unmanaged and - optionally - managed resources.
         /// </summary>
@@ -154,33 +179,6 @@ namespace Emby.Server.Implementations.Data
 
             _disposed = true;
         }
-
-        protected List<string> GetColumnNames(IDatabaseConnection connection, string table)
-        {
-            var list = new List<string>();
-
-            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<string> existingColumnNames)
-        {
-            if (existingColumnNames.Contains(columnName, StringComparer.OrdinalIgnoreCase))
-            {
-                return;
-            }
-
-            connection.Execute("alter table " + table + " add column " + columnName + " " + type + " NULL");
-        }
     }
 
     public enum SynchronousMode