[RESOLVED] Class Architecture

liunx

Guest
OK, so I have a db connect and query class that accepts sql and params, prepares and executes the pdo statement and returns an array of results.

First question: should I be doing this all in 1 class?
I use it thus:

$dbo = new DBconnector();
$dbo->query($sql,$params);
$result = $dbo->fetchArray();


If I break it down into a db_connection class and a query class, would it be best to extend the db class or instantiate it as an object within the query class?
The db class already extends a system vars class that contains the application settings for connection.

Given my ambition to remove all sql from the page scripts, should I create an abstract query class that is extended by a concrete class for each query, or query type? These will be very specific and complex reporting queries rather than general purpose DML inserts and updates.

Answered it myself: or did it anyway.
 
Back
Top