/* TShock, a server mod for Terraria 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 the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ using System.Collections.Generic; using MySql.Data.MySqlClient; namespace TShockAPI.DB.Queries; /// /// Interface for various SQL related utilities. /// public interface IQueryBuilder { /// /// Creates a table from a SqlTable object. /// /// The SqlTable to create the table from /// The sql query for the table creation. string CreateTable(SqlTable table); /// /// Alter a table from source to destination /// /// Must have name and column names. Column types are not required /// Must have column names and column types. /// The SQL Query string AlterTable(SqlTable from, SqlTable to); /// /// Converts the MySqlDbType enum to it's string representation. /// /// The MySqlDbType type /// The length of the datatype /// The string representation string DbTypeToString(MySqlDbType type, int? length); /// /// A UPDATE Query /// /// The table to update /// The values to change /// /// The SQL query string UpdateValue(string table, List values, List wheres); /// /// A INSERT query /// /// The table to insert to /// /// The SQL Query string InsertValues(string table, List values); /// /// A SELECT query to get all columns /// /// The table to select from /// /// The SQL query string ReadColumn(string table, List wheres); /// /// Deletes row(s). /// /// The table to delete the row from /// /// The SQL query string DeleteRow(string table, List wheres); /// /// Renames the given table. /// /// Old name of the table /// New name of the table /// The sql query for renaming the table. string RenameTable(string from, string to); }