Skip to content

Commit

Permalink
RowSetCursor -> BlockCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
pacman82 committed Nov 25, 2022
1 parent 6fb62b6 commit cf7245d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions odbc-api/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub trait Cursor: ResultSetMetadata {
}

/// Binds this cursor to a buffer holding a row set.
fn bind_buffer<B>(self, row_set_buffer: B) -> Result<RowSetCursor<Self, B>, Error>
fn bind_buffer<B>(self, row_set_buffer: B) -> Result<BlockCursor<Self, B>, Error>
where
Self: Sized,
B: RowSetBuffer;
Expand Down Expand Up @@ -270,15 +270,15 @@ impl<S> Cursor for CursorImpl<S>
where
S: AsStatementRef,
{
fn bind_buffer<B>(mut self, mut row_set_buffer: B) -> Result<RowSetCursor<Self, B>, Error>
fn bind_buffer<B>(mut self, mut row_set_buffer: B) -> Result<BlockCursor<Self, B>, Error>
where
B: RowSetBuffer,
{
let stmt = self.statement.as_stmt_ref();
unsafe {
bind_row_set_buffer_to_statement(stmt, &mut row_set_buffer)?;
}
Ok(RowSetCursor::new(row_set_buffer, self))
Ok(BlockCursor::new(row_set_buffer, self))
}
}

Expand Down Expand Up @@ -357,14 +357,17 @@ unsafe impl<T: RowSetBuffer> RowSetBuffer for &mut T {
}
}

#[deprecated = "Use new name BlockCursor instead"]
pub type RowSetCursor<C, B> = BlockCursor<C, B>;

/// Iterates in blocks (called row sets) over a result set, filling a buffers with a lot of rows at
/// once, instead of iterating the result set row by row. This is usually much faster.
pub struct RowSetCursor<C: AsStatementRef, B> {
pub struct BlockCursor<C: AsStatementRef, B> {
buffer: B,
cursor: C,
}

impl<C, B> RowSetCursor<C, B>
impl<C, B> BlockCursor<C, B>
where
C: Cursor,
{
Expand Down Expand Up @@ -435,7 +438,7 @@ where
}
}

impl<C, B> Drop for RowSetCursor<C, B>
impl<C, B> Drop for BlockCursor<C, B>
where
C: AsStatementRef,
{
Expand Down
4 changes: 2 additions & 2 deletions odbc-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ pub use self::{
columnar_bulk_inserter::{BoundInputSlice, ColumnarBulkInserter},
connection::{escape_attribute_value, Connection},
cursor::{
Cursor, CursorImpl, CursorPolling, CursorRow, RowSetBuffer, RowSetCursor,
RowSetCursorPolling,
Cursor, CursorImpl, CursorPolling, CursorRow, RowSetBuffer, BlockCursor,
RowSetCursorPolling, RowSetCursor
},
driver_complete_option::DriverCompleteOption,
environment::{DataSourceInfo, DriverInfo, Environment},
Expand Down

0 comments on commit cf7245d

Please sign in to comment.