Struct odbc_api::handles::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 [u16], ) -> 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> 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>,

§

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>,

§

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