aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs')
-rw-r--r--OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs77
1 files changed, 74 insertions, 3 deletions
diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
index 0df88b6..3648437 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLGridData.cs
@@ -38,7 +38,7 @@ namespace OpenSim.Framework.Data.MSSQL
38 /// <summary> 38 /// <summary>
39 /// A grid data interface for Microsoft SQL Server 39 /// A grid data interface for Microsoft SQL Server
40 /// </summary> 40 /// </summary>
41 public class SqlGridData : IGridData 41 public class MSSQLGridData : IGridData
42 { 42 {
43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
44 44
@@ -77,7 +77,7 @@ namespace OpenSim.Framework.Data.MSSQL
77 77
78 private void TestTables() 78 private void TestTables()
79 { 79 {
80 IDbCommand cmd = database.Query("SELECT * FROM "+m_regionsTableName, new Dictionary<string, string>()); 80 IDbCommand cmd = database.Query("SELECT TOP 1 * FROM "+m_regionsTableName, new Dictionary<string, string>());
81 81
82 try 82 try
83 { 83 {
@@ -200,7 +200,7 @@ namespace OpenSim.Framework.Data.MSSQL
200 System.Console.WriteLine("No regions found. Create new one."); 200 System.Console.WriteLine("No regions found. Create new one.");
201 } 201 }
202 202
203 if (database.insertRegionRow(profile)) 203 if ( insertRegionRow(profile))
204 { 204 {
205 return DataResponse.RESPONSE_OK; 205 return DataResponse.RESPONSE_OK;
206 } 206 }
@@ -210,6 +210,77 @@ namespace OpenSim.Framework.Data.MSSQL
210 } 210 }
211 } 211 }
212 212
213
214 /// <summary>
215 /// Creates a new region in the database
216 /// </summary>
217 /// <param name="profile">The region profile to insert</param>
218 /// <returns>Successful?</returns>
219 public bool insertRegionRow(RegionProfileData profile)
220 {
221 //Insert new region
222 string sql =
223 "INSERT INTO " + m_regionsTableName + " ([regionHandle], [regionName], [uuid], [regionRecvKey], [regionSecret], [regionSendKey], [regionDataURI], ";
224 sql +=
225 "[serverIP], [serverPort], [serverURI], [locX], [locY], [locZ], [eastOverrideHandle], [westOverrideHandle], [southOverrideHandle], [northOverrideHandle], [regionAssetURI], [regionAssetRecvKey], ";
226 sql +=
227 "[regionAssetSendKey], [regionUserURI], [regionUserRecvKey], [regionUserSendKey], [regionMapTexture], [serverHttpPort], [serverRemotingPort]) VALUES ";
228
229 sql += "(@regionHandle, @regionName, @uuid, @regionRecvKey, @regionSecret, @regionSendKey, @regionDataURI, ";
230 sql +=
231 "@serverIP, @serverPort, @serverURI, @locX, @locY, @locZ, @eastOverrideHandle, @westOverrideHandle, @southOverrideHandle, @northOverrideHandle, @regionAssetURI, @regionAssetRecvKey, ";
232 sql +=
233 "@regionAssetSendKey, @regionUserURI, @regionUserRecvKey, @regionUserSendKey, @regionMapTexture, @serverHttpPort, @serverRemotingPort);";
234
235 Dictionary<string, string> parameters = new Dictionary<string, string>();
236
237 parameters["regionHandle"] = profile.regionHandle.ToString();
238 parameters["regionName"] = profile.regionName;
239 parameters["uuid"] = profile.UUID.ToString();
240 parameters["regionRecvKey"] = profile.regionRecvKey;
241 parameters["regionSecret"] = profile.regionSecret;
242 parameters["regionSendKey"] = profile.regionSendKey;
243 parameters["regionDataURI"] = profile.regionDataURI;
244 parameters["serverIP"] = profile.serverIP;
245 parameters["serverPort"] = profile.serverPort.ToString();
246 parameters["serverURI"] = profile.serverURI;
247 parameters["locX"] = profile.regionLocX.ToString();
248 parameters["locY"] = profile.regionLocY.ToString();
249 parameters["locZ"] = profile.regionLocZ.ToString();
250 parameters["eastOverrideHandle"] = profile.regionEastOverrideHandle.ToString();
251 parameters["westOverrideHandle"] = profile.regionWestOverrideHandle.ToString();
252 parameters["northOverrideHandle"] = profile.regionNorthOverrideHandle.ToString();
253 parameters["southOverrideHandle"] = profile.regionSouthOverrideHandle.ToString();
254 parameters["regionAssetURI"] = profile.regionAssetURI;
255 parameters["regionAssetRecvKey"] = profile.regionAssetRecvKey;
256 parameters["regionAssetSendKey"] = profile.regionAssetSendKey;
257 parameters["regionUserURI"] = profile.regionUserURI;
258 parameters["regionUserRecvKey"] = profile.regionUserRecvKey;
259 parameters["regionUserSendKey"] = profile.regionUserSendKey;
260 parameters["regionMapTexture"] = profile.regionMapTextureID.ToString();
261 parameters["serverHttpPort"] = profile.httpPort.ToString();
262 parameters["serverRemotingPort"] = profile.remotingPort.ToString();
263
264
265 bool returnval = false;
266
267 try
268 {
269 IDbCommand result = database.Query(sql, parameters);
270
271 if (result.ExecuteNonQuery() == 1)
272 returnval = true;
273
274 result.Dispose();
275 }
276 catch (Exception e)
277 {
278 m_log.Error("MSSQLManager : " + e.ToString());
279 }
280
281 return returnval;
282 }
283
213 /// <summary> 284 /// <summary>
214 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret. 285 /// DEPRECIATED. Attempts to authenticate a region by comparing a shared secret.
215 /// </summary> 286 /// </summary>