pub struct Null;Expand description
A marker type representing a NULL value.
This can be used with both Bindable and Writable.
See Statement::bind and Statement::read.
Trait Implementations§
impl Bindable for Null
§Examples
use sqlite_ll::{Connection, Null};
let c = Connection::open_memory()?;
c.execute(r##"
CREATE TABLE users (name TEXT, age INTEGER);
INSERT INTO users (name, age) VALUES ('Alice', NULL), ('Bob', 30);
"##)?;
let mut stmt = c.prepare("SELECT name FROM users WHERE age IS ?")?;
stmt.bind(1, Null)?;
let mut names = Vec::new();
while let Some(row) = stmt.next()? {
names.push(row.read::<String>(0)?);
}
assert_eq!(names, vec![String::from("Alice")]);impl Copy for Null
impl Eq for Null
impl Readable for Null
§Examples
use sqlite_ll::{Connection, Null, State};
let c = Connection::open_memory()?;
c.execute(r##"
CREATE TABLE users (name TEXT, age INTEGER);
INSERT INTO users (name, age) VALUES ('Alice', NULL), ('Bob', 30);
"##)?;
let mut stmt = c.prepare("SELECT age FROM users WHERE name = ?")?;
stmt.bind(1, "Alice")?;
let mut names = Vec::new();
while let State::Row = stmt.step()? {
names.push(stmt.read::<Null>(0)?);
}
assert_eq!(names, vec![Null]);impl StructuralPartialEq for Null
Auto Trait Implementations§
impl Freeze for Null
impl RefUnwindSafe for Null
impl Send for Null
impl Sync for Null
impl Unpin for Null
impl UnwindSafe for Null
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more