diff --git a/tests/common-tests.h b/tests/common-tests.h index 39f0e851..2d5f7e65 100644 --- a/tests/common-tests.h +++ b/tests/common-tests.h @@ -363,6 +363,17 @@ private: SOCI_NOT_COPYABLE(function_creator_base) }; +enum class Backend { + Empty, + SQLite, + MySQL, + PostgreSQL, + ODBC, + Oracle, + Firebird, + DB2, +}; + // This is a singleton class, at any given time there is at most one test // context alive and common_tests fixture class uses it. class test_context_base @@ -404,6 +415,8 @@ public: return connectString_; } + virtual Backend get_backend() const = 0; + virtual std::string to_date_time(std::string const &dateTime) const = 0; virtual table_creator_base* table_creator_1(session&) const = 0; @@ -6620,7 +6633,11 @@ TEST_CASE_METHOD(common_tests, "BLOB", "[core][blob]") for (auto it = rowSet.begin(); it != rowSet.end(); ++it) { containedData = true; const soci::row ¤tRow = *it; - CHECK(currentRow.get_properties(0).get_data_type() == soci::dt_integer); + + soci::data_type type = currentRow.get_properties(0).get_data_type(); + soci::data_type expectedType = tc_.get_backend() != Backend::Oracle ? soci::dt_integer : soci::dt_long_long; + CHECK(type == expectedType); + CHECK(currentRow.get_properties(1).get_data_type() == soci::dt_blob); //soci::blob retrieved = currentRow.get(1); //CHECK(retrieved.get_len() == 10); diff --git a/tests/db2/test-db2.cpp b/tests/db2/test-db2.cpp index 5501f1da..4feefd3a 100644 --- a/tests/db2/test-db2.cpp +++ b/tests/db2/test-db2.cpp @@ -68,6 +68,8 @@ public: test_context(backend_factory const & pi_back_end, std::string const & pi_connect_string) : test_context_base(pi_back_end, pi_connect_string) {} + Backend get_backend() const override { return Backend::DB2; } + table_creator_base* table_creator_1(soci::session & pr_s) const override { pr_s << "SET CURRENT SCHEMA = 'DB2INST1'"; diff --git a/tests/firebird/test-firebird.cpp b/tests/firebird/test-firebird.cpp index cfe68895..4a8ac855 100644 --- a/tests/firebird/test-firebird.cpp +++ b/tests/firebird/test-firebird.cpp @@ -1191,6 +1191,8 @@ class test_context : public tests::test_context_base : test_context_base(backEnd, connectString) {} + tests::Backend get_backend() const override { return tests::Backend::Firebird; } + tests::table_creator_base* table_creator_1(soci::session& s) const override { return new TableCreator1(s); diff --git a/tests/mysql/test-mysql.h b/tests/mysql/test-mysql.h index 40e17298..b47d488f 100644 --- a/tests/mysql/test-mysql.h +++ b/tests/mysql/test-mysql.h @@ -70,6 +70,8 @@ public: std::string const &connectString) : test_context_base(backEnd, connectString) {} + Backend get_backend() const override { return Backend::MySQL; } + table_creator_base* table_creator_1(soci::session& s) const override { return new table_creator_one(s); diff --git a/tests/odbc/test-odbc-access.cpp b/tests/odbc/test-odbc-access.cpp index 2783646f..af266900 100644 --- a/tests/odbc/test-odbc-access.cpp +++ b/tests/odbc/test-odbc-access.cpp @@ -73,6 +73,8 @@ public: test_context(backend_factory const &backend, std::string const &connstr) : test_context_base(backend, connstr) {} + Backend get_backend() const override { return Backend::ODBC; } + table_creator_base * table_creator_1(soci::session& s) const { return new table_creator_one(s); diff --git a/tests/odbc/test-odbc-db2.cpp b/tests/odbc/test-odbc-db2.cpp index 91788949..85b5b6cf 100644 --- a/tests/odbc/test-odbc-db2.cpp +++ b/tests/odbc/test-odbc-db2.cpp @@ -69,6 +69,8 @@ public: std::string const &connectString) : test_context_base(backEnd, connectString) {} + Backend get_backend() const override { return Backend::ODBC; } + table_creator_base * table_creator_1(soci::session& s) const { return new table_creator_one(s); diff --git a/tests/odbc/test-odbc-mssql.cpp b/tests/odbc/test-odbc-mssql.cpp index 8b3ecd74..fd20a606 100644 --- a/tests/odbc/test-odbc-mssql.cpp +++ b/tests/odbc/test-odbc-mssql.cpp @@ -156,6 +156,8 @@ public: std::string const &connstr) : test_context_base(backend, connstr) {} + Backend get_backend() const override { return Backend::ODBC; } + table_creator_base* table_creator_1(soci::session& s) const override { return new table_creator_one(s); diff --git a/tests/odbc/test-odbc-postgresql.cpp b/tests/odbc/test-odbc-postgresql.cpp index 4dbfa3c4..fb2f66f3 100644 --- a/tests/odbc/test-odbc-postgresql.cpp +++ b/tests/odbc/test-odbc-postgresql.cpp @@ -161,6 +161,8 @@ public: std::cout << "Using ODBC driver version " << m_verDriver << "\n"; } + Backend get_backend() const override { return Backend::ODBC; } + table_creator_base * table_creator_1(soci::session& s) const override { return new table_creator_one(s); diff --git a/tests/oracle/test-oracle.cpp b/tests/oracle/test-oracle.cpp index d3531fd1..8fcffbe8 100644 --- a/tests/oracle/test-oracle.cpp +++ b/tests/oracle/test-oracle.cpp @@ -1407,6 +1407,8 @@ public: std::string const &connectString) : test_context_base(backEnd, connectString) {} + Backend get_backend() const override { return Backend::Oracle; } + table_creator_base* table_creator_1(soci::session& s) const override { return new table_creator_one(s); diff --git a/tests/postgresql/test-postgresql.cpp b/tests/postgresql/test-postgresql.cpp index 4bd85b61..f5cb9463 100644 --- a/tests/postgresql/test-postgresql.cpp +++ b/tests/postgresql/test-postgresql.cpp @@ -1346,6 +1346,8 @@ public: : test_context_base(backend, connstr) {} + Backend get_backend() const override { return Backend::PostgreSQL; } + table_creator_base* table_creator_1(soci::session& s) const override { return new table_creator_one(s); diff --git a/tests/sqlite3/test-sqlite3.cpp b/tests/sqlite3/test-sqlite3.cpp index 0aa91f76..b015267c 100644 --- a/tests/sqlite3/test-sqlite3.cpp +++ b/tests/sqlite3/test-sqlite3.cpp @@ -794,6 +794,8 @@ public: std::string const &connstr) : test_context_base(backend, connstr) {} + Backend get_backend() const override { return Backend::SQLite; } + table_creator_base* table_creator_1(soci::session& s) const override { return new table_creator_one(s);