On 01/22/2003 03:26 AM, Philip Zee wrote:
I am trying to create a class, say User.  Each user has an entry in the database
table called user.  Each function, including the constructor, will be calling
the database to do something.  Is it better to initialize the database
connection inside each function or is it better to initialize the connection at
the beginning of the class?  What's the best practice on this?
I think Metastorage is what you are looking for. It is a persistence layer generator application. It lets you model your classes of objects and then it generates all the code for the classes that store and retrieves the objects of those classes in database tables.

You do not have to write any code. You just specify the operations that you want to perform with the objects of your classes and Metastorage generates adequate code to execute such operations with class functions that you may configure to your needs.

Metastorage is Open Source and is available here:




Manuel Lemos

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to