[][src]Trait odbc_api::Cursor

pub trait Cursor: Sized {
    pub fn describe_col(
        &self,
        column_number: u16,
        column_description: &mut ColumnDescription
    ) -> Result<(), Error>;
pub fn num_result_cols(&self) -> Result<i16, Error>;
pub unsafe fn fetch(&mut self) -> Result<bool, Error>;
pub unsafe fn set_row_array_size(&mut self, size: u32) -> Result<(), Error>;
pub unsafe fn set_num_rows_fetched(
        &mut self,
        num_rows: &mut usize
    ) -> Result<(), Error>;
pub unsafe fn set_row_bind_type(
        &mut self,
        row_size: u32
    ) -> Result<(), Error>;
pub fn unbind_cols(&mut self) -> Result<(), Error>;
pub unsafe fn bind_col(
        &mut self,
        column_number: u16,
        target: &mut impl CDataMut
    ) -> Result<(), Error>;
pub fn is_unsigned_column(&self, column_number: u16) -> Result<bool, Error>;
pub fn bind_buffer<B>(
        self,
        row_set_buffer: B
    ) -> Result<RowSetCursor<Self, B>, Error>
    where
        B: RowSetBuffer
;
pub fn col_type(&self, column_number: u16) -> Result<SqlDataType, Error>;
pub fn col_concise_type(
        &self,
        column_number: u16
    ) -> Result<SqlDataType, Error>;
pub fn col_octet_length(&self, column_number: u16) -> Result<isize, Error>;
pub fn col_display_size(&self, column_number: u16) -> Result<isize, Error>;
pub fn col_precision(&self, column_number: u16) -> Result<isize, Error>;
pub fn col_scale(&self, column_number: u16) -> Result<isize, Error>;
pub fn col_name(
        &self,
        column_number: u16,
        buf: &mut Vec<u16>
    ) -> Result<(), Error>;
pub fn application_row_descriptor(&self) -> Result<Description<'_>, Error>; pub fn column_names(&self) -> Result<ColumnNamesIt<'_, Self>, Error> { ... } }

Cursors are used to process and iterate the result sets returned by executing queries.

Required methods

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

Fetch a column description using the column index.

Parameters

  • column_number: Column index. 0 is the bookmark column. The other column indices start with 1.
  • column_description: Holds the description of the column after the call. This method does not provide strong exception safety as the value of this argument is undefined in case of an error.

pub fn num_result_cols(&self) -> Result<i16, Error>[src]

Number of columns in result set.

pub unsafe fn fetch(&mut self) -> Result<bool, Error>[src]

Returns the next set of rows in the result set.

If any columns are bound, it returns the data in those columns. If the application has specified a pointer to a row status array or a buffer in which to return the number of rows fetched, fetch also returns this information. Calls to fetch can be mixed with calls to fetch_scroll.

Safety

Fetch dereferences bound buffers and is therefore unsafe.

pub unsafe fn set_row_array_size(&mut self, size: u32) -> Result<(), Error>[src]

Sets the batch size for bulk cursors, if retrieving many rows at once.

Safety

It is the callers responsibility to ensure that buffers bound using bind_col can hold the specified amount of rows.

pub unsafe fn set_num_rows_fetched(
    &mut self,
    num_rows: &mut usize
) -> Result<(), Error>
[src]

Bind an integer to hold the number of rows retrieved with fetch in the current row set.

Safety

num_rows must not be moved and remain valid, as long as it remains bound to the cursor.

pub unsafe fn set_row_bind_type(&mut self, row_size: u32) -> Result<(), Error>[src]

Sets the binding type to columnar binding for batch cursors.

Any Positive number indicates a row wise binding with that row length. 0 indicates a columnar binding.

Safety

It is the callers responsibility to ensure that the bound buffers match the memory layout specified by this function.

pub fn unbind_cols(&mut self) -> Result<(), Error>[src]

Release all column buffers bound by bind_col. Except bookmark column.

pub unsafe fn bind_col(
    &mut self,
    column_number: u16,
    target: &mut impl CDataMut
) -> Result<(), Error>
[src]

Binds application data buffers to columns in the result set

  • column_number: 0 is the bookmark column. It is not included in some result sets. All other columns are numbered starting with 1. It is an error to bind a higher-numbered column than there are columns in the result set. This error cannot be detected until the result set has been created, so it is returned by fetch, not bind_col.
  • target_type: The identifier of the C data type of the value buffer. When it is retrieving data from the data source with fetch, the driver converts the data to this type. When it sends data to the source, the driver converts the data from this type.
  • target_value: Pointer to the data buffer to bind to the column.
  • target_length: Length of target value in bytes. (Or for a single element in case of bulk aka. block fetching data).
  • indicator: Buffer is going to hold length or indicator values.

Safety

It is the callers responsibility to make sure the bound columns live until they are no longer bound.

pub fn is_unsigned_column(&self, column_number: u16) -> Result<bool, Error>[src]

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

column_number: Index of the column, starting at 1.

pub fn bind_buffer<B>(
    self,
    row_set_buffer: B
) -> Result<RowSetCursor<Self, B>, Error> where
    B: RowSetBuffer
[src]

Binds this cursor to a buffer holding a row set.

pub fn col_type(&self, column_number: u16) -> Result<SqlDataType, Error>[src]

SqlDataType

column_number: Index of the column, starting at 1.

pub fn col_concise_type(&self, column_number: u16) -> Result<SqlDataType, Error>[src]

The concise data type. For the datetime and interval data types, this field returns the concise data type; for example, TIME or INTERVAL_YEAR.

column_number: Index of the column, starting at 1.

pub fn col_octet_length(&self, column_number: u16) -> Result<isize, Error>[src]

Returns the size in bytes of the columns. For variable sized types the maximum size is returned, excluding a terminating zero.

column_number: Index of the column, starting at 1.

pub fn col_display_size(&self, column_number: u16) -> Result<isize, Error>[src]

Maximum number of characters required to display data from the column.

column_number: Index of the column, starting at 1.

pub fn col_precision(&self, column_number: u16) -> Result<isize, Error>[src]

Precision of the column.

Denotes the applicable precision. For data types SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, and all the interval data types that represent a time interval, its value is the applicable precision of the fractional seconds component.

pub fn col_scale(&self, column_number: u16) -> Result<isize, Error>[src]

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.

pub fn col_name(
    &self,
    column_number: u16,
    buf: &mut Vec<u16>
) -> Result<(), Error>
[src]

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.

pub fn application_row_descriptor(&self) -> Result<Description<'_>, Error>[src]

Loading content...

Provided methods

pub fn column_names(&self) -> Result<ColumnNamesIt<'_, Self>, Error>[src]

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

This is a wrapper around col_name introduced for convenience.

Loading content...

Implementors

impl<'o, S> Cursor for CursorImpl<'o, S> where
    S: BorrowMut<Statement<'o>>, 
[src]

Loading content...