Subject | RE: [IBO] TIBOQuery param AsFloat strange behaviour |
---|---|
Author | Jason Wharton |
Post date | 2018-10-26T20:31:50Z |
Here is the broken code:
function GetVarSame( const v1, v2: variant ): boolean;
begin
Result := VarSameValue( v1, v2 );
if ( not Result ) and
( VarType( v1 ) in [ varDouble, varSingle ] ) then
Result := FloatToStr( v1 ) = FloatToStr( v2 );
end;
function GetVarSame( const v1, v2: variant ): boolean;
begin
Result := VarSameValue( v1, v2 );
if ( not Result ) then
begin
if ( VarType( v1 ) in [ varDouble, varSingle ] ) and
( not VarIsEmpty( v1 )) and
( not VarIsEmpty( v2 )) then
Result := FloatToStr( v1 ) = FloatToStr( v2 );
end;
end;
I apologize for this and hope this helps. For those who use my development SVN repository, this was fixed in revision 2776.
From: IBObjects@yahoogroups.com [mailto:IBObjects@yahoogroups.com]
Sent: Wednesday, May 09, 2018 12:49 PM
To: IBObjects@yahoogroups.com
Subject: Re: [IBO] TIBOQuery param AsFloat strange behaviour
Could anyone please confirm or deny the behaviour described below? I
don't know if it's a bug in IBO 5.9.7 (I've downgraded to 5.9.3 and
everything works fine), or if I messed something up with the
configuration (although I can't imagine what possibly could cause zeros
to be replaced by nulls)?
If it's a bug, it would be worthwhile to warn
the users (setting nulls
in numeric columns instead of zeros can lead to
byzantine bugs on
nullable columns; imagine doing a sum(...) over such
column with a
single null record within a million). But maybe I'm just
overreacting.
Anyway, a three-liner is enough to reproduce this, so please
try it out
and post your conclusions.
Thanks in advance and have a
good one.
Tomasz
On 04.05.2018 o 13:11, Tomasz Tyrakowski
t.tyrakowski@...
[IBObjects] wrote:
> Hi,I've recently upgraded to the current (5.9.7) IBO release and was
>
>
>surprised by a strange TIBOQuery behaviour, which forced me to downgrade
>back to 5.9.3.
> In the latest release, when you do somethinglike:
>query.ParamByName('val').AsFloat := 0.0;
> query.SQL.Text := 'update T set F = :val';
>
> query.ExecSQL;the records get updated to NULL (!!!) instead of 0. Setting any non-zero
>
>
>value works as expected (only 0 results in NULLs). Tested it also with a
>freshly created table (to exclude any triggers / other dbms factors).
> In5.9.3 the same code works well, updates F to 0.
> Delphi 10.2.3.it
>
> Could anyone please confirm experiencing similar behaviour? Or is
> just me? Can you do a quick check with a query like above and seewhat
> happens?customers started calling
> I discovered it the hard way, i.e. scores of
> the help desk complaining about null checkerrors in the app (IBO tried
> to store nulls instead of zeros in non-nullcolumns).
>--
> regards
> Tomasz
>
__--==============================--__
__--== Tomasz Tyrakowski ==--__
__--== SOL-SYSTEM ==--__
__--== http://www.sol-system.pl ==--__
__--==============================--__