ddbc.core

DDBC - D DataBase Connector - abstraction layer for RDBMS access, with interface similar to JDBC.

Source file ddbc/core.d.

DDBC library attempts to provide implementation independent interface to different databases.

Set of supported RDBMSs can be extended by writing Drivers for particular DBs. Currently it only includes MySQL Driver which uses patched version of MYSQLN (native D implementation of MySQL connector, written by Steve Teale)

JDBC documentation can be found here: http://docs.oracle.com/javase/1.5.0/docs/api/java/sql/package-summary.html

Limitations of current version: readonly unidirectional resultset, completely fetched into memory.

Its primary objects are:

  • Driver:
    • Implements interface to particular RDBMS, used to create connections
  • Connection:
    • Connection to the server, and querying and setting of server parameters.
  • Statement: Handling of general SQL requests/queries/commands, with principal methods:
    • executeUpdate() - run query which doesn't return result set.
    • executeQuery() - execute query which returns ResultSet interface to access rows of result.
  • PreparedStatement: Handling of general SQL requests/queries/commands which having additional parameters, with principal methods:
    • executeUpdate() - run query which doesn't return result set.
    • executeQuery() - execute query which returns ResultSet interface to access rows of result.
    • setXXX() - setter methods to bind parameters.
  • ResultSet:
    • Get result of query row by row, accessing individual fields.

You can find usage examples in unittest{} sections.

Members

Enums

SqlType
enum SqlType

JDBC java.sql.Types from http://docs.oracle.com/javase/6/docs/api/java/sql/Types.html

Functions

makeDDBCUrl
string makeDDBCUrl(string driverName, string[string] params)

Helper function to make url in format required for DSN connections to Microsoft SQL Server

makeDDBCUrl
string makeDDBCUrl(string driverName, string host = null, int port = 0, string dbName = null, string[string] params = null)

Helper function to make url in form driverName://host:port/dbname?param1=value1,param2=value2

Interfaces

Connection
interface Connection
ParameterMetaData
interface ParameterMetaData
PreparedStatement
interface PreparedStatement

An object that represents a precompiled SQL statement.

ResultSet
interface ResultSet

Meta

Authors

Vadim Lopatin