Apache Ignite C++ Client
Loading...
Searching...
No Matches
qualified_name.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. 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#pragma once
19
20#include "ignite/client/sql/sql_statement.h"
21#include "ignite/common/detail/config.h"
22
23#include <algorithm>
24#include <string>
25#include <string_view>
26
27namespace ignite {
28
40class qualified_name {
41public:
43 IGNITE_API static constexpr std::string_view DEFAULT_SCHEMA_NAME = sql_statement::DEFAULT_SCHEMA;
44
46 IGNITE_API static constexpr char SEPARATOR_CHAR = '.';
47
49 IGNITE_API static constexpr char QUOTE_CHAR = '"';
50
51 // Default
52 qualified_name() = default;
53
61 [[nodiscard]] IGNITE_API static qualified_name create(std::string_view schema_name, std::string_view object_name);
62
69 [[nodiscard]] IGNITE_API static qualified_name parse(std::string_view simple_or_canonical_name);
70
76 [[nodiscard]] const std::string& get_schema_name() const { return m_schema_name; }
77
83 [[nodiscard]] const std::string& get_object_name() const { return m_object_name; }
84
91 [[nodiscard]] const std::string& get_canonical_name() const;
92
93private:
100 qualified_name(std::string schema_name, std::string object_name)
101 : m_schema_name(std::move(schema_name))
102 , m_object_name(std::move(object_name)) {}
103
105 std::string m_schema_name;
106
108 std::string m_object_name;
109
111 mutable std::string m_canonical_name;
112};
113} // namespace ignite
Definition qualified_name.h:40
static IGNITE_API qualified_name create(std::string_view schema_name, std::string_view object_name)
Definition qualified_name.cpp:37
static IGNITE_API constexpr char QUOTE_CHAR
Definition qualified_name.h:49
static IGNITE_API constexpr std::string_view DEFAULT_SCHEMA_NAME
Definition qualified_name.h:43
const std::string & get_canonical_name() const
Definition qualified_name.cpp:73
static IGNITE_API constexpr char SEPARATOR_CHAR
Definition qualified_name.h:46
const std::string & get_object_name() const
Definition qualified_name.h:83
const std::string & get_schema_name() const
Definition qualified_name.h:76
static IGNITE_API qualified_name parse(std::string_view simple_or_canonical_name)
Definition qualified_name.cpp:48
static constexpr std::string_view DEFAULT_SCHEMA
Definition sql_statement.h:35