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: BufferDescDescribes the C-Type used to describe values and wether we need a NULL representation.
data_type: DataTypeThe 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
impl BindParamDesc
Sourcepub fn wide_text(max_str_len: usize) -> Self
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.
Sourcepub fn text(max_str_len: usize) -> Self
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.
Sourcepub fn timestamp(nullable: bool, precision: i16) -> Self
pub fn timestamp(nullable: bool, precision: i16) -> Self
A description for binding timestamps to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull 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 choose3. Many databases error if you exceed the maximum precision of the column. If you are unsure about the maximum precision supported by the Database7is a good guess.
Sourcepub fn time(nullable: bool) -> Self
pub fn time(nullable: bool) -> Self
A description for binding [crate::Time] values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn time_as_text(precision: i16) -> Self
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 choose3. Some databases error if you exceed the maximum precision of the column. If you are unsure about the maximum precision supported by the Database7is a good guess.
Sourcepub fn decimal_as_text(precision: u8, scale: i8) -> Self
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. for123.45this would be5.scale: The number of digits to the right of the decimal point. E.g. for123.45this would be2.
Sourcepub fn i16(nullable: bool) -> Self
pub fn i16(nullable: bool) -> Self
A description for binding 16 bit integers to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn i32(nullable: bool) -> Self
pub fn i32(nullable: bool) -> Self
A description for binding 32 bit integers to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn i64(nullable: bool) -> Self
pub fn i64(nullable: bool) -> Self
A description for binding 64 bit integers to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn binary(max_bytes: usize) -> Self
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.
Sourcepub fn f64(nullable: bool) -> Self
pub fn f64(nullable: bool) -> Self
A description for binding f64 values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn f32(nullable: bool) -> Self
pub fn f32(nullable: bool) -> Self
A description for binding f32 values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn u8(nullable: bool) -> Self
pub fn u8(nullable: bool) -> Self
A description for binding u8 values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn i8(nullable: bool) -> Self
pub fn i8(nullable: bool) -> Self
A description for binding u8 values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn date(nullable: bool) -> Self
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. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Sourcepub fn bit(nullable: bool) -> Self
pub fn bit(nullable: bool) -> Self
A description for binding crate::Bit values to a parameter.
§Parameters
nullable: Whether the parameter can be NULL. Iftruenull values can be represented, iffalsenull values can not be represented, but we can save an allocation for an indicator buffer.
Trait Implementations§
Source§impl Clone for BindParamDesc
impl Clone for BindParamDesc
Source§fn clone(&self) -> BindParamDesc
fn clone(&self) -> BindParamDesc
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more