[][src]Crate rbatis_drivers

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.

This example is not tested
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));
}

Modules

mysql

MySQL RDBC Driver

postgres

Postgres RDBC Driver

time_util

Structs

Column

Enums

DataType

RDBC Data Types

Error

RDBC Error

Value

Traits

Connection

Represents a connection to a database

Driver

Represents database driver that can be shared between threads, and can therefore implement a connection pool

ResultSet

Result set from executing a query against a statement

ResultSetMetaData

Meta data for result set

Statement

Represents an executable statement

Type Definitions

Result

RDBC Result type