Drop the AGPL license in favor of a source-available license. See the blog post [1] for details. [1] https://www.scylladb.com/2024/12/18/why-were-moving-to-a-source-available-license/
47 lines
935 B
C++
47 lines
935 B
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*
|
|
* Modified by ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: (LicenseRef-ScyllaDB-Source-Available-1.0 and Apache-2.0)
|
|
*/
|
|
|
|
#include "utils/assert.hh"
|
|
#include "cql3/keyspace_element_name.hh"
|
|
|
|
namespace cql3 {
|
|
|
|
void keyspace_element_name::set_keyspace(std::string_view ks, bool keep_case)
|
|
{
|
|
_ks_name = to_internal_name(ks, keep_case);
|
|
}
|
|
|
|
bool keyspace_element_name::has_keyspace() const
|
|
{
|
|
return bool(_ks_name);
|
|
}
|
|
|
|
const sstring& keyspace_element_name::get_keyspace() const
|
|
{
|
|
SCYLLA_ASSERT(_ks_name);
|
|
return *_ks_name;
|
|
}
|
|
|
|
sstring keyspace_element_name::to_internal_name(std::string_view view, bool keep_case)
|
|
{
|
|
sstring name(view);
|
|
if (!keep_case) {
|
|
std::transform(name.begin(), name.end(), name.begin(), ::tolower);
|
|
}
|
|
return name;
|
|
}
|
|
|
|
sstring keyspace_element_name::to_string() const
|
|
{
|
|
return has_keyspace() ? (get_keyspace() + ".") : "";
|
|
}
|
|
|
|
}
|