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

Function parse_values

crates/sql-parser/src/parser/sql.rs:226–264  ·  view source on GitHub ↗

Parse a VALUES expression

(values: Query)

Source from the content-addressed store, hash-verified

224
225/// Parse a VALUES expression
226fn parse_values(values: Query) -> SqlParseResult<SqlValues> {
227 match values {
228 Query {
229 with: None,
230 body,
231 order_by,
232 limit: None,
233 offset: None,
234 fetch: None,
235 locks,
236 } if order_by.is_empty() && locks.is_empty() => match *body {
237 SetExpr::Values(Values {
238 explicit_row: false,
239 rows,
240 }) => {
241 let mut row_literals = Vec::new();
242 for row in rows {
243 let mut literals = Vec::new();
244 for expr in row {
245 literals.push(parse_literal_expr(expr, SqlUnsupported::InsertValue)?);
246 }
247 row_literals.push(literals);
248 }
249 Ok(SqlValues(row_literals))
250 }
251 _ => Err(SqlUnsupported::Insert(Query {
252 with: None,
253 body,
254 order_by,
255 limit: None,
256 offset: None,
257 fetch: None,
258 locks,
259 })
260 .into()),
261 },
262 _ => Err(SqlUnsupported::Insert(values).into()),
263 }
264}
265
266/// Parse column/variable assignments in an UPDATE or SET statement
267fn parse_assignments(assignments: Vec<Assignment>) -> SqlParseResult<Vec<SqlSet>> {

Callers 1

parse_statementFunction · 0.85

Calls 8

parse_literal_exprFunction · 0.85
SqlValuesClass · 0.85
newFunction · 0.50
OkFunction · 0.50
ErrFunction · 0.50
InsertClass · 0.50
is_emptyMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…