diff options
Merge branch 'master' into careminster-presence-refactor
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 13f5fa2..fe5152a 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -33,6 +33,7 @@ using log4net; | |||
33 | using MySql.Data.MySqlClient; | 33 | using MySql.Data.MySqlClient; |
34 | using OpenMetaverse; | 34 | using OpenMetaverse; |
35 | using OpenSim.Framework; | 35 | using OpenSim.Framework; |
36 | using OpenSim.Data; | ||
36 | 37 | ||
37 | namespace OpenSim.Data.MySQL | 38 | namespace OpenSim.Data.MySQL |
38 | { | 39 | { |
@@ -111,7 +112,7 @@ namespace OpenSim.Data.MySQL | |||
111 | dbcon.Open(); | 112 | dbcon.Open(); |
112 | 113 | ||
113 | using (MySqlCommand cmd = new MySqlCommand( | 114 | using (MySqlCommand cmd = new MySqlCommand( |
114 | "SELECT name, description, assetType, local, temporary, asset_flags, data FROM assets WHERE id=?id", | 115 | "SELECT name, description, assetType, local, temporary, asset_flags, CreatorID, data FROM assets WHERE id=?id", |
115 | dbcon)) | 116 | dbcon)) |
116 | { | 117 | { |
117 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); | 118 | cmd.Parameters.AddWithValue("?id", assetID.ToString()); |
@@ -122,7 +123,7 @@ namespace OpenSim.Data.MySQL | |||
122 | { | 123 | { |
123 | if (dbReader.Read()) | 124 | if (dbReader.Read()) |
124 | { | 125 | { |
125 | asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], UUID.Zero.ToString()); | 126 | asset = new AssetBase(assetID, (string)dbReader["name"], (sbyte)dbReader["assetType"], dbReader["CreatorID"].ToString()); |
126 | asset.Data = (byte[])dbReader["data"]; | 127 | asset.Data = (byte[])dbReader["data"]; |
127 | asset.Description = (string)dbReader["description"]; | 128 | asset.Description = (string)dbReader["description"]; |
128 | 129 | ||
@@ -162,8 +163,8 @@ namespace OpenSim.Data.MySQL | |||
162 | 163 | ||
163 | MySqlCommand cmd = | 164 | MySqlCommand cmd = |
164 | new MySqlCommand( | 165 | new MySqlCommand( |
165 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, data)" + | 166 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + |
166 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?data)", | 167 | "VALUES(?id, ?name, ?description, ?assetType, ?local, ?temporary, ?create_time, ?access_time, ?asset_flags, ?CreatorID, ?data)", |
167 | dbcon); | 168 | dbcon); |
168 | 169 | ||
169 | string assetName = asset.Name; | 170 | string assetName = asset.Name; |
@@ -195,6 +196,7 @@ namespace OpenSim.Data.MySQL | |||
195 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); | 196 | cmd.Parameters.AddWithValue("?temporary", asset.Temporary); |
196 | cmd.Parameters.AddWithValue("?create_time", now); | 197 | cmd.Parameters.AddWithValue("?create_time", now); |
197 | cmd.Parameters.AddWithValue("?access_time", now); | 198 | cmd.Parameters.AddWithValue("?access_time", now); |
199 | cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID); | ||
198 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 200 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
199 | cmd.Parameters.AddWithValue("?data", asset.Data); | 201 | cmd.Parameters.AddWithValue("?data", asset.Data); |
200 | cmd.ExecuteNonQuery(); | 202 | cmd.ExecuteNonQuery(); |
@@ -304,7 +306,7 @@ namespace OpenSim.Data.MySQL | |||
304 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 306 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
305 | { | 307 | { |
306 | dbcon.Open(); | 308 | dbcon.Open(); |
307 | MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags FROM assets LIMIT ?start, ?count", dbcon); | 309 | MySqlCommand cmd = new MySqlCommand("SELECT name,description,assetType,temporary,id,asset_flags,CreatorID FROM assets LIMIT ?start, ?count", dbcon); |
308 | cmd.Parameters.AddWithValue("?start", start); | 310 | cmd.Parameters.AddWithValue("?start", start); |
309 | cmd.Parameters.AddWithValue("?count", count); | 311 | cmd.Parameters.AddWithValue("?count", count); |
310 | 312 | ||
@@ -320,7 +322,8 @@ namespace OpenSim.Data.MySQL | |||
320 | metadata.Type = (sbyte)dbReader["assetType"]; | 322 | metadata.Type = (sbyte)dbReader["assetType"]; |
321 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. | 323 | metadata.Temporary = Convert.ToBoolean(dbReader["temporary"]); // Not sure if this is correct. |
322 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); | 324 | metadata.Flags = (AssetFlags)Convert.ToInt32(dbReader["asset_flags"]); |
323 | metadata.FullID = new UUID((string)dbReader["id"]); | 325 | metadata.FullID = DBGuid.FromDB(dbReader["id"]); |
326 | metadata.CreatorID = dbReader["CreatorID"].ToString(); | ||
324 | 327 | ||
325 | // Current SHA1s are not stored/computed. | 328 | // Current SHA1s are not stored/computed. |
326 | metadata.SHA1 = new byte[] { }; | 329 | metadata.SHA1 = new byte[] { }; |