mirror of https://github.com/boostorg/mysql.git
parent
a61d4c9deb
commit
990b7c47cc
|
@ -27,6 +27,8 @@
|
|||
#include <boost/mysql/detail/protocol/protocol_types.hpp>
|
||||
#include <boost/mysql/detail/typing/writable_field_traits.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
|
@ -62,14 +64,14 @@ class connection
|
|||
|
||||
const detail::channel<Stream>& get_channel() const noexcept
|
||||
{
|
||||
assert(channel_ != nullptr);
|
||||
BOOST_ASSERT(channel_ != nullptr);
|
||||
return *channel_;
|
||||
}
|
||||
diagnostics& shared_diag() noexcept { return get_channel().shared_diag(); }
|
||||
|
||||
detail::channel<Stream>& get_channel() noexcept
|
||||
{
|
||||
assert(channel_ != nullptr);
|
||||
BOOST_ASSERT(channel_ != nullptr);
|
||||
return *channel_;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/bytestring.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <vector>
|
||||
|
||||
|
@ -22,12 +24,8 @@ namespace detail {
|
|||
|
||||
struct authentication_plugin
|
||||
{
|
||||
using calculator_signature = error_code (*)(
|
||||
string_view password,
|
||||
string_view challenge,
|
||||
bool use_ssl,
|
||||
bytestring& output
|
||||
);
|
||||
using calculator_signature =
|
||||
error_code (*)(string_view password, string_view challenge, bool use_ssl, bytestring& output);
|
||||
|
||||
string_view name;
|
||||
calculator_signature calculator;
|
||||
|
@ -53,7 +51,7 @@ public:
|
|||
}
|
||||
string_view plugin_name() const noexcept
|
||||
{
|
||||
assert(plugin_);
|
||||
BOOST_ASSERT(plugin_);
|
||||
return plugin_->name;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <boost/mysql/time.hpp>
|
||||
|
||||
#include <boost/mp11.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/variant2/variant.hpp>
|
||||
|
||||
#include <string>
|
||||
|
@ -61,7 +62,7 @@ struct field_impl
|
|||
{
|
||||
const T* res = boost::variant2::get_if<T>(&data);
|
||||
if (!res)
|
||||
throw bad_field_access();
|
||||
BOOST_THROW_EXCEPTION(bad_field_access());
|
||||
return *res;
|
||||
}
|
||||
|
||||
|
@ -70,7 +71,7 @@ struct field_impl
|
|||
{
|
||||
T* res = boost::variant2::get_if<T>(&data);
|
||||
if (!res)
|
||||
throw bad_field_access();
|
||||
BOOST_THROW_EXCEPTION(bad_field_access());
|
||||
return *res;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/datetime.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace boost {
|
||||
|
@ -21,10 +22,7 @@ namespace detail {
|
|||
|
||||
constexpr unsigned char last_month_day_arr[] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
|
||||
|
||||
constexpr bool is_leap(std::uint16_t y) noexcept
|
||||
{
|
||||
return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
|
||||
}
|
||||
constexpr bool is_leap(std::uint16_t y) noexcept { return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0); }
|
||||
|
||||
constexpr inline std::uint8_t last_month_day(std::uint16_t y, std::uint8_t m) noexcept
|
||||
{
|
||||
|
@ -51,7 +49,7 @@ BOOST_CXX14_CONSTEXPR inline int boost::mysql::detail::ymd_to_days(
|
|||
std::uint8_t day
|
||||
) noexcept
|
||||
{
|
||||
assert(is_valid(years, month, day));
|
||||
BOOST_ASSERT(is_valid(years, month, day));
|
||||
int y = years;
|
||||
const int m = month;
|
||||
const int d = day;
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/row_impl.hpp>
|
||||
#include <boost/mysql/detail/auxiliar/string_view_offset.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace boost {
|
||||
|
@ -109,7 +111,7 @@ void boost::mysql::detail::row_impl::assign(const field_view* fields, std::size_
|
|||
// don't implement sub-range operators (e.g. row_view[2:4])
|
||||
if (fields_.data() == fields)
|
||||
{
|
||||
assert(fields_.size() == size);
|
||||
BOOST_ASSERT(fields_.size() == size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -142,14 +144,14 @@ inline void boost::mysql::detail::row_impl::copy_strings()
|
|||
default: break;
|
||||
}
|
||||
}
|
||||
assert(buffer_it == string_buffer_.data() + size);
|
||||
BOOST_ASSERT(buffer_it == string_buffer_.data() + size);
|
||||
}
|
||||
|
||||
inline void boost::mysql::detail::row_impl::copy_strings_as_offsets(std::size_t first, std::size_t num_fields)
|
||||
{
|
||||
// Preconditions
|
||||
assert(first <= fields_.size());
|
||||
assert(first + num_fields <= fields_.size());
|
||||
BOOST_ASSERT(first <= fields_.size());
|
||||
BOOST_ASSERT(first + num_fields <= fields_.size());
|
||||
|
||||
// Calculate the required size for the new strings
|
||||
std::size_t size = 0;
|
||||
|
@ -174,7 +176,7 @@ inline void boost::mysql::detail::row_impl::copy_strings_as_offsets(std::size_t
|
|||
default: break;
|
||||
}
|
||||
}
|
||||
assert(offset == string_buffer_.size());
|
||||
BOOST_ASSERT(offset == string_buffer_.size());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -12,8 +12,9 @@
|
|||
|
||||
#include <boost/mysql/string_view.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <ostream>
|
||||
|
||||
|
@ -31,7 +32,7 @@ public:
|
|||
static_string() noexcept : size_(0) {}
|
||||
static_string(string_view value) noexcept : size_(value.size())
|
||||
{
|
||||
assert(value.size() <= max_size);
|
||||
BOOST_ASSERT(value.size() <= max_size);
|
||||
size_ = value.size();
|
||||
std::memcpy(buffer_.data(), value.data(), value.size());
|
||||
}
|
||||
|
@ -40,7 +41,7 @@ public:
|
|||
void append(const void* arr, std::size_t sz) noexcept
|
||||
{
|
||||
std::size_t new_size = size_ + sz;
|
||||
assert(new_size <= max_size);
|
||||
BOOST_ASSERT(new_size <= max_size);
|
||||
std::memcpy(buffer_.data() + size_, arr, sz);
|
||||
size_ = new_size;
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include <boost/asio/compose.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/ssl/stream_base.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <utility>
|
||||
|
@ -56,8 +57,7 @@ struct get_non_ssl_stream_t<false>
|
|||
};
|
||||
|
||||
template <typename Stream>
|
||||
auto get_non_ssl_stream(Stream& s)
|
||||
-> decltype(get_non_ssl_stream_t<is_ssl_stream<Stream>::value>::call(s))
|
||||
auto get_non_ssl_stream(Stream& s) -> decltype(get_non_ssl_stream_t<is_ssl_stream<Stream>::value>::call(s))
|
||||
{
|
||||
return get_non_ssl_stream_t<is_ssl_stream<Stream>::value>::call(s);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ struct async_compose_noop
|
|||
template <class... Args>
|
||||
void operator()(Args&&...)
|
||||
{
|
||||
assert(false);
|
||||
BOOST_ASSERT(false);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -97,7 +97,7 @@ struct ssl_handshake_helper<Stream, false>
|
|||
{
|
||||
static void call(disableable_ssl_stream<Stream>&, error_code&)
|
||||
{
|
||||
assert(false); // should never be called
|
||||
BOOST_ASSERT(false); // should never be called
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -165,7 +165,7 @@ struct ssl_shutdown_helper<Stream, false>
|
|||
{
|
||||
static void call_sync(disableable_ssl_stream<Stream>&, error_code&)
|
||||
{
|
||||
assert(false); // should never be called
|
||||
BOOST_ASSERT(false); // should never be called
|
||||
}
|
||||
|
||||
template <BOOST_ASIO_COMPLETION_TOKEN_FOR(void(error_code)) CompletionToken>
|
||||
|
@ -252,8 +252,7 @@ boost::mysql::detail::disableable_ssl_stream<Stream>::async_read_some(
|
|||
}
|
||||
else
|
||||
{
|
||||
return get_non_ssl_stream(inner_stream_)
|
||||
.async_read_some(buff, std::forward<CompletionToken>(token));
|
||||
return get_non_ssl_stream(inner_stream_).async_read_some(buff, std::forward<CompletionToken>(token));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,8 +289,7 @@ boost::mysql::detail::disableable_ssl_stream<Stream>::async_write_some(
|
|||
}
|
||||
else
|
||||
{
|
||||
return get_non_ssl_stream(inner_stream_)
|
||||
.async_write_some(buff, std::forward<CompletionToken>(token));
|
||||
return get_non_ssl_stream(inner_stream_).async_write_some(buff, std::forward<CompletionToken>(token));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -16,14 +16,12 @@
|
|||
#include <boost/mysql/detail/protocol/deserialization_context.hpp>
|
||||
#include <boost/mysql/detail/protocol/serialization.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/ignore_unused.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
inline void boost::mysql::detail::message_parser::parse_message(
|
||||
read_buffer& buff,
|
||||
result& res
|
||||
) noexcept
|
||||
inline void boost::mysql::detail::message_parser::parse_message(read_buffer& buff, result& res) noexcept
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
|
@ -47,7 +45,7 @@ inline void boost::mysql::detail::message_parser::parse_message(
|
|||
);
|
||||
auto err = deserialize_message_part(ctx, header);
|
||||
boost::ignore_unused(err);
|
||||
assert(err == error_code());
|
||||
BOOST_ASSERT(err == error_code());
|
||||
|
||||
// Process the sequence number
|
||||
if (state_.is_first_frame)
|
||||
|
|
|
@ -17,13 +17,14 @@
|
|||
#include <boost/asio/compose.hpp>
|
||||
#include <boost/asio/coroutine.hpp>
|
||||
#include <boost/asio/post.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
boost::asio::const_buffer boost::mysql::detail::message_reader::get_next_message(
|
||||
std::uint8_t& seqnum,
|
||||
error_code& ec
|
||||
) noexcept
|
||||
{
|
||||
assert(has_message());
|
||||
BOOST_ASSERT(has_message());
|
||||
if (result_.message.has_seqnum_mismatch || seqnum != result_.message.seqnum_first)
|
||||
{
|
||||
ec = make_error_code(client_errc::sequence_number_mismatch);
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
#include <boost/mysql/detail/channel/read_buffer.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
boost::mysql::detail::read_buffer::read_buffer(std::size_t size) : buffer_(size, std::uint8_t(0))
|
||||
|
@ -22,14 +23,14 @@ boost::mysql::detail::read_buffer::read_buffer(std::size_t size) : buffer_(size,
|
|||
|
||||
void boost::mysql::detail::read_buffer::move_to_reserved(std::size_t length) noexcept
|
||||
{
|
||||
assert(length <= current_message_size());
|
||||
BOOST_ASSERT(length <= current_message_size());
|
||||
current_message_offset_ += length;
|
||||
}
|
||||
|
||||
void boost::mysql::detail::read_buffer::remove_current_message_last(std::size_t length) noexcept
|
||||
{
|
||||
assert(length <= current_message_size());
|
||||
assert(length > 0);
|
||||
BOOST_ASSERT(length <= current_message_size());
|
||||
BOOST_ASSERT(length > 0);
|
||||
std::memmove(pending_first() - length, pending_first(), pending_size());
|
||||
pending_offset_ -= length;
|
||||
free_offset_ -= length;
|
||||
|
@ -37,13 +38,13 @@ void boost::mysql::detail::read_buffer::remove_current_message_last(std::size_t
|
|||
|
||||
void boost::mysql::detail::read_buffer::move_to_current_message(std::size_t n) noexcept
|
||||
{
|
||||
assert(n <= pending_size());
|
||||
BOOST_ASSERT(n <= pending_size());
|
||||
pending_offset_ += n;
|
||||
}
|
||||
|
||||
void boost::mysql::detail::read_buffer::move_to_pending(std::size_t n) noexcept
|
||||
{
|
||||
assert(n <= free_size());
|
||||
BOOST_ASSERT(n <= free_size());
|
||||
free_offset_ += n;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
#include <boost/asio/async_result.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <boost/mysql/detail/protocol/db_flavor.hpp>
|
||||
#include <boost/mysql/detail/protocol/resultset_encoding.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/core/span.hpp>
|
||||
|
||||
|
@ -63,7 +64,7 @@ public:
|
|||
template <class T>
|
||||
T& span_element() const noexcept
|
||||
{
|
||||
assert(data_);
|
||||
BOOST_ASSERT(data_);
|
||||
return static_cast<T*>(data_)[offset_];
|
||||
}
|
||||
};
|
||||
|
@ -85,7 +86,7 @@ public:
|
|||
|
||||
BOOST_ATTRIBUTE_NODISCARD error_code on_head_ok_packet(const ok_packet& pack, diagnostics& diag)
|
||||
{
|
||||
assert(is_reading_head());
|
||||
BOOST_ASSERT(is_reading_head());
|
||||
auto err = on_head_ok_packet_impl(pack, diag);
|
||||
set_state_for_ok(pack);
|
||||
return err;
|
||||
|
@ -93,7 +94,7 @@ public:
|
|||
|
||||
void on_num_meta(std::size_t num_columns)
|
||||
{
|
||||
assert(is_reading_head());
|
||||
BOOST_ASSERT(is_reading_head());
|
||||
on_num_meta_impl(num_columns);
|
||||
remaining_meta_ = num_columns;
|
||||
set_state(state_t::reading_metadata);
|
||||
|
@ -117,7 +118,7 @@ public:
|
|||
|
||||
void on_row_batch_start()
|
||||
{
|
||||
assert(is_reading_rows());
|
||||
BOOST_ASSERT(is_reading_rows());
|
||||
on_row_batch_start_impl();
|
||||
}
|
||||
|
||||
|
@ -126,13 +127,13 @@ public:
|
|||
BOOST_ATTRIBUTE_NODISCARD error_code
|
||||
on_row(deserialization_context ctx, const output_ref& ref, std::vector<field_view>& storage)
|
||||
{
|
||||
assert(is_reading_rows());
|
||||
BOOST_ASSERT(is_reading_rows());
|
||||
return on_row_impl(ctx, ref, storage);
|
||||
}
|
||||
|
||||
BOOST_ATTRIBUTE_NODISCARD error_code on_row_ok_packet(const ok_packet& pack)
|
||||
{
|
||||
assert(is_reading_rows());
|
||||
BOOST_ASSERT(is_reading_rows());
|
||||
auto err = on_row_ok_packet_impl(pack);
|
||||
set_state_for_ok(pack);
|
||||
return err;
|
||||
|
@ -201,7 +202,7 @@ private:
|
|||
|
||||
error_code on_meta_helper(metadata&& meta, string_view column_name, diagnostics& diag)
|
||||
{
|
||||
assert(is_reading_meta());
|
||||
BOOST_ASSERT(is_reading_meta());
|
||||
bool is_last = --remaining_meta_ == 0;
|
||||
auto err = on_meta_impl(std::move(meta), column_name, is_last, diag);
|
||||
if (is_last)
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <boost/mysql/detail/protocol/constants.hpp>
|
||||
#include <boost/mysql/detail/protocol/deserialize_row.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace boost {
|
||||
|
@ -112,31 +114,31 @@ public:
|
|||
|
||||
std::uint64_t get_affected_rows() const noexcept
|
||||
{
|
||||
assert(eof_data_.has_value);
|
||||
BOOST_ASSERT(eof_data_.has_value);
|
||||
return eof_data_.affected_rows;
|
||||
}
|
||||
|
||||
std::uint64_t get_last_insert_id() const noexcept
|
||||
{
|
||||
assert(eof_data_.has_value);
|
||||
BOOST_ASSERT(eof_data_.has_value);
|
||||
return eof_data_.last_insert_id;
|
||||
}
|
||||
|
||||
unsigned get_warning_count() const noexcept
|
||||
{
|
||||
assert(eof_data_.has_value);
|
||||
BOOST_ASSERT(eof_data_.has_value);
|
||||
return eof_data_.warnings;
|
||||
}
|
||||
|
||||
string_view get_info() const noexcept
|
||||
{
|
||||
assert(eof_data_.has_value);
|
||||
BOOST_ASSERT(eof_data_.has_value);
|
||||
return string_view(info_.data(), info_.size());
|
||||
}
|
||||
|
||||
bool get_is_out_params() const noexcept
|
||||
{
|
||||
assert(eof_data_.has_value);
|
||||
BOOST_ASSERT(eof_data_.has_value);
|
||||
return eof_data_.is_out_params;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <boost/mysql/detail/protocol/deserialization_context.hpp>
|
||||
#include <boost/mysql/detail/protocol/deserialize_row.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
namespace detail {
|
||||
|
@ -63,7 +65,7 @@ public:
|
|||
}
|
||||
const per_resultset_data& operator[](std::size_t i) const noexcept
|
||||
{
|
||||
assert(i < size());
|
||||
BOOST_ASSERT(i < size());
|
||||
return i == 0 ? first_ : rest_[i - 1];
|
||||
}
|
||||
per_resultset_data& back() noexcept
|
||||
|
@ -72,7 +74,7 @@ public:
|
|||
}
|
||||
const per_resultset_data& back() const noexcept
|
||||
{
|
||||
assert(first_has_data_);
|
||||
BOOST_ASSERT(first_has_data_);
|
||||
return rest_.empty() ? first_ : rest_.back();
|
||||
}
|
||||
per_resultset_data& emplace_back()
|
||||
|
@ -105,7 +107,7 @@ public:
|
|||
|
||||
row_view get_out_params() const noexcept
|
||||
{
|
||||
assert(is_complete());
|
||||
BOOST_ASSERT(is_complete());
|
||||
for (std::size_t i = 0; i < per_result_.size(); ++i)
|
||||
{
|
||||
if (per_result_[i].is_out_params)
|
||||
|
@ -192,7 +194,7 @@ private:
|
|||
|
||||
error_code on_row_impl(deserialization_context ctx, const output_ref&, std::vector<field_view>&) override
|
||||
{
|
||||
assert(has_active_batch());
|
||||
BOOST_ASSERT(has_active_batch());
|
||||
|
||||
// add row storage
|
||||
std::size_t num_fields = current_resultset().num_columns;
|
||||
|
@ -215,7 +217,7 @@ private:
|
|||
|
||||
void on_row_batch_start_impl() override final
|
||||
{
|
||||
assert(!has_active_batch());
|
||||
BOOST_ASSERT(!has_active_batch());
|
||||
num_fields_at_batch_start_ = rows_.fields().size();
|
||||
}
|
||||
|
||||
|
@ -247,13 +249,13 @@ private:
|
|||
|
||||
per_resultset_data& current_resultset() noexcept
|
||||
{
|
||||
assert(!per_result_.empty());
|
||||
BOOST_ASSERT(!per_result_.empty());
|
||||
return per_result_.back();
|
||||
}
|
||||
|
||||
const per_resultset_data& current_resultset() const noexcept
|
||||
{
|
||||
assert(!per_result_.empty());
|
||||
BOOST_ASSERT(!per_result_.empty());
|
||||
return per_result_.back();
|
||||
}
|
||||
|
||||
|
@ -287,7 +289,7 @@ private:
|
|||
|
||||
const per_resultset_data& get_resultset(std::size_t index) const noexcept
|
||||
{
|
||||
assert(index < per_result_.size());
|
||||
BOOST_ASSERT(index < per_result_.size());
|
||||
return per_result_[index];
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <boost/mysql/detail/typing/pos_map.hpp>
|
||||
#include <boost/mysql/detail/typing/row_traits.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
|
@ -65,27 +67,27 @@ public:
|
|||
std::size_t num_resultsets() const noexcept { return desc_.size(); }
|
||||
std::size_t num_columns(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].num_columns;
|
||||
}
|
||||
name_table_t name_table(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].name_table;
|
||||
}
|
||||
meta_check_fn_t meta_check_fn(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].meta_check;
|
||||
}
|
||||
execst_parse_fn_t parse_fn(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].parse_fn;
|
||||
}
|
||||
std::size_t type_index(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].type_index;
|
||||
}
|
||||
span<std::size_t> pos_map(std::size_t idx) const noexcept
|
||||
|
@ -111,31 +113,31 @@ public:
|
|||
|
||||
std::uint64_t get_affected_rows() const noexcept
|
||||
{
|
||||
assert(ok_data_.has_value);
|
||||
BOOST_ASSERT(ok_data_.has_value);
|
||||
return ok_data_.affected_rows;
|
||||
}
|
||||
|
||||
std::uint64_t get_last_insert_id() const noexcept
|
||||
{
|
||||
assert(ok_data_.has_value);
|
||||
BOOST_ASSERT(ok_data_.has_value);
|
||||
return ok_data_.last_insert_id;
|
||||
}
|
||||
|
||||
unsigned get_warning_count() const noexcept
|
||||
{
|
||||
assert(ok_data_.has_value);
|
||||
BOOST_ASSERT(ok_data_.has_value);
|
||||
return ok_data_.warnings;
|
||||
}
|
||||
|
||||
string_view get_info() const noexcept
|
||||
{
|
||||
assert(ok_data_.has_value);
|
||||
BOOST_ASSERT(ok_data_.has_value);
|
||||
return string_view(info_.data(), info_.size());
|
||||
}
|
||||
|
||||
bool get_is_out_params() const noexcept
|
||||
{
|
||||
assert(ok_data_.has_value);
|
||||
BOOST_ASSERT(ok_data_.has_value);
|
||||
return ok_data_.is_out_params;
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <boost/mysql/detail/typing/readable_field_traits.hpp>
|
||||
#include <boost/mysql/detail/typing/row_traits.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/mp11/integer_sequence.hpp>
|
||||
|
||||
|
@ -87,22 +88,22 @@ public:
|
|||
std::size_t num_resultsets() const noexcept { return desc_.size(); }
|
||||
std::size_t num_columns(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].num_columns;
|
||||
}
|
||||
name_table_t name_table(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].name_table;
|
||||
}
|
||||
meta_check_fn_t meta_check_fn(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].meta_check;
|
||||
}
|
||||
results_parse_fn_t parse_fn(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return desc_[idx].parse_fn;
|
||||
}
|
||||
results_reset_fn_t reset_fn() const noexcept { return reset_; }
|
||||
|
@ -113,7 +114,7 @@ public:
|
|||
}
|
||||
static_per_resultset_data& per_result(std::size_t idx) const noexcept
|
||||
{
|
||||
assert(idx < num_resultsets());
|
||||
BOOST_ASSERT(idx < num_resultsets());
|
||||
return ptr_.per_resultset[idx];
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include <boost/mysql/detail/protocol/process_error_packet.hpp>
|
||||
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
@ -48,7 +49,7 @@ inline error_code process_execution_response(
|
|||
inline error_code process_field_definition(channel_base& chan, execution_processor& proc, diagnostics& diag)
|
||||
{
|
||||
// Read the field definition packet (it's cached at this point)
|
||||
assert(chan.has_read_messages());
|
||||
BOOST_ASSERT(chan.has_read_messages());
|
||||
error_code err;
|
||||
auto msg = chan.next_read_message(proc.sequence_number(), err);
|
||||
if (err)
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
#include <boost/mysql/detail/protocol/deserialize_errc.hpp>
|
||||
|
||||
#include <boost/asio/buffer.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
||||
|
@ -28,14 +28,10 @@ class deserialization_context
|
|||
capabilities capabilities_;
|
||||
|
||||
public:
|
||||
deserialization_context(
|
||||
const std::uint8_t* first,
|
||||
const std::uint8_t* last,
|
||||
capabilities caps
|
||||
) noexcept
|
||||
deserialization_context(const std::uint8_t* first, const std::uint8_t* last, capabilities caps) noexcept
|
||||
: first_(first), last_(last), capabilities_(caps)
|
||||
{
|
||||
assert(last_ >= first_);
|
||||
BOOST_ASSERT(last_ >= first_);
|
||||
};
|
||||
deserialization_context(boost::asio::const_buffer buff, capabilities caps) noexcept
|
||||
: deserialization_context(
|
||||
|
@ -48,12 +44,12 @@ public:
|
|||
void set_first(const std::uint8_t* new_first) noexcept
|
||||
{
|
||||
first_ = new_first;
|
||||
assert(last_ >= first_);
|
||||
BOOST_ASSERT(last_ >= first_);
|
||||
}
|
||||
void advance(std::size_t sz) noexcept
|
||||
{
|
||||
first_ += sz;
|
||||
assert(last_ >= first_);
|
||||
BOOST_ASSERT(last_ >= first_);
|
||||
}
|
||||
void rewind(std::size_t sz) noexcept { first_ -= sz; }
|
||||
std::size_t size() const noexcept { return last_ - first_; }
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <boost/mysql/client_errc.hpp>
|
||||
#include <boost/mysql/error_code.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
@ -31,10 +31,9 @@ inline error_code to_error_code(deserialize_errc v) noexcept
|
|||
{
|
||||
case deserialize_errc::ok: return error_code();
|
||||
case deserialize_errc::incomplete_message: return error_code(client_errc::incomplete_message);
|
||||
case deserialize_errc::protocol_value_error:
|
||||
return error_code(client_errc::protocol_value_error);
|
||||
case deserialize_errc::protocol_value_error: return error_code(client_errc::protocol_value_error);
|
||||
case deserialize_errc::server_unsupported: return error_code(client_errc::server_unsupported);
|
||||
default: assert(false); return error_code(); // avoid warnings
|
||||
default: BOOST_ASSERT(false); return error_code(); // avoid warnings
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <boost/mysql/detail/protocol/binary_serialization.hpp>
|
||||
#include <boost/mysql/detail/protocol/constants.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
namespace detail {
|
||||
|
@ -28,13 +30,7 @@ void serialize_binary_float(serialization_context& ctx, T input)
|
|||
// Time types
|
||||
inline void serialize_binary_date(serialization_context& ctx, const date& input)
|
||||
{
|
||||
serialize(
|
||||
ctx,
|
||||
static_cast<std::uint8_t>(binc::date_sz),
|
||||
input.year(),
|
||||
input.month(),
|
||||
input.day()
|
||||
);
|
||||
serialize(ctx, static_cast<std::uint8_t>(binc::date_sz), input.year(), input.month(), input.day());
|
||||
}
|
||||
|
||||
inline void serialize_binary_datetime(serialization_context& ctx, const datetime& input)
|
||||
|
@ -88,8 +84,10 @@ inline string_lenenc to_string_lenenc(blob_view v)
|
|||
} // namespace boost
|
||||
|
||||
inline std::size_t boost::mysql::detail::
|
||||
serialization_traits<boost::mysql::field_view, boost::mysql::detail::serialization_tag::none>::
|
||||
get_size_(const serialization_context& ctx, const field_view& input) noexcept
|
||||
serialization_traits<boost::mysql::field_view, boost::mysql::detail::serialization_tag::none>::get_size_(
|
||||
const serialization_context& ctx,
|
||||
const field_view& input
|
||||
) noexcept
|
||||
{
|
||||
switch (input.kind())
|
||||
{
|
||||
|
@ -103,13 +101,15 @@ inline std::size_t boost::mysql::detail::
|
|||
case field_kind::date: return binc::date_sz + binc::length_sz;
|
||||
case field_kind::datetime: return binc::datetime_dhmsu_sz + binc::length_sz;
|
||||
case field_kind::time: return binc::time_dhmsu_sz + binc::length_sz;
|
||||
default: assert(false); return 0;
|
||||
default: BOOST_ASSERT(false); return 0;
|
||||
}
|
||||
}
|
||||
|
||||
inline void boost::mysql::detail::
|
||||
serialization_traits<boost::mysql::field_view, boost::mysql::detail::serialization_tag::none>::
|
||||
serialize_(serialization_context& ctx, const field_view& input) noexcept
|
||||
serialization_traits<boost::mysql::field_view, boost::mysql::detail::serialization_tag::none>::serialize_(
|
||||
serialization_context& ctx,
|
||||
const field_view& input
|
||||
) noexcept
|
||||
{
|
||||
switch (input.kind())
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ inline void boost::mysql::detail::
|
|||
case field_kind::date: serialize_binary_date(ctx, input.get_date()); break;
|
||||
case field_kind::datetime: serialize_binary_datetime(ctx, input.get_datetime()); break;
|
||||
case field_kind::time: serialize_binary_time(ctx, input.get_time()); break;
|
||||
default: assert(false); break;
|
||||
default: BOOST_ASSERT(false); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include <boost/mysql/detail/protocol/process_error_packet.hpp>
|
||||
#include <boost/mysql/detail/protocol/serialization.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
namespace detail {
|
||||
|
@ -68,7 +70,7 @@ inline error_code deserialize_binary_row(
|
|||
// Skip packet header (it is not part of the message in the binary
|
||||
// protocol but it is in the text protocol, so we include it for homogeneity)
|
||||
// The caller will have checked we have this byte already for us
|
||||
assert(ctx.enough_size(1));
|
||||
BOOST_ASSERT(ctx.enough_size(1));
|
||||
ctx.advance(1);
|
||||
|
||||
// Number of fields
|
||||
|
@ -114,7 +116,7 @@ boost::mysql::error_code boost::mysql::detail::deserialize_row(
|
|||
boost::span<field_view> output
|
||||
)
|
||||
{
|
||||
assert(meta.size() == output.size());
|
||||
BOOST_ASSERT(meta.size() == output.size());
|
||||
return encoding == detail::resultset_encoding::text ? deserialize_text_row(ctx, meta, output.data())
|
||||
: deserialize_binary_row(ctx, meta, output.data());
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <boost/mysql/detail/protocol/constants.hpp>
|
||||
#include <boost/mysql/detail/protocol/deserialize_text_field.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/lexical_cast/try_lexical_convert.hpp>
|
||||
|
||||
|
@ -215,7 +216,7 @@ inline deserialize_errc deserialize_text_value_time(
|
|||
// size check
|
||||
std::size_t actual_min_size = time_min_sz + (decimals ? decimals + 1 : 0);
|
||||
std::size_t actual_max_size = actual_min_size + 1 + 1; // hour extra character and sign
|
||||
assert(actual_max_size <= time_max_sz);
|
||||
BOOST_ASSERT(actual_max_size <= time_max_sz);
|
||||
if (from.size() < actual_min_size || from.size() > actual_max_size)
|
||||
return deserialize_errc::protocol_value_error;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
|
||||
#include <boost/mysql/detail/protocol/handshake_messages.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
inline boost::mysql::detail::deserialize_errc boost::mysql::detail::serialization_traits<
|
||||
boost::mysql::detail::handshake_packet,
|
||||
boost::mysql::detail::serialization_tag::struct_with_fields>::
|
||||
|
@ -56,8 +58,7 @@ inline boost::mysql::detail::deserialize_errc boost::mysql::detail::serializatio
|
|||
return err;
|
||||
|
||||
// Auth plugin data, second part
|
||||
auto auth2_length = static_cast<std::uint8_t>((std::max
|
||||
)(13, auth_plugin_data_len - auth1_length));
|
||||
auto auth2_length = static_cast<std::uint8_t>((std::max)(13, auth_plugin_data_len - auth1_length));
|
||||
const void* auth2_data = ctx.first();
|
||||
if (!ctx.enough_size(auth2_length))
|
||||
return deserialize_errc::incomplete_message;
|
||||
|
@ -71,10 +72,8 @@ inline boost::mysql::detail::deserialize_errc boost::mysql::detail::serializatio
|
|||
// Compose auth_plugin_data
|
||||
output.auth_plugin_data.clear();
|
||||
output.auth_plugin_data.append(auth_plugin_data_part_1.data(), auth1_length);
|
||||
output.auth_plugin_data.append(
|
||||
auth2_data,
|
||||
auth2_length - 1
|
||||
); // discard an extra trailing NULL byte
|
||||
output.auth_plugin_data.append(auth2_data,
|
||||
auth2_length - 1); // discard an extra trailing NULL byte
|
||||
|
||||
return deserialize_errc::ok;
|
||||
}
|
||||
|
@ -133,7 +132,7 @@ inline boost::mysql::detail::deserialize_errc boost::mysql::detail::serializatio
|
|||
// Discard an additional NULL at the end of auth data
|
||||
if (!auth_data.empty())
|
||||
{
|
||||
assert(auth_data.back() == 0);
|
||||
BOOST_ASSERT(auth_data.back() == 0);
|
||||
auth_data = auth_data.substr(0, auth_data.size() - 1);
|
||||
}
|
||||
return err;
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <boost/mysql/detail/protocol/null_bitmap_traits.hpp>
|
||||
#include <boost/mysql/detail/protocol/prepared_statement_messages.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
namespace detail {
|
||||
|
@ -33,7 +35,7 @@ inline protocol_field_type get_protocol_field_type(const field_view& input) noex
|
|||
case field_kind::date: return protocol_field_type::date;
|
||||
case field_kind::datetime: return protocol_field_type::datetime;
|
||||
case field_kind::time: return protocol_field_type::time;
|
||||
default: assert(false); return protocol_field_type::null;
|
||||
default: BOOST_ASSERT(false); return protocol_field_type::null;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,7 +75,7 @@ inline std::size_t boost::mysql::detail::serialization_traits<
|
|||
std::size_t res = 1 + // command ID
|
||||
get_size(ctx, value.statement_id, value.flags, value.iteration_count);
|
||||
auto num_params = std::distance(value.params_begin, value.params_end);
|
||||
assert(num_params >= 0 && num_params <= 255);
|
||||
BOOST_ASSERT(num_params >= 0 && num_params <= 255);
|
||||
|
||||
if (num_params > 0u)
|
||||
{
|
||||
|
@ -103,7 +105,7 @@ inline void boost::mysql::detail::serialization_traits<
|
|||
|
||||
// Number of parameters
|
||||
auto num_params = std::distance(input.params_begin, input.params_end);
|
||||
assert(num_params >= 0 && num_params <= 255);
|
||||
BOOST_ASSERT(num_params >= 0 && num_params <= 255);
|
||||
|
||||
if (num_params > 0)
|
||||
{
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/void_t.hpp>
|
||||
#include <boost/mysql/detail/protocol/serialization.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cmath>
|
||||
#include <type_traits>
|
||||
|
||||
|
@ -50,8 +52,7 @@ struct is_struct_with_fields_helper : std::false_type
|
|||
template <typename T>
|
||||
struct is_struct_with_fields_helper<
|
||||
T,
|
||||
void_t<decltype(T::apply(std::declval<T&>(), is_struct_with_fields_test_op()))>>
|
||||
: std::true_type
|
||||
void_t<decltype(T::apply(std::declval<T&>(), is_struct_with_fields_test_op()))>> : std::true_type
|
||||
{
|
||||
};
|
||||
|
||||
|
@ -60,10 +61,7 @@ struct struct_deserialize_op
|
|||
deserialization_context& ctx;
|
||||
deserialize_errc result;
|
||||
|
||||
struct_deserialize_op(deserialization_context& ctx) noexcept
|
||||
: ctx(ctx), result(deserialize_errc::ok)
|
||||
{
|
||||
}
|
||||
struct_deserialize_op(deserialization_context& ctx) noexcept : ctx(ctx), result(deserialize_errc::ok) {}
|
||||
|
||||
template <class... Types>
|
||||
void operator()(Types&... output) noexcept
|
||||
|
@ -115,17 +113,10 @@ void serialize_command_id(serialization_context&, std::false_type) noexcept
|
|||
{
|
||||
}
|
||||
|
||||
inline deserialize_errc deserialize_helper(deserialization_context&) noexcept
|
||||
{
|
||||
return deserialize_errc::ok;
|
||||
}
|
||||
inline deserialize_errc deserialize_helper(deserialization_context&) noexcept { return deserialize_errc::ok; }
|
||||
|
||||
template <class FirstType, class... Types>
|
||||
deserialize_errc deserialize_helper(
|
||||
deserialization_context& ctx,
|
||||
FirstType& first,
|
||||
Types&... tail
|
||||
) noexcept
|
||||
deserialize_errc deserialize_helper(deserialization_context& ctx, FirstType& first, Types&... tail) noexcept
|
||||
{
|
||||
deserialize_errc err = serialization_traits<FirstType>::deserialize_(ctx, first);
|
||||
if (err == deserialize_errc::ok)
|
||||
|
@ -177,10 +168,7 @@ void boost::mysql::detail::serialize(serialization_context& ctx, const Types&...
|
|||
}
|
||||
|
||||
template <class... Types>
|
||||
std::size_t boost::mysql::detail::get_size(
|
||||
const serialization_context& ctx,
|
||||
const Types&... input
|
||||
) noexcept
|
||||
std::size_t boost::mysql::detail::get_size(const serialization_context& ctx, const Types&... input) noexcept
|
||||
{
|
||||
return get_size_helper(ctx, input...);
|
||||
}
|
||||
|
@ -204,11 +192,8 @@ boost::mysql::detail::deserialize_errc boost::mysql::detail::
|
|||
}
|
||||
|
||||
template <class T>
|
||||
void boost::mysql::detail::
|
||||
serialization_traits<T, boost::mysql::detail::serialization_tag::plain_int>::serialize_(
|
||||
serialization_context& ctx,
|
||||
T input
|
||||
) noexcept
|
||||
void boost::mysql::detail::serialization_traits<T, boost::mysql::detail::serialization_tag::plain_int>::
|
||||
serialize_(serialization_context& ctx, T input) noexcept
|
||||
{
|
||||
boost::endian::endian_store<T, sizeof(T), boost::endian::order::little>(ctx.first(), input);
|
||||
ctx.advance(sizeof(T));
|
||||
|
@ -223,8 +208,10 @@ constexpr bool boost::mysql::detail::is_struct_with_fields()
|
|||
|
||||
template <class T>
|
||||
boost::mysql::detail::deserialize_errc boost::mysql::detail::
|
||||
serialization_traits<T, boost::mysql::detail::serialization_tag::struct_with_fields>::
|
||||
deserialize_(deserialization_context& ctx, T& output) noexcept
|
||||
serialization_traits<T, boost::mysql::detail::serialization_tag::struct_with_fields>::deserialize_(
|
||||
deserialization_context& ctx,
|
||||
T& output
|
||||
) noexcept
|
||||
{
|
||||
struct_deserialize_op op(ctx);
|
||||
T::apply(output, op);
|
||||
|
@ -233,8 +220,10 @@ boost::mysql::detail::deserialize_errc boost::mysql::detail::
|
|||
|
||||
template <class T>
|
||||
void boost::mysql::detail::
|
||||
serialization_traits<T, boost::mysql::detail::serialization_tag::struct_with_fields>::
|
||||
serialize_(serialization_context& ctx, const T& input) noexcept
|
||||
serialization_traits<T, boost::mysql::detail::serialization_tag::struct_with_fields>::serialize_(
|
||||
serialization_context& ctx,
|
||||
const T& input
|
||||
) noexcept
|
||||
{
|
||||
// For commands, add the command ID. Commands are only sent by the client,
|
||||
// so this is not considered in the deserialization functions.
|
||||
|
@ -267,7 +256,7 @@ void boost::mysql::detail::serialize_message(
|
|||
buffer.resize(size);
|
||||
ctx.set_first(buffer.data());
|
||||
serialize(ctx, input);
|
||||
assert(ctx.first() == buffer.data() + buffer.size());
|
||||
BOOST_ASSERT(ctx.first() == buffer.data() + buffer.size());
|
||||
}
|
||||
|
||||
template <class Deserializable>
|
||||
|
@ -295,10 +284,7 @@ boost::mysql::error_code boost::mysql::detail::deserialize_message_part(
|
|||
}
|
||||
|
||||
template <class... Types>
|
||||
void boost::mysql::detail::serialize_fields(
|
||||
serialization_context& ctx,
|
||||
const Types&... fields
|
||||
) noexcept
|
||||
void boost::mysql::detail::serialize_fields(serialization_context& ctx, const Types&... fields) noexcept
|
||||
{
|
||||
serialize_fields_helper(ctx, fields...);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
#ifndef BOOST_MYSQL_DETAIL_PROTOCOL_NULL_BITMAP_TRAITS_HPP
|
||||
#define BOOST_MYSQL_DETAIL_PROTOCOL_NULL_BITMAP_TRAITS_HPP
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
|
||||
|
@ -21,14 +22,8 @@ class null_bitmap_traits
|
|||
std::size_t offset_;
|
||||
std::size_t num_fields_;
|
||||
|
||||
constexpr std::size_t byte_pos(std::size_t field_pos) const noexcept
|
||||
{
|
||||
return (field_pos + offset_) / 8;
|
||||
}
|
||||
constexpr std::size_t bit_pos(std::size_t field_pos) const noexcept
|
||||
{
|
||||
return (field_pos + offset_) % 8;
|
||||
}
|
||||
constexpr std::size_t byte_pos(std::size_t field_pos) const noexcept { return (field_pos + offset_) / 8; }
|
||||
constexpr std::size_t bit_pos(std::size_t field_pos) const noexcept { return (field_pos + offset_) % 8; }
|
||||
|
||||
public:
|
||||
constexpr null_bitmap_traits(std::size_t offset, std::size_t num_fields) noexcept
|
||||
|
@ -39,12 +34,12 @@ public:
|
|||
constexpr std::size_t byte_count() const noexcept { return (num_fields_ + 7 + offset_) / 8; }
|
||||
bool is_null(const std::uint8_t* null_bitmap_begin, std::size_t field_pos) const noexcept
|
||||
{
|
||||
assert(field_pos < num_fields_);
|
||||
BOOST_ASSERT(field_pos < num_fields_);
|
||||
return null_bitmap_begin[byte_pos(field_pos)] & (1 << bit_pos(field_pos));
|
||||
}
|
||||
void set_null(std::uint8_t* null_bitmap_begin, std::size_t field_pos) const noexcept
|
||||
{
|
||||
assert(field_pos < num_fields_);
|
||||
BOOST_ASSERT(field_pos < num_fields_);
|
||||
null_bitmap_begin[byte_pos(field_pos)] |= (1 << bit_pos(field_pos));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <boost/mysql/metadata_collection_view.hpp>
|
||||
#include <boost/mysql/string_view.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/core/span.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
@ -43,7 +44,7 @@ inline void pos_map_add_field(
|
|||
{
|
||||
if (has_field_names(name_table))
|
||||
{
|
||||
assert(self.size() == name_table.size());
|
||||
BOOST_ASSERT(self.size() == name_table.size());
|
||||
|
||||
// We're mapping fields by name. Try to find where in our target struct
|
||||
// is the current field located
|
||||
|
@ -70,7 +71,7 @@ inline field_view map_field_view(
|
|||
span<const field_view> array
|
||||
) noexcept
|
||||
{
|
||||
assert(cpp_index < self.size());
|
||||
BOOST_ASSERT(cpp_index < self.size());
|
||||
return array[self[cpp_index]];
|
||||
}
|
||||
|
||||
|
@ -80,7 +81,7 @@ inline const metadata& map_metadata(
|
|||
metadata_collection_view meta
|
||||
) noexcept
|
||||
{
|
||||
assert(cpp_index < self.size());
|
||||
BOOST_ASSERT(cpp_index < self.size());
|
||||
return meta[self[cpp_index]];
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include <boost/mysql/detail/typing/pos_map.hpp>
|
||||
#include <boost/mysql/detail/typing/readable_field_traits.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/describe/members.hpp>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <boost/mp11/utility.hpp>
|
||||
|
@ -238,15 +239,15 @@ template <BOOST_MYSQL_STATIC_ROW StaticRow>
|
|||
error_code meta_check(span<const std::size_t> pos_map, metadata_collection_view meta, diagnostics& diag)
|
||||
{
|
||||
using fields = typename row_traits<StaticRow>::types;
|
||||
assert(pos_map.size() == get_row_size<StaticRow>());
|
||||
BOOST_ASSERT(pos_map.size() == get_row_size<StaticRow>());
|
||||
return meta_check_field_type_list<fields>(pos_map, get_row_name_table<StaticRow>(), meta, diag);
|
||||
}
|
||||
|
||||
template <BOOST_MYSQL_STATIC_ROW StaticRow>
|
||||
error_code parse(span<const std::size_t> pos_map, span<const field_view> from, StaticRow& to)
|
||||
{
|
||||
assert(pos_map.size() == get_row_size<StaticRow>());
|
||||
assert(from.size() >= get_row_size<StaticRow>());
|
||||
BOOST_ASSERT(pos_map.size() == get_row_size<StaticRow>());
|
||||
BOOST_ASSERT(from.size() >= get_row_size<StaticRow>());
|
||||
parse_functor ctx(pos_map, from);
|
||||
row_traits<StaticRow>::parse(ctx, to);
|
||||
return ctx.error();
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/execution_processor/execution_state_impl.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
|
|
@ -12,6 +12,9 @@
|
|||
|
||||
#include <boost/mysql/date.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
|
@ -20,19 +23,19 @@ BOOST_CXX14_CONSTEXPR boost::mysql::date::date(time_point tp)
|
|||
{
|
||||
bool ok = detail::days_to_ymd(tp.time_since_epoch().count(), year_, month_, day_);
|
||||
if (!ok)
|
||||
throw std::out_of_range("date::date: time_point was out of range");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("date::date: time_point was out of range"));
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR boost::mysql::date::time_point boost::mysql::date::get_time_point() const noexcept
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return unch_get_time_point();
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR boost::mysql::date::time_point boost::mysql::date::as_time_point() const
|
||||
{
|
||||
if (!valid())
|
||||
throw std::invalid_argument("date::as_time_point: invalid date");
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("date::as_time_point: invalid date"));
|
||||
return unch_get_time_point();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/datetime.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
|
@ -42,14 +44,14 @@ BOOST_CXX14_CONSTEXPR boost::mysql::datetime::datetime(time_point tp)
|
|||
rem = rem - num_seconds;
|
||||
auto num_microseconds = duration_cast<microseconds>(rem);
|
||||
|
||||
assert(num_hours.count() >= 0 && num_hours.count() <= detail::max_hour);
|
||||
assert(num_minutes.count() >= 0 && num_minutes.count() <= detail::max_min);
|
||||
assert(num_seconds.count() >= 0 && num_seconds.count() <= detail::max_sec);
|
||||
assert(num_microseconds.count() >= 0 && num_microseconds.count() <= detail::max_micro);
|
||||
BOOST_ASSERT(num_hours.count() >= 0 && num_hours.count() <= detail::max_hour);
|
||||
BOOST_ASSERT(num_minutes.count() >= 0 && num_minutes.count() <= detail::max_min);
|
||||
BOOST_ASSERT(num_seconds.count() >= 0 && num_seconds.count() <= detail::max_sec);
|
||||
BOOST_ASSERT(num_microseconds.count() >= 0 && num_microseconds.count() <= detail::max_micro);
|
||||
|
||||
bool ok = detail::days_to_ymd(num_days.count(), year_, month_, day_);
|
||||
if (!ok)
|
||||
throw std::out_of_range("datetime::datetime: time_point was out of range");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("datetime::datetime: time_point was out of range"));
|
||||
|
||||
microsecond_ = static_cast<std::uint32_t>(num_microseconds.count());
|
||||
second_ = static_cast<std::uint8_t>(num_seconds.count());
|
||||
|
@ -66,14 +68,14 @@ constexpr bool boost::mysql::datetime::valid() const noexcept
|
|||
BOOST_CXX14_CONSTEXPR boost::mysql::datetime::time_point boost::mysql::datetime::get_time_point(
|
||||
) const noexcept
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return unch_get_time_point();
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR boost::mysql::datetime::time_point boost::mysql::datetime::as_time_point() const
|
||||
{
|
||||
if (!valid())
|
||||
throw std::invalid_argument("datetime::as_time_point: invalid datetime");
|
||||
BOOST_THROW_EXCEPTION(std::invalid_argument("datetime::as_time_point: invalid datetime"));
|
||||
return unch_get_time_point();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
|
@ -310,7 +313,7 @@ BOOST_CXX14_CONSTEXPR boost::mysql::time boost::mysql::field_view::get_time() co
|
|||
BOOST_CXX14_CONSTEXPR void boost::mysql::field_view::check_kind(internal_kind expected) const
|
||||
{
|
||||
if (ikind_ != expected)
|
||||
throw bad_field_access();
|
||||
BOOST_THROW_EXCEPTION(bad_field_access());
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR bool boost::mysql::field_view::operator==(const field_view& rhs) const noexcept
|
||||
|
@ -359,7 +362,7 @@ BOOST_CXX14_CONSTEXPR bool boost::mysql::field_view::operator==(const field_view
|
|||
case field_kind::date: return rhs_k == field_kind::date && get_date() == rhs.get_date();
|
||||
case field_kind::datetime: return rhs_k == field_kind::datetime && get_datetime() == rhs.get_datetime();
|
||||
case field_kind::time: return rhs_k == field_kind::time && get_time() == rhs.get_time();
|
||||
default: assert(false); return false;
|
||||
default: BOOST_ASSERT(false); return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -384,7 +387,7 @@ inline std::ostream& boost::mysql::operator<<(std::ostream& os, const field_view
|
|||
case field_kind::date: return os << value.get_date();
|
||||
case field_kind::datetime: return os << value.get_datetime();
|
||||
case field_kind::time: return detail::print_time(os, value.get_time());
|
||||
default: assert(false); return os;
|
||||
default: BOOST_ASSERT(false); return os;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <ostream>
|
||||
#include <stdexcept>
|
||||
|
@ -21,7 +23,7 @@
|
|||
boost::mysql::field_view boost::mysql::row_view::at(std::size_t i) const
|
||||
{
|
||||
if (i >= size_)
|
||||
throw std::out_of_range("row_view::at");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("row_view::at"));
|
||||
return fields_[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/auxiliar/rows_iterator.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <stdexcept>
|
||||
|
||||
|
@ -31,14 +33,14 @@ boost::mysql::row_view boost::mysql::rows::at(std::size_t i) const
|
|||
{
|
||||
if (i >= size())
|
||||
{
|
||||
throw std::out_of_range("rows::at");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("rows::at"));
|
||||
}
|
||||
return detail::row_slice(impl_.fields().data(), num_columns_, i);
|
||||
}
|
||||
|
||||
boost::mysql::row_view boost::mysql::rows::operator[](std::size_t i) const noexcept
|
||||
{
|
||||
assert(i < size());
|
||||
BOOST_ASSERT(i < size());
|
||||
return detail::row_slice(impl_.fields().data(), num_columns_, i);
|
||||
}
|
||||
|
||||
|
|
|
@ -15,12 +15,14 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/auxiliar/rows_iterator.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
boost::mysql::row_view boost::mysql::rows_view::operator[](std::size_t i) const noexcept
|
||||
{
|
||||
assert(i < size());
|
||||
BOOST_ASSERT(i < size());
|
||||
return detail::row_slice(fields_, num_columns_, i);
|
||||
}
|
||||
|
||||
|
@ -28,7 +30,7 @@ boost::mysql::row_view boost::mysql::rows_view::at(std::size_t i) const
|
|||
{
|
||||
if (i >= size())
|
||||
{
|
||||
throw std::out_of_range("rows_view::at");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("rows_view::at"));
|
||||
}
|
||||
return detail::row_slice(fields_, num_columns_, i);
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/protocol/prepared_statement_messages.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
template <BOOST_MYSQL_WRITABLE_FIELD_TUPLE WritableFieldTuple>
|
||||
class boost::mysql::bound_statement_tuple
|
||||
{
|
||||
|
@ -61,7 +63,7 @@ boost::mysql::bound_statement_tuple<typename std::decay<WritableFieldTuple>::typ
|
|||
bind(WritableFieldTuple&& args) const
|
||||
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return bound_statement_tuple<typename std::decay<WritableFieldTuple>::type>(
|
||||
*this,
|
||||
std::forward<WritableFieldTuple>(args)
|
||||
|
@ -74,7 +76,7 @@ boost::mysql::bound_statement_iterator_range<FieldViewFwdIterator> boost::mysql:
|
|||
FieldViewFwdIterator last
|
||||
) const
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return bound_statement_iterator_range<FieldViewFwdIterator>(*this, first, last);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#include <boost/mysql/detail/auxiliar/results_iterator.hpp>
|
||||
#include <boost/mysql/detail/execution_processor/results_impl.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace boost {
|
||||
|
@ -155,7 +157,7 @@ public:
|
|||
*/
|
||||
rows_view rows() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_rows(0);
|
||||
}
|
||||
|
||||
|
@ -184,7 +186,7 @@ public:
|
|||
*/
|
||||
metadata_collection_view meta() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_meta(0);
|
||||
}
|
||||
|
||||
|
@ -205,7 +207,7 @@ public:
|
|||
*/
|
||||
std::uint64_t affected_rows() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_affected_rows(0);
|
||||
}
|
||||
|
||||
|
@ -226,7 +228,7 @@ public:
|
|||
*/
|
||||
std::uint64_t last_insert_id() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_last_insert_id(0);
|
||||
}
|
||||
|
||||
|
@ -247,7 +249,7 @@ public:
|
|||
*/
|
||||
unsigned warning_count() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_warning_count(0);
|
||||
}
|
||||
|
||||
|
@ -278,7 +280,7 @@ public:
|
|||
*/
|
||||
string_view info() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_info(0);
|
||||
}
|
||||
|
||||
|
@ -299,7 +301,7 @@ public:
|
|||
*/
|
||||
iterator begin() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return iterator(&impl_, 0);
|
||||
}
|
||||
|
||||
|
@ -320,7 +322,7 @@ public:
|
|||
*/
|
||||
iterator end() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return iterator(&impl_, size());
|
||||
}
|
||||
|
||||
|
@ -342,9 +344,9 @@ public:
|
|||
*/
|
||||
inline resultset_view at(std::size_t i) const
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
if (i >= size())
|
||||
throw std::out_of_range("results::at: out of range");
|
||||
BOOST_THROW_EXCEPTION(std::out_of_range("results::at: out of range"));
|
||||
return detail::resultset_view_access::construct(impl_, i);
|
||||
}
|
||||
|
||||
|
@ -365,8 +367,8 @@ public:
|
|||
*/
|
||||
resultset_view operator[](std::size_t i) const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
assert(i < size());
|
||||
BOOST_ASSERT(has_value());
|
||||
BOOST_ASSERT(i < size());
|
||||
return detail::resultset_view_access::construct(impl_, i);
|
||||
}
|
||||
|
||||
|
@ -421,7 +423,7 @@ public:
|
|||
*/
|
||||
bool empty() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -438,7 +440,7 @@ public:
|
|||
*/
|
||||
std::size_t size() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.num_resultsets();
|
||||
}
|
||||
|
||||
|
@ -466,7 +468,7 @@ public:
|
|||
*/
|
||||
row_view out_params() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_out_params();
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <boost/mysql/row_view.hpp>
|
||||
#include <boost/mysql/rows.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
@ -158,7 +158,7 @@ public:
|
|||
*/
|
||||
rows_view rows() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return rws_;
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public:
|
|||
*/
|
||||
metadata_collection_view meta() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return meta_;
|
||||
}
|
||||
|
||||
|
@ -196,7 +196,7 @@ public:
|
|||
*/
|
||||
std::uint64_t affected_rows() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return affected_rows_;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ public:
|
|||
*/
|
||||
std::uint64_t last_insert_id() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return last_insert_id_;
|
||||
}
|
||||
|
||||
|
@ -230,7 +230,7 @@ public:
|
|||
*/
|
||||
unsigned warning_count() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return warnings_;
|
||||
}
|
||||
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
*/
|
||||
string_view info() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return string_view(info_.data(), info_.size());
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ public:
|
|||
*/
|
||||
bool is_out_params() const noexcept
|
||||
{
|
||||
assert(has_value_);
|
||||
BOOST_ASSERT(has_value_);
|
||||
return is_out_params_;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/execution_processor/results_impl.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
||||
|
@ -64,7 +66,7 @@ public:
|
|||
*/
|
||||
rows_view rows() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_rows(index_);
|
||||
}
|
||||
|
||||
|
@ -85,7 +87,7 @@ public:
|
|||
*/
|
||||
metadata_collection_view meta() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_meta(index_);
|
||||
}
|
||||
|
||||
|
@ -102,7 +104,7 @@ public:
|
|||
*/
|
||||
std::uint64_t affected_rows() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_affected_rows(index_);
|
||||
}
|
||||
|
||||
|
@ -119,7 +121,7 @@ public:
|
|||
*/
|
||||
std::uint64_t last_insert_id() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_last_insert_id(index_);
|
||||
}
|
||||
|
||||
|
@ -136,7 +138,7 @@ public:
|
|||
*/
|
||||
unsigned warning_count() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_warning_count(index_);
|
||||
}
|
||||
|
||||
|
@ -163,7 +165,7 @@ public:
|
|||
*/
|
||||
string_view info() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_info(index_);
|
||||
}
|
||||
|
||||
|
@ -180,7 +182,7 @@ public:
|
|||
*/
|
||||
bool is_out_params() const noexcept
|
||||
{
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_->get_is_out_params(index_);
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
#include <boost/mysql/detail/auxiliar/rows_iterator.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost {
|
||||
|
@ -216,9 +218,9 @@ private:
|
|||
rows_view(const field_view* fields, std::size_t num_fields, std::size_t num_columns) noexcept
|
||||
: fields_(fields), num_fields_(num_fields), num_columns_(num_columns)
|
||||
{
|
||||
assert(fields != nullptr || num_fields == 0); // fields null => num_fields 0
|
||||
assert(num_fields == 0 || num_columns != 0); // num_fields != 0 => num_columns != 0
|
||||
assert(num_columns == 0 || (num_fields % num_columns == 0));
|
||||
BOOST_ASSERT(fields != nullptr || num_fields == 0); // fields null => num_fields 0
|
||||
BOOST_ASSERT(num_fields == 0 || num_columns != 0); // num_fields != 0 => num_columns != 0
|
||||
BOOST_ASSERT(num_columns == 0 || (num_fields % num_columns == 0));
|
||||
}
|
||||
|
||||
#ifndef BOOST_MYSQL_DOXYGEN
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/typing/writable_field_traits.hpp>
|
||||
|
||||
#include <cassert>
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <tuple>
|
||||
#include <type_traits>
|
||||
|
@ -85,7 +86,7 @@ public:
|
|||
*/
|
||||
std::uint32_t id() const noexcept
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return id_;
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,7 @@ public:
|
|||
*/
|
||||
unsigned num_params() const noexcept
|
||||
{
|
||||
assert(valid());
|
||||
BOOST_ASSERT(valid());
|
||||
return num_params_;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#include <boost/mysql/detail/auxiliar/access_fwd.hpp>
|
||||
#include <boost/mysql/detail/execution_processor/static_results_impl.hpp>
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost {
|
||||
namespace mysql {
|
||||
|
||||
|
@ -135,7 +137,7 @@ public:
|
|||
#endif
|
||||
rows() const noexcept {
|
||||
static_assert(I < sizeof...(StaticRow), "Index I out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.template get_rows<I>();
|
||||
}
|
||||
|
||||
|
@ -169,7 +171,7 @@ public:
|
|||
metadata_collection_view meta() const noexcept
|
||||
{
|
||||
static_assert(I < sizeof...(StaticRow), "Index I out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_interface().get_meta(I);
|
||||
}
|
||||
|
||||
|
@ -193,7 +195,7 @@ public:
|
|||
std::uint64_t affected_rows() const noexcept
|
||||
{
|
||||
static_assert(I < sizeof...(StaticRow), "Index I out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_interface().get_affected_rows(I);
|
||||
}
|
||||
|
||||
|
@ -217,7 +219,7 @@ public:
|
|||
std::uint64_t last_insert_id() const noexcept
|
||||
{
|
||||
static_assert(I < sizeof...(StaticRow), "I index out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_interface().get_last_insert_id(I);
|
||||
}
|
||||
|
||||
|
@ -241,7 +243,7 @@ public:
|
|||
unsigned warning_count() const noexcept
|
||||
{
|
||||
static_assert(I < sizeof...(StaticRow), "I index out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_interface().get_warning_count(I);
|
||||
}
|
||||
|
||||
|
@ -275,7 +277,7 @@ public:
|
|||
string_view info() const noexcept
|
||||
{
|
||||
static_assert(I < sizeof...(StaticRow), "I index out of range");
|
||||
assert(has_value());
|
||||
BOOST_ASSERT(has_value());
|
||||
return impl_.get_interface().get_info(I);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue