Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 51 → Rev 50

/trunk/Db/Table.php
1,12 → 1,8
<?php
 
namespace PointedEars\PHPX\Db;
 
require_once __DIR__ . '/../Application.php';
require_once __DIR__ . '/../AbstractModel.php';
 
use \PointedEars\PHPX\Application;
 
/**
* Generic database table model class
*
16,7 → 12,7
* ID of the last inserted row, or the last value from
a sequence object, depending on the underlying driver.
*/
class Table extends \PointedEars\PHPX\AbstractModel
class Table extends AbstractModel
{
/**
* Name of the table
/trunk/Db/Mapper.php
1,7 → 1,5
<?php
 
namespace PointedEars\PHPX\Db;
 
require_once __DIR__ . '/../AbstractModel.php';
require_once __DIR__ . '/Table.php';
 
10,7 → 8,7
*
* @author Thomas Lahn
*/
abstract class Mapper extends \PointedEars\PHPX\AbstractModel
abstract class Mapper extends AbstractModel
{
/**
* Class name of the associated table model
/trunk/Db/Database.php
1,7 → 1,5
<?php
 
namespace PointedEars\PHPX\Db;
 
require_once __DIR__ . '/../global.inc';
require_once __DIR__ . '/../AbstractModel.php';
 
23,7 → 21,7
* Last success value of the database operation
* @author Thomas Lahn
*/
class Database extends \PointedEars\PHPX\AbstractModel
class Database extends AbstractModel
{
/* Access properties */
 
191,7 → 189,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;
481,7 → 479,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))
{
841,7 → 839,7
 
if (is_null($fetch_style))
{
$fetch_style = \PDO::FETCH_ASSOC;
$fetch_style = PDO::FETCH_ASSOC;
}
 
if (!is_null($ctor_args))
/trunk/Db/MySQLDB.php
1,7 → 1,5
<?php
 
namespace PointedEars\PHPX\Db;
 
require_once __DIR__ . '/Database.php';
 
class MySQLDB extends Database
51,7 → 49,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}" : '');
58,7 → 56,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();