aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index 2211d4c..466f5db 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Data; 29using System.Data;
30using System.Reflection; 30using System.Reflection;
31using System.Collections.Generic;
31using log4net; 32using log4net;
32using MySql.Data.MySqlClient; 33using MySql.Data.MySqlClient;
33using OpenMetaverse; 34using OpenMetaverse;
@@ -311,6 +312,56 @@ namespace OpenSim.Data.MySQL
311 return assetExists; 312 return assetExists;
312 } 313 }
313 314
315 /// <summary>
316 /// Returns a list of AssetMetadata objects. The list is a subset of
317 /// the entire data set offset by <paramref name="start" /> containing
318 /// <paramref name="count" /> elements.
319 /// </summary>
320 /// <param name="start">The number of results to discard from the total data set.</param>
321 /// <param name="count">The number of rows the returned list should contain.</param>
322 /// <returns>A list of AssetMetadata objects.</returns>
323 public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
324 {
325 List<AssetMetadata> retList = new List<AssetMetadata>(count);
326
327 lock (_dbConnection)
328 {
329 _dbConnection.CheckConnection();
330
331 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", _dbConnection.Connection);
332 cmd.Parameters.AddWithValue("?start", start);
333 cmd.Parameters.AddWithValue("?count", count);
334
335 try
336 {
337 using (MySqlDataReader dbReader = cmd.ExecuteReader())
338 {
339 while (dbReader.Read())
340 {
341 AssetMetadata metadata = new AssetMetadata();
342 metadata.Name = (string) dbReader["name"];
343 metadata.Description = (string) dbReader["description"];
344 metadata.Type = (sbyte) dbReader["assetType"];
345 metadata.Temporary = (bool) dbReader["temporary"]; // Not sure if this is correct.
346 metadata.FullID = new UUID((string) dbReader["id"]);
347
348 // Current SHA1s are not stored/computed.
349 metadata.SHA1 = new byte[] {};
350
351 retList.Add(metadata);
352 }
353 }
354 }
355 catch (Exception e)
356 {
357 m_log.Error("[ASSETS DB]: MySql failure fetching asset set" + Environment.NewLine + e.ToString() + Environment.NewLine + "Attempting reconnection");
358 _dbConnection.Reconnect();
359 }
360 }
361
362 return retList;
363 }
364
314 #endregion 365 #endregion
315 366
316 /// <summary> 367 /// <summary>