Problems? Is your data what you think it is? | |
PerlMonks |
Re: How to structure applications using a RDBMSby gav^ (Curate) |
on Jul 19, 2002 at 01:10 UTC ( [id://183101]=note: print w/replies, xml ) | Need Help?? |
You might want to look at two cunning modules by Michael Schwern/Tony Bowden, Ima::DBI and Class::DBI. The first gives all your classes nice cached DBI handles and SQL statements. In your class you set up your SQL statements:
Which you can then retrieve in anything that uses the class: I like this approach because all the SQL lives in a seperate module and doesn't mess up your main application. It also has some handy shortcuts like:
Now Class::DBI is a great abstraction layer if, like me, you don't like to play with SQL at all. An example: Now like magic you have a class to talk to the database and hide you from the horrors of SQL: or
This came out a bit longer than I expected, but I hope it might help somebody :) gav^
In Section
Seekers of Perl Wisdom
|
|