Database.run

Runs an SQL script that can contain multiple statements.

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

Parameters

sql string

The code of the 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