aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Data.MySQL/MySQLInventoryData.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.MySQL/MySQLInventoryData.cs
parentTerrain: (diff)
downloadopensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.zip
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.gz
opensim-SC_OLD-8143c597fc5f62ec0d931d2d5b887730e06aec04.tar.bz2
opensim-SC_OLD-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 'OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs')
-rw-r--r--OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs58
1 files changed, 23 insertions, 35 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
index 5009d9e..8a7e869 100644
--- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs
@@ -132,7 +132,7 @@ namespace OpenSim.Framework.Data.MySQL
132 param["?uuid"] = user.ToStringHyphenated(); 132 param["?uuid"] = user.ToStringHyphenated();
133 param["?zero"] = LLUUID.Zero.ToStringHyphenated(); 133 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
134 134
135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param); 135 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND (agentID = ?uuid OR category = 0)", param);
136 IDataReader reader = result.ExecuteReader(); 136 IDataReader reader = result.ExecuteReader();
137 137
138 List<InventoryFolderBase> items = database.readInventoryFolders(reader); 138 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
@@ -152,40 +152,6 @@ namespace OpenSim.Framework.Data.MySQL
152 } 152 }
153 153
154 /// <summary> 154 /// <summary>
155 /// Returns the users inventory root folder.
156 /// </summary>
157 /// <param name="user"></param>
158 /// <returns></returns>
159 public InventoryFolderBase getUserRootFolder(LLUUID user)
160 {
161 try
162 {
163 lock (database)
164 {
165 Dictionary<string, string> param = new Dictionary<string, string>();
166 param["?uuid"] = user.ToStringHyphenated();
167 param["?zero"] = LLUUID.Zero.ToStringHyphenated();
168
169 IDbCommand result = database.Query("SELECT * FROM inventoryfolders WHERE parentFolderID = ?zero AND agentID = ?uuid", param);
170 IDataReader reader = result.ExecuteReader();
171
172 List<InventoryFolderBase> items = database.readInventoryFolders(reader);
173 InventoryFolderBase rootFolder = items[0]; //should only be one folder with parent set to zero (the root one).
174 reader.Close();
175 result.Dispose();
176
177 return rootFolder;
178 }
179 }
180 catch (Exception e)
181 {
182 database.Reconnect();
183 Console.WriteLine(e.ToString());
184 return null;
185 }
186 }
187
188 /// <summary>
189 /// Returns a list of folders in a users inventory contained within the specified folder 155 /// Returns a list of folders in a users inventory contained within the specified folder
190 /// </summary> 156 /// </summary>
191 /// <param name="parentID">The folder to search</param> 157 /// <param name="parentID">The folder to search</param>
@@ -348,5 +314,27 @@ namespace OpenSim.Framework.Data.MySQL
348 { 314 {
349 addInventoryFolder(folder); 315 addInventoryFolder(folder);
350 } 316 }
317
318 public void deleteInventoryCategory(InventoryCategory inventoryCategory)
319 {
320 try
321 {
322 lock (database) {
323 IDbCommand cmd = database.Query(string.Format("DELETE FROM inventoryitems WHERE parentFolderID IN (SELECT folderId FROM inventoryfolders WHERE category={0})", (byte)inventoryCategory), null);
324 cmd.ExecuteNonQuery();
325
326
327 cmd = database.Query(string.Format("DELETE FROM inventoryfolders WHERE category={0}", (byte)inventoryCategory), null);
328 cmd.ExecuteNonQuery();
329 }
330
331 }
332 catch (Exception e)
333 {
334 database.Reconnect();
335 Console.WriteLine(e.ToString());
336 }
337 }
338
351 } 339 }
352} 340}