Skip to main content

BindParamDesc

Struct BindParamDesc 

Source
pub struct BindParamDesc {
    pub buffer_desc: BufferDesc,
    pub data_type: DataType,
}
Expand description

Description of paramater domain and buffer bound for bulk insertion. Used by Prepared::column_inserter.

Fields§

§buffer_desc: BufferDesc

Describes the C-Type used to describe values and wether we need a NULL representation.

§data_type: DataType

The relational type or domain of the parameter. While there is a strong correllation between the buffer used and the relational type, it is not always a naive mapping. E.g. a text buffer can not only carry VARCHAR but also a DECIMAL or a timestamp.

Implementations§

Source§

impl BindParamDesc

Source

pub fn wide_text(max_str_len: usize) -> Self

A description for binding utf-16 data to a parameter.

§Parameters
  • max_str_len: The maximum length of the string in utf-16 code units. Excluding terminating null character.

Uses a wide character buffer and sets the data type to DataType::WVarchar or DataType::WLongVarchar.

Source

pub fn text(max_str_len: usize) -> Self

A description for binding narrow text (usually utf-8) data to a parameter.

  • max_str_len: The maximum length of the string in bytes. excluding terminating null character.

Uses a narrow character buffer and sets the data type to DataType::Varchar or DataType::LongVarchar.

Source

pub fn timestamp(nullable: bool, precision: i16) -> Self

A description for binding timestamps to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
  • precision: The number of digits for the fractional seconds part. E.g. if you know your input to be milliseconds choose 3. Many databases error if you exceed the maximum precision of the column. If you are unsure about the maximum precision supported by the Database 7 is a good guess.
Source

pub fn time(nullable: bool) -> Self

A description for binding [crate::Time] values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn time_as_text(precision: i16) -> Self

A description for binding wallclock time in a text buffer.

§Parameters
  • precision: The number of digits for the fractional seconds part. E.g. if you know your input to be milliseconds choose 3. Some databases error if you exceed the maximum precision of the column. If you are unsure about the maximum precision supported by the Database 7 is a good guess.
Source

pub fn decimal_as_text(precision: u8, scale: i8) -> Self

A description for binding decimal represented as text to a parameter.

§Parameters
  • precision: The total number of digits in the decimal number. E.g. for 123.45 this would be 5.
  • scale: The number of digits to the right of the decimal point. E.g. for 123.45 this would be 2.
Source

pub fn i16(nullable: bool) -> Self

A description for binding 16 bit integers to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn i32(nullable: bool) -> Self

A description for binding 32 bit integers to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn i64(nullable: bool) -> Self

A description for binding 64 bit integers to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn binary(max_bytes: usize) -> Self

A description for binding variadic binary data to a parameter.

§Parameters
  • max_bytes: The maximum length of the binary data in bytes.
Source

pub fn f64(nullable: bool) -> Self

A description for binding f64 values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn f32(nullable: bool) -> Self

A description for binding f32 values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn u8(nullable: bool) -> Self

A description for binding u8 values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn i8(nullable: bool) -> Self

A description for binding u8 values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn date(nullable: bool) -> Self

A description for binding crate::sys::Date values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.
Source

pub fn bit(nullable: bool) -> Self

A description for binding crate::Bit values to a parameter.

§Parameters
  • nullable: Whether the parameter can be NULL. If true null values can be represented, if false null values can not be represented, but we can save an allocation for an indicator buffer.

Trait Implementations§

Source§

impl Clone for BindParamDesc

Source§

fn clone(&self) -> BindParamDesc

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BindParamDesc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for BindParamDesc

Source§

fn eq(&self, other: &BindParamDesc) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for BindParamDesc

Source§

impl Eq for BindParamDesc

Source§

impl StructuralPartialEq for BindParamDesc

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.