Files
scylladb/cql3/statements/cf_statement.cc
Avi Kivity fcb8d040e8 treewide: use Software Package Data Exchange (SPDX) license identifiers
Instead of lengthy blurbs, switch to single-line, machine-readable
standardized (https://spdx.dev) license identifiers. The Linux kernel
switched long ago, so there is strong precedent.

Three cases are handled: AGPL-only, Apache-only, and dual licensed.
For the latter case, I chose (AGPL-3.0-or-later and Apache-2.0),
reasoning that our changes are extensive enough to apply our license.

The changes we applied mechanically with a script, except to
licenses/README.md.

Closes #9937
2022-01-18 12:15:18 +01:00

62 lines
1.3 KiB
C++

/*
*/
/*
* Copyright 2014-present-2015 ScyllaDB
*
* Modified by ScyllaDB
*/
/*
* SPDX-License-Identifier: (AGPL-3.0-or-later and Apache-2.0)
*/
#include "raw/cf_statement.hh"
#include "service/client_state.hh"
#include "cql3/column_specification.hh"
namespace cql3 {
namespace statements {
namespace raw {
cf_statement::cf_statement(std::optional<cf_name> cf_name)
: _cf_name(std::move(cf_name))
{
}
void cf_statement::prepare_keyspace(const service::client_state& state)
{
if (!_cf_name->has_keyspace()) {
// XXX: We explicitely only want to call state.getKeyspace() in this case, as we don't want to throw
// if not logged in any keyspace but a keyspace is explicitely set on the statement. So don't move
// the call outside the 'if' or replace the method by 'prepareKeyspace(state.getKeyspace())'
_cf_name->set_keyspace(state.get_keyspace(), true);
}
}
void cf_statement::prepare_keyspace(std::string_view keyspace)
{
if (!_cf_name->has_keyspace()) {
_cf_name->set_keyspace(keyspace, true);
}
}
const sstring& cf_statement::keyspace() const
{
assert(_cf_name->has_keyspace()); // "The statement hasn't be prepared correctly";
return _cf_name->get_keyspace();
}
const sstring& cf_statement::column_family() const
{
return _cf_name->get_column_family();
}
}
}
}