Subject | Re: [IBO] Data Types in IBO |
---|---|
Author | Helen Borrie |
Post date | 2004-04-29T05:50:21Z |
At 12:36 AM 29/04/2004 -0400, you wrote:
SQLSubType. These are smallints corresponding to RDB$TYPE of the members
of the enumerated type RDB$FIELD_TYPE in the system table RDB$TYPES. You
can inspect the system tables easily in the IB_SQL browser, by checking the
"System Inf." checkbox on the Relations tab and selecting RDB$TYPES.
Only BLOBs have a value in SQLSubType: specifically, text BLOBs have 1, of
course. The SQLType of a BLOB is 261; of a varchar(n), 37; of a char(n),
14. So you can store a simple, static TStringlist in your application with
strings of the format NAME=VALUE to map the SQLTypes you are interested in
to whatever you want. For example, just bypass the VCL's ft* things
altogether and map an sqltype directly to input tag values like <textarea>,
etc., e.g.
14=<text>
261=<textarea>
etc.
Booleans are harder, since the database doesn't have boolean types; so
IsBoolean is the only way you will be able to distinguish whether a char
(sqltype 14) or a smallint (sqltype 7) is being used as a Boolean - and
then only if you have told the application so by some means. You can
simply "make up" an entry in your list for your custom Booleans, using a
number that's not used by the database enumeration, say
999=<checkbox>
Helen
>My database uses TiboDatabase. I detect field names using SchemaCacheNot directly. But each prepared TIB_Column has the properties SQLType and
>properties, and am trying to detect data types using db.datasets[ i
>].fields[ j ], etc.
>
>I am converting some legacy code which used tIboQuery to compare datatypes
>with ftString, ftMemo, etc.
>
>My new code uses tib_column properties, where I can only find Boolean
>properties isText, isBlob, isNumeric, etc. I am looking for a way to
>distinguish between the old ftString and ftMemo. This is important because
>of the web interface, in which the controls differ between string and memo
>types. Better yet would be some syntax allowing me to continue using the
>ftxx syntax with tib_column if possible.
SQLSubType. These are smallints corresponding to RDB$TYPE of the members
of the enumerated type RDB$FIELD_TYPE in the system table RDB$TYPES. You
can inspect the system tables easily in the IB_SQL browser, by checking the
"System Inf." checkbox on the Relations tab and selecting RDB$TYPES.
Only BLOBs have a value in SQLSubType: specifically, text BLOBs have 1, of
course. The SQLType of a BLOB is 261; of a varchar(n), 37; of a char(n),
14. So you can store a simple, static TStringlist in your application with
strings of the format NAME=VALUE to map the SQLTypes you are interested in
to whatever you want. For example, just bypass the VCL's ft* things
altogether and map an sqltype directly to input tag values like <textarea>,
etc., e.g.
14=<text>
261=<textarea>
etc.
Booleans are harder, since the database doesn't have boolean types; so
IsBoolean is the only way you will be able to distinguish whether a char
(sqltype 14) or a smallint (sqltype 7) is being used as a Boolean - and
then only if you have told the application so by some means. You can
simply "make up" an entry in your list for your custom Booleans, using a
number that's not used by the database enumeration, say
999=<checkbox>
Helen