7 releases
0.1.6 | Dec 23, 2019 |
---|---|
0.1.5 | Dec 23, 2019 |
#5 in #rdbc
Used in rdbc-cli
11KB
244 lines
MySQL RDBC Driver
This crate implements an RDBC Driver for the mysql
crate.
The RDBC (Rust DataBase Connectivity) API is loosely based on the ODBC and JDBC standards.
use rdbc::Value;
use rdbc_mysql::MySQLDriver;
let driver = MySQLDriver::new();
let conn = driver.connect("mysql://root:password@localhost:3307/mysql").unwrap();
let mut conn = conn.borrow_mut();
let stmt = conn.prepare("SELECT a FROM b WHERE c = ?").unwrap();
let mut stmt = stmt.borrow_mut();
let rs = stmt.execute_query(&vec![Value::Int32(123)]).unwrap();
let mut rs = rs.borrow_mut();
while rs.next() {
println!("{:?}", rs.get_string(1));
}
Dependencies
~15–27MB
~452K SLoC