aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data
diff options
context:
space:
mode:
authorKunnis2009-08-16 23:25:12 -0500
committerMelanie2009-08-19 23:46:25 +0100
commitb1853d9f265fb32cf51d65fdcf2d5b4741911f00 (patch)
treec3d814cc0a53ef3a68310e5872eafc3f5acc0280 /OpenSim/Data
parent* Switching IAssetData to follow the new naming schema, removing the separate... (diff)
downloadopensim-SC-b1853d9f265fb32cf51d65fdcf2d5b4741911f00.zip
opensim-SC-b1853d9f265fb32cf51d65fdcf2d5b4741911f00.tar.gz
opensim-SC-b1853d9f265fb32cf51d65fdcf2d5b4741911f00.tar.bz2
opensim-SC-b1853d9f265fb32cf51d65fdcf2d5b4741911f00.tar.xz
Fixing a spot I missed in assets. Switching Grid to the new naming schema with Store/Get
Diffstat (limited to 'OpenSim/Data')
-rw-r--r--OpenSim/Data/GridDataBase.cs3
-rw-r--r--OpenSim/Data/IGridData.cs11
-rw-r--r--OpenSim/Data/MSSQL/MSSQLGridData.cs27
-rw-r--r--OpenSim/Data/MySQL/MySQLGridData.cs13
-rw-r--r--OpenSim/Data/NHibernate/NHibernateGridData.cs14
-rw-r--r--OpenSim/Data/SQLite/SQLiteGridData.cs10
-rw-r--r--OpenSim/Data/Tests/BasicGridTest.cs8
7 files changed, 23 insertions, 63 deletions
diff --git a/OpenSim/Data/GridDataBase.cs b/OpenSim/Data/GridDataBase.cs
index 5a30455..a03488b 100644
--- a/OpenSim/Data/GridDataBase.cs
+++ b/OpenSim/Data/GridDataBase.cs
@@ -38,9 +38,8 @@ namespace OpenSim.Data
38 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); 38 public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
39 public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); 39 public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
40 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); 40 public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
41 public abstract DataResponse AddProfile(RegionProfileData profile); 41 public abstract DataResponse StoreProfile(RegionProfileData profile);
42 public abstract ReservationData GetReservationAtPoint(uint x, uint y); 42 public abstract ReservationData GetReservationAtPoint(uint x, uint y);
43 public abstract DataResponse UpdateProfile(RegionProfileData profile);
44 public abstract DataResponse DeleteProfile(string uuid); 43 public abstract DataResponse DeleteProfile(string uuid);
45 44
46 public abstract void Initialise(); 45 public abstract void Initialise();
diff --git a/OpenSim/Data/IGridData.cs b/OpenSim/Data/IGridData.cs
index 4bf8646..8bd3811 100644
--- a/OpenSim/Data/IGridData.cs
+++ b/OpenSim/Data/IGridData.cs
@@ -99,18 +99,11 @@ namespace OpenSim.Data
99 bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); 99 bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
100 100
101 /// <summary> 101 /// <summary>
102 /// Adds a new profile to the database 102 /// Adds or updates a profile in the database
103 /// </summary> 103 /// </summary>
104 /// <param name="profile">The profile to add</param> 104 /// <param name="profile">The profile to add</param>
105 /// <returns>RESPONSE_OK if successful, error if not.</returns> 105 /// <returns>RESPONSE_OK if successful, error if not.</returns>
106 DataResponse AddProfile(RegionProfileData profile); 106 DataResponse StoreProfile(RegionProfileData profile);
107
108 /// <summary>
109 /// Updates a profile in the database
110 /// </summary>
111 /// <param name="profile"></param>
112 /// <returns></returns>
113 DataResponse UpdateProfile(RegionProfileData profile);
114 107
115 /// <summary> 108 /// <summary>
116 /// Remove a profile from the database 109 /// Remove a profile from the database
diff --git a/OpenSim/Data/MSSQL/MSSQLGridData.cs b/OpenSim/Data/MSSQL/MSSQLGridData.cs
index 0ebbf4e..8a3d332 100644
--- a/OpenSim/Data/MSSQL/MSSQLGridData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLGridData.cs
@@ -272,26 +272,23 @@ namespace OpenSim.Data.MSSQL
272 /// </summary> 272 /// </summary>
273 /// <param name="profile">The profile to add</param> 273 /// <param name="profile">The profile to add</param>
274 /// <returns>A dataresponse enum indicating success</returns> 274 /// <returns>A dataresponse enum indicating success</returns>
275 override public DataResponse AddProfile(RegionProfileData profile) 275 override public DataResponse StoreProfile(RegionProfileData profile)
276 { 276 {
277 if (InsertRegionRow(profile)) 277 if (GetProfileByUUID(profile.UUID) == null)
278 { 278 {
279 return DataResponse.RESPONSE_OK; 279 if (InsertRegionRow(profile))
280 {
281 return DataResponse.RESPONSE_OK;
282 }
280 } 283 }
281 return DataResponse.RESPONSE_ERROR; 284 else
282 }
283
284 /// <summary>
285 /// Update the specified region in the database
286 /// </summary>
287 /// <param name="profile">The profile to update</param>
288 /// <returns>A dataresponse enum indicating success</returns>
289 override public DataResponse UpdateProfile(RegionProfileData profile)
290 {
291 if (UpdateRegionRow(profile))
292 { 285 {
293 return DataResponse.RESPONSE_OK; 286 if (UpdateRegionRow(profile))
287 {
288 return DataResponse.RESPONSE_OK;
289 }
294 } 290 }
291
295 return DataResponse.RESPONSE_ERROR; 292 return DataResponse.RESPONSE_ERROR;
296 } 293 }
297 294
diff --git a/OpenSim/Data/MySQL/MySQLGridData.cs b/OpenSim/Data/MySQL/MySQLGridData.cs
index 0a5800b..1ec2609 100644
--- a/OpenSim/Data/MySQL/MySQLGridData.cs
+++ b/OpenSim/Data/MySQL/MySQLGridData.cs
@@ -391,7 +391,7 @@ namespace OpenSim.Data.MySQL
391 /// </summary> 391 /// </summary>
392 /// <param name="profile">The profile to add</param> 392 /// <param name="profile">The profile to add</param>
393 /// <returns>Successful?</returns> 393 /// <returns>Successful?</returns>
394 override public DataResponse AddProfile(RegionProfileData profile) 394 override public DataResponse StoreProfile(RegionProfileData profile)
395 { 395 {
396 MySQLSuperManager dbm = GetLockedConnection(); 396 MySQLSuperManager dbm = GetLockedConnection();
397 try { 397 try {
@@ -408,17 +408,6 @@ namespace OpenSim.Data.MySQL
408 } 408 }
409 409
410 /// <summary> 410 /// <summary>
411 /// Update a sim profile
412 /// </summary>
413 /// <param name="profile">The profile to update</param>
414 /// <returns>Sucessful?</returns>
415 /// <remarks>Same as AddProfile</remarks>
416 override public DataResponse UpdateProfile(RegionProfileData profile)
417 {
418 return AddProfile(profile);
419 }
420
421 /// <summary>
422 /// Deletes a sim profile from the database 411 /// Deletes a sim profile from the database
423 /// </summary> 412 /// </summary>
424 /// <param name="uuid">the sim UUID</param> 413 /// <param name="uuid">the sim UUID</param>
diff --git a/OpenSim/Data/NHibernate/NHibernateGridData.cs b/OpenSim/Data/NHibernate/NHibernateGridData.cs
index fe8da59..018af62 100644
--- a/OpenSim/Data/NHibernate/NHibernateGridData.cs
+++ b/OpenSim/Data/NHibernate/NHibernateGridData.cs
@@ -117,7 +117,7 @@ namespace OpenSim.Data.NHibernate
117 throw new NotImplementedException(); 117 throw new NotImplementedException();
118 } 118 }
119 119
120 public override DataResponse AddProfile(RegionProfileData profile) 120 public override DataResponse StoreProfile(RegionProfileData profile)
121 { 121 {
122 if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) 122 if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null)
123 { 123 {
@@ -126,21 +126,9 @@ namespace OpenSim.Data.NHibernate
126 } 126 }
127 else 127 else
128 { 128 {
129 return DataResponse.RESPONSE_ERROR;
130 }
131 }
132
133 public override DataResponse UpdateProfile(RegionProfileData profile)
134 {
135 if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null)
136 {
137 manager.Update(profile); 129 manager.Update(profile);
138 return DataResponse.RESPONSE_OK; 130 return DataResponse.RESPONSE_OK;
139 } 131 }
140 else
141 {
142 return DataResponse.RESPONSE_ERROR;
143 }
144 } 132 }
145 133
146 public override DataResponse DeleteProfile(string uuid) 134 public override DataResponse DeleteProfile(string uuid)
diff --git a/OpenSim/Data/SQLite/SQLiteGridData.cs b/OpenSim/Data/SQLite/SQLiteGridData.cs
index 4107594..18abb88 100644
--- a/OpenSim/Data/SQLite/SQLiteGridData.cs
+++ b/OpenSim/Data/SQLite/SQLiteGridData.cs
@@ -203,7 +203,7 @@ namespace OpenSim.Data.SQLite
203 /// </summary> 203 /// </summary>
204 /// <param name="profile">The profile to add</param> 204 /// <param name="profile">The profile to add</param>
205 /// <returns>A dataresponse enum indicating success</returns> 205 /// <returns>A dataresponse enum indicating success</returns>
206 override public DataResponse AddProfile(RegionProfileData profile) 206 override public DataResponse StoreProfile(RegionProfileData profile)
207 { 207 {
208 if (database.insertRow(profile)) 208 if (database.insertRow(profile))
209 { 209 {
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite
215 } 215 }
216 } 216 }
217 217
218 override public DataResponse UpdateProfile(RegionProfileData profile) 218 /// <summary>
219 {
220 return AddProfile(profile);
221 }
222
223 /// <summary>
224 /// Deletes a sim profile from the database 219 /// Deletes a sim profile from the database
225 /// </summary> 220 /// </summary>
226 /// <param name="uuid">the sim UUID</param> 221 /// <param name="uuid">the sim UUID</param>
227 /// <returns>Successful?</returns> 222 /// <returns>Successful?</returns>
228 //public DataResponse DeleteProfile(RegionProfileData profile)
229 override public DataResponse DeleteProfile(string uuid) 223 override public DataResponse DeleteProfile(string uuid)
230 { 224 {
231 Dictionary<string, string> param = new Dictionary<string, string>(); 225 Dictionary<string, string> param = new Dictionary<string, string>();
diff --git a/OpenSim/Data/Tests/BasicGridTest.cs b/OpenSim/Data/Tests/BasicGridTest.cs
index de8fb48..df6c669 100644
--- a/OpenSim/Data/Tests/BasicGridTest.cs
+++ b/OpenSim/Data/Tests/BasicGridTest.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Data.Tests
70 reg.Uuid = regionUUID; 70 reg.Uuid = regionUUID;
71 reg.RegionName = regionName; 71 reg.RegionName = regionName;
72 72
73 db.AddProfile(reg); 73 db.StoreProfile(reg);
74 74
75 return reg; 75 return reg;
76 } 76 }
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests
120 RegionProfileData retreg = db.GetProfileByUUID(region2); 120 RegionProfileData retreg = db.GetProfileByUUID(region2);
121 retreg.regionName = "Gotham City"; 121 retreg.regionName = "Gotham City";
122 122
123 db.UpdateProfile(retreg); 123 db.StoreProfile(retreg);
124 124
125 retreg = db.GetProfileByUUID(region2); 125 retreg = db.GetProfileByUUID(region2);
126 Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); 126 Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))");
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests
135 retreg.RegionName = "Gotham Town"; 135 retreg.RegionName = "Gotham Town";
136 retreg.Uuid = region1; 136 retreg.Uuid = region1;
137 137
138 db.AddProfile(retreg); 138 db.StoreProfile(retreg);
139 139
140 retreg = db.GetProfileByUUID(region2); 140 retreg = db.GetProfileByUUID(region2);
141 retreg.RegionName = "Gothan Town"; 141 retreg.RegionName = "Gothan Town";
142 retreg.Uuid = region3; 142 retreg.Uuid = region3;
143 143
144 db.AddProfile(retreg); 144 db.StoreProfile(retreg);
145 145
146 List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); 146 List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10);
147 147