rbatis_drivers 1.0.2

Rust DataBase Connectivity (RDBC) API
Documentation

The RDBC (Rust DataBase Connectivity) API is loosely based on the ODBC and JDBC standards and provides a database agnostic programming interface for executing queries and fetching results.

Reference implementation RDBC Drivers exist for Postgres, MySQL and SQLite.

The following example demonstrates how RDBC can be used to run a trivial query against Postgres.

use crate::*;
use rdbc_postgres::PostgresDriver;

let driver = PostgresDriver::new();
let mut conn = driver.connect("postgres://postgres:password@localhost:5433").unwrap();
let mut stmt = conn.prepare("SELECT a FROM b WHERE c = ?").unwrap();
let mut rs = stmt.execute_query(&[Value::Int32(123)]).unwrap();
while rs.next() {
println!("{:?}", rs.get_string(1));
}