[−][src]Crate rdbc
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 and MySQL.
The following example demonstrates how RDBC can be used to run a trivial query against Postgres.
ⓘThis example is not tested
let driver = PostgresDriver::new(); let conn = driver.connect("postgres://postgres@localhost:5433"); let stmt = conn.create_statement("SELECT foo FROM bar").unwrap(); let rs = stmt.execute_query().unwrap(); let mut rs = rs.borrow_mut(); while rs.next() { println!("{}", rs.get_string(1)); }
Enums
Error | RDBC Error |
Traits
Connection | Represents a connection to a database |
ResultSet | Result set from executing a query against a statement |
Type Definitions
Result | RDBC Result type |