mirror of
https://github.com/postgres/postgres.git
synced 2025-04-27 22:56:53 +03:00
Without this, there's no way to pass arbitrary libpq connection parameters to these applications. It's a bit strange that the option is called -d/--dbname, when in fact you can *not* pass a database name in it, but it's consistent with other client applications where a connection string is also passed using -d. Original patch by Amit Kapila, heavily modified by me.
20 lines
409 B
C
20 lines
409 B
C
#include "libpq-fe.h"
|
|
|
|
extern const char *progname;
|
|
extern char *connection_string;
|
|
extern char *dbhost;
|
|
extern char *dbuser;
|
|
extern char *dbport;
|
|
extern int dbgetpassword;
|
|
|
|
/* Connection kept global so we can disconnect easily */
|
|
extern PGconn *conn;
|
|
|
|
#define disconnect_and_exit(code) \
|
|
{ \
|
|
if (conn != NULL) PQfinish(conn); \
|
|
exit(code); \
|
|
}
|
|
|
|
extern PGconn *GetConnection(void);
|