only truncate string if length given and <= 255, to not unnecessary truncate varchar(>255) as PostgreSQL uses text anyway and MySQL truncates itself silently (unless strict mode!)

This commit is contained in:
Ralf Becker 2012-08-13 14:42:55 +00:00
parent 1d743830c9
commit 25ddf016f4

View File

@ -1463,7 +1463,9 @@ class egw_db
{
$value = implode($glue,$value);
}
if (!is_null($length) && strlen($value) > $length)
// only truncate string if length given and <= 255
// to not unnecessary truncate varchar(>255) as PostgreSQL uses text anyway and MySQL truncates itself silently (unless strict mode!)
if (!is_null($length) && $length <= 255 && strlen($value) > $length)
{
$value = substr($value,0,$length);
}