Subject problem with php trim of rdb$relation_name field
Author p51b.mustang
Hi,

Using Zend & PHP I perform a select of roles using rdb$relation_name field, something like:

$sql = "select cast(r.rdb\$relation_name as varchar(31)) as \"ROLE\"
from rdb\$user_privileges r
where (upper(r.rdb\$user) = upper('".$logonid."'))
and r.rdb\$privilege = 'M' /* member priv */
and r.rdb\$user_type = 8 /* user records */
and r.rdb\$object_type = 13 /* for roles only */
order by r.rdb\$relation_name ";

$stmt = $this->db->query($sql);
$row = $stmt->fetchAll();

Which does provide a list of roles for a user. However, the rdb$relation_name is padded to 31 bytes with spaces. So I perform the following to trim the role down:

foreach ($row as $rec){
foreach($rec as $key => $value) {
$rec[$key] = trim($value);

The problem is that the role field does not get trimmed.
Am I doing something wrong, or has someone else hit this problem?
Regards
David