From 8a8c89a0f32b528bd588715bdbfc875c852e7187 Mon Sep 17 00:00:00 2001
From: Brian McBee
Date: Sat, 15 Dec 2007 04:57:14 +0000
Subject: Grid Inventory feature upgrade: renaming folders should now be
 correct, subfolders work, moving folders works. Tested only in MYSQL, but may
 work in MSSQL and sqlite. Probably not working in standalone mode.

---
 OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs | 28 ++++++++++++++++++++++
 1 file changed, 28 insertions(+)

(limited to 'OpenSim/Framework/Data.MSSQL')

diff --git a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
index ef2a0f3..69b53a3 100644
--- a/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Framework/Data.MSSQL/MSSQLInventoryData.cs
@@ -604,6 +604,34 @@ namespace OpenSim.Framework.Data.MSSQL
             
         }
 
+        /// <summary>
+        /// Updates an inventory folder
+        /// </summary>
+        /// <param name="folder">Folder to update</param>
+
+        public void moveInventoryFolder(InventoryFolderBase folder)
+        {
+            SqlCommand command = new SqlCommand("UPDATE inventoryfolders set folderID = @folderID, " +
+                                                           "parentFolderID = @parentFolderID," +
+                                                           "folderID = @keyFolderID;", database.getConnection());
+            SqlParameter param1 = new SqlParameter("@folderID", folder.folderID.ToStringHyphenated());
+            SqlParameter param2 = new SqlParameter("@parentFolderID", folder.parentID.ToStringHyphenated());
+            SqlParameter param3 = new SqlParameter("@keyFolderID", folder.folderID.ToStringHyphenated());
+            command.Parameters.Add(param1);
+            command.Parameters.Add(param2);
+            command.Parameters.Add(param3);
+
+            try
+            {
+                command.ExecuteNonQuery();
+            }
+            catch (Exception e)
+            {
+                MainLog.Instance.Error(e.ToString());
+            }
+
+
+        }
 
         /// <summary>
         /// Append a list of all the child folders of a parent folder 
-- 
cgit v1.1