Files
scylladb/cql3/description.cc
Avi Kivity f3eade2f62 treewide: relicense to ScyllaDB-Source-Available-1.0
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/
2024-12-18 17:45:13 +02:00

44 lines
1.1 KiB
C++

/*
* Copyright (C) 2024-present ScyllaDB
*/
/*
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
*/
#include "cql3/description.hh"
#include <seastar/core/on_internal_error.hh>
#include "cql3/util.hh"
#include "utils/log.hh"
#include "types/types.hh"
static logging::logger dlogger{"description"};
namespace cql3 {
std::vector<bytes_opt> description::serialize(bool serialize_create_statement) const {
std::vector<bytes_opt> result{};
result.reserve(serialize_create_statement ? 4 : 3);
if (keyspace) {
result.push_back(to_bytes(cql3::util::maybe_quote(*keyspace)));
} else {
result.push_back(data_value::make_null(utf8_type).serialize());
}
result.push_back(to_bytes(type));
result.push_back(to_bytes(cql3::util::maybe_quote(name)));
if (serialize_create_statement && create_statement) {
result.push_back(to_bytes(*create_statement));
} else if (serialize_create_statement) {
on_internal_error(dlogger, "create_statement field is empty");
}
return result;
}
} // namespace cql3