mirror of
https://github.com/SOCI/soci.git
synced 2026-02-13 00:59:39 -06:00
Special case data type for Oracle backend
This commit is contained in:
@@ -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<soci::blob>(1);
|
||||
//CHECK(retrieved.get_len() == 10);
|
||||
|
||||
@@ -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'";
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user