Well to me the problem is always that I'm getting put from a <form> and I have to do this tedious mapping between form input names and the fields in my db. How do we expect this amazing class to function?
I've always hoped for something that validates user input as automatically as possible. I realize that I can't expect a DBMS to know that I want to put a valid email address in a VARCHAR field, but I can expect an automatic code generator to know that INT fields have no alpha chars in them.
I'm sort of imagining a system wherein I can create a new object that corresponds to the table I want and just feed it $GET or $POST (or some subarray of $GET or $POST) and the constructor will take care to extract all its instance var values from the supplied array.
Then I can use a data mapper which knows how to handle all the CRUD.
Suppose I have a table called my_table, then I could do omething like this:
require 'classes/MyTable.php'; // this php file could be auto-generated from an EXPLAIN statement and is a trivial class with one class var for each table column
$mt = new MyTable($_POST); // could this auto-validate? Could I hang some custom validation on it?
require 'classes/Mapper.php'; // a carefully constructed class to handle DB access in a DBMS-agonostic way
$mapper = new Mapper(DB_HOST, DB_USER, DB_PASS, DB_NAME);
// then one of these: