aboutsummaryrefslogtreecommitdiff
path: root/src/bin/scripts/common.h
blob: 52e7b0c3fccc0f7e346945fd0e6f7fe96f7f5100 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "postgres_fe.h"

#ifdef HAVE_GETOPT_H
# include <getopt.h>
#endif

#ifndef HAVE_GETOPT_LONG
#include "getopt_long.h"
#endif

#include "libpq-fe.h"
#include "pqexpbuffer.h"

#ifndef HAVE_OPTRESET
int optreset;
#endif

const char *get_user_name(const char *progname);
char *get_progname(char *argv0);

#define _(x) gettext((x))
void init_nls(void);

typedef void (*help_handler)(const char *);

void handle_help_version_opts(int argc, char *argv[], const char *fixed_progname, help_handler hlp);

extern char *simple_prompt(const char *prompt, int maxlen, bool echo);

PGconn *
connectDatabase(const char *dbname, const char *pghost, const char *pgport,
				const char *pguser, bool require_password, const char *progname);

PGresult *
executeQuery(PGconn *conn, const char *command, const char *progname, bool echo);