From: <no...@so...> - 2001-12-04 19:16:24
|
Bugs item #489023, was opened at 2001-12-04 11:16 You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=109028&aid=489023&group_id=9028 Category: Core Engine Group: None Status: Open Resolution: None Priority: 5 Submitted By: Andrei Kireev (andreik) Assigned to: Nobody/Anonymous (nobody) Summary: incorrect work of equation operator Initial Comment: There is a bug in FB RC1 build 608 with equation operator and varchar/char fields. Below is a step-by-step example which shows incorrect behavior. 1. create table s (f varchar(10)) 2. insert into s values ('aaa') take care, that there are just three charactes no leading or trailing spaces 3. select * from s F ========== aaa Ok! 4. select * from s where f = 'aaa' F ========== aaa All right. 5. select * from s where f = 'aaa ' <-- look, there is a trailing blank Result is incorrect! F ========== aaa field defined as varchar, not char! so, 'aaa' <> 'aaa ' at least, in Delphi, C++ or VB that is true. 6. insert into s values ('aaa ') 7. select * from s F ========== aaa aaa Ok 8. select * from s where f = 'aaa' The result is incorrect again: F ========== aaa aaa 9. select * from s where f = 'aaa ' F ========== aaa aaa The result is incorrect. And look, cpecified string exceeds length of field varchar(10). 10. LIKE without charactes % or _ must behave the same way as quation operator =, isn't it? so try, select * from s where f like 'aaa' wow! result is CORRECT this time: F ========== aaa 11. select * from s where f like 'aaa ' again correct: F ========== aaa 12.select * from s where f like 'aaa%' F ========== aaa aaa it's Ok 13.select * from s where f containing 'aaa' F ========== aaa aaa it's Ok 14.select * from s where f containing 'aaa ' F ========== aaa Ok! so, the equation operator with strings gets wrong results. It strips trailing spaces from field values as well as from specified string to match. In those cases LIKE operator or CONTAINING results in correct values. Result of LIKE comparison != result of = operator if field contains trailing spaces and LIKE string to match does not contain '%' or '_' ---------------------------------------------------------------------- You can respond by visiting: http://sourceforge.net/tracker/?func=detail&atid=109028&aid=489023&group_id=9028 |