diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 59501f161..6ee269ba5 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -666,7 +666,7 @@ /** * @brief Paging is handled if navigation information exists in the query xml * - * It is quite convenient although its structure is not good at all .. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $index_hint, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); diff --git a/classes/db/queryparts/condition/Condition.class.php b/classes/db/queryparts/condition/Condition.class.php index ea8657b71..4db069e72 100644 --- a/classes/db/queryparts/condition/Condition.class.php +++ b/classes/db/queryparts/condition/Condition.class.php @@ -17,8 +17,8 @@ return $this->pipe . ' ' . $this->getConditionPart($this->column_name, $this->value, $this->operation); } - function getConditionPart($name, $value, $operation) { - switch($operation) { + function show(){ + switch($this->operation) { case 'equal' : case 'more' : case 'excess' : @@ -31,16 +31,19 @@ case 'notin' : case 'notequal' : // if variable is not set or is not string or number, return - if(!isset($value)) return; - if($value === '') return; - if(!in_array(gettype($value), array('string', 'integer'))) return; + if(!isset($this->value)) return false; + if($this->value === '') return false; + if(!in_array(gettype($this->value), array('string', 'integer'))) return false; break; case 'between' : - if(!is_array($value)) return; - if(count($value)!=2) return; - - } + if(!is_array($this->value)) return false; + if(count($this->value)!=2) return false; + } + return true; + } + + function getConditionPart($name, $value, $operation) { switch($operation) { case 'equal' : return $name.' = '.$value; diff --git a/classes/db/queryparts/condition/ConditionGroup.class.php b/classes/db/queryparts/condition/ConditionGroup.class.php index ecf5870f1..bc3a1b888 100644 --- a/classes/db/queryparts/condition/ConditionGroup.class.php +++ b/classes/db/queryparts/condition/ConditionGroup.class.php @@ -15,7 +15,8 @@ else $group = ''; foreach($this->conditions as $condition){ - $group .= $condition->toString() . ' '; + if($condition->show()) + $group .= $condition->toString() . ' '; } if($this->pipe !== "") diff --git a/classes/xml/xmlquery/QueryParser.class.php b/classes/xml/xmlquery/QueryParser.class.php index 00f95d5b8..852aeced1 100644 --- a/classes/xml/xmlquery/QueryParser.class.php +++ b/classes/xml/xmlquery/QueryParser.class.php @@ -95,7 +95,6 @@ class QueryParser { } function toString(){ - // TODO Add tags for update, insert .. if($this->action == 'select'){ $columns = new SelectColumnsTag($this->query->columns->column, $this->dbParser); }else if($this->action == 'insert'){ diff --git a/classes/xml/xmlquery/argument/Argument.class.php b/classes/xml/xmlquery/argument/Argument.class.php index 9b88296bb..f24dd4a20 100644 --- a/classes/xml/xmlquery/argument/Argument.class.php +++ b/classes/xml/xmlquery/argument/Argument.class.php @@ -31,6 +31,8 @@ } function escapeValue($column_type){ + if(!isset($this->value)) return; + if($column_type === '') $column_type = 'varchar'; if(in_array($column_type, array('date', 'varchar', 'char'))) $this->value = '\''.$this->value.'\''; } diff --git a/classes/xml/xmlquery/tags/condition/ConditionsTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionsTag.class.php index 864634131..ef174bc2e 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionsTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionsTag.class.php @@ -15,6 +15,7 @@ $xml_groups = $xml_conditions->group; if($xml_groups){ + if(!is_array($xml_groups)) $xml_groups = array($xml_groups); require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionGroupTag.class.php'); foreach($xml_groups as $group){ $this->condition_groups[] = new ConditionGroupTag($group->condition, $this->dbParser, $group->pipe);