GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Fix Row count wrong when grouping joined tables, phpmyadmin/phpmyadmi… · phpmyadmin/sql-parser@2eb3372

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/Components
    • JoinKeyword.php
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/Components/JoinKeyword.php‎

Copy file name to clipboardExpand all lines: src/Components/JoinKeyword.php
+11-3Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ class JoinKeyword extends Component
6262
* @var Condition[]
6363
*/
6464
public $on;
65+
public $using;
6566

6667
/**
6768
* @param Parser $parser The parser that serves as context.
@@ -85,10 +86,12 @@ public static function parse(Parser $parser, TokensList $list, array $options =
8586
*
8687
* 1 -----------------------[ expr ]----------------------> 2
8788
*
88-
* 2 ------------------------[ ON ]-----------------------> 3
89+
* 2 ---------------------[ ON|USING ]--------------------> 3/4
8990
*
9091
* 3 --------------------[ conditions ]-------------------> 0
9192
*
93+
* 4 ----------------------[ columns ]--------------------> 0
94+
*
9295
* @var int $state
9396
*/
9497
$state = 0;
@@ -131,14 +134,19 @@ public static function parse(Parser $parser, TokensList $list, array $options =
131134
$expr->expr = Expression::parse($parser, $list, array('field' => 'table'));
132135
$state = 2;
133136
} elseif ($state === 2) {
134-
if (($token->type === Token::TYPE_KEYWORD) && ($token->value === 'ON')) {
135-
$state = 3;
137+
if (($token->type === Token::TYPE_KEYWORD) && ($token->value === 'ON' || $token->value === 'USING')) {
138+
$state = $token->value === 'ON' ? 3 : 4;
136139
}
137140
} elseif ($state === 3) {
138141
$expr->on = Condition::parse($parser, $list);
139142
$ret[] = $expr;
140143
$expr = new JoinKeyword();
141144
$state = 0;
145+
} elseif ($state === 4) {
146+
$expr->using = ArrayObj::parse($parser, $list);
147+
$ret[] = $expr;
148+
$expr = new JoinKeyword();
149+
$state = 0;
142150
}
143151

144152
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.