PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
common.h
Go to the documentation of this file.
1 /*
2  * common.h
3  * Common support routines for bin/scripts/
4  *
5  * Copyright (c) 2003-2017, PostgreSQL Global Development Group
6  *
7  * src/bin/scripts/common.h
8  */
9 #ifndef COMMON_H
10 #define COMMON_H
11 
12 #include "common/username.h"
13 #include "libpq-fe.h"
14 #include "getopt_long.h" /* pgrminclude ignore */
15 #include "pqexpbuffer.h" /* pgrminclude ignore */
16 
18 {
22 };
23 
24 extern bool CancelRequested;
25 
26 typedef void (*help_handler) (const char *progname);
27 
28 extern void handle_help_version_opts(int argc, char *argv[],
29  const char *fixed_progname,
30  help_handler hlp);
31 
32 extern PGconn *connectDatabase(const char *dbname, const char *pghost,
33  const char *pgport, const char *pguser,
34  enum trivalue prompt_password, const char *progname,
35  bool fail_ok, bool allow_password_reuse);
36 
37 extern PGconn *connectMaintenanceDatabase(const char *maintenance_db,
38  const char *pghost, const char *pgport, const char *pguser,
39  enum trivalue prompt_password, const char *progname);
40 
41 extern PGresult *executeQuery(PGconn *conn, const char *query,
42  const char *progname, bool echo);
43 
44 extern void executeCommand(PGconn *conn, const char *query,
45  const char *progname, bool echo);
46 
47 extern bool executeMaintenanceCommand(PGconn *conn, const char *query,
48  bool echo);
49 
50 extern bool yesno_prompt(const char *question);
51 
52 extern void setup_cancel_handler(void);
53 
54 extern void SetCancelConn(PGconn *conn);
55 extern void ResetCancelConn(void);
56 
57 
58 #endif /* COMMON_H */
void setup_cancel_handler(void)
Definition: common.c:288
Definition: common.h:20
bool yesno_prompt(const char *question)
Definition: common.c:265
void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp)
Definition: common.c:35
void executeCommand(PGconn *conn, const char *query, const char *progname, bool echo)
Definition: common.c:205
const char * progname
Definition: pg_standby.c:37
void(* help_handler)(const char *progname)
Definition: common.h:26
void SetCancelConn(void)
Definition: common.c:402
bool executeMaintenanceCommand(PGconn *conn, const char *query, bool echo)
Definition: common.c:235
PGconn * conn
Definition: streamutil.c:45
Definition: common.h:21
bool CancelRequested
Definition: common.c:24
char * pghost
Definition: pgbench.c:180
trivalue
Definition: vacuumlo.c:31
char * dbname
Definition: streamutil.c:41
PGconn * connectDatabase(const char *dbname, const char *pghost, const char *pgport, const char *pguser, enum trivalue prompt_password, const char *progname, bool fail_ok, bool allow_password_reuse)
Definition: common.c:66
void ResetCancelConn(void)
Definition: common.c:432
PGresult * executeQuery(PGconn *conn, const char *query, const char *progname, bool echo)
Definition: common.c:178
char * pgport
Definition: pgbench.c:181
PGconn * connectMaintenanceDatabase(const char *maintenance_db, const char *pghost, const char *pgport, const char *pguser, enum trivalue prompt_password, const char *progname)
Definition: common.c:152