diff options
author | Justin Clarke Casey | 2009-07-24 19:10:32 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-07-24 19:10:32 +0000 |
commit | a3f4330c8728bf3624f61f831ae8b61358231067 (patch) | |
tree | 84fe3c1ebbf6099587c1915378b0b6a06a9a565c /OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |
parent | * minor ccc (diff) | |
download | opensim-SC_OLD-a3f4330c8728bf3624f61f831ae8b61358231067.zip opensim-SC_OLD-a3f4330c8728bf3624f61f831ae8b61358231067.tar.gz opensim-SC_OLD-a3f4330c8728bf3624f61f831ae8b61358231067.tar.bz2 opensim-SC_OLD-a3f4330c8728bf3624f61f831ae8b61358231067.tar.xz |
* Apply http://opensimulator.org/mantis/view.php?id=3902
* Restrict asset and inventory name descriptions so as not to overflow MSSQL field lengths
* Thanks StrawberryFride
Diffstat (limited to 'OpenSim/Data/MSSQL/MSSQLInventoryData.cs')
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 15 |
1 files changed, 13 insertions, 2 deletions
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)); |