Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 31 → Rev 32

/trunk/Db/Database.php
21,6 → 21,8
*/
class Database extends AbstractModel
{
/* Access properties */
/**
* DSN of the database
* @var string
44,8 → 46,26
* @var array
*/
protected $_options = array();
 
/**
* Database-specific string to use for quoting a name or value
* left-hand side (for security reasons and to prevent a name
* from being parsed as a keyword).
* @var string
*/
protected $_leftQuote = '';
/**
* Database-specific string to use for quoting a name or value
* left-hand side (for security reasons and to prevent a name
* from being parsed as a keyword).
* @var string
*/
protected $_rightQuote = '';
/* Status properties */
/**
* Database connection
* @var PDO
*/
145,7 → 165,7
*/
public function escapeName($name)
{
return $name;
return $this->_leftQuote . $name . $this->_rightQuote;
}
/**
183,7 → 203,14
{
foreach ($array as $column => &$value)
{
$value = $value . ' AS ' . $column;
$quotedColumn = $column;
if (strpos($column, $this->_leftQuote) === false
&& strpos($column, $this->_rightQuote) === false)
{
$quotedColumn = $this->_leftQuote . $column . $this->_rightQuote;
}
$value = $value . ' AS ' . $quotedColumn;
}
return $array;
228,7 → 255,7
* @return array
* The escaped array
*/
protected function _escapeValueArray(array &$array, $suffix = '', array &$escape = array('', ''))
protected function _escapeValueArray(array &$array, $suffix = '')
{
$result = array();
250,7 → 277,7
$placeholder = '(' . implode(',', self::_expand($value, $column)) . ')';
}
$result[] = $escape[0] . $column . $escape[1] . "{$op}{$placeholder}{$suffix}";
$result[] = $this->_leftQuote . $column . $this->_rightQuote . "{$op}{$placeholder}{$suffix}";
}
return $result;