OT: Firebird 4 and Lazarus

184 views
Skip to first unread message

Ismael L. Donis Garcia

unread,
Jul 7, 2021, 11:25:03 AM7/7/21
to firebird...@googlegroups.com
I have an application developed in lasarus with Firebird 2.5.9 which works perfect.
And I've been trying to migrate it to Firebird 4, but I'm having trouble getting the data.
For example:
When I ask the following question it always returns 0.
if (dm.rssc3.FieldByName ('balance'). AsFloat <> 0) then netreg ();
even though the record is not 0.
If I use:
DataTypeCompatibility = 3.0
The system does work correctly, but I don't want to modify the firebird configuration so that the system works correctly.
What other action can I do to get it to return the correct value?
 
Will this problem have to do with a DLL version?
 
I use:
Windows 7 32 bit
Lazarus-2.0.12 with fpc-3.2.0
 
 
Best Regards

Mark Rotteveel

unread,
Jul 7, 2021, 12:00:35 PM7/7/21
to firebird...@googlegroups.com
On 2021-07-07 17:25, Ismael L. Donis Garcia wrote:
> I have an application developed in lasarus with Firebird 2.5.9 which
> works perfect.
> And I've been trying to migrate it to Firebird 4, but I'm having
> trouble getting the data.
> For example:
> When I ask the following question it always returns 0.
> if (dm.rssc3.FieldByName ('balance'). AsFloat <> 0) then netreg ();
> even though the record is not 0.
> If I use:
> DataTypeCompatibility = 3.0
> The system does work correctly, but I don't want to modify the
> firebird configuration so that the system works correctly.
> What other action can I do to get it to return the correct value?
>
> Will this problem have to do with a DLL version?

This probably has to do with whatever data type balance is and how it's
produced (i.e. what the underlying query is).

I'm going to guess it is a SUM of some NUMERIC or DECIMAL column, so the
resulting type is a NUMERIC/DECIMAL with precision 38 (introduced in
Firebird 4). Probably whatever library you're using doesn't support the
INT128-backed NUMERIC/DECIMAL types with precision between 19 and 38.

Mark

Ismael L. Donis Garcia

unread,
Jul 7, 2021, 3:43:25 PM7/7/21
to firebird...@googlegroups.com
Thanks Mark

If it is precisely the sum of a decimal field, it seems that the Lazarus
library is not yet compatible with Firebird 4, so I have no choice but to
use
DataTypeCompatibility = 3.0
Until Lazarus fixes this problem

Best Regards
--
Ismael
Devuan User: http://distrowatch.com/table.php?distribution=devuan
Web Site: http://www.sisconge.byethost15.com/
https://gitlab.uic.cu/ismael.donis/sistema-de-contabilidad-general/
> --
> You received this message because you are subscribed to the Google Groups
> "firebird-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to firebird-suppo...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/firebird-support/53117dfb52ec1b7e239ffbeb9939d83d%40lawinegevaar.nl.
>


Terschlüsen, Ralf

unread,
Jul 8, 2021, 7:13:28 AM7/8/21
to firebird...@googlegroups.com
Change the query.
For example cast(sum(x) as float) or cast(sum(x) as numeric(n.n) )

Best regards
Ralf

-----Ursprüngliche Nachricht-----
Von: firebird...@googlegroups.com [mailto:firebird...@googlegroups.com] Im Auftrag von Ismael L. Donis Garcia
Gesendet: Mittwoch, 7. Juli 2021 21:43
An: firebird...@googlegroups.com
Betreff: Re: [firebird-support] OT: Firebird 4 and Lazarus
To view this discussion on the web, visit https://groups.google.com/d/msgid/firebird-support/B66FE59C906B4AE0B5D8C0BFEFB830AA%40natio.co.cu.

Virgo Pärna

unread,
Jul 8, 2021, 7:22:20 AM7/8/21
to firebird...@googlegroups.com
On 2021-07-08 08:54, Terschlüsen, Ralf wrote:
> Change the query.
> For example cast(sum(x) as float) or cast(sum(x) as numeric(n.n) )
>

Or make sure, that
SET BIND OF NUMERIC(38) TO LEGACY
is executed after connecting database.
And maybe also
SET BIND OF DECFLOAT TO LEGACY
if database server is Firebird 4.0 or newer.


--
Virgo Pärna
Gaiasoft OÜ
vi...@gaiasoft.ee

Ismael L. Donis Garcia

unread,
Jul 8, 2021, 11:02:33 AM7/8/21
to firebird...@googlegroups.com
Thank you very much Ralf and Virgo

I worked it out with:

CREATE TRIGGER SET_BIND_AC ACTIVE
ON CONNECT POSITION 0
AS
BEGIN
set bind of int128 to legacy;
set bind of decfloat to legacy;
END
--
You received this message because you are subscribed to the Google Groups
"firebird-support" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to firebird-suppo...@googlegroups.com.
To view this discussion on the web, visit
https://groups.google.com/d/msgid/firebird-support/eb0284ee-094c-52b1-4c45-38614042f8ba%40gaiasoft.ee.


Reply all
Reply to author
Forward
0 new messages