More Quercus fixes
This commit is contained in:
parent
bd1a484f2b
commit
9e36f60b28
37
sys/db.php
37
sys/db.php
@ -27,13 +27,22 @@ class db extends PDO {
|
||||
if ( ! isset(self::$instance[$dbname]))
|
||||
{
|
||||
//echo 'Creating new instance of db class.';
|
||||
self::$instance[$dbname] = new db($dbname, $options);
|
||||
self::$instance[$dbname] = self::_get_conf($dbname, $options);
|
||||
}
|
||||
|
||||
return self::$instance[$dbname];
|
||||
}
|
||||
|
||||
function __construct($dbname="default", $options=array())
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Makes DSN from config file, and creates database object
|
||||
*
|
||||
* @param string $dbname
|
||||
* @param array $options
|
||||
* @return db object
|
||||
*/
|
||||
private static function _get_conf($dbname="default", $options=array())
|
||||
{
|
||||
// Include the database config file
|
||||
require(APP_PATH.'config/db.php');
|
||||
@ -76,7 +85,23 @@ class db extends PDO {
|
||||
);
|
||||
|
||||
$options = $opts + $options;
|
||||
|
||||
|
||||
return new db($dsn, $user, $pass, $options);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Constructor to override PDO constructor - Quercus doesn't seem to override
|
||||
* the parent constructor unless the arguments match.
|
||||
*
|
||||
* @param string $dsn
|
||||
* @param string $user
|
||||
* @param string $pass
|
||||
* @param array $options
|
||||
*/
|
||||
function __construct($dsn, $user, $pass, $options)
|
||||
{
|
||||
// Let's try connecting now!
|
||||
parent::__construct($dsn, $user, $pass, $options);
|
||||
|
||||
@ -185,9 +210,9 @@ class db extends PDO {
|
||||
}
|
||||
|
||||
// Bind the parameters
|
||||
foreach($data as $placeholder => $value)
|
||||
foreach($data as $k => $value)
|
||||
{
|
||||
$res = $query->bindParam($placeholder, $value);
|
||||
$res = $query->bindValue($k, $value);
|
||||
|
||||
if( ! $res)
|
||||
{
|
||||
@ -196,8 +221,6 @@ class db extends PDO {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ class JSObject extends Object{
|
||||
{
|
||||
$this->$name = $value;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,7 +159,7 @@ class miniMVC extends JSObject{
|
||||
/**
|
||||
* Constructor - Any classes loaded here become subclasses of miniMVC
|
||||
*/
|
||||
public function __construct()
|
||||
function __construct()
|
||||
{
|
||||
self::$instance =& $this;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user