The OpenD Programming Language

Row

A row in a result set from a query.

You can access this as either an array or associative array:

foreach(Row row; db.query("SELECT id, name FROM mytable")) {
	// can access by index or by name
	row[0] == row["id"];
	row[1] == row["name"];

	// can also iterate over the results
	foreach(name, data; row) {
		 // will send name = "id", data = the thing
		 // and then next loop will be name = "name", data = the thing
	}
}

Members

Functions

opApply
int opApply(int delegate(string, DatabaseDatum) dg)
int opApply(int delegate(DatabaseDatum) dg)

Allows iteration over the columns with the foreach statement.

opIndex
DatabaseDatum opIndex(size_t idx, string file, int line)
DatabaseDatum opIndex(string name, string file, int line)

Allows for access by index or column name.

toAA
string[string] toAA()

Hacky conversion to simpler types.

toString
string toString()

Provides a string representation of the row, for quick eyeball debugging. You probably won't want the format this prints in (and don't rely upon it, as it is subject to change at any time without notice!), but it might be useful for use with writeln.

toStringArray
string[] toStringArray()

Hacky conversion to simpler types.

Meta