From f1287cc7af7da26910c5cba456a8c35b6454d815 Mon Sep 17 00:00:00 2001
From: Kunnis
Date: Sun, 16 Aug 2009 18:54:20 -0500
Subject: * Switching IAssetData to follow the new naming schema, removing the
separate insert and update methods.
---
OpenSim/Data/MSSQL/MSSQLAssetData.cs | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
(limited to 'OpenSim/Data/MSSQL')
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index a542584..d193cf5 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -122,7 +122,7 @@ namespace OpenSim.Data.MSSQL
///
/// the asset UUID
///
- override protected AssetBase FetchStoredAsset(UUID assetID)
+ override public AssetBase GetAsset(UUID assetID)
{
string sql = "SELECT * FROM assets WHERE id = @id";
using (AutoClosingSqlCommand command = m_database.Query(sql))
@@ -152,7 +152,16 @@ namespace OpenSim.Data.MSSQL
/// Create asset in m_database
///
/// the asset
- override public void CreateAsset(AssetBase asset)
+ override public void StoreAsset(AssetBase asset)
+ {
+ if (ExistsAsset(asset.FullID))
+ UpdateAsset(asset);
+ else
+ InsertAsset(asset);
+ }
+
+
+ private void InsertAsset(AssetBase asset)
{
if (ExistsAsset(asset.FullID))
{
@@ -208,7 +217,7 @@ namespace OpenSim.Data.MSSQL
/// Update asset in m_database
///
/// the asset
- override public void UpdateAsset(AssetBase asset)
+ private void UpdateAsset(AssetBase asset)
{
string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType,
local = @local, temporary = @temporary, data = @data
@@ -250,7 +259,7 @@ namespace OpenSim.Data.MSSQL
}
}
-// Commented out since currently unused - this probably should be called in FetchAsset()
+// Commented out since currently unused - this probably should be called in GetAsset()
// private void UpdateAccessTime(AssetBase asset)
// {
// using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id"))
@@ -276,7 +285,7 @@ namespace OpenSim.Data.MSSQL
/// true if exist.
override public bool ExistsAsset(UUID uuid)
{
- if (FetchAsset(uuid) != null)
+ if (GetAsset(uuid) != null)
{
return true;
}
--
cgit v1.1
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/MSSQL/MSSQLGridData.cs | 27 ++++++++++++---------------
1 file changed, 12 insertions(+), 15 deletions(-)
(limited to 'OpenSim/Data/MSSQL')
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
///
/// The profile to add
/// A dataresponse enum indicating success
- 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;
- }
-
- ///
- /// Update the specified region in the database
- ///
- /// The profile to update
- /// A dataresponse enum indicating success
- 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;
}
--
cgit v1.1