Coverage Report

Created: 2025-11-16 07:11

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/mysql-server/include/lex_string.h
Line
Count
Source
1
/*
2
   Copyright (c) 2000, 2025, Oracle and/or its affiliates.
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, version 2.0,
6
   as published by the Free Software Foundation.
7
8
   This program is designed to work with certain software (including
9
   but not limited to OpenSSL) that is licensed under separate terms,
10
   as designated in a particular file or component or in included license
11
   documentation.  The authors of MySQL hereby grant you an additional
12
   permission to link the program and your derivative works with the
13
   separately licensed software that they have either included with
14
   the program or referenced in the documentation.
15
16
   This program is distributed in the hope that it will be useful,
17
   but WITHOUT ANY WARRANTY; without even the implied warranty of
18
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
   GNU General Public License, version 2.0, for more details.
20
21
   You should have received a copy of the GNU General Public License
22
   along with this program; if not, write to the Free Software
23
   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
24
25
#ifndef LEX_STRING_INCLUDED
26
#define LEX_STRING_INCLUDED
27
28
#include "mysql/mysql_lex_string.h"
29
30
#ifdef __cplusplus
31
#include <string>
32
#include <string_view>
33
#endif
34
35
/*
36
  LEX_STRING -- a pair of a C-string and its length.
37
  (it's part of the plugin API as a MYSQL_LEX_STRING)
38
  Ditto LEX_CSTRING/MYSQL_LEX_CSTRING.
39
*/
40
41
typedef struct MYSQL_LEX_STRING LEX_STRING;
42
typedef struct MYSQL_LEX_CSTRING LEX_CSTRING;
43
44
#ifdef __cplusplus
45
46
constexpr const LEX_STRING NULL_STR = {nullptr, 0};
47
constexpr const LEX_CSTRING NULL_CSTR = {nullptr, 0};
48
constexpr const LEX_CSTRING EMPTY_CSTR = {"", 0};
49
50
0
static inline std::string to_string(const LEX_STRING &str) {
51
0
  return std::string(str.str, str.length);
52
0
}
Unexecuted instantiation: fuzz_show_warnings.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: show_warnings_parser.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: sql_lexer.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: sql_lexer_thd.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: charset.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: my_getwd.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: my_lib.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: mf_pack.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: ctype-bin.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: ctype-latin1.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: ctype-mb.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: ctype-simple.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: ctype-uca.cc:to_string(MYSQL_LEX_STRING const&)
Unexecuted instantiation: fuzz_sql_lexer.cc:to_string(MYSQL_LEX_STRING const&)
53
54
0
static inline std::string to_string(const LEX_CSTRING &str) {
55
0
  return std::string(str.str, str.length);
56
0
}
Unexecuted instantiation: fuzz_show_warnings.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: show_warnings_parser.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: sql_lexer.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: sql_lexer_thd.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: charset.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: my_getwd.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: my_lib.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: mf_pack.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: ctype-bin.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: ctype-latin1.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: ctype-mb.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: ctype-simple.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: ctype-uca.cc:to_string(MYSQL_LEX_CSTRING const&)
Unexecuted instantiation: fuzz_sql_lexer.cc:to_string(MYSQL_LEX_CSTRING const&)
57
58
147k
static inline std::string_view to_string_view(LEX_STRING str) {
59
147k
  return std::string_view{str.str, str.length};
60
147k
}
Unexecuted instantiation: fuzz_show_warnings.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: show_warnings_parser.cc:to_string_view(MYSQL_LEX_STRING)
sql_lexer.cc:to_string_view(MYSQL_LEX_STRING)
Line
Count
Source
58
147k
static inline std::string_view to_string_view(LEX_STRING str) {
59
147k
  return std::string_view{str.str, str.length};
60
147k
}
Unexecuted instantiation: sql_lexer_thd.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: charset.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: my_getwd.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: my_lib.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: mf_pack.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: ctype-bin.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: ctype-latin1.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: ctype-mb.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: ctype-simple.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: ctype-uca.cc:to_string_view(MYSQL_LEX_STRING)
Unexecuted instantiation: fuzz_sql_lexer.cc:to_string_view(MYSQL_LEX_STRING)
61
62
0
static inline std::string_view to_string_view(LEX_CSTRING str) {
63
0
  return std::string_view{str.str, str.length};
64
0
}
Unexecuted instantiation: fuzz_show_warnings.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: show_warnings_parser.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: sql_lexer.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: sql_lexer_thd.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: charset.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: my_getwd.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: my_lib.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: mf_pack.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: ctype-bin.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: ctype-latin1.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: ctype-mb.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: ctype-simple.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: ctype-uca.cc:to_string_view(MYSQL_LEX_CSTRING)
Unexecuted instantiation: fuzz_sql_lexer.cc:to_string_view(MYSQL_LEX_CSTRING)
65
66
#endif  // defined(__cplusplus)
67
68
#endif