odbc_api::parameter

Type Alias VarCharSlice

Source
pub type VarCharSlice<'a> = VarChar<&'a [u8]>;
Expand description

Binds a byte array as a VarChar input parameter.

While a byte array can provide us with a pointer to the start of the array and the length of the array itself, it can not provide us with a pointer to the length of the buffer. So to bind strings which are not zero terminated we need to store the length in a separate value.

This type is created if into_parameter of the IntoParameter trait is called on a &str.

§Example

use odbc_api::{Environment, ConnectionOptions, IntoParameter};

let env = Environment::new()?;

let mut conn = env.connect(
    "YourDatabase", "SA", "My@Test@Password1",
    ConnectionOptions::default()
)?;
if let Some(cursor) = conn.execute(
    "SELECT year FROM Birthdays WHERE name=?;",
    &"Bernd".into_parameter())?
{
    // Use cursor to process query results.
};

Aliased Type§

struct VarCharSlice<'a> { /* private fields */ }