mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-23 04:32:50 -04:00
Fix /mb on same block yet again (Thanks goodlyay and JPlaysClassic), completely deprecate Database.AddParams as it is not threadsafe and is completely obsoleted by Execute()/Fill() now.
This commit is contained in:
parent
1d9aa1910b
commit
95d5ffed9c
@ -111,7 +111,7 @@ namespace MCGalaxy.Commands.Building {
|
||||
|
||||
string syntax = Messages.Rows.Count == 0 ?
|
||||
"INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (@0, @1, @2, @3)"
|
||||
: "UPDATE `Messages" + p.level.name + "` SET Message=@3 WHERE X=@0, Y=@1, Z=@2";
|
||||
: "UPDATE `Messages" + p.level.name + "` SET Message=@3 WHERE X=@0 AND Y=@1 AND Z=@2";
|
||||
Database.Execute(syntax, x, y, z, cpos.message);
|
||||
}
|
||||
|
||||
|
@ -22,10 +22,9 @@ using System.IO;
|
||||
namespace MCGalaxy.SQL {
|
||||
public static partial class Database {
|
||||
|
||||
[Obsolete("Use a ParameterisedQuery instance instead, which is threadsafe.")]
|
||||
[Obsolete("Use Execute() or Fill() instead, which is threadsafe.", true)]
|
||||
public static void AddParams(string name, object param) {
|
||||
if (Server.useMySQL) MySQL.AddParams(name, param);
|
||||
else SQLite.AddParams(name, param);
|
||||
throw new NotSupportedException("AddParams() is not threadsafe and is deprecated, use Execute() or Fill() instead.");
|
||||
}
|
||||
|
||||
public static bool TableExists(string table) {
|
||||
@ -142,10 +141,6 @@ namespace MCGalaxy.SQL {
|
||||
static string connStringFormat = "Data Source={0};Port={1};User ID={2};Password={3};Pooling={4}";
|
||||
public static string connString { get { return String.Format(connStringFormat, Server.MySQLHost, Server.MySQLPort, Server.MySQLUsername, Server.MySQLPassword, Server.DatabasePooling); } }
|
||||
internal static ParameterisedQuery query = new MySQLParameterisedQuery();
|
||||
|
||||
public static void AddParams(string name, object param) { query.AddParam(name, param); }
|
||||
|
||||
public static void ClearParams() { query.ClearParams(); }
|
||||
|
||||
public const string TableExists = "SELECT * FROM information_schema.tables WHERE table_schema = @1 AND table_name = @0";
|
||||
}
|
||||
@ -155,10 +150,6 @@ namespace MCGalaxy.SQL {
|
||||
static string connStringFormat = "Data Source =" + Server.apppath + "/MCGalaxy.db; Version =3; Pooling ={0}; Max Pool Size =300;";
|
||||
public static string connString { get { return String.Format(connStringFormat, Server.DatabasePooling); } }
|
||||
internal static ParameterisedQuery query = new SQLiteParameterisedQuery();
|
||||
|
||||
public static void AddParams(string name, object param) { query.AddParam(name, param); }
|
||||
|
||||
public static void ClearParams() { query.ClearParams(); }
|
||||
|
||||
public const string TableExists = "SELECT name FROM sqlite_master WHERE type='table' AND name=@0";
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user