473,372 Members | 1,047 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,372 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 1749
> 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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.