WIP, incorporating type parsing using new sqlez patterns
This commit is contained in:
parent
3c1b747f64
commit
c8face33fa
4 changed files with 73 additions and 6 deletions
|
@ -10,6 +10,18 @@ pub trait Column: Sized {
|
|||
fn column(statement: &mut Statement, start_index: i32) -> Result<(Self, i32)>;
|
||||
}
|
||||
|
||||
impl Bind for bool {
|
||||
fn bind(&self, statement: &Statement, start_index: i32) -> Result<i32> {
|
||||
statement.bind(self.then_some(1).unwrap_or(0), start_index)
|
||||
}
|
||||
}
|
||||
|
||||
impl Column for bool {
|
||||
fn column(statement: &mut Statement, start_index: i32) -> Result<(Self, i32)> {
|
||||
i32::column(statement, start_index).map(|(i, next_index)| (i != 0, next_index))
|
||||
}
|
||||
}
|
||||
|
||||
impl Bind for &[u8] {
|
||||
fn bind(&self, statement: &Statement, start_index: i32) -> Result<i32> {
|
||||
statement.bind_blob(start_index, self)?;
|
||||
|
|
|
@ -114,7 +114,7 @@ impl<'a> Statement<'a> {
|
|||
|
||||
unsafe {
|
||||
sqlite3_bind_int(self.raw_statement, index, int);
|
||||
}
|
||||
};
|
||||
self.connection.last_error()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue