* Escaped log messages properly when logging to DB

* World map textures are now checked against DBNull before returning
* MySQL now informs when it gets a connection
* "Fastmode" support added to world map queries (MySQL-only), disabled by default.
zircon^2
Adam Frisby 2007-05-28 23:32:05 +00:00
parent 0ba587022b
commit 82ab883ea2
2 changed files with 54 additions and 20 deletions

View File

@ -33,6 +33,8 @@ namespace OpenGrid.Framework.Data.MySQL
dbcon = new MySqlConnection(connectionString); dbcon = new MySqlConnection(connectionString);
dbcon.Open(); dbcon.Open();
System.Console.WriteLine("MySQL connection established");
} }
catch (Exception e) catch (Exception e)
{ {
@ -120,7 +122,15 @@ namespace OpenGrid.Framework.Data.MySQL
retval.regionUserSendKey = (string)reader["regionUserSendKey"]; retval.regionUserSendKey = (string)reader["regionUserSendKey"];
// World Map Addition // World Map Addition
retval.regionMapTextureID = new libsecondlife.LLUUID((string)reader["regionMapTexture"]); string tempRegionMap = reader["regionMapTexture"].ToString();
if (tempRegionMap != "")
{
retval.regionMapTextureID = new libsecondlife.LLUUID(tempRegionMap);
}
else
{
retval.regionMapTextureID = new libsecondlife.LLUUID();
}
} }
else else
{ {
@ -209,7 +219,7 @@ namespace OpenGrid.Framework.Data.MySQL
public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage) public bool insertLogRow(string serverDaemon, string target, string methodCall, string arguments, int priority, string logMessage)
{ {
string sql = "INSERT INTO logs (target, server, method, arguments, priority, message) VALUES ("; string sql = "INSERT INTO logs (`target`, `server`, `method`, `arguments`, `priority`, `message`) VALUES ";
sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)"; sql += "(?target, ?server, ?method, ?arguments, ?priority, ?message)";
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();

View File

@ -315,6 +315,29 @@ namespace OpenGridServices.GridServer
response.Value = responseData; response.Value = responseData;
IList simProfileList = new ArrayList(); IList simProfileList = new ArrayList();
bool fastMode = false; // MySQL Only
if (fastMode)
{
Dictionary<ulong, SimProfileData> neighbours = getRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
foreach (KeyValuePair<ulong, SimProfileData> aSim in neighbours)
{
Hashtable simProfileBlock = new Hashtable();
simProfileBlock["x"] = aSim.Value.regionLocX;
simProfileBlock["y"] = aSim.Value.regionLocY;
simProfileBlock["name"] = aSim.Value.regionName;
simProfileBlock["access"] = 0;
simProfileBlock["region-flags"] = 0;
simProfileBlock["water-height"] = 20;
simProfileBlock["agents"] = 1;
simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString();
simProfileList.Add(simProfileBlock);
}
}
else
{
SimProfileData simProfile; SimProfileData simProfile;
for (int x = xmin; x < xmax; x++) for (int x = xmin; x < xmax; x++)
{ {
@ -337,6 +360,7 @@ namespace OpenGridServices.GridServer
} }
} }
} }
}
responseData["sim-profiles"] = simProfileList; responseData["sim-profiles"] = simProfileList;