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

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

Meta