File: pool_proto_modules.h

package info (click to toggle)
pgpool2 3.3.4-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 9,196 kB
  • sloc: ansic: 59,850; sh: 12,893; yacc: 10,787; lex: 4,637; sql: 743; makefile: 481; java: 469; php: 125; ruby: 98; asm: 5
file content (188 lines) | stat: -rw-r--r-- 7,725 bytes parent folder | download | duplicates (2)
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
/* -*-pgsql-c-*- */
/*
 *
 * $Header$
 *
 * pgpool: a language independent connection pool server for PostgreSQL 
 * written by Tatsuo Ishii
 *
 * Copyright (c) 2003-2012	PgPool Global Development Group
 *
 * Permission to use, copy, modify, and distribute this software and
 * its documentation for any purpose and without fee is hereby
 * granted, provided that the above copyright notice appear in all
 * copies and that both that copyright notice and this permission
 * notice appear in supporting documentation, and that the name of the
 * author not be used in advertising or publicity pertaining to
 * distribution of the software without specific, written prior
 * permission. The author makes no representations about the
 * suitability of this software for any purpose.  It is provided "as
 * is" without express or implied warranty.
 *
 * pool_proto_modules.h.: header file for pool_proto_modules.c, pool_proto2.c
 * and pool_process_query.c
 *
 */

#ifndef POOL_PROTO_MODULES_H
#define POOL_PROTO_MODULES_H

#include "parser/parser.h"
#include "parser/pool_memory.h"
#include "parser/pg_list.h"
#include "parser/parsenodes.h"
#include "pool_rewrite_query.h"
#include "pool_session_context.h"
#include "pool_process_reporting.h"

#define SPECIFIED_ERROR 1
#define POOL_DUMMY_WRITE_QUERY "DELETE FROM foo WHERE col = 'pgpool: unable to parse the query'"
#define POOL_DUMMY_READ_QUERY "SELECT 'pgpool: unable to parse the query'"
#define POOL_ERROR_QUERY "send invalid query from pgpool to abort transaction"

extern char *copy_table;  /* copy table name */
extern char *copy_schema;  /* copy table name */
extern char copy_delimiter; /* copy delimiter char */
extern char *copy_null; /* copy null string */

extern int is_select_pgcatalog;
extern int is_select_for_update; /* also for SELECT ... INTO */
extern bool is_parallel_table;
extern char *parsed_query;

/*
 * modules defined in pool_proto_modules.c
 */
extern POOL_STATUS SimpleQuery(POOL_CONNECTION *frontend, 
							   POOL_CONNECTION_POOL *backend,
							   int len, char *contents);

extern POOL_STATUS Execute(POOL_CONNECTION *frontend, 
						   POOL_CONNECTION_POOL *backend,
						   int len, char *contents);

extern POOL_STATUS Parse(POOL_CONNECTION *frontend,
						 POOL_CONNECTION_POOL *backend,
						 int len, char *contents);

extern POOL_STATUS Bind(POOL_CONNECTION *frontend,
						POOL_CONNECTION_POOL *backend,
						int len, char *contents);

extern POOL_STATUS Describe(POOL_CONNECTION *frontend,
							POOL_CONNECTION_POOL *backend,
							int len, char *contents);

extern POOL_STATUS Close(POOL_CONNECTION *frontend,
						 POOL_CONNECTION_POOL *backend,
						 int len, char *contents);

extern POOL_STATUS FunctionCall3(POOL_CONNECTION *frontend,
								 POOL_CONNECTION_POOL *backend,
								 int len, char *contents);

extern POOL_STATUS ReadyForQuery(POOL_CONNECTION *frontend, 
								 POOL_CONNECTION_POOL *backend, bool send_ready, bool cache_commit);

extern POOL_STATUS ParseComplete(POOL_CONNECTION *frontend,
								 POOL_CONNECTION_POOL *backend);

extern POOL_STATUS BindComplete(POOL_CONNECTION *frontend,
								POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CloseComplete(POOL_CONNECTION *frontend,
								 POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CommandComplete(POOL_CONNECTION *frontend,
								   POOL_CONNECTION_POOL *backend);

extern POOL_STATUS ParameterDescription(POOL_CONNECTION *frontend,
										POOL_CONNECTION_POOL *backend);

extern POOL_STATUS ErrorResponse3(POOL_CONNECTION *frontend,
								  POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CopyInResponse(POOL_CONNECTION *frontend, 
								  POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CopyOutResponse(POOL_CONNECTION *frontend, 
								   POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CopyDataRows(POOL_CONNECTION *frontend,
								POOL_CONNECTION_POOL *backend, int copyin);

extern POOL_STATUS FunctionCall(POOL_CONNECTION *frontend, 
								POOL_CONNECTION_POOL *backend);

extern POOL_STATUS ProcessFrontendResponse(POOL_CONNECTION *frontend, 
										   POOL_CONNECTION_POOL *backend);

extern POOL_STATUS ProcessBackendResponse(POOL_CONNECTION *frontend, 
										  POOL_CONNECTION_POOL *backend,
										  int *state, short *num_fields);

/*
 * modules defined in pool_proto2.c
 */
extern POOL_STATUS AsciiRow(POOL_CONNECTION *frontend,
							POOL_CONNECTION_POOL *backend,
							short num_fields);

extern POOL_STATUS BinaryRow(POOL_CONNECTION *frontend,
							 POOL_CONNECTION_POOL *backend,
							 short num_fields);

extern POOL_STATUS CompletedResponse(POOL_CONNECTION *frontend, 
									 POOL_CONNECTION_POOL *backend);

extern POOL_STATUS CursorResponse(POOL_CONNECTION *frontend,
								  POOL_CONNECTION_POOL *backend);

extern POOL_STATUS EmptyQueryResponse(POOL_CONNECTION *frontend,
									  POOL_CONNECTION_POOL *backend);

extern POOL_STATUS FunctionResultResponse(POOL_CONNECTION *frontend,
										  POOL_CONNECTION_POOL *backend);

extern POOL_STATUS NotificationResponse(POOL_CONNECTION *frontend,
										POOL_CONNECTION_POOL *backend);

extern int RowDescription(POOL_CONNECTION *frontend,
						  POOL_CONNECTION_POOL *backend,
						  short *result);


extern POOL_STATUS wait_for_query_response(POOL_CONNECTION *frontend, POOL_CONNECTION *backend, int protoVersion);
extern int is_select_query(Node *node, char *sql);
extern bool is_commit_query(Node *node);
extern bool is_rollback_query(Node *node);
extern bool is_commit_or_rollback_query(Node *node);
extern bool is_strict_query(Node *node); /* returns non 0 if this is strict query */
extern int need_insert_lock(POOL_CONNECTION_POOL *backend, char *query, Node *node);
extern POOL_STATUS insert_lock(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, char *query, InsertStmt *node, int lock_kind);
extern char *parse_copy_data(char *buf, int len, char delimiter, int col_id);
extern int check_copy_from_stdin(Node *node); /* returns non 0 if this is a COPY FROM STDIN */
extern void query_ps_status(char *query, POOL_CONNECTION_POOL *backend);		/* show ps status */
extern POOL_STATUS start_internal_transaction(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, Node *node);
extern POOL_STATUS end_internal_transaction(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend);
extern int detect_deadlock_error(POOL_CONNECTION *master, int major);
extern int detect_serialization_error(POOL_CONNECTION *master, int major, bool unread);
extern int detect_active_sql_transaction_error(POOL_CONNECTION *backend, int major);
extern int detect_query_cancel_error(POOL_CONNECTION *backend, int major);
extern bool is_partition_table(POOL_CONNECTION_POOL *backend, Node *node);
extern POOL_STATUS pool_discard_packet(POOL_CONNECTION_POOL *cp);
extern void query_cache_register(char kind, POOL_CONNECTION *frontend, char *database, char *data, int data_len);
extern int is_drop_database(Node *node);		/* returns non 0 if this is a DROP DATABASE command */

extern POOL_STATUS send_simplequery_message(POOL_CONNECTION *backend, int len, char *string, int major);
extern POOL_STATUS send_extended_protocol_message(POOL_CONNECTION_POOL *backend,
												  int node_id, char *kind,
												  int len, char *string);

extern int synchronize(POOL_CONNECTION *cp);
extern POOL_STATUS read_kind_from_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, char *decided_kind);
extern POOL_STATUS read_kind_from_one_backend(POOL_CONNECTION *frontend, POOL_CONNECTION_POOL *backend, char *kind, int node);
extern POOL_STATUS do_error_command(POOL_CONNECTION *backend, int major);
extern POOL_STATUS raise_intentional_error_if_need(POOL_CONNECTION_POOL *backend);

#endif