Refactor changes didn't save
This commit is contained in:
parent
4bab43466c
commit
9d4e2d6d9b
3 changed files with 8 additions and 8 deletions
|
|
@ -5,12 +5,12 @@ using System.Text;
|
||||||
|
|
||||||
namespace TShockAPI.DB
|
namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
public interface IQuery
|
public interface IQueryCreator
|
||||||
{
|
{
|
||||||
string CreateTable(SqlTable table);
|
string CreateTable(SqlTable table);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class SqliteQuery : IQuery
|
public class SqliteQueryCreator : IQueryCreator
|
||||||
{
|
{
|
||||||
public string CreateTable(SqlTable table)
|
public string CreateTable(SqlTable table)
|
||||||
{
|
{
|
||||||
|
|
@ -18,7 +18,7 @@ namespace TShockAPI.DB
|
||||||
return "CREATE TABLE '{0}' ({1})".SFormat(table.Name, string.Join(", ", columns));
|
return "CREATE TABLE '{0}' ({1})".SFormat(table.Name, string.Join(", ", columns));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public class MysqlQuery : IQuery
|
public class MysqlQueryCreator : IQueryCreator
|
||||||
{
|
{
|
||||||
public string CreateTable(SqlTable table)
|
public string CreateTable(SqlTable table)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -24,11 +24,11 @@ namespace TShockAPI.DB
|
||||||
public class SqlTableCreator
|
public class SqlTableCreator
|
||||||
{
|
{
|
||||||
IDbConnection database;
|
IDbConnection database;
|
||||||
IQuery query;
|
IQueryCreator creator;
|
||||||
public SqlTableCreator(IDbConnection db, IQuery provider)
|
public SqlTableCreator(IDbConnection db, IQueryCreator provider)
|
||||||
{
|
{
|
||||||
database = db;
|
database = db;
|
||||||
query = provider;
|
creator = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnsureExists(SqlTable table)
|
public void EnsureExists(SqlTable table)
|
||||||
|
|
@ -43,7 +43,7 @@ namespace TShockAPI.DB
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
database.Query(query.CreateTable(table));
|
database.Query(creator.CreateTable(table));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@
|
||||||
<Compile Include="BackupManager.cs" />
|
<Compile Include="BackupManager.cs" />
|
||||||
<Compile Include="DB\BanManager.cs" />
|
<Compile Include="DB\BanManager.cs" />
|
||||||
<Compile Include="DBTools.cs" />
|
<Compile Include="DBTools.cs" />
|
||||||
<Compile Include="DB\IQuery.cs" />
|
<Compile Include="DB\IQueryCreator.cs" />
|
||||||
<Compile Include="DB\ItemManager.cs" />
|
<Compile Include="DB\ItemManager.cs" />
|
||||||
<Compile Include="DB\SqlColumn.cs" />
|
<Compile Include="DB\SqlColumn.cs" />
|
||||||
<Compile Include="DB\SqlTable.cs" />
|
<Compile Include="DB\SqlTable.cs" />
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue