MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / parse_sql

Function parse_sql

src/mz-deploy/src/project/compiler.rs:1069–1074  ·  view source on GitHub ↗

Parse a SQL string into a list of raw AST statements. Returns `Err(())` on any parse failure. Used only for cache reconstruction where detailed error reporting is unnecessary — a parse failure simply means the cache entry is stale.

(sql: &str)

Source from the content-addressed store, hash-verified

1067/// where detailed error reporting is unnecessary — a parse failure simply
1068/// means the cache entry is stale.
1069fn parse_sql(sql: &str) -> Result<Vec<Statement<Raw>>, ()> {
1070 mz_sql_parser::parser::parse_statements_with_limit(sql)
1071 .map_err(|_| ())?
1072 .map(|stmts| stmts.into_iter().map(|stmt| stmt.ast).collect())
1073 .map_err(|_| ())
1074}
1075
1076/// Parse a SQL string that must contain exactly one statement.
1077///

Callers 1

parse_one_statementFunction · 0.70

Calls 4

mapMethod · 0.45
collectMethod · 0.45
into_iterMethod · 0.45

Tested by

no test coverage detected