*Added ability to update only necessary data on insertRegion for the grid server.

afrisby
mingchen 2008-01-07 15:23:00 +00:00
parent bbac579849
commit 1718c39e10
2 changed files with 24 additions and 6 deletions

View File

@ -600,8 +600,19 @@ namespace OpenSim.Framework.Data.MySQL
/// <returns>Success?</returns> /// <returns>Success?</returns>
public bool insertRegion(RegionProfileData regiondata) public bool insertRegion(RegionProfileData regiondata)
{ {
string sql = bool GRID_ONLY_UPDATE_NECESSARY_DATA = false;
"REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
string sql = "";
if (GRID_ONLY_UPDATE_NECESSARY_DATA)
{
sql += "INSERT INTO ";
}
else
{
sql += "REPLACE INTO ";
}
sql += "regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
sql += sql +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, "; "serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql += sql +=
@ -611,8 +622,16 @@ namespace OpenSim.Framework.Data.MySQL
sql += sql +=
"?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, "; "?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
sql += sql +=
"?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);"; "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort)";
//sql += "ON DUPLICATE KEY UPDATE;";
if (GRID_ONLY_UPDATE_NECESSARY_DATA)
{
sql += "ON DUPLICATE KEY UPDATE serverIP = ?serverIP, serverPort = ?serverPort, serverURI = ?serverURI;";
}
else
{
sql += ";";
}
Dictionary<string, string> parameters = new Dictionary<string, string>(); Dictionary<string, string> parameters = new Dictionary<string, string>();
@ -642,7 +661,6 @@ namespace OpenSim.Framework.Data.MySQL
parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToString(); parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToString();
parameters["?serverHttpPort"] = regiondata.httpPort.ToString(); parameters["?serverHttpPort"] = regiondata.httpPort.ToString();
parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString(); parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString();
bool returnval = false; bool returnval = false;
try try