mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-14 00:39:57 +09:00
Fixed join condidition bug: if the user specifies the "pipe" attribute of a condition in a join cause, it should be ignored (otherwise the sql string is like INNER JOIN ... ON AND a = b). Fixed order by bug.
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0-DB@8387 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
520300fad1
commit
d3067703a4
10 changed files with 31 additions and 12 deletions
|
|
@ -7,6 +7,7 @@ require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/UpdateColumnsTag.class.
|
|||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/column/DeleteColumnsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/table/TablesTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/ConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/condition/JoinConditionsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/group/GroupsTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/NavigationTag.class.php');
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/tags/navigation/IndexTag.class.php');
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@
|
|||
|
||||
function escapeValue($column_type){
|
||||
if(!isset($this->value)) return;
|
||||
if($column_type === '') $column_type = 'varchar';
|
||||
if($column_type === '') return;
|
||||
//if($column_type === '') $column_type = 'varchar';
|
||||
if(in_array($column_type, array('date', 'varchar', 'char')))
|
||||
$this->value = '\''.$this->value.'\'';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,8 +19,9 @@
|
|||
if(!isset($this->value)) return;
|
||||
|
||||
$str_pos = strpos($this->value, '(');
|
||||
// TODO Replace this with parseExpression
|
||||
if($str_pos===false) return '"'.$this->value.'"';
|
||||
// // TODO Replace this with parseExpression
|
||||
if($str_pos===false) return '\''.$this->value.'\'';
|
||||
//if($str_pos===false) return $this->value;
|
||||
|
||||
$func_name = substr($this->value, 0, $str_pos);
|
||||
$args = substr($this->value, $str_pos+1, strlen($value)-1);
|
||||
|
|
@ -52,7 +53,8 @@
|
|||
$val = sprintf('"%s*%d"', $this->column_name, $args);
|
||||
break;
|
||||
default :
|
||||
$val = '"' . $this->value . '"';
|
||||
$val = '\'' . $this->value . '\'';
|
||||
//$val = $this->value;
|
||||
}
|
||||
|
||||
return $val;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@
|
|||
$this->argument = new QueryArgument($condition);
|
||||
}
|
||||
|
||||
function setPipe($pipe){
|
||||
$this->pipe = $pipe;
|
||||
}
|
||||
|
||||
function getArgument(){
|
||||
return $this->argument;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
class JoinConditionsTag extends ConditionsTag {
|
||||
|
||||
function JoinConditionsTag($xml_conditions, $dbParser){
|
||||
parent::ConditionsTag($xml_conditions, $dbParser);
|
||||
$this->condition_groups[0]->conditions[0]->setPipe("");
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
function IndexTag($index, $dbParser){
|
||||
$this->dbParser = $dbParser;
|
||||
$this->argument_name = $index->attrs->var;
|
||||
//$index->attrs->default = $this->dbParser->parseExpression($index->attrs->default);
|
||||
$index->attrs->default = $this->dbParser->parseExpression($index->attrs->default);
|
||||
$this->default = $index->attrs->default;
|
||||
require_once(_XE_PATH_.'classes/xml/xmlquery/queryargument/QueryArgument.class.php');
|
||||
$this->argument = new QueryArgument($index);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
function getTableString(){
|
||||
if($this->isJoinTable()){
|
||||
$conditionsTag = new ConditionsTag($this->conditions, $this->dbParser);
|
||||
$conditionsTag = new JoinConditionsTag($this->conditions, $this->dbParser);
|
||||
return sprintf('new JoinTable(\'%s\', \'%s\', "%s", %s)'
|
||||
, $this->dbParser->escape($this->name)
|
||||
, $this->dbParser->escape($this->alias)
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
<condition operation="equal" column="modules.site_srl" var="site_srl" default="0" notnull="notnull" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="modules.module" order="asc" />
|
||||
<index var="sort_index" default="module_categories.title" order="asc" />
|
||||
<index var="sort_index" default="modules.mid" order="asc" />
|
||||
<index var="sort_index1" default="modules.module" order="asc" />
|
||||
<index var="sort_index2" default="module_categories.title" order="asc" />
|
||||
<index var="sort_index3" default="modules.mid" order="asc" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<condition operation="equal" column="sites.site_srl" default="modules.site_srl" pipe="and" />
|
||||
</conditions>
|
||||
<navigation>
|
||||
<index var="sort_index" default="modules.module" order="asc" />
|
||||
<index var="sort_index" default="modules.mid" order="asc" />
|
||||
<index var="sort_index1" default="modules.module" order="asc" />
|
||||
<index var="sort_index2" default="modules.mid" order="asc" />
|
||||
</navigation>
|
||||
</query>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue