64 $this->operation = $condition->attrs->operation;
65 $this->pipe = $condition->attrs->pipe;
67 $this->column_name = $dbParser->parseExpression($condition->attrs->column);
70 if($isColumnName = (strpos($condition->attrs->default,
'.') !== FALSE
71 && strpos($condition->attrs->default,
'.') !== 0
72 && strpos($condition->attrs->default,
'%') === FALSE ))
74 $condition->attrs->default = $dbParser->parseExpression($condition->attrs->default);
77 if($condition->node_name ==
'query')
79 $this->query =
new QueryTag($condition, TRUE);
80 $this->default_column = $this->query->toString();
82 else if($condition->attrs->var && !strpos($condition->attrs->var,
'.'))
85 $this->argument_name = $this->argument->getArgumentName();
89 if(isset($condition->attrs->default))
91 $operationList = array(
'in' => 1,
'between' => 1,
'notin' => 1,
'not_in' => 1);
92 if(isset($operationList[$this->operation]))
94 $default_value = $condition->attrs->default;
95 if(strpos($default_value,
"'") !== FALSE)
97 $default_value =
"\"" . $default_value .
"\"";
101 $default_value =
"'" . $default_value .
"'";
106 $default_value_object =
new DefaultValue($this->column_name, $condition->attrs->default);
107 $default_value = $default_value_object->toString();
109 if($default_value_object->isStringFromFunction())
111 $default_value =
'"\'".' . $default_value .
'."\'"';
114 if($default_value_object->isString() && !$isColumnName && !is_numeric($condition->attrs->default))
116 if(strpos($default_value,
"'") !== FALSE)
118 $default_value =
"\"" . $default_value .
"\"";
122 $default_value =
"'" . $default_value .
"'";
126 $this->default_column = $default_value;
130 $this->default_column =
"'" . $dbParser->parseColumnName($condition->attrs->var) .
"'";
142 $arguments = array();
145 $arguments = array_merge($arguments, $this->query->getArguments());
158 return sprintf(
"new ConditionSubquery('%s',%s,%s%s)"
160 , $this->default_column
161 ,
'"' . $this->operation .
'"'
162 , $this->pipe ?
", '" . $this->pipe .
"'" :
''
165 else if(isset($this->default_column))
167 return sprintf(
"new ConditionWithoutArgument('%s',%s,%s%s)"
169 , $this->default_column
170 ,
'"' . $this->operation .
'"'
171 , $this->pipe ?
", '" . $this->pipe .
"'" :
''
176 return sprintf(
"new ConditionWithArgument('%s',%s,%s%s)"
178 ,
'$' . $this->argument_name .
'_argument'
179 ,
'"' . $this->operation .
'"'
180 , $this->pipe ?
", '" . $this->pipe .
"'" :
''