Skip to content

Commit 4576d65

Browse files
committed
Move constructor into Cursor
1 parent 20244b3 commit 4576d65

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/sqlite3/cursor.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ pub struct Cursor<'db> {
4242
dbh: &'db *dbh
4343
}
4444

45-
pub fn cursor_with_statement<'db>(stmt: *stmt, dbh: &'db *dbh) -> Cursor<'db> {
46-
debug!("`Cursor.cursor_with_statement()`: stmt={:?}", stmt);
47-
Cursor { stmt: stmt, dbh: dbh }
48-
}
49-
5045
#[unsafe_destructor]
5146
impl<'db> Drop for Cursor<'db> {
5247
/// Deletes a prepared SQL statement.
@@ -60,6 +55,10 @@ impl<'db> Drop for Cursor<'db> {
6055
}
6156

6257
impl<'db> Cursor<'db> {
58+
pub fn new<'dbh>(stmt: *stmt, dbh: &'dbh *dbh) -> Cursor<'dbh> {
59+
debug!("`Cursor.new()`: stmt={:?}", stmt);
60+
Cursor { stmt: stmt, dbh: dbh }
61+
}
6362

6463
/// Resets a prepared SQL statement, but does not reset its bindings.
6564
/// See http://www.sqlite.org/c3ref/reset.html

src/sqlite3/database.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl Database {
7777
});
7878
if r == SQLITE_OK {
7979
debug!("`Database.prepare()`: stmt={:?}", new_stmt);
80-
Ok( cursor_with_statement(new_stmt, &self.dbh))
80+
Ok(Cursor::new(new_stmt, &self.dbh))
8181
} else {
8282
Err(r)
8383
}

0 commit comments

Comments
 (0)