main(int argc, char *argv[]) { my_debug(argv[1]); read_config(); if (!pgsql_connect()) return 0; generate_registry(argv[1]); PQfinish(conn); }
/** * Reset the database conenction. * * Error messages from this function are sent to the message * handler (see msngr_init_log() and msngr_init_mail()). * * @param dbconn - pointer to the database connection * * @return database status: * - DB_NO_ERROR * - DB_MEM_ERROR * - DB_ERROR * * @see DBStatus */ DBStatus pgsql_reset(DBConn *dbconn) { PGconn *pgconn; if (dbconn->dbh) { pgconn = (PGconn *)dbconn->dbh; PQreset(pgconn); if (PQstatus(pgconn) == CONNECTION_OK) { return(DB_NO_ERROR); } } return(pgsql_connect(dbconn)); }