CUBRID Engine
latest
Main Page
Namespaces
Classes
Files
File List
File Members
access_json_table.hpp
Go to the documentation of this file.
1
/*
2
* Copyright 2008 Search Solution Corporation
3
* Copyright 2016 CUBRID Corporation
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*
17
*/
18
19
//
20
// access_json_table.hpp - defines structures required to access json table spec type.
21
//
22
23
#ifndef _ACCESS_JSON_TABLE_H_
24
#define _ACCESS_JSON_TABLE_H_
25
26
#include <string>
27
#include <vector>
28
29
#include <cstdint>
30
31
#include "
json_table_def.h
"
32
#include "
object_domain.h
"
33
34
// forward declarations
35
struct
db_value
;
36
struct
tp_domain
;
37
class
regu_variable_node
;
38
class
JSON_DOC
;
39
class
JSON_ITERATOR
;
40
41
namespace
cubxasl
42
{
43
namespace
json_table
44
{
45
46
struct
column
47
{
48
tp_domain
*
m_domain
;
49
char
*
m_path
;
50
char
*
m_column_name
;
51
json_table_column_behavior
m_on_error
;
52
json_table_column_behavior
m_on_empty
;
53
db_value
*
m_output_value_pointer
;
// should match xasl->outptr_list value pointers
54
55
// there are three types of columns based on how they function:
56
// extract from path, exists at path or ordinality
57
json_table_column_function
m_function
;
58
59
column
();
60
61
void
init
();
62
int
evaluate
(
const
JSON_DOC
&
input
,
size_t
ordinality);
63
void
clear_xasl
(
bool
is_final_clear =
true
);
64
65
private
:
66
int
evaluate_extract
(
const
JSON_DOC
&
input
);
67
int
evaluate_exists
(
const
JSON_DOC
&
input
);
68
int
evaluate_ordinality
(
size_t
ordinality);
69
70
int
trigger_on_error
(
const
JSON_DOC
&
input
,
const
TP_DOMAIN_STATUS
&status_cast,
db_value
&value_out);
71
int
trigger_on_empty
(
db_value
&value_out);
72
};
73
74
struct
node
75
{
76
char
*
m_path
;
77
size_t
m_ordinality
;
// will be used to count the row ordinality
78
column
*
m_output_columns
;
// columns part of output only
79
size_t
m_output_columns_size
;
80
node
*
m_nested_nodes
;
// nested nodes
81
size_t
m_nested_nodes_size
;
82
size_t
m_id
;
// identifier for each node
83
JSON_ITERATOR
*
m_iterator
;
84
bool
m_is_iterable_node
;
85
86
node
(
void
);
87
88
void
init
();
89
void
clear_columns (
bool
is_final_clear);
90
void
clear_iterators (
bool
is_final_clear);
91
void
clear_xasl
(
bool
is_final_clear =
true
);
92
void
init_iterator ();
93
void
init_ordinality ();
94
};
95
96
struct
spec_node
97
{
98
node
*
m_root_node
;
99
regu_variable_node
*
m_json_reguvar
;
100
std::size_t
m_node_count
;
// the total number of nodes
101
102
spec_node
();
103
104
void
init
();
105
void
clear_xasl
(
bool
is_final_clear =
true
);
106
};
107
108
}
// namespace json_table
109
}
// namespace cubxasl
110
111
// to be used outside namespace
112
using
json_table_column
=
cubxasl::json_table::column
;
113
using
json_table_node
=
cubxasl::json_table::node
;
114
using
json_table_spec_node
=
cubxasl::json_table::spec_node
;
115
116
#endif // _ACCESS_JSON_TABLE_H_
cubxasl::json_table::column::evaluate_ordinality
int evaluate_ordinality(size_t ordinality)
Definition:
access_json_table.cpp:195
JSON_DOC
Definition:
db_json_types_internal.hpp:33
cubxasl::json_table::column::evaluate_extract
int evaluate_extract(const JSON_DOC &input)
Definition:
access_json_table.cpp:127
cubxasl::json_table::spec_node::m_json_reguvar
regu_variable_node * m_json_reguvar
Definition:
access_json_table.hpp:99
cubxasl::json_table::column::m_on_empty
json_table_column_behavior m_on_empty
Definition:
access_json_table.hpp:52
cubxasl::json_table::column::m_output_value_pointer
db_value * m_output_value_pointer
Definition:
access_json_table.hpp:53
cubxasl::json_table::node::m_iterator
JSON_ITERATOR * m_iterator
Definition:
access_json_table.hpp:83
cubxasl::json_table::column
Definition:
access_json_table.hpp:46
cubxasl::json_table::node::m_nested_nodes
node * m_nested_nodes
Definition:
access_json_table.hpp:80
cubxasl::json_table::node::m_output_columns
column * m_output_columns
Definition:
access_json_table.hpp:78
cubxasl::json_table::column::trigger_on_error
int trigger_on_error(const JSON_DOC &input, const TP_DOMAIN_STATUS &status_cast, db_value &value_out)
Definition:
access_json_table.cpp:41
TP_DOMAIN_STATUS
enum tp_domain_status TP_DOMAIN_STATUS
cubxasl::json_table::node::m_ordinality
size_t m_ordinality
Definition:
access_json_table.hpp:77
json_table_def.h
cubxasl::json_table::column::m_on_error
json_table_column_behavior m_on_error
Definition:
access_json_table.hpp:51
db_value
Definition:
dbtype_def.h:1080
json_table_column_behavior
Definition:
json_table_def.h:45
input
static int input()
Definition:
cnvlex.c:1661
cubxasl::json_table::column::column
column()
Definition:
access_json_table.cpp:107
cubxasl::json_table::column::m_function
json_table_column_function m_function
Definition:
access_json_table.hpp:57
cubxasl::json_table::column::evaluate_exists
int evaluate_exists(const JSON_DOC &input)
Definition:
access_json_table.cpp:169
cubxasl::json_table::column::m_column_name
char * m_column_name
Definition:
access_json_table.hpp:50
JSON_ITERATOR
Definition:
db_json.cpp:111
cubxasl::json_table::node::m_is_iterable_node
bool m_is_iterable_node
Definition:
access_json_table.hpp:84
cubxasl::json_table::column::m_path
char * m_path
Definition:
access_json_table.hpp:49
cubxasl::json_table::node::m_id
size_t m_id
Definition:
access_json_table.hpp:82
cubxasl::json_table::node::m_path
char * m_path
Definition:
access_json_table.hpp:76
tp_domain
Definition:
object_domain.h:72
json_table_column_function
json_table_column_function
Definition:
json_table_def.h:38
cubxasl::json_table::spec_node
Definition:
access_json_table.hpp:96
cubxasl::json_table::column::m_domain
tp_domain * m_domain
Definition:
access_json_table.hpp:48
cubxasl::json_table::column::trigger_on_empty
int trigger_on_empty(db_value &value_out)
Definition:
access_json_table.cpp:79
cubxasl
Definition:
query_planner.h:38
regu_variable_node
Definition:
regu_var.hpp:169
cubxasl::json_table::column::evaluate
int evaluate(const JSON_DOC &input, size_t ordinality)
Definition:
access_json_table.cpp:205
cubxasl::json_table::column::init
void init()
Definition:
access_json_table.cpp:113
cubxasl::json_table::node
Definition:
access_json_table.hpp:74
cubxasl::json_table::node::m_output_columns_size
size_t m_output_columns_size
Definition:
access_json_table.hpp:79
cubxasl::json_table::spec_node::m_node_count
std::size_t m_node_count
Definition:
access_json_table.hpp:100
cubxasl::json_table::column::clear_xasl
void clear_xasl(bool is_final_clear=true)
Definition:
access_json_table.cpp:233
cubxasl::json_table::spec_node::m_root_node
node * m_root_node
Definition:
access_json_table.hpp:98
object_domain.h
cubxasl::json_table::node::m_nested_nodes_size
size_t m_nested_nodes_size
Definition:
access_json_table.hpp:81
src
xasl
access_json_table.hpp
Generated by
1.8.11