[DB-SIG] ANN: mxODBC Version 0.3

Greg Stein (Exchange) gstein@exchange.microsoft.com
Sat, 29 Nov 1997 02:29:41 -0800

Bill makes some good points, but the one single thing that caught my eye
last week when you first announced this was your tossing of the DBI
module. I'd like to reiterate that that was really not a very good idea

Exceptions are handled by identity. The single dbi module provides the
exception that all db modules will raise. Clients can then catch
"dbi.integrityError" and catch an error regardless of what underlying db
module was used. The dbi module also provides a common set of type

As with Bill, I don't understand some of the motivation here...


p.s. I gave up championing the db-sig because I believe there was
nothing left for it to do... that it was a SIG without a purpose. I'd
propose that creating a uniform ODBC db module should be placed on the
agenda. There was also an "open item" on the agenda for somebody to
update/maintain the DBAPI spec; that is still open/undone.

-----Original Message-----
From:	Bill Tutt 
Sent:	Friday, November 28, 1997 3:43 PM
To:	'M.-A. Lemburg'; DB-SIG @ Python.org
Subject:	RE: [DB-SIG] ANN: mxODBC Version 0.3

Ugh.. why do we need N different ODBC modules?
I'd really love to know.. 

>From your webpage:
	This interface module was created in need of an Python interface
the German ADABAS D relational database from Software AG. This database
be accessed through the Oracle CLI and or ODBC. After having tried both
OracleDB module from Digital Creations and the SolidDB Module (ODBC)
g.a.m.s. I decided to code my own version, because both didn't meet my
requirement for high stability for various reasons. 

What are those reasons?
Please, we'd like to know, really.. :)

Also, whats wrong with just porting the ODBC code from Win32?
I'm certainly more than willing to answer specific questions about it.
Unfortunately I don't have the time to test fixes to it, but I'm more
happy to answer questions about it.

Lets see if I can list the differences between your ODBC code, and the
Win32 version has exceptions, where you have essentially ODBC errors..
Exceptions: The dbi code includes exceptions your ODBC module is
supposed to
                   Specfically: noError, opError, progError,
dataError, and internalError
Where they apply to the following cases:
	noError is generally ment to be thrown when you have a warning
Data truncated that you should know about.
	opError is an operational error i.e. being disconnected,  data
source name not found, etc....
	progError is a programming error i.e. table already exists,
not found, etc...
	integrityError is an integirity error in the database's
integerity i.e. a foreign key check fails
	dataError is a data error, i.e. Numeric value out of range,
by zero, etc...
	internalError is an interntal Database error, i.e. Invalid
state, invalid transaction state, etc...

You have: (sqlstate, sqltype, errortext, lineno) tuples.
You can find the sqlstate->DBI exceptions in odbc.cpp in the Win32 code.

Autocommit: You default to off, when ODBC defaults to on.. 
This is highly conterintuitive, and violates the principle of least
The Win32 code has a similar function: setautocommit(0 | 1) to turn
autocommit on or off.
Whether or not ODBC should default to autocommit or not isn't really the
question.. if it does, so should we.

Connection String:
You have ('host:DBNAME', 'uid', 'pwd')
Win32 has: 'DSN/uid/pwd'
What really should be done here is to adopt an ODBC like connection
string... aka:
'property=value;property=value' Where "uid" is always the userid, and
is always the password.

fetchxxx() return values:
The return values are the same as the Win32 ODBC code

Ditching DBI:
That was a particulary silly thing to do, the exceptions listed above
in DBI, and DBI is a useful abstraction mechanism, and is database
independant.. Why does it need to be tossed?

Large Binary/Text data:
This is one place where your code does the right thing, and the Win32
code falls down.
Currently the Win32 ODBC code has a 64k limit on binary data, which can
easily fixed.

Well there isn't any difference between what you do, and what the
ODBC code does.
(Well except for handling TIME types but thats just a function of
the date part, or indeed just one line in odbc.cpp)
They're both limited to dates after Jan 1, 1970 00:00:00 GMT.
What we should do is come up with a sane date type for Python that isn't
based on time_t.

Looping over lists of tuples for non-resultset producing queries:
Your code does do this, and modifying Win32 ODBC to do this is trivial
well. (I have the necessary details btw...)

ODBC Catalog functions:
Well your code is ahead of the Win32 code here obviously since the Win32
code doens't have anything like this.
Submission of code for this kind of thing is greatly appreciated.

Wanting only to have one ODBC module,
Bill Tutt
Not speaking for Microsoft, etc...

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org

DB-SIG  - SIG on Tabular Databases in Python

send messages to: db-sig@python.org
administrivia to: db-sig-request@python.org