pub trait Cursor: ResultSetMetadata {
unsafe fn stmt_mut(&mut self) -> &mut Self::Statement;
fn bind_buffer<B>(
self,
row_set_buffer: B
) -> Result<RowSetCursor<Self, B>, Error>
where
Self: Sized,
B: RowSetBuffer;
fn next_row(
&mut self
) -> Result<Option<CursorRow<'_, Self::Statement>>, Error> { ... }
}
Expand description
Cursors are used to process and iterate the result sets returned by executing queries.
Required methods
Provides access to the underlying statement handle.
Safety
Assigning to this statement handle or binding buffers to it may invalidate the invariants
of safe wrapper types (i.e. crate::RowSetCursor
). Some actions like closing the cursor
may just result in ODBC transition errors, others like binding columns may even cause actual
invalid memory access if not used with care.
fn bind_buffer<B>(
self,
row_set_buffer: B
) -> Result<RowSetCursor<Self, B>, Error> where
Self: Sized,
B: RowSetBuffer,
fn bind_buffer<B>(
self,
row_set_buffer: B
) -> Result<RowSetCursor<Self, B>, Error> where
Self: Sized,
B: RowSetBuffer,
Binds this cursor to a buffer holding a row set.
Provided methods
Advances the cursor to the next row in the result set.
While this method is very convenient due to the fact that the application does not have to
declare and bind specific buffers it is also in many situations extremely slow. Concrete
performance depends on the ODBC driver in question, but it is likely it performs a roundtrip
to the datasource for each individual row. It is also likely an extra conversion is
performed then requesting individual fields, since the C buffer type is not known to the
driver in advance. Consider binding a buffer to the cursor first using
Self::bind_buffer
.