renamed blob to blob_type_t

This commit is contained in:
2026-01-07 09:21:10 +01:00
parent 41f6c9f516
commit f30c250a20
44 changed files with 88 additions and 80 deletions
@@ -38,7 +38,7 @@ public:
utils::result<std::vector<object::attribute>, utils::error> describe(const std::string& table) override;
utils::result<bool, utils::error> exists(const std::string &schema_name, const std::string &table_name) override;
[[nodiscard]] std::string to_escaped_string( const utils::blob& value ) const override;
[[nodiscard]] std::string to_escaped_string( const utils::blob_type_t& value ) const override;
private:
[[nodiscard]] static std::string generate_statement_name(const sql::query_context &query) ;
@@ -38,7 +38,7 @@ public:
void write_value(size_t pos, const char *x, size_t size) override;
void write_value(size_t pos, const std::string &x) override;
void write_value(size_t pos, const std::string &x, size_t size) override;
void write_value(size_t pos, const utils::blob &x) override;
void write_value(size_t pos, const utils::blob_type_t &x) override;
void write_value(size_t pos, const utils::value &x, size_t size) override;
[[nodiscard]] const bind_data& params() const;
@@ -28,7 +28,7 @@ public:
void read_value(const char *, size_t, char *, size_t) override {}
void read_value(const char *, size_t, std::string &) override {}
void read_value(const char *, size_t, std::string &, size_t) override {}
void read_value(const char *, size_t, utils::blob &) override {}
void read_value(const char *, size_t, utils::blob_type_t &) override {}
void read_value(const char *, size_t, utils::value &, size_t) override {}
};
@@ -62,7 +62,7 @@ public:
void read_value(const char *id, size_t index, char *value, size_t size) override;
void read_value(const char *id, size_t index, std::string &value) override;
void read_value(const char *id, size_t index, std::string &value, size_t size) override;
void read_value(const char *id, size_t index, utils::blob &value) override;
void read_value(const char *id, size_t index, utils::blob_type_t &value) override;
void read_value(const char *id, size_t index, utils::value &val, size_t size) override;
protected:
@@ -293,7 +293,7 @@ utils::result<bool, utils::error> postgres_connection::exists(const std::string
return utils::ok(*result == 1);
}
std::string postgres_connection::to_escaped_string(const utils::blob &value) const {
std::string postgres_connection::to_escaped_string(const utils::blob_type_t &value) const {
size_t escapedDataLength;
unsigned char *escapedData = PQescapeByteaConn(conn_, value.data(), value.size(), &escapedDataLength);
@@ -148,7 +148,7 @@ void postgres_parameter_binder::write_value(const size_t pos, const utils::time_
void postgres_parameter_binder::write_value(size_t pos, const utils::timestamp &x) {
}
void postgres_parameter_binder::write_value(const size_t pos, const utils::blob &x) {
void postgres_parameter_binder::write_value(const size_t pos, const utils::blob_type_t &x) {
bind_data_.bytes[pos] = x;
bind_data_.values[pos] = reinterpret_cast<char *>(bind_data_.bytes[pos].data());
bind_data_.lengths[pos] = static_cast<int>(bind_data_.bytes[pos].size());
@@ -145,7 +145,7 @@ void postgres_result_reader::read_value(const char * /*id*/, const size_t index,
value.assign(column(index));
}
void postgres_result_reader::read_value(const char * /*id*/, const size_t index, utils::blob &value) {
void postgres_result_reader::read_value(const char * /*id*/, const size_t index, utils::blob_type_t &value) {
const auto *data = reinterpret_cast<const unsigned char *>(column(index));
size_t length;
@@ -164,11 +164,11 @@ void set_value(const char *str, utils::value &value) {
}
template<>
void set_value<utils::blob>(const char *str, utils::value &value) {
void set_value<utils::blob_type_t>(const char *str, utils::value &value) {
size_t length;
unsigned char *unescaped = PQunescapeBytea(reinterpret_cast<const unsigned char *>(str), &length);
value = utils::blob(unescaped, unescaped + length);
value = utils::blob_type_t(unescaped, unescaped + length);
PQfreemem(unescaped);
}
@@ -232,7 +232,7 @@ void postgres_result_reader::read_value(const char * /*id*/, const size_t index,
break;
}
case utils::basic_type::Blob: {
set_value<utils::blob>(column(index), val);
set_value<utils::blob_type_t>(column(index), val);
break;
}
case utils::basic_type::Unknown: