Fixed condition tag bug.

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8393 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-05-23 09:28:18 +00:00
parent 52c3d503bc
commit c40ccf777f
3 changed files with 12 additions and 9 deletions

View file

@ -117,7 +117,7 @@ class QueryParser {
$prebuff = '';
foreach($arguments as $argument){
if($argument->getArgumentName()){
if(isset($argument) && $argument->getArgumentName()){
$prebuff .= $argument->toString();
$prebuff .= sprintf("$%s_argument->escapeValue('%s');\n"
, $argument->getArgumentName()

View file

@ -17,7 +17,7 @@
}
if(!$this->argument_name) $this->argument_name = $tag->attrs->name;
if(!$this->argument_name) $this->argument_name = $tag->attrs->column;
if(!$this->argument_name) $this->argument_name = str_replace('.', '_', $condition->attrs->column);
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php');
$this->argument_validator = new QueryArgumentValidator($tag);

View file

@ -21,12 +21,15 @@
$this->pipe = $condition->attrs->pipe;
$dbParser = XmlQueryParser::getDBParser();
$this->column_name = $dbParser->parseColumnName($condition->attrs->column);
// TODO fix this hack - argument_name is initialized in three places :) [ here, queryArgument and queryArgumentValidator]
$this->argument_name = $condition->attrs->var;
if(!$this->argument_name) $this->argument_name = $condition->attrs->column;
$this->default_column = $dbParser->parseColumnName($condition->attrs->default);
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
$this->argument = new QueryArgument($condition);
if($condition->attrs->var){
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
$this->argument_name = $condition->attrs->var;
$this->argument = new QueryArgument($condition);
}
else {
$this->default_column = $dbParser->parseColumnName($condition->attrs->default);
}
}
function setPipe($pipe){
@ -40,7 +43,7 @@
function getConditionString(){
return sprintf("new Condition('%s',%s,%s%s)"
, $this->column_name
, $this->argument_name ? '$' . $this->argument_name . '_argument->getValue()' : "'" . $this->default_column . "'"
, $this->default_column ? "'" . $this->default_column . "'" : '$' . $this->argument_name . '_argument->getValue()'
, '"'.$this->operation.'"'
, $this->pipe ? ", '" . $this->pipe . "'" : ''
);