diff options
Diffstat (limited to 'OpenSim/Data/MSSQL')
-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 | } |