Make Query Builder more flexible

This commit is contained in:
Timothy Warren 2012-03-23 15:33:05 -04:00
parent 225a5560fd
commit 961cbbe67a

View File

@ -62,6 +62,19 @@ class Query_Builder {
*/ */
public function __construct($params) public function __construct($params)
{ {
// Convert array to object
if (is_array($params))
{
$p = new StdClass();
foreach($params as $key => $val)
{
$p->$key = $val;
}
$params = $p;
}
$params->type = strtolower($params->type); $params->type = strtolower($params->type);
$dbtype = ($params->type !== 'postgresql') ? $params->type : 'pgsql'; $dbtype = ($params->type !== 'postgresql') ? $params->type : 'pgsql';