1 /* Copyright (c) 2010, 2021, Oracle and/or its affiliates.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software Foundation,
21    51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
22 
23 
24 #ifndef SQL_BOOTSTRAP_H
25 #define SQL_BOOTSTRAP_H
26 
27 /**
28   The maximum size of a bootstrap query.
29   Increase this size if parsing a longer query during bootstrap is necessary.
30   The longest query in use depends on the documentation content,
31   see the file fill_help_tables.sql
32 */
33 #define MAX_BOOTSTRAP_QUERY_SIZE 44000
34 /**
35   The maximum size of a bootstrap query, expressed in a single line.
36   Do not increase this size, use the multiline syntax instead.
37 */
38 #define MAX_BOOTSTRAP_LINE_SIZE 44000
39 #define MAX_BOOTSTRAP_ERROR_LEN 256
40 
41 #define READ_BOOTSTRAP_SUCCESS     0
42 #define READ_BOOTSTRAP_EOF         1
43 #define READ_BOOTSTRAP_ERROR       2
44 #define READ_BOOTSTRAP_QUERY_SIZE  3
45 
46 #define QUERY_SOURCE_FILE     0
47 #define QUERY_SOURCE_COMPILED 1
48 
49 typedef struct st_mysql_file *fgets_input_t;
50 typedef char * (*fgets_fn_t)(char *, size_t, fgets_input_t, int *error);
51 
52 int read_bootstrap_query(char *query, size_t *query_length,
53                          fgets_input_t input, fgets_fn_t fgets_fn, int *error);
54 
55 #endif
56 
57 
58