* As above for a SQL command (which returns nothing). */
| 44 | * As above for a SQL command (which returns nothing). |
| 45 | */ |
| 46 | void |
| 47 | executeCommand(PGconn *conn, const char *query, bool echo) |
| 48 | { |
| 49 | PGresult *res; |
| 50 | |
| 51 | if (echo) |
| 52 | printf("%s\n", query); |
| 53 | |
| 54 | res = PQexec(conn, query); |
| 55 | if (!res || |
| 56 | PQresultStatus(res) != PGRES_COMMAND_OK) |
| 57 | { |
| 58 | pg_log_error("query failed: %s", PQerrorMessage(conn)); |
| 59 | pg_log_info("query was: %s", query); |
| 60 | PQfinish(conn); |
| 61 | exit(1); |
| 62 | } |
| 63 | |
| 64 | PQclear(res); |
| 65 | } |
| 66 | |
| 67 | |
| 68 | /* |
no test coverage detected