mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 04:24:14 +09:00
Added support for addQuotes - escpaes special charcters in query arguments.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8585 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
652cc1549a
commit
54ef159878
2 changed files with 10 additions and 3 deletions
|
|
@ -121,7 +121,6 @@
|
||||||
/**
|
/**
|
||||||
* @brief handles quatation of the string variables from the query
|
* @brief handles quatation of the string variables from the query
|
||||||
**/
|
**/
|
||||||
// TODO Make sure this is handled in DBParser class
|
|
||||||
function addQuotes($string)
|
function addQuotes($string)
|
||||||
{
|
{
|
||||||
if (!$this->fd) return $string;
|
if (!$this->fd) return $string;
|
||||||
|
|
|
||||||
|
|
@ -50,16 +50,24 @@
|
||||||
if(!isset($value) || $value === '') return null;
|
if(!isset($value) || $value === '') return null;
|
||||||
if(in_array($this->type, array('date', 'varchar', 'char','text', 'bigtext'))){
|
if(in_array($this->type, array('date', 'varchar', 'char','text', 'bigtext'))){
|
||||||
if(!is_array($value))
|
if(!is_array($value))
|
||||||
$value = '\''.$value.'\'';
|
$value = $this->_escapeStringValue ($value);
|
||||||
else {
|
else {
|
||||||
$total = count($value);
|
$total = count($value);
|
||||||
for($i = 0; $i < $total; $i++)
|
for($i = 0; $i < $total; $i++)
|
||||||
$value[$i] = '\''.$value[$i].'\'';
|
$value[$i] = $this->_escapeStringValue($value[$i]);
|
||||||
|
//$value[$i] = '\''.$value[$i].'\'';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _escapeStringValue($value){
|
||||||
|
$db = &DB::getInstance();
|
||||||
|
$value = $db->addQuotes($value);
|
||||||
|
return '\''.$value.'\'';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function isValid(){
|
function isValid(){
|
||||||
return $this->isValid;
|
return $this->isValid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue