1//
2// SQLiteTest.h
3//
4// Definition of the SQLiteTest class.
5//
6// Copyright (c) 2006, Applied Informatics Software Engineering GmbH.
7// and Contributors.
8//
9// SPDX-License-Identifier: BSL-1.0
10//
11
12
13#ifndef SQLiteTest_INCLUDED
14#define SQLiteTest_INCLUDED
15
16
17#include "Poco/SQL/SQLite/SQLite.h"
18#include "Poco/CppUnit/TestCase.h"
19
20
21namespace Poco {
22namespace SQL {
23
24class Session;
25
26} }
27
28
29class SQLiteTest: public CppUnit::TestCase
30{
31public:
32 SQLiteTest(const std::string& name);
33 ~SQLiteTest();
34
35 void testBinding();
36 void testZeroRows();
37 void testSimpleAccess();
38 void testInMemory();
39 void testNullCharPointer();
40 void testInsertCharPointer();
41 void testInsertCharPointer2();
42 void testComplexType();
43 void testSimpleAccessVector();
44 void testComplexTypeVector();
45 void testSharedPtrComplexTypeVector();
46 void testInsertVector();
47 void testInsertEmptyVector();
48 void testAffectedRows();
49 void testInsertSingleBulk();
50 void testInsertSingleBulkVec();
51
52 void testLimit();
53 void testLimitOnce();
54 void testLimitPrepare();
55 void testLimitZero();
56 void testPrepare();
57
58 void testSetSimple();
59 void testSetComplex();
60 void testSetComplexUnique();
61 void testMultiSetSimple();
62 void testMultiSetComplex();
63 void testMapComplex();
64 void testMapComplexUnique();
65 void testMultiMapComplex();
66 void testSelectIntoSingle();
67 void testSelectIntoSingleStep();
68 void testSelectIntoSingleFail();
69 void testLowerLimitOk();
70 void testLowerLimitFail();
71 void testCombinedLimits();
72 void testCombinedIllegalLimits();
73 void testRange();
74 void testIllegalRange();
75 void testSingleSelect();
76 void testEmptyDB();
77 void testNonexistingDB();
78
79 void testCLOB();
80
81 void testTuple1();
82 void testTupleVector1();
83 void testTuple2();
84 void testTupleVector2();
85 void testTuple3();
86 void testTupleVector3();
87 void testTuple4();
88 void testTupleVector4();
89 void testTuple5();
90 void testTupleVector5();
91 void testTuple6();
92 void testTupleVector6();
93 void testTuple7();
94 void testTupleVector7();
95 void testTuple8();
96 void testTupleVector8();
97 void testTuple9();
98 void testTupleVector9();
99 void testTuple10();
100 void testTupleVector10();
101
102 void testDateTime();
103
104 void testInternalExtraction();
105 void testPrimaryKeyConstraint();
106 void testNullable();
107 void testNulls();
108 void testRowIterator();
109 void testRowIteratorLimit();
110 void testRowFilter();
111 void testAsync();
112
113 void testAny();
114 void testDynamicAny();
115 void testPair();
116
117 void testSQLChannel();
118 void testSQLLogger();
119
120 void testExternalBindingAndExtraction();
121 void testBindingCount();
122 void testMultipleResults();
123
124 void testReconnect();
125
126 void testThreadModes();
127
128 void testUpdateCallback();
129 void testCommitCallback();
130 void testRollbackCallback();
131 void testNotifier();
132
133 void testSessionTransaction();
134 void testTransaction();
135 void testTransactor();
136
137 void testFTS3();
138
139 void testJSONRowFormatter();
140
141 void testIncrementVacuum();
142
143 void testIllegalFilePath();
144
145 void setUp();
146 void tearDown();
147
148 static void sqliteUpdateCallbackFn(void*, int, const char*, const char*, Poco::Int64);
149 static int sqliteCommitCallbackFn(void*);
150 static void sqliteRollbackCallbackFn(void*);
151
152 void onInsert(const void* pSender);
153 void onUpdate(const void* pSender);
154 void onDelete(const void* pSender);
155 void onCommit(const void* pSender);
156 void onRollback(const void* pSender);
157
158 static CppUnit::Test* suite();
159
160private:
161 void setTransactionIsolation(Poco::SQL::Session& session, Poco::UInt32 ti);
162 void checkJSON(const std::string& sql, const std::string& json, int mode = 0);
163
164 static int _insertCounter;
165 static int _updateCounter;
166 static int _deleteCounter;
167
168 int _commitCounter;
169 int _rollbackCounter;
170};
171
172
173#endif // SQLiteTest_INCLUDED
174