Il giorno mar, 17/04/2007 alle 10.16 +0200, M.-A. Lemburg ha scritto: > > While this can be solved using a registry of types conversions, > I see problems in standardizing the way to define the type > mappings since different database backends tend to have > or need different types.
I can see an API that leverages on the introspection abilities of the drivers, to abstract to the different type representations of the various backends. Let's suppose that a driver "knows" the type of a DB column, then we can ask it for an abstract "dbtype": dbtype = connection_object.getdbtype("SELECT 1 AS foo") where the query _must_ return a scalar from which the driver infers the type. Then the type can be used as a key in the registry. Obviously the conversion function will be backend-specific but I suppose the signature couldbe the same for all functions. Given the fact that the conversion happens inside a cursor and than the connection is available from the cursor object itself, something like: py_data = conversion_function(backend_data, cursor_object) Then we can at least make a standard for the registry methods. federico -- Federico Di Gregorio http://people.initd.org/fog Debian GNU/Linux Developer [EMAIL PROTECTED] INIT.D Developer [EMAIL PROTECTED] All programmers are optimists. -- Frederick P. Brooks, Jr.
signature.asc
Description: Questa รจ una parte del messaggio firmata digitalmente
_______________________________________________ DB-SIG maillist - DB-SIG@python.org http://mail.python.org/mailman/listinfo/db-sig