mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-30 15:52:17 +09:00
Issue 343 - Problem when condition have var and default attribute both.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9482 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3815aece09
commit
36211cb65b
5 changed files with 120 additions and 28 deletions
|
|
@ -29,6 +29,24 @@
|
|||
|
||||
function toString(){
|
||||
$validator = '';
|
||||
if($this->filter){
|
||||
$validator .= sprintf("$%s_argument->checkFilter('%s');\n"
|
||||
, $this->argument_name
|
||||
, $this->filter
|
||||
);
|
||||
}
|
||||
if($this->min_length){
|
||||
$validator .= sprintf("$%s_argument->checkMinLength(%s);\n"
|
||||
, $this->argument_name
|
||||
, $this->min_length
|
||||
);
|
||||
}
|
||||
if($this->max_length){
|
||||
$validator .= sprintf("$%s_argument->checkMaxLength(%s);\n"
|
||||
, $this->argument_name
|
||||
, $this->max_length
|
||||
);
|
||||
}
|
||||
if(isset($this->default_value)){
|
||||
$this->default_value = new DefaultValue($this->argument_name, $this->default_value);
|
||||
if($this->default_value->isSequence())
|
||||
|
|
@ -48,24 +66,6 @@
|
|||
, $this->argument_name
|
||||
);
|
||||
}
|
||||
if($this->filter){
|
||||
$validator .= sprintf("$%s_argument->checkFilter('%s');\n"
|
||||
, $this->argument_name
|
||||
, $this->filter
|
||||
);
|
||||
}
|
||||
if($this->min_length){
|
||||
$validator .= sprintf("$%s_argument->checkMinLength(%s);\n"
|
||||
, $this->argument_name
|
||||
, $this->min_length
|
||||
);
|
||||
}
|
||||
if($this->max_length){
|
||||
$validator .= sprintf("$%s_argument->checkMaxLength(%s);\n"
|
||||
, $this->argument_name
|
||||
, $this->max_length
|
||||
);
|
||||
}
|
||||
return $validator;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,20 +23,25 @@
|
|||
$dbParser = DB::getParser();
|
||||
$this->column_name = $dbParser->parseColumnName($condition->attrs->column);
|
||||
|
||||
$isColumnName = strpos($condition->attrs->default, '.');
|
||||
$isColumnName = $isColumnName || strpos($condition->attrs->var, '.');
|
||||
// If default value is column name, it should be escaped
|
||||
if($isColumnName = strpos($condition->attrs->default, '.')){
|
||||
$condition->attrs->default = $dbParser->parseColumnName($condition->attrs->default);
|
||||
}
|
||||
|
||||
if($condition->node_name == 'query'){
|
||||
$this->query = new QueryTag($condition, true);
|
||||
$this->default_column = $this->query->toString();
|
||||
}
|
||||
else if(($condition->attrs->var && !$isColumnName) || $isColumnName === false){
|
||||
else if($condition->attrs->var && !strpos($condition->attrs->var, '.')){
|
||||
$this->argument = new QueryArgument($condition);
|
||||
$this->argument_name = $this->argument->getArgumentName();
|
||||
}
|
||||
else {
|
||||
if($condition->attrs->default)
|
||||
$this->default_column = "'" . $dbParser->parseColumnName($condition->attrs->default) . "'" ;
|
||||
if($condition->attrs->default){
|
||||
if(!$isColumnName && !is_numeric($condition->attrs->default))
|
||||
$condition->attrs->default = "\'" . $condition->attrs->default . "\'";
|
||||
$this->default_column = "'" . $condition->attrs->default . "'" ;
|
||||
}
|
||||
else
|
||||
$this->default_column = "'" . $dbParser->parseColumnName($condition->attrs->var) . "'" ;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue