aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Data/MSSQL/MSSQLAssetData.cs27
-rw-r--r--OpenSim/Data/MSSQL/MSSQLInventoryData.cs15
2 files changed, 36 insertions, 6 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLAssetData.cs b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
index ba2b816..1e09c57 100644
--- a/OpenSim/Data/MSSQL/MSSQLAssetData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLAssetData.cs
@@ -60,7 +60,7 @@ namespace OpenSim.Data.MSSQL
60 // [Obsolete("Cannot be default-initialized!")] 60 // [Obsolete("Cannot be default-initialized!")]
61 override public void Initialise() 61 override public void Initialise()
62 { 62 {
63 m_log.Info("[MSSQLUserData]: " + Name + " cannot be default-initialized!"); 63 m_log.Info("[MSSQLAssetData]: " + Name + " cannot be default-initialized!");
64 throw new PluginNotInitialisedException(Name); 64 throw new PluginNotInitialisedException(Name);
65 } 65 }
66 66
@@ -165,12 +165,24 @@ namespace OpenSim.Data.MSSQL
165 VALUES 165 VALUES
166 (@id, @name, @description, @assetType, @local, 166 (@id, @name, @description, @assetType, @local,
167 @temporary, @create_time, @access_time, @data)"; 167 @temporary, @create_time, @access_time, @data)";
168 string assetName = asset.Name;
169 if (asset.Name.Length > 64)
170 {
171 assetName = asset.Name.Substring(0, 64);
172 m_log.Warn("[ASSET DB]: Name field truncated from " + asset.Name.Length.ToString() + " to " + assetName.Length.ToString() + " characters");
173 }
174 string assetDescription = asset.Description;
175 if (asset.Description.Length > 64)
176 {
177 assetDescription = asset.Description.Substring(0, 64);
178 m_log.Warn("[ASSET DB]: Description field truncated from " + asset.Description.Length.ToString() + " to " + assetDescription.Length.ToString() + " characters");
179 }
168 using (AutoClosingSqlCommand command = m_database.Query(sql)) 180 using (AutoClosingSqlCommand command = m_database.Query(sql))
169 { 181 {
170 int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000); 182 int now = (int)((System.DateTime.Now.Ticks - m_ticksToEpoch) / 10000000);
171 command.Parameters.Add(m_database.CreateParameter("id", asset.FullID)); 183 command.Parameters.Add(m_database.CreateParameter("id", asset.FullID));
172 command.Parameters.Add(m_database.CreateParameter("name", asset.Name)); 184 command.Parameters.Add(m_database.CreateParameter("name", assetName));
173 command.Parameters.Add(m_database.CreateParameter("description", asset.Description)); 185 command.Parameters.Add(m_database.CreateParameter("description", assetDescription));
174 command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type)); 186 command.Parameters.Add(m_database.CreateParameter("assetType", asset.Type));
175 command.Parameters.Add(m_database.CreateParameter("local", asset.Local)); 187 command.Parameters.Add(m_database.CreateParameter("local", asset.Local));
176 command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary)); 188 command.Parameters.Add(m_database.CreateParameter("temporary", asset.Temporary));
@@ -178,7 +190,14 @@ namespace OpenSim.Data.MSSQL
178 command.Parameters.Add(m_database.CreateParameter("create_time", now)); 190 command.Parameters.Add(m_database.CreateParameter("create_time", now));
179 command.Parameters.Add(m_database.CreateParameter("data", asset.Data)); 191 command.Parameters.Add(m_database.CreateParameter("data", asset.Data));
180 192
181 command.ExecuteNonQuery(); 193 try
194 {
195 command.ExecuteNonQuery();
196 }
197 catch(Exception e)
198 {
199 m_log.Error("[ASSET DB]: Error inserting item :" + e.Message);
200 }
182 } 201 }
183 } 202 }
184 203
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
index 8dbee3e..eb90192 100644
--- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
+++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs
@@ -412,7 +412,18 @@ namespace OpenSim.Data.MSSQL
412 @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID, 412 @inventoryNextPermissions, @inventoryCurrentPermissions, @invType, @creatorID,
413 @inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType, 413 @inventoryBasePermissions, @inventoryEveryOnePermissions, @inventoryGroupPermissions, @salePrice, @saleType,
414 @creationDate, @groupID, @groupOwned, @flags)"; 414 @creationDate, @groupID, @groupOwned, @flags)";
415 415 string itemName = item.Name;
416 if (item.Name.Length > 64)
417 {
418 itemName = item.Name.Substring(0, 64);
419 m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters");
420 }
421 string itemDesc = item.Description;
422 if (item.Description.Length > 128)
423 {
424 itemDesc = item.Description.Substring(0, 128);
425 m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters");
426 }
416 using (AutoClosingSqlCommand command = database.Query(sql)) 427 using (AutoClosingSqlCommand command = database.Query(sql))
417 { 428 {
418 command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); 429 command.Parameters.Add(database.CreateParameter("inventoryID", item.ID));
@@ -420,7 +431,7 @@ namespace OpenSim.Data.MSSQL
420 command.Parameters.Add(database.CreateParameter("assetType", item.AssetType)); 431 command.Parameters.Add(database.CreateParameter("assetType", item.AssetType));
421 command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder)); 432 command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder));
422 command.Parameters.Add(database.CreateParameter("avatarID", item.Owner)); 433 command.Parameters.Add(database.CreateParameter("avatarID", item.Owner));
423 command.Parameters.Add(database.CreateParameter("inventoryName", item.Name)); 434 command.Parameters.Add(database.CreateParameter("inventoryName", itemName));
424 command.Parameters.Add(database.CreateParameter("inventoryDescription", item.Description)); 435 command.Parameters.Add(database.CreateParameter("inventoryDescription", item.Description));
425 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); 436 command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
426 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); 437 command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));