diff --git a/include/fbsqlxx.hpp b/include/fbsqlxx.hpp index b5c946e..f557861 100644 --- a/include/fbsqlxx.hpp +++ b/include/fbsqlxx.hpp @@ -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 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& 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(unsigned i) const /// /// template <> -inline std::vector result_set::as>(unsigned i) const +inline octets result_set::as(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(start, start + f.length); + return octets(start, start + f.length); } @@ -1177,7 +1178,7 @@ public: return *this; } - statement& set(unsigned i, const std::vector& value) + statement& set(unsigned i, const octets& value) { debug("statement: ", this, ", set #", i, " -> octets"); get_input_parameters()->set(i - 1, value);