odbc_api

Struct CursorImpl

Source
pub struct CursorImpl<Stmt: AsStatementRef> { /* private fields */ }
Expand description

Cursors are used to process and iterate the result sets returned by executing queries. Created by either a prepared query or direct execution. Usually utilized through the crate::Cursor trait.

Implementations§

Source§

impl<S> CursorImpl<S>
where S: AsStatementRef,

Source

pub unsafe fn new(statement: S) -> Self

Users of this library are encouraged not to call this constructor directly but rather invoke crate::Connection::execute or crate::Prepared::execute to get a cursor and utilize it using the crate::Cursor trait. This method is public so users with an understanding of the raw ODBC C-API have a way to create a cursor, after they left the safety rails of the Rust type System, in order to implement a use case not covered yet, by the safe abstractions within this crate.

§Safety

statement must be in Cursor state, for the invariants of this type to hold.

Source

pub fn into_stmt(self) -> S

Deconstructs the CursorImpl without calling drop. This is a way to get to the underlying statement, while preventing a call to close cursor.

Trait Implementations§

Source§

impl<S> AsStatementRef for CursorImpl<S>
where S: AsStatementRef,

Source§

fn as_stmt_ref(&mut self) -> StatementRef<'_>

Get an exclusive reference to the underlying statement handle. This method is used to implement other more higher level methods on top of it. It is not intended to be called by users of this crate directly, yet it may serve as an escape hatch for low level use cases.
Source§

impl<S> Cursor for CursorImpl<S>
where S: AsStatementRef,

Source§

fn bind_buffer<B>( self, row_set_buffer: B, ) -> Result<BlockCursor<Self, B>, Error>
where B: RowSetBuffer,

Binds this cursor to a buffer holding a row set.
Source§

fn more_results(self) -> Result<Option<Self>, Error>
where Self: Sized,

For some datasources it is possible to create more than one result set at once via a call to execute. E.g. by calling a stored procedure or executing multiple SQL statements at once. This method consumes the current cursor and creates a new one representing the next result set should it exist.
Source§

fn next_row(&mut self) -> Result<Option<CursorRow<'_>>, Error>

Advances the cursor to the next row in the result set. This is Slow. Bind crate::buffers instead, for good performance. Read more
Source§

impl<S> Drop for CursorImpl<S>
where S: AsStatementRef,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<S> ResultSetMetadata for CursorImpl<S>
where S: AsStatementRef,

Source§

fn describe_col( &mut self, column_number: u16, column_description: &mut ColumnDescription, ) -> Result<(), Error>

Fetch a column description using the column index. Read more
Source§

fn num_result_cols(&mut self) -> Result<i16, Error>

Number of columns in result set. Can also be used to see whether executing a prepared Statement (crate::Prepared) would yield a result set, as this would return 0 if it does not. Read more
Source§

fn column_is_unsigned(&mut self, column_number: u16) -> Result<bool, Error>

true if a given column in a result set is unsigned or not a numeric type, false otherwise. Read more
Source§

fn col_octet_length( &mut self, column_number: u16, ) -> Result<Option<NonZeroUsize>, Error>

Size in bytes of the columns. For variable sized types this is the maximum size, excluding a terminating zero. Read more
Source§

fn col_display_size( &mut self, column_number: u16, ) -> Result<Option<NonZeroUsize>, Error>

Maximum number of characters required to display data from the column. If the driver is unable to provide a maximum None is returned. Read more
Source§

fn col_precision(&mut self, column_number: u16) -> Result<isize, Error>

Precision of the column. Read more
Source§

fn col_scale(&mut self, column_number: u16) -> Result<isize, Error>

The applicable scale for a numeric data type. For DECIMAL and NUMERIC data types, this is the defined scale. It is undefined for all other data types.
Source§

fn col_name(&mut self, column_number: u16) -> Result<String, Error>

The column alias, if it applies. If the column alias does not apply, the column name is returned. If there is no column name or a column alias, an empty string is returned.
Source§

fn column_names(&mut self) -> Result<ColumnNamesIt<'_, Self>, Error>

Use this if you want to iterate over all column names and allocate a String for each one. Read more
Source§

fn col_data_type(&mut self, column_number: u16) -> Result<DataType, Error>

Data type of the specified column. Read more

Auto Trait Implementations§

§

impl<Stmt> Freeze for CursorImpl<Stmt>
where Stmt: Freeze,

§

impl<Stmt> RefUnwindSafe for CursorImpl<Stmt>
where Stmt: RefUnwindSafe,

§

impl<Stmt> Send for CursorImpl<Stmt>
where Stmt: Send,

§

impl<Stmt> Sync for CursorImpl<Stmt>
where Stmt: Sync,

§

impl<Stmt> Unpin for CursorImpl<Stmt>
where Stmt: Unpin,

§

impl<Stmt> UnwindSafe for CursorImpl<Stmt>
where Stmt: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more