1 /* Copyright (C) 2008-2019 Kentoku Shiba
2    Copyright (C) 2019 MariaDB corp
3 
4   This program is free software; you can redistribute it and/or modify
5   it under the terms of the GNU General Public License as published by
6   the Free Software Foundation; version 2 of the License.
7 
8   This program is distributed in the hope that it will be useful,
9   but WITHOUT ANY WARRANTY; without even the implied warranty of
10   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11   GNU General Public License for more details.
12 
13   You should have received a copy of the GNU General Public License
14   along with this program; if not, write to the Free Software
15   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
16 
17 #define SPIDER_DB_WRAPPER_STR "mysql"
18 #define SPIDER_DB_WRAPPER_LEN (sizeof(SPIDER_DB_WRAPPER_STR) - 1)
19 #define SPIDER_DB_PK_NAME_STR "PRIMARY"
20 #define SPIDER_DB_PK_NAME_LEN (sizeof(SPIDER_DB_PK_NAME_STR) - 1)
21 #define SPIDER_DB_UNIQUE_NAME_STR "UNIQUE"
22 #define SPIDER_DB_UNIQUE_NAME_LEN (sizeof(SPIDER_DB_UNIQUE_NAME_STR) - 1)
23 #define SPIDER_DB_KEY_NAME_STR "KEY"
24 #define SPIDER_DB_KEY_NAME_LEN (sizeof(SPIDER_DB_KEY_NAME_STR) - 1)
25 #define SPIDER_DB_SEQUENCE_NAME_STR ""
26 #define SPIDER_DB_SEQUENCE_NAME_LEN (sizeof(SPIDER_DB_SEQUENCE_NAME_STR) - 1)
27 
28 #define SPIDER_DB_TABLE_LOCK_READ_LOCAL         0
29 #define SPIDER_DB_TABLE_LOCK_READ               1
30 #define SPIDER_DB_TABLE_LOCK_LOW_PRIORITY_WRITE 2
31 #define SPIDER_DB_TABLE_LOCK_WRITE              3
32 
33 #define SPIDER_DB_INSERT_REPLACE       (1 << 0)
34 #define SPIDER_DB_INSERT_IGNORE        (1 << 1)
35 #define SPIDER_DB_INSERT_LOW_PRIORITY  (1 << 2)
36 #define SPIDER_DB_INSERT_HIGH_PRIORITY (1 << 3)
37 #define SPIDER_DB_INSERT_DELAYED       (1 << 4)
38 
39 #define SPIDER_SQL_OPEN_PAREN_STR "("
40 #define SPIDER_SQL_OPEN_PAREN_LEN (sizeof(SPIDER_SQL_OPEN_PAREN_STR) - 1)
41 #define SPIDER_SQL_CLOSE_PAREN_STR ")"
42 #define SPIDER_SQL_CLOSE_PAREN_LEN (sizeof(SPIDER_SQL_CLOSE_PAREN_STR) - 1)
43 #define SPIDER_SQL_COMMA_STR ","
44 #define SPIDER_SQL_COMMA_LEN (sizeof(SPIDER_SQL_COMMA_STR) - 1)
45 #define SPIDER_SQL_UNION_ALL_STR ")union all("
46 #define SPIDER_SQL_UNION_ALL_LEN (sizeof(SPIDER_SQL_UNION_ALL_STR) - 1)
47 #define SPIDER_SQL_NULL_STR "null"
48 #define SPIDER_SQL_NULL_LEN (sizeof(SPIDER_SQL_NULL_STR) - 1)
49 #define SPIDER_SQL_GT_STR " > "
50 #define SPIDER_SQL_GT_LEN (sizeof(SPIDER_SQL_GT_STR) - 1)
51 #define SPIDER_SQL_GTEQUAL_STR " >= "
52 #define SPIDER_SQL_GTEQUAL_LEN (sizeof(SPIDER_SQL_GTEQUAL_STR) - 1)
53 #define SPIDER_SQL_LT_STR " < "
54 #define SPIDER_SQL_LT_LEN (sizeof(SPIDER_SQL_LT_STR) - 1)
55 #define SPIDER_SQL_LTEQUAL_STR " <= "
56 #define SPIDER_SQL_LTEQUAL_LEN (sizeof(SPIDER_SQL_LTEQUAL_STR) - 1)
57 
58 #define SPIDER_SQL_ID_STR "id"
59 #define SPIDER_SQL_ID_LEN (sizeof(SPIDER_SQL_ID_STR) - 1)
60 #define SPIDER_SQL_TMP_BKA_ENGINE_STR "memory"
61 #define SPIDER_SQL_TMP_BKA_ENGINE_LEN (sizeof(SPIDER_SQL_TMP_BKA_ENGINE_STR) - 1)
62 
63 #define SPIDER_SQL_INSERT_STR "insert "
64 #define SPIDER_SQL_INSERT_LEN (sizeof(SPIDER_SQL_INSERT_STR) - 1)
65 #define SPIDER_SQL_REPLACE_STR "replace "
66 #define SPIDER_SQL_REPLACE_LEN (sizeof(SPIDER_SQL_REPLACE_STR) - 1)
67 #define SPIDER_SQL_SELECT_STR "select "
68 #define SPIDER_SQL_SELECT_LEN (sizeof(SPIDER_SQL_SELECT_STR) - 1)
69 #define SPIDER_SQL_UPDATE_STR "update "
70 #define SPIDER_SQL_UPDATE_LEN (sizeof(SPIDER_SQL_UPDATE_STR) - 1)
71 #define SPIDER_SQL_DELETE_STR "delete "
72 #define SPIDER_SQL_DELETE_LEN (sizeof(SPIDER_SQL_DELETE_STR) - 1)
73 #define SPIDER_SQL_DISTINCT_STR "distinct "
74 #define SPIDER_SQL_DISTINCT_LEN (sizeof(SPIDER_SQL_DISTINCT_STR) - 1)
75 #define SPIDER_SQL_HIGH_PRIORITY_STR "high_priority "
76 #define SPIDER_SQL_HIGH_PRIORITY_LEN (sizeof(SPIDER_SQL_HIGH_PRIORITY_STR) - 1)
77 #define SPIDER_SQL_LOW_PRIORITY_STR "low_priority "
78 #define SPIDER_SQL_LOW_PRIORITY_LEN (sizeof(SPIDER_SQL_LOW_PRIORITY_STR) - 1)
79 #define SPIDER_SQL_SQL_DELAYED_STR "delayed "
80 #define SPIDER_SQL_SQL_DELAYED_LEN (sizeof(SPIDER_SQL_SQL_DELAYED_STR) - 1)
81 #define SPIDER_SQL_SQL_IGNORE_STR "ignore "
82 #define SPIDER_SQL_SQL_IGNORE_LEN (sizeof(SPIDER_SQL_SQL_IGNORE_STR) - 1)
83 #define SPIDER_SQL_FROM_STR " from "
84 #define SPIDER_SQL_FROM_LEN (sizeof(SPIDER_SQL_FROM_STR) - 1)
85 #define SPIDER_SQL_WHERE_STR " where "
86 #define SPIDER_SQL_WHERE_LEN (sizeof(SPIDER_SQL_WHERE_STR) - 1)
87 #define SPIDER_SQL_OR_STR " or "
88 #define SPIDER_SQL_OR_LEN (sizeof(SPIDER_SQL_OR_STR) - 1)
89 #define SPIDER_SQL_ORDER_STR " order by "
90 #define SPIDER_SQL_ORDER_LEN (sizeof(SPIDER_SQL_ORDER_STR) - 1)
91 #define SPIDER_SQL_DESC_STR " desc"
92 #define SPIDER_SQL_DESC_LEN (sizeof(SPIDER_SQL_DESC_STR) - 1)
93 #define SPIDER_SQL_LIMIT_STR " limit "
94 #define SPIDER_SQL_LIMIT_LEN (sizeof(SPIDER_SQL_LIMIT_STR) - 1)
95 #define SPIDER_SQL_INTO_STR "into "
96 #define SPIDER_SQL_INTO_LEN (sizeof(SPIDER_SQL_INTO_STR) - 1)
97 #define SPIDER_SQL_VALUES_STR "values"
98 #define SPIDER_SQL_VALUES_LEN (sizeof(SPIDER_SQL_VALUES_STR) - 1)
99 #define SPIDER_SQL_SHARED_LOCK_STR " lock in share mode"
100 #define SPIDER_SQL_SHARED_LOCK_LEN (sizeof(SPIDER_SQL_SHARED_LOCK_STR) - 1)
101 #define SPIDER_SQL_FOR_UPDATE_STR " for update"
102 #define SPIDER_SQL_FOR_UPDATE_LEN (sizeof(SPIDER_SQL_FOR_UPDATE_STR) - 1)
103 
104 #define SPIDER_SQL_SQL_ALTER_TABLE_STR "alter table "
105 #define SPIDER_SQL_SQL_ALTER_TABLE_LEN (sizeof(SPIDER_SQL_SQL_ALTER_TABLE_STR) - 1)
106 #define SPIDER_SQL_SQL_DISABLE_KEYS_STR " disable keys"
107 #define SPIDER_SQL_SQL_DISABLE_KEYS_LEN (sizeof(SPIDER_SQL_SQL_DISABLE_KEYS_STR) - 1)
108 #define SPIDER_SQL_SQL_ENABLE_KEYS_STR " enable keys"
109 #define SPIDER_SQL_SQL_ENABLE_KEYS_LEN (sizeof(SPIDER_SQL_SQL_ENABLE_KEYS_STR) - 1)
110 #define SPIDER_SQL_SQL_CHECK_TABLE_STR "check table "
111 #define SPIDER_SQL_SQL_CHECK_TABLE_LEN (sizeof(SPIDER_SQL_SQL_CHECK_TABLE_STR) - 1)
112 #define SPIDER_SQL_SQL_ANALYZE_STR "analyze "
113 #define SPIDER_SQL_SQL_ANALYZE_LEN (sizeof(SPIDER_SQL_SQL_ANALYZE_STR) - 1)
114 #define SPIDER_SQL_SQL_OPTIMIZE_STR "optimize "
115 #define SPIDER_SQL_SQL_OPTIMIZE_LEN (sizeof(SPIDER_SQL_SQL_OPTIMIZE_STR) - 1)
116 #define SPIDER_SQL_SQL_REPAIR_STR "repair "
117 #define SPIDER_SQL_SQL_REPAIR_LEN (sizeof(SPIDER_SQL_SQL_REPAIR_STR) - 1)
118 #define SPIDER_SQL_SQL_TABLE_STR "table "
119 #define SPIDER_SQL_SQL_TABLE_LEN (sizeof(SPIDER_SQL_SQL_TABLE_STR) - 1)
120 #define SPIDER_SQL_SQL_QUICK_STR " quick"
121 #define SPIDER_SQL_SQL_QUICK_LEN (sizeof(SPIDER_SQL_SQL_QUICK_STR) - 1)
122 #define SPIDER_SQL_SQL_FAST_STR " fast"
123 #define SPIDER_SQL_SQL_FAST_LEN (sizeof(SPIDER_SQL_SQL_FAST_STR) - 1)
124 #define SPIDER_SQL_SQL_MEDIUM_STR " medium"
125 #define SPIDER_SQL_SQL_MEDIUM_LEN (sizeof(SPIDER_SQL_SQL_MEDIUM_STR) - 1)
126 #define SPIDER_SQL_SQL_EXTENDED_STR " extended"
127 #define SPIDER_SQL_SQL_EXTENDED_LEN (sizeof(SPIDER_SQL_SQL_EXTENDED_STR) - 1)
128 #define SPIDER_SQL_SQL_LOCAL_STR "local "
129 #define SPIDER_SQL_SQL_LOCAL_LEN (sizeof(SPIDER_SQL_SQL_LOCAL_STR) - 1)
130 #define SPIDER_SQL_SQL_USE_FRM_STR " use_frm"
131 #define SPIDER_SQL_SQL_USE_FRM_LEN (sizeof(SPIDER_SQL_SQL_USE_FRM_STR) - 1)
132 #define SPIDER_SQL_TRUNCATE_TABLE_STR "truncate table "
133 #define SPIDER_SQL_TRUNCATE_TABLE_LEN (sizeof(SPIDER_SQL_TRUNCATE_TABLE_STR) - 1)
134 #define SPIDER_SQL_EXPLAIN_SELECT_STR "explain select 1 "
135 #define SPIDER_SQL_EXPLAIN_SELECT_LEN sizeof(SPIDER_SQL_EXPLAIN_SELECT_STR) - 1
136 #define SPIDER_SQL_FLUSH_LOGS_STR "flush logs"
137 #define SPIDER_SQL_FLUSH_LOGS_LEN sizeof(SPIDER_SQL_FLUSH_LOGS_STR) - 1
138 #define SPIDER_SQL_FLUSH_TABLES_STR "flush tables"
139 #define SPIDER_SQL_FLUSH_TABLES_LEN sizeof(SPIDER_SQL_FLUSH_TABLES_STR) - 1
140 #define SPIDER_SQL_WITH_READ_LOCK_STR " with read lock"
141 #define SPIDER_SQL_WITH_READ_LOCK_LEN sizeof(SPIDER_SQL_WITH_READ_LOCK_STR) - 1
142 #define SPIDER_SQL_DUPLICATE_KEY_UPDATE_STR " on duplicate key update "
143 #define SPIDER_SQL_DUPLICATE_KEY_UPDATE_LEN (sizeof(SPIDER_SQL_DUPLICATE_KEY_UPDATE_STR) - 1)
144 #define SPIDER_SQL_HANDLER_STR "handler "
145 #define SPIDER_SQL_HANDLER_LEN (sizeof(SPIDER_SQL_HANDLER_STR) - 1)
146 #define SPIDER_SQL_OPEN_STR " open "
147 #define SPIDER_SQL_OPEN_LEN (sizeof(SPIDER_SQL_OPEN_STR) - 1)
148 #define SPIDER_SQL_CLOSE_STR " close "
149 #define SPIDER_SQL_CLOSE_LEN (sizeof(SPIDER_SQL_CLOSE_STR) - 1)
150 #define SPIDER_SQL_READ_STR " read "
151 #define SPIDER_SQL_READ_LEN (sizeof(SPIDER_SQL_READ_STR) - 1)
152 #define SPIDER_SQL_FIRST_STR " first "
153 #define SPIDER_SQL_FIRST_LEN (sizeof(SPIDER_SQL_FIRST_STR) - 1)
154 #define SPIDER_SQL_NEXT_STR " next  "
155 #define SPIDER_SQL_NEXT_LEN (sizeof(SPIDER_SQL_NEXT_STR) - 1)
156 #define SPIDER_SQL_PREV_STR " prev  "
157 #define SPIDER_SQL_PREV_LEN (sizeof(SPIDER_SQL_PREV_STR) - 1)
158 #define SPIDER_SQL_LAST_STR " last  "
159 #define SPIDER_SQL_LAST_LEN (sizeof(SPIDER_SQL_LAST_STR) - 1)
160 #define SPIDER_SQL_AS_STR "as "
161 #define SPIDER_SQL_AS_LEN (sizeof(SPIDER_SQL_AS_STR) - 1)
162 #define SPIDER_SQL_WITH_QUERY_EXPANSION_STR " with query expansion"
163 #define SPIDER_SQL_WITH_QUERY_EXPANSION_LEN (sizeof(SPIDER_SQL_WITH_QUERY_EXPANSION_STR) - 1)
164 #define SPIDER_SQL_IN_BOOLEAN_MODE_STR " in boolean mode"
165 #define SPIDER_SQL_IN_BOOLEAN_MODE_LEN (sizeof(SPIDER_SQL_IN_BOOLEAN_MODE_STR) - 1)
166 #define SPIDER_SQL_MATCH_STR "match("
167 #define SPIDER_SQL_MATCH_LEN (sizeof(SPIDER_SQL_MATCH_STR) - 1)
168 #define SPIDER_SQL_AGAINST_STR ")against("
169 #define SPIDER_SQL_AGAINST_LEN (sizeof(SPIDER_SQL_AGAINST_STR) - 1)
170 #define SPIDER_SQL_IS_NULL_STR " is null"
171 #define SPIDER_SQL_IS_NULL_LEN (sizeof(SPIDER_SQL_IS_NULL_STR) - 1)
172 #define SPIDER_SQL_IS_NOT_NULL_STR " is not null"
173 #define SPIDER_SQL_IS_NOT_NULL_LEN (sizeof(SPIDER_SQL_IS_NOT_NULL_STR) - 1)
174 #define SPIDER_SQL_NOT_NULL_STR " not null"
175 #define SPIDER_SQL_NOT_NULL_LEN (sizeof(SPIDER_SQL_NOT_NULL_STR) - 1)
176 #define SPIDER_SQL_DEFAULT_STR " default "
177 #define SPIDER_SQL_DEFAULT_LEN (sizeof(SPIDER_SQL_DEFAULT_STR) - 1)
178 #define SPIDER_SQL_SPACE_STR " "
179 #define SPIDER_SQL_SPACE_LEN (sizeof(SPIDER_SQL_SPACE_STR) - 1)
180 #define SPIDER_SQL_ONE_STR "1"
181 #define SPIDER_SQL_ONE_LEN sizeof(SPIDER_SQL_ONE_STR) - 1
182 #define SPIDER_SQL_SQL_CACHE_STR "sql_cache "
183 #define SPIDER_SQL_SQL_CACHE_LEN (sizeof(SPIDER_SQL_SQL_CACHE_STR) - 1)
184 #define SPIDER_SQL_SQL_NO_CACHE_STR "sql_no_cache "
185 #define SPIDER_SQL_SQL_NO_CACHE_LEN (sizeof(SPIDER_SQL_SQL_NO_CACHE_STR) - 1)
186 #define SPIDER_SQL_SQL_QUICK_MODE_STR "quick "
187 #define SPIDER_SQL_SQL_QUICK_MODE_LEN (sizeof(SPIDER_SQL_SQL_QUICK_MODE_STR) - 1)
188 #define SPIDER_SQL_SET_STR " set "
189 #define SPIDER_SQL_SET_LEN (sizeof(SPIDER_SQL_SET_STR) - 1)
190 #define SPIDER_SQL_UNDERSCORE_STR "_"
191 #define SPIDER_SQL_UNDERSCORE_LEN sizeof(SPIDER_SQL_UNDERSCORE_STR) - 1
192 #define SPIDER_SQL_PF_EQUAL_STR " <=> "
193 #define SPIDER_SQL_PF_EQUAL_LEN (sizeof(SPIDER_SQL_PF_EQUAL_STR) - 1)
194 #define SPIDER_SQL_GROUP_STR " group by "
195 #define SPIDER_SQL_GROUP_LEN (sizeof(SPIDER_SQL_GROUP_STR) - 1)
196 #define SPIDER_SQL_HAVING_STR " having "
197 #define SPIDER_SQL_HAVING_LEN (sizeof(SPIDER_SQL_HAVING_STR) - 1)
198 #define SPIDER_SQL_PLUS_STR " + "
199 #define SPIDER_SQL_PLUS_LEN (sizeof(SPIDER_SQL_PLUS_STR) - 1)
200 #define SPIDER_SQL_MINUS_STR " - "
201 #define SPIDER_SQL_MINUS_LEN (sizeof(SPIDER_SQL_MINUS_STR) - 1)
202 
203 #define SPIDER_SQL_YEAR_STR "year"
204 #define SPIDER_SQL_YEAR_LEN (sizeof(SPIDER_SQL_YEAR_STR) - 1)
205 #define SPIDER_SQL_QUARTER_STR "quarter"
206 #define SPIDER_SQL_QUARTER_LEN (sizeof(SPIDER_SQL_QUARTER_STR) - 1)
207 #define SPIDER_SQL_MONTH_STR "month"
208 #define SPIDER_SQL_MONTH_LEN (sizeof(SPIDER_SQL_MONTH_STR) - 1)
209 #define SPIDER_SQL_WEEK_STR "week"
210 #define SPIDER_SQL_WEEK_LEN (sizeof(SPIDER_SQL_WEEK_STR) - 1)
211 #define SPIDER_SQL_DAY_STR "day"
212 #define SPIDER_SQL_DAY_LEN (sizeof(SPIDER_SQL_DAY_STR) - 1)
213 #define SPIDER_SQL_HOUR_STR "hour"
214 #define SPIDER_SQL_HOUR_LEN (sizeof(SPIDER_SQL_HOUR_STR) - 1)
215 #define SPIDER_SQL_MINUTE_STR "minute"
216 #define SPIDER_SQL_MINUTE_LEN (sizeof(SPIDER_SQL_MINUTE_STR) - 1)
217 #define SPIDER_SQL_SECOND_STR "second"
218 #define SPIDER_SQL_SECOND_LEN (sizeof(SPIDER_SQL_SECOND_STR) - 1)
219 #define SPIDER_SQL_MICROSECOND_STR "microsecond"
220 #define SPIDER_SQL_MICROSECOND_LEN (sizeof(SPIDER_SQL_MICROSECOND_STR) - 1)
221 
222 #define SPIDER_SQL_SHOW_RECORDS_STR "select count(*) from "
223 #define SPIDER_SQL_SHOW_RECORDS_LEN sizeof(SPIDER_SQL_SHOW_RECORDS_STR) - 1
224 #define SPIDER_SQL_SHOW_INDEX_STR "show index from "
225 #define SPIDER_SQL_SHOW_INDEX_LEN sizeof(SPIDER_SQL_SHOW_INDEX_STR) - 1
226 #define SPIDER_SQL_SELECT_STATISTICS_STR "select `column_name`,`cardinality` from `information_schema`.`statistics` where `table_schema` = "
227 #define SPIDER_SQL_SELECT_STATISTICS_LEN sizeof(SPIDER_SQL_SELECT_STATISTICS_STR) - 1
228 #define SPIDER_SQL_MAX_STR "max"
229 #define SPIDER_SQL_MAX_LEN sizeof(SPIDER_SQL_MAX_STR) - 1
230 
231 #define SPIDER_SQL_DROP_TMP_STR "drop temporary table if exists "
232 #define SPIDER_SQL_DROP_TMP_LEN (sizeof(SPIDER_SQL_DROP_TMP_STR) - 1)
233 #define SPIDER_SQL_CREATE_TMP_STR "create temporary table "
234 #define SPIDER_SQL_CREATE_TMP_LEN (sizeof(SPIDER_SQL_CREATE_TMP_STR) - 1)
235 #define SPIDER_SQL_TMP_BKA_STR "tmp_spider_bka_"
236 #define SPIDER_SQL_TMP_BKA_LEN (sizeof(SPIDER_SQL_TMP_BKA_STR) - 1)
237 #define SPIDER_SQL_ENGINE_STR ")engine="
238 #define SPIDER_SQL_ENGINE_LEN (sizeof(SPIDER_SQL_ENGINE_STR) - 1)
239 #define SPIDER_SQL_DEF_CHARSET_STR " default charset="
240 #define SPIDER_SQL_DEF_CHARSET_LEN (sizeof(SPIDER_SQL_DEF_CHARSET_STR) - 1)
241 #define SPIDER_SQL_ID_TYPE_STR " bigint"
242 #define SPIDER_SQL_ID_TYPE_LEN (sizeof(SPIDER_SQL_ID_TYPE_STR) - 1)
243 
244 #define SPIDER_SQL_COLUMN_NAME_STR "`column_name`"
245 #define SPIDER_SQL_COLUMN_NAME_LEN sizeof(SPIDER_SQL_COLUMN_NAME_STR) - 1
246 
247 #define SPIDER_SQL_A_DOT_STR "a."
248 #define SPIDER_SQL_A_DOT_LEN (sizeof(SPIDER_SQL_A_DOT_STR) - 1)
249 #define SPIDER_SQL_B_DOT_STR "b."
250 #define SPIDER_SQL_B_DOT_LEN (sizeof(SPIDER_SQL_B_DOT_STR) - 1)
251 #define SPIDER_SQL_A_STR "a"
252 #define SPIDER_SQL_A_LEN (sizeof(SPIDER_SQL_A_STR) - 1)
253 #define SPIDER_SQL_B_STR "b"
254 #define SPIDER_SQL_B_LEN (sizeof(SPIDER_SQL_B_STR) - 1)
255 
256 #define SPIDER_SQL_TRIM_STR "trim"
257 #define SPIDER_SQL_TRIM_LEN sizeof(SPIDER_SQL_TRIM_STR) - 1
258 #define SPIDER_SQL_TRIM_BOTH_STR "both "
259 #define SPIDER_SQL_TRIM_BOTH_LEN sizeof(SPIDER_SQL_TRIM_BOTH_STR) - 1
260 #define SPIDER_SQL_TRIM_LEADING_STR "leading "
261 #define SPIDER_SQL_TRIM_LEADING_LEN sizeof(SPIDER_SQL_TRIM_LEADING_STR) - 1
262 #define SPIDER_SQL_TRIM_TRAILING_STR "trailing "
263 #define SPIDER_SQL_TRIM_TRAILING_LEN sizeof(SPIDER_SQL_TRIM_TRAILING_STR) - 1
264 
265 #define SPIDER_SQL_INDEX_IGNORE_STR " IGNORE INDEX "
266 #define SPIDER_SQL_INDEX_IGNORE_LEN (sizeof(SPIDER_SQL_INDEX_IGNORE_STR) - 1)
267 #define SPIDER_SQL_INDEX_USE_STR " USE INDEX "
268 #define SPIDER_SQL_INDEX_USE_LEN (sizeof(SPIDER_SQL_INDEX_USE_STR) - 1)
269 #define SPIDER_SQL_INDEX_FORCE_STR " FORCE INDEX "
270 #define SPIDER_SQL_INDEX_FORCE_LEN (sizeof(SPIDER_SQL_INDEX_FORCE_STR) - 1)
271 
272 #define SPIDER_SQL_INT_LEN 20
273 #define SPIDER_SQL_HANDLER_CID_LEN 6
274 #define SPIDER_SQL_HANDLER_CID_FORMAT "t%05u"
275 #define SPIDER_UDF_PING_TABLE_PING_ONLY                (1 << 0)
276 #define SPIDER_UDF_PING_TABLE_USE_WHERE                (1 << 1)
277 #define SPIDER_UDF_PING_TABLE_USE_ALL_MONITORING_NODES (1 << 2)
278 
279 int spider_db_connect(
280   const SPIDER_SHARE *share,
281   SPIDER_CONN *conn,
282   int link_idx
283 );
284 
285 int spider_db_ping_internal(
286   SPIDER_SHARE *share,
287   SPIDER_CONN *conn,
288   int all_link_idx,
289   int *need_mon
290 );
291 
292 int spider_db_ping(
293   ha_spider *spider,
294   SPIDER_CONN *conn,
295   int link_idx
296 );
297 
298 void spider_db_disconnect(
299   SPIDER_CONN *conn
300 );
301 
302 int spider_db_conn_queue_action(
303   SPIDER_CONN *conn
304 );
305 
306 int spider_db_before_query(
307   SPIDER_CONN *conn,
308   int *need_mon
309 );
310 
311 int spider_db_query(
312   SPIDER_CONN *conn,
313   const char *query,
314   uint length,
315   int quick_mode,
316   int *need_mon
317 );
318 
319 int spider_db_errorno(
320   SPIDER_CONN *conn
321 );
322 
323 int spider_db_set_trx_isolation(
324   SPIDER_CONN *conn,
325   int trx_isolation,
326   int *need_mon
327 );
328 
329 int spider_db_set_names_internal(
330   SPIDER_TRX *trx,
331   SPIDER_SHARE *share,
332   SPIDER_CONN *conn,
333   int all_link_idx,
334   int *need_mon
335 );
336 
337 int spider_db_set_names(
338   ha_spider *spider,
339   SPIDER_CONN *conn,
340   int link_idx
341 );
342 
343 int spider_db_query_with_set_names(
344   ulong sql_type,
345   ha_spider *spider,
346   SPIDER_CONN *conn,
347   int link_idx
348 );
349 
350 int spider_db_query_for_bulk_update(
351   ha_spider *spider,
352   SPIDER_CONN *conn,
353   int link_idx,
354   ha_rows *dup_key_found
355 );
356 
357 size_t spider_db_real_escape_string(
358   SPIDER_CONN *conn,
359   char *to,
360   const char *from,
361   size_t from_length
362 );
363 
364 int spider_db_consistent_snapshot(
365   SPIDER_CONN *conn,
366   int *need_mon
367 );
368 
369 int spider_db_start_transaction(
370   SPIDER_CONN *conn,
371   int *need_mon
372 );
373 
374 int spider_db_commit(
375   SPIDER_CONN *conn
376 );
377 
378 int spider_db_rollback(
379   SPIDER_CONN *conn
380 );
381 
382 int spider_db_append_hex_string(
383   spider_string *str,
384   uchar *hex_ptr,
385   int hex_ptr_length
386 );
387 
388 void spider_db_append_xid_str(
389   spider_string *tmp_str,
390   XID *xid
391 );
392 
393 int spider_db_xa_end(
394   SPIDER_CONN *conn,
395   XID *xid
396 );
397 
398 int spider_db_xa_prepare(
399   SPIDER_CONN *conn,
400   XID *xid
401 );
402 
403 int spider_db_xa_commit(
404   SPIDER_CONN *conn,
405   XID *xid
406 );
407 
408 int spider_db_xa_rollback(
409   SPIDER_CONN *conn,
410   XID *xid
411 );
412 
413 int spider_db_lock_tables(
414   ha_spider *spider,
415   int link_idx
416 );
417 
418 int spider_db_unlock_tables(
419   ha_spider *spider,
420   int link_idx
421 );
422 
423 int spider_db_append_name_with_quote_str(
424   spider_string *str,
425   const char *name,
426   uint dbton_id
427 );
428 
429 int spider_db_append_name_with_quote_str(
430   spider_string *str,
431   LEX_CSTRING &name,
432   uint dbton_id
433 );
434 
435 int spider_db_append_name_with_quote_str_internal(
436   spider_string *str,
437   const char *name,
438   int length,
439   uint dbton_id
440 );
441 
442 int spider_db_append_name_with_quote_str_internal(
443   spider_string *str,
444   const char *name,
445   int length,
446   CHARSET_INFO *cs,
447   uint dbton_id
448 );
449 
450 int spider_db_append_select(
451   ha_spider *spider
452 );
453 
454 int spider_db_append_select_columns(
455   ha_spider *spider
456 );
457 
458 int spider_db_append_null_value(
459   spider_string *str,
460   KEY_PART_INFO *key_part,
461   const uchar **ptr
462 );
463 
464 int spider_db_append_key_columns(
465   const key_range *start_key,
466   ha_spider *spider,
467   spider_string *str
468 );
469 
470 int spider_db_append_key_hint(
471   spider_string *str,
472   char *hint_str
473 );
474 
475 int spider_db_append_key_where_internal(
476   spider_string *str,
477   spider_string *str_part,
478   spider_string *str_part2,
479   const key_range *start_key,
480   const key_range *end_key,
481   ha_spider *spider,
482   bool set_order,
483   ulong sql_type,
484   uint dbton_id
485 );
486 
487 int spider_db_append_key_where(
488   const key_range *start_key,
489   const key_range *end_key,
490   ha_spider *spider
491 );
492 
493 int spider_db_append_charset_name_before_string(
494   spider_string *str,
495   CHARSET_INFO *cs
496 );
497 
498 #ifdef HANDLER_HAS_DIRECT_AGGREGATE
499 int spider_db_refetch_for_item_sum_funcs(
500   ha_spider *spider
501 );
502 
503 int spider_db_fetch_for_item_sum_funcs(
504   SPIDER_DB_ROW *row,
505   ha_spider *spider
506 );
507 
508 int spider_db_fetch_for_item_sum_func(
509   SPIDER_DB_ROW *row,
510   Item_sum *item_sum,
511   ha_spider *spider
512 );
513 #endif
514 
515 int spider_db_append_match_fetch(
516   ha_spider *spider,
517   st_spider_ft_info *ft_first,
518   st_spider_ft_info *ft_current,
519   SPIDER_DB_ROW *row
520 );
521 
522 int spider_db_append_match_where(
523   ha_spider *spider
524 );
525 
526 int spider_db_append_hint_after_table(
527   ha_spider *spider,
528   spider_string *str,
529   spider_string *hint
530 );
531 
532 int spider_db_append_show_records(
533   SPIDER_SHARE *share
534 );
535 
536 void spider_db_free_show_records(
537   SPIDER_SHARE *share
538 );
539 
540 int spider_db_append_show_index(
541   SPIDER_SHARE *share
542 );
543 
544 void spider_db_free_show_index(
545   SPIDER_SHARE *share
546 );
547 
548 void spider_db_append_handler_next(
549   ha_spider *spider
550 );
551 
552 void spider_db_get_row_from_tmp_tbl_rec(
553   SPIDER_RESULT *current,
554   SPIDER_DB_ROW **row
555 );
556 
557 int spider_db_get_row_from_tmp_tbl(
558   SPIDER_RESULT *current,
559   SPIDER_DB_ROW **row
560 );
561 
562 int spider_db_get_row_from_tmp_tbl_pos(
563   SPIDER_POSITION *pos,
564   SPIDER_DB_ROW **row
565 );
566 
567 int spider_db_fetch_row(
568   SPIDER_SHARE *share,
569   Field *field,
570   SPIDER_DB_ROW *row,
571   my_ptrdiff_t ptr_diff
572 );
573 
574 int spider_db_fetch_table(
575   ha_spider *spider,
576   uchar *buf,
577   TABLE *table,
578   SPIDER_RESULT_LIST *result_list
579 );
580 
581 int spider_db_fetch_key(
582   ha_spider *spider,
583   uchar *buf,
584   TABLE *table,
585   const KEY *key_info,
586   SPIDER_RESULT_LIST *result_list
587 );
588 
589 int spider_db_fetch_minimum_columns(
590   ha_spider *spider,
591   uchar *buf,
592   TABLE *table,
593   SPIDER_RESULT_LIST *result_list
594 );
595 
596 void spider_db_free_one_result_for_start_next(
597   ha_spider *spider
598 );
599 
600 void spider_db_free_one_result(
601   SPIDER_RESULT_LIST *result_list,
602   SPIDER_RESULT *result
603 );
604 
605 void spider_db_free_one_quick_result(
606   SPIDER_RESULT *result
607 );
608 
609 int spider_db_free_result(
610   ha_spider *spider,
611   bool final
612 );
613 
614 int spider_db_store_result(
615   ha_spider *spider,
616   int link_idx,
617   TABLE *table
618 );
619 
620 void spider_db_discard_result(
621   ha_spider *spider,
622   int link_idx,
623   SPIDER_CONN *conn
624 );
625 
626 void spider_db_discard_multiple_result(
627   ha_spider *spider,
628   int link_idx,
629   SPIDER_CONN *conn
630 );
631 
632 #ifdef HA_CAN_BULK_ACCESS
633 int spider_db_bulk_store_result(
634   ha_spider *spider,
635   SPIDER_CONN *conn,
636   int link_idx,
637   bool discard_result
638 );
639 #endif
640 
641 int spider_db_fetch(
642   uchar *buf,
643   ha_spider *spider,
644   TABLE *table
645 );
646 
647 int spider_db_seek_prev(
648   uchar *buf,
649   ha_spider *spider,
650   TABLE *table
651 );
652 
653 int spider_db_seek_next(
654   uchar *buf,
655   ha_spider *spider,
656   int link_idx,
657   TABLE *table
658 );
659 
660 int spider_db_seek_last(
661   uchar *buf,
662   ha_spider *spider,
663   int link_idx,
664   TABLE *table
665 );
666 
667 int spider_db_seek_first(
668   uchar *buf,
669   ha_spider *spider,
670   TABLE *table
671 );
672 
673 void spider_db_set_pos_to_first_row(
674   SPIDER_RESULT_LIST *result_list
675 );
676 
677 void spider_db_create_position(
678   ha_spider *spider,
679   SPIDER_POSITION *pos
680 );
681 
682 int spider_db_seek_tmp(
683   uchar *buf,
684   SPIDER_POSITION *pos,
685   ha_spider *spider,
686   TABLE *table
687 );
688 
689 int spider_db_seek_tmp_table(
690   uchar *buf,
691   SPIDER_POSITION *pos,
692   ha_spider *spider,
693   TABLE *table
694 );
695 
696 int spider_db_seek_tmp_key(
697   uchar *buf,
698   SPIDER_POSITION *pos,
699   ha_spider *spider,
700   TABLE *table,
701   const KEY *key_info
702 );
703 
704 int spider_db_seek_tmp_minimum_columns(
705   uchar *buf,
706   SPIDER_POSITION *pos,
707   ha_spider *spider,
708   TABLE *table
709 );
710 
711 int spider_db_show_table_status(
712   ha_spider *spider,
713   int link_idx,
714   int sts_mode,
715   uint flag
716 );
717 
718 int spider_db_simple_action(
719   uint simple_action,
720   spider_db_handler *db_handler,
721   int link_idx
722 );
723 
724 int spider_db_simple_action(
725   uint simple_action,
726   ha_spider *spider,
727   int link_idx,
728   bool pre_call
729 );
730 
731 void spider_db_set_cardinarity(
732   ha_spider *spider,
733   TABLE *table
734 );
735 
736 int spider_db_show_index(
737   ha_spider *spider,
738   int link_idx,
739   TABLE *table,
740   int crd_mode
741 );
742 
743 ha_rows spider_db_explain_select(
744   key_range *start_key,
745   key_range *end_key,
746   ha_spider *spider,
747   int link_idx
748 );
749 
750 int spider_db_bulk_insert_init(
751   ha_spider *spider,
752   const TABLE *table
753 );
754 
755 int spider_db_bulk_insert(
756   ha_spider *spider,
757   TABLE *table,
758   ha_copy_info *copy_info,
759   bool bulk_end
760 );
761 
762 #ifdef HA_CAN_BULK_ACCESS
763 int spider_db_bulk_bulk_insert(
764   ha_spider *spider
765 );
766 #endif
767 
768 int spider_db_update_auto_increment(
769   ha_spider *spider,
770   int link_idx
771 );
772 
773 int spider_db_bulk_update_size_limit(
774   ha_spider *spider,
775   TABLE *table
776 );
777 
778 int spider_db_bulk_update_end(
779   ha_spider *spider,
780   ha_rows *dup_key_found
781 );
782 
783 int spider_db_bulk_update(
784   ha_spider *spider,
785   TABLE *table,
786   my_ptrdiff_t ptr_diff
787 );
788 
789 int spider_db_update(
790   ha_spider *spider,
791   TABLE *table,
792   const uchar *old_data
793 );
794 
795 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
796 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
797 int spider_db_direct_update(
798   ha_spider *spider,
799   TABLE *table,
800   KEY_MULTI_RANGE *ranges,
801   uint range_count,
802   ha_rows *update_rows,
803   ha_rows *found_rows
804 );
805 #else
806 int spider_db_direct_update(
807   ha_spider *spider,
808   TABLE *table,
809   ha_rows *update_rows,
810   ha_rows *found_rows
811 );
812 #endif
813 #endif
814 
815 #ifdef HA_CAN_BULK_ACCESS
816 int spider_db_bulk_direct_update(
817   ha_spider *spider,
818   ha_rows *update_rows
819 );
820 #endif
821 
822 int spider_db_bulk_delete(
823   ha_spider *spider,
824   TABLE *table,
825   my_ptrdiff_t ptr_diff
826 );
827 
828 int spider_db_delete(
829   ha_spider *spider,
830   TABLE *table,
831   const uchar *buf
832 );
833 
834 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
835 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS_WITH_HS
836 int spider_db_direct_delete(
837   ha_spider *spider,
838   TABLE *table,
839   KEY_MULTI_RANGE *ranges,
840   uint range_count,
841   ha_rows *delete_rows
842 );
843 #else
844 int spider_db_direct_delete(
845   ha_spider *spider,
846   TABLE *table,
847   ha_rows *delete_rows
848 );
849 #endif
850 #endif
851 
852 int spider_db_delete_all_rows(
853   ha_spider *spider
854 );
855 
856 int spider_db_disable_keys(
857   ha_spider *spider
858 );
859 
860 int spider_db_enable_keys(
861   ha_spider *spider
862 );
863 
864 int spider_db_check_table(
865   ha_spider *spider,
866   HA_CHECK_OPT* check_opt
867 );
868 
869 int spider_db_repair_table(
870   ha_spider *spider,
871   HA_CHECK_OPT* check_opt
872 );
873 
874 int spider_db_analyze_table(
875   ha_spider *spider
876 );
877 
878 int spider_db_optimize_table(
879   ha_spider *spider
880 );
881 
882 int spider_db_flush_tables(
883   ha_spider *spider,
884   bool lock
885 );
886 
887 int spider_db_flush_logs(
888   ha_spider *spider
889 );
890 
891 Field *spider_db_find_field_in_item_list(
892   Item **item_list,
893   uint item_count,
894   uint start_item,
895   spider_string *str,
896   const char *func_name,
897   int func_name_length
898 );
899 
900 int spider_db_print_item_type(
901   Item *item,
902   Field *field,
903   ha_spider *spider,
904   spider_string *str,
905   const char *alias,
906   uint alias_length,
907   uint dbton_id,
908   bool use_fields,
909   spider_fields *fields
910 );
911 
912 int spider_db_print_item_type_default(
913   Item *item,
914   ha_spider *spider,
915   spider_string *str
916 );
917 
918 int spider_db_open_item_cond(
919   Item_cond *item_cond,
920   ha_spider *spider,
921   spider_string *str,
922   const char *alias,
923   uint alias_length,
924   uint dbton_id,
925   bool use_fields,
926   spider_fields *fields
927 );
928 
929 int spider_db_open_item_func(
930   Item_func *item_func,
931   ha_spider *spider,
932   spider_string *str,
933   const char *alias,
934   uint alias_length,
935   uint dbton_id,
936   bool use_fields,
937   spider_fields *fields
938 );
939 
940 #ifdef HANDLER_HAS_DIRECT_AGGREGATE
941 int spider_db_open_item_sum_func(
942   Item_sum *item_sum,
943   ha_spider *spider,
944   spider_string *str,
945   const char *alias,
946   uint alias_length,
947   uint dbton_id,
948   bool use_fields,
949   spider_fields *fields
950 );
951 #endif
952 
953 int spider_db_open_item_ident(
954   Item_ident *item_ident,
955   ha_spider *spider,
956   spider_string *str,
957   const char *alias,
958   uint alias_length,
959   uint dbton_id,
960   bool use_fields,
961   spider_fields *fields
962 );
963 
964 int spider_db_open_item_field(
965   Item_field *item_field,
966   ha_spider *spider,
967   spider_string *str,
968   const char *alias,
969   uint alias_length,
970   uint dbton_id,
971   bool use_fields,
972   spider_fields *fields
973 );
974 
975 int spider_db_open_item_ref(
976   Item_ref *item_ref,
977   ha_spider *spider,
978   spider_string *str,
979   const char *alias,
980   uint alias_length,
981   uint dbton_id,
982   bool use_fields,
983   spider_fields *fields
984 );
985 
986 int spider_db_open_item_row(
987   Item_row *item_row,
988   ha_spider *spider,
989   spider_string *str,
990   const char *alias,
991   uint alias_length,
992   uint dbton_id,
993   bool use_fields,
994   spider_fields *fields
995 );
996 
997 int spider_db_open_item_string(
998   Item *item,
999   Field *field,
1000   ha_spider *spider,
1001   spider_string *str,
1002   const char *alias,
1003   uint alias_length,
1004   uint dbton_id,
1005   bool use_fields,
1006   spider_fields *fields
1007 );
1008 
1009 int spider_db_open_item_int(
1010   Item *item,
1011   Field *field,
1012   ha_spider *spider,
1013   spider_string *str,
1014   const char *alias,
1015   uint alias_length,
1016   uint dbton_id,
1017   bool use_fields,
1018   spider_fields *fields
1019 );
1020 
1021 int spider_db_open_item_cache(
1022   Item_cache *item_cache,
1023   Field *field,
1024   ha_spider *spider,
1025   spider_string *str,
1026   const char *alias,
1027   uint alias_length,
1028   uint dbton_id,
1029   bool use_fields,
1030   spider_fields *fields
1031 );
1032 
1033 int spider_db_open_item_insert_value(
1034   Item_insert_value *item_insert_value,
1035   Field *field,
1036   ha_spider *spider,
1037   spider_string *str,
1038   const char *alias,
1039   uint alias_length,
1040   uint dbton_id,
1041   bool use_fields,
1042   spider_fields *fields
1043 );
1044 
1045 int spider_db_append_condition(
1046   ha_spider *spider,
1047   const char *alias,
1048   uint alias_length,
1049   bool test_flg
1050 );
1051 
1052 #ifdef HANDLER_HAS_DIRECT_UPDATE_ROWS
1053 int spider_db_append_update_columns(
1054   ha_spider *spider,
1055   spider_string *str,
1056   const char *alias,
1057   uint alias_length,
1058   uint dbton_id,
1059   bool use_fields,
1060   spider_fields *fields
1061 );
1062 #endif
1063 
1064 uint spider_db_check_ft_idx(
1065   Item_func *item_func,
1066   ha_spider *spider
1067 );
1068 
1069 int spider_db_udf_fetch_row(
1070   SPIDER_TRX *trx,
1071   Field *field,
1072   SPIDER_DB_ROW *row,
1073   ulong *length
1074 );
1075 
1076 int spider_db_udf_fetch_table(
1077   SPIDER_TRX *trx,
1078   SPIDER_CONN *conn,
1079   TABLE *table,
1080   SPIDER_DB_RESULT *result,
1081   uint set_on,
1082   uint set_off
1083 );
1084 
1085 int spider_db_udf_direct_sql_connect(
1086   const SPIDER_DIRECT_SQL *direct_sql,
1087   SPIDER_CONN *conn
1088 );
1089 
1090 int spider_db_udf_direct_sql_ping(
1091   SPIDER_DIRECT_SQL *direct_sql
1092 );
1093 
1094 int spider_db_udf_direct_sql(
1095   SPIDER_DIRECT_SQL *direct_sql
1096 );
1097 
1098 int spider_db_udf_direct_sql_select_db(
1099   SPIDER_DIRECT_SQL *direct_sql,
1100   SPIDER_CONN *conn
1101 );
1102 
1103 int spider_db_udf_direct_sql_set_names(
1104   SPIDER_DIRECT_SQL *direct_sql,
1105   SPIDER_TRX *trx,
1106   SPIDER_CONN *conn
1107 );
1108 
1109 int spider_db_udf_check_and_set_set_names(
1110   SPIDER_TRX *trx
1111 );
1112 
1113 int spider_db_udf_append_set_names(
1114   SPIDER_TRX *trx
1115 );
1116 
1117 void spider_db_udf_free_set_names(
1118   SPIDER_TRX *trx
1119 );
1120 
1121 int spider_db_udf_ping_table(
1122   SPIDER_TABLE_MON_LIST *table_mon_list,
1123   SPIDER_SHARE *share,
1124   SPIDER_TRX *trx,
1125   SPIDER_CONN *conn,
1126   char *where_clause,
1127   uint where_clause_length,
1128   bool ping_only,
1129   bool use_where,
1130   longlong limit
1131 );
1132 
1133 int spider_db_udf_ping_table_append_mon_next(
1134   spider_string *str,
1135   char *child_table_name,
1136   uint child_table_name_length,
1137   int link_id,
1138   char *where_clause,
1139   uint where_clause_length,
1140   longlong first_sid,
1141   int full_mon_count,
1142   int current_mon_count,
1143   int success_count,
1144   int fault_count,
1145   int flags,
1146   longlong limit
1147 );
1148 
1149 int spider_db_udf_ping_table_append_select(
1150   spider_string *str,
1151   SPIDER_SHARE *share,
1152   SPIDER_TRX *trx,
1153   spider_string *where_str,
1154   bool use_where,
1155   longlong limit,
1156   uint dbton_id
1157 );
1158 
1159 int spider_db_udf_ping_table_mon_next(
1160   THD *thd,
1161   SPIDER_TABLE_MON *table_mon,
1162   SPIDER_CONN *conn,
1163   SPIDER_MON_TABLE_RESULT *mon_table_result,
1164   char *child_table_name,
1165   uint child_table_name_length,
1166   int link_id,
1167   char *where_clause,
1168   uint where_clause_length,
1169   longlong first_sid,
1170   int full_mon_count,
1171   int current_mon_count,
1172   int success_count,
1173   int fault_count,
1174   int flags,
1175   longlong limit
1176 );
1177 
1178 int spider_db_udf_copy_tables(
1179   SPIDER_COPY_TABLES *copy_tables,
1180   ha_spider *spider,
1181   TABLE *table,
1182   longlong bulk_insert_rows
1183 );
1184 
1185 int spider_db_open_handler(
1186   ha_spider *spider,
1187   SPIDER_CONN *conn,
1188   int link_idx
1189 );
1190 
1191 #ifdef HA_CAN_BULK_ACCESS
1192 int spider_db_bulk_open_handler(
1193   ha_spider *spider,
1194   SPIDER_CONN *conn,
1195   int link_idx
1196 );
1197 #endif
1198 
1199 int spider_db_close_handler(
1200   ha_spider *spider,
1201   SPIDER_CONN *conn,
1202   int link_idx,
1203   uint tgt_conn_kind
1204 );
1205 
1206 #if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
1207 void spider_db_hs_request_buf_reset(
1208   SPIDER_CONN *conn
1209 );
1210 #endif
1211 
1212 bool spider_db_conn_is_network_error(
1213   int error_num
1214 );
1215