mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-24 05:03:34 -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 ?
|
string syntax = Messages.Rows.Count == 0 ?
|
||||||
"INSERT INTO `Messages" + p.level.name + "` (X, Y, Z, Message) VALUES (@0, @1, @2, @3)"
|
"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);
|
Database.Execute(syntax, x, y, z, cpos.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,10 +22,9 @@ using System.IO;
|
|||||||
namespace MCGalaxy.SQL {
|
namespace MCGalaxy.SQL {
|
||||||
public static partial class Database {
|
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) {
|
public static void AddParams(string name, object param) {
|
||||||
if (Server.useMySQL) MySQL.AddParams(name, param);
|
throw new NotSupportedException("AddParams() is not threadsafe and is deprecated, use Execute() or Fill() instead.");
|
||||||
else SQLite.AddParams(name, param);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool TableExists(string table) {
|
public static bool TableExists(string table) {
|
||||||
@ -143,10 +142,6 @@ namespace MCGalaxy.SQL {
|
|||||||
public static string connString { get { return String.Format(connStringFormat, Server.MySQLHost, Server.MySQLPort, Server.MySQLUsername, Server.MySQLPassword, Server.DatabasePooling); } }
|
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();
|
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";
|
public const string TableExists = "SELECT * FROM information_schema.tables WHERE table_schema = @1 AND table_name = @0";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -156,10 +151,6 @@ namespace MCGalaxy.SQL {
|
|||||||
public static string connString { get { return String.Format(connStringFormat, Server.DatabasePooling); } }
|
public static string connString { get { return String.Format(connStringFormat, Server.DatabasePooling); } }
|
||||||
internal static ParameterisedQuery query = new SQLiteParameterisedQuery();
|
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";
|
public const string TableExists = "SELECT name FROM sqlite_master WHERE type='table' AND name=@0";
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user