renamed blob to blob_type_t
This commit is contained in:
@@ -65,7 +65,7 @@ utils::result<bool, utils::error> test_connection::exists(const std::string &/*s
|
||||
return utils::ok(false);
|
||||
}
|
||||
|
||||
std::string test_connection::to_escaped_string(const utils::blob& value) const {
|
||||
std::string test_connection::to_escaped_string(const utils::blob_type_t& value) const {
|
||||
return utils::to_string(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,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:
|
||||
bool is_open_{false};
|
||||
|
||||
@@ -19,6 +19,6 @@ void test_parameter_binder::write_value(size_t /*pos*/, const char * /*x*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const char * /*x*/, size_t /*size*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const std::string &/*x*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const std::string &/*x*/, size_t /*size*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const utils::blob &/*x*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const utils::blob_type_t &/*x*/) {}
|
||||
void test_parameter_binder::write_value(size_t /*pos*/, const utils::value &/*x*/, size_t /*size*/) {}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,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;
|
||||
};
|
||||
|
||||
|
||||
@@ -64,10 +64,16 @@ void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/,
|
||||
value = 2.14159265358979323846;
|
||||
}
|
||||
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, matador::time &/*value*/) {
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::date_type_t &value) {
|
||||
value = {2021, 10, 27};
|
||||
}
|
||||
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, matador::date &/*value*/) {
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::time_type_t &value) {
|
||||
value = {12, 34, 56, 123456};
|
||||
}
|
||||
|
||||
void test_result_reader::read_value(const char *id, size_t index, utils::timestamp &value) {
|
||||
value = utils::timestamp();
|
||||
}
|
||||
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, char * /*value*/, const size_t /*size*/) {
|
||||
@@ -81,7 +87,7 @@ void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/,
|
||||
value = "Hello world";
|
||||
}
|
||||
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::blob &value) {
|
||||
void test_result_reader::read_value(const char * /*id*/, const size_t /*index*/, utils::blob_type_t &value) {
|
||||
value = {'b', 'l', 'o', 'b'};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,12 +21,13 @@ public:
|
||||
void read_value(const char *, size_t, bool &) override {}
|
||||
void read_value(const char *, size_t, float &) override {}
|
||||
void read_value(const char *, size_t, double &) override {}
|
||||
void read_value(const char *, size_t, time &) override {}
|
||||
void read_value(const char *, size_t, date &) override {}
|
||||
void read_value(const char *, size_t, utils::date_type_t &) override {}
|
||||
void read_value(const char *, size_t, utils::time_type_t &) override {}
|
||||
void read_value(const char *, size_t, utils::timestamp &) override {}
|
||||
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 {}
|
||||
};
|
||||
|
||||
@@ -51,12 +52,13 @@ public:
|
||||
void read_value(const char *id, size_t index, bool &value) override;
|
||||
void read_value(const char *id, size_t index, float &value) override;
|
||||
void read_value(const char *id, size_t index, double &value) override;
|
||||
void read_value(const char *id, size_t index, matador::time &value) override;
|
||||
void read_value(const char *id, size_t index, matador::date &value) override;
|
||||
void read_value(const char *id, size_t index, utils::date_type_t &value) override;
|
||||
void read_value(const char *id, size_t index, utils::time_type_t &value) override;
|
||||
void read_value(const char *id, size_t index, utils::timestamp &value) override;
|
||||
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:
|
||||
|
||||
@@ -234,7 +234,7 @@ TEST_CASE_METHOD(QueryFixture, "Test create, insert and select a blob column", "
|
||||
|
||||
result = query::insert()
|
||||
.into("person", {"id", "name", "data"})
|
||||
.values({7U, "george", blob{1, 'A', 3, 4}})
|
||||
.values({7U, "george", blob_type_t{1, 'A', 3, 4}})
|
||||
.str(*db);
|
||||
|
||||
REQUIRE(result == R"(INSERT INTO "person" ("id", "name", "data") VALUES (7, 'george', X'01410304'))");
|
||||
|
||||
@@ -37,7 +37,7 @@ TEST_CASE("Test field", "[field]") {
|
||||
REQUIRE(bool_val.has_value());
|
||||
REQUIRE(bool_val.value());
|
||||
|
||||
f = sql::field("name", utils::blob{ 7,8,6,5,4,3 }, utils::constraints::None, 0, 1);
|
||||
f = sql::field("name", utils::blob_type_t{ 7,8,6,5,4,3 }, utils::constraints::None, 0, 1);
|
||||
REQUIRE(f.index() == 1);
|
||||
REQUIRE(!f.is_null());
|
||||
REQUIRE(!f.is_integer());
|
||||
@@ -46,9 +46,9 @@ TEST_CASE("Test field", "[field]") {
|
||||
REQUIRE(!f.is_bool());
|
||||
REQUIRE(!f.is_string());
|
||||
|
||||
auto blob_val = f.as<utils::blob>();
|
||||
auto blob_val = f.as<utils::blob_type_t>();
|
||||
REQUIRE(blob_val.has_value());
|
||||
REQUIRE(blob_val.value() == utils::blob{ 7,8,6,5,4,3 });
|
||||
REQUIRE(blob_val.value() == utils::blob_type_t{ 7,8,6,5,4,3 });
|
||||
|
||||
REQUIRE(!f.as<std::string>().has_value());
|
||||
}
|
||||
Reference in New Issue
Block a user