MySQL
9.3.0
Source Code Documentation
Toggle main menu visibility
Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
o
p
r
s
t
u
v
w
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Concepts
Classes
Class List
Class Index
Class Hierarchy
Class Members
All
:
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Related Functions
:
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
Concepts
column_mapping_converter.h
Go to the documentation of this file.
1
/*
2
Copyright (c) 2024, 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 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
26
#ifndef ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_DATABASE_CONVERTERS_COLUMN_MAPPING_CONVERTER_H_
27
#define ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_DATABASE_CONVERTERS_COLUMN_MAPPING_CONVERTER_H_
28
29
#include <stdexcept>
30
#include <string>
31
32
#include "
helper/json/text_to.h
"
33
#include "
mrs/database/entry/object.h
"
34
35
namespace
mrs
{
36
namespace
database {
37
38
class
ColumnMappingConverter
{
39
public
:
40
ColumnMappingConverter
() {}
41
42
void
operator()
(
entry::ForeignKeyReference::ColumnMapping
*out,
43
const
char
*
value
)
const
{
44
if
(
nullptr
==
value
) {
45
*out = {};
46
return
;
47
}
48
49
rapidjson::Document doc =
helper::json::text_to_document
(
value
);
50
if
(!doc.IsArray()) {
51
throw
std::runtime_error(
52
"'object_reference's column 'metadata', must be an array"
);
53
}
54
55
out->clear();
56
for
(
const
auto
&col : doc.GetArray()) {
57
if
(!col.IsObject())
58
throw
std::runtime_error(
59
"'object_reference's column 'metadata', element must be an "
60
"object."
);
61
if
(!col.HasMember(
"base"
) || !col[
"base"
].IsString())
62
throw
std::runtime_error(
63
"'object_reference's column 'metadata', element must contain "
64
"'base' field with "
65
"string value."
);
66
if
(!col.HasMember(
"ref"
) || !col[
"ref"
].IsString())
67
throw
std::runtime_error(
68
"'object_reference's column 'metadata', element must contain 'ref' "
69
"field with string "
70
"value."
);
71
72
out->emplace_back(col[
"base"
].GetString(), col[
"ref"
].GetString());
73
}
74
}
75
};
76
77
}
// namespace database
78
}
// namespace mrs
79
80
#endif
/* ROUTER_SRC_MYSQL_REST_SERVICE_SRC_MRS_DATABASE_CONVERTERS_COLUMN_MAPPING_CONVERTER_H_ \
81
*/
mrs::database::ColumnMappingConverter
Definition:
column_mapping_converter.h:38
mrs::database::ColumnMappingConverter::ColumnMappingConverter
ColumnMappingConverter()
Definition:
column_mapping_converter.h:40
mrs::database::ColumnMappingConverter::operator()
void operator()(entry::ForeignKeyReference::ColumnMapping *out, const char *value) const
Definition:
column_mapping_converter.h:42
mrs::database::entry::ForeignKeyReference::ColumnMapping
std::vector< std::pair< std::string, std::string > > ColumnMapping
Definition:
object.h:120
helper::json::text_to_document
rapidjson::Document text_to_document(const std::string &str)
Definition:
text_to.h:138
mrs::database::inner::value
ValueType value(const std::optional< ValueType > &v)
Definition:
gtid.h:83
mrs
Definition:
authorize_manager.h:48
object.h
text_to.h
router
src
mysql_rest_service
src
mrs
database
converters
column_mapping_converter.h
Generated by
1.9.2