diff options
author | Justin Clarke Casey | 2009-07-24 19:41:53 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-07-24 19:41:53 +0000 |
commit | 92047114ac004cfed16eb15daa257cf84fe7ba36 (patch) | |
tree | 4c323862c0c2e07505143d0540e26121e67fe5c9 | |
parent | * Correct minor bug where item description bounded string was not actually be... (diff) | |
download | opensim-SC-92047114ac004cfed16eb15daa257cf84fe7ba36.zip opensim-SC-92047114ac004cfed16eb15daa257cf84fe7ba36.tar.gz opensim-SC-92047114ac004cfed16eb15daa257cf84fe7ba36.tar.bz2 opensim-SC-92047114ac004cfed16eb15daa257cf84fe7ba36.tar.xz |
* Extend inventory name and description length checks to UpdateItem for mssql
-rw-r--r-- | OpenSim/Data/MSSQL/MSSQLInventoryData.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs index f68253a..d68ac39 100644 --- a/OpenSim/Data/MSSQL/MSSQLInventoryData.cs +++ b/OpenSim/Data/MSSQL/MSSQLInventoryData.cs | |||
@@ -414,17 +414,20 @@ namespace OpenSim.Data.MSSQL | |||
414 | @creationDate, @groupID, @groupOwned, @flags)"; | 414 | @creationDate, @groupID, @groupOwned, @flags)"; |
415 | 415 | ||
416 | string itemName = item.Name; | 416 | string itemName = item.Name; |
417 | |||
417 | if (item.Name.Length > 64) | 418 | if (item.Name.Length > 64) |
418 | { | 419 | { |
419 | itemName = item.Name.Substring(0, 64); | 420 | itemName = item.Name.Substring(0, 64); |
420 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters"); | 421 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters"); |
421 | } | 422 | } |
423 | |||
422 | string itemDesc = item.Description; | 424 | string itemDesc = item.Description; |
423 | if (item.Description.Length > 128) | 425 | if (item.Description.Length > 128) |
424 | { | 426 | { |
425 | itemDesc = item.Description.Substring(0, 128); | 427 | itemDesc = item.Description.Substring(0, 128); |
426 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters"); | 428 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters"); |
427 | } | 429 | } |
430 | |||
428 | using (AutoClosingSqlCommand command = database.Query(sql)) | 431 | using (AutoClosingSqlCommand command = database.Query(sql)) |
429 | { | 432 | { |
430 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); | 433 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); |
@@ -499,6 +502,21 @@ namespace OpenSim.Data.MSSQL | |||
499 | groupOwned = @groupOwned, | 502 | groupOwned = @groupOwned, |
500 | flags = @flags | 503 | flags = @flags |
501 | WHERE inventoryID = @keyInventoryID"; | 504 | WHERE inventoryID = @keyInventoryID"; |
505 | |||
506 | string itemName = item.Name; | ||
507 | if (item.Name.Length > 64) | ||
508 | { | ||
509 | itemName = item.Name.Substring(0, 64); | ||
510 | m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update"); | ||
511 | } | ||
512 | |||
513 | string itemDesc = item.Description; | ||
514 | if (item.Description.Length > 128) | ||
515 | { | ||
516 | itemDesc = item.Description.Substring(0, 128); | ||
517 | m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters on update"); | ||
518 | } | ||
519 | |||
502 | using (AutoClosingSqlCommand command = database.Query(sql)) | 520 | using (AutoClosingSqlCommand command = database.Query(sql)) |
503 | { | 521 | { |
504 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); | 522 | command.Parameters.Add(database.CreateParameter("inventoryID", item.ID)); |
@@ -506,8 +524,8 @@ namespace OpenSim.Data.MSSQL | |||
506 | command.Parameters.Add(database.CreateParameter("assetType", item.AssetType)); | 524 | command.Parameters.Add(database.CreateParameter("assetType", item.AssetType)); |
507 | command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder)); | 525 | command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder)); |
508 | command.Parameters.Add(database.CreateParameter("avatarID", item.Owner)); | 526 | command.Parameters.Add(database.CreateParameter("avatarID", item.Owner)); |
509 | command.Parameters.Add(database.CreateParameter("inventoryName", item.Name)); | 527 | command.Parameters.Add(database.CreateParameter("inventoryName", itemName)); |
510 | command.Parameters.Add(database.CreateParameter("inventoryDescription", item.Description)); | 528 | command.Parameters.Add(database.CreateParameter("inventoryDescription", itemDesc)); |
511 | command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); | 529 | command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions)); |
512 | command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); | 530 | command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions)); |
513 | command.Parameters.Add(database.CreateParameter("invType", item.InvType)); | 531 | command.Parameters.Add(database.CreateParameter("invType", item.InvType)); |