aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgbench/pgbench.h
blob: a3db6b97cc95b0939a2bb26fb5cc7931cb3da0b0 (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
/*-------------------------------------------------------------------------
 *
 * pgbench.h
 *
 * Portions Copyright (c) 1996-2015, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 *-------------------------------------------------------------------------
 */

#ifndef PGBENCH_H
#define PGBENCH_H

typedef enum PgBenchExprType
{
	ENODE_INTEGER_CONSTANT,
	ENODE_VARIABLE,
	ENODE_OPERATOR
} PgBenchExprType;

typedef struct PgBenchExpr PgBenchExpr;

struct PgBenchExpr
{
	PgBenchExprType	etype;
	union
	{
		struct
		{
			int64 ival;
		} integer_constant;
		struct
		{
			char *varname;
		} variable;
		struct
		{
			char operator;
			PgBenchExpr	*lexpr;
			PgBenchExpr *rexpr;
		} operator;
	} u;
};

extern PgBenchExpr *expr_parse_result;

extern int      expr_yyparse(void);
extern int      expr_yylex(void);
extern void expr_yyerror(const char *str);
extern void expr_scanner_init(const char *str, const char *source,
							  const int lineno, const char *line,
							  const char *cmd, const int ecol);
extern void syntax_error(const char* source, const int lineno, const char* line,
						 const char* cmd, const char* msg, const char* more,
						 const int col);
extern void expr_scanner_finish(void);

extern int64 strtoint64(const char *str);

#endif	/* PGBENCH_H */