Subject | Re: [Firebird-Architect] IN LIST |
---|---|
Author | Adriano dos Santos Fernandes |
Post date | 2006-12-03T16:42:45Z |
Doug Chamberlin wrote:
*one* string:
X IN LIST ('01-01-2006, 02-27-2006..03-01-2006, 05-15-2006'
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
> At 09:32 AM 12/3/2006, Adriano dos Santos Fernandes wrote:This is not a real example, as colors is not something you can have ranges.
>
>> 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!
>
> Try another example:That shows that '-' is not a good separator, so as suggested, and inside
>
> 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')
>
*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 knowThe parser knows nothing, it only pass the strings to others layers.
> 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!
>
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