I am about to start writing a database class but am in the process of designing it.
My goal with this project is to have one class for database connection and querying, and another class that returns results, with methods for iterating through them and using the data.
I already know a couple things that I want:
- Connect and Disconnect methods
Database selection and re-selection
Support for multiple queries - I'm especially conf**kled about how to implement this
Executing queries from a file
Methods to aid in debugging
One of things I don't want this to do is aid in the writing of SQL statements. I think that SQL is a good thing to commit to memory and want to avoid having my class generating SQL statements as much as possible.
An important feature I wanted to focus on was debugging. I was thinking about having an array which will hold mysql_error()'s. I am curious about what other things I might implement in this class to help with debugging?
Also, I would like one of the classes in this project to handle the escaping/unescaping data. Maybe the database class will escape data and the result class will unescape data?
I have been looking at alot of other classes and have already ganked some ideas. The point of this thread is design help, I am confident that I can implement most of the features I want.
If nothing else I will just have it as a reference and then other people can gank ideas from it. ^^
Hope to hear from someone soon.
EDIT:
I was also just thinking maybe I should create methods or another class (child/extender???) that would enable me to store data in a text file or some other useful storage medium. I may write a seperate class for xml stuff but would still like to hear ideas.