* Extend inventory name and description length checks to UpdateItem for mssql

trunk
Justin Clarke Casey 2009-07-24 19:41:53 +00:00
parent de893a4a10
commit 92047114ac
1 changed files with 20 additions and 2 deletions

View File

@ -414,17 +414,20 @@ namespace OpenSim.Data.MSSQL
@creationDate, @groupID, @groupOwned, @flags)";
string itemName = item.Name;
if (item.Name.Length > 64)
{
itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters");
}
string itemDesc = item.Description;
if (item.Description.Length > 128)
{
itemDesc = item.Description.Substring(0, 128);
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters");
}
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("inventoryID", item.ID));
@ -499,6 +502,21 @@ namespace OpenSim.Data.MSSQL
groupOwned = @groupOwned,
flags = @flags
WHERE inventoryID = @keyInventoryID";
string itemName = item.Name;
if (item.Name.Length > 64)
{
itemName = item.Name.Substring(0, 64);
m_log.Warn("[INVENTORY DB]: Name field truncated from " + item.Name.Length.ToString() + " to " + itemName.Length.ToString() + " characters on update");
}
string itemDesc = item.Description;
if (item.Description.Length > 128)
{
itemDesc = item.Description.Substring(0, 128);
m_log.Warn("[INVENTORY DB]: Description field truncated from " + item.Description.Length.ToString() + " to " + itemDesc.Length.ToString() + " characters on update");
}
using (AutoClosingSqlCommand command = database.Query(sql))
{
command.Parameters.Add(database.CreateParameter("inventoryID", item.ID));
@ -506,8 +524,8 @@ namespace OpenSim.Data.MSSQL
command.Parameters.Add(database.CreateParameter("assetType", item.AssetType));
command.Parameters.Add(database.CreateParameter("parentFolderID", item.Folder));
command.Parameters.Add(database.CreateParameter("avatarID", item.Owner));
command.Parameters.Add(database.CreateParameter("inventoryName", item.Name));
command.Parameters.Add(database.CreateParameter("inventoryDescription", item.Description));
command.Parameters.Add(database.CreateParameter("inventoryName", itemName));
command.Parameters.Add(database.CreateParameter("inventoryDescription", itemDesc));
command.Parameters.Add(database.CreateParameter("inventoryNextPermissions", item.NextPermissions));
command.Parameters.Add(database.CreateParameter("inventoryCurrentPermissions", item.CurrentPermissions));
command.Parameters.Add(database.CreateParameter("invType", item.InvType));