Skip to content

Bind serializable Rust data to ODBC statements

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

adamreichold/serde-odbc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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();

About

Bind serializable Rust data to ODBC statements

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Languages