Type Definition odbc_api::parameter::VarCharSlice
source · 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, IntoParameter};
let env = Environment::new()?;
let mut conn = env.connect("YourDatabase", "SA", "My@Test@Password1")?;
if let Some(cursor) = conn.execute(
"SELECT year FROM Birthdays WHERE name=?;",
&"Bernd".into_parameter())?
{
// Use cursor to process query results.
};