ddbc.common

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

Source file ddbc/common.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

This module contains some useful base class implementations for writing Driver for particular RDBMS. As well it contains useful class - ConnectionPoolDataSourceImpl - which can be used as connection pool.

You can find usage examples in unittest{} sections.

Members

Aliases

DriverFactoryDelegate
alias DriverFactoryDelegate = Driver delegate()

Delegate type to create DDBC driver instance.

Classes

ColumnMetadataItem
class ColumnMetadataItem

Column metadata object to be used in driver implementations

ConnectionPoolDataSourceImpl
class ConnectionPoolDataSourceImpl

Simple connection pool DataSource implementation. When close() is called on connection received from this pool, it will be returned to pool instead of closing. Next getConnection() will just return existing connection from pool, instead of slow connection establishment process.

ConnectionWrapper
class ConnectionWrapper

Wrapper class for connection

DataSourceImpl
class DataSourceImpl

Implementation of simple DataSource: it just holds connection parameters, and can create new Connection by getConnection(). Method close() on such connection will really close connection.

DriverFactory
class DriverFactory

DDBC Driver factory. Can create driver by name or DDBC URL.

ParameterMetaDataImpl
class ParameterMetaDataImpl

parameter set metadate implementation object - to be used in driver implementations

ParameterMetaDataItem
class ParameterMetaDataItem

parameter metadata object - to be used in driver implementations

ResultSetImpl
class ResultSetImpl

Helper implementation of ResultSet - throws Method not implemented for most of methods. Useful for driver implementations

ResultSetMetaDataImpl
class ResultSetMetaDataImpl

Metadata for result set - to be used in driver implementations

Functions

createConnection
Connection createConnection(string url, string[string] params)

Helper function to create DDBC connection, automatically selecting driver based on URL

createConnectionPool
DataSource createConnectionPool(string url, string[string] params, int maxPoolSize, int timeToLive, int waitTimeOut)

Helper function to create connection pool data source, automatically selecting driver based on URL

createDataSource
DataSource createDataSource(string url, string[string] params)

Helper function to create simple DDBC DataSource, automatically selecting driver based on URL

extractDriverNameFromURL
string extractDriverNameFromURL(string url)

extracts driver name from DDBC URL e.g., for "ddbc:postgresql://localhost/test" it will return "postgresql"

extractParamsFromURL
void extractParamsFromURL(string url, string[string] params)

extract parameters from URL string to stringstring map, update url to strip params

setUserAndPassword
void setUserAndPassword(string[string] params, string username, string password)

sets user and password parameters in parameter map

stripDdbcPrefix
string stripDdbcPrefix(string url)

removes ddbc: prefix from string (if any) e.g., for "ddbc:postgresql://localhost/test" it will return "postgresql://localhost/test"

unitTestExecuteBatch
void unitTestExecuteBatch(Connection conn, string[] queries)
Undocumented in source. Be warned that the author may not have intended to support it.

Interfaces

ConnectionCloseHandler
interface ConnectionCloseHandler

To be called on connection close

Static functions

myRemove
void myRemove(T[] array, size_t index)
Undocumented in source. Be warned that the author may not have intended to support it.
myRemove
void myRemove(T[] array, T item)
Undocumented in source. Be warned that the author may not have intended to support it.

Meta

Authors

Vadim Lopatin