diff options
author | Mike Mazur | 2009-03-09 07:29:34 +0000 |
---|---|---|
committer | Mike Mazur | 2009-03-09 07:29:34 +0000 |
commit | a2f07ecd2e248966957a8ea70d772276359b02e8 (patch) | |
tree | 5050ec85024e44e4946bfc29782875b3f50f5d37 /OpenSim/Data/MSSQL/MSSQLAssetData.cs | |
parent | * Tweak llMoveToTarget per mantis 3265 (diff) | |
download | opensim-SC_OLD-a2f07ecd2e248966957a8ea70d772276359b02e8.zip opensim-SC_OLD-a2f07ecd2e248966957a8ea70d772276359b02e8.tar.gz opensim-SC_OLD-a2f07ecd2e248966957a8ea70d772276359b02e8.tar.bz2 opensim-SC_OLD-a2f07ecd2e248966957a8ea70d772276359b02e8.tar.xz |
Implemented FetchAssetMetadataSet in DB backends.
This method fetches metadata for a subset of the entries in the assets
database. This functionality is used in the ForEach calls in the asset
storage providers in AssetInventoryServer. With this implemented,
frontends such as the BrowseFrontend should now work.
- MySQL: implemented, sanity tested
- SQLite: implemented, sanity tested
- MSSQL: implemented, not tested
- NHibernate: not implemented
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 61db8f5..edacf08 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -28,6 +28,7 @@ | |||
28 | using System; | 28 | using System; |
29 | using System.Data; | 29 | using System.Data; |
30 | using System.Reflection; | 30 | using System.Reflection; |
31 | using System.Collections.Generic; | ||
31 | using OpenMetaverse; | 32 | using OpenMetaverse; |
32 | using log4net; | 33 | using log4net; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
@@ -245,6 +246,41 @@ namespace OpenSim.Data.MSSQL | |||
245 | return false; | 246 | return false; |
246 | } | 247 | } |
247 | 248 | ||
249 | /// <summary> | ||
250 | /// Returns a list of AssetMetadata objects. The list is a subset of | ||
251 | /// the entire data set offset by <paramref name="start" /> containing | ||
252 | /// <paramref name="count" /> elements. | ||
253 | /// </summary> | ||
254 | /// <param name="start">The number of results to discard from the total data set.</param> | ||
255 | /// <param name="count">The number of rows the returned list should contain.</param> | ||
256 | /// <returns>A list of AssetMetadata objects.</returns> | ||
257 | public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count) | ||
258 | { | ||
259 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | ||
260 | |||
261 | using (AutoClosingSqlCommand command = database.Query("SELECT name,description,assetType,temporary,id FROM assets LIMIT @start, @count")) | ||
262 | { | ||
263 | command.Parameters.Add(database.CreateParameter("start", start)); | ||
264 | command.Parameters.Add(database.CreateParameter("count", count)); | ||
265 | |||
266 | using (IDataReader reader = command.ExecuteReader()) | ||
267 | { | ||
268 | while (reader.Read()) | ||
269 | { | ||
270 | AssetMetadata metadata = new AssetMetadata(); | ||
271 | // Region Main | ||
272 | metadata.FullID = new UUID((Guid)reader["id"]); | ||
273 | metadata.Name = (string)reader["name"]; | ||
274 | metadata.Description = (string)reader["description"]; | ||
275 | metadata.Type = Convert.ToSByte(reader["assetType"]); | ||
276 | metadata.Temporary = Convert.ToBoolean(reader["temporary"]); | ||
277 | } | ||
278 | } | ||
279 | } | ||
280 | |||
281 | return retList; | ||
282 | } | ||
283 | |||
248 | #endregion | 284 | #endregion |
249 | } | 285 | } |
250 | } | 286 | } |