![]() |
MySQL 8.0.43
Source Code Documentation
|
#include "my_inttypes.h"Go to the source code of this file.
Classes | |
| struct | TYPELIB |
Macros | |
| #define | FIND_TYPE_BASIC 0 |
| #define | FIND_TYPE_NO_PREFIX (1 << 0) |
makes find_type() require the whole name, no prefix More... | |
| #define | FIND_TYPE_NO_OVERWRITE (1 << 1) |
| always implicitly on, so unused, but old code may pass it More... | |
| #define | FIND_TYPE_ALLOW_NUMBER (1 << 2) |
makes find_type() accept a number More... | |
| #define | FIND_TYPE_COMMA_TERM (1 << 3) |
makes find_type() treat ',' as terminator More... | |
Functions | |
| 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 TYPELIB denotes a bit position. More... | |
| int | find_type_or_exit (const char *x, TYPELIB *typelib, const char *option) |
| int | find_type (const char *x, const TYPELIB *typelib, unsigned int flags) |
| Search after a string in a list of strings. More... | |
| const char * | get_type (TYPELIB *typelib, unsigned int nr) |
| Get type. More... | |
| TYPELIB * | copy_typelib (MEM_ROOT *root, TYPELIB *from) |
| Create a copy of a specified TYPELIB structure. More... | |
| 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) |
| Parse and apply a set of flag assingments. More... | |
Variables | |
| TYPELIB | sql_protocol_typelib |
| #define FIND_TYPE_ALLOW_NUMBER (1 << 2) |
makes find_type() accept a number
| #define FIND_TYPE_BASIC 0 |
| #define FIND_TYPE_COMMA_TERM (1 << 3) |
makes find_type() treat ',' as terminator
| #define FIND_TYPE_NO_OVERWRITE (1 << 1) |
always implicitly on, so unused, but old code may pass it
| #define FIND_TYPE_NO_PREFIX (1 << 0) |
makes find_type() require the whole name, no prefix
Create a copy of a specified TYPELIB structure.
| root | pointer to a MEM_ROOT object for allocations |
| from | pointer to a source TYPELIB structure |
| pointer | to the new TYPELIB structure on successful copy |
| NULL | otherwise |
| uint64_t find_set_from_flags | ( | const TYPELIB * | lib, |
| int | default_name, | ||
| uint64_t | cur_set, | ||
| uint64_t | default_set, | ||
| const char * | str, | ||
| uint | length, | ||
| const char ** | err_pos, | ||
| uint * | err_len | ||
| ) |
Parse and apply a set of flag assingments.
| lib | Flag names |
| default_name | Number of "default" in the typelib |
| cur_set | Current set of flags (start from this state) |
| default_set | Default set of flags (use this for assign-default keyword and flag=default assignments) |
| str | String to be parsed |
| length | Length of the string |
| err_pos | OUT If error, set to point to start of wrong set string NULL on success |
| err_len | OUT If error, set to the length of wrong set string |
Parse a set of flag assignments, that is, parse a string in form:
param_name1=value1,param_name2=value2,...
where the names are specified in the TYPELIB, and each value can be either 'on','off', or 'default'. Setting the same name twice is not allowed.
Besides param=val assignments, we support the "default" keyword (keyword default_name in the typelib). It can be used one time, if specified it causes us to build the new set over the default_set rather than cur_set value.
| Parsed | set value if (*errpos == NULL), otherwise undefined |
Search after a string in a list of strings.
Endspace in x is not compared.
| x | String to find |
| typelib | TYPELIB (struct of pointer to values + count) |
| flags | flags to tune behaviour: a combination of FIND_TYPE_NO_PREFIX FIND_TYPE_ALLOW_NUMBER FIND_TYPE_COMMA_TERM. FIND_TYPE_NO_OVERWRITE can be passed but is redundant (is always implicitly on). |
| -1 | Too many matching values |
| 0 | No matching value |
| >0 | Offset+1 in typelib for matched string |
| int find_type_or_exit | ( | const char * | x, |
| TYPELIB * | typelib, | ||
| const char * | option | ||
| ) |
| uint64_t find_typeset | ( | const char * | x, |
| TYPELIB * | lib, | ||
| int * | err | ||
| ) |
Create an integer value to represent the supplied comma-separated string where each string in the TYPELIB denotes a bit position.
| x | string to decompose |
| lib | TYPELIB (struct of pointer to values + count) |
| err | index (not char position) of string element which was not found or 0 if there was no error |
| a | integer representation of the supplied string |
|
extern |