MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / parse_relvar

Method parse_relvar

crates/sql-parser/src/parser/mod.rs:80–108  ·  view source on GitHub ↗

Parse a table reference in a FROM clause

(expr: TableFactor)

Source from the content-addressed store, hash-verified

78
79 /// Parse a table reference in a FROM clause
80 fn parse_relvar(expr: TableFactor) -> SqlParseResult<(SqlIdent, SqlIdent)> {
81 match expr {
82 // Relvar no alias
83 TableFactor::Table {
84 name,
85 alias: None,
86 args: None,
87 with_hints,
88 version: None,
89 partitions,
90 } if with_hints.is_empty() && partitions.is_empty() => {
91 let name = parse_ident(name)?;
92 let alias = name.clone();
93 Ok((name, alias))
94 }
95 // Relvar with alias
96 TableFactor::Table {
97 name,
98 alias: Some(TableAlias { name: alias, columns }),
99 args: None,
100 with_hints,
101 version: None,
102 partitions,
103 } if with_hints.is_empty() && partitions.is_empty() && columns.is_empty() => {
104 Ok((parse_ident(name)?, alias.into()))
105 }
106 _ => Err(SqlUnsupported::From(expr).into()),
107 }
108 }
109}
110
111/// Parse the items of a SELECT clause

Callers

nothing calls this directly

Implementers 2

sql.rscrates/sql-parser/src/parser/sql.rs
sub.rscrates/sql-parser/src/parser/sub.rs

Calls 6

parse_identFunction · 0.85
OkFunction · 0.50
ErrFunction · 0.50
FromClass · 0.50
is_emptyMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected