From b1853d9f265fb32cf51d65fdcf2d5b4741911f00 Mon Sep 17 00:00:00 2001
From: Kunnis
Date: Sun, 16 Aug 2009 23:25:12 -0500
Subject: Fixing a spot I missed in assets. Switching Grid to the new naming
 schema with Store/Get

---
 OpenSim/Data/GridDataBase.cs                  |  3 +--
 OpenSim/Data/IGridData.cs                     | 11 ++---------
 OpenSim/Data/MSSQL/MSSQLGridData.cs           | 27 ++++++++++++---------------
 OpenSim/Data/MySQL/MySQLGridData.cs           | 13 +------------
 OpenSim/Data/NHibernate/NHibernateGridData.cs | 14 +-------------
 OpenSim/Data/SQLite/SQLiteGridData.cs         | 10 ++--------
 OpenSim/Data/Tests/BasicGridTest.cs           |  8 ++++----
 7 files changed, 23 insertions(+), 63 deletions(-)

(limited to 'OpenSim/Data')

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
         public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax);
         public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum);
         public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
-        public abstract DataResponse AddProfile(RegionProfileData profile);
+        public abstract DataResponse StoreProfile(RegionProfileData profile);
         public abstract ReservationData GetReservationAtPoint(uint x, uint y);
-        public abstract DataResponse UpdateProfile(RegionProfileData profile);
         public abstract DataResponse DeleteProfile(string uuid);
 
         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
         bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey);
 
         /// <summary>
-        /// Adds a new profile to the database
+        /// Adds or updates a profile in the database
         /// </summary>
         /// <param name="profile">The profile to add</param>
         /// <returns>RESPONSE_OK if successful, error if not.</returns>
-        DataResponse AddProfile(RegionProfileData profile);
-
-        /// <summary>
-        /// Updates a profile in the database
-        /// </summary>
-        /// <param name="profile"></param>
-        /// <returns></returns>
-        DataResponse UpdateProfile(RegionProfileData profile);
+        DataResponse StoreProfile(RegionProfileData profile);
 
         /// <summary>
         /// 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
         /// </summary>
         /// <param name="profile">The profile to add</param>
         /// <returns>A dataresponse enum indicating success</returns>
-        override public DataResponse AddProfile(RegionProfileData profile)
+        override public DataResponse StoreProfile(RegionProfileData profile)
         {
-            if (InsertRegionRow(profile))
+            if (GetProfileByUUID(profile.UUID) == null)
             {
-                return DataResponse.RESPONSE_OK;
+                if (InsertRegionRow(profile))
+                {
+                    return DataResponse.RESPONSE_OK;
+                }
             }
-            return DataResponse.RESPONSE_ERROR;
-        }
-
-        /// <summary>
-        /// Update the specified region in the database
-        /// </summary>
-        /// <param name="profile">The profile to update</param>
-        /// <returns>A dataresponse enum indicating success</returns>
-        override public DataResponse UpdateProfile(RegionProfileData profile)
-        {
-            if (UpdateRegionRow(profile))
+            else
             {
-                return DataResponse.RESPONSE_OK;
+                if (UpdateRegionRow(profile))
+                {
+                    return DataResponse.RESPONSE_OK;
+                }
             }
+
             return DataResponse.RESPONSE_ERROR;
         }
 
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
         /// </summary>
         /// <param name="profile">The profile to add</param>
         /// <returns>Successful?</returns>
-        override public DataResponse AddProfile(RegionProfileData profile)
+        override public DataResponse StoreProfile(RegionProfileData profile)
         {
             MySQLSuperManager dbm = GetLockedConnection();
             try {
@@ -408,17 +408,6 @@ namespace OpenSim.Data.MySQL
         }
 
         /// <summary>
-        /// Update a sim profile
-        /// </summary>
-        /// <param name="profile">The profile to update</param>
-        /// <returns>Sucessful?</returns>
-        /// <remarks>Same as AddProfile</remarks>
-        override public DataResponse UpdateProfile(RegionProfileData profile)
-        {
-            return AddProfile(profile);
-        }
-
-        /// <summary>
         /// Deletes a sim profile from the database
         /// </summary>
         /// <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
             throw new NotImplementedException();
         }
 
-        public override DataResponse AddProfile(RegionProfileData profile)
+        public override DataResponse StoreProfile(RegionProfileData profile)
         {
             if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null)
             {
@@ -126,21 +126,9 @@ namespace OpenSim.Data.NHibernate
             }
             else
             {
-                return DataResponse.RESPONSE_ERROR;
-            }
-        }
-
-        public override DataResponse UpdateProfile(RegionProfileData profile)
-        {
-            if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null)
-            {
                 manager.Update(profile);
                 return DataResponse.RESPONSE_OK;
             }
-            else
-            {
-                return DataResponse.RESPONSE_ERROR;
-            }
         }
 
         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
         /// </summary>
         /// <param name="profile">The profile to add</param>
         /// <returns>A dataresponse enum indicating success</returns>
-        override public DataResponse AddProfile(RegionProfileData profile)
+        override public DataResponse StoreProfile(RegionProfileData profile)
         {
             if (database.insertRow(profile))
             {
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite
             }
         }
 
-        override public DataResponse UpdateProfile(RegionProfileData profile)
-        {
-            return AddProfile(profile);
-        }
-
-                /// <summary>
+        /// <summary>
         /// Deletes a sim profile from the database
         /// </summary>
         /// <param name="uuid">the sim UUID</param>
         /// <returns>Successful?</returns>
-        //public DataResponse DeleteProfile(RegionProfileData profile)
         override public DataResponse DeleteProfile(string uuid)
         {
             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
             reg.Uuid = regionUUID;
             reg.RegionName = regionName;
 
-            db.AddProfile(reg);
+            db.StoreProfile(reg);
 
             return reg;
         }
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests
             RegionProfileData retreg = db.GetProfileByUUID(region2);
             retreg.regionName = "Gotham City";
 
-            db.UpdateProfile(retreg);
+            db.StoreProfile(retreg);
 
             retreg = db.GetProfileByUUID(region2);
             Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))");
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests
             retreg.RegionName = "Gotham Town";
             retreg.Uuid = region1;
 
-            db.AddProfile(retreg);
+            db.StoreProfile(retreg);
 
             retreg = db.GetProfileByUUID(region2);
             retreg.RegionName = "Gothan Town";
             retreg.Uuid = region3;
 
-            db.AddProfile(retreg);
+            db.StoreProfile(retreg);
 
             List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10);
 
-- 
cgit v1.1