Database.run

Runs an SQL script that can contain multiple statements.

struct Database
void
run
(
string script
,
bool delegate() dg = null
)

Parameters

script
Type: string

The code of the SQL script.

dg
Type: bool delegate()

A delegate to call for each statement to handle the results. The passed ResultRange will be empty if a statement doesn't return rows. If the delegate return false, the execution is aborted.

Examples

1 auto db = Database(":memory:");
2 db.run(`CREATE TABLE test1 (val INTEGER);
3         CREATE TABLE test2 (val FLOAT);
4         DROP TABLE test1;
5         DROP TABLE test2;`);

Meta