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

Method parse_from

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

Parse a FROM clause

(mut tables: Vec<TableWithJoins>)

Source from the content-addressed store, hash-verified

27
28 /// Parse a FROM clause
29 fn parse_from(mut tables: Vec<TableWithJoins>) -> SqlParseResult<SqlFrom> {
30 if tables.is_empty() {
31 return Err(SqlRequired::From.into());
32 }
33 if tables.len() > 1 {
34 return Err(SqlUnsupported::ImplicitJoins.into());
35 }
36 let TableWithJoins { relation, joins } = tables.swap_remove(0);
37 let (name, alias) = Self::parse_relvar(relation)?;
38 if joins.is_empty() {
39 return Ok(SqlFrom::Expr(name, alias));
40 }
41 Ok(SqlFrom::Join(name, alias, Self::parse_joins(joins)?))
42 }
43
44 /// Parse a sequence of JOIN clauses
45 fn parse_joins(joins: Vec<Join>) -> SqlParseResult<Vec<SqlJoin>> {

Callers

nothing calls this directly

Implementers 2

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

Calls 5

ExprEnum · 0.85
ErrFunction · 0.50
OkFunction · 0.50
is_emptyMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected