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

Method parse_statement

src/sqllogictest/src/parser.rs:208–237  ·  view source on GitHub ↗
(
        &mut self,
        mut words: impl Iterator<Item = &'a str>,
        first_line: &'a str,
    )

Source from the content-addressed store, hash-verified

206 }
207
208 fn parse_statement(
209 &mut self,
210 mut words: impl Iterator<Item = &'a str>,
211 first_line: &'a str,
212 ) -> Result<Record<'a>, anyhow::Error> {
213 let location = self.location();
214 let mut expected_error = None;
215 let mut rows_affected = None;
216 match words.next() {
217 Some("count") => {
218 rows_affected = Some(
219 words
220 .next()
221 .ok_or_else(|| anyhow!("missing count of rows affected"))?
222 .parse::<u64>()
223 .map_err(|err| anyhow!("parsing count of rows affected: {}", err))?,
224 );
225 }
226 Some("ok") | Some("OK") => (),
227 Some("error") => expected_error = Some(parse_expected_error(first_line)),
228 _ => bail!("invalid statement disposition: {}", first_line),
229 };
230 let sql = self.split_at(&DOUBLE_LINE_REGEX)?;
231 Ok(Record::Statement {
232 expected_error,
233 rows_affected,
234 sql,
235 location,
236 })
237 }
238
239 fn parse_query(
240 &mut self,

Callers 1

parse_recordMethod · 0.45

Calls 4

parse_expected_errorFunction · 0.85
locationMethod · 0.45
nextMethod · 0.45
split_atMethod · 0.45

Tested by

no test coverage detected