refactor(db): Update SqlQueryBuilder references + Various refactors
Consolidates the creation of SQL query builders across multiple classes to ensure a unified approach for database operations. Replaces manual type checks and specific query creators with a generic method for better maintainability and to prevent errors. Improves code readability and reduces duplication, facilitating easier updates in the future.
This commit is contained in:
parent
27fde1f9ac
commit
084411f847
15 changed files with 399 additions and 488 deletions
|
|
@ -62,7 +62,7 @@ namespace TShockAPI
|
|||
/// <param name="clearTextLog"></param>
|
||||
public SqlLog(IDbConnection db, string textlogFilepath, bool clearTextLog)
|
||||
{
|
||||
FileName = string.Format("{0}://database", db.GetSqlType());
|
||||
FileName = $"{db.GetSqlType()}://database";
|
||||
_database = db;
|
||||
_backupLog = new TextLog(textlogFilepath, clearTextLog);
|
||||
|
||||
|
|
@ -74,10 +74,7 @@ namespace TShockAPI
|
|||
new SqlColumn("Message", MySqlDbType.Text)
|
||||
);
|
||||
|
||||
var creator = new SqlTableCreator(db,
|
||||
db.GetSqlType() == SqlType.Sqlite
|
||||
? (IQueryBuilder) new SqliteQueryCreator()
|
||||
: new MysqlQueryCreator());
|
||||
SqlTableCreator creator = new(db, db.GetSqlQueryBuilder());
|
||||
creator.EnsureTableStructure(table);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue