diff options
author | Diva Canto | 2009-08-19 17:36:34 -0700 |
---|---|---|
committer | Diva Canto | 2009-08-19 17:36:34 -0700 |
commit | a3db2936f7b9297815244d39cdb33c26d17c70e2 (patch) | |
tree | 6f5c6626f94f878a020412f348dcbc51aadd2312 /OpenSim/Data/MSSQL | |
parent | Fixes GetItem and GetFolder for SQLite. Turns out some methods were no-op in ... (diff) | |
parent | Fixing a spot I missed in assets. Switching Grid to the new naming schema wit... (diff) | |
download | opensim-SC-a3db2936f7b9297815244d39cdb33c26d17c70e2.zip opensim-SC-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.gz opensim-SC-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.bz2 opensim-SC-a3db2936f7b9297815244d39cdb33c26d17c70e2.tar.xz |
Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Data/MSSQL')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 19 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 27 |
2 files changed, 26 insertions, 20 deletions
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 | |||
122 | /// </summary> | 122 | /// </summary> |
123 | /// <param name="assetID">the asset UUID</param> | 123 | /// <param name="assetID">the asset UUID</param> |
124 | /// <returns></returns> | 124 | /// <returns></returns> |
125 | override protected AssetBase FetchStoredAsset(UUID assetID) | 125 | override public AssetBase GetAsset(UUID assetID) |
126 | { | 126 | { |
127 | string sql = "SELECT * FROM assets WHERE id = @id"; | 127 | string sql = "SELECT * FROM assets WHERE id = @id"; |
128 | using (AutoClosingSqlCommand command = m_database.Query(sql)) | 128 | using (AutoClosingSqlCommand command = m_database.Query(sql)) |
@@ -152,7 +152,16 @@ namespace OpenSim.Data.MSSQL | |||
152 | /// Create asset in m_database | 152 | /// Create asset in m_database |
153 | /// </summary> | 153 | /// </summary> |
154 | /// <param name="asset">the asset</param> | 154 | /// <param name="asset">the asset</param> |
155 | override public void CreateAsset(AssetBase asset) | 155 | override public void StoreAsset(AssetBase asset) |
156 | { | ||
157 | if (ExistsAsset(asset.FullID)) | ||
158 | UpdateAsset(asset); | ||
159 | else | ||
160 | InsertAsset(asset); | ||
161 | } | ||
162 | |||
163 | |||
164 | private void InsertAsset(AssetBase asset) | ||
156 | { | 165 | { |
157 | if (ExistsAsset(asset.FullID)) | 166 | if (ExistsAsset(asset.FullID)) |
158 | { | 167 | { |
@@ -208,7 +217,7 @@ namespace OpenSim.Data.MSSQL | |||
208 | /// Update asset in m_database | 217 | /// Update asset in m_database |
209 | /// </summary> | 218 | /// </summary> |
210 | /// <param name="asset">the asset</param> | 219 | /// <param name="asset">the asset</param> |
211 | override public void UpdateAsset(AssetBase asset) | 220 | private void UpdateAsset(AssetBase asset) |
212 | { | 221 | { |
213 | string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType, | 222 | string sql = @"UPDATE assets set id = @id, name = @name, description = @description, assetType = @assetType, |
214 | local = @local, temporary = @temporary, data = @data | 223 | local = @local, temporary = @temporary, data = @data |
@@ -250,7 +259,7 @@ namespace OpenSim.Data.MSSQL | |||
250 | } | 259 | } |
251 | } | 260 | } |
252 | 261 | ||
253 | // Commented out since currently unused - this probably should be called in FetchAsset() | 262 | // Commented out since currently unused - this probably should be called in GetAsset() |
254 | // private void UpdateAccessTime(AssetBase asset) | 263 | // private void UpdateAccessTime(AssetBase asset) |
255 | // { | 264 | // { |
256 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) | 265 | // using (AutoClosingSqlCommand cmd = m_database.Query("UPDATE assets SET access_time = @access_time WHERE id=@id")) |
@@ -276,7 +285,7 @@ namespace OpenSim.Data.MSSQL | |||
276 | /// <returns>true if exist.</returns> | 285 | /// <returns>true if exist.</returns> |
277 | override public bool ExistsAsset(UUID uuid) | 286 | override public bool ExistsAsset(UUID uuid) |
278 | { | 287 | { |
279 | if (FetchAsset(uuid) != null) | 288 | if (GetAsset(uuid) != null) |
280 | { | 289 | { |
281 | return true; | 290 | return true; |
282 | } | 291 | } |
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 | ||