Consolidate connection closure calls

This commit is contained in:
Ian Barwick
2018-03-21 12:35:35 +09:00
committed by Ian Barwick
parent 71b13f5307
commit a403da67bc
4 changed files with 60 additions and 59 deletions

View File

@@ -311,6 +311,21 @@ is_superuser_connection(PGconn *conn, t_connection_user *userinfo)
}
void
close_connection(PGconn **conn)
{
if (*conn == NULL)
return;
if (PQstatus(*conn) == CONNECTION_OK)
{
PQfinish(*conn);
}
*conn = NULL;
}
/* =============================== */
/* conninfo manipulation functions */
/* =============================== */