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

Function pretty_sql

src/expr/src/scalar/func.rs:2342–2355  ·  view source on GitHub ↗
(sql: &str, width: i32, temp_storage: &'a RowArena)

Source from the content-addressed store, hash-verified

2340
2341#[sqlfunc(propagates_nulls = true)]
2342fn pretty_sql<'a>(sql: &str, width: i32, temp_storage: &'a RowArena) -> Result<&'a str, EvalError> {
2343 let width =
2344 usize::try_from(width).map_err(|_| EvalError::PrettyError("invalid width".into()))?;
2345 let pretty = pretty_str(
2346 sql,
2347 PrettyConfig {
2348 width,
2349 format_mode: FormatMode::Simple,
2350 },
2351 )
2352 .map_err(|e| EvalError::PrettyError(e.to_string().into()))?;
2353 let pretty = temp_storage.push_string(pretty);
2354 Ok(pretty)
2355}
2356
2357#[sqlfunc]
2358fn redact_sql(sql: &str) -> Result<String, EvalError> {

Callers

nothing calls this directly

Calls 3

push_stringMethod · 0.80
pretty_strFunction · 0.50
to_stringMethod · 0.45

Tested by

no test coverage detected