aboutsummaryrefslogtreecommitdiff
path: root/contrib/pg_dumplo/pg_dumplo.h
blob: d9132ba059abcced5c5a8d9fefe3da63faaff96e (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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef _PG_LODUMP_H_
#define _PG_LODUMP_H_

#define VERSION "0.0.5"

/* ----------
 * Define
 * ----------
 */        
#define QUERY_BUFSIZ	(8*1024)
#define DIR_UMASK	0755
#define FILE_UMASK	0666 

#define	TRUE		1
#define FALSE		0
#define RE_OK		0
#define RE_ERROR	1

#define MAX_TABLE_NAME	128
#define MAX_ATTR_NAME	128

extern char *progname;

/* ----------
 * LO struct
 * ----------
 */
typedef struct { 
	char		*lo_table,
			*lo_attr;
	long		lo_oid;
} LOlist;

typedef struct {
	int		action;
	LOlist		*lolist;
	char		**argv,
			*user,
			*db,
			*host,
			*space;
	FILE		*index;
	int		counter,
			argc,
			lolist_start,
			remove,
			quiet;
	PGresult	*res;
	PGconn		*conn;
} LODumpMaster;

typedef enum {	
	ACTION_NONE,
	ACTION_SHOW,
	ACTION_EXPORT_ATTR,	
	ACTION_EXPORT_ALL,	
	ACTION_IMPORT
} PGLODUMP_ACTIONS;

extern void	notice		(LODumpMaster *pgLO, int set);
extern int	check_res	(LODumpMaster *pgLO);
extern void	index_file	(LODumpMaster *pgLO);
extern void	load_lolist	(LODumpMaster *pgLO);
extern void	pglo_export	(LODumpMaster *pgLO);
extern void	pglo_import	(LODumpMaster *pgLO);

#endif /* _PG_LODUMP_H */