1//
2// ODBCMySQLTest.h
3//
4// Definition of the MySQLTest class.
5//
6// Copyright (c) 2008, Applied Informatics Software Engineering GmbH.
7// and Contributors.
8//
9// SPDX-License-Identifier: BSL-1.0
10//
11
12
13#ifndef MySQLTest_INCLUDED
14#define MySQLTest_INCLUDED
15
16
17#include "Poco/SQL/MySQL/MySQL.h"
18#include "Poco/SQL/Session.h"
19#include "Poco/SharedPtr.h"
20#include "Poco/CppUnit/TestCase.h"
21#include "SQLExecutor.h"
22
23
24class MySQLTest: public CppUnit::TestCase
25 /// MySQL test class
26 /// Tested:
27 ///
28 /// Driver | DB | OS
29 /// ----------------+---------------------------+------------------------------------------
30 /// 03.51.12.00 | MySQL 5.0.27-community-nt | MS Windows XP Professional x64 v.2003/SP1
31 /// | |
32 /// | Ver 14.14 Distrib 5.5.37, | Linux debian 3.2.0-4-amd64 #1
33 /// | for debian-linux-gnu | SMP Debian 3.2.57-3 x86_64 GNU/Linux
34 /// | (x86_64) using readline |
35 /// | 6.2 |
36 /// | |
37{
38public:
39 MySQLTest(const std::string& name);
40 ~MySQLTest();
41
42 void testBareboneMySQL();
43
44 void testSimpleAccess();
45 void testComplexType();
46 void testSimpleAccessVector();
47 void testComplexTypeVector();
48 void testInsertVector();
49 void testInsertEmptyVector();
50
51 void testInsertSingleBulk();
52 void testInsertSingleBulkVec();
53
54 void testLimit();
55 void testLimitOnce();
56 void testLimitPrepare();
57 void testLimitZero();
58 void testPrepare();
59
60 void testSetSimple();
61 void testSetComplex();
62 void testSetComplexUnique();
63 void testMultiSetSimple();
64 void testMultiSetComplex();
65 void testMapComplex();
66 void testMapComplexUnique();
67 void testMultiMapComplex();
68 void testSelectIntoSingle();
69 void testSelectIntoSingleStep();
70 void testSelectIntoSingleFail();
71 void testLowerLimitOk();
72 void testLowerLimitFail();
73 void testCombinedLimits();
74 void testCombinedIllegalLimits();
75 void testRange();
76 void testIllegalRange();
77 void testSingleSelect();
78 void testEmptyDB();
79 void testDateTime();
80 void testBLOB();
81 void testBLOBStmt();
82 void testLongText();
83
84 void testUnsignedInts();
85 void testFloat();
86 void testDouble();
87
88 void testAny();
89 void testDynamicAny();
90
91 void testTuple();
92 void testTupleVector();
93
94 void testStdTuple();
95 void testStdTupleVector();
96
97 void testInternalExtraction();
98
99 void testNull();
100 void testNullVector();
101
102 void testNullableInt();
103 void testNullableString();
104 void testTupleWithNullable();
105
106 void testSessionTransaction();
107 void testTransaction();
108
109 void testReconnect();
110
111 void setUp();
112 void tearDown();
113
114 static CppUnit::Test* suite();
115
116private:
117 static void connectNoDB();
118
119 void dropTable(const std::string& tableName);
120 void recreatePersonTable();
121 void recreatePersonBLOBTable();
122 void recreatePersonLongTextTable();
123 void recreatePersonDateTimeTable();
124 void recreatePersonDateTable();
125 void recreatePersonTimeTable();
126 void recreateStringsTable();
127 void recreateIntsTable();
128 void recreateUnsignedIntsTable();
129 void recreateFloatsTable();
130 void recreateTuplesTable();
131 void recreateVectorsTable();
132 void recreateNullableIntTable();
133 void recreateNullableStringTable();
134 void recreateAnyTable();
135
136 static void dbInfo(Poco::SQL::Session& session);
137
138 static std::string getHost();
139 static std::string getPort();
140 static std::string getUser();
141 static std::string getPass();
142 static std::string getBase();
143 static std::string _dbConnString;
144 static Poco::SharedPtr<Poco::SQL::Session> _pSession;
145 static Poco::SharedPtr<SQLExecutor> _pExecutor;
146 static const bool bindValues[8];
147};
148
149
150#endif // MySQLTest_INCLUDED
151