diff options
author | UbitUmarov | 2015-09-01 14:54:35 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-01 14:54:35 +0100 |
commit | 371c9dd2af01a2e7422ec901ee1f80757284a78c (patch) | |
tree | 058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Data/MySQL/MySQLAssetData.cs | |
parent | remove lixo (diff) | |
parent | dont change camera on crossings (diff) | |
download | opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2 opensim-SC_OLD-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz |
bad merge?
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 5d8da17..cb5a38e 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -154,7 +154,7 @@ namespace OpenSim.Data.MySQL | |||
154 | /// </summary> | 154 | /// </summary> |
155 | /// <param name="asset">Asset UUID to create</param> | 155 | /// <param name="asset">Asset UUID to create</param> |
156 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 156 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
157 | override public void StoreAsset(AssetBase asset) | 157 | override public bool StoreAsset(AssetBase asset) |
158 | { | 158 | { |
159 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 159 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) |
160 | { | 160 | { |
@@ -203,6 +203,43 @@ namespace OpenSim.Data.MySQL | |||
203 | cmd.Parameters.AddWithValue("?data", asset.Data); | 203 | cmd.Parameters.AddWithValue("?data", asset.Data); |
204 | cmd.ExecuteNonQuery(); | 204 | cmd.ExecuteNonQuery(); |
205 | } | 205 | } |
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 | catch (Exception e) | 244 | catch (Exception e) |
208 | { | 245 | { |
@@ -364,4 +401,4 @@ namespace OpenSim.Data.MySQL | |||
364 | 401 | ||
365 | #endregion | 402 | #endregion |
366 | } | 403 | } |
367 | } \ No newline at end of file | 404 | } |