The OpenD Programming Language

MySql

The main class for accessing the MySql database.

// connect to database with the constructor
auto db = new MySql("localhost", "my_user", "my_password", "my_database_name");
// use the query function to execute sql...
// use ? for data placeholders...
db.query("INSERT INTO people (id, name) VALUES (?, ?)", 10, "My Name");
// and use foreach to loop over result sets
foreach(row; db.query("SELECT id, name FROM people ORDER BY name LIMIT 10"))
	writeln(row[0], " ", row["name"]); // index and name supported

Destructor

A destructor is present on this object, but not explicitly documented in the source.

Members

Functions

affectedRows
int affectedRows()
insert
int insert(string table, MySqlResult result, string[string] columnsToModify, string[] columnsToSkip)

Builds and executes an INERT INTO statement

lastInsertId
int lastInsertId()
queryDataObject
ResultByDataObject!R queryDataObject(string sql, T t)
queryDataObjectWithCustomKeys
ResultByDataObject!R queryDataObjectWithCustomKeys(string[string] keyMapping, string sql, T t)

Gets a minimal ORM object from a query

startTransaction
void startTransaction()

Meta