Added namespaces
/trunk/Db/MySQLDB.php |
---|
1,5 → 1,7 |
<?php |
namespace PointedEars\PHPX\Db; |
require_once __DIR__ . '/Database.php'; |
class MySQLDB extends Database |
49,7 → 51,7 |
public function __construct() |
{ |
$this->readConfig(); |
$this->_dsn = "mysql:host={$this->_host}" |
. (!is_null($this->_dbname) ? ";dbname={$this->_dbname}" : '') |
. (!is_null($this->_charset) ? ";charset={$this->_charset}" : ''); |
56,7 → 58,7 |
if (!is_null($this->_charset)) |
{ |
$this->_options[PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset; |
$this->_options[\PDO::MYSQL_ATTR_INIT_COMMAND] = "SET NAMES " . $this->_charset; |
} |
parent::__construct(); |
/trunk/Db/Database.php |
---|
1,5 → 1,7 |
<?php |
namespace PointedEars\PHPX\Db; |
require_once __DIR__ . '/../global.inc'; |
require_once __DIR__ . '/../AbstractModel.php'; |
21,7 → 23,7 |
* Last success value of the database operation |
* @author Thomas Lahn |
*/ |
class Database extends AbstractModel |
class Database extends \PointedEars\PHPX\AbstractModel |
{ |
/* Access properties */ |
189,7 → 191,7 |
if ($this->_connection === null) |
{ |
$this->_connection = |
new PDO($this->_dsn, $this->_username, $this->_password, $this->_options); |
new \PDO($this->_dsn, $this->_username, $this->_password, $this->_options); |
} |
return $this->_connection; |
479,7 → 481,7 |
* @see PDOStatement::fetchAll() |
*/ |
public function select($tables, $columns = null, $where = null, |
$order = null, $limit = null, $fetch_style = PDO::FETCH_ASSOC) |
$order = null, $limit = null, $fetch_style = \PDO::FETCH_ASSOC) |
{ |
if (is_null($columns)) |
{ |
839,7 → 841,7 |
if (is_null($fetch_style)) |
{ |
$fetch_style = PDO::FETCH_ASSOC; |
$fetch_style = \PDO::FETCH_ASSOC; |
} |
if (!is_null($ctor_args)) |
/trunk/Db/Mapper.php |
---|
1,5 → 1,7 |
<?php |
namespace PointedEars\PHPX\Db; |
require_once __DIR__ . '/../AbstractModel.php'; |
require_once __DIR__ . '/Table.php'; |
8,7 → 10,7 |
* |
* @author Thomas Lahn |
*/ |
abstract class Mapper extends AbstractModel |
abstract class Mapper extends \PointedEars\PHPX\AbstractModel |
{ |
/** |
* Class name of the associated table model |
/trunk/Db/Table.php |
---|
1,8 → 1,12 |
<?php |
namespace PointedEars\PHPX\Db; |
require_once __DIR__ . '/../Application.php'; |
require_once __DIR__ . '/../AbstractModel.php'; |
use \PointedEars\PHPX\Application; |
/** |
* Generic database table model class |
* |
12,7 → 16,7 |
* ID of the last inserted row, or the last value from |
a sequence object, depending on the underlying driver. |
*/ |
class Table extends AbstractModel |
class Table extends \PointedEars\PHPX\AbstractModel |
{ |
/** |
* Name of the table |