Hrunting has asked for the wisdom of the Perl Monks concerning the following question:
According to the subclassing posts that are out there, one of the things that you're supposed to do when subclassing DBI is to call __PACKAGE__->init_rootclass(). That works fine.
However, when you use Apache::DBI, Apache::DBI will be used to make the connection, but an Apache::DBI::db connection won't be returned to you; a connection from your class will. If the init_rootclass() is removed from the subclass, all works as expected, but of course, you lose any adjustments you may have made withing subclass::db and subclass::st.
Does anyone know of a workaround to this? It seems a shame to lose the persistent functionality of Apache::DBI if you want to use subclassed DBI::db and ::st objects. Conversely, it seems stupid to have to reinvent the Apache::DBI wheel when you have subclasses.
From what I've read in Apache::DBI's code, I suspect that a partial rewrite of Apache::DBI would be needed to support subclassed DBI objects, but I wanted to hear at least *some* opinions on the matter, first.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 1: Apache::DBI and DBI subclasses
by tilly (Archbishop) on Dec 09, 2001 at 08:26 UTC | |
by Hrunting (Pilgrim) on Dec 09, 2001 at 20:31 UTC | |
by tilly (Archbishop) on Dec 09, 2001 at 21:54 UTC |