mirror of
https://github.com/fluencelabs/sqlite-wasm-connector
synced 2025-04-25 00:32:14 +00:00
Rename cursor into into_cursor
This commit is contained in:
parent
6d10fd7ee7
commit
4973bbc397
@ -60,7 +60,7 @@ use sqlite::Value;
|
||||
let mut cursor = connection
|
||||
.prepare("SELECT * FROM users WHERE age > ?")
|
||||
.unwrap()
|
||||
.cursor();
|
||||
.into_cursor();
|
||||
|
||||
cursor.bind(&[Value::Integer(50)]).unwrap();
|
||||
|
||||
|
@ -88,7 +88,7 @@
|
||||
//! let mut cursor = connection
|
||||
//! .prepare("SELECT * FROM users WHERE age > ?")
|
||||
//! .unwrap()
|
||||
//! .cursor();
|
||||
//! .into_cursor();
|
||||
//!
|
||||
//! cursor.bind(&[Value::Integer(50)]).unwrap();
|
||||
//!
|
||||
|
@ -117,7 +117,7 @@ impl<'l> Statement<'l> {
|
||||
|
||||
/// Upgrade to a cursor.
|
||||
#[inline]
|
||||
pub fn cursor(self) -> Cursor<'l> {
|
||||
pub fn into_cursor(self) -> Cursor<'l> {
|
||||
::cursor::new(self)
|
||||
}
|
||||
|
||||
|
10
tests/lib.rs
10
tests/lib.rs
@ -117,7 +117,7 @@ fn cursor_read() {
|
||||
let statement = ok!(connection.prepare(statement));
|
||||
|
||||
let mut count = 0;
|
||||
let mut cursor = statement.cursor();
|
||||
let mut cursor = statement.into_cursor();
|
||||
while let Some(row) = ok!(cursor.next()) {
|
||||
let id = row[0].as_integer().unwrap();
|
||||
if id == 1 {
|
||||
@ -139,7 +139,7 @@ fn cursor_wildcard() {
|
||||
let statement = ok!(connection.prepare(statement));
|
||||
|
||||
let mut count = 0;
|
||||
let mut cursor = statement.cursor();
|
||||
let mut cursor = statement.into_cursor();
|
||||
while let Some(_) = ok!(cursor.next()) {
|
||||
count += 1;
|
||||
}
|
||||
@ -154,7 +154,7 @@ fn cursor_wildcard_with_binding() {
|
||||
ok!(statement.bind(1, "%type"));
|
||||
|
||||
let mut count = 0;
|
||||
let mut cursor = statement.cursor();
|
||||
let mut cursor = statement.into_cursor();
|
||||
while let Some(_) = ok!(cursor.next()) {
|
||||
count += 1;
|
||||
}
|
||||
@ -166,10 +166,10 @@ fn cursor_workflow() {
|
||||
let connection = setup_users(":memory:");
|
||||
|
||||
let select = "SELECT id, name FROM users WHERE id = ?";
|
||||
let mut select = ok!(connection.prepare(select)).cursor();
|
||||
let mut select = ok!(connection.prepare(select)).into_cursor();
|
||||
|
||||
let insert = "INSERT INTO users (id, name) VALUES (?, ?)";
|
||||
let mut insert = ok!(connection.prepare(insert)).cursor();
|
||||
let mut insert = ok!(connection.prepare(insert)).into_cursor();
|
||||
|
||||
for _ in 0..10 {
|
||||
ok!(select.bind(&[Value::Integer(1)]));
|
||||
|
Loading…
x
Reference in New Issue
Block a user