aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/SQLite/SQLiteAssetData.cs
diff options
context:
space:
mode:
authorMike Mazur2009-03-09 07:29:34 +0000
committerMike Mazur2009-03-09 07:29:34 +0000
commita2f07ecd2e248966957a8ea70d772276359b02e8 (patch)
tree5050ec85024e44e4946bfc29782875b3f50f5d37 /OpenSim/Data/SQLite/SQLiteAssetData.cs
parent* Tweak llMoveToTarget per mantis 3265 (diff)
downloadopensim-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 '')
-rw-r--r--OpenSim/Data/SQLite/SQLiteAssetData.cs50
1 files changed, 50 insertions, 0 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs
index 1b42198..6a323e1 100644
--- a/OpenSim/Data/SQLite/SQLiteAssetData.cs
+++ b/OpenSim/Data/SQLite/SQLiteAssetData.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 Mono.Data.SqliteClient; 33using Mono.Data.SqliteClient;
33using OpenMetaverse; 34using OpenMetaverse;
@@ -49,6 +50,7 @@ namespace OpenSim.Data.SQLite
49 /// Artificial constructor called upon plugin load 50 /// Artificial constructor called upon plugin load
50 /// </summary> 51 /// </summary>
51 private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; 52 private const string SelectAssetSQL = "select * from assets where UUID=:UUID";
53 private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, UUID from assets limit :start, :count";
52 private const string DeleteAssetSQL = "delete from assets where UUID=:UUID"; 54 private const string DeleteAssetSQL = "delete from assets where UUID=:UUID";
53 private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)"; 55 private const string InsertAssetSQL = "insert into assets(UUID, Name, Description, Type, Local, Temporary, Data) values(:UUID, :Name, :Description, :Type, :Local, :Temporary, :Data)";
54 private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID"; 56 private const string UpdateAssetSQL = "update assets set Name=:Name, Description=:Description, Type=:Type, Local=:Local, Temporary=:Temporary, Data=:Data where UUID=:UUID";
@@ -256,6 +258,54 @@ namespace OpenSim.Data.SQLite
256 return asset; 258 return asset;
257 } 259 }
258 260
261 private static AssetMetadata buildAssetMetadata(IDataReader row)
262 {
263 AssetMetadata metadata = new AssetMetadata();
264
265 metadata.FullID = new UUID((string) row["UUID"]);
266 metadata.Name = (string) row["Name"];
267 metadata.Description = (string) row["Description"];
268 metadata.Type = Convert.ToSByte(row["Type"]);
269 metadata.Temporary = Convert.ToBoolean(row["Temporary"]); // Not sure if this is correct.
270
271 // Current SHA1s are not stored/computed.
272 metadata.SHA1 = new byte[] {};
273
274 return metadata;
275 }
276
277 /// <summary>
278 /// Returns a list of AssetMetadata objects. The list is a subset of
279 /// the entire data set offset by <paramref name="start" /> containing
280 /// <paramref name="count" /> elements.
281 /// </summary>
282 /// <param name="start">The number of results to discard from the total data set.</param>
283 /// <param name="count">The number of rows the returned list should contain.</param>
284 /// <returns>A list of AssetMetadata objects.</returns>
285 public override List<AssetMetadata> FetchAssetMetadataSet(int start, int count)
286 {
287 List<AssetMetadata> retList = new List<AssetMetadata>(count);
288
289 lock (this)
290 {
291 using (SqliteCommand cmd = new SqliteCommand(SelectAssetMetadataSQL, m_conn))
292 {
293 cmd.Parameters.Add(new SqliteParameter(":start", start));
294 cmd.Parameters.Add(new SqliteParameter(":count", count));
295
296 using (IDataReader reader = cmd.ExecuteReader())
297 {
298 while (reader.Read())
299 {
300 AssetMetadata metadata = buildAssetMetadata(reader);
301 retList.Add(metadata);
302 }
303 }
304 }
305 }
306
307 return retList;
308 }
259 309
260 /*********************************************************************** 310 /***********************************************************************
261 * 311 *