Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: A brief survey of the DBI usability layer modules on the CPAN

by johnnywang (Priest)
on Nov 01, 2005 at 20:59 UTC ( [id://504740]=note: print w/replies, xml ) Need Help??


in reply to A brief survey of the DBI usability layer modules on the CPAN

Thanks for the survey, I also found the raw DBI pretty cumbersome for many simple tasks.

How does DBIx::Simple play with connection pools such as connect_cached, prepare_cached and Apache::DBI?

Replies are listed 'Best First'.
Re^2: A brief survey of the DBI usability layer modules on the CPAN
by Aristotle (Chancellor) on Nov 01, 2005 at 21:20 UTC

    There’s nothing about any of that in the documentation.

    Since DBIx::Simple does nothing extraordinary, I assume it works with Apache::DBI no differently than any other piece of code that uses DBI naïvely.

    I can’t see that it uses connect_cached; it does expose the database handle via a getter, but there’s no way to set it or to supply your own. Supplying your own would make this and more things possible; that might make a good feature request. but you can supply your own database handle, which you can set up in any way you’d like.

    As for prepare_cached, it actually uses its own caching scheme for statement handles; but it does not use prepare_cached. I don’t know what the motivation behind this is, so there may or may not be a good feature request to be made here.

    Makeshifts last the longest.

      I can’t see that it uses connect_cached; it does expose the database handle via a getter, but there’s no way to set it or to supply your own. Supplying your own would make this and more things possible; that might make a good feature request.
      I haven't used DBIx::Simple (and am now looking in to it), but a quick glance at the docs has this constructor:

      DBIx::Simple->connect($dbh)

      I would assume this could be used to pass your own DB handle created via connect_cached.

      ++ for a good writeup. I'd definitely be interested on your thoughts on Class::DBI, and a comparision between it and DBIx::Simple.

        D’oh! I even wondered how it could be that Juerd would miss such an obvious and obviously useful feature, and checked the docs multiple times – but didn’t see it. Sometimes I really have a blind spot. Thanks for pointing out the blunder, I fixed my node.

        As for a comparison with Class::DBI – there’s just not much to compare. DBIx::Simple is a very thin layer on top of DBI which doesn’t fundamentally affect the way you work, it just adds a good helping of readability and makes some things a smidgen easier. So DBIx::Simple is to Class::DBI exactly as DBI also is to Class::DBI.

        Makeshifts last the longest.

      As for prepare_cached, it actually uses its own caching scheme for statement handles; but it does not use prepare_cached. I don’t know what the motivation behind this is

      prepare_cached caches sth objects not caring whether the sth has finished already. You might be executing a sth that was still in use somewhere else. This leads to all kinds of interesting bugs :)

      Juerd # { site => 'juerd.nl', do_not_use => 'spamtrap', perl6_server => 'feather' }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://504740]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-03-19 10:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found