Subject | Watchout for long aliases... |
---|---|
Author | Nigel Weeks |
Post date | 2004-11-05T05:40:30Z |
Consider the following scenario, run directly in isql:
select 'hello' AS
THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE from
rdb$database;
returns the following:
THIS_IS_A_VERY_LONG_FIELD_NAME_
===============================
hello
While we all know there's a 32 character limit on field names, it silently
applies to aliases as well...
I got trapped when using PHP:
$sql = "select 'hello' AS
THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE from
rdb\$database";
$rec = ibase_query($sql);
$obj = ibase_Fetch_object($rec);
echo $obj->THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE;
...this returned nothing, no error messages, nothin, but...:
echo $obj->THIS_IS_A_VERY_LONG_FIELD_NAME_
...works just fine.
Just thought it's worth letting people know the fix...
select 'hello' AS
THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE from
rdb$database;
returns the following:
THIS_IS_A_VERY_LONG_FIELD_NAME_
===============================
hello
While we all know there's a 32 character limit on field names, it silently
applies to aliases as well...
I got trapped when using PHP:
$sql = "select 'hello' AS
THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE from
rdb\$database";
$rec = ibase_query($sql);
$obj = ibase_Fetch_object($rec);
echo $obj->THIS_IS_A_VERY_LONG_FIELD_NAME_FAR_TOO_LONG_FOR_PRACTICAL_USE;
...this returned nothing, no error messages, nothin, but...:
echo $obj->THIS_IS_A_VERY_LONG_FIELD_NAME_
...works just fine.
Just thought it's worth letting people know the fix...