On Fri, 7 Jun 2013 10:56:43 -0400, "Leyne, Sean"
<[email protected]> wrote:
>> similar to does not match x'##'-codes
>> -------------------------------------
>> 
>>                  Key: CORE-4114
>>                  URL: http://tracker.firebirdsql.org/browse/CORE-4114
>>              Project: Firebird Core
>>           Issue Type: Bug
>>           Components: Engine
>>     Affects Versions: 2.5.2
>>          Environment: Win7/64
>>             Reporter: Thomas Beckmann
>> 
>> 
>> As this example points out, x'##'-codes are not properly matched by
>> similar
>> to:
>> 
>> select
>>   iif(' ' similar to '[[:WHITESPACE:]]', 'T', 'F'),
>>   iif(x'20' similar to '[[:WHITESPACE:]]', 'T', 'F'),
>>   iif(x'20' similar to '%', 'T', 'F')
>> from RDB$DATABASE
>> 
>> returns 'T', 'F', 'F'
> 
> In a comment, Vlad Khorsun wrote:
> 
>         Thomas, 
> 
>         x-prefixed literals have charset OCTETS and it could be a reason
>         for such issues.
> 
>         Try to use charset introducer before literal, for example:  
>         _win1252 x'20'
> 
> 
> I am naïve when it comes to charset issues, as an arrogant North
American
> dealing with charset is a rarity (the world only writes in English,
no?),
> but I find the idea that all x-prefixed literals should be treated as
> OCTETS to be problematic. 

I am not 100% sure, but I assume the SQL specification says that X'...' is
of type BINARY (or VARBINARY), and the closest type that Firebird has is
CHAR CHARACTER SET OCTETS (BTW: Isn't it time to introduce BINARY and
VARBINARY as a type on its own)
 
> I would have thought that the engine would 'auto-translate' the values
> based on the context.

In this context there is no way for the engine to decide what other
character set would be the right one... so coercion using cast or
introducer is required. And in OCTETS I assume there is no whitespace, or
it is (only) 0x00.

Mark

------------------------------------------------------------------------------
How ServiceNow helps IT people transform IT departments:
1. A cloud service to automate IT design, transition and operations
2. Dashboards that offer high-level views of enterprise services
3. A single system of record for all IT processes
http://p.sf.net/sfu/servicenow-d2d-j
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to