* As above for a SQL maintenance command (returns command success). * Command is executed with a cancel handler set, so Ctrl-C can * interrupt it. */
| 71 | * interrupt it. |
| 72 | */ |
| 73 | bool |
| 74 | executeMaintenanceCommand(PGconn *conn, const char *query, bool echo) |
| 75 | { |
| 76 | PGresult *res; |
| 77 | bool r; |
| 78 | |
| 79 | if (echo) |
| 80 | printf("%s\n", query); |
| 81 | |
| 82 | SetCancelConn(conn); |
| 83 | res = PQexec(conn, query); |
| 84 | ResetCancelConn(); |
| 85 | |
| 86 | r = (res && PQresultStatus(res) == PGRES_COMMAND_OK); |
| 87 | |
| 88 | if (res) |
| 89 | PQclear(res); |
| 90 | |
| 91 | return r; |
| 92 | } |
no test coverage detected