arsd.database

Public Imports

std.variant
public import std.variant;
Undocumented in source.
std.datetime
public import std.datetime;
Undocumented in source.

Members

Classes

InsertBuilder
class InsertBuilder
Undocumented in source.
SelectBuilder
class SelectBuilder

WARNING: this is as susceptible to SQL injections as you would be writing it out by hand

SimpleDataObject
class SimpleDataObject(string tableToUse, fieldsToUse)

This creates an editable data object out of a simple struct.

Functions

DataObjectField
string DataObjectField()

You can subclass DataObject if you want to get some compile time checks or better types.

escapedVariants
string escapedVariants(Database db, string sql, Variant[] t)

Note: ?n params are zero based!

Interfaces

Database
interface Database

Structs

StructFromCreateTable
struct StructFromCreateTable(string sql, string tableName)

Given some SQL, it finds the CREATE TABLE instruction for the given tableName. (this is so it can find one entry from a file with several SQL commands. But it may break on a complex file, so try to only feed it simple sql files.)

Templates

DataObjectFromSqlCreateTable
template DataObjectFromSqlCreateTable(string sql, string tableName)

Combines StructFromCreateTable and SimpleDataObject into a one-stop template. alias DataObjectFromSqlCreateTable(import("file.sql"), "my_table") MyTable;

Meta