Function Database.run

Runs an SQL script that can contain multiple statements.

void run (
  string script,
  bool delegate(ResultRange) dg = cast(bool delegate(ResultRange))null
);

Parameters

NameDescription
script The code of the SQL script.
dg 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.

Example

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