mirror of
https://github.com/VCMP-SqMod/SqMod.git
synced 2025-06-29 05:27:12 +02:00
Major plugin refactor and cleanup.
Switched to POCO library for unified platform/library interface. Deprecated the external module API. It was creating more problems than solving. Removed most built-in libraries in favor of system libraries for easier maintenance. Cleaned and secured code with help from static analyzers.
This commit is contained in:
17
vendor/POCO/Data/PostgreSQL/testsuite/src/Driver.cpp
vendored
Normal file
17
vendor/POCO/Data/PostgreSQL/testsuite/src/Driver.cpp
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// Console-based test driver for Poco PostgreSQL.
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "CppUnit/TestRunner.h"
|
||||
#include "PostgreSQLTestSuite.h"
|
||||
|
||||
|
||||
CppUnitMain(PostgreSQLTestSuite)
|
1125
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTest.cpp
vendored
Normal file
1125
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTest.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
141
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTest.h
vendored
Normal file
141
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTest.h
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
//
|
||||
// PostgreSQLTest.h
|
||||
//
|
||||
// Definition of the PostgreSQLTest class.
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef PostgreSQLTest_INCLUDED
|
||||
#define PostgreSQLTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/PostgreSQL/PostgreSQL.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "SQLExecutor.h"
|
||||
|
||||
|
||||
class PostgreSQLTest: public CppUnit::TestCase
|
||||
/// PostgreSQL test class
|
||||
/// Tested:
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ----------------+---------------------------+------------------------------------------
|
||||
/// 03.51.12.00 | PostgreSQL 9.3.1.0(18) | Mac OSX 10.9.1
|
||||
///
|
||||
|
||||
{
|
||||
public:
|
||||
PostgreSQLTest(const std::string& name);
|
||||
~PostgreSQLTest();
|
||||
|
||||
void testConnectNoDB();
|
||||
void testPostgreSQLOIDs();
|
||||
void testBarebonePostgreSQL();
|
||||
|
||||
void testSimpleAccess();
|
||||
void testComplexType();
|
||||
void testSimpleAccessVector();
|
||||
void testComplexTypeVector();
|
||||
void testInsertVector();
|
||||
void testInsertEmptyVector();
|
||||
|
||||
void testInsertSingleBulk();
|
||||
void testInsertSingleBulkVec();
|
||||
|
||||
void testLimit();
|
||||
void testLimitOnce();
|
||||
void testLimitPrepare();
|
||||
void testLimitZero();
|
||||
void testPrepare();
|
||||
|
||||
void testSetSimple();
|
||||
void testSetComplex();
|
||||
void testSetComplexUnique();
|
||||
void testMultiSetSimple();
|
||||
void testMultiSetComplex();
|
||||
void testMapComplex();
|
||||
void testMapComplexUnique();
|
||||
void testMultiMapComplex();
|
||||
void testSelectIntoSingle();
|
||||
void testSelectIntoSingleStep();
|
||||
void testSelectIntoSingleFail();
|
||||
void testLowerLimitOk();
|
||||
void testLowerLimitFail();
|
||||
void testCombinedLimits();
|
||||
void testCombinedIllegalLimits();
|
||||
void testRange();
|
||||
void testIllegalRange();
|
||||
void testSingleSelect();
|
||||
void testEmptyDB();
|
||||
void testDateTime();
|
||||
void testBLOB();
|
||||
void testBLOBStmt();
|
||||
void testCLOBStmt();
|
||||
|
||||
void testUnsignedInts();
|
||||
void testFloat();
|
||||
void testDouble();
|
||||
|
||||
void testTuple();
|
||||
void testTupleVector();
|
||||
|
||||
void testInternalExtraction();
|
||||
|
||||
void testNull();
|
||||
void testNullVector();
|
||||
|
||||
void testNullableInt();
|
||||
void testNullableString();
|
||||
void testTupleWithNullable();
|
||||
|
||||
void testSessionTransaction();
|
||||
void testTransaction();
|
||||
|
||||
void testReconnect();
|
||||
|
||||
void setUp();
|
||||
void tearDown();
|
||||
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
|
||||
void dropTable(const std::string& tableName);
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonCLOBTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateUnsignedIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateNullableIntTable();
|
||||
void recreateNullableStringTable();
|
||||
|
||||
static void dbInfo(Poco::Data::Session& session);
|
||||
|
||||
static std::string getHost();
|
||||
static std::string getPort();
|
||||
static std::string getBase();
|
||||
static std::string getUser();
|
||||
static std::string getPass();
|
||||
|
||||
static std::string _dbConnString;
|
||||
static Poco::SharedPtr<Poco::Data::Session> _pSession;
|
||||
static Poco::SharedPtr<SQLExecutor> _pExecutor;
|
||||
static const bool bindValues[8];
|
||||
};
|
||||
|
||||
|
||||
#endif // PostgreSQLTest_INCLUDED
|
26
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTestSuite.cpp
vendored
Normal file
26
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTestSuite.cpp
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
//
|
||||
// PostgreSQLTestSuite.cpp
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "PostgreSQLTestSuite.h"
|
||||
#include "PostgreSQLTest.h"
|
||||
|
||||
CppUnit::Test* PostgreSQLTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("PostgreSQLTestSuite");
|
||||
|
||||
addTest(pSuite, PostgreSQLTest::suite());
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
|
||||
void PostgreSQLTestSuite::addTest(CppUnit::TestSuite* pSuite, CppUnit::Test* pT)
|
||||
{
|
||||
if (pSuite && pT) pSuite->addTest(pT);
|
||||
}
|
27
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTestSuite.h
vendored
Normal file
27
vendor/POCO/Data/PostgreSQL/testsuite/src/PostgreSQLTestSuite.h
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// PostgreSQLTestSuite.h
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef PostgreSQLTestSuite_INCLUDED
|
||||
#define PostgreSQLTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "CppUnit/TestSuite.h"
|
||||
|
||||
class PostgreSQLTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
static void addTest(CppUnit::TestSuite* pSuite, CppUnit::Test* pT);
|
||||
};
|
||||
|
||||
|
||||
#endif // PostgreSQLTestSuite_INCLUDED
|
2133
vendor/POCO/Data/PostgreSQL/testsuite/src/SQLExecutor.cpp
vendored
Normal file
2133
vendor/POCO/Data/PostgreSQL/testsuite/src/SQLExecutor.cpp
vendored
Normal file
File diff suppressed because it is too large
Load Diff
110
vendor/POCO/Data/PostgreSQL/testsuite/src/SQLExecutor.h
vendored
Normal file
110
vendor/POCO/Data/PostgreSQL/testsuite/src/SQLExecutor.h
vendored
Normal file
@ -0,0 +1,110 @@
|
||||
//
|
||||
// SQLExecutor.h
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef SQLExecutor_PostgreSQL_INCLUDED
|
||||
#define SQLExecutor_PostgreSQL_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Data/PostgreSQL/PostgreSQL.h"
|
||||
#include "Poco/Data/Session.h"
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
class SQLExecutor: public CppUnit::TestCase
|
||||
{
|
||||
public:
|
||||
enum DataBinding
|
||||
{
|
||||
PB_IMMEDIATE,
|
||||
PB_AT_EXEC
|
||||
};
|
||||
|
||||
enum DataExtraction
|
||||
{
|
||||
DE_MANUAL,
|
||||
DE_BOUND
|
||||
};
|
||||
|
||||
SQLExecutor(const std::string& name, Poco::Data::Session* _pSession);
|
||||
~SQLExecutor();
|
||||
|
||||
void oidPostgreSQLTest(std::string host, std::string user, std::string pwd, std::string db, std::string port, const char* tableCreateString, const Oid anOIDArray[]);
|
||||
/// This function verifies the PostgreSQL Column type OIDs are consistent between releases
|
||||
|
||||
void barebonePostgreSQLTest(std::string host, std::string user, std::string pwd, std::string db, std::string port, const char* tableCreateString);
|
||||
/// This function uses "bare bone" API calls (i.e. calls are not
|
||||
/// "wrapped" in PocoSQL framework structures).
|
||||
/// The purpose of the function is to verify that driver behaves
|
||||
/// correctly. If this test passes, subsequent tests failures are likely ours.
|
||||
|
||||
void simpleAccess();
|
||||
void complexType();
|
||||
void simpleAccessVector();
|
||||
void complexTypeVector();
|
||||
void insertVector();
|
||||
void insertEmptyVector();
|
||||
|
||||
void insertSingleBulk();
|
||||
void insertSingleBulkVec();
|
||||
|
||||
void limits();
|
||||
void limitOnce();
|
||||
void limitPrepare();
|
||||
void limitZero();
|
||||
void prepare();
|
||||
|
||||
void setSimple();
|
||||
void setComplex();
|
||||
void setComplexUnique();
|
||||
void multiSetSimple();
|
||||
void multiSetComplex();
|
||||
void mapComplex();
|
||||
void mapComplexUnique();
|
||||
void multiMapComplex();
|
||||
void selectIntoSingle();
|
||||
void selectIntoSingleStep();
|
||||
void selectIntoSingleFail();
|
||||
void lowerLimitOk();
|
||||
void lowerLimitFail();
|
||||
void combinedLimits();
|
||||
void combinedIllegalLimits();
|
||||
void ranges();
|
||||
void illegalRange();
|
||||
void singleSelect();
|
||||
void emptyDB();
|
||||
|
||||
void blob(unsigned int bigSize = 1024000); // size value will have to go into an int in the end
|
||||
void clobStmt();
|
||||
void blobStmt();
|
||||
void dateTime();
|
||||
void date();
|
||||
void time();
|
||||
void unsignedInts();
|
||||
void floats();
|
||||
void doubles();
|
||||
void tuples();
|
||||
void tupleVector();
|
||||
|
||||
void internalExtraction();
|
||||
void doNull();
|
||||
|
||||
void sessionTransaction(const std::string& connect);
|
||||
void transaction(const std::string& connect);
|
||||
|
||||
void reconnect();
|
||||
|
||||
private:
|
||||
void setTransactionIsolation(Poco::Data::Session& session, Poco::UInt32 ti);
|
||||
|
||||
Poco::Data::Session* _pSession;
|
||||
};
|
||||
|
||||
|
||||
#endif // SQLExecutor_PostgreSQL_INCLUDED
|
28
vendor/POCO/Data/PostgreSQL/testsuite/src/WinDriver.cpp
vendored
Normal file
28
vendor/POCO/Data/PostgreSQL/testsuite/src/WinDriver.cpp
vendored
Normal file
@ -0,0 +1,28 @@
|
||||
//
|
||||
// WinDriver.cpp
|
||||
//
|
||||
// Windows test driver for Poco PostgreSQL.
|
||||
//
|
||||
// Copyright (c) 2015, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "WinTestRunner/WinTestRunner.h"
|
||||
#include "PostgreSQLTestSuite.h"
|
||||
|
||||
|
||||
class TestDriver: public CppUnit::WinTestRunnerApp
|
||||
{
|
||||
void TestMain()
|
||||
{
|
||||
CppUnit::WinTestRunner runner;
|
||||
runner.addTest(PostgreSQLTestSuite::suite());
|
||||
runner.run();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TestDriver theDriver;
|
Reference in New Issue
Block a user