PGCommand.executeRow

Executes query and returns only first row of the result.

class PGCommand
DBRow!Specs
executeRow
(
Specs...
)
(
bool throwIfMoreRows = true
)

Parameters

throwIfMoreRows
Type: bool

If true, throws Exception when result contains more than one row.

Throws

Exception if result doesn't contain any rows or field count do not match. Exception if result contains more than one row when throwIfMoreRows is true.

Examples

auto cmd = new PGCommand(conn, "SELECT 1, 'abc'");
auto row1 = cmd.executeRow!(int, string); // returns DBRow!(int, string)
assert(is(typeof(i[0]) == int) && is(typeof(i[1]) == string));
auto row2 = cmd.executeRow; // returns DBRow!(Variant[])

Meta