473,387 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

kinterbas db column type

Hi,

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?

Thanks,
Uwe

Jul 18 '05 #1
6 1750
> 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

Jul 18 '05 #2
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?

Jul 18 '05 #3
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()?
Jul 18 '05 #4
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?

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.

Uwe

Jul 18 '05 #5
>
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
)

This is what I got from a cursor's description:

(('ID', <type 'int'>, 12, 4, 0, 0, False), ('PT_TEST_ID', <type 'int'>,
12, 4, 0, 0, False), ('INTVALUE', <type 'int'>, 12, 4, 0, 0, True),
('BOOLVALUE', <type 'int'>, 12, 4, 0, 0, True), ('FLOATVALUE', <type
'float'>, 17, 8, 0, 0, True), ('DATETIMEVALUE', <type 'tuple'>, 22, 8,
0, 0, True), ('DATEVALUE', <type 'tuple'>, 22, 8, 0, 0, True),
('TIMEVALUE', <type 'tuple'>, 22, 8, 0, 0, True), ('TEXTVALUE', <type
'str'>, 0, 8, 0, 1, True), ('PERSISTENTVALUE', <type 'str'>, 0, 8, 0, 0,
True))

The tuple type is really a tuple. Try this:

import time
time.gmtime()

This will give you a tuple. Well, you can ask for a separate DATE and
TIME type.
Well, in dialect 1, only TIMESTAMP supported.

Cheers,

L


Jul 18 '05 #6
Uwe Grauer wrote:

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.

Uwe


Got the answer in db-sig, thought i should share it:

David Rushby wrote:

This is a known problem in 3.1_pre6 and earlier. It's fixed in the CVS
version, which I plan to release soon as 3.1_pre7. Here's the relevant
SF bug report:
http://sourceforge.net/tracker/index...13&atid=109913

If you're not compiler- or CVS- constrained, use the CVS version right
now; it's quite stable.

Jul 18 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Peter Foti | last post by:
Hi all, I have a form that contains a 2 column table. In the left column is the description for a particular input (ie - "First Name", "Last Name", "Phone Number", etc.). In the right column...
1
by: aspnetpal | last post by:
Hi Every1, I'm getting this error. 'Cannot specify a column width on data type smalldatetime.' I'm using SQL Server & I've check the data type in the db & it's same as smalldatetime. Any...
4
by: Brian Brane | last post by:
I have properties that wrap DataRow columns as in: public int aNumber { get{ return m_DataRow; } set{ m_DataRow = value; } } If the column happens to contain DBNull, I get a cast exception...
6
by: Robert Schuldenfrei | last post by:
Dear NG, After being away from C# programming for a spell, I am trying my hand at what should be a simple task. I have been hitting my head against the wall this morning. I have a simple order...
3
by: Bob Day | last post by:
VS 2003, sql How do you determine the data type of a column if its value is DBNull? 1)Table: Column1 STRING non-nullable 2) Fill to a DataSet via DataAdapter 3) dim Data_Type_Is...
6
by: Balin | last post by:
Hi all, I have some problem with packege kinterbas for Firebird db connection this is my code: import kinterbasdb class ConnessioneDB: def initialize(self):...
3
by: matt.skibbs | last post by:
When we moved a project from .NET 1.1 to .NET 2.0, we ran into an issue with some code that inserts a datatable from IDataReader.GetSchemaTable() into a dataset, and then serializes the dataset to...
1
by: RGow | last post by:
Hi, I'd like to know whether there is a way to alter the data type of a VARCHAR FOR BIT DATA column to be simply a VARCHAR column? I executed an ALTER TABLE statement, similar to, ALTER TABLE...
8
by: mlwerth | last post by:
Dear Access Group: This is the most basic and most embarrassing of questions, but I cannot find where to change the data type of a text field that I have in Access 2003 to a number field. I've...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.