[DB-SIG] Inheriting from a DBAPI 2.0 Cursor Object
chris at cogdon.org
Thu Sep 25 21:55:12 EDT 2003
On Thursday, Sep 25, 2003, at 18:19 US/Pacific, Peter L. Buschman wrote:
> Thanks so much. I had been so focused on finding an inheritance
> solution ( difficult since the Connection and Cursor objects are not
> directly in DBAPI ) that I completely missed simply wrapping the
> relevant objects. DBAPI is not that complex, so wrapping the methods
> is not
> that much extra code.
As a general solution, you can also include a 'auto wrapper' that will
pass through calls to the wrapped object if they're not defined at the
def __getattr__ ( self, name ):
return getattr ( self.db, name )
... into the class, and then you won't have to write 'trivial' wrappers
for all the methods that simply pass the call to the wrapped object.
("`-/")_.-'"``-._ Chris Cogdon <chris at cogdon.org>
. . `; -._ )-;-,_`)
(v_,)' _ )`-.\ ``-'
_.- _..-_/ / ((.'
((,.-' ((,/ fL
More information about the DB-SIG