MySQL 8.4.3
Source Code Documentation
typelib.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2024, 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 designed to work 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 either included with
13 the program or referenced in the documentation.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef _typelib_h
25#define _typelib_h
26
27/**
28 @file include/typelib.h
29*/
30
31#include "my_inttypes.h"
32
33struct MEM_ROOT;
34
35struct TYPELIB { /* Different types saved here */
36 size_t count{0}; /* How many types */
37 const char *name{nullptr}; /* Name of typelib */
38 const char **type_names{nullptr};
39 unsigned int *type_lengths{nullptr};
40};
41
42extern uint64_t find_typeset(const char *x, TYPELIB *typelib,
43 int *error_position);
44extern int find_type_or_exit(const char *x, TYPELIB *typelib,
45 const char *option);
46#define FIND_TYPE_BASIC 0
47/** makes @c find_type() require the whole name, no prefix */
48#define FIND_TYPE_NO_PREFIX (1 << 0)
49/** always implicitly on, so unused, but old code may pass it */
50#define FIND_TYPE_NO_OVERWRITE (1 << 1)
51/** makes @c find_type() accept a number */
52#define FIND_TYPE_ALLOW_NUMBER (1 << 2)
53/** makes @c find_type() treat ',' as terminator */
54#define FIND_TYPE_COMMA_TERM (1 << 3)
55
56extern int find_type(const char *x, const TYPELIB *typelib, unsigned int flags);
57extern const char *get_type(TYPELIB *typelib, unsigned int nr);
58extern TYPELIB *copy_typelib(MEM_ROOT *root, TYPELIB *from);
59
61
62uint64_t find_set_from_flags(const TYPELIB *lib, int default_name,
63 uint64_t cur_set, uint64_t default_set,
64 const char *str, unsigned int length,
65 const char **err_pos, unsigned int *err_len);
66
67#endif /* _typelib_h */
static int flags[50]
Definition: hp_test1.cc:40
Some integer typedefs for easier portability.
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1081
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:76
The MEM_ROOT is a simple arena, where allocations are carved out of larger blocks.
Definition: my_alloc.h:83
Definition: typelib.h:35
const char ** type_names
Definition: typelib.h:38
size_t count
Definition: typelib.h:36
const char * name
Definition: typelib.h:37
unsigned int * type_lengths
Definition: typelib.h:39
int find_type_or_exit(const char *x, TYPELIB *typelib, const char *option)
Definition: typelib.cc:50
TYPELIB * copy_typelib(MEM_ROOT *root, TYPELIB *from)
Create a copy of a specified TYPELIB structure.
Definition: typelib.cc:199
int find_type(const char *x, const TYPELIB *typelib, unsigned int flags)
const char * get_type(TYPELIB *typelib, unsigned int nr)
TYPELIB sql_protocol_typelib
Definition: client.cc:2078
uint64_t find_typeset(const char *x, TYPELIB *typelib, int *error_position)
Create an integer value to represent the supplied comma-separated string where each string in the TYP...
Definition: typelib.cc:161
uint64_t find_set_from_flags(const TYPELIB *lib, int default_name, uint64_t cur_set, uint64_t default_set, const char *str, unsigned int length, const char **err_pos, unsigned int *err_len)