(core *parser.Select_coreContext)
| 530 | } |
| 531 | |
| 532 | func (c *cc) getTables(core *parser.Select_coreContext) []ast.Node { |
| 533 | if core.Join_clause() != nil { |
| 534 | join := core.Join_clause().(*parser.Join_clauseContext) |
| 535 | tables := c.convertTablesOrSubquery(join.AllTable_or_subquery()) |
| 536 | table := tables[0] |
| 537 | for i, t := range tables[1:] { |
| 538 | joinExpr := &ast.JoinExpr{ |
| 539 | Larg: table, |
| 540 | Rarg: t, |
| 541 | } |
| 542 | jo := join.Join_operator(i) |
| 543 | if jo.NATURAL_() != nil { |
| 544 | joinExpr.IsNatural = true |
| 545 | } |
| 546 | switch { |
| 547 | case jo.CROSS_() != nil || jo.INNER_() != nil: |
| 548 | joinExpr.Jointype = ast.JoinTypeInner |
| 549 | case jo.LEFT_() != nil: |
| 550 | joinExpr.Jointype = ast.JoinTypeLeft |
| 551 | case jo.RIGHT_() != nil: |
| 552 | joinExpr.Jointype = ast.JoinTypeRight |
| 553 | case jo.FULL_() != nil: |
| 554 | joinExpr.Jointype = ast.JoinTypeFull |
| 555 | } |
| 556 | jc := join.Join_constraint(i) |
| 557 | switch { |
| 558 | case jc.ON_() != nil: |
| 559 | joinExpr.Quals = c.convert(jc.Expr()) |
| 560 | case jc.USING_() != nil: |
| 561 | var using ast.List |
| 562 | for _, cn := range jc.AllColumn_name() { |
| 563 | using.Items = append(using.Items, NewIdentifier(cn.GetText())) |
| 564 | } |
| 565 | joinExpr.UsingClause = &using |
| 566 | } |
| 567 | table = joinExpr |
| 568 | } |
| 569 | return []ast.Node{table} |
| 570 | } else { |
| 571 | return c.convertTablesOrSubquery(core.AllTable_or_subquery()) |
| 572 | } |
| 573 | } |
| 574 | |
| 575 | func (c *cc) getCols(core *parser.Select_coreContext) []ast.Node { |
| 576 | var cols []ast.Node |
no test coverage detected