Rewriting My Database Object
As part of my combined programming and database course I decided to approach the remaining exercises in a more object oriented way by using a database class to handle the connection towards the database. The first version was somewhat clumsy since I wanted to put in so many features into it. Tonight I sat down again and re-wrote the whole thing from scratch with simplicity in mind and the result was 300 lines less code even though I added some remarkable features the previous incarnation didn’t have.
If you’re interested in what it looks like the source code is available on a subdomain of mine along with another file showing off some example usage
April 12th, 2007 at 5:04 pm
:O You’re using php4 property definitions in a php5 class! :P make sure to fix them up, also you may want to consider binding the class to an interface and adding support for other database types, such as postgresql.
If you need an example of how to do so, you know where to find me.