Normalize quote_ident method
This commit is contained in:
parent
ace22357f6
commit
b3306772f9
@ -23,6 +23,7 @@ abstract class DB_PDO extends PDO {
|
|||||||
|
|
||||||
public $manip;
|
public $manip;
|
||||||
protected $statement;
|
protected $statement;
|
||||||
|
protected $escape_char = '"';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDO constructor wrapper
|
* PDO constructor wrapper
|
||||||
@ -172,7 +173,9 @@ abstract class DB_PDO extends PDO {
|
|||||||
// Split each identifier by the period
|
// Split each identifier by the period
|
||||||
$hiers = explode('.', $ident);
|
$hiers = explode('.', $ident);
|
||||||
|
|
||||||
return '"'.implode('"."', $hiers).'"';
|
return $this->escape_char .
|
||||||
|
implode("{$this->escape_char}.{$this->escape_char}", $hiers) .
|
||||||
|
$this->escape_char;
|
||||||
}
|
}
|
||||||
|
|
||||||
// -------------------------------------------------------------------------
|
// -------------------------------------------------------------------------
|
||||||
|
@ -19,6 +19,8 @@
|
|||||||
*/
|
*/
|
||||||
class MySQL extends DB_PDO {
|
class MySQL extends DB_PDO {
|
||||||
|
|
||||||
|
protected $escape_char = '`';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Connect to MySQL Database
|
* Connect to MySQL Database
|
||||||
*
|
*
|
||||||
@ -83,26 +85,5 @@ class MySQL extends DB_PDO {
|
|||||||
{
|
{
|
||||||
return isset($this->statement) ? $this->statement->rowCount() : FALSE;
|
return isset($this->statement) ? $this->statement->rowCount() : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// --------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Surrounds the string with the databases identifier escape characters
|
|
||||||
*
|
|
||||||
* @param string $ident
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function quote_ident($ident)
|
|
||||||
{
|
|
||||||
if (is_array($ident))
|
|
||||||
{
|
|
||||||
return array_map(array($this, 'quote_ident'), $ident);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Split each identifier by the period
|
|
||||||
$hiers = explode('.', $ident);
|
|
||||||
|
|
||||||
return '`'.implode('`.`', $hiers).'`';
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
//End of mysql_driver.php
|
//End of mysql_driver.php
|
Binary file not shown.
Reference in New Issue
Block a user