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

Method parseQualifiedName

pkg/sql/parser/parser.go:1026–1044  ·  view source on GitHub ↗

parseQualifiedName parses a potentially schema-qualified name (e.g., schema.table or db.schema.table). Returns the full dotted name as a string. Supports up to 3-part names.

()

Source from the content-addressed store, hash-verified

1024// parseQualifiedName parses a potentially schema-qualified name (e.g., schema.table or db.schema.table).
1025// Returns the full dotted name as a string. Supports up to 3-part names.
1026func (p *Parser) parseQualifiedName() (string, error) {
1027 if !p.isIdentifier() && !p.isNonReservedKeyword() {
1028 return "", p.expectedError("identifier")
1029 }
1030 name := p.currentToken.Token.Value
1031 p.advance()
1032
1033 // Check for schema.table or db.schema.table
1034 for p.isType(models.TokenTypePeriod) {
1035 p.advance() // Consume .
1036 if !p.isIdentifier() && !p.isNonReservedKeyword() {
1037 return "", p.expectedError("identifier after .")
1038 }
1039 name = name + "." + p.currentToken.Token.Value
1040 p.advance()
1041 }
1042
1043 return name, nil
1044}
1045
1046// Accepts IDENT or non-reserved keywords that can be used as table names
1047func (p *Parser) parseTableReference() (*ast.TableReference, error) {

Callers 15

parseCreateStatementMethod · 0.95
parseCreateTableMethod · 0.95
parseDropStatementMethod · 0.95
parseDeleteStatementMethod · 0.95
parseTableReferenceMethod · 0.95
parseUpdateStatementMethod · 0.95
parseInsertStatementMethod · 0.95
parseCreateViewMethod · 0.95
parseRefreshStatementMethod · 0.95

Calls 5

isIdentifierMethod · 0.95
isNonReservedKeywordMethod · 0.95
expectedErrorMethod · 0.95
advanceMethod · 0.95
isTypeMethod · 0.95

Tested by

no test coverage detected