aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
diff options
context:
space:
mode:
authorlbsa712007-09-27 13:25:45 +0000
committerlbsa712007-09-27 13:25:45 +0000
commit8143c597fc5f62ec0d931d2d5b887730e06aec04 (patch)
treeae67873a5f801b2b7bdf9a7b088db98beb97b5ac /OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
parentTerrain: (diff)
downloadopensim-SC-8143c597fc5f62ec0d931d2d5b887730e06aec04.zip
opensim-SC-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.gz
opensim-SC-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.bz2
opensim-SC-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.xz
* Tleiades grid mode inventory (#444) - thanx Tleiades!
* updated to rev 1413 on libsecondlife.dll and libsecondlife.dll.config (#423)
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs61
1 files changed, 30 insertions, 31 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index d3d752f..cac992c 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -61,6 +61,7 @@ namespace OpenSim.Framework.Data.SQLite
61 MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions"); 61 MainLog.Instance.Verbose("DATASTORE", "Populated Intentory Items Definitions");
62 62
63 ds.AcceptChanges(); 63 ds.AcceptChanges();
64
64 return; 65 return;
65 } 66 }
66 67
@@ -195,43 +196,16 @@ namespace OpenSim.Framework.Data.SQLite
195 /// <returns>A list of folder objects</returns> 196 /// <returns>A list of folder objects</returns>
196 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 197 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
197 { 198 {
198 return null;
199 }
200
201 /// <summary>
202 /// Returns the users inventory root folder.
203 /// </summary>
204 /// <param name="user">The UUID of the user who is having inventory being returned</param>
205 /// <returns>Root inventory folder</returns>
206 public InventoryFolderBase getUserRootFolder(LLUUID user)
207 {
208 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 199 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
209 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 200 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
210 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'"; 201
202 string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
211 DataRow[] rows = inventoryFolderTable.Select(selectExp); 203 DataRow[] rows = inventoryFolderTable.Select(selectExp);
212 foreach (DataRow row in rows) 204 foreach (DataRow row in rows)
213 { 205 {
214 folders.Add(this.buildFolder(row)); 206 folders.Add(this.buildFolder(row));
215 } 207 }
216 208 return folders;
217 if (folders.Count == 1)
218 {
219 //we found the root
220 //System.Console.WriteLine("found root inventory folder");
221 return folders[0];
222 }
223 else if (folders.Count > 1)
224 {
225 //err shouldn't be more than one root
226 //System.Console.WriteLine("found more than one root inventory folder");
227 }
228 else if (folders.Count == 0)
229 {
230 // no root?
231 //System.Console.WriteLine("couldn't find root inventory folder");
232 }
233
234 return null;
235 } 209 }
236 210
237 /// <summary> 211 /// <summary>
@@ -270,7 +244,14 @@ namespace OpenSim.Framework.Data.SQLite
270 /// <returns>A class containing folder information</returns> 244 /// <returns>A class containing folder information</returns>
271 public InventoryFolderBase getInventoryFolder(LLUUID folder) 245 public InventoryFolderBase getInventoryFolder(LLUUID folder)
272 { 246 {
273 return null; 247 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
248 string selectExp = "UUID = '" + folder.ToString() + "'";
249 DataRow[] rows = inventoryFolderTable.Select(selectExp);
250
251 if (rows.Length == 1)
252 return this.buildFolder(rows[0]);
253 else
254 return null;
274 } 255 }
275 256
276 /// <summary> 257 /// <summary>
@@ -308,6 +289,11 @@ namespace OpenSim.Framework.Data.SQLite
308 this.invItemsDa.Update(ds, "inventoryitems"); 289 this.invItemsDa.Update(ds, "inventoryitems");
309 } 290 }
310 291
292 //TODO! Implement SQLite deleteInventoryCategory
293 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
294 {
295 }
296
311 /// <summary> 297 /// <summary>
312 /// Adds a new folder specified by folder 298 /// Adds a new folder specified by folder
313 /// </summary> 299 /// </summary>
@@ -326,6 +312,11 @@ namespace OpenSim.Framework.Data.SQLite
326 this.addFolder(folder); 312 this.addFolder(folder);
327 } 313 }
328 314
315 //TODO! implement CreateNewUserInventory
316 public void CreateNewUserInventory(LLUUID user)
317 {
318 throw new Exception("Function not implemented");
319 }
329 320
330 /*********************************************************************** 321 /***********************************************************************
331 * 322 *
@@ -350,6 +341,7 @@ namespace OpenSim.Framework.Data.SQLite
350 createCol(inv, "parentFolderID", typeof(System.String)); 341 createCol(inv, "parentFolderID", typeof(System.String));
351 createCol(inv, "avatarID", typeof(System.String)); 342 createCol(inv, "avatarID", typeof(System.String));
352 createCol(inv, "creatorsID", typeof(System.String)); 343 createCol(inv, "creatorsID", typeof(System.String));
344 createCol(inv, "category", typeof(System.Byte));
353 345
354 createCol(inv, "inventoryName", typeof(System.String)); 346 createCol(inv, "inventoryName", typeof(System.String));
355 createCol(inv, "inventoryDescription", typeof(System.String)); 347 createCol(inv, "inventoryDescription", typeof(System.String));
@@ -373,6 +365,7 @@ namespace OpenSim.Framework.Data.SQLite
373 createCol(fol, "parentID", typeof(System.String)); 365 createCol(fol, "parentID", typeof(System.String));
374 createCol(fol, "type", typeof(System.Int32)); 366 createCol(fol, "type", typeof(System.Int32));
375 createCol(fol, "version", typeof(System.Int32)); 367 createCol(fol, "version", typeof(System.Int32));
368 createCol(fol, "category", typeof(System.Byte));
376 369
377 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; 370 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
378 return fol; 371 return fol;
@@ -415,6 +408,7 @@ namespace OpenSim.Framework.Data.SQLite
415 folder.parentID = new LLUUID((string)row["parentID"]); 408 folder.parentID = new LLUUID((string)row["parentID"]);
416 folder.type = Convert.ToInt16(row["type"]); 409 folder.type = Convert.ToInt16(row["type"]);
417 folder.version = Convert.ToUInt16(row["version"]); 410 folder.version = Convert.ToUInt16(row["version"]);
411 folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
418 return folder; 412 return folder;
419 } 413 }
420 414
@@ -426,6 +420,7 @@ namespace OpenSim.Framework.Data.SQLite
426 row["parentID"] = folder.parentID; 420 row["parentID"] = folder.parentID;
427 row["type"] = folder.type; 421 row["type"] = folder.type;
428 row["version"] = folder.version; 422 row["version"] = folder.version;
423 row["category"] = folder.category;
429 } 424 }
430 425
431 426
@@ -644,3 +639,7 @@ namespace OpenSim.Framework.Data.SQLite
644 } 639 }
645} 640}
646 641
642
643
644
645