Skip to content

Commit

Permalink
Fixed bug in AddRegion failing to completely add regions
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tylerjwatson committed Feb 6, 2016
1 parent 1bf703a commit 3d37f51
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion TShockAPI/DB/RegionManager.cs
Expand Up @@ -140,7 +140,7 @@ public bool AddRegion(int tx, int ty, int width, int height, string regionname,
"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<int>("Id");
}
Expand Down

0 comments on commit 3d37f51

Please sign in to comment.