From abba8761cccdef26c8f454e0bb917b660ac86ae9 Mon Sep 17 00:00:00 2001 From: mosmartin Date: Mon, 23 May 2011 08:42:16 +0000 Subject: [PATCH] fixed an issue when default argument name is column name git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8391 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/xml/xmlquery/argument/Argument.class.php | 2 +- classes/xml/xmlquery/queryargument/QueryArgument.class.php | 2 ++ .../queryargument/validator/QueryArgumentValidator.class.php | 1 + classes/xml/xmlquery/tags/condition/ConditionTag.class.php | 3 ++- 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/xml/xmlquery/argument/Argument.class.php b/classes/xml/xmlquery/argument/Argument.class.php index 23cb46539..8e8e3fb88 100644 --- a/classes/xml/xmlquery/argument/Argument.class.php +++ b/classes/xml/xmlquery/argument/Argument.class.php @@ -34,7 +34,7 @@ if(!isset($this->value)) return; if($column_type === '') return; //if($column_type === '') $column_type = 'varchar'; - if(in_array($column_type, array('date', 'varchar', 'char'))) + if(in_array($column_type, array('date', 'varchar', 'char', 'bigtext'))) $this->value = '\''.$this->value.'\''; } diff --git a/classes/xml/xmlquery/queryargument/QueryArgument.class.php b/classes/xml/xmlquery/queryargument/QueryArgument.class.php index b18e6d784..a8df696f7 100644 --- a/classes/xml/xmlquery/queryargument/QueryArgument.class.php +++ b/classes/xml/xmlquery/queryargument/QueryArgument.class.php @@ -17,6 +17,8 @@ } if(!$this->argument_name) $this->argument_name = $tag->attrs->name; + if(!$this->argument_name) $this->argument_name = $tag->attrs->column; + require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php'); $this->argument_validator = new QueryArgumentValidator($tag); diff --git a/classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php b/classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php index 371dd33c3..9c4d478df 100644 --- a/classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php +++ b/classes/xml/xmlquery/queryargument/validator/QueryArgumentValidator.class.php @@ -14,6 +14,7 @@ function QueryArgumentValidator($tag){ $this->argument_name = $tag->attrs->var; if(!$this->argument_name) $this->argument_name = $tag->attrs->name; + if(!$this->argument_name) $this->argument_name = $tag->attrs->column; $this->default_value = $tag->attrs->default; $this->notnull = $tag->attrs->notnull; $this->filter = $tag->attrs->filter; diff --git a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php index ae5eb08d2..563f2c4e0 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php @@ -22,8 +22,9 @@ $this->operation = $condition->attrs->operation; $this->pipe = $condition->attrs->pipe; $this->column_name = $this->dbParser->parseColumnName($condition->attrs->column); - // TODO fix this hack - should use default value for query argument + // 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 = $this->dbParser->parseColumnName($condition->attrs->default); require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php'); $this->argument = new QueryArgument($condition);