Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Object Oriented Pattern help

by bjelli (Pilgrim)
on May 12, 2001 at 13:57 UTC ( #79931=note: print w/replies, xml ) Need Help??

in reply to Object Oriented Pattern help

I know you want to program the stuff for yourself, but you might get some ideas by reading code:

There is a module Class::DBI that helps you create a Class that is closly linked to one Table in a Database.

It reuses the DB connection, and there is a function set_sql to generate reusable sql-statements (and statement handles).

Brigitte    'I never met a chocolate I didnt like'    Jellinek

Replies are listed 'Best First'.
Re: Re: Object Oriented Pattern help
by thefid (Friar) on May 12, 2001 at 19:09 UTC
    The module Class::DBI was exactly what I was looking for... thanks!

    Like koolade suggested, it may not be a good idea to open a database connection for every object, since I may have the case where a query for guests may return up to 100 objects. It looks like this module is efficient in that respects using the module Ima::DBI where it states:

    Holds off opening a database connection until necessary. While Ima::DBI is informed of all your database connections and SQL statements at compile-time, it will not connect to the database until you actually prepare a statement on that connection. This is obviously very good for programs that sometimes never touch the database. It's also good for code that has lots of possible connections and statements, but which typically only use a few. Kinda like an autoloader.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://79931]
[erix]: well, dutch royals are germans, really
[choroba]: Utrecht? Is that where we made the trip, LanX?
[erix]: we should really dupm the lot, but I got no say in the matter :)
[LanX]: yeah its a religious mafia , the only two big calvinist houses are dutch and prussian. ..
[LanX]: choroba yes
[erix]: Utrecht has a beautiful old center, and less mass-tourism than Amsterdam
[erix]: next time, drop by :)
[LanX]: religion is also the reason how the house of Hanover aquire the English throne, all other candidates on succession where catholics...
[erix]: Henry VIII has a lot to answer for :P
[LanX]: erix sure next time you miss a conference nearby we drop by ...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (12)
As of 2017-12-15 16:36 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (439 votes). Check out past polls.