serde-odbc

Crates.ioserde-odbc
lib.rsserde-odbc
version0.3.1
created_at2018-02-25 20:39:00.40914+00
updated_at2024-02-11 20:57:34.796357+00
descriptionBind serializable Rust data to ODBC statements
homepage
repositoryhttps://github.com/adamreichold/serde-odbc
max_upload_size
id52824
size178,139
Adam Reichold (adamreichold)

documentation

README

Build Status

Bind serializable Rust data to ODBC statements

The main function of this crate is to use the Serialize trait to automatically make the necessary calls to SQLBindCol and SQLBindParameter. It also supports binding of parameter and row sets, e.g. the following code performs a bulk insert:

#[derive(Clone, Default, Serialize)]
struct Todo {
    id: serde_odbc::Nullable<i32>,
    text: serde_odbc::String<generic_array::typenum::U4096>,
    done: bool,
}

let stmt: serde_odbc::Statement<serde_odbc::ParamSet<Todo>, serde_odbc::NoCols> =
    serde_odbc::Statement::new(&conn, "INSERT INTO todos (id, text, done) VALUES (?, ?, ?)");

stmt.params().reserve(128);
for todo in /* ... */ {
    stmt.params().push(todo);
}

stmt.exec().unwrap();
Commit count: 37

cargo fmt