I'm just trying to get into the whole programming patterns with PHP. I'm wondering if anyone has any experience with any patterns that use a DB 'Interface' class, and if it was a good idea? I'm trying to build an application that is meant to be expanded by others, so I'm trying to decide if it's worth it to add another layer to my application
ie. main->dbInterface->DBAL->presentation
The only benefit I can see is that others don't need to know SQL syntax, but don't most able developers know it anyway? If I was to use this interface, basic SELECT queries for example could be shown like:
Code: Select all
$db->get(array('config_name', 'config_value'), 'config');Code: Select all
$db->get(array('config_name', 'config_value'), 'config', 'config_value', '3', '`config_name DESC`', '20');Code: Select all
SELECT config_name, config_value
FROM config
WHERE config_value = 3
ORDER BY `config_name` DESC
LIMIT 20;
Anyway, thanks for reading
Sphenn