From 1718c39e100b17d44d14e9fa138d4a24793e4b89 Mon Sep 17 00:00:00 2001
From: mingchen
Date: Mon, 7 Jan 2008 15:23:00 +0000
Subject: *Added ability to update only necessary data on insertRegion for the
grid server.
---
OpenSim/Framework/Data.MySQL/MySQLManager.cs | 28 +++++++++++++++++++++++-----
OpenSim/Grid/UserServer/UserManager.cs | 2 +-
2 files changed, 24 insertions(+), 6 deletions(-)
(limited to 'OpenSim')
diff --git a/OpenSim/Framework/Data.MySQL/MySQLManager.cs b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
index 96f0c4d..9532f21 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLManager.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLManager.cs
@@ -600,8 +600,19 @@ namespace OpenSim.Framework.Data.MySQL
/// Success?
public bool insertRegion(RegionProfileData regiondata)
{
- string sql =
- "REPLACE INTO regions (regionHandle, regionName, uuid, regionRecvKey, regionSecret, regionSendKey, regionDataURI, ";
+ bool GRID_ONLY_UPDATE_NECESSARY_DATA = false;
+
+ 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 +=
"serverIP, serverPort, serverURI, locX, locY, locZ, eastOverrideHandle, westOverrideHandle, southOverrideHandle, northOverrideHandle, regionAssetURI, regionAssetRecvKey, ";
sql +=
@@ -611,8 +622,16 @@ namespace OpenSim.Framework.Data.MySQL
sql +=
"?serverIP, ?serverPort, ?serverURI, ?locX, ?locY, ?locZ, ?eastOverrideHandle, ?westOverrideHandle, ?southOverrideHandle, ?northOverrideHandle, ?regionAssetURI, ?regionAssetRecvKey, ";
sql +=
- "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort);";
- //sql += "ON DUPLICATE KEY UPDATE;";
+ "?regionAssetSendKey, ?regionUserURI, ?regionUserRecvKey, ?regionUserSendKey, ?regionMapTexture, ?serverHttpPort, ?serverRemotingPort)";
+
+ if (GRID_ONLY_UPDATE_NECESSARY_DATA)
+ {
+ sql += "ON DUPLICATE KEY UPDATE serverIP = ?serverIP, serverPort = ?serverPort, serverURI = ?serverURI;";
+ }
+ else
+ {
+ sql += ";";
+ }
Dictionary parameters = new Dictionary();
@@ -642,7 +661,6 @@ namespace OpenSim.Framework.Data.MySQL
parameters["?regionMapTexture"] = regiondata.regionMapTextureID.ToString();
parameters["?serverHttpPort"] = regiondata.httpPort.ToString();
parameters["?serverRemotingPort"] = regiondata.remotingPort.ToString();
-
bool returnval = false;
try
diff --git a/OpenSim/Grid/UserServer/UserManager.cs b/OpenSim/Grid/UserServer/UserManager.cs
index c905ffe..03b1fbc 100644
--- a/OpenSim/Grid/UserServer/UserManager.cs
+++ b/OpenSim/Grid/UserServer/UserManager.cs
@@ -334,4 +334,4 @@ namespace OpenSim.Grid.UserServer
throw new Exception("The method or operation is not implemented.");
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1