APM: Database wrapper classes

Wayne Walker wwalker at bybent.com
Tue Aug 13 09:31:44 CDT 2002


Hi Everyone,

First we should be having a meeting in 8 days. Someone will get out a
notice soon.

But, more importantly, I want other peoples inputs on good ways to wrap
database access in some kind of class or package.

Let's say I have a project that uses three database tables and I need/want
to hide/bury the SQL away from the application developers (who are new
to perl, every piece I can hide from them is one less thing they need
to learn right now).

I could write some classes that just make the SQL disappear:

Person
        add(%data)
        delete($id)
        get($id)
Address
        add(%data)
        delete($id)
        get($id)
Relations
        add(%data)
        delete($id)
        get($id)

This alone makes life easier for everyone.  At first...

Then we run into performance issues, or cross table joins, or searches,
...

At which point this is now fairly ugly.  We end up having the SQL hidden
away, except for complex steps and then we're doing SQL outside of any
of the objects.

So, any recommendations?  Existing CPAN modules that handle this somehow.
A particular class hierarchy that makes sense for this that you've used
(a few class names and method names like I did).

David, do not bring up the CDC hierarchy, I'm trying to forget that
still.... :)

-- 

Wayne Walker



More information about the Austin mailing list