From 863195612bdef56165f2b4354bab280c371618b9 Mon Sep 17 00:00:00 2001 From: lbsa71 Date: Thu, 27 Sep 2007 14:57:43 +0000 Subject: Reverting back to 2017 since 2018 were causing Linux breakage; reopening Tleiades patch 444 and 445. --- OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 58 +++++++++++++--------- 1 file changed, 35 insertions(+), 23 deletions(-) (limited to 'OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs') diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index 8a7e869..5009d9e 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs @@ -132,7 +132,7 @@ namespace OpenSim.Framework.Data.MySQL param["?uuid"] = user.ToStringHyphenated(); param["?zero"] = LLUUID.Zero.ToStringHyphenated(); - IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND (agentID = ?uuid OR category = 0)", param); + IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); IDataReader reader = result.ExecuteReader(); List items = database.readInventoryFolders(reader); @@ -152,6 +152,40 @@ namespace OpenSim.Framework.Data.MySQL } /// + /// Returns the users inventory root folder. + /// + /// + /// + public InventoryFolderBase getUserRootFolder(LLUUID user) + { + try + { + lock (database) + { + Dictionary param = new Dictionary(); + param["?uuid"] = user.ToStringHyphenated(); + param["?zero"] = LLUUID.Zero.ToStringHyphenated(); + + IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); + IDataReader reader = result.ExecuteReader(); + + List items = database.readInventoryFolders(reader); + InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one). + reader.Close(); + result.Dispose(); + + return rootFolder; + } + } + catch (Exception e) + { + database.Reconnect(); + Console.WriteLine(e.ToString()); + return null; + } + } + + /// /// Returns a list of folders in a users inventory contained within the specified folder /// /// The folder to search @@ -314,27 +348,5 @@ namespace OpenSim.Framework.Data.MySQL { addInventoryFolder(folder); } - - public void deleteInventoryCategory(InventoryCategory inventoryCategory) - { - try - { - lock (database) { - IDbCommand cmd = database.Query(string.Format("DELETE FROM inventoryitems WHERE parentFolderID IN (SELECT folderId FROM inventoryfolders WHERE category={0})", (byte)inventoryCategory), null); - cmd.ExecuteNonQuery(); - - - cmd = database.Query(string.Format("DELETE FROM inventoryfolders WHERE category={0}", (byte)inventoryCategory), null); - cmd.ExecuteNonQuery(); - } - - } - catch (Exception e) - { - database.Reconnect(); - Console.WriteLine(e.ToString()); - } - } - } } -- cgit v1.1