mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-27 20:04:23 +01:00
Create extern functions to support vtab xConnect in core/ext
This commit is contained in:
@@ -23,6 +23,9 @@ pub enum ResultCode {
|
||||
EOF = 15,
|
||||
ReadOnly = 16,
|
||||
RowID = 17,
|
||||
Row = 18,
|
||||
Interrupt = 19,
|
||||
Busy = 20,
|
||||
}
|
||||
|
||||
impl ResultCode {
|
||||
@@ -60,6 +63,34 @@ impl Display for ResultCode {
|
||||
ResultCode::EOF => write!(f, "EOF"),
|
||||
ResultCode::ReadOnly => write!(f, "Read Only"),
|
||||
ResultCode::RowID => write!(f, "RowID"),
|
||||
ResultCode::Row => write!(f, "Row"),
|
||||
ResultCode::Interrupt => write!(f, "Interrupt"),
|
||||
ResultCode::Busy => write!(f, "Busy"),
|
||||
}
|
||||
}
|
||||
}
|
||||
#[repr(C)]
|
||||
#[derive(PartialEq, Debug, Eq, Clone, Copy)]
|
||||
/// StepResult is used to represent the state of a query as it is exposed
|
||||
/// to the public API of a connection in a virtual table extension.
|
||||
/// the IO variant is always handled internally and therefore is not included here.
|
||||
pub enum StepResult {
|
||||
Error,
|
||||
Row,
|
||||
Done,
|
||||
Interrupt,
|
||||
Busy,
|
||||
}
|
||||
|
||||
impl From<ResultCode> for StepResult {
|
||||
fn from(code: ResultCode) -> Self {
|
||||
match code {
|
||||
ResultCode::Error => StepResult::Error,
|
||||
ResultCode::Row => StepResult::Row,
|
||||
ResultCode::EOF => StepResult::Done,
|
||||
ResultCode::Interrupt => StepResult::Interrupt,
|
||||
ResultCode::Busy => StepResult::Busy,
|
||||
_ => StepResult::Error,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user