std.database.BasicDatabase

BasicDatabase: a common and generic front-end for database access

Typically, this interface is impliclity used when import a specific database driver as shown in this simple example:

import std.database.sqlite;
auto db = createDatabase("file:///testdb");
auto rows = db.connection.query("select name,score from score").rows;
foreach (r; rows) writeln(r[0], r[1]);

BasicDatabase, and it's chain of types, provides a common, easy to use, and flexibe front end for client interactions with a database. it carefully manages lifetimes and states, making the front end easy to use and the driver layer easy to implement.

For advanced usage (such as library implementers), you can also explicitly instantiate a BasicDatabase with a specific Driver type:

1 struct MyDriver {
2   struct Database {//...}
3   struct Connection {//...}
4   struct Statement {//...}
5   struct Bind {//...}
6   struct Result {//...}
7 }
8 
9 import std.database;
10 alias DB = BasicDatabase!(MyDriver);
11 auto db = DB("mysql://127.0.0.1");

Members

Structs

BasicColumnSet
struct BasicColumnSet(D)

A range over result column information

BasicConnection
struct BasicConnection(D)

Database connection class

BasicDatabase
struct BasicDatabase(D)

A root type for interacting with databases. It's primary purpose is act as a factory for database connections. This type can be shared across threads.

BasicResult
struct BasicResult(D)

An internal class for result access and iteration. See the RowSet type for range based access to results

BasicRow
struct BasicRow(D)

A row accessor for the current row in a RowSet input range.

BasicRowSet
struct BasicRowSet(D)

A input range over the results of a query.

BasicStatement
struct BasicStatement(D)

Manages statement details such as query execution and input binding.

BasicValue
struct BasicValue(D)

A value accessor for an indexed value in the current row in a RowSet input range.

Meta