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/MySQL/MySQLAssetData.cs | |
parent | * Tweak llMoveToTarget per mantis 3265 (diff) | |
download | opensim-SC-a2f07ecd2e248966957a8ea70d772276359b02e8.zip opensim-SC-a2f07ecd2e248966957a8ea70d772276359b02e8.tar.gz opensim-SC-a2f07ecd2e248966957a8ea70d772276359b02e8.tar.bz2 opensim-SC-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/MySQL/MySQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 51 |
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 @@ | |||
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 log4net; | 32 | using log4net; |
32 | using MySql.Data.MySqlClient; | 33 | using MySql.Data.MySqlClient; |
33 | using OpenMetaverse; | 34 | using 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> |