I've posted this to a couple of mailing lists and haven't received any answers, so maybe the folks at perlmonks can give some insight.

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.


In reply to Apache::DBI and DBI subclasses by Hrunting

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.