in reply to Re: Object Oriented Pattern help
in thread Object Oriented Pattern help

I have never, ever benchmarked this, but prepare_cached1 should get you increased performance, especially if you're using your queries a lot.

In other words, what repson said =)

1"the statement handle returned will be stored in a hash associated with the `$dbh'. If another call is made to `prepare_cached' with the same `$statement' and `%attr' values, then the corresponding cached `$sth' will be returned without contacting the database server" from the DBI documentation.

perl -e 'print "How sweet does a rose smell? "; chomp $n = <STDIN>; $r +ose = "smells sweet to degree $n"; *other_name = *rose; print "$other +_name\n"'

Replies are listed 'Best First'.
Re: Re: Re: Object Oriented Pattern help
by blue_cowdawg (Monsignor) on May 15, 2001 at 00:10 UTC

    As I said in my write up there is a lot more that can be done with the code that I presented. For instance, how about having just one DBH for the module as a whole? This way the first instantiation of an object declared in the .PM would make a connection and that connection would be used until nobody cared any more.

    I am not always convinced that fetchrow_hashref is all that efficient. In fact in the DBI man page it says that it isn't.

    One cat. Many ways to skin it and only that cat objects to how it is skinned...

    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Peter L. Berghold --- Peter@Berghold.Net "Those who fail to learn from history are condemned to repeat it."