i need to know the database column types returned by kinterbasdb. Implicit type conversion is i nice thing to have, but it hides the real types in the database. So how could i get this information?
> i need to know the database column types returned by kinterbasdb. > Implicit type conversion is i nice thing to have, but it hides the > real types in the database. > So how could i get this information?
If you use InterBase only, you can get that information from the metadatabase. Try this:
RDB$RELATIONS - this stores table information RDB$FIELDS - this is for the fields (here you have the RDB$FIELD_TYPE field) RDB$RELATION_FIELDS - connects relations to fields
you can figure out the others. (Oh, it is for InterBase 6.0 but the others are similar or the same)
Gandalf wrote: >> i need to know the database column types returned by kinterbasdb. >> Implicit type conversion is i nice thing to have, but it hides the >> real types in the database. >> So how could i get this information?
> If you use InterBase only, you can get that information from the > metadatabase. > Try this:
> RDB$RELATIONS - this stores table information > RDB$FIELDS - this is for the fields (here you have the RDB$FIELD_TYPE > field) > RDB$RELATION_FIELDS - connects relations to fields
> you can figure out the others. (Oh, it is for InterBase 6.0 but the > others are similar or the same)
> Cheers,
> L 1.0
Does this mean, that the kinterbasdb isn't DB-API 2.0 compliant?
>>> i need to know the database column types returned by kinterbasdb. >>> Implicit type conversion is i nice thing to have, but it hides the >>> real types in the database. >>> So how could i get this information?
>> RDB$RELATIONS - this stores table information >> RDB$FIELDS - this is for the fields (here you have the RDB$FIELD_TYPE >> field) >> RDB$RELATION_FIELDS - connects relations to fields
> Does this mean, that the kinterbasdb isn't DB-API 2.0 compliant?
It is DB-API 2.0 compilant. I'm sorry, maybe I misunderstood you. This is a way to get the column types in InterBase inside. Do you want to know the Python types in the row returned by .fetch()?
>>>> i need to know the database column types returned by kinterbasdb. >>>> Implicit type conversion is i nice thing to have, but it hides the >>>> real types in the database. >>>> So how could i get this information?
>>> RDB$RELATIONS - this stores table information >>> RDB$FIELDS - this is for the fields (here you have the RDB$FIELD_TYPE >>> field) >>> RDB$RELATION_FIELDS - connects relations to fields
>> Does this mean, that the kinterbasdb isn't DB-API 2.0 compliant?
> It is DB-API 2.0 compilant. I'm sorry, maybe I misunderstood you. This > is a way > to get the column types in InterBase inside. Do you want to know the > Python types > in the row returned by .fetch()?
Sorry Gandalf,
more explanation:
It's different from other modules cause it does a implicit type conversion to the Python-types. So for a DATETIME-column in mysql you get a type_code 12 (which is indeed DATETIME in MySQLdb) but in kinterbasdb you get t_tuple. This does not help me very much since the information i need is different from what i get.
>>> Does this mean, that the kinterbasdb isn't DB-API 2.0 compliant?
>> It is DB-API 2.0 compilant. I'm sorry, maybe I misunderstood you. >> This is a way >> to get the column types in InterBase inside. Do you want to know the >> Python types >> in the row returned by .fetch()?
> Sorry Gandalf,
> more explanation:
> It's different from other modules cause it does a implicit type > conversion to the Python-types. > So for a DATETIME-column in mysql you get a type_code 12 (which is > indeed DATETIME in MySQLdb) but in kinterbasdb you get t_tuple. This > does not help me very much since the information i need is different > from what i get.
Okay, I created this table (InterBase 6.01):
create table PV_TEST ( ID integer not null, PT_TEST_ID integer not null, INTVALUE integer, BOOLVALUE integer, FLOATVALUE double precision, DATETIMEVALUE timestamp, DATEVALUE timestamp, TIMEVALUE timestamp, TEXTVALUE blob sub_type text segment size 80, PERSISTENTVALUE blob segment size 80 )
> It's different from other modules cause it does a implicit type > conversion to the Python-types. > So for a DATETIME-column in mysql you get a type_code 12 (which is > indeed DATETIME in MySQLdb) but in kinterbasdb you get t_tuple. This > does not help me very much since the information i need is different > from what i get.
> Uwe
Got the answer in db-sig, thought i should share it: