[DB-SIG] RE: column type casting

Dittmar, Daniel daniel.dittmar@sap.com
Fri, 23 Mar 2001 10:32:10 +0100


> Data handlers are one way to do this. In mxODBC I chose the positional
> approach for the converter function. Still missing is some sort
> of generic data input/output handler device. I remember that 
> Andy's MySQL
> module has a nice way to this -- it's easy for him though, because
> most of his code is in Python which is simple to extend by 
> subclassing.
> 
> One way to implement this would be by using callbacks which are
> triggered by certain type mappings. They are cumbersome to use
> though...

In sapdbapi, you can
- install data handler for each column of a cursor
- use the connection to specify data handlers for specific types which are
then used for every cursor

In addition, there are some default handler for date/time types: conversion
from the internal format to either <module time> tuples or to strings using
a time.strftime format.

Yet another thing we could standardize on (although maybe we should ask a
few users what they found useful).

Daniel

--
Daniel Dittmar
daniel.dittmar@sap.com
SAP DB, SAP Labs Berlin
http://www.sapdb.org/