mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-12 10:13:51 +01:00
Cppunit and data test enhancements (#4616)
* enh(CppUnit): Source code enhancements. * enh(DataTest): Code enhancements (mostly to use override) to prevent wrong test calls when renaming.
This commit is contained in:
parent
669be63134
commit
1eebd46c04
@ -33,11 +33,11 @@ public:
|
||||
long data2lineNumber,
|
||||
const std::string& fileName);
|
||||
CppUnitException(const CppUnitException& other);
|
||||
virtual ~CppUnitException() noexcept;
|
||||
~CppUnitException() noexcept override;
|
||||
|
||||
CppUnitException& operator = (const CppUnitException& other);
|
||||
|
||||
const char* what() const noexcept;
|
||||
const char* what() const noexcept override;
|
||||
|
||||
long lineNumber() const;
|
||||
long data1LineNumber() const;
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
|
||||
protected:
|
||||
ClassUnderTest call(ClassUnderTest object);
|
||||
void runTest ();
|
||||
void runTest () override;
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
int countTestCases();
|
||||
std::string toString();
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr);
|
||||
void run(TestResult* result, const Test::Callback& callback = nullptr) override;
|
||||
|
||||
private:
|
||||
const int _timesRepeat;
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include "CppUnit/CppUnitException.h"
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <typeinfo>
|
||||
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
|
||||
#include <stdexcept>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "CppUnit/TestResult.h"
|
||||
#include "CppUnit/estring.h"
|
||||
@ -117,7 +117,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback)
|
||||
}
|
||||
catch (CppUnitException& e)
|
||||
{
|
||||
CppUnitException* copy = new CppUnitException(e);
|
||||
auto* copy = new CppUnitException(e);
|
||||
result->addFailure(this, copy);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
@ -128,7 +128,7 @@ void TestCase::run(TestResult *result, const Test::Callback& callback)
|
||||
}
|
||||
catch (...)
|
||||
{
|
||||
CppUnitException *e = new CppUnitException ("unknown exception");
|
||||
auto* e = new CppUnitException ("unknown exception");
|
||||
result->addError (this, e);
|
||||
}
|
||||
tearDown ();
|
||||
|
@ -15,9 +15,7 @@ TestDecorator::TestDecorator(Test* test)
|
||||
}
|
||||
|
||||
|
||||
TestDecorator::~TestDecorator()
|
||||
{
|
||||
}
|
||||
TestDecorator::~TestDecorator() = default;
|
||||
|
||||
|
||||
int TestDecorator::countTestCases() const
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "CppUnit/TextTestResult.h"
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
|
||||
|
||||
namespace CppUnit {
|
||||
@ -28,8 +27,8 @@ TestRunner::TestRunner(std::ostream& ostr):
|
||||
|
||||
TestRunner::~TestRunner()
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
delete it->second;
|
||||
for (auto & _mapping : _mappings)
|
||||
delete _mapping.second;
|
||||
}
|
||||
|
||||
|
||||
@ -80,9 +79,9 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
||||
}
|
||||
else if (arg == "-print")
|
||||
{
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
for (auto& _mapping : _mappings)
|
||||
{
|
||||
print(it->first, it->second, 0);
|
||||
print(_mapping.first, _mapping.second, 0);
|
||||
}
|
||||
printed = true;
|
||||
continue;
|
||||
@ -104,8 +103,8 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
||||
return false;
|
||||
}
|
||||
|
||||
Test* testToRun = 0;
|
||||
for (Mappings::iterator it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
|
||||
Test* testToRun = nullptr;
|
||||
for (auto it = _mappings.begin(); !testToRun && it != _mappings.end(); ++it)
|
||||
{
|
||||
testToRun = find(testCase, it->second, it->first);
|
||||
}
|
||||
@ -124,18 +123,18 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
||||
if (all)
|
||||
{
|
||||
tests.clear();
|
||||
for (Mappings::iterator it = _mappings.begin(); it != _mappings.end(); ++it)
|
||||
for (auto& _mapping : _mappings)
|
||||
{
|
||||
collectAllTestCases(it->second, tests);
|
||||
collectAllTestCases(_mapping.second, tests);
|
||||
}
|
||||
}
|
||||
|
||||
TextTestResult result(_ostr, ignore);
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
for (auto testToRun : tests)
|
||||
{
|
||||
Test* testToRun = *it;
|
||||
if(testToRun->getType() == Test::Long && !longRunning)
|
||||
continue;
|
||||
|
||||
if (setup.size() > 0)
|
||||
testToRun->addSetup(setup);
|
||||
|
||||
@ -163,7 +162,7 @@ bool TestRunner::run(const std::vector<std::string>& args, const Test::Callback&
|
||||
|
||||
void TestRunner::addTest(const std::string& name, Test* test)
|
||||
{
|
||||
_mappings.push_back(Mapping(name, test));
|
||||
_mappings.emplace_back(name, test);
|
||||
}
|
||||
|
||||
|
||||
@ -176,9 +175,9 @@ void TestRunner::print(const std::string& name, Test* pTest, int indent)
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
for (auto* test : tests)
|
||||
{
|
||||
print((*it)->toString(), *it, indent + 1);
|
||||
print(test->toString(), test, indent + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -192,17 +191,17 @@ Test* TestRunner::find(const std::string& name, Test* pTest, const std::string&
|
||||
}
|
||||
else
|
||||
{
|
||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
auto* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
for (auto* test : tests)
|
||||
{
|
||||
Test* result = find(name, *it, (*it)->toString());
|
||||
Test* result = find(name, test, test->toString());
|
||||
if (result) return result;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,14 +211,14 @@ int TestRunner::collectAllTestCases(Test* pTest, std::vector<Test*>& testcases)
|
||||
int added = 0;
|
||||
if (pTest->getType() == Test::Suite)
|
||||
{
|
||||
TestSuite* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
auto* pSuite = dynamic_cast<TestSuite*>(pTest);
|
||||
|
||||
if (pSuite)
|
||||
{
|
||||
const std::vector<Test*>& tests = pSuite->tests();
|
||||
for (std::vector<Test*>::const_iterator it = tests.begin(); it != tests.end(); ++it)
|
||||
for (auto* test : tests)
|
||||
{
|
||||
added += collectAllTestCases(*it, testcases);
|
||||
added += collectAllTestCases(test, testcases);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,22 +13,22 @@ namespace CppUnit {
|
||||
// Deletes all tests in the suite.
|
||||
void TestSuite::deleteContents()
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
delete *it;
|
||||
for (auto* _test : _tests)
|
||||
delete _test;
|
||||
}
|
||||
|
||||
|
||||
// Runs the tests and collects their result in a TestResult.
|
||||
void TestSuite::run(TestResult *result, const Test::Callback& callback)
|
||||
{
|
||||
for (std::vector<Test*>::iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
for (auto* test : _tests)
|
||||
{
|
||||
if (result->shouldStop())
|
||||
break;
|
||||
|
||||
Test *test = *it;
|
||||
if (!setup().empty())
|
||||
test->addSetup(setup());
|
||||
|
||||
test->run(result, callback);
|
||||
}
|
||||
}
|
||||
@ -39,8 +39,8 @@ int TestSuite::countTestCases() const
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (std::vector<Test*>::const_iterator it = _tests.begin(); it != _tests.end(); ++it)
|
||||
count += (*it)->countTestCases();
|
||||
for (auto* _test : _tests)
|
||||
count += _test->countTestCases();
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ file(GLOB SRCS_G ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
POCO_SOURCES_AUTO(DATA_TEST_LIB_SRCS ${SRCS_G})
|
||||
|
||||
# Headers
|
||||
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/*.h)
|
||||
file(GLOB HDRS_G ${CMAKE_CURRENT_SOURCE_DIR}/include/Poco/Data/Test/*.h)
|
||||
POCO_HEADERS_AUTO(DATA_TEST_LIB_SRCS ${HDRS_G})
|
||||
|
||||
# Version Resource
|
||||
|
@ -14,15 +14,13 @@
|
||||
#define DataTest_SQLExecutor_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "Poco/Data/Test/DataTest.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/BulkExtraction.h"
|
||||
#include "Poco/Data/BulkBinding.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
#include <string_view>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
@ -55,7 +53,7 @@ public:
|
||||
};
|
||||
|
||||
SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = nullptr, bool numberedPlaceHolders = false);
|
||||
~SQLExecutor();
|
||||
~SQLExecutor() override;
|
||||
|
||||
template <typename C>
|
||||
void connection(C& c, const std::string& connectString)
|
||||
|
@ -45,9 +45,9 @@ class Diagnostics
|
||||
{
|
||||
public:
|
||||
|
||||
inline static const unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
||||
inline static const unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
||||
inline static const unsigned int SQL_NAME_LENGTH = 128;
|
||||
static constexpr unsigned int SQL_STATE_SIZE = SQL_SQLSTATE_SIZE + 1;
|
||||
static constexpr unsigned int SQL_MESSAGE_LENGTH = SQL_MAX_MESSAGE_LENGTH + 1;
|
||||
static constexpr unsigned int SQL_NAME_LENGTH = 128;
|
||||
inline static const std::string DATA_TRUNCATED;
|
||||
|
||||
struct DiagnosticFields
|
||||
|
@ -32,12 +32,12 @@ class ODBCAccessTest: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
ODBCAccessTest(const std::string& name);
|
||||
~ODBCAccessTest();
|
||||
~ODBCAccessTest() override;
|
||||
|
||||
void testSimpleAccess();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
void setUp() override;
|
||||
void tearDown() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
|
@ -28,37 +28,37 @@ class ODBCDB2Test: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCDB2Test(const std::string& name);
|
||||
~ODBCDB2Test();
|
||||
~ODBCDB2Test() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testBareboneODBC() override;
|
||||
|
||||
void testBLOB();
|
||||
void testFilter();
|
||||
void testBLOB() override;
|
||||
void testFilter() override;
|
||||
|
||||
void testStoredProcedure();
|
||||
void testStoredProcedureAny();
|
||||
void testStoredProcedureDynamicVar();
|
||||
void testStoredFunction();
|
||||
void testStoredProcedure() override;
|
||||
void testStoredProcedureAny() override;
|
||||
void testStoredProcedureDynamicVar() override;
|
||||
void testStoredFunction() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void dropObject(const std::string& type, const std::string& tableName);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull = "");
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void dropObject(const std::string& type, const std::string& tableName) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonDateTable() override;
|
||||
void recreatePersonTimeTable() override;
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
|
||||
static ODBCTest::SessionPtr _pSession;
|
||||
static ODBCTest::ExecPtr _pExecutor;
|
||||
|
@ -31,39 +31,39 @@ class ODBCMySQLTest: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCMySQLTest(const std::string& name);
|
||||
~ODBCMySQLTest();
|
||||
~ODBCMySQLTest() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testBareboneODBC() override;
|
||||
|
||||
void testBLOB();
|
||||
void testBLOB() override;
|
||||
|
||||
void testStoredProcedure();
|
||||
void testStoredFunction();
|
||||
void testStoredProcedure() override;
|
||||
void testStoredFunction() override;
|
||||
|
||||
void testNull();
|
||||
void testNull() override;
|
||||
|
||||
void testMultipleResults();
|
||||
void testFilter();
|
||||
void testMultipleResults() override;
|
||||
void testFilter() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull = "");
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void dropObject(const std::string& type, const std::string& name) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonDateTable() override;
|
||||
void recreatePersonTimeTable() override;
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
|
||||
static ODBCTest::SessionPtr _pSession;
|
||||
static ODBCTest::ExecPtr _pExecutor;
|
||||
|
@ -30,47 +30,47 @@ class ODBCOracleTest: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCOracleTest(const std::string& name);
|
||||
~ODBCOracleTest();
|
||||
~ODBCOracleTest() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testBareboneODBC() override;
|
||||
|
||||
void testBLOB();
|
||||
void testBLOB() override;
|
||||
|
||||
void testMultipleResults();
|
||||
void testMultipleResults() override;
|
||||
|
||||
virtual void testTransaction();
|
||||
void testTransaction() override;
|
||||
|
||||
void testStoredProcedure();
|
||||
void testStoredProcedure() override;
|
||||
void testCursorStoredProcedure();
|
||||
void testStoredFunction();
|
||||
void testStoredFunction() override;
|
||||
void testCursorStoredFunction();
|
||||
void testStoredProcedureAny();
|
||||
void testStoredProcedureDynamicVar();
|
||||
void testStoredProcedureAny() override;
|
||||
void testStoredProcedureDynamicVar() override;
|
||||
void testAutoTransaction();
|
||||
|
||||
void testNull();
|
||||
void testNull() override;
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
static void testBarebone();
|
||||
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonTupleTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull = "");
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void recreateUnicodeTable();
|
||||
void dropObject(const std::string& type, const std::string& name) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonTupleTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonDateTable() override;
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
void recreateUnicodeTable() override;
|
||||
|
||||
static ODBCTest::SessionPtr _pSession;
|
||||
static ODBCTest::ExecPtr _pExecutor;
|
||||
|
@ -37,37 +37,37 @@ class ODBCPostgreSQLTest: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCPostgreSQLTest(const std::string& name);
|
||||
~ODBCPostgreSQLTest();
|
||||
~ODBCPostgreSQLTest() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testBareboneODBC() override;
|
||||
|
||||
void testBLOB();
|
||||
void testBLOB() override;
|
||||
|
||||
void testStoredFunction();
|
||||
void testStoredFunctionAny();
|
||||
void testStoredFunctionDynamicAny();
|
||||
void testStoredFunction() override;
|
||||
void testStoredFunctionAny() override;
|
||||
void testStoredFunctionDynamicAny() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull="");
|
||||
void recreateBoolTable();
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void recreateUnicodeTable();
|
||||
void dropObject(const std::string& type, const std::string& name) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreatePersonDateTable() override;
|
||||
void recreatePersonTimeTable() override;
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateBoolTable() override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
void recreateUnicodeTable() override;
|
||||
|
||||
void configurePLPgSQL();
|
||||
/// Configures PL/pgSQL in the database. A reasonable defaults
|
||||
|
@ -40,51 +40,51 @@ class ODBCSQLServerTest: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCSQLServerTest(const std::string& name);
|
||||
~ODBCSQLServerTest();
|
||||
~ODBCSQLServerTest() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testBareboneODBC() override;
|
||||
|
||||
void testTempTable();
|
||||
void testTempTable() override;
|
||||
|
||||
void testBLOB();
|
||||
void testBLOB() override;
|
||||
void testBigString();
|
||||
void testBigBatch();
|
||||
void testNull();
|
||||
void testBulk();
|
||||
void testNull() override;
|
||||
void testBulk() override;
|
||||
|
||||
void testStoredProcedure();
|
||||
void testStoredProcedure() override;
|
||||
void testCursorStoredProcedure();
|
||||
void testStoredProcedureAny();
|
||||
void testStoredProcedureDynamicVar();
|
||||
void testStoredProcedureAny() override;
|
||||
void testStoredProcedureDynamicVar() override;
|
||||
|
||||
void testStoredProcedureReturn();
|
||||
void testStoredFunction();
|
||||
void testStoredFunction() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void dropObject(const std::string& type, const std::string& name) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonBigStringTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreatePersonDateTable() { /* no-op */ };
|
||||
void recreatePersonTimeTable() { /* no-op */ };
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateUUIDsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreatePersonDateTable() override { /* no-op */ };
|
||||
void recreatePersonTimeTable() override { /* no-op */ };
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateUUIDsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull = "");
|
||||
void recreateBoolTable();
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void recreateUnicodeTable();
|
||||
void recreateEncodingTables();
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateBoolTable() override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
void recreateUnicodeTable() override;
|
||||
void recreateEncodingTables() override;
|
||||
|
||||
static SessionPtr _pSession;
|
||||
static SessionPtr _pEncSession;
|
||||
|
@ -28,29 +28,29 @@ class ODBCSQLiteTest: public ODBCTest
|
||||
{
|
||||
public:
|
||||
ODBCSQLiteTest(const std::string& name);
|
||||
~ODBCSQLiteTest();
|
||||
~ODBCSQLiteTest() override;
|
||||
|
||||
void testBareboneODBC();
|
||||
void testAffectedRows();
|
||||
void testNull();
|
||||
void testBareboneODBC() override;
|
||||
void testAffectedRows() override;
|
||||
void testNull() override;
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
void dropObject(const std::string& type, const std::string& name);
|
||||
void recreateNullableTable();
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateAnysTable();
|
||||
void recreateNullsTable(const std::string& notNull = "");
|
||||
void recreateMiscTable();
|
||||
void recreateLogTable();
|
||||
void dropObject(const std::string& type, const std::string& name) override;
|
||||
void recreateNullableTable() override;
|
||||
void recreatePersonTable() override;
|
||||
void recreatePersonBLOBTable() override;
|
||||
void recreatePersonDateTimeTable() override;
|
||||
void recreateStringsTable() override;
|
||||
void recreateIntsTable() override;
|
||||
void recreateFloatsTable() override;
|
||||
void recreateTuplesTable() override;
|
||||
void recreateVectorsTable() override;
|
||||
void recreateAnysTable() override;
|
||||
void recreateNullsTable(const std::string& notNull = "") override;
|
||||
void recreateMiscTable() override;
|
||||
void recreateLogTable() override;
|
||||
|
||||
static ODBCTest::SessionPtr _pSession;
|
||||
static ODBCTest::ExecPtr _pExecutor;
|
||||
|
@ -40,10 +40,10 @@ public:
|
||||
std::string& rPwd,
|
||||
std::string& rConnectString);
|
||||
|
||||
~ODBCTest();
|
||||
~ODBCTest() override;
|
||||
|
||||
virtual void setUp();
|
||||
virtual void tearDown();
|
||||
void setUp() override;
|
||||
void tearDown() override;
|
||||
|
||||
virtual void testBareboneODBC() = 0;
|
||||
|
||||
@ -166,7 +166,7 @@ public:
|
||||
virtual void testReconnect();
|
||||
|
||||
protected:
|
||||
typedef Poco::Data::ODBC::Utility::DriverMap Drivers;
|
||||
using Drivers = Poco::Data::ODBC::Utility::DriverMap;
|
||||
|
||||
virtual void dropObject(const std::string& type, const std::string& name);
|
||||
virtual void recreateNullableTable();
|
||||
|
@ -13,16 +13,13 @@
|
||||
#ifndef SQLExecutor_INCLUDED
|
||||
#define SQLExecutor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/ODBC/ODBC.h"
|
||||
#include "Poco/Data/ODBC/Utility.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "Poco/Data/ODBC/ODBCException.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/Data/BulkExtraction.h"
|
||||
#include "Poco/Data/BulkBinding.h"
|
||||
#include "Poco/Data/Test/SQLExecutor.h"
|
||||
#include "Poco/NumberFormatter.h"
|
||||
#include "Poco/String.h"
|
||||
#include "Poco/Exception.h"
|
||||
#include <iostream>
|
||||
|
||||
@ -88,8 +85,10 @@ public:
|
||||
DE_BOUND
|
||||
};
|
||||
|
||||
SQLExecutor(const std::string& name, Poco::Data::Session* pSession, Poco::Data::Session* pEncSession = 0);
|
||||
~SQLExecutor();
|
||||
SQLExecutor(const std::string& name,
|
||||
Poco::Data::Session* pSession,
|
||||
Poco::Data::Session* pEncSession = nullptr);
|
||||
~SQLExecutor() override;
|
||||
|
||||
void execute(const std::string& sql);
|
||||
/// Execute a query.
|
||||
|
Loading…
Reference in New Issue
Block a user