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

Function parse_one_statement

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

Parse a SQL string that must contain exactly one statement. Returns `Err(())` if parsing fails or the string contains zero or multiple statements.

(sql: &str)

Source from the content-addressed store, hash-verified

1078/// Returns `Err(())` if parsing fails or the string contains zero or
1079/// multiple statements.
1080fn parse_one_statement(sql: &str) -> Result<Statement<Raw>, ()> {
1081 let mut statements = parse_sql(sql)?;
1082 if statements.len() != 1 {
1083 return Err(());
1084 }
1085 Ok(statements.remove(0))
1086}
1087
1088/// Parse a list of SQL strings and downcast each to a specific statement type.
1089///

Callers 2

parse_statement_listFunction · 0.85
parse_main_statementFunction · 0.85

Calls 3

parse_sqlFunction · 0.70
lenMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected