Skip to content

Commit 74573c8

Browse files
authored
Merge pull request #201 from oohook/master
Update PositionCalculator.php Thank you for your contribution.
2 parents ef1377d + d4179ff commit 74573c8

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

src/PHPSQLParser/builders/GroupByBuilder.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ protected function buildGroupByAlias($parsed) {
7171
$builder = new GroupByAliasBuilder();
7272
return $builder->build($parsed);
7373
}
74+
75+
protected function buildGroupByExpression($parsed) {
76+
$builder = new GroupByExpressionBuilder();
77+
return $builder->build($parsed);
78+
}
7479

7580
public function build(array $parsed) {
7681
$sql = "";
@@ -79,8 +84,9 @@ public function build(array $parsed) {
7984
$sql .= $this->buildColRef($v);
8085
$sql .= $this->buildPosition($v);
8186
$sql .= $this->buildFunction($v);
87+
$sql .= $this->buildGroupByExpression($v);
8288
$sql .= $this->buildGroupByAlias($v);
83-
89+
8490
if ($len == strlen($sql)) {
8591
throw new UnableToCreateSQLException('GROUP', $k, $v, 'expr_type');
8692
}

src/PHPSQLParser/positions/PositionCalculator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ protected function findPositionWithinString($sql, $value, $expr_type) {
156156
// whitespace, comma, parenthesis, digit or letter, end_of_string
157157
// an operator should not be surrounded by another operator
158158

159-
if ($expr_type === 'operator') {
159+
if (in_array($expr_type,array('operator','column-list'),true)) {
160160

161161
$ok = ($before === "" || in_array($before, self::$allowedOnOperator, true))
162162
|| (strtolower($before) >= 'a' && strtolower($before) <= 'z');

0 commit comments

Comments
 (0)