Subject Re: [IBO] TIB_Query, how find out fields Datatype?
Author Helen Borrie
At 12:46 PM 12/01/2008, you wrote:
>Hi,
>
>Wiht a TIBOQuery i can do:
>
>q :TIBOQuery
>fieldtype:= q.FieldDefs.Items[i].DataType
>
>how this works with IB_Query?
>q :TIB_Query
>fieldtype:= q. ???

The SQLType property of a TIB_Column returns the native SQL type, which is a smallint represented by a symbol. As you see, the type is different, depending on whether the column is nullable or not:

(from IB_Header.pas)
// not nullable nullable ;
SQL_VARYING = 448; SQL_VARYING_ = 449; // varchar
SQL_TEXT = 452; SQL_TEXT_ = 453; // char
SQL_DOUBLE = 480; SQL_DOUBLE_ = 481; //double precision
SQL_FLOAT = 482; SQL_FLOAT_ = 483; //
SQL_LONG = 496; SQL_LONG_ = 497; // integer
SQL_SHORT = 500; SQL_SHORT_ = 501; // smallint
SQL_DATE = 510; SQL_DATE_ = 511; // dialect 1 date
SQL_BLOB = 520; SQL_BLOB_ = 521; // blob
SQL_D_FLOAT = 530; SQL_D_FLOAT_ = 531; // float
SQL_ARRAY = 540; SQL_ARRAY_ = 541; // array
SQL_QUAD = 550; SQL_QUAD_ = 551; // type with internal uses, e.g. blob_ids
SQL_TIMESTAMP = 510; SQL_TIMESTAMP_ = 511; // dialect 3 timestamp, dialect 1 date
SQL_TYPE_TIME = 560; SQL_TYPE_TIME_ = 561; // time
SQL_TYPE_DATE = 570; SQL_TYPE_DATE_ = 571; // dialect 3 date
SQL_INT64 = 580; SQL_INT64_ = 581; // bigint
SQL_BOOLEAN = 590; SQL_BOOLEAN_ = 591; // not used

But in practice you rarely need to use these, as TIB_Column has other properties by which you can determine important attributes associated with the column's data type, e.g. IsNumeric, as well as the As... methods for reading and writing operations specific to data type.

Helen