Grids mistakenly display OCTETS as null-terminated strings

All topics regarding IBExpert IDE

Grids mistakenly display OCTETS as null-terminated strings

Postby Paulo França Lacerda » Thu Mar 04, 2010 3:45 am

When a table column is defined as "char(n) character set octets" - for UUID, the grids (for queries and database values) are wrongly displaying the values as null-terminated string, and this (visually) truncates the value up to zero.

For instance, let's take this scenario for using the new char_to_uuid() internal function (in Firebird 2.5 RC2):

Code: Select all
select
   char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D')
from
   rdb$database;

The query above will display an empty result, although the conversion is correctly done by char_to_uuid().

As the second pair in the literal passed to char_to_uuid() is "00", it becomes the first octet after transformed. As an octet, the result of the function creates the correct value, but when viewed as null-terminated string, it shows an empty value.

Even if we type cast the result of the query to octets (expliciting the result type of the function), we get an empty string as result:

Code: Select all
select
   cast ( char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D') as char(16) character set octets )
from
   rdb$database;

To confirm char_to_uuid() is working fine, just runs the following query:

Code: Select all
select
   uuid_to_char (char_to_uuid ('25002304-1702-95B4-7449-F94FED240D9D'))
from
   rdb$database;

The query above converts the hyphenized/string version of the UUID to Octets, then converts it back to string, proving the function is working as expected.

Initially, I thougt it was a bug in Firebird 2.5 RC2, so I ended up adding the issue as bug to the bug tracker: http://tracker.firebirdsql.org/browse/CORE-2905

However, a team guy warned be about the zero-pair issue.

IBExpert's grids should take the character set into account and display such values as hexa pairs, instead of assuming the "char(16)" in the row definition as being displayable as string.

Thanks in advance,
Paulo França
Paulo França Lacerda
 
Posts: 7
Joined: Mon Mar 01, 2010 11:01 pm

Re: Grids mistakenly display OCTETS as null-terminated strings

Postby AVX » Tue Mar 16, 2010 2:46 pm

We will think about this.
AVX
 
Posts: 81
Joined: Sat Jun 07, 2008 4:55 am


Return to IBExpert IDE

Who is online

Users browsing this forum: No registered users and 1 guest