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/SQLite/SQLiteAssetData.cs | 47 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 28 deletions(-) (limited to 'OpenSim/Data/SQLite') diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 72af7a0..3831467 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -90,7 +90,7 @@ namespace OpenSim.Data.SQLite /// /// UUID of ... ? /// Asset base - override protected AssetBase FetchStoredAsset(UUID uuid) + override public AssetBase GetAsset(UUID uuid) { lock (this) { @@ -119,18 +119,16 @@ namespace OpenSim.Data.SQLite /// Create an asset /// /// Asset Base - override public void CreateAsset(AssetBase asset) + override public void StoreAsset(AssetBase asset) { //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); if (ExistsAsset(asset.FullID)) { - //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); - } - else - { + LogAssetLoad(asset); + lock (this) { - using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) + using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) { cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); @@ -144,29 +142,22 @@ namespace OpenSim.Data.SQLite } } } - } - - /// - /// Update an asset - /// - /// - override public void UpdateAsset(AssetBase asset) - { - LogAssetLoad(asset); - - lock (this) + else { - using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) + lock (this) { - cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); - cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); - cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); - cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); - cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); - cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); - cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); - - cmd.ExecuteNonQuery(); + using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); + cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); + cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); + cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); + cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); + cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); + + cmd.ExecuteNonQuery(); + } } } } -- cgit v1.1