PostgreSQL Source Code
git master
connect_utils.h
Go to the documentation of this file.
1
/*-------------------------------------------------------------------------
2
*
3
* Facilities for frontend code to connect to and disconnect from databases.
4
*
5
* Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
6
* Portions Copyright (c) 1994, Regents of the University of California
7
*
8
* src/include/fe_utils/connect_utils.h
9
*
10
*-------------------------------------------------------------------------
11
*/
12
#ifndef CONNECT_UTILS_H
13
#define CONNECT_UTILS_H
14
15
#include "
libpq-fe.h
"
16
17
enum
trivalue
18
{
19
TRI_DEFAULT
,
20
TRI_NO
,
21
TRI_YES
22
};
23
24
/* Parameters needed by connectDatabase/connectMaintenanceDatabase */
25
typedef
struct
_connParams
26
{
27
/* These fields record the actual command line parameters */
28
const
char
*
dbname
;
/* this may be a connstring! */
29
const
char
*
pghost
;
30
const
char
*
pgport
;
31
const
char
*
pguser
;
32
enum
trivalue
prompt_password
;
33
/* If not NULL, this overrides the dbname obtained from command line */
34
/* (but *only* the DB name, not anything else in the connstring) */
35
const
char
*
override_dbname
;
36
}
ConnParams
;
37
38
extern
PGconn
*
connectDatabase
(
const
ConnParams
*cparams,
39
const
char
*
progname
,
40
bool
echo,
bool
fail_ok,
41
bool
allow_password_reuse);
42
43
extern
PGconn
*
connectMaintenanceDatabase
(
ConnParams
*cparams,
44
const
char
*
progname
,
bool
echo);
45
46
extern
void
disconnectDatabase
(
PGconn
*
conn
);
47
48
#endif
/* CONNECT_UTILS_H */
disconnectDatabase
void disconnectDatabase(PGconn *conn)
Definition:
connect_utils.c:158
ConnParams
struct _connParams ConnParams
TRI_YES
@ TRI_YES
Definition:
connect_utils.h:21
TRI_DEFAULT
@ TRI_DEFAULT
Definition:
connect_utils.h:19
TRI_NO
@ TRI_NO
Definition:
connect_utils.h:20
connectDatabase
PGconn * connectDatabase(const ConnParams *cparams, const char *progname, bool echo, bool fail_ok, bool allow_password_reuse)
Definition:
connect_utils.c:32
connectMaintenanceDatabase
PGconn * connectMaintenanceDatabase(ConnParams *cparams, const char *progname, bool echo)
Definition:
connect_utils.c:134
libpq-fe.h
progname
const char * progname
Definition:
main.c:43
conn
PGconn * conn
Definition:
streamutil.c:53
_connParams
Definition:
pg_backup.h:83
_connParams::pghost
const char * pghost
Definition:
connect_utils.h:29
_connParams::pguser
const char * pguser
Definition:
connect_utils.h:31
_connParams::dbname
const char * dbname
Definition:
connect_utils.h:28
_connParams::override_dbname
const char * override_dbname
Definition:
connect_utils.h:35
_connParams::pgport
const char * pgport
Definition:
connect_utils.h:30
_connParams::prompt_password
enum trivalue prompt_password
Definition:
connect_utils.h:32
pg_conn
Definition:
libpq-int.h:377
trivalue
trivalue
Definition:
vacuumlo.c:35
src
include
fe_utils
connect_utils.h
Generated on Tue Dec 3 2024 06:13:25 for PostgreSQL Source Code by
1.9.1