Subject Re: [IBO] Does the SQLType property work?
Author terriertech
Helen, thanks for your response. I got the general idea and got it
working. I didn't know about the SQL_ constants and this makes life
easier.

In the case of blobs, I need to mime-encode them, and in the case of
non-integers, I need to set up a custom component accordingly. So yes
I need a basic comprehension of the metadata but nothing too extensive.


--- In IBObjects@yahoogroups.com, Helen Borrie <helebor@t...> wrote:
> At 04:02 PM 8/10/2004 +0000, you wrote:
>
>
> >Hi, I am trying to figure out the data type of a field, which should
> >really be a simple task, but I am running into problems.
> >
> >First up, if I use the IsBlob property it returns false even though my
> >field *is* a blob.
>
> There is nothing to test unless the query is prepared. Native IBO
doesn't
> store persistent field objects.
>
>
> >Second, if I look at x->Fields->Columns[i]->IsNumeric, it does not
> >tell me whether the field is an integer or floating point value.
>
> Correct. IsNumeric is just a quick check to see whether it is or is
not a
> generically numeric type (not NUMERIC(), note!) as opposed to
string, blob
> or Boolean. Delphi can't distinguish between a fixed decimal and a
floating
> type. When the statement is prepared, you can read the SqlScale
property
> to determine whether a column with SqlType SQL_INTEGER or SQL_INT64
is a
> fixed point type (SqlScale > 0).
>
>
> >I searched through the previous messages and found that I can use the
> >SQLType property, but the values being put into this property seem out
> >of whack. For example, the mapping goes something like this:
> >Varchar = 449
> >Char = 453
> >Timestamp = 511
> >Integer = 497
> >Blob = 521
> >
> >The values are consistent, they just don't match anything I am seeing
> >in rdb$types. Am I supposed to somehow process the SQLType property
> >to get the actual field type?
>
> Use the SQL_ constants. These are listed in under Global Constants
in the
> Component Help. But these are not intended for direct use and, on their
> own, may not provide enough information to discern full attributes
of the
> stored data. For SQL_VARYING, for instance, you would also need to
read
> the SqlLen property. In the general case, it's far better to read the
> IsWhatever properties of the TIB_Column, which are available
whenever the
> statement is prepared.
>
> Can you explain what you need this test for?
>
> If it's for extracting metadata, Delphi's raw interpretation of data
isn't
> adequate to extract metadata. A lot of messing about goes on under the
> covers to make IB datatypes work with Delphi. Depending on what you
are
> trying to do, TIB_DDL_Extract might be what you need.
>
> Helen