diff options
Diffstat (limited to 'OpenSim/Framework/Data.MySQL')
-rw-r--r-- | OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs index 7c86e2c..4020cc1 100644 --- a/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs +++ b/OpenSim/Framework/Data.MySQL/MySQLInventoryData.cs | |||
@@ -211,11 +211,7 @@ namespace OpenSim.Framework.Data.MySQL | |||
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | /// <summary> | 214 | // see InventoryItemBase.getUserRootFolder |
215 | /// Returns the users inventory root folder. | ||
216 | /// </summary> | ||
217 | /// <param name="user"></param> | ||
218 | /// <returns></returns> | ||
219 | public InventoryFolderBase getUserRootFolder(LLUUID user) | 215 | public InventoryFolderBase getUserRootFolder(LLUUID user) |
220 | { | 216 | { |
221 | try | 217 | try |
@@ -234,9 +230,19 @@ namespace OpenSim.Framework.Data.MySQL | |||
234 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); | 230 | List<InventoryFolderBase> items = new List<InventoryFolderBase>(); |
235 | while (reader.Read()) | 231 | while (reader.Read()) |
236 | items.Add(readInventoryFolder(reader)); | 232 | items.Add(readInventoryFolder(reader)); |
233 | |||
234 | InventoryFolderBase rootFolder = null; | ||
235 | |||
236 | // There should only ever be one root folder for a user. However, if there's more | ||
237 | // than one we'll simply use the first one rather than failing. It would be even | ||
238 | // nicer to print some message to this effect, but this feels like it's too low a | ||
239 | // to put such a message out, and it's too minor right now to spare the time to | ||
240 | // suitably refactor. | ||
241 | if (items.Count > 0) | ||
242 | { | ||
243 | rootFolder = items[0]; | ||
244 | } | ||
237 | 245 | ||
238 | InventoryFolderBase rootFolder = items[0]; | ||
239 | //should only be one folder with parent set to zero (the root one). | ||
240 | reader.Close(); | 246 | reader.Close(); |
241 | result.Dispose(); | 247 | result.Dispose(); |
242 | 248 | ||
@@ -252,7 +258,9 @@ namespace OpenSim.Framework.Data.MySQL | |||
252 | } | 258 | } |
253 | 259 | ||
254 | /// <summary> | 260 | /// <summary> |
255 | /// Returns a list of folders in a users inventory contained within the specified folder | 261 | /// Return a list of folders in a users inventory contained within the specified folder. |
262 | /// This method is only used in tests - in normal operation the user always have one, | ||
263 | /// and only one, root folder. | ||
256 | /// </summary> | 264 | /// </summary> |
257 | /// <param name="parentID">The folder to search</param> | 265 | /// <param name="parentID">The folder to search</param> |
258 | /// <returns>A list of inventory folders</returns> | 266 | /// <returns>A list of inventory folders</returns> |
@@ -605,4 +613,4 @@ namespace OpenSim.Framework.Data.MySQL | |||
605 | } | 613 | } |
606 | } | 614 | } |
607 | } | 615 | } |
608 | } \ No newline at end of file | 616 | } |