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