Subject Re: [Firebird-Architect] IN LIST
Author Adriano dos Santos Fernandes
Doug Chamberlin wrote:
> At 09:32 AM 12/3/2006, Adriano dos Santos Fernandes wrote:
>
>> It will be evaluated as IN and BETWEEN.
>> Any datatype could be used inside the string: dates, integers,
>> strings... as long as a correct escape character is used.
>>
>
> I think you missed by point completely. Let me give you another specific
> example...
>
> How would the parser translate this:
> IN LIST ('Red','Green','Purple'-'Black','Yellow')
>
> The parser CANNOT just evaluate this "as IN and BETWEEN" because there is
> no known sequence of colors for it to translate the shorthand
> 'Purple'-'Black' into!
>
This is not a real example, as colors is not something you can have ranges.

> Try another example:
>
> I may decide to shorten this list
> IN ('01-01-2006','02-27-2006','02-28-2006','03-01-2006','05-15-2006')
> into
> IN LIST ('01-01-2006','02-27-2006'-'03-01-2006','05-15-2006')
>
That shows that '-' is not a good separator, so as suggested, and inside
*one* string:
X IN LIST ('01-01-2006, 02-27-2006..03-01-2006, 05-15-2006'

> How will the parser translate it back into the first list? How will it know
> I'm listing date values and that there is exactly one value that I want
> between 02-27-2006 and 03-01-2006? To it these are just strings and they
> have no order!
>
The parser knows nothing, it only pass the strings to others layers.

Then, each item are separated and evaluated as:
X IN ('01-01-2006', '05-15-2006') OR (X BETWEEN '02-27-2006' AND
'03-01-2006')

The engine already knows how to evaluate this. :-)


Adriano