Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

field size

2 views
Skip to first unread message

Ed

unread,
Jan 9, 2008, 9:33:23 PM1/9/08
to
Hi,

I understand that TTable.items[x].size contains the size of
the field; but this depends entirely on what the DataType is.

Is there a way to find out the actual 'length' of the field?

If the table itself has the following definition:

MyTable.db:

fldname character 20
fldindex numeric 10 0
fldate date 0 0
flblob memo 0

How does one go about in finding the above?

For datatype = float, the precision and size = 0.
For datetypes the precision and size = 0

Any help appreciated

Edmund

Zoren Lendry

unread,
Jan 9, 2008, 10:00:51 PM1/9/08
to
Ed wrote:
> Is there a way to find out the actual 'length' of the field?
> How does one go about in finding the above?
> For datatype = float, the precision and size = 0.
> For datetypes the precision and size = 0

Are you asking about how much space a given data type takes in the
underlying db? If so, then it depends on the database you are using. For
instance, InterBase and Firebird have 3 separate datatypes for dates and
times: Timestamp, which occupies 8 bytes, has both a date and a time
portion. The Date portion is the Integer part, and the Time portion is
the Float (fraction) part. A Date by itself takes 4 bytes, and contains
no time information. A Time by itself takes 4 bytes, and contains no
date information. A Double probably takes 8 bytes. A Boolean takes 2
bytes. Numeric/Decimal up to a precision of 9 occupies 4 bytes, 8 bytes
beyond 9.

As far as the TField descendants are concerned, you will get size and
precision of 0 where the values are irrelevant. For instance, for an
exact numeric type (NUMERIC/DECIMAL in IB/FB), the precision and scale
matter a great deal. But for a Double? It just is what it is, up to the max.

You need to say what DB you're using, because it makes a difference.

Loren sZendre

Ed

unread,
Apr 11, 2008, 5:56:33 AM4/11/08
to
Zoren Lendry wrote:
>
> As far as the TField descendants are concerned, you will get size and
> precision of 0 where the values are irrelevant. For instance, for an
> exact numeric type (NUMERIC/DECIMAL in IB/FB), the precision and scale
> matter a great deal. But for a Double? It just is what it is, up to the
> max.
>
> You need to say what DB you're using, because it makes a difference.
>
Hi Zoren,

I'm talking about tables from a FoxPro Database.

Edmund


0 new messages