Rename cursor into into_cursor

This commit is contained in:
Ivan Ukhov 2020-06-13 09:02:18 +02:00
parent 6d10fd7ee7
commit 4973bbc397
4 changed files with 8 additions and 8 deletions

View File

@ -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();

View File

@ -88,7 +88,7 @@
//! let mut cursor = connection
//! .prepare("SELECT * FROM users WHERE age > ?")
//! .unwrap()
//! .cursor();
//! .into_cursor();
//!
//! cursor.bind(&[Value::Integer(50)]).unwrap();
//!

View File

@ -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)
}

View File

@ -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)]));