mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-04-25 16:52:15 +00:00
Always succeed when calling Statement::cursor
This commit is contained in:
parent
fd9c9a0a25
commit
22aea1100f
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "sqlite"
|
name = "sqlite"
|
||||||
version = "0.19.1"
|
version = "0.19.2"
|
||||||
authors = ["Ivan Ukhov <ivan.ukhov@gmail.com>"]
|
authors = ["Ivan Ukhov <ivan.ukhov@gmail.com>"]
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
repository = "https://github.com/stainless-steel/sqlite"
|
repository = "https://github.com/stainless-steel/sqlite"
|
||||||
|
@ -54,7 +54,7 @@ use sqlite::Value;
|
|||||||
|
|
||||||
let mut cursor = connection.prepare("
|
let mut cursor = connection.prepare("
|
||||||
SELECT * FROM users WHERE age > ?
|
SELECT * FROM users WHERE age > ?
|
||||||
").unwrap().cursor().unwrap();
|
").unwrap().cursor();
|
||||||
|
|
||||||
cursor.bind(&[Value::Integer(50)]).unwrap();
|
cursor.bind(&[Value::Integer(50)]).unwrap();
|
||||||
|
|
||||||
|
@ -52,6 +52,6 @@ impl<'l> Cursor<'l> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn new<'l>(statement: Statement<'l>) -> Result<Cursor<'l>> {
|
pub fn new<'l>(statement: Statement<'l>) -> Cursor<'l> {
|
||||||
Ok(Cursor { state: None, values: None, statement: statement })
|
Cursor { state: None, values: None, statement: statement }
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@
|
|||||||
//!
|
//!
|
||||||
//! let mut cursor = connection.prepare("
|
//! let mut cursor = connection.prepare("
|
||||||
//! SELECT * FROM users WHERE age > ?
|
//! SELECT * FROM users WHERE age > ?
|
||||||
//! ").unwrap().cursor().unwrap();
|
//! ").unwrap().cursor();
|
||||||
//!
|
//!
|
||||||
//! cursor.bind(&[Value::Integer(50)]).unwrap();
|
//! cursor.bind(&[Value::Integer(50)]).unwrap();
|
||||||
//!
|
//!
|
||||||
|
@ -103,7 +103,7 @@ impl<'l> Statement<'l> {
|
|||||||
|
|
||||||
/// Upgrade to a cursor.
|
/// Upgrade to a cursor.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn cursor(self) -> Result<Cursor<'l>> {
|
pub fn cursor(self) -> Cursor<'l> {
|
||||||
::cursor::new(self)
|
::cursor::new(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ fn connection_set_busy_handler() {
|
|||||||
fn cursor() {
|
fn cursor() {
|
||||||
let connection = setup(":memory:");
|
let connection = setup(":memory:");
|
||||||
let statement = "SELECT id, name FROM users WHERE id = ?";
|
let statement = "SELECT id, name FROM users WHERE id = ?";
|
||||||
let mut cursor = ok!(connection.prepare(statement)).cursor().unwrap();
|
let mut cursor = ok!(connection.prepare(statement)).cursor();
|
||||||
|
|
||||||
ok!(cursor.bind(&[Value::Integer(1)]));
|
ok!(cursor.bind(&[Value::Integer(1)]));
|
||||||
assert_eq!(ok!(ok!(cursor.next())), &[Value::Integer(1), Value::String("Alice".to_string())]);
|
assert_eq!(ok!(ok!(cursor.next())), &[Value::Integer(1), Value::String("Alice".to_string())]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user