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

Function redact_sql

src/expr/src/scalar/func.rs:2358–2367  ·  view source on GitHub ↗
(sql: &str)

Source from the content-addressed store, hash-verified

2356
2357#[sqlfunc]
2358fn redact_sql(sql: &str) -> Result<String, EvalError> {
2359 let stmts = mz_sql_parser::parser::parse_statements(sql)
2360 .map_err(|e| EvalError::RedactError(e.to_string().into()))?;
2361 match stmts.len() {
2362 1 => Ok(stmts[0].ast.to_ast_string_redacted()),
2363 n => Err(EvalError::RedactError(
2364 format!("expected a single statement, found {n}").into(),
2365 )),
2366 }
2367}
2368
2369#[sqlfunc(propagates_nulls = true)]
2370fn starts_with(a: &str, b: &str) -> bool {

Callers

nothing calls this directly

Calls 4

parse_statementsFunction · 0.50
to_stringMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected