Database.run

Runs an SQL script that can contain multiple statements.

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

Parameters

script string

The code of the SQL script.

dg 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

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

Meta