Convert all SQL keywords to upper case

대소문자를 섞어서 쓰고 있던 SQL 키워드들을 모두 대문자로 통일
as, and, or, like, desc 등이 소문자였음
This commit is contained in:
Kijin Sung 2018-06-30 15:42:52 +09:00
parent 6070707941
commit 83362034cd
6 changed files with 15 additions and 20 deletions

View file

@ -46,7 +46,7 @@ class Condition
$this->column_name = $column_name;
$this->argument = $argument;
$this->operation = $operation;
$this->pipe = $pipe;
$this->pipe = strtoupper($pipe);
}
function getArgument()
@ -208,32 +208,27 @@ class Condition
case 'like_tail' :
case 'like_prefix' :
case 'like' :
if(defined('__CUBRID_VERSION__')
&& __CUBRID_VERSION__ >= '8.4.1')
return $name . ' rlike ' . $value;
else
return $name . ' like ' . $value;
break;
return $name . ' LIKE ' . $value;
case 'notlike_tail' :
case 'notlike_prefix' :
case 'notlike' :
return $name . ' not like ' . $value;
return $name . ' NOT LIKE ' . $value;
break;
case 'in' :
return $name . ' in ' . $value;
return $name . ' IN ' . $value;
break;
case 'notin' :
case 'not_in' :
return $name . ' not in ' . $value;
return $name . ' NOT IN ' . $value;
break;
case 'notequal' :
return $name . ' <> ' . $value;
break;
case 'notnull' :
return $name . ' is not null';
return $name . ' IS NOT NULL ';
break;
case 'null' :
return $name . ' is null';
return $name . ' IS NULL ';
break;
case 'and' :
return $name . ' & ' . $value;
@ -248,7 +243,7 @@ class Condition
return $name . ' ~ ' . $value;
break;
case 'between' :
return $name . ' between ' . $value[0] . ' and ' . $value[1];
return $name . ' BETWEEN ' . $value[0] . ' AND ' . $value[1];
break;
}
}

View file

@ -68,7 +68,7 @@ class ConditionWithArgument extends Condition
$q = '?';
}
}
return $this->pipe . ' ' . $this->getConditionPart($q);
return strtoupper($this->pipe) . ' ' . $this->getConditionPart($q);
}
/**

View file

@ -42,7 +42,7 @@ class SelectExpression extends Expression
*/
function getExpression()
{
return sprintf("%s%s", $this->column_name, $this->column_alias ? " as " . $this->column_alias : "");
return sprintf("%s%s", $this->column_name, $this->column_alias ? (' AS ' . $this->column_alias) : "");
}
function show()

View file

@ -37,7 +37,7 @@ class OrderByColumn
{
$result = $this->getColumnName();
$result .= ' ';
$result .= is_a($this->sort_order, 'Argument') ? $this->sort_order->getValue() : $this->sort_order;
$result .= is_a($this->sort_order, 'Argument') ? $this->sort_order->getValue() : strtoupper($this->sort_order);
return $result;
}

View file

@ -41,9 +41,9 @@ class JoinTable extends Table
function toString($with_value = true)
{
$part = $this->join_type . ' ' . $this->name;
$part .= $this->alias ? ' as ' . $this->alias : '';
$part .= ' on ';
$part = strtoupper($this->join_type) . ' ' . $this->name;
$part .= $this->alias ? (' AS ' . $this->alias) : '';
$part .= ' ON ';
foreach($this->conditions as $conditionGroup)
{
$part .= $conditionGroup->toString($with_value);

View file

@ -36,7 +36,7 @@ class Table
function toString()
{
//return $this->name;
return sprintf("%s%s", $this->name, $this->alias ? ' as ' . $this->alias : '');
return sprintf("%s%s", $this->name, $this->alias ? (' AS ' . $this->alias) : '');
}
function getName()