From a2f07ecd2e248966957a8ea70d772276359b02e8 Mon Sep 17 00:00:00 2001 From: Mike Mazur Date: Mon, 9 Mar 2009 07:29:34 +0000 Subject: 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 --- OpenSim/Data/MSSQL/MSSQLAssetData.cs | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'OpenSim/Data/MSSQL/MSSQLAssetData.cs') 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 @@ using System; using System.Data; using System.Reflection; +using System.Collections.Generic; using OpenMetaverse; using log4net; using OpenSim.Framework; @@ -245,6 +246,41 @@ namespace OpenSim.Data.MSSQL return false; } + /// + /// Returns a list of AssetMetadata objects. The list is a subset of + /// the entire data set offset by containing + /// elements. + /// + /// The number of results to discard from the total data set. + /// The number of rows the returned list should contain. + /// A list of AssetMetadata objects. + public override List FetchAssetMetadataSet(int start, int count) + { + List retList = new List(count); + + using (AutoClosingSqlCommand command = database.Query("SELECT name,description,assetType,temporary,id FROM assets LIMIT @start, @count")) + { + command.Parameters.Add(database.CreateParameter("start", start)); + command.Parameters.Add(database.CreateParameter("count", count)); + + using (IDataReader reader = command.ExecuteReader()) + { + while (reader.Read()) + { + AssetMetadata metadata = new AssetMetadata(); + // Region Main + metadata.FullID = new UUID((Guid)reader["id"]); + metadata.Name = (string)reader["name"]; + metadata.Description = (string)reader["description"]; + metadata.Type = Convert.ToSByte(reader["assetType"]); + metadata.Temporary = Convert.ToBoolean(reader["temporary"]); + } + } + } + + return retList; + } + #endregion } } -- cgit v1.1