Solved

Help : Delphi 3.0 Floating Point Types

Posted on 1998-05-18
12
300 Views
Last Modified: 2010-04-06
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
Comment
Question by:westy100697
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 2
  • +1
12 Comments
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346077
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
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346078
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
 

Author Comment

by:westy100697
ID: 1346079
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!

 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346080
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
 

Author Comment

by:westy100697
ID: 1346081
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
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1346082
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
 

Author Comment

by:westy100697
ID: 1346083
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
 
LVL 5

Expert Comment

by:ronit051397
ID: 1346084
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
 

Author Comment

by:westy100697
ID: 1346085
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
 
LVL 5

Expert Comment

by:ronit051397
ID: 1346086
OK, let me know when you want it to be posted.
0
 

Expert Comment

by:boabyte
ID: 1346087
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
 
LVL 5

Accepted Solution

by:
JimBob091197 earned 300 total points
ID: 1346088
Hi Westy/boabyte

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

Cheers,
JB
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question