There are a few variables that are required for a driver to have. This are variables which are used by DAL to pass some things on to the driver or they are used to transport data from the driver to DAL.
required variables set by DAL
This variable will contain the username which is used to connect to the database.
This variable will contain the password for the username.
This variable will contain some extra parameters for the database connectString.
required variables read by DAL
Contains the full name of the driver, is used to construct the drivers name.
Version number of the driver, is used to construct the drivers name.
This array contains the functions the driver is capable of, this array can contain the following values
return_object | : | The driver is capable of returning objects from a resultset |
return_array | : | The driver is capable of returning an associative array from a resultset |
return_row | : | The driver is capable of returning an enumerated array from a resultset |
return_last_insert | : | The driver is capable of returning the last insert on the database |
transactions | : | The driver supports transactions. This includes startTransaction, commitTransaction and abortTransaction. |
seekrecord | : | The driver supports seeking to a specified record within the resultset |
nextrecord | : | The driver supports the function nextRecord, or seeking to the next record |
prevrecord | : | The driver supports the function prevRecord, or seeking to the previous record |
While a lot functions are optional, such as the transaction and fetch functions there are also some functions that are required. Below you'll find a list.
connectDB()
closeDB()
selectDB()
capabilities()
getDBError()
executeQuery($query)
saveState()
restoreState()
Warnings / errors that are occuring during executing of the driver's functions should be suppressed. In different words, the driver itself may not produce any warnings. All error and warning handling will be done by the DAL class.
The various variables necessary for the housekeeping of the driver module need to be declared within the module itself. By example the module is responsible for keeping score of result identifiers and database connections. At the end of the session the onDestroy function is called. So if the driver needs to do any cleanup work, like closing db connections, it has to be done in that block.