diff options
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLAssetData.cs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs index 5d1e170..ec9d4f6 100644 --- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs +++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs | |||
@@ -121,15 +121,16 @@ namespace OpenSim.Data.MSSQL | |||
121 | if (reader.Read()) | 121 | if (reader.Read()) |
122 | { | 122 | { |
123 | AssetBase asset = new AssetBase( | 123 | AssetBase asset = new AssetBase( |
124 | new UUID((Guid)reader["id"]), | 124 | DBGuid.FromDB(reader["id"]), |
125 | (string)reader["name"], | 125 | (string)reader["name"], |
126 | Convert.ToSByte(reader["assetType"]), | 126 | Convert.ToSByte(reader["assetType"]), |
127 | String.Empty | 127 | reader["creatorid"].ToString() |
128 | ); | 128 | ); |
129 | // Region Main | 129 | // Region Main |
130 | asset.Description = (string)reader["description"]; | 130 | asset.Description = (string)reader["description"]; |
131 | asset.Local = Convert.ToBoolean(reader["local"]); | 131 | asset.Local = Convert.ToBoolean(reader["local"]); |
132 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); | 132 | asset.Temporary = Convert.ToBoolean(reader["temporary"]); |
133 | asset.Flags = (AssetFlags)(Convert.ToInt32(reader["asset_flags"])); | ||
133 | asset.Data = (byte[])reader["data"]; | 134 | asset.Data = (byte[])reader["data"]; |
134 | return asset; | 135 | return asset; |
135 | } | 136 | } |
@@ -160,10 +161,10 @@ namespace OpenSim.Data.MSSQL | |||
160 | 161 | ||
161 | string sql = @"INSERT INTO assets | 162 | string sql = @"INSERT INTO assets |
162 | ([id], [name], [description], [assetType], [local], | 163 | ([id], [name], [description], [assetType], [local], |
163 | [temporary], [create_time], [access_time], [data]) | 164 | [temporary], [create_time], [access_time], [creatorid], [asset_flags], [data]) |
164 | VALUES | 165 | VALUES |
165 | (@id, @name, @description, @assetType, @local, | 166 | (@id, @name, @description, @assetType, @local, |
166 | @temporary, @create_time, @access_time, @data)"; | 167 | @temporary, @create_time, @access_time, @creatorid, @asset_flags, @data)"; |
167 | 168 | ||
168 | string assetName = asset.Name; | 169 | string assetName = asset.Name; |
169 | if (asset.Name.Length > 64) | 170 | if (asset.Name.Length > 64) |
@@ -191,6 +192,8 @@ namespace OpenSim.Data.MSSQL | |||
191 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); | 192 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); |
192 | command.Parameters.Add(m_database.CreateParameter("access_time", now)); | 193 | command.Parameters.Add(m_database.CreateParameter("access_time", now)); |
193 | command.Parameters.Add(m_database.CreateParameter("create_time", now)); | 194 | command.Parameters.Add(m_database.CreateParameter("create_time", now)); |
195 | command.Parameters.Add(m_database.CreateParameter("asset_flags", (int)asset.Flags)); | ||
196 | command.Parameters.Add(m_database.CreateParameter("creatorid", asset.Metadata.CreatorID)); | ||
194 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); | 197 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); |
195 | conn.Open(); | 198 | conn.Open(); |
196 | try | 199 | try |
@@ -212,6 +215,7 @@ namespace OpenSim.Data.MSSQL | |||
212 | { | 215 | { |
213 | string sql = @"UPDATE assets set name = @name, description = @description, assetType = @assetType, | 216 | string sql = @"UPDATE assets set name = @name, description = @description, assetType = @assetType, |
214 | local = @local, temporary = @temporary, data = @data | 217 | local = @local, temporary = @temporary, data = @data |
218 | , creatorid = @creatorid | ||
215 | WHERE id = @keyId;"; | 219 | WHERE id = @keyId;"; |
216 | 220 | ||
217 | string assetName = asset.Name; | 221 | string assetName = asset.Name; |
@@ -238,6 +242,7 @@ namespace OpenSim.Data.MSSQL | |||
238 | command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); | 242 | command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); |
239 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); | 243 | command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); |
240 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); | 244 | command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); |
245 | command.Parameters.Add(m_database.CreateParameter("creatorid", asset.Metadata.CreatorID)); | ||
241 | conn.Open(); | 246 | conn.Open(); |
242 | try | 247 | try |
243 | { | 248 | { |
@@ -296,7 +301,7 @@ namespace OpenSim.Data.MSSQL | |||
296 | List<AssetMetadata> retList = new List<AssetMetadata>(count); | 301 | List<AssetMetadata> retList = new List<AssetMetadata>(count); |
297 | string sql = @"WITH OrderedAssets AS | 302 | string sql = @"WITH OrderedAssets AS |
298 | ( | 303 | ( |
299 | SELECT id, name, description, assetType, temporary, | 304 | SELECT id, name, description, assetType, temporary, creatorid, |
300 | Row = ROW_NUMBER() OVER (ORDER BY id) | 305 | Row = ROW_NUMBER() OVER (ORDER BY id) |
301 | FROM assets | 306 | FROM assets |
302 | ) | 307 | ) |
@@ -320,6 +325,7 @@ namespace OpenSim.Data.MSSQL | |||
320 | metadata.Description = (string)reader["description"]; | 325 | metadata.Description = (string)reader["description"]; |
321 | metadata.Type = Convert.ToSByte(reader["assetType"]); | 326 | metadata.Type = Convert.ToSByte(reader["assetType"]); |
322 | metadata.Temporary = Convert.ToBoolean(reader["temporary"]); | 327 | metadata.Temporary = Convert.ToBoolean(reader["temporary"]); |
328 | metadata.CreatorID = (string)reader["creatorid"]; | ||
323 | } | 329 | } |
324 | } | 330 | } |
325 | } | 331 | } |