Last bit of cleanup
This commit is contained in:
parent
7898af4ceb
commit
db2765aae5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user