Add docs, fix Makefile and fix some bugs and typos

This commit is contained in:
postgres
2010-09-17 07:14:52 -05:00
parent 707c501b24
commit 93417715d4
7 changed files with 392 additions and 139 deletions

View File

@@ -30,3 +30,29 @@ establishDBConnection(const char *conninfo, const bool exit_on_error)
return conn;
}
bool
is_standby(PGconn *conn)
{
PGresult *res;
bool result;
res = PQexec(conn, "SELECT pg_is_in_recovery()");
if (PQresultStatus(res) != PGRES_TUPLES_OK)
{
fprintf(stderr, "Can't query server mode: %s", PQerrorMessage(conn));
PQclear(res);
PQfinish(conn);
exit(1);
}
if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
result = false;
else
result = true;
PQclear(res);
return result;
}