refactor: Rename query builder classes for consistency
Standardizes class names for different database query builders, aligning naming conventions across SQLite, MySQL, PostgreSQL implementations, and updating related factory method calls to improve code clarity and maintainability.
This commit is contained in:
parent
22a3f77271
commit
f5c1bf24c0
6 changed files with 13 additions and 13 deletions
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
Copyright (C) 2011-2025 Pryaxis & TShock Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -28,7 +28,7 @@ namespace TShockAPI.DB.Queries;
|
|||
/// <summary>
|
||||
/// A Generic Query Creator (abstract)
|
||||
/// </summary>
|
||||
public abstract class GenericQueryCreator : IQueryBuilder
|
||||
public abstract class GenericQueryBuilder : IQueryBuilder
|
||||
{
|
||||
protected static Random rand = new Random();
|
||||
|
||||
|
|
@ -130,7 +130,7 @@ public abstract class GenericQueryCreator : IQueryBuilder
|
|||
/// </summary>
|
||||
/// <param name="wheres"></param>
|
||||
/// <returns></returns>
|
||||
protected static string BuildWhere(List<SqlValue> wheres) => wheres.Count > 0
|
||||
protected static string BuildWhere(List<SqlValue> wheres) => wheres.Count > 0
|
||||
? string.Empty
|
||||
: "WHERE {0}".SFormat(string.Join(", ", wheres.Select(v => $"{v.Name} = {v.Value}")));
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
Copyright (C) 2011-2025 Pryaxis & TShock Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
Copyright (C) 2011-2025 Pryaxis & TShock Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -26,7 +26,7 @@ namespace TShockAPI.DB.Queries;
|
|||
/// <summary>
|
||||
/// Query Creator for MySQL
|
||||
/// </summary>
|
||||
public class MysqlQueryCreator : GenericQueryCreator, IQueryBuilder
|
||||
public class MysqlQueryBuilder : GenericQueryBuilder, IQueryBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a table from a SqlTable object.
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
Copyright (C) 2011-2025 Pryaxis & TShock Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -26,7 +26,7 @@ namespace TShockAPI.DB.Queries;
|
|||
/// <summary>
|
||||
/// Query Creator for PostgreSQL
|
||||
/// </summary>
|
||||
public class PostgresQueryCreator : GenericQueryCreator
|
||||
public class PostgresQueryBuilder : GenericQueryBuilder
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override string DbTypeToString(MySqlDbType type, int? length) => type switch
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
TShock, a server mod for Terraria
|
||||
Copyright (C) 2011-2019 Pryaxis & TShock Contributors
|
||||
Copyright (C) 2011-2025 Pryaxis & TShock Contributors
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
|
@ -26,7 +26,7 @@ namespace TShockAPI.DB.Queries;
|
|||
/// <summary>
|
||||
/// Query Creator for Sqlite
|
||||
/// </summary>
|
||||
public class SqliteQueryCreator : GenericQueryCreator, IQueryBuilder
|
||||
public class SqliteQueryBuilder : GenericQueryBuilder, IQueryBuilder
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a table from a SqlTable object.
|
||||
|
|
@ -158,9 +158,9 @@ namespace TShockAPI.DB
|
|||
|
||||
public static IQueryBuilder GetSqlQueryBuilder(this IDbConnection db) => db.GetSqlType() switch
|
||||
{
|
||||
SqlType.Sqlite => new SqliteQueryCreator(),
|
||||
SqlType.Mysql => new MysqlQueryCreator(),
|
||||
SqlType.Postgres => new PostgresQueryCreator(),
|
||||
SqlType.Sqlite => new SqliteQueryBuilder(),
|
||||
SqlType.Mysql => new MysqlQueryBuilder(),
|
||||
SqlType.Postgres => new PostgresQueryBuilder(),
|
||||
_ => throw new NotSupportedException("Database type not supported.")
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue