1 /*
2  *
3  * pgpool: a language independent connection pool server for PostgreSQL
4  * written by Tatsuo Ishii
5  *
6  * Copyright (c) 2003-2020	PgPool Global Development Group
7  *
8  * Permission to use, copy, modify, and distribute this software and
9  * its documentation for any purpose and without fee is hereby
10  * granted, provided that the above copyright notice appear in all
11  * copies and that both that copyright notice and this permission
12  * notice appear in supporting documentation, and that the name of the
13  * author not be used in advertising or publicity pertaining to
14  * distribution of the software without specific, written prior
15  * permission. The author makes no representations about the
16  * suitability of this software for any purpose.  It is provided "as
17  * is" without express or implied warranty.
18  *
19  */
20 
21 
22 #ifndef pool_process_query_h
23 #define pool_process_query_h
24 
25 #define LOCK_COMMENT "/*INSERT LOCK*/"
26 #define LOCK_COMMENT_SZ (sizeof(LOCK_COMMENT)-1)
27 #define NO_LOCK_COMMENT "/*NO INSERT LOCK*/"
28 #define NO_LOCK_COMMENT_SZ (sizeof(NO_LOCK_COMMENT)-1)
29 
30 
31 extern void reset_variables(void);
32 extern void reset_connection(void);
33 extern void per_node_statement_log(POOL_CONNECTION_POOL * backend,
34 								   int node_id, char *query);
35 extern int	pool_extract_error_message(bool read_kind, POOL_CONNECTION * backend,
36 									   int major, bool unread, char **message);
37 extern POOL_STATUS do_command(POOL_CONNECTION * frontend, POOL_CONNECTION * backend,
38 							  char *query, int protoMajor, int pid, int key, int no_ready_for_query);
39 extern void do_query(POOL_CONNECTION * backend, char *query, POOL_SELECT_RESULT * *result, int major);
40 extern void free_select_result(POOL_SELECT_RESULT * result);
41 extern int	compare(const void *p1, const void *p2);
42 extern void do_error_execute_command(POOL_CONNECTION_POOL * backend, int node_id, int major);
43 extern POOL_STATUS pool_discard_packet_contents(POOL_CONNECTION_POOL * cp);
44 extern void pool_dump_valid_backend(int backend_id);
45 extern bool pool_push_pending_data(POOL_CONNECTION * backend);
46 
47 
48 extern void pool_send_frontend_exits(POOL_CONNECTION_POOL * backend);
49 extern POOL_STATUS ParameterStatus(POOL_CONNECTION * frontend,
50 								   POOL_CONNECTION_POOL * backend);
51 
52 extern void pool_send_error_message(POOL_CONNECTION * frontend, int protoMajor,
53 						char *code,
54 						char *message,
55 						char *detail,
56 						char *hint,
57 						char *file,
58 						int line);
59 extern void pool_send_fatal_message(POOL_CONNECTION * frontend, int protoMajor,
60 						char *code,
61 						char *message,
62 						char *detail,
63 						char *hint,
64 						char *file,
65 						int line);
66 extern void pool_send_severity_message(POOL_CONNECTION * frontend, int protoMajor,
67 						   char *code,
68 						   char *message,
69 						   char *detail,
70 						   char *hint,
71 						   char *file,
72 						   char *severity,
73 						   int line);
74 
75 extern POOL_STATUS SimpleForwardToFrontend(char kind, POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend);
76 extern POOL_STATUS SimpleForwardToBackend(char kind, POOL_CONNECTION * frontend, POOL_CONNECTION_POOL * backend, int len, char *contents);
77 
78 extern POOL_STATUS pool_process_query(POOL_CONNECTION * frontend,
79 POOL_CONNECTION_POOL * backend,
80 int reset_request);
81 extern bool is_backend_cache_empty(POOL_CONNECTION_POOL * backend);
82 extern void pool_send_readyforquery(POOL_CONNECTION * frontend);
83 
84 extern char *extract_error_kind(char *message, int major);
85 
86 #endif /* pool_process_query_h */
87