aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Data/MySQL/MySQLAssetData.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r--OpenSim/Data/MySQL/MySQLAssetData.cs47
1 files changed, 5 insertions, 42 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs
index cb5a38e..76b1e38 100644
--- a/OpenSim/Data/MySQL/MySQLAssetData.cs
+++ b/OpenSim/Data/MySQL/MySQLAssetData.cs
@@ -202,52 +202,15 @@ namespace OpenSim.Data.MySQL
202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); 202 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
203 cmd.Parameters.AddWithValue("?data", asset.Data); 203 cmd.Parameters.AddWithValue("?data", asset.Data);
204 cmd.ExecuteNonQuery(); 204 cmd.ExecuteNonQuery();
205 } 205 return true;
206
207 string assetDescription = asset.Description;
208 if (asset.Description.Length > 64)
209 {
210 assetDescription = asset.Description.Substring(0, 64);
211 m_log.WarnFormat(
212 "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add",
213 asset.Description, asset.ID, asset.Description.Length, assetDescription.Length);
214 }
215
216 try
217 {
218 using (cmd)
219 {
220 // create unix epoch time
221 int now = (int)Utils.DateTimeToUnixTime(DateTime.UtcNow);
222 cmd.Parameters.AddWithValue("?id", asset.ID);
223 cmd.Parameters.AddWithValue("?name", assetName);
224 cmd.Parameters.AddWithValue("?description", assetDescription);
225 cmd.Parameters.AddWithValue("?assetType", asset.Type);
226 cmd.Parameters.AddWithValue("?local", asset.Local);
227 cmd.Parameters.AddWithValue("?temporary", asset.Temporary);
228 cmd.Parameters.AddWithValue("?create_time", now);
229 cmd.Parameters.AddWithValue("?access_time", now);
230 cmd.Parameters.AddWithValue("?CreatorID", asset.Metadata.CreatorID);
231 cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags);
232 cmd.Parameters.AddWithValue("?data", asset.Data);
233 cmd.ExecuteNonQuery();
234 return true;
235 }
236 }
237 catch (Exception e)
238 {
239 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
240 asset.FullID, asset.Name, e.Message);
241 return false;
242 } 206 }
243 } 207 }
208
244 catch (Exception e) 209 catch (Exception e)
245 { 210 {
246 m_log.Error( 211 m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}",
247 string.Format( 212 asset.FullID, asset.Name, e.Message);
248 "[ASSET DB]: MySQL failure creating asset {0} with name {1}. Exception ", 213 return false;
249 asset.FullID, asset.Name)
250 , e);
251 } 214 }
252 } 215 }
253 } 216 }