aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MySQL/MySQLXInventoryData.cs28
1 files changed, 25 insertions, 3 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
index caf18a4..189ee5e 100644
--- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs
+++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs
@@ -123,11 +123,24 @@ namespace OpenSim.Data.MySQL
123 { 123 {
124 } 124 }
125 125
126 public override bool Delete(string field, string val)
127 {
128 XInventoryItem[] retrievedItems = Get(new string[] { field }, new string[] { val });
129 if (retrievedItems.Length == 0)
130 return false;
131
132 if (!base.Delete(field, val))
133 return false;
134
135 IncrementFolderVersion(retrievedItems[0].parentFolderID);
136
137 return true;
138 }
139
126 public bool MoveItem(string id, string newParent) 140 public bool MoveItem(string id, string newParent)
127 { 141 {
128 using (MySqlCommand cmd = new MySqlCommand()) 142 using (MySqlCommand cmd = new MySqlCommand())
129 { 143 {
130
131 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm); 144 cmd.CommandText = String.Format("update {0} set parentFolderID = ?ParentFolderID where inventoryID = ?InventoryID", m_Realm);
132 cmd.Parameters.AddWithValue("?ParentFolderID", newParent); 145 cmd.Parameters.AddWithValue("?ParentFolderID", newParent);
133 cmd.Parameters.AddWithValue("?InventoryID", id); 146 cmd.Parameters.AddWithValue("?InventoryID", id);
@@ -184,6 +197,13 @@ namespace OpenSim.Data.MySQL
184 if (!base.Store(item)) 197 if (!base.Store(item))
185 return false; 198 return false;
186 199
200 IncrementFolderVersion(item.parentFolderID);
201
202 return true;
203 }
204
205 private bool IncrementFolderVersion(UUID folderID)
206 {
187 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 207 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
188 { 208 {
189 dbcon.Open(); 209 dbcon.Open();
@@ -193,7 +213,7 @@ namespace OpenSim.Data.MySQL
193 cmd.Connection = dbcon; 213 cmd.Connection = dbcon;
194 214
195 cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID"); 215 cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID");
196 cmd.Parameters.AddWithValue("?folderID", item.parentFolderID.ToString()); 216 cmd.Parameters.AddWithValue("?folderID", folderID.ToString());
197 217
198 try 218 try
199 { 219 {
@@ -205,9 +225,11 @@ namespace OpenSim.Data.MySQL
205 } 225 }
206 cmd.Dispose(); 226 cmd.Dispose();
207 } 227 }
228
208 dbcon.Close(); 229 dbcon.Close();
209 } 230 }
231
210 return true; 232 return true;
211 } 233 }
212 } 234 }
213} 235} \ No newline at end of file