MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / parseSnowflakeUseStatement

Method parseSnowflakeUseStatement

pkg/sql/parser/parser.go:754–768  ·  view source on GitHub ↗

parseSnowflakeUseStatement parses: USE [WAREHOUSE | DATABASE | SCHEMA | ROLE] The object-kind keyword is optional (plain "USE " switches the current database). We parse-only; the statement is represented as a DescribeStatement placeholder until a dedicated UseStatement node is introd

()

Source from the content-addressed store, hash-verified

752// database). We parse-only; the statement is represented as a DescribeStatement
753// placeholder until a dedicated UseStatement node is introduced.
754func (p *Parser) parseSnowflakeUseStatement() (ast.Statement, error) {
755 p.advance() // Consume USE
756 // Optional object kind.
757 switch strings.ToUpper(p.currentToken.Token.Value) {
758 case "WAREHOUSE", "DATABASE", "SCHEMA", "ROLE":
759 p.advance()
760 }
761 name, err := p.parseQualifiedName()
762 if err != nil {
763 return nil, p.expectedError("name after USE")
764 }
765 stmt := ast.GetDescribeStatement()
766 stmt.TableName = "USE " + name
767 return stmt, nil
768}
769
770// parseSnowflakeStageStatement parses Snowflake stage operations as stubs:
771//

Callers 1

parseStatementMethod · 0.95

Calls 4

advanceMethod · 0.95
parseQualifiedNameMethod · 0.95
expectedErrorMethod · 0.95
GetDescribeStatementFunction · 0.92

Tested by

no test coverage detected