-
Notifications
You must be signed in to change notification settings - Fork 0
/
loader.h
49 lines (34 loc) · 1.11 KB
/
loader.h
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
/* defines */
#define MAXFLDLEN 1024
#define MAXFLDCNT 200
/* + Configuration variables */
const char *host, *user, *pass, *database, *table, *dbcharset; int port;
const char *delimiter, *fields, *incharset, *error_log, *raw_log; int skip_head, total_rows, ttruncate, transaction_limit;
/* - Configuration variables */
static int put_comma;
int fieldCount = 0;
int verboseLevel = 8;
char * inputFile;
char * configFile = "pgcloader.cfg";
char * configSection = "default\0";
PGconn *conn;
FILE *error;
FILE *raw;
typedef unsigned long long ticks;
/* allowed fields for import */
int allowedFieldsCount=0;
char allowedFields[MAXFLDCNT][MAXFLDLEN]={0x0};
char currentFields[MAXFLDCNT][MAXFLDLEN]={0x0};
/* function prototypes */
// pgcloader.c
void fieldHandler ( void *s, size_t i, void *p );
void eolHandler ( int c, void *p );
// util.c
void initConfig ();
int initOptions ( int argc, char *argv[] );
void explode ( char *record, char *delim, char arr[][MAXFLDLEN],int *fldcnt);
int isString ( char * str );
static __inline__ ticks getticks (void);
// import.c
void importFromSTDIN ();
void importFromFile ();