From 3d37f51290f9af7ec8e7796cbe02a897c5d42ce6 Mon Sep 17 00:00:00 2001 From: Tyler Watson Date: Sat, 6 Feb 2016 20:37:57 +1000 Subject: [PATCH] Fixed bug in AddRegion failing to completely add regions An invalid SQL query selecting the region ID from the newly inserted region prevented the AddRegion method from completely adding a region, even though it was inserted into the database correctly, leading to a `false` result even though the region add was successful. This fixes /region define, and HouseRegions. --- TShockAPI/DB/RegionManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs index 09862c9d..dd2cfc12 100755 --- a/TShockAPI/DB/RegionManager.cs +++ b/TShockAPI/DB/RegionManager.cs @@ -140,7 +140,7 @@ namespace TShockAPI.DB "INSERT INTO Regions (X1, Y1, width, height, RegionName, WorldID, UserIds, Protected, Groups, Owner, Z) VALUES (@0, @1, @2, @3, @4, @5, @6, @7, @8, @9, @10);", tx, ty, width, height, regionname, worldid, "", 1, "", owner, z); int id; - using (QueryResult res = database.QueryReader("SELECT Id FROM Regions WHERE RegionName = @0 AND WorldID = @1", regionname, worldid)) + using (QueryResult res = database.QueryReader("SELECT Id FROM Regions WHERE RegionName = '@0' AND WorldID = '@1'", regionname, worldid)) { id = res.Get("Id"); }