mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-poco.git
synced 2025-11-08 22:43:17 +00:00
Data2sql (#2070)
* remove leftover progen files * remove Data sources and turn headers into forwards * add SQL files #2059 * Data2sql: adjust Travis, AppVeyor & Makefiles (#2069) * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * fix header forwarding * Data2sql: Fixes for complete Travis CI success (#2071) * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Restore DataFormatException * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * Replace Data by SQL * construct RowFilter from RecordSet reference instead of pointer * pass Container ref instead of ptr to Column * elimitate g++ warnings * SQL: remove raw pointers from interfaces #2094; add constness and move ops where appropriate * tidy up Postgres * ODBC fixes
This commit is contained in:
committed by
GitHub
parent
7726d024ab
commit
b49ac67225
17
SQL/MySQL/testsuite/src/Driver.cpp
Normal file
17
SQL/MySQL/testsuite/src/Driver.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Driver.cpp
|
||||
//
|
||||
// Console-based test driver for Poco SQLite.
|
||||
//
|
||||
// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/CppUnit/TestRunner.h"
|
||||
#include "MySQLTestSuite.h"
|
||||
|
||||
|
||||
CppUnitMain(MySQLTestSuite)
|
||||
1020
SQL/MySQL/testsuite/src/MySQLTest.cpp
Normal file
1020
SQL/MySQL/testsuite/src/MySQLTest.cpp
Normal file
File diff suppressed because it is too large
Load Diff
150
SQL/MySQL/testsuite/src/MySQLTest.h
Normal file
150
SQL/MySQL/testsuite/src/MySQLTest.h
Normal file
@@ -0,0 +1,150 @@
|
||||
//
|
||||
// ODBCMySQLTest.h
|
||||
//
|
||||
// Definition of the MySQLTest class.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef MySQLTest_INCLUDED
|
||||
#define MySQLTest_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/SQL/MySQL/MySQL.h"
|
||||
#include "Poco/SQL/Session.h"
|
||||
#include "Poco/SharedPtr.h"
|
||||
#include "Poco/CppUnit/TestCase.h"
|
||||
#include "SQLExecutor.h"
|
||||
|
||||
|
||||
class MySQLTest: public CppUnit::TestCase
|
||||
/// MySQL test class
|
||||
/// Tested:
|
||||
///
|
||||
/// Driver | DB | OS
|
||||
/// ----------------+---------------------------+------------------------------------------
|
||||
/// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1
|
||||
/// | |
|
||||
/// | Ver 14.14 Distrib 5.5.37, | Linux debian 3.2.0-4-amd64 #1
|
||||
/// | for debian-linux-gnu | SMP Debian 3.2.57-3 x86_64 GNU/Linux
|
||||
/// | (x86_64) using readline |
|
||||
/// | 6.2 |
|
||||
/// | |
|
||||
{
|
||||
public:
|
||||
MySQLTest(const std::string& name);
|
||||
~MySQLTest();
|
||||
|
||||
void testBareboneMySQL();
|
||||
|
||||
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 testLongText();
|
||||
|
||||
void testUnsignedInts();
|
||||
void testFloat();
|
||||
void testDouble();
|
||||
|
||||
void testAny();
|
||||
void testDynamicAny();
|
||||
|
||||
void testTuple();
|
||||
void testTupleVector();
|
||||
|
||||
void testStdTuple();
|
||||
void testStdTupleVector();
|
||||
|
||||
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:
|
||||
static void connectNoDB();
|
||||
|
||||
void dropTable(const std::string& tableName);
|
||||
void recreatePersonTable();
|
||||
void recreatePersonBLOBTable();
|
||||
void recreatePersonLongTextTable();
|
||||
void recreatePersonDateTimeTable();
|
||||
void recreatePersonDateTable();
|
||||
void recreatePersonTimeTable();
|
||||
void recreateStringsTable();
|
||||
void recreateIntsTable();
|
||||
void recreateUnsignedIntsTable();
|
||||
void recreateFloatsTable();
|
||||
void recreateTuplesTable();
|
||||
void recreateVectorsTable();
|
||||
void recreateNullableIntTable();
|
||||
void recreateNullableStringTable();
|
||||
void recreateAnyTable();
|
||||
|
||||
static void dbInfo(Poco::SQL::Session& session);
|
||||
|
||||
static std::string getHost();
|
||||
static std::string getPort();
|
||||
static std::string getUser();
|
||||
static std::string getPass();
|
||||
static std::string getBase();
|
||||
static std::string _dbConnString;
|
||||
static Poco::SharedPtr<Poco::SQL::Session> _pSession;
|
||||
static Poco::SharedPtr<SQLExecutor> _pExecutor;
|
||||
static const bool bindValues[8];
|
||||
};
|
||||
|
||||
|
||||
#endif // MySQLTest_INCLUDED
|
||||
26
SQL/MySQL/testsuite/src/MySQLTestSuite.cpp
Normal file
26
SQL/MySQL/testsuite/src/MySQLTestSuite.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// ODBCTestSuite.cpp
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "MySQLTestSuite.h"
|
||||
#include "MySQLTest.h"
|
||||
|
||||
CppUnit::Test* MySQLTestSuite::suite()
|
||||
{
|
||||
CppUnit::TestSuite* pSuite = new CppUnit::TestSuite("MySQLTestSuite");
|
||||
|
||||
addTest(pSuite, MySQLTest::suite());
|
||||
return pSuite;
|
||||
}
|
||||
|
||||
|
||||
void MySQLTestSuite::addTest(CppUnit::TestSuite* pSuite, CppUnit::Test* pT)
|
||||
{
|
||||
if (pSuite && pT) pSuite->addTest(pT);
|
||||
}
|
||||
29
SQL/MySQL/testsuite/src/MySQLTestSuite.h
Normal file
29
SQL/MySQL/testsuite/src/MySQLTestSuite.h
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// ODBCTestSuite.h
|
||||
//
|
||||
// Definition of the ODBCTestSuite class.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef MySQLTestSuite_INCLUDED
|
||||
#define MySQLTestSuite_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/CppUnit/TestSuite.h"
|
||||
|
||||
class MySQLTestSuite
|
||||
{
|
||||
public:
|
||||
static CppUnit::Test* suite();
|
||||
|
||||
private:
|
||||
static void addTest(CppUnit::TestSuite* pSuite, CppUnit::Test* pT);
|
||||
};
|
||||
|
||||
|
||||
#endif // MySQLTestSuite_INCLUDED
|
||||
2147
SQL/MySQL/testsuite/src/SQLExecutor.cpp
Normal file
2147
SQL/MySQL/testsuite/src/SQLExecutor.cpp
Normal file
File diff suppressed because it is too large
Load Diff
113
SQL/MySQL/testsuite/src/SQLExecutor.h
Normal file
113
SQL/MySQL/testsuite/src/SQLExecutor.h
Normal file
@@ -0,0 +1,113 @@
|
||||
//
|
||||
// SQLExecutor.h
|
||||
//
|
||||
// Definition of the SQLExecutor class.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#ifndef SQLExecutor_INCLUDED
|
||||
#define SQLExecutor_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/SQL/MySQL/MySQL.h"
|
||||
#include "Poco/SQL/Session.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::SQL::Session* _pSession);
|
||||
~SQLExecutor();
|
||||
|
||||
void bareboneMySQLTest(const std::string& host, const std::string& user, const std::string& pwd, const std::string& db, const std::string& port, const char* tableCreateString);
|
||||
/// This function uses "bare bone" MySQL API calls (i.e. calls are not
|
||||
/// "wrapped" in PocoData 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 = ~0);
|
||||
void blobStmt();
|
||||
void longText();
|
||||
void dateTime();
|
||||
void date();
|
||||
void time();
|
||||
void unsignedInts();
|
||||
void floats();
|
||||
void doubles();
|
||||
void any();
|
||||
void dynamicAny();
|
||||
void tuples();
|
||||
void tupleVector();
|
||||
|
||||
void stdTuples();
|
||||
void stdTupleVector();
|
||||
|
||||
void internalExtraction();
|
||||
void doNull();
|
||||
|
||||
void sessionTransaction(const std::string& connect);
|
||||
void transaction(const std::string& connect);
|
||||
|
||||
void reconnect();
|
||||
|
||||
private:
|
||||
void setTransactionIsolation(Poco::SQL::Session& session, Poco::UInt32 ti);
|
||||
|
||||
Poco::SQL::Session* _pSession;
|
||||
};
|
||||
|
||||
|
||||
#endif // SQLExecutor_INCLUDED
|
||||
28
SQL/MySQL/testsuite/src/WinDriver.cpp
Normal file
28
SQL/MySQL/testsuite/src/WinDriver.cpp
Normal file
@@ -0,0 +1,28 @@
|
||||
//
|
||||
// WinDriver.cpp
|
||||
//
|
||||
// Windows test driver for Poco MySQL.
|
||||
//
|
||||
// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
|
||||
// and Contributors.
|
||||
//
|
||||
// SPDX-License-Identifier: BSL-1.0
|
||||
//
|
||||
|
||||
|
||||
#include "WinTestRunner/WinTestRunner.h"
|
||||
#include "MySQLTestSuite.h"
|
||||
|
||||
|
||||
class TestDriver: public CppUnit::WinTestRunnerApp
|
||||
{
|
||||
void TestMain()
|
||||
{
|
||||
CppUnit::WinTestRunner runner;
|
||||
runner.addTest(MySQLTestSuite::suite());
|
||||
runner.run();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
TestDriver theDriver;
|
||||
Reference in New Issue
Block a user