Bug #10901
BEGINS trims the rvalue if the lvalue field is first in an index
100%
History
#2 Updated by Constantin Asofiei 8 months ago
- Assignee set to Constantin Asofiei
This test shows that if a field is part of a leading component, then it will trim the rvalue for BEGINS:
def temp-table tt1 field f1 as char field f2 as char index ix1 f1 index ix2 f1 f2 . create tt1. tt1.f1 = "abc d". tt1.f2 = "abc d". release tt1. def var ch as char. ch = "abc d ". message length(ch). find first tt1 where tt1.f1 begins "abc d " no-error. message avail tt1. // yes find first tt1 where tt1.f1 begins ch no-error. message avail tt1. // yes find first tt1 where tt1.f2 begins "abc d " no-error. message avail tt1. // no, not leading find first tt1 where tt1.f2 begins ch no-error. message avail tt1. // no, not leading
In FWD we emit either upper(tt1.f1) like 'ABC D %' in case of literals or toUpperCase(convertToSQLBegins(ch)) in case of an expression.
I can't see how to fix this properly at runtime (as we have different levels of caches either at FQL, SQL, or even FFC results), so is kind of complicated to make sure the argument is trimmed.
I suggest to emit toUpperCase(convertToSQLBegins(rtrim(ch))) for the second case and for the first case automatically rtrim the literal case: upper(tt1.f1) like 'ABC D%'
#3 Updated by Constantin Asofiei 8 months ago
Actually things are a little more complicated: what matters is that the field is part of the 4GL index associated with the query.
#5 Updated by Constantin Asofiei 8 months ago
- Status changed from New to Review
- % Done changed from 0 to 100
- reviewer Alexandru Lungu added
Created 10901a from trunk rev 16292. In rev 16293: If in a BEGINS LVALUE is a field part of the index used for sort, then RVALUE must be right-trimmed.
Alex, please review.
#6 Updated by Constantin Asofiei 6 months ago
- Status changed from Review to Closed
Branch 10901a was merged to trunk rev 16395 and archived.