mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-03-15 06:20:50 +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)
|
||||
}
|
||||
|
||||
/// 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.
|
||||
///
|
||||
/// The function should be called multiple times until `State::Done` is
|
||||
@ -63,20 +57,6 @@ impl<'l> Statement<'l> {
|
||||
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.
|
||||
///
|
||||
/// The leftmost column has the index 0.
|
||||
@ -92,6 +72,26 @@ impl<'l> Statement<'l> {
|
||||
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.
|
||||
#[inline]
|
||||
pub fn cursor(self) -> Cursor<'l> {
|
||||
|
Loading…
x
Reference in New Issue
Block a user