Hazelcast C++ Client
Hazelcast C++ Client Library
Loading...
Searching...
No Matches
sql_row_metadata.h
1/*
2 * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#pragma once
17
18#include <vector>
19#include <unordered_map>
20
21#include "hazelcast/util/export.h"
22#include "hazelcast/client/sql/sql_column_metadata.h"
23
24namespace hazelcast {
25namespace client {
26namespace sql {
27
31class HAZELCAST_API sql_row_metadata
32{
33public:
38 std::unordered_map<std::string, std::size_t>::const_iterator;
39
40 explicit sql_row_metadata(std::vector<sql_column_metadata> columns);
41
47 std::size_t column_count() const;
48
56 const sql_column_metadata& column(std::size_t index) const;
57
63 const std::vector<sql_column_metadata>& columns() const;
64
74 const_iterator find_column(const std::string& column_name) const;
75
79 const_iterator end() const;
80
81 friend bool HAZELCAST_API operator==(const sql_row_metadata& lhs,
82 const sql_row_metadata& rhs);
83
84private:
85 std::vector<sql_column_metadata> columns_;
86 std::unordered_map<std::string, std::size_t> name_to_index_;
87};
88
89} // namespace sql
90} // namespace client
91} // namespace hazelcast
std::unordered_map< std::string, std::size_t >::const_iterator const_iterator
key is the column name, value is the column index.
const sql_column_metadata & column(std::size_t index) const
Gets column metadata.
Definition sql.cpp:1282
std::size_t column_count() const
Gets the number of columns in the row.
Definition sql.cpp:1276
const_iterator end() const
Constant indicating that the column is not found.
Definition sql.cpp:1306
const_iterator find_column(const std::string &column_name) const
Find index of the column with the given name.
Definition sql.cpp:1300
const std::vector< sql_column_metadata > & columns() const
Gets columns metadata.
Definition sql.cpp:1294