mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-04-25 00:32:14 +00:00
A cosmetic reordering
This commit is contained in:
parent
125317935b
commit
3ebfc76d37
@ -44,12 +44,6 @@ impl<'l> Statement<'l> {
|
|||||||
parameter.bind(self, i)
|
parameter.bind(self, i)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the number of columns.
|
|
||||||
#[inline]
|
|
||||||
pub fn columns(&self) -> usize {
|
|
||||||
unsafe { ffi::sqlite3_column_count(self.raw.0) as usize }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Advance to the next state.
|
/// Advance to the next state.
|
||||||
///
|
///
|
||||||
/// The function should be called multiple times until `State::Done` is
|
/// The function should be called multiple times until `State::Done` is
|
||||||
@ -63,20 +57,6 @@ impl<'l> Statement<'l> {
|
|||||||
Ok(state)
|
Ok(state)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the type of a column.
|
|
||||||
///
|
|
||||||
/// The type is revealed after the first step has been taken.
|
|
||||||
pub fn kind(&self, i: usize) -> Type {
|
|
||||||
match unsafe { ffi::sqlite3_column_type(self.raw.0, i as c_int) } {
|
|
||||||
ffi::SQLITE_BLOB => Type::Binary,
|
|
||||||
ffi::SQLITE_FLOAT => Type::Float,
|
|
||||||
ffi::SQLITE_INTEGER => Type::Integer,
|
|
||||||
ffi::SQLITE_TEXT => Type::String,
|
|
||||||
ffi::SQLITE_NULL => Type::Null,
|
|
||||||
_ => unreachable!(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Read a value from a column.
|
/// Read a value from a column.
|
||||||
///
|
///
|
||||||
/// The leftmost column has the index 0.
|
/// The leftmost column has the index 0.
|
||||||
@ -92,6 +72,26 @@ impl<'l> Statement<'l> {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Return the number of columns.
|
||||||
|
#[inline]
|
||||||
|
pub fn columns(&self) -> usize {
|
||||||
|
unsafe { ffi::sqlite3_column_count(self.raw.0) as usize }
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Return the type of a column.
|
||||||
|
///
|
||||||
|
/// The type is revealed after the first step has been taken.
|
||||||
|
pub fn kind(&self, i: usize) -> Type {
|
||||||
|
match unsafe { ffi::sqlite3_column_type(self.raw.0, i as c_int) } {
|
||||||
|
ffi::SQLITE_BLOB => Type::Binary,
|
||||||
|
ffi::SQLITE_FLOAT => Type::Float,
|
||||||
|
ffi::SQLITE_INTEGER => Type::Integer,
|
||||||
|
ffi::SQLITE_TEXT => Type::String,
|
||||||
|
ffi::SQLITE_NULL => Type::Null,
|
||||||
|
_ => unreachable!(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Upgrade to a cursor.
|
/// Upgrade to a cursor.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn cursor(self) -> Cursor<'l> {
|
pub fn cursor(self) -> Cursor<'l> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user