Recent

Author Topic: FPC missing Double Precision in DB field type?  (Read 2688 times)

Fantablup

  • Full Member
  • ***
  • Posts: 171
FPC missing Double Precision in DB field type?
« on: June 10, 2021, 09:16:39 pm »
I just searched all day almost on it. And maybe it can be some help to someone.

I wonder if this is a bug in FPC.
It was some notice on the same thing with delphi some years ago. They added the Double Precision in the 2009 version i think i remember.

Zeos components seems to use the default field types from FPC, when it's used the normal simple way.

I encountered a problem when i was going to get info on field types from a TZQuery.
I have Double Precision field types in the table, but it only show it as a float type.

I checked in Lazarus source\packages\fcl-db\src\
It does not have any Double Precision type. It only have the ftFloat type. And it is this type it gives when getting field type from the table.

So, i wondered what i could do.

I looked at ZDbcIntfs for Zeos, and see it has Double Precision.
So, i could not use TZQuery with the Open commend, and had to get the resultset with DbcStatement instead.

I then had to use stResult.GetMetadata.GetColumnType(i) for getting the correct field type.

I now get all the correct field types.
But this took a long time to figure out.

BTW
I wish i could buy a beer to every one that is working on Lazarus and FPC. You just do one amazing job.

tonyw

  • Sr. Member
  • ****
  • Posts: 321
    • MWA Software
Re: FPC missing Double Precision in DB field type?
« Reply #1 on: June 11, 2021, 01:17:06 pm »
If you look in the DB unit, a TFloatField returns its value using type "Double".

There is also the TBCDField which uses the "currency" type and a separate "precision".

TFMTBCDField is used to hold very large numbers using the TBCD type.

I can't speak for Zero, but IBX uses all the above types and chooses the most appropriate for the field. TFMTBCDField is used to support the new INT128 and DECFLOAT types in Firebird 4.

Fantablup

  • Full Member
  • ***
  • Posts: 171
Re: FPC missing Double Precision in DB field type?
« Reply #2 on: June 11, 2021, 02:00:28 pm »
I know float is used with double.
The problem is getting the correct field description for display.
This is the whole problem that it was to me.

 

TinyPortal © 2005-2018