aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
diff options
context:
space:
mode:
authorlbsa712007-09-27 14:57:43 +0000
committerlbsa712007-09-27 14:57:43 +0000
commit863195612bdef56165f2b4354bab280c371618b9 (patch)
tree63cec15a6c0338a8777640ed13fd7c3ce05eeba7 /OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
parentrevert change to libsecondlife.dll.config which breaks Linux (diff)
downloadopensim-SC-863195612bdef56165f2b4354bab280c371618b9.zip
opensim-SC-863195612bdef56165f2b4354bab280c371618b9.tar.gz
opensim-SC-863195612bdef56165f2b4354bab280c371618b9.tar.bz2
opensim-SC-863195612bdef56165f2b4354bab280c371618b9.tar.xz
Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs71
1 files changed, 34 insertions, 37 deletions
diff --git a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
index eb0ba04..d3d752f 100644
--- a/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
+++ b/OpenSim/Framework/Data.SQLite/SQLiteInventoryStore.cs
@@ -61,11 +61,10 @@ 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
65 return; 64 return;
66 } 65 }
67 66
68 public InventoryItemBase buildItem(DataRow row) 67 public InventoryItemBase BuildItem(DataRow row)
69 { 68 {
70 InventoryItemBase item = new InventoryItemBase(); 69 InventoryItemBase item = new InventoryItemBase();
71 item.inventoryID = new LLUUID((string)row["UUID"]); 70 item.inventoryID = new LLUUID((string)row["UUID"]);
@@ -183,7 +182,7 @@ namespace OpenSim.Framework.Data.SQLite
183 DataRow[] rows = inventoryItemTable.Select(selectExp); 182 DataRow[] rows = inventoryItemTable.Select(selectExp);
184 foreach (DataRow row in rows) 183 foreach (DataRow row in rows)
185 { 184 {
186 retval.Add(buildItem(row)); 185 retval.Add(BuildItem(row));
187 } 186 }
188 187
189 return retval; 188 return retval;
@@ -196,16 +195,43 @@ namespace OpenSim.Framework.Data.SQLite
196 /// <returns>A list of folder objects</returns> 195 /// <returns>A list of folder objects</returns>
197 public List<InventoryFolderBase> getUserRootFolders(LLUUID user) 196 public List<InventoryFolderBase> getUserRootFolders(LLUUID user)
198 { 197 {
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 {
199 List<InventoryFolderBase> folders = new List<InventoryFolderBase>(); 208 List<InventoryFolderBase> folders = new List<InventoryFolderBase>();
200 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 209 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"];
201 210 string selectExp = "agentID = '" + user.ToString() + "' AND parentID = '" + LLUUID.Zero.ToString() + "'";
202 string selectExp = "parentID = '" + LLUUID.Zero.ToString() + "' AND (agentID = '" + user.ToString() + "' OR category = 0)";
203 DataRow[] rows = inventoryFolderTable.Select(selectExp); 211 DataRow[] rows = inventoryFolderTable.Select(selectExp);
204 foreach (DataRow row in rows) 212 foreach (DataRow row in rows)
205 { 213 {
206 folders.Add(this.buildFolder(row)); 214 folders.Add(this.buildFolder(row));
207 } 215 }
208 return folders; 216
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;
209 } 235 }
210 236
211 /// <summary> 237 /// <summary>
@@ -234,11 +260,7 @@ namespace OpenSim.Framework.Data.SQLite
234 /// <returns>A class containing item information</returns> 260 /// <returns>A class containing item information</returns>
235 public InventoryItemBase getInventoryItem(LLUUID item) 261 public InventoryItemBase getInventoryItem(LLUUID item)
236 { 262 {
237 DataRow row = ds.Tables["inventoryitems"].Rows.Find(item); 263 return null;
238 if (row != null)
239 return this.buildItem(row);
240 else
241 return null;
242 } 264 }
243 265
244 /// <summary> 266 /// <summary>
@@ -248,14 +270,7 @@ namespace OpenSim.Framework.Data.SQLite
248 /// <returns>A class containing folder information</returns> 270 /// <returns>A class containing folder information</returns>
249 public InventoryFolderBase getInventoryFolder(LLUUID folder) 271 public InventoryFolderBase getInventoryFolder(LLUUID folder)
250 { 272 {
251 DataTable inventoryFolderTable = ds.Tables["inventoryfolders"]; 273 return null;
252 string selectExp = "UUID = '" + folder.ToString() + "'";
253 DataRow[] rows = inventoryFolderTable.Select(selectExp);
254
255 if (rows.Length == 1)
256 return this.buildFolder(rows[0]);
257 else
258 return null;
259 } 274 }
260 275
261 /// <summary> 276 /// <summary>
@@ -293,11 +308,6 @@ namespace OpenSim.Framework.Data.SQLite
293 this.invItemsDa.Update(ds, "inventoryitems"); 308 this.invItemsDa.Update(ds, "inventoryitems");
294 } 309 }
295 310
296 //TODO! Implement SQLite deleteInventoryCategory
297 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
298 {
299 }
300
301 /// <summary> 311 /// <summary>
302 /// Adds a new folder specified by folder 312 /// Adds a new folder specified by folder
303 /// </summary> 313 /// </summary>
@@ -316,11 +326,6 @@ namespace OpenSim.Framework.Data.SQLite
316 this.addFolder(folder); 326 this.addFolder(folder);
317 } 327 }
318 328
319 //TODO! implement CreateNewUserInventory
320 public void CreateNewUserInventory(LLUUID user)
321 {
322 throw new Exception("Function not implemented");
323 }
324 329
325 /*********************************************************************** 330 /***********************************************************************
326 * 331 *
@@ -345,7 +350,6 @@ namespace OpenSim.Framework.Data.SQLite
345 createCol(inv, "parentFolderID", typeof(System.String)); 350 createCol(inv, "parentFolderID", typeof(System.String));
346 createCol(inv, "avatarID", typeof(System.String)); 351 createCol(inv, "avatarID", typeof(System.String));
347 createCol(inv, "creatorsID", typeof(System.String)); 352 createCol(inv, "creatorsID", typeof(System.String));
348 createCol(inv, "category", typeof(System.Byte));
349 353
350 createCol(inv, "inventoryName", typeof(System.String)); 354 createCol(inv, "inventoryName", typeof(System.String));
351 createCol(inv, "inventoryDescription", typeof(System.String)); 355 createCol(inv, "inventoryDescription", typeof(System.String));
@@ -369,7 +373,6 @@ namespace OpenSim.Framework.Data.SQLite
369 createCol(fol, "parentID", typeof(System.String)); 373 createCol(fol, "parentID", typeof(System.String));
370 createCol(fol, "type", typeof(System.Int32)); 374 createCol(fol, "type", typeof(System.Int32));
371 createCol(fol, "version", typeof(System.Int32)); 375 createCol(fol, "version", typeof(System.Int32));
372 createCol(fol, "category", typeof(System.Byte));
373 376
374 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] }; 377 fol.PrimaryKey = new DataColumn[] { fol.Columns["UUID"] };
375 return fol; 378 return fol;
@@ -412,7 +415,6 @@ namespace OpenSim.Framework.Data.SQLite
412 folder.parentID = new LLUUID((string)row["parentID"]); 415 folder.parentID = new LLUUID((string)row["parentID"]);
413 folder.type = Convert.ToInt16(row["type"]); 416 folder.type = Convert.ToInt16(row["type"]);
414 folder.version = Convert.ToUInt16(row["version"]); 417 folder.version = Convert.ToUInt16(row["version"]);
415 folder.category = (InventoryCategory)Convert.ToByte(row["category"]);
416 return folder; 418 return folder;
417 } 419 }
418 420
@@ -424,7 +426,6 @@ namespace OpenSim.Framework.Data.SQLite
424 row["parentID"] = folder.parentID; 426 row["parentID"] = folder.parentID;
425 row["type"] = folder.type; 427 row["type"] = folder.type;
426 row["version"] = folder.version; 428 row["version"] = folder.version;
427 row["category"] = folder.category;
428 } 429 }
429 430
430 431
@@ -643,7 +644,3 @@ namespace OpenSim.Framework.Data.SQLite
643 } 644 }
644} 645}
645 646
646
647
648
649