PGCommand.executeNonQuery

Executes a non query command, i.e. query which doesn't return any rows. Commonly used with data manipulation commands, such as INSERT, UPDATE and DELETE.

class PGCommand
ulong
executeNonQuery
()

Return Value

Type: ulong

Number of affected rows.

Examples

auto cmd = new PGCommand(conn, "DELETE * FROM table");
auto deletedRows = cmd.executeNonQuery;
cmd.query = "UPDATE table SET quantity = 1 WHERE price > 100";
auto updatedRows = cmd.executeNonQuery;
cmd.query = "INSERT INTO table VALUES(1, 50)";
assert(cmd.executeNonQuery == 1);

Meta