fix Argument and Condition argument type

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8562 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
lickawtl 2011-07-05 08:15:27 +00:00
parent 909276e16b
commit 013ada255d
5 changed files with 61 additions and 41 deletions

View file

@ -2,10 +2,16 @@
class ConditionArgument extends Argument {
var $operation;
var $type;
function ConditionArgument($name, $value, $operation){
parent::Argument($name, $value);
$this->operation = $operation;
if($this->type !== 'date'){
$dbParser = XmlQueryParser::getDBParser();
$this->value = $dbParser->escapeStringValue($this->value);
}
}
function createConditionValue(){
@ -119,6 +125,35 @@
*/
}
}
function getType(){
return $this->type;
}
function setColumnType($column_type){
if(!isset($this->value)) return;
if($column_type === '') return;
$this->type = $column_type;
//if($column_type === '') $column_type = 'varchar';
}
function escapeValue($value){
if(in_array($this->type, array('date', 'varchar', 'char','text', 'bigtext'))){
if(!is_array($value))
$value = '\''.$value.'\'';
else {
$total = count($value);
for($i = 0; $i < $total; $i++)
$value[$i] = '\''.$value[$i].'\'';
}
}
return $value;
}
}
?>