diff options
author | UbitUmarov | 2017-05-06 20:38:38 +0100 |
---|---|---|
committer | UbitUmarov | 2017-05-06 20:38:38 +0100 |
commit | 76337b1d8e532173d37038539163cbda9a742281 (patch) | |
tree | d9f42df6bcbd6ebdafbf94fb749c9f5229650f3f /OpenSim/Data/MySQL/MySQLAssetData.cs | |
parent | build const strings a compile time... (diff) | |
download | opensim-SC-76337b1d8e532173d37038539163cbda9a742281.zip opensim-SC-76337b1d8e532173d37038539163cbda9a742281.tar.gz opensim-SC-76337b1d8e532173d37038539163cbda9a742281.tar.bz2 opensim-SC-76337b1d8e532173d37038539163cbda9a742281.tar.xz |
another misplaced close
Diffstat (limited to 'OpenSim/Data/MySQL/MySQLAssetData.cs')
-rw-r--r-- | OpenSim/Data/MySQL/MySQLAssetData.cs | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/OpenSim/Data/MySQL/MySQLAssetData.cs b/OpenSim/Data/MySQL/MySQLAssetData.cs index 27cc0ba..8569c90 100644 --- a/OpenSim/Data/MySQL/MySQLAssetData.cs +++ b/OpenSim/Data/MySQL/MySQLAssetData.cs | |||
@@ -158,28 +158,27 @@ namespace OpenSim.Data.MySQL | |||
158 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> | 158 | /// <remarks>On failure : Throw an exception and attempt to reconnect to database</remarks> |
159 | override public bool StoreAsset(AssetBase asset) | 159 | override public bool StoreAsset(AssetBase asset) |
160 | { | 160 | { |
161 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | 161 | string assetName = asset.Name; |
162 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | ||
162 | { | 163 | { |
163 | dbcon.Open(); | 164 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); |
164 | 165 | m_log.WarnFormat( | |
165 | string assetName = asset.Name; | 166 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", |
166 | if (asset.Name.Length > AssetBase.MAX_ASSET_NAME) | 167 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); |
167 | { | 168 | } |
168 | assetName = asset.Name.Substring(0, AssetBase.MAX_ASSET_NAME); | ||
169 | m_log.WarnFormat( | ||
170 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
171 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
172 | } | ||
173 | 169 | ||
174 | string assetDescription = asset.Description; | 170 | string assetDescription = asset.Description; |
175 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) | 171 | if (asset.Description.Length > AssetBase.MAX_ASSET_DESC) |
176 | { | 172 | { |
177 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); | 173 | assetDescription = asset.Description.Substring(0, AssetBase.MAX_ASSET_DESC); |
178 | m_log.WarnFormat( | 174 | m_log.WarnFormat( |
179 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | 175 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", |
180 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | 176 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); |
181 | } | 177 | } |
182 | 178 | ||
179 | using (MySqlConnection dbcon = new MySqlConnection(m_connectionString)) | ||
180 | { | ||
181 | dbcon.Open(); | ||
183 | using (MySqlCommand cmd = | 182 | using (MySqlCommand cmd = |
184 | new MySqlCommand( | 183 | new MySqlCommand( |
185 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + | 184 | "replace INTO assets(id, name, description, assetType, local, temporary, create_time, access_time, asset_flags, CreatorID, data)" + |
@@ -202,16 +201,17 @@ namespace OpenSim.Data.MySQL | |||
202 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); | 201 | cmd.Parameters.AddWithValue("?asset_flags", (int)asset.Flags); |
203 | cmd.Parameters.AddWithValue("?data", asset.Data); | 202 | cmd.Parameters.AddWithValue("?data", asset.Data); |
204 | cmd.ExecuteNonQuery(); | 203 | cmd.ExecuteNonQuery(); |
204 | dbcon.Close(); | ||
205 | return true; | 205 | return true; |
206 | } | 206 | } |
207 | catch (Exception e) | 207 | catch (Exception e) |
208 | { | 208 | { |
209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", | 209 | m_log.ErrorFormat("[ASSET DB]: MySQL failure creating asset {0} with name \"{1}\". Error: {2}", |
210 | asset.FullID, asset.Name, e.Message); | 210 | asset.FullID, asset.Name, e.Message); |
211 | dbcon.Close(); | ||
211 | return false; | 212 | return false; |
212 | } | 213 | } |
213 | } | 214 | } |
214 | dbcon.Close(); | ||
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||