diff options
author | Teravus Ovares (Dan Olivares) | 2009-08-20 19:25:52 -0400 |
---|---|---|
committer | Teravus Ovares (Dan Olivares) | 2009-08-20 19:25:52 -0400 |
commit | 181b992b4a8dab3423b52f705e20dcb63e7fdb47 (patch) | |
tree | 309f2255464873944a5478472596cbc24b130b27 /OpenSim/Data | |
parent | * Deal with git thinking that file was changed even though it wasn't and it's... (diff) | |
parent | Merge branch 'master' of ssh://diva@opensimulator.org/var/git/opensim (diff) | |
download | opensim-SC_OLD-181b992b4a8dab3423b52f705e20dcb63e7fdb47.zip opensim-SC_OLD-181b992b4a8dab3423b52f705e20dcb63e7fdb47.tar.gz opensim-SC_OLD-181b992b4a8dab3423b52f705e20dcb63e7fdb47.tar.bz2 opensim-SC_OLD-181b992b4a8dab3423b52f705e20dcb63e7fdb47.tar.xz |
Merge branch 'master' of ssh://MyConnection/var/git/opensim
Diffstat (limited to 'OpenSim/Data')
-rw-r--r-- | OpenSim/Data/AssetDataBase.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/GridDataBase.cs | 3 | ||||
-rw-r--r-- | OpenSim/Data/IAssetData.cs | 5 | ||||
-rw-r--r-- | OpenSim/Data/IGridData.cs | 11 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 19 | ||||
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLGridData.cs | 27 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/MySQL/MySQLGridData.cs | 13 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateAssetData.cs | 24 | ||||
-rw-r--r-- | OpenSim/Data/NHibernate/NHibernateGridData.cs | 14 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 47 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteGridData.cs | 10 | ||||
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 4 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicAssetTest.cs | 24 | ||||
-rw-r--r-- | OpenSim/Data/Tests/BasicGridTest.cs | 8 |
15 files changed, 85 insertions, 147 deletions
diff --git a/OpenSim/Data/AssetDataBase.cs b/OpenSim/Data/AssetDataBase.cs index f723ebf..5deb44e 100644 --- a/OpenSim/Data/AssetDataBase.cs +++ b/OpenSim/Data/AssetDataBase.cs | |||
@@ -36,15 +36,9 @@ namespace OpenSim.Data | |||
36 | { | 36 | { |
37 | public abstract class AssetDataBase : IAssetDataPlugin | 37 | public abstract class AssetDataBase : IAssetDataPlugin |
38 | { | 38 | { |
39 | public virtual AssetBase FetchAsset(UUID uuid) | 39 | public abstract AssetBase GetAsset(UUID uuid); |
40 | { | ||
41 | return FetchStoredAsset(uuid); | ||
42 | } | ||
43 | |||
44 | protected abstract AssetBase FetchStoredAsset(UUID uuid); | ||
45 | 40 | ||
46 | public abstract void CreateAsset(AssetBase asset); | 41 | public abstract void StoreAsset(AssetBase asset); |
47 | public abstract void UpdateAsset(AssetBase asset); | ||
48 | public abstract bool ExistsAsset(UUID uuid); | 42 | public abstract bool ExistsAsset(UUID uuid); |
49 | 43 | ||
50 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); | 44 | public abstract List<AssetMetadata> FetchAssetMetadataSet(int start, int count); |
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 | |||
38 | public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); | 38 | public abstract RegionProfileData[] GetProfilesInRange(uint Xmin, uint Ymin, uint Xmax, uint Ymax); |
39 | public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); | 39 | public abstract List<RegionProfileData> GetRegionsByName(string namePrefix, uint maxNum); |
40 | public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); | 40 | public abstract bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); |
41 | public abstract DataResponse AddProfile(RegionProfileData profile); | 41 | public abstract DataResponse StoreProfile(RegionProfileData profile); |
42 | public abstract ReservationData GetReservationAtPoint(uint x, uint y); | 42 | public abstract ReservationData GetReservationAtPoint(uint x, uint y); |
43 | public abstract DataResponse UpdateProfile(RegionProfileData profile); | ||
44 | public abstract DataResponse DeleteProfile(string uuid); | 43 | public abstract DataResponse DeleteProfile(string uuid); |
45 | 44 | ||
46 | public abstract void Initialise(); | 45 | public abstract void Initialise(); |
diff --git a/OpenSim/Data/IAssetData.cs b/OpenSim/Data/IAssetData.cs index d13732b..2149bca 100644 --- a/OpenSim/Data/IAssetData.cs +++ b/OpenSim/Data/IAssetData.cs | |||
@@ -33,9 +33,8 @@ namespace OpenSim.Data | |||
33 | { | 33 | { |
34 | public interface IAssetDataPlugin : IPlugin | 34 | public interface IAssetDataPlugin : IPlugin |
35 | { | 35 | { |
36 | AssetBase FetchAsset(UUID uuid); | 36 | AssetBase GetAsset(UUID uuid); |
37 | void CreateAsset(AssetBase asset); | 37 | void StoreAsset(AssetBase asset); |
38 | void UpdateAsset(AssetBase asset); | ||
39 | bool ExistsAsset(UUID uuid); | 38 | bool ExistsAsset(UUID uuid); |
40 | List<AssetMetadata> FetchAssetMetadataSet(int start, int count); | 39 | List<AssetMetadata> FetchAssetMetadataSet(int start, int count); |
41 | void Initialise(string connect); | 40 | void Initialise(string connect); |
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 | |||
99 | bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); | 99 | bool AuthenticateSim(UUID UUID, ulong regionHandle, string simrecvkey); |
100 | 100 | ||
101 | /// <summary> | 101 | /// <summary> |
102 | /// Adds a new profile to the database | 102 | /// Adds or updates a profile in the database |
103 | /// </summary> | 103 | /// </summary> |
104 | /// <param name="profile">The profile to add</param> | 104 | /// <param name="profile">The profile to add</param> |
105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> | 105 | /// <returns>RESPONSE_OK if successful, error if not.</returns> |
106 | DataResponse AddProfile(RegionProfileData profile); | 106 | DataResponse StoreProfile(RegionProfileData profile); |
107 | |||
108 | /// <summary> | ||
109 | /// Updates a profile in the database | ||
110 | /// </summary> | ||
111 | /// <param name="profile"></param> | ||
112 | /// <returns></returns> | ||
113 | DataResponse UpdateProfile(RegionProfileData profile); | ||
114 | 107 | ||
115 | /// <summary> | 108 | /// <summary> |
116 | /// Remove a profile from the database | 109 | /// Remove a profile from the database |
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 | ||
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 0865083..1b4377a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -135,7 +135,7 @@ namespace OpenSim.Data.MySQL | |||
135 | /// <param name="assetID">Asset UUID to fetch</param> | 135 | /// <param name="assetID">Asset UUID to fetch</param> |
136 | /// <returns>Return the asset</returns> | 136 | /// <returns>Return the asset</returns> |
137 | /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks> | 137 | /// <remarks>On failure : throw an exception and attempt to reconnect to database</remarks> |
138 | override protected AssetBase FetchStoredAsset(UUID assetID) | 138 | override public AssetBase GetAsset(UUID assetID) |
139 | { | 139 | { |
140 | AssetBase asset = null; | 140 | AssetBase asset = null; |
141 | lock (_dbConnection) | 141 | lock (_dbConnection) |
@@ -192,7 +192,7 @@ namespace OpenSim.Data.MySQL | |||
192 | /// </summary> | 192 | /// </summary> |
193 | /// <param name="asset">Asset UUID to create</param> | 193 | /// <param name="asset">Asset UUID to create</param> |
194 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 194 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
195 | override public void CreateAsset(AssetBase asset) | 195 | override public void StoreAsset(AssetBase asset) |
196 | { | 196 | { |
197 | lock (_dbConnection) | 197 | lock (_dbConnection) |
198 | { | 198 | { |
@@ -285,15 +285,6 @@ namespace OpenSim.Data.MySQL | |||
285 | } | 285 | } |
286 | 286 | ||
287 | /// <summary> | 287 | /// <summary> |
288 | /// Update a asset in database, see <see cref="CreateAsset"/> | ||
289 | /// </summary> | ||
290 | /// <param name="asset">Asset UUID to update</param> | ||
291 | override public void UpdateAsset(AssetBase asset) | ||
292 | { | ||
293 | CreateAsset(asset); | ||
294 | } | ||
295 | |||
296 | /// <summary> | ||
297 | /// check if the asset UUID exist in database | 288 | /// check if the asset UUID exist in database |
298 | /// </summary> | 289 | /// </summary> |
299 | /// <param name="uuid">The asset UUID</param> | 290 | /// <param name="uuid">The asset UUID</param> |
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 | |||
391 | /// </summary> | 391 | /// </summary> |
392 | /// <param name="profile">The profile to add</param> | 392 | /// <param name="profile">The profile to add</param> |
393 | /// <returns>Successful?</returns> | 393 | /// <returns>Successful?</returns> |
394 | override public DataResponse AddProfile(RegionProfileData profile) | 394 | override public DataResponse StoreProfile(RegionProfileData profile) |
395 | { | 395 | { |
396 | MySQLSuperManager dbm = GetLockedConnection(); | 396 | MySQLSuperManager dbm = GetLockedConnection(); |
397 | try { | 397 | try { |
@@ -408,17 +408,6 @@ namespace OpenSim.Data.MySQL | |||
408 | } | 408 | } |
409 | 409 | ||
410 | /// <summary> | 410 | /// <summary> |
411 | /// Update a sim profile | ||
412 | /// </summary> | ||
413 | /// <param name="profile">The profile to update</param> | ||
414 | /// <returns>Sucessful?</returns> | ||
415 | /// <remarks>Same as AddProfile</remarks> | ||
416 | override public DataResponse UpdateProfile(RegionProfileData profile) | ||
417 | { | ||
418 | return AddProfile(profile); | ||
419 | } | ||
420 | |||
421 | /// <summary> | ||
422 | /// Deletes a sim profile from the database | 411 | /// Deletes a sim profile from the database |
423 | /// </summary> | 412 | /// </summary> |
424 | /// <param name="uuid">the sim UUID</param> | 413 | /// <param name="uuid">the sim UUID</param> |
diff --git a/OpenSim/Data/NHibernate/NHibernateAssetData.cs b/OpenSim/Data/NHibernate/NHibernateAssetData.cs index 9d8cec5..aaba15c 100644 --- a/OpenSim/Data/NHibernate/NHibernateAssetData.cs +++ b/OpenSim/Data/NHibernate/NHibernateAssetData.cs | |||
@@ -65,30 +65,24 @@ namespace OpenSim.Data.NHibernate | |||
65 | 65 | ||
66 | } | 66 | } |
67 | 67 | ||
68 | override protected AssetBase FetchStoredAsset(UUID uuid) | 68 | override public AssetBase GetAsset(UUID uuid) |
69 | { | 69 | { |
70 | return (AssetBase)manager.Get(typeof(AssetBase), uuid); | 70 | return (AssetBase)manager.Get(typeof(AssetBase), uuid); |
71 | } | 71 | } |
72 | 72 | ||
73 | private void Save(AssetBase asset) | 73 | override public void StoreAsset(AssetBase asset) |
74 | { | 74 | { |
75 | AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID); | 75 | AssetBase temp = (AssetBase)manager.Get(typeof(AssetBase), asset.FullID); |
76 | if (temp == null) | 76 | if (temp == null) |
77 | { | 77 | { |
78 | m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); | ||
78 | manager.Insert(asset); | 79 | manager.Insert(asset); |
79 | } | 80 | } |
80 | } | 81 | else |
81 | 82 | { | |
82 | override public void CreateAsset(AssetBase asset) | 83 | m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); |
83 | { | 84 | manager.Update(asset); |
84 | m_log.InfoFormat("[NHIBERNATE] inserting asset {0}", asset.FullID); | 85 | } |
85 | Save(asset); | ||
86 | } | ||
87 | |||
88 | override public void UpdateAsset(AssetBase asset) | ||
89 | { | ||
90 | m_log.InfoFormat("[NHIBERNATE] updating asset {0}", asset.FullID); | ||
91 | manager.Update(asset); | ||
92 | } | 86 | } |
93 | 87 | ||
94 | // private void LogAssetLoad(AssetBase asset) | 88 | // private void LogAssetLoad(AssetBase asset) |
@@ -107,7 +101,7 @@ namespace OpenSim.Data.NHibernate | |||
107 | override public bool ExistsAsset(UUID uuid) | 101 | override public bool ExistsAsset(UUID uuid) |
108 | { | 102 | { |
109 | m_log.InfoFormat("[NHIBERNATE] ExistsAsset: {0}", uuid); | 103 | m_log.InfoFormat("[NHIBERNATE] ExistsAsset: {0}", uuid); |
110 | return (FetchAsset(uuid) != null); | 104 | return (GetAsset(uuid) != null); |
111 | } | 105 | } |
112 | 106 | ||
113 | /// <summary> | 107 | /// <summary> |
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 | |||
117 | throw new NotImplementedException(); | 117 | throw new NotImplementedException(); |
118 | } | 118 | } |
119 | 119 | ||
120 | public override DataResponse AddProfile(RegionProfileData profile) | 120 | public override DataResponse StoreProfile(RegionProfileData profile) |
121 | { | 121 | { |
122 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) | 122 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) == null) |
123 | { | 123 | { |
@@ -126,21 +126,9 @@ namespace OpenSim.Data.NHibernate | |||
126 | } | 126 | } |
127 | else | 127 | else |
128 | { | 128 | { |
129 | return DataResponse.RESPONSE_ERROR; | ||
130 | } | ||
131 | } | ||
132 | |||
133 | public override DataResponse UpdateProfile(RegionProfileData profile) | ||
134 | { | ||
135 | if (manager.Get(typeof(RegionProfileData), profile.Uuid) != null) | ||
136 | { | ||
137 | manager.Update(profile); | 129 | manager.Update(profile); |
138 | return DataResponse.RESPONSE_OK; | 130 | return DataResponse.RESPONSE_OK; |
139 | } | 131 | } |
140 | else | ||
141 | { | ||
142 | return DataResponse.RESPONSE_ERROR; | ||
143 | } | ||
144 | } | 132 | } |
145 | 133 | ||
146 | public override DataResponse DeleteProfile(string uuid) | 134 | public override DataResponse DeleteProfile(string uuid) |
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 | |||
90 | /// </summary> | 90 | /// </summary> |
91 | /// <param name="uuid">UUID of ... ?</param> | 91 | /// <param name="uuid">UUID of ... ?</param> |
92 | /// <returns>Asset base</returns> | 92 | /// <returns>Asset base</returns> |
93 | override protected AssetBase FetchStoredAsset(UUID uuid) | 93 | override public AssetBase GetAsset(UUID uuid) |
94 | { | 94 | { |
95 | lock (this) | 95 | lock (this) |
96 | { | 96 | { |
@@ -119,18 +119,16 @@ namespace OpenSim.Data.SQLite | |||
119 | /// Create an asset | 119 | /// Create an asset |
120 | /// </summary> | 120 | /// </summary> |
121 | /// <param name="asset">Asset Base</param> | 121 | /// <param name="asset">Asset Base</param> |
122 | override public void CreateAsset(AssetBase asset) | 122 | override public void StoreAsset(AssetBase asset) |
123 | { | 123 | { |
124 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 124 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
125 | if (ExistsAsset(asset.FullID)) | 125 | if (ExistsAsset(asset.FullID)) |
126 | { | 126 | { |
127 | //m_log.Info("[ASSET DB]: Asset exists already, ignoring."); | 127 | LogAssetLoad(asset); |
128 | } | 128 | |
129 | else | ||
130 | { | ||
131 | lock (this) | 129 | lock (this) |
132 | { | 130 | { |
133 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 131 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
134 | { | 132 | { |
135 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 133 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
136 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 134 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
@@ -144,29 +142,22 @@ namespace OpenSim.Data.SQLite | |||
144 | } | 142 | } |
145 | } | 143 | } |
146 | } | 144 | } |
147 | } | 145 | else |
148 | |||
149 | /// <summary> | ||
150 | /// Update an asset | ||
151 | /// </summary> | ||
152 | /// <param name="asset"></param> | ||
153 | override public void UpdateAsset(AssetBase asset) | ||
154 | { | ||
155 | LogAssetLoad(asset); | ||
156 | |||
157 | lock (this) | ||
158 | { | 146 | { |
159 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 147 | lock (this) |
160 | { | 148 | { |
161 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 149 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
162 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 150 | { |
163 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 151 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
164 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 152 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); |
165 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 153 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); |
166 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 154 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
167 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); | 155 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
168 | 156 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | |
169 | cmd.ExecuteNonQuery(); | 157 | cmd.Parameters.Add(new SqliteParameter(":Data", asset.Data)); |
158 | |||
159 | cmd.ExecuteNonQuery(); | ||
160 | } | ||
170 | } | 161 | } |
171 | } | 162 | } |
172 | } | 163 | } |
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 | |||
203 | /// </summary> | 203 | /// </summary> |
204 | /// <param name="profile">The profile to add</param> | 204 | /// <param name="profile">The profile to add</param> |
205 | /// <returns>A dataresponse enum indicating success</returns> | 205 | /// <returns>A dataresponse enum indicating success</returns> |
206 | override public DataResponse AddProfile(RegionProfileData profile) | 206 | override public DataResponse StoreProfile(RegionProfileData profile) |
207 | { | 207 | { |
208 | if (database.insertRow(profile)) | 208 | if (database.insertRow(profile)) |
209 | { | 209 | { |
@@ -215,17 +215,11 @@ namespace OpenSim.Data.SQLite | |||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | override public DataResponse UpdateProfile(RegionProfileData profile) | 218 | /// <summary> |
219 | { | ||
220 | return AddProfile(profile); | ||
221 | } | ||
222 | |||
223 | /// <summary> | ||
224 | /// Deletes a sim profile from the database | 219 | /// Deletes a sim profile from the database |
225 | /// </summary> | 220 | /// </summary> |
226 | /// <param name="uuid">the sim UUID</param> | 221 | /// <param name="uuid">the sim UUID</param> |
227 | /// <returns>Successful?</returns> | 222 | /// <returns>Successful?</returns> |
228 | //public DataResponse DeleteProfile(RegionProfileData profile) | ||
229 | override public DataResponse DeleteProfile(string uuid) | 223 | override public DataResponse DeleteProfile(string uuid) |
230 | { | 224 | { |
231 | Dictionary<string, string> param = new Dictionary<string, string>(); | 225 | Dictionary<string, string> param = new Dictionary<string, string>(); |
diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index e5f7a50..64591fd 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs | |||
@@ -628,12 +628,12 @@ namespace OpenSim.Data.SQLite | |||
628 | 628 | ||
629 | public InventoryItemBase queryInventoryItem(UUID itemID) | 629 | public InventoryItemBase queryInventoryItem(UUID itemID) |
630 | { | 630 | { |
631 | return null; | 631 | return getInventoryItem(itemID); |
632 | } | 632 | } |
633 | 633 | ||
634 | public InventoryFolderBase queryInventoryFolder(UUID folderID) | 634 | public InventoryFolderBase queryInventoryFolder(UUID folderID) |
635 | { | 635 | { |
636 | return null; | 636 | return getInventoryFolder(folderID); |
637 | } | 637 | } |
638 | 638 | ||
639 | /// <summary> | 639 | /// <summary> |
diff --git a/OpenSim/Data/Tests/BasicAssetTest.cs b/OpenSim/Data/Tests/BasicAssetTest.cs index 09131c1..1969d76 100644 --- a/OpenSim/Data/Tests/BasicAssetTest.cs +++ b/OpenSim/Data/Tests/BasicAssetTest.cs | |||
@@ -84,34 +84,34 @@ namespace OpenSim.Data.Tests | |||
84 | scrambler.Scramble(a2); | 84 | scrambler.Scramble(a2); |
85 | scrambler.Scramble(a3); | 85 | scrambler.Scramble(a3); |
86 | 86 | ||
87 | db.CreateAsset(a1); | 87 | db.StoreAsset(a1); |
88 | db.CreateAsset(a2); | 88 | db.StoreAsset(a2); |
89 | db.CreateAsset(a3); | 89 | db.StoreAsset(a3); |
90 | 90 | ||
91 | AssetBase a1a = db.FetchAsset(uuid1); | 91 | AssetBase a1a = db.GetAsset(uuid1); |
92 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); | 92 | Assert.That(a1a, Constraints.PropertyCompareConstraint(a1)); |
93 | 93 | ||
94 | AssetBase a2a = db.FetchAsset(uuid2); | 94 | AssetBase a2a = db.GetAsset(uuid2); |
95 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); | 95 | Assert.That(a2a, Constraints.PropertyCompareConstraint(a2)); |
96 | 96 | ||
97 | AssetBase a3a = db.FetchAsset(uuid3); | 97 | AssetBase a3a = db.GetAsset(uuid3); |
98 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); | 98 | Assert.That(a3a, Constraints.PropertyCompareConstraint(a3)); |
99 | 99 | ||
100 | scrambler.Scramble(a1a); | 100 | scrambler.Scramble(a1a); |
101 | scrambler.Scramble(a2a); | 101 | scrambler.Scramble(a2a); |
102 | scrambler.Scramble(a3a); | 102 | scrambler.Scramble(a3a); |
103 | 103 | ||
104 | db.UpdateAsset(a1a); | 104 | db.StoreAsset(a1a); |
105 | db.UpdateAsset(a2a); | 105 | db.StoreAsset(a2a); |
106 | db.UpdateAsset(a3a); | 106 | db.StoreAsset(a3a); |
107 | 107 | ||
108 | AssetBase a1b = db.FetchAsset(uuid1); | 108 | AssetBase a1b = db.GetAsset(uuid1); |
109 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); | 109 | Assert.That(a1b, Constraints.PropertyCompareConstraint(a1a)); |
110 | 110 | ||
111 | AssetBase a2b = db.FetchAsset(uuid2); | 111 | AssetBase a2b = db.GetAsset(uuid2); |
112 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); | 112 | Assert.That(a2b, Constraints.PropertyCompareConstraint(a2a)); |
113 | 113 | ||
114 | AssetBase a3b = db.FetchAsset(uuid3); | 114 | AssetBase a3b = db.GetAsset(uuid3); |
115 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); | 115 | Assert.That(a3b, Constraints.PropertyCompareConstraint(a3a)); |
116 | 116 | ||
117 | Assert.That(db.ExistsAsset(uuid1), Is.True); | 117 | Assert.That(db.ExistsAsset(uuid1), Is.True); |
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 | |||
70 | reg.Uuid = regionUUID; | 70 | reg.Uuid = regionUUID; |
71 | reg.RegionName = regionName; | 71 | reg.RegionName = regionName; |
72 | 72 | ||
73 | db.AddProfile(reg); | 73 | db.StoreProfile(reg); |
74 | 74 | ||
75 | return reg; | 75 | return reg; |
76 | } | 76 | } |
@@ -120,7 +120,7 @@ namespace OpenSim.Data.Tests | |||
120 | RegionProfileData retreg = db.GetProfileByUUID(region2); | 120 | RegionProfileData retreg = db.GetProfileByUUID(region2); |
121 | retreg.regionName = "Gotham City"; | 121 | retreg.regionName = "Gotham City"; |
122 | 122 | ||
123 | db.UpdateProfile(retreg); | 123 | db.StoreProfile(retreg); |
124 | 124 | ||
125 | retreg = db.GetProfileByUUID(region2); | 125 | retreg = db.GetProfileByUUID(region2); |
126 | Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); | 126 | Assert.That(retreg.RegionName, Is.EqualTo("Gotham City"), "Assert.That(retreg.RegionName, Is.EqualTo(\"Gotham City\"))"); |
@@ -135,13 +135,13 @@ namespace OpenSim.Data.Tests | |||
135 | retreg.RegionName = "Gotham Town"; | 135 | retreg.RegionName = "Gotham Town"; |
136 | retreg.Uuid = region1; | 136 | retreg.Uuid = region1; |
137 | 137 | ||
138 | db.AddProfile(retreg); | 138 | db.StoreProfile(retreg); |
139 | 139 | ||
140 | retreg = db.GetProfileByUUID(region2); | 140 | retreg = db.GetProfileByUUID(region2); |
141 | retreg.RegionName = "Gothan Town"; | 141 | retreg.RegionName = "Gothan Town"; |
142 | retreg.Uuid = region3; | 142 | retreg.Uuid = region3; |
143 | 143 | ||
144 | db.AddProfile(retreg); | 144 | db.StoreProfile(retreg); |
145 | 145 | ||
146 | List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); | 146 | List<RegionProfileData> listreg = db.GetRegionsByName("Gotham",10); |
147 | 147 | ||