diff options
author | Justin Clark-Casey (justincc) | 2013-02-27 21:41:21 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2013-02-27 21:41:21 +0000 |
commit | 9b045e72b6ea82fe201b45fd870b6b50c9b9e4d0 (patch) | |
tree | 87a93fe97324d8bf49d7d378bb7044c7b1ec6a99 /OpenSim/Data/SQLite | |
parent | Add more information to warnings logged when asset names and descriptions hav... (diff) | |
download | opensim-SC_OLD-9b045e72b6ea82fe201b45fd870b6b50c9b9e4d0.zip opensim-SC_OLD-9b045e72b6ea82fe201b45fd870b6b50c9b9e4d0.tar.gz opensim-SC_OLD-9b045e72b6ea82fe201b45fd870b6b50c9b9e4d0.tar.bz2 opensim-SC_OLD-9b045e72b6ea82fe201b45fd870b6b50c9b9e4d0.tar.xz |
Add asset name and description truncation warnings to SQLite database plugin for consistency.
Diffstat (limited to 'OpenSim/Data/SQLite')
-rw-r--r-- | OpenSim/Data/SQLite/SQLiteAssetData.cs | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index 61e7aaf..c32982e 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs | |||
@@ -46,7 +46,7 @@ namespace OpenSim.Data.SQLite | |||
46 | /// </summary> | 46 | /// </summary> |
47 | public class SQLiteAssetData : AssetDataBase | 47 | public class SQLiteAssetData : AssetDataBase |
48 | { | 48 | { |
49 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 49 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
50 | 50 | ||
51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; | 51 | private const string SelectAssetSQL = "select * from assets where UUID=:UUID"; |
52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; | 52 | private const string SelectAssetMetadataSQL = "select Name, Description, Type, Temporary, asset_flags, UUID, CreatorID from assets limit :start, :count"; |
@@ -133,6 +133,24 @@ namespace OpenSim.Data.SQLite | |||
133 | /// <param name="asset">Asset Base</param> | 133 | /// <param name="asset">Asset Base</param> |
134 | override public void StoreAsset(AssetBase asset) | 134 | override public void StoreAsset(AssetBase asset) |
135 | { | 135 | { |
136 | string assetName = asset.Name; | ||
137 | if (asset.Name.Length > 64) | ||
138 | { | ||
139 | assetName = asset.Name.Substring(0, 64); | ||
140 | m_log.WarnFormat( | ||
141 | "[ASSET DB]: Name '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
142 | asset.Name, asset.ID, asset.Name.Length, assetName.Length); | ||
143 | } | ||
144 | |||
145 | string assetDescription = asset.Description; | ||
146 | if (asset.Description.Length > 64) | ||
147 | { | ||
148 | assetDescription = asset.Description.Substring(0, 64); | ||
149 | m_log.WarnFormat( | ||
150 | "[ASSET DB]: Description '{0}' for asset {1} truncated from {2} to {3} characters on add", | ||
151 | asset.Description, asset.ID, asset.Description.Length, assetDescription.Length); | ||
152 | } | ||
153 | |||
136 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); | 154 | //m_log.Info("[ASSET DB]: Creating Asset " + asset.FullID.ToString()); |
137 | if (ExistsAsset(asset.FullID)) | 155 | if (ExistsAsset(asset.FullID)) |
138 | { | 156 | { |
@@ -143,8 +161,8 @@ namespace OpenSim.Data.SQLite | |||
143 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) | 161 | using (SqliteCommand cmd = new SqliteCommand(UpdateAssetSQL, m_conn)) |
144 | { | 162 | { |
145 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 163 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
146 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 164 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
147 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 165 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
148 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 166 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
149 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 167 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
150 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 168 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |
@@ -163,8 +181,8 @@ namespace OpenSim.Data.SQLite | |||
163 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) | 181 | using (SqliteCommand cmd = new SqliteCommand(InsertAssetSQL, m_conn)) |
164 | { | 182 | { |
165 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); | 183 | cmd.Parameters.Add(new SqliteParameter(":UUID", asset.FullID.ToString())); |
166 | cmd.Parameters.Add(new SqliteParameter(":Name", asset.Name)); | 184 | cmd.Parameters.Add(new SqliteParameter(":Name", assetName)); |
167 | cmd.Parameters.Add(new SqliteParameter(":Description", asset.Description)); | 185 | cmd.Parameters.Add(new SqliteParameter(":Description", assetDescription)); |
168 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); | 186 | cmd.Parameters.Add(new SqliteParameter(":Type", asset.Type)); |
169 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); | 187 | cmd.Parameters.Add(new SqliteParameter(":Local", asset.Local)); |
170 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); | 188 | cmd.Parameters.Add(new SqliteParameter(":Temporary", asset.Temporary)); |