odbc_api::handles

Struct Descriptor

Source
pub struct Descriptor<'stmt> { /* private fields */ }
Expand description

A descriptor associated with a statement. This wrapper does not wrap explicitly allocated descriptors which have the connection as parent, but usually implicitly allocated ones associated with the statement. It could also represent an explicitly allocated one, but ony in the context there it is associated with a statement and currently borrowed from it.

  • IPD Implementation parameter descriptor
  • APD Application parameter descriptor
  • IRD Implemenation row descriptor
  • ARD Application row descriptor

Implementations§

Source§

impl<'stmt> Descriptor<'stmt>

Source

pub unsafe fn new(handle: HDesc) -> Self

§Safety

Call this method only with a valid (successfully allocated) ODBC descriptor handle.

Source

pub fn as_sys(&self) -> HDesc

Directly acces the underlying ODBC handle.

Source

pub fn set_precision( &mut self, rec_number: i16, precision: i16, ) -> SqlResult<()>

Number of digits for an exact numeric type, the number of bits in the mantissa (binary precision) for an approximate numeric type, or the numbers of digits in the fractional seconds component for the SQL_TYPE_TIME, SQL_TYPE_TIMESTAMP, or SQL_INTERVAL_SECOND data type. This field is undefined for all other data types. See: https://learn.microsoft.com/sql/odbc/reference/syntax/sqlsetdescfield-function

Source

pub fn set_scale(&mut self, rec_number: i16, scale: i16) -> SqlResult<()>

The defined scale for decimal and numeric data types. The field is undefined for all other data types.

Source

pub unsafe fn set_type( &mut self, rec_number: i16, c_type: CDataType, ) -> SqlResult<()>

C-Type bound to the data pointer.

§Safety

The buffer bound to the data pointer in ARD must match, otherwise calls to fetch might e.g. write beyond the bounds of these types, if e.g. a larger type is bound

Source

pub unsafe fn set_data_ptr( &mut self, rec_number: i16, data_ptr: Pointer, ) -> SqlResult<()>

Data pointer filled with values from the source when fetching data.

§Safety

Pointer must be valid and match the description set using set_type.

Trait Implementations§

Source§

impl<'stmt> AsHandle for Descriptor<'stmt>

Source§

fn as_handle(&self) -> Handle

The raw underlying ODBC handle used to talk to the ODBC C API. The handle must be valid.
Source§

fn handle_type(&self) -> HandleType

The type of the ODBC handle returned by as_handle. This is a method rather than a constant in order to make the type object safe.

Auto Trait Implementations§

§

impl<'stmt> Freeze for Descriptor<'stmt>

§

impl<'stmt> RefUnwindSafe for Descriptor<'stmt>

§

impl<'stmt> !Send for Descriptor<'stmt>

§

impl<'stmt> !Sync for Descriptor<'stmt>

§

impl<'stmt> Unpin for Descriptor<'stmt>

§

impl<'stmt> UnwindSafe for Descriptor<'stmt>

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> Diagnostics for T
where T: AsHandle + ?Sized,

Source§

fn diagnostic_record( &self, rec_number: i16, message_text: &mut [u8], ) -> Option<DiagnosticResult>

Call this method to retrieve diagnostic information for the last call to an ODBC function. Read more
Source§

fn diagnostic_record_vec( &self, rec_number: i16, message_text: &mut Vec<SqlChar>, ) -> Option<DiagnosticResult>

Call this method to retrieve diagnostic information for the last call to an ODBC function. This method builds on top of Self::diagnostic_record, if the message does not fit in the buffer, it will grow the message buffer and extract it again. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.