Subversion Repositories PHPX

Compare Revisions

Last modification

Ignore whitespace Rev 32 → Rev 31

/trunk/Db/MySQLDB.php
33,18 → 33,6
*/
protected $_charset = null;
/**
* (non-PHPdoc)
* @see Database::_leftQuote
*/
protected $_leftQuote = '`';
/**
* (non-PHPdoc)
* @see Database::_rightQuote
*/
protected $_rightQuote = '`';
public function __construct()
{
$this->_dsn = "mysql:host={$this->_host}"
58,4 → 46,40
parent::__construct();
}
/**
* Escapes a database name so that it can be used in a query.
*
* @param string $name
* The name to be escaped
* @return string
* The escaped name
*/
public function escapeName($name)
{
return '`' . $name . '`';
}
 
/**
* (non-PHPdoc)
* @see Database::_escapeAliasArray()
*/
protected function _escapeAliasArray(array &$array)
{
foreach ($array as $column => &$value)
{
$value = $value . ' AS `' . $column . '`';
}
return $array;
}
 
/**
* (non-PHPdoc)
* @see Database::_escapeValueArray()
*/
protected function _escapeValueArray(array &$array, $suffix = '', array &$escape = array('`', '`'))
{
return parent::_escapeValueArray($array, $suffix, $escape);
}
}
/trunk/Db/ODBCDB.php
10,18 → 10,6
*/
protected $_alias;
/**
* (non-PHPdoc)
* @see Database::_leftQuote
*/
protected $_leftQuote = '[';
/**
* (non-PHPdoc)
* @see Database::_rightQuote
*/
protected $_rightQuote = ']';
public function __construct()
{
// $this->_connection = @odbc_connect($this->_alias, $this->_username, $this->_password);
28,4 → 16,13
$this->_dsn = 'odbc:' . $this->_alias;
parent::__construct();
}
/**
* (non-PHPdoc)
* @see Database::_escapeValueArray()
*/
protected function _escapeValueArray(array &$array, $suffix = '', array &$escape = array('`', '`'))
{
return parent::_escapeValueArray($array, $suffix, $escape);
}
}
/trunk/Db/Database.php
21,8 → 21,6
*/
class Database extends AbstractModel
{
/* Access properties */
/**
* DSN of the database
* @var string
46,26 → 44,8
* @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
*/
165,7 → 145,7
*/
public function escapeName($name)
{
return $this->_leftQuote . $name . $this->_rightQuote;
return $name;
}
/**
203,14 → 183,7
{
foreach ($array as $column => &$value)
{
$quotedColumn = $column;
if (strpos($column, $this->_leftQuote) === false
&& strpos($column, $this->_rightQuote) === false)
{
$quotedColumn = $this->_leftQuote . $column . $this->_rightQuote;
}
$value = $value . ' AS ' . $quotedColumn;
$value = $value . ' AS ' . $column;
}
return $array;
255,7 → 228,7
* @return array
* The escaped array
*/
protected function _escapeValueArray(array &$array, $suffix = '')
protected function _escapeValueArray(array &$array, $suffix = '', array &$escape = array('', ''))
{
$result = array();
277,7 → 250,7
$placeholder = '(' . implode(',', self::_expand($value, $column)) . ')';
}
$result[] = $this->_leftQuote . $column . $this->_rightQuote . "{$op}{$placeholder}{$suffix}";
$result[] = $escape[0] . $column . $escape[1] . "{$op}{$placeholder}{$suffix}";
}
return $result;