aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs29
1 files changed, 25 insertions, 4 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index d55369a..13f5fa2 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -111,7 +111,7 @@ namespace OpenSim.Data.MySQL
111 dbcon.Open(); 111 dbcon.Open();
112 112
113 using (MySqlCommand cmd = new MySqlCommand( 113 using (MySqlCommand cmd = new MySqlCommand(
114 "SELECT name, description, assetType, local, temporary, data FROM assets WHERE id=?id", 114 "SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id",
115 dbcon)) 115 dbcon))
116 { 116 {
117 cmd.Parameters.AddWithValue("?id", assetID.ToString()); 117 cmd.Parameters.AddWithValue("?id", assetID.ToString());
@@ -133,6 +133,7 @@ namespace OpenSim.Data.MySQL
133 asset.Local = false; 133 asset.Local = false;
134 134
135 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]); 135 asset.Temporary = Convert.ToBoolean(dbReader["temporary"]);
136 asset.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
136 } 137 }
137 } 138 }
138 } 139 }
@@ -161,8 +162,8 @@ namespace OpenSim.Data.MySQL
161 162
162 MySqlCommand cmd = 163 MySqlCommand cmd =
163 new MySqlCommand( 164 new MySqlCommand(
164 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, data)" + 165 "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" +
165 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?data)", 166 "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)",
166 dbcon); 167 dbcon);
167 168
168 string assetName = asset.Name; 169 string assetName = asset.Name;
@@ -194,6 +195,7 @@ namespace OpenSim.Data.MySQL
194 cmd.Parameters.AddWithValue("?temporary", asset.Temporary); 195 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
195 cmd.Parameters.AddWithValue("?create_time", now); 196 cmd.Parameters.AddWithValue("?create_time", now);
196 cmd.Parameters.AddWithValue("?access_time", now); 197 cmd.Parameters.AddWithValue("?access_time", now);
198 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
197 cmd.Parameters.AddWithValue("?data", asset.Data); 199 cmd.Parameters.AddWithValue("?data", asset.Data);
198 cmd.ExecuteNonQuery(); 200 cmd.ExecuteNonQuery();
199 cmd.Dispose(); 201 cmd.Dispose();
@@ -302,7 +304,7 @@ namespace OpenSim.Data.MySQL
302 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) 304 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
303 { 305 {
304 dbcon.Open(); 306 dbcon.Open();
305 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id FROM assets LIMIT ?start, ?count", dbcon); 307 MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon);
306 cmd.Parameters.AddWithValue("?start", start); 308 cmd.Parameters.AddWithValue("?start", start);
307 cmd.Parameters.AddWithValue("?count", count); 309 cmd.Parameters.AddWithValue("?count", count);
308 310
@@ -317,6 +319,7 @@ namespace OpenSim.Data.MySQL
317 metadata.Description = (string)dbReader["description"]; 319 metadata.Description = (string)dbReader["description"];
318 metadata.Type = (sbyte)dbReader["assetType"]; 320 metadata.Type = (sbyte)dbReader["assetType"];
319 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. 321 metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct.
322 metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]);
320 metadata.FullID = new UUID((string)dbReader["id"]); 323 metadata.FullID = new UUID((string)dbReader["id"]);
321 324
322 // Current SHA1s are not stored/computed. 325 // Current SHA1s are not stored/computed.
@@ -336,6 +339,24 @@ namespace OpenSim.Data.MySQL
336 return retList; 339 return retList;
337 } 340 }
338 341
342 public override bool Delete(string id)
343 {
344 lock (m_dbLock)
345 {
346 using (MySqlConnection dbcon = new MySqlConnection(m_connectionString))
347 {
348 dbcon.Open();
349 MySqlCommand cmd = new MySqlCommand("delete from assets where id=?id", dbcon);
350 cmd.Parameters.AddWithValue("?id", id);
351 cmd.ExecuteNonQuery();
352
353 cmd.Dispose();
354 }
355 }
356
357 return true;
358 }
359
339 #endregion 360 #endregion
340 } 361 }
341} 362}