MCPcopy Create free account
hub / github.com/dolthub/doltgresql / nodeSelect

Function nodeSelect

server/ast/select.go:29–75  ·  view source on GitHub ↗

nodeSelect handles *tree.Select nodes.

(ctx *Context, node *tree.Select)

Source from the content-addressed store, hash-verified

27
28// nodeSelect handles *tree.Select nodes.
29func nodeSelect(ctx *Context, node *tree.Select) (vitess.SelectStatement, error) {
30 if node == nil {
31 return nil, nil
32 }
33 if node.Select == nil {
34 node.Select = &tree.ValuesClause{
35 Rows: []tree.Exprs{},
36 }
37 }
38 selectStmt, err := nodeSelectStatement(ctx, node.Select)
39 if err != nil {
40 return nil, err
41 }
42 orderBy, err := nodeOrderBy(ctx, node.OrderBy)
43 if err != nil {
44 return nil, err
45 }
46 with, err := nodeWith(ctx, node.With)
47 if err != nil {
48 return nil, err
49 }
50 limit, err := nodeLimit(ctx, node.Limit)
51 if err != nil {
52 return nil, err
53 }
54 _, err = nodeLockingClause(ctx, node.Locking)
55 if err != nil {
56 return nil, err
57 }
58
59 switch selectStmt := selectStmt.(type) {
60 case *vitess.ParenSelect:
61 return selectStmt, nil
62 case *vitess.Select:
63 selectStmt.OrderBy = orderBy
64 selectStmt.With = with
65 selectStmt.Limit = limit
66 return selectStmt, nil
67 case *vitess.SetOp:
68 selectStmt.OrderBy = orderBy
69 selectStmt.With = with
70 selectStmt.Limit = limit
71 return selectStmt, nil
72 default:
73 return nil, errors.Errorf("SELECT has encountered an unknown clause: `%T`", selectStmt)
74 }
75}
76
77// nodeSelectStatement handles tree.SelectStatement nodes.
78func nodeSelectStatement(ctx *Context, node tree.SelectStatement) (vitess.SelectStatement, error) {

Callers 8

ConvertFunction · 0.85
nodeCreateTableFunction · 0.85
nodeExplainFunction · 0.85
nodeCreateViewFunction · 0.85
nodeUnionClauseFunction · 0.85
nodeInsertFunction · 0.85
nodeParenSelectFunction · 0.85
nodeCTEFunction · 0.85

Calls 6

nodeSelectStatementFunction · 0.85
nodeOrderByFunction · 0.85
nodeWithFunction · 0.85
nodeLimitFunction · 0.85
nodeLockingClauseFunction · 0.85
ErrorfMethod · 0.65

Tested by

no test coverage detected