diff options
author | Mark Wong <markwkm@gmail.com> | 2007-09-21 17:16:51 -0700 |
---|---|---|
committer | Mark Wong <markwkm@gmail.com> | 2007-09-21 17:16:51 -0700 |
commit | 37b02356e7f88ac2b7bd2f03e6d8912467c49676 (patch) | |
tree | d25395b32165009dd452199043a0486dae55ebb3 /commands.c | |
parent | b836d596e5c9e21441f7689a2000270567ccdfe0 (diff) |
Made changes so that the ptop will run without seg faulting if the
database isn't running or if the database stops while ptop is running.
The system summary info will still update but there will not be any
processes displayed. Tried to get a message to display that the no
database connection was made. That can hopefully be fixed in a later
version.
Diffstat (limited to 'commands.c')
-rw-r--r-- | commands.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -31,6 +31,7 @@ #include "version.h" #include "machine.h" #include "help.h" +#include "pg.h" extern int errno; @@ -521,7 +522,7 @@ show_current_query(char *conninfo, int procpid) display_pager(info); /* Get the currently running query. */ - pgconn = PQconnectdb(conninfo); + pgconn = connect_to_db(conninfo); pgresult = PQexec(pgconn, sql); rows = PQntuples(pgresult); for (i = 0; i < rows; i++) { @@ -555,7 +556,7 @@ show_locks(char *conninfo, int procpid) display_pager(info); /* Get the locks helf by the process. */ - pgconn = PQconnectdb(conninfo); + pgconn = connect_to_db(conninfo); pgresult = PQexec(pgconn, sql); rows = PQntuples(pgresult); |