[][src]Crate rdbc_sqlite

SQLite RDBC Driver

This crate implements an RDBC Driver for the rusqlite crate.

The RDBC (Rust DataBase Connectivity) API is loosely based on the ODBC and JDBC standards.

use std::sync::Arc;
use rdbc::{self, Value};
use rdbc_sqlite::SqliteDriver;
let driver: Arc<dyn rdbc::Driver> = Arc::new(SqliteDriver::new());
let conn = driver.connect("").unwrap();
let mut conn = conn.borrow_mut();
let stmt = conn.prepare("CREATE TABLE test (a INT NOT NULL)").unwrap().borrow_mut().execute_update(&vec![]).unwrap();
let stmt = conn.prepare("INSERT INTO test (a) VALUES (?)").unwrap().borrow_mut().execute_update(&vec![rdbc::Value::Int32(123)]).unwrap();
let stmt = conn.prepare("SELECT a FROM test").unwrap();
let mut stmt = stmt.borrow_mut();
let rs = stmt.execute_query(&vec![]).unwrap();
assert_eq!(Some(123), rs.as_ref().borrow_mut().get_i32(0).unwrap());