MySQL  8.0.17
Source Code Documentation
typelib.h
Go to the documentation of this file.
1 /* Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
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
21  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 
23 #ifndef _typelib_h
24 #define _typelib_h
25 
26 /**
27  @file include/typelib.h
28 */
29 
30 #include "my_inttypes.h"
31 
32 struct MEM_ROOT;
33 
34 struct TYPELIB { /* Different types saved here */
35  size_t count{0}; /* How many types */
36  const char *name{nullptr}; /* Name of typelib */
37  const char **type_names{nullptr};
38  unsigned int *type_lengths{nullptr};
39 };
40 
41 extern my_ulonglong find_typeset(const char *x, TYPELIB *typelib,
42  int *error_position);
43 extern int find_type_or_exit(const char *x, TYPELIB *typelib,
44  const char *option);
45 #define FIND_TYPE_BASIC 0
46 /** makes @c find_type() require the whole name, no prefix */
47 #define FIND_TYPE_NO_PREFIX (1 << 0)
48 /** always implicitely on, so unused, but old code may pass it */
49 #define FIND_TYPE_NO_OVERWRITE (1 << 1)
50 /** makes @c find_type() accept a number */
51 #define FIND_TYPE_ALLOW_NUMBER (1 << 2)
52 /** makes @c find_type() treat ',' as terminator */
53 #define FIND_TYPE_COMMA_TERM (1 << 3)
54 
55 extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
56 extern void make_type(char *to, unsigned int nr, TYPELIB *typelib);
57 extern const char *get_type(TYPELIB *typelib, unsigned int nr);
58 extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
59 
61 
62 my_ulonglong find_set_from_flags(const TYPELIB *lib, size_t default_name,
63  my_ulonglong cur_set, my_ulonglong default_set,
64  const char *str, unsigned int length,
65  const char **err_pos, unsigned int *err_len);
66 
67 #endif /* _typelib_h */
Some integer typedefs for easier portability.
unsigned int * type_lengths
Definition: typelib.h:38
TYPELIB sql_protocol_typelib
Definition: client.cc:1981
const char ** type_names
Definition: typelib.h:37
int find_type(const char *x, const TYPELIB *typelib, unsigned int flags)
Search after a string in a list of strings.
Definition: typelib.cc:86
unsigned int root
Definition: dbug_analyze.cc:514
structure to define some default "config_option" option settings
Definition: innodb_config.h:180
unsigned long long my_ulonglong
Definition: my_inttypes.h:78
my_ulonglong find_typeset(const char *x, TYPELIB *typelib, int *error_position)
Create an integer value to represent the supplied comma-seperated string where each string in the TYP...
Definition: typelib.cc:175
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
Definition: typelib.cc:48
TYPELIB * copy_typelib(MEM_ROOT *root, TYPELIB *from)
Create a copy of a specified TYPELIB structure.
Definition: typelib.cc:214
Definition: typelib.h:34
size_t count
Definition: typelib.h:35
void make_type(char *to, unsigned int nr, TYPELIB *typelib)
Get name of type nr.
Definition: typelib.cc:140
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:77
static int flags[50]
Definition: hp_test1.cc:39
const char * name
Definition: typelib.h:36
my_ulonglong find_set_from_flags(const TYPELIB *lib, size_t default_name, my_ulonglong cur_set, my_ulonglong default_set, const char *str, unsigned int length, const char **err_pos, unsigned int *err_len)
Parse and apply a set of flag assingments.
Definition: typelib.cc:311
bool length(const dd::Spatial_reference_system *srs, const Geometry *g1, double *length, bool *null) noexcept
Computes the length of linestrings and multilinestrings.
Definition: length.cc:75
const char * get_type(TYPELIB *typelib, unsigned int nr)
Get type.
Definition: typelib.cc:156