dblayeroo: allow to extends it. Add a connect class instead of the constructor
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3561 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -57,6 +57,19 @@ class dblayeroo
|
|||||||
*/
|
*/
|
||||||
public function __construct ($dsn, $username=null, $password=null,
|
public function __construct ($dsn, $username=null, $password=null,
|
||||||
$driver_options=null)
|
$driver_options=null)
|
||||||
|
{
|
||||||
|
$this->connect ($dsn, $username, $password, $driver_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Connection to the database engine
|
||||||
|
* See http://fr2.php.net/manual/en/pdo.construct.php for the $dsn format
|
||||||
|
* @param string $dsn PDO Data Source Name
|
||||||
|
* @param string|null $username Username to connect
|
||||||
|
* @param string|null $password Password to connect
|
||||||
|
* @param string|null $driver_options Driver options to the database
|
||||||
|
*/
|
||||||
|
public function connect ($dsn, $username=null, $password=null,
|
||||||
|
$driver_options=null)
|
||||||
/* {{{ */
|
/* {{{ */
|
||||||
{
|
{
|
||||||
$driver = @explode (":", $dsn);
|
$driver = @explode (":", $dsn);
|
||||||
@@ -1306,7 +1319,7 @@ class dblayeroo
|
|||||||
$this->debugLog ("Entering setForeignObj (OBJECT)");
|
$this->debugLog ("Entering setForeignObj (OBJECT)");
|
||||||
if (! is_object ($object))
|
if (! is_object ($object))
|
||||||
$this->DBException ("Invalid setForeignObj parameter: not an object");
|
$this->DBException ("Invalid setForeignObj parameter: not an object");
|
||||||
if (get_class ($object) !== __CLASS__)
|
if (! is_subclass_of ($object, __CLASS__))
|
||||||
$this->DBException (
|
$this->DBException (
|
||||||
"Invalid object provided to setForeignObj (not dblayeroo object)");
|
"Invalid object provided to setForeignObj (not dblayeroo object)");
|
||||||
if (! isset ($object->table))
|
if (! isset ($object->table))
|
||||||
|
|||||||
Reference in New Issue
Block a user