mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8658 201d5d3c-b55e-5fd7-737f-ddc643e51545
56 lines
No EOL
1.7 KiB
PHP
56 lines
No EOL
1.7 KiB
PHP
<?php
|
|
|
|
class ConditionArgument extends Argument {
|
|
var $operation;
|
|
|
|
|
|
function ConditionArgument($name, $value, $operation){
|
|
if(isset($value) && in_array($operation, array('in', 'not in', 'between')) && !is_array($value)){
|
|
$value = explode(',', $value);
|
|
}
|
|
parent::Argument($name, $value);
|
|
$this->operation = $operation;
|
|
|
|
if($this->type !== 'date'){
|
|
$dbParser = XmlQueryParser::getDBParser();
|
|
$this->value = $dbParser->escapeStringValue($this->value);
|
|
}
|
|
}
|
|
|
|
function createConditionValue(){
|
|
if(!isset($this->value)) return;
|
|
|
|
$name = $this->column_name;
|
|
$operation = $this->operation;
|
|
$value = $this->value;
|
|
|
|
switch($operation) {
|
|
case 'like_prefix' :
|
|
$this->value = $value.'%';
|
|
break;
|
|
case 'like_tail' :
|
|
$this->value = '%'.$value;
|
|
break;
|
|
case 'like' :
|
|
$this->value = '%'.$value.'%';
|
|
break;
|
|
case 'in':
|
|
if(!is_array($value)) $this->value = array($value);
|
|
break;
|
|
}
|
|
}
|
|
|
|
function getType(){
|
|
return $this->type;
|
|
}
|
|
|
|
function setColumnType($column_type){
|
|
if(!isset($this->value)) return;
|
|
if($column_type === '') return;
|
|
|
|
$this->type = $column_type;
|
|
}
|
|
|
|
}
|
|
|
|
?>
|