Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 33 → Rev 34

/trunk/Db/Database.php
95,8 → 95,44
*/
protected $_lastInsertId = '';
public function __construct()
/**
* Creates a new <code>Database</code> instance.
*
* Each of the parameters is optional and can also be given
* by a protected property where the parameter name is preceded
* by <code>_</code>. Parameter values overwrite the default
* property values. It is recommended to use default property
* values of inheriting classes except for small applications
* and testing purposes.
*
* @param string $dsn
* @param string $username
* @param string $password
* @param mixed $options
*/
public function __construct($dsn = '', $username = null,
$password = null, array $options = array())
{
if ($dsn !== '')
{
$this->_dsn = $dsn;
}
if ($username !== null)
{
$this->_username = $username;
}
if ($password !== null)
{
$this->_password = $password;
}
if ($options)
{
$this->_options = $options;
}
$this->_connection =
new PDO($this->_dsn, $this->_username, $this->_password, $this->_options);
}
388,8 → 424,10
if (is_array($where) && $this->_isAssociativeArray($where))
{
/* FIXME: Export and reuse this */
foreach ($where as $column => $condition)
{
/* TODO: Also handle function calls as keys */
if (is_array($condition) && $this->_isAssociativeArray($condition))
{
reset($condition);