mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-08-04 01:58:16 +00:00
core: Unify StepResult structs
...also simplify Statement::step() to get some performance back. Before: ``` Execute `SELECT 1`/Limbo time: [49.128 ns 50.425 ns 52.604 ns] ``` After: ``` Execute `SELECT 1`/Limbo time: [49.128 ns 50.425 ns 52.604 ns] ```
This commit is contained in:
parent
7573fc62e6
commit
23cd8b10c3
1 changed files with 2 additions and 16 deletions
18
core/lib.rs
18
core/lib.rs
|
@ -467,14 +467,7 @@ impl Statement {
|
|||
}
|
||||
|
||||
pub fn step(&mut self) -> Result<StepResult<'_>> {
|
||||
let result = self.program.step(&mut self.state, self.pager.clone())?;
|
||||
match result {
|
||||
vdbe::StepResult::Row(row) => Ok(StepResult::Row(Row { values: row.values })),
|
||||
vdbe::StepResult::IO => Ok(StepResult::IO),
|
||||
vdbe::StepResult::Done => Ok(StepResult::Done),
|
||||
vdbe::StepResult::Interrupt => Ok(StepResult::Interrupt),
|
||||
vdbe::StepResult::Busy => Ok(StepResult::Busy),
|
||||
}
|
||||
self.program.step(&mut self.state, self.pager.clone())
|
||||
}
|
||||
|
||||
pub fn columns(&self) -> &[String] {
|
||||
|
@ -498,14 +491,7 @@ impl Statement {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum StepResult<'a> {
|
||||
Row(Row<'a>),
|
||||
IO,
|
||||
Done,
|
||||
Interrupt,
|
||||
Busy,
|
||||
}
|
||||
pub type StepResult<'a> = vdbe::StepResult<'a>;
|
||||
|
||||
pub type Row<'a> = types::Record<'a>;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue