summaryrefslogtreecommitdiffstats
path: root/pg.h
blob: f19e8551f5e9238868c5b8857fb1feceea1fc075 (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
/*	Copyright (c) 2007-2019, Mark Wong */

#ifndef _PG_H_
#define _PG_H_

#include <libpq-fe.h>

struct pg_conninfo_ctx
{
	PGconn	   *connection;
	int			persistent;
	const char *values[6];
};

void		connect_to_db(struct pg_conninfo_ctx *);
void		disconnect_from_db(struct pg_conninfo_ctx *);

PGresult   *pg_locks(PGconn *, int);
PGresult   *pg_processes(PGconn *);
PGresult   *pg_replication(PGconn *);
PGresult   *pg_query(PGconn *, int);

enum BackendState
{
	STATE_UNDEFINED,
	STATE_IDLE,
	STATE_RUNNING,
	STATE_IDLEINTRANSACTION,
	STATE_FASTPATH,
	STATE_IDLEINTRANSACTION_ABORTED,
	STATE_DISABLED
};

#endif							/* _PG_H_ */