Replace vector<uchar> with octets type alias

This commit is contained in:
gzip4 2025-02-22 12:59:51 +05:00
parent b6284cdb15
commit fb61dfbd7f

View File

@ -86,6 +86,7 @@ inline int64_t portable_integer(const uint8_t* p, short length)
inline std::string type_name(unsigned int type)
{
// 0-bit means nullability, clear before switch
switch (type & ~1u)
{
case SQL_ARRAY:
@ -363,7 +364,7 @@ struct parameter
int subtype;
int scale;
std::string str_value;
std::vector<uint8_t> octets_value;
octets octets_value;
union
{
@ -582,7 +583,7 @@ public:
m_parameters.at(i) = std::move(p);
}
void set(unsigned int i, const std::vector<uint8_t>& value)
void set(unsigned int i, const octets& value)
{
parameter p{};
p.type = MY_SQL_OCTETS;
@ -980,13 +981,13 @@ inline std::string result_set::as<std::string>(unsigned i) const
/// <param name="i"></param>
/// <returns></returns>
template <>
inline std::vector<uint8_t> result_set::as<std::vector<uint8_t>>(unsigned i) const
inline octets result_set::as<octets>(unsigned i) const
{
assert(i >= 1);
auto const& f = m_fields.at(i - 1);
check_field_null(f.name, f.null_offset);
auto start = m_buffer.data() + f.offset;
return std::vector<uint8_t>(start, start + f.length);
return octets(start, start + f.length);
}
@ -1177,7 +1178,7 @@ public:
return *this;
}
statement& set(unsigned i, const std::vector<uint8_t>& value)
statement& set(unsigned i, const octets& value)
{
debug("statement: ", this, ", set #", i, " -> octets");
get_input_parameters()->set(i - 1, value);