- Notifications
You must be signed in to change notification settings - Fork 4k
/
Copy pathinsert_statement_builder.h
72 lines (61 loc) · 2.9 KB
/
insert_statement_builder.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* Copyright (c) 2015, 2025, Oracle and/or its affiliates.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2.0,
* as published by the Free Software Foundation.
*
* This program is designed to work with certain software (including
* but not limited to OpenSSL) that is licensed under separate terms,
* as designated in a particular file or component or in included license
* documentation. The authors of MySQL hereby grant you an additional
* permission to link the program and your derivative works with the
* separately licensed software that they have either included with
* the program or referenced in the documentation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License, version 2.0, for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef PLUGIN_X_SRC_INSERT_STATEMENT_BUILDER_H_
#definePLUGIN_X_SRC_INSERT_STATEMENT_BUILDER_H_
#include<memory>
#include<string>
#include<vector>
#include"plugin/x/src/interface/document_id_aggregator.h"
#include"plugin/x/src/statement_builder.h"
namespacexpl {
classInsert_statement_builder : publicCrud_statement_builder {
public:
using Insert = ::Mysqlx::Crud::Insert;
using Document_id_list = iface::Document_id_aggregator::Document_id_list;
explicitInsert_statement_builder(
const Expression_generator &gen,
iface::Document_id_aggregator *id_aggregator = nullptr)
: Crud_statement_builder(gen), m_document_id_aggregator(id_aggregator) {}
voidbuild(const Insert &msg) const;
protected:
using Projection_list = Repeated_field_list<::Mysqlx::Crud::Column>;
using Field_list = Repeated_field_list<::Mysqlx::Expr::Expr>;
using Row_list = Repeated_field_list<::Mysqlx::Crud::Insert_TypedRow>;
using Placeholder = ::google::protobuf::uint32;
voidadd_projection(const Projection_list &projection,
constbool is_relational) const;
voidadd_values(const Row_list &values, constint projection_size) const;
voidadd_row(const Field_list &row, constint projection_size) const;
voidadd_documents(const Row_list &values) const;
voidadd_document(const Field_list &row) const;
voidadd_upsert(constbool is_relational) const;
booladd_document_literal(const Mysqlx::Datatypes::Scalar &arg) const;
booladd_document_placeholder(const Placeholder &arg) const;
voidadd_document_object(const Mysqlx::Expr::Object &arg) const;
private:
iface::Document_id_aggregator *m_document_id_aggregator;
};
} // namespace xpl
#endif// PLUGIN_X_SRC_INSERT_STATEMENT_BUILDER_H_