diff options
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLXInventoryData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLXInventoryData.cs | 53 |
1 files changed, 51 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLXInventoryData.cs b/OpenSim/Data/MySQL/MySQLXInventoryData.cs index 307a4c7..caf18a4 100644 --- a/OpenSim/Data/MySQL/MySQLXInventoryData.cs +++ b/OpenSim/Data/MySQL/MySQLXInventoryData.cs | |||
@@ -64,24 +64,42 @@ namespace OpenSim.Data.MySQL | |||
64 | 64 | ||
65 | public bool StoreFolder(XInventoryFolder folder) | 65 | public bool StoreFolder(XInventoryFolder folder) |
66 | { | 66 | { |
67 | if (folder.folderName.Length > 64) | ||
68 | folder.folderName = folder.folderName.Substring(0, 64); | ||
69 | |||
67 | return m_Folders.Store(folder); | 70 | return m_Folders.Store(folder); |
68 | } | 71 | } |
69 | 72 | ||
70 | public bool StoreItem(XInventoryItem item) | 73 | public bool StoreItem(XInventoryItem item) |
71 | { | 74 | { |
75 | if (item.inventoryName.Length > 64) | ||
76 | item.inventoryName = item.inventoryName.Substring(0, 64); | ||
77 | if (item.inventoryDescription.Length > 128) | ||
78 | item.inventoryDescription = item.inventoryDescription.Substring(0, 128); | ||
79 | |||
72 | return m_Items.Store(item); | 80 | return m_Items.Store(item); |
73 | } | 81 | } |
74 | 82 | ||
75 | public bool DeleteFolders(string field, string val) | 83 | public bool DeleteFolders(string field, string val) |
76 | { | 84 | { |
77 | return m_Folders.Delete(field, val); | 85 | return m_Folders.Delete(field, val); |
78 | } | 86 | } |
79 | 87 | ||
88 | public bool DeleteFolders(string[] fields, string[] vals) | ||
89 | { | ||
90 | return m_Folders.Delete(fields, vals); | ||
91 | } | ||
92 | |||
80 | public bool DeleteItems(string field, string val) | 93 | public bool DeleteItems(string field, string val) |
81 | { | 94 | { |
82 | return m_Items.Delete(field, val); | 95 | return m_Items.Delete(field, val); |
83 | } | 96 | } |
84 | 97 | ||
98 | public bool DeleteItems(string[] fields, string[] vals) | ||
99 | { | ||
100 | return m_Items.Delete(fields, vals); | ||
101 | } | ||
102 | |||
85 | public bool MoveItem(string id, string newParent) | 103 | public bool MoveItem(string id, string newParent) |
86 | { | 104 | { |
87 | return m_Items.MoveItem(id, newParent); | 105 | return m_Items.MoveItem(id, newParent); |
@@ -122,7 +140,7 @@ namespace OpenSim.Data.MySQL | |||
122 | { | 140 | { |
123 | using (MySqlCommand cmd = new MySqlCommand()) | 141 | using (MySqlCommand cmd = new MySqlCommand()) |
124 | { | 142 | { |
125 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags = 1", m_Realm); | 143 | cmd.CommandText = String.Format("select * from inventoryitems where avatarId = ?uuid and assetType = ?type and flags & 1", m_Realm); |
126 | 144 | ||
127 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); | 145 | cmd.Parameters.AddWithValue("?uuid", principalID.ToString()); |
128 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); | 146 | cmd.Parameters.AddWithValue("?type", (int)AssetType.Gesture); |
@@ -160,5 +178,36 @@ namespace OpenSim.Data.MySQL | |||
160 | } | 178 | } |
161 | } | 179 | } |
162 | } | 180 | } |
181 | |||
182 | public override bool Store(XInventoryItem item) | ||
183 | { | ||
184 | if (!base.Store(item)) | ||
185 | return false; | ||
186 | |||
187 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
188 | { | ||
189 | dbcon.Open(); | ||
190 | |||
191 | using (MySqlCommand cmd = new MySqlCommand()) | ||
192 | { | ||
193 | cmd.Connection = dbcon; | ||
194 | |||
195 | cmd.CommandText = String.Format("update inventoryfolders set version=version+1 where folderID = ?folderID"); | ||
196 | cmd.Parameters.AddWithValue("?folderID", item.parentFolderID.ToString()); | ||
197 | |||
198 | try | ||
199 | { | ||
200 | cmd.ExecuteNonQuery(); | ||
201 | } | ||
202 | catch (Exception) | ||
203 | { | ||
204 | return false; | ||
205 | } | ||
206 | cmd.Dispose(); | ||
207 | } | ||
208 | dbcon.Close(); | ||
209 | } | ||
210 | return true; | ||
211 | } | ||
163 | } | 212 | } |
164 | } | 213 | } |