Skip to content

Commit

Permalink
Fix (bool *)PQgetval
Browse files Browse the repository at this point in the history
  • Loading branch information
Cédric Villemain authored and Jaime Casanova committed Mar 9, 2011
1 parent bf91816 commit 035a9bc
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions dbutils.c
Expand Up @@ -68,6 +68,7 @@ bool
is_standby(PGconn *conn)
{
PGresult *res;
bool *resbool;
bool result;

res = PQexec(conn, "SELECT pg_is_in_recovery()");
Expand All @@ -80,11 +81,11 @@ is_standby(PGconn *conn)
PQfinish(conn);
exit(ERR_DB_QUERY);
}

if (strcmp(PQgetvalue(res, 0, 0), "f") == 0)
result = false;
else
resbool = (bool *) PQgetvalue(res, 0, 0);
if (resbool)
result = true;
else
result = false;

PQclear(res);
return result;
Expand Down

0 comments on commit 035a9bc

Please sign in to comment.