Database

Represents a generic database.

Members

Enums

Type
enum Type
Undocumented in source.

Functions

close
void close()

Closes the connection with the database. Should only be called after connect.

closeImpl
void closeImpl()
Undocumented in source.
connect
void connect(string db, string user, string password)
void connect(string password)

Performs authentication and connect to a database. It is possible to reconnect using the same object by calling close and then connect again.

connectImpl
void connectImpl(string db, string user, string password)
Undocumented in source.
del
void del(string table, Clause.Where where)

Deletes row from a table.

del
void del(T entity)

Deletes zero or one row using the entity's primary key(s).

deleteImpl
void deleteImpl(string , Clause.Where )
Undocumented in source.
drop
void drop(string table)

Deletes a table. May throw an exception if the table does not exist.

dropIfExists
void dropIfExists(string table)

Deletes a table if exists.

escape
string escape(T value)
Undocumented in source. Be warned that the author may not have intended to support it.
escapeBinary
string escapeBinary(ubyte[] )
Undocumented in source.
escapeDate
string escapeDate(std.datetime.Date )
Undocumented in source.
escapeDateTime
string escapeDateTime(std.datetime.DateTime )
Undocumented in source.
escapeString
string escapeString(string )
Undocumented in source.
escapeTime
string escapeTime(std.datetime.TimeOfDay )
Undocumented in source.
init
void init()

Initializes an entity, either by creating it or updating its fields when it already exists.

initImpl
void initImpl(InitInfo )
Undocumented in source.
insert
void insert(T entity, bool updateId)

Inserts a new entity into the database. This method does not alter the entity: to update it after an insert use select.

insertImpl
Result insertImpl(InsertInfo )
Undocumented in source.
select
T[] select(Select select)

Selects entities from the database using the optional given clauses. The name of the fields should correspond to the name of the entity's fields in the database, not to the ones in the D program.

selectId
T selectId(T entity, Select select)

Selects an entity from its primary key(s).

selectImpl
Result selectImpl(SelectInfo , Select )
Undocumented in source.
selectOne
T selectOne(Select select)

Selects one entity from the database.

update
void update(T entity, Clause.Where where)

Updates one or more table fields. The given fields should correspond to the ones in the entity class, not to the ones in the database.

update
void update(T entity)

Updates a single row of a table searching by the entity's primary key(s).

updateImpl
void updateImpl(UpdateInfo , Clause.Where )
Undocumented in source.

Properties

db
string db [@property getter]

Indicates the name of the database opened or null if the database isn't connected.

Structs

InitInfo
struct InitInfo
Undocumented in source.
InsertInfo
struct InsertInfo
Undocumented in source.
Result
struct Result

Result of a select query.

Select
struct Select

Clauses for select. It is possible to instantiate the struct with the parameters in any order.

SelectInfo
struct SelectInfo
Undocumented in source.
UpdateInfo
struct UpdateInfo
Undocumented in source.

Meta