[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 305
  • Last Modified:

Help : Delphi 3.0 Floating Point Types

My Question is as follows......

 I am currently writing a program that will include a Database Structure Viewer as per Database DeskTop. Now I am
able to get all the fields pertaining to a particular table and also their sizes. ALL except the floating point numbers which
do not return anything in their size property. I need some way of reading their size ie their width and number of decimal places. I am sure this will be easy but I have just hit a brick wall and cannot seem to come up with a solution. This is to be used as a utility in a much larger program if the users happen to have database problems down the track.  Anyway
if you can help then you will get the points.

Thanks in Advance,
WESTY
0
westy100697
Asked:
westy100697
  • 5
  • 4
  • 2
  • +1
1 Solution
 
JimBob091197Commented:
Hi

My help file for TField's Size property says "The interpretation of Size depends on the data type." and in particular for fields of type tfFloat "Size is not used; its value is always 0."

Regards,
JB
0
 
JimBob091197Commented:
Hi again

There is also the DataSize property for fields.  Again, the help file has the following to say:
"For float fields, DataSize is always 8. Database tables store float fields as a Double, which is the same as the type used by TFloatField."

Cheers,
JB
0
 
westy100697Author Commented:
JimBob,
            This much I already know. The problem seems to be to try and diplay the tables
Structure information in a stringgrid. I am unable to ascertain for example if a TFloatfield that I have set through the Database Desktop has for example the following settings...

Field Name     Type      Size      Decimals

MYFIELD         F            6              3

This is the sort of info I require as if I do updates of the Tables for clients and I forget to send them the updated tables then I want to be able to get them to change the structure
while in the program. Otherwise I will get messages like "field 'MYFIELD' not of expected type"  . This will occur if I have for example changed the size of the field or the number of decimal places and this is what I want to be able to cover for. I hope this might shed some
more light on what I am trying to do.

PS.  As you stated earlier DataSize always displays 8 and so is useless to me as I need to be able to pin point the problem field.

Regards,

WESTY
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
JimBob091197Commented:
Hi

I don't think you can get any more info for float fields.
TFloatField.Size = 0 (Always!!)
TFloatField.DataSize = 8

However, there is also a numeric field type called TBCDField.
TBCDField.Size = Number of digits AFTER decimal point.
TBCDField.DataSize = 34

In your example you say MyField is of type F.  Type F is type "Formatted Memo."  What version of Delphi & Database Desktop are you using?  I'm using DB Desktop 7 with Paradox 7, and Delphi 3.

JB
0
 
westy100697Author Commented:
JimBob,
            I am using dBase tables and so F is a Float Field not a Memo. But yeh I thought as much with regards to a Float Field which is why I am impressed with DB Desktop as it is able to display the field structures with the correct field size and decimal places. I would have put money on that there was a work around but it seems I have come up with a blank. I am also using Delphi 3 and DB Desktop 7 . I have exhausted the help but there is nothing really specific to my problem. The same in Books I have purchased relating to Delphi 3. Surely if DB Desktop can do it then it must be able to be done. Very frustrating.
Anyway I hope someone may know the answer to the problem and so I am going to bump
the points up a little more as it seems to be a goodun.

Cheers
WESTY
0
 
JimBob091197Commented:
Hi Westy

The DB Desktop must be using the BDE API.  This file is bde.int, and can be found in Delphi\Doc directory.

DB Desktop probably uses the call DbiGetFieldDescs, which returns a FLDDesc structure.  I think your info may be in the iUnits1 or iUnits2 part of the FLDDesc.

I will play around with DbiGetFieldDescs, and if I come up with anything I will let you know.

Cheers,
JB
0
 
westy100697Author Commented:
JimBob,
            Yeh I was going to say before that I have already had a look in the old dbiprocs.int
file from delphi 1 to see if that could shed any light on it but drew a blank also. But your suggestion about the bde.int file sounds very interesting and I will look at it also to see if I can resolve anything. Looks like I may be closer after all.

Thanks.
WESTY
0
 
ronit051397Commented:
Yes. JB is right, the iUnits2 showsthe number of digits after the point. I allready have  a source code. If JB won't find the solution for you, I'll post it later.

Ronit
0
 
westy100697Author Commented:
Ronit,
         Yeh no worries, I have had a decent look at the bde.int file and have been able to implement the code in my app. but it will just take a little mucking around to get it working
error free. But if you already have source code written to do a similar thing post it if JimBob hasn't been able to find a solution. Will be happy to award points to both.

WESTY
0
 
ronit051397Commented:
OK, let me know when you want it to be posted.
0
 
boabyteCommented:
Hey this is WESTY here. I have had a bit of trouble trying to LOG ON with westy so I have set up another registered name boabyte. Now with regards to the problems I have listed above I have solved it thanks to JimBob and pointing me towards the bde.int file. Thanks
JimBob I have it working well now in my APP and have only got to write changes to a table now but the hard part is done. If you lock the question (JimBob) I will award you the points. Thanks very much.

Regards
WESTY
0
 
JimBob091197Commented:
Hi Westy/boabyte

Glad you got it working.  Nothing like a little perseverance!!

Cheers,
JB
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 5
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now