Skip to content

Commit 61e5a65

Browse files
Merge branch 'main' into main
2 parents 5569afc + 1b23a88 commit 61e5a65

199 files changed

Lines changed: 10711 additions & 4890 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ jobs:
193193
- uses: actions/checkout@v4
194194
- run: sudo apt -y update && sudo apt -y install libssl-dev
195195
- run: >-
196-
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_TRACE=ON -DENABLE_TESTS=ON
196+
cmake -S. -Bcmake-build -GNinja -DPOCO_MINIMAL_BUILD=ON -DENABLE_TRACE=ON -DENABLE_TESTS=ON -DENABLE_INSTALL_CPPUNIT=ON
197197
- run: cmake --build cmake-build --target all --parallel 4
198198
- uses: ./.github/actions/retry-action
199199
with:
@@ -530,7 +530,7 @@ jobs:
530530
- uses: actions/checkout@v4
531531
- run: brew install openssl@3
532532
- run: >-
533-
cmake -S. -Bcmake-build -DPOCO_MINIMAL_BUILD=ON -DENABLE_TRACE=ON -DENABLE_TESTS=ON
533+
cmake -S. -Bcmake-build -DPOCO_MINIMAL_BUILD=ON -DENABLE_TRACE=ON -DENABLE_TESTS=ON -DENABLE_INSTALL_CPPUNIT=ON
534534
-DENABLE_ACTIVERECORD=OFF -DENABLE_ACTIVERECORD_COMPILER=OFF -DENABLE_APACHECONNECTOR=OFF
535535
- run: cmake --build cmake-build --target all --parallel 4
536536
- uses: ./.github/actions/retry-action

CMakeLists.txt

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ endif()
219219
option(ENABLE_CPPUNIT
220220
"Set to OFF|ON (default is OFF) to enable CppUnit library" OFF)
221221

222+
option(ENABLE_INSTALL_CPPUNIT
223+
"Set to OFF|ON (default is OFF) to install CppUnit headers and libraries" OFF)
224+
222225
option(ENABLE_TESTS
223226
"Set to OFF|ON (default is OFF) to control build of POCO tests" OFF)
224227

@@ -288,6 +291,9 @@ endif()
288291
if(ENABLE_PDF)
289292
string(APPEND _opt_deps ", libpng")
290293
endif()
294+
if(ENABLE_TRACE)
295+
string(APPEND _opt_deps ", cpptrace")
296+
endif()
291297

292298
if(POCO_UNBUNDLED)
293299
# All bundled deps become external
@@ -438,6 +444,10 @@ if(ENABLE_POCODOC)
438444
set(ENABLE_DATA_SQLITE ON CACHE BOOL "Enable Data SQLite" FORCE)
439445
endif()
440446

447+
if(ENABLE_INSTALL_CPPUNIT)
448+
set(ENABLE_CPPUNIT ON CACHE BOOL "Enable CppUnit" FORCE)
449+
endif()
450+
441451
if(ENABLE_TESTS)
442452
set(ENABLE_CPPUNIT ON CACHE BOOL "Enable CppUnit" FORCE)
443453

@@ -645,11 +655,6 @@ if(EXISTS ${PROJECT_SOURCE_DIR}/Encodings/Compiler AND ENABLE_ENCODINGS_COMPILER
645655
list(APPEND Poco_COMPONENTS "EncodingsCompiler")
646656
endif()
647657

648-
if(ENABLE_TRACE)
649-
add_subdirectory(Trace)
650-
list(APPEND Poco_COMPONENTS "Trace")
651-
endif()
652-
653658
if(ENABLE_MODULES AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.28)
654659
add_subdirectory(modules)
655660
list(APPEND Poco_COMPONENTS "C++ modules")

CppUnit/CMakeLists.txt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,19 @@ elseif (MINGW)
3434
target_compile_definitions(CppUnit PUBLIC _DLL)
3535
endif()
3636

37-
install(
38-
DIRECTORY include/CppUnit
39-
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
40-
COMPONENT Devel
41-
)
37+
if(ENABLE_INSTALL_CPPUNIT)
38+
install(
39+
DIRECTORY include/CppUnit
40+
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
41+
COMPONENT Devel
42+
)
4243

43-
install(
44-
TARGETS CppUnit
45-
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
46-
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
47-
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
48-
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
49-
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
50-
)
44+
install(
45+
TARGETS CppUnit
46+
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
47+
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
48+
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
49+
BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR}
50+
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
51+
)
52+
endif()

Data/ODBC/ODBC.make

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ SYSLIBS += -L$(POCO_ODBC_LIB)
5151
## MinGW
5252
##
5353
ifeq ($(POCO_CONFIG),MinGW)
54-
# -DODBCVER=0x0300: SQLHandle declaration issue
54+
# -DODBCVER=0x0350: SQL_GUID type depends on ODBC version 0x0350 (ODBC 3.5)
5555
# -DNOMINMAX : MIN/MAX macros defined in windows conflict with libstdc++
56-
CXXFLAGS += -DODBCVER=0x0300 -DNOMINMAX
56+
CXXFLAGS += -DODBCVER=0x0350 -DNOMINMAX
5757

5858
##
5959
## unixODBC

Data/SQLite/testsuite/src/SQLiteTest.cpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,48 @@ void SQLiteTest::testBind()
305305
}
306306

307307

308+
void SQLiteTest::testAddBindingReuse()
309+
{
310+
Session session(Poco::Data::SQLite::Connector::KEY, "dummy.db");
311+
session << "DROP TABLE IF EXISTS test", now;
312+
session << "CREATE TABLE test (id INTEGER, name VARCHAR(30))", now;
313+
session << "INSERT INTO test VALUES(1, 'Alice')", now;
314+
session << "INSERT INTO test VALUES(2, 'Bob')", now;
315+
session << "INSERT INTO test VALUES(3, 'Charlie')", now;
316+
317+
Statement stmt(session);
318+
stmt << "SELECT name FROM test WHERE id = ?";
319+
320+
// first execute
321+
int id = 1;
322+
Poco::Data::AbstractBindingVec bindings;
323+
bindings.push_back(Poco::Data::Keywords::bind(id, "id"));
324+
stmt.addBinding(bindings, true);
325+
std::string name;
326+
stmt.addExtract(into(name));
327+
stmt.execute();
328+
assertTrue (name == "Alice");
329+
330+
// second execute with new binding — this is the bug scenario from #5220
331+
id = 2;
332+
Poco::Data::AbstractBindingVec bindings2;
333+
bindings2.push_back(Poco::Data::Keywords::bind(id, "id"));
334+
stmt.addBinding(bindings2, true);
335+
name.clear();
336+
stmt.execute();
337+
assertTrue (name == "Bob");
338+
339+
// third execute to confirm repeated reuse
340+
id = 3;
341+
Poco::Data::AbstractBindingVec bindings3;
342+
bindings3.push_back(Poco::Data::Keywords::bind(id, "id"));
343+
stmt.addBinding(bindings3, true);
344+
name.clear();
345+
stmt.execute();
346+
assertTrue (name == "Charlie");
347+
}
348+
349+
308350
void SQLiteTest::testBinding()
309351
{
310352
Session tmp (Poco::Data::SQLite::Connector::KEY, "dummy.db");
@@ -4061,6 +4103,7 @@ CppUnit::Test* SQLiteTest::suite()
40614103
CppUnit_addTest(pSuite, SQLiteTest, testIllegalFilePath);
40624104
CppUnit_addTest(pSuite, SQLiteTest, testTransactionTypeProperty);
40634105
CppUnit_addTest(pSuite, SQLiteTest, testRecordsetCopyMove);
4106+
CppUnit_addTest(pSuite, SQLiteTest, testAddBindingReuse);
40644107

40654108
return pSuite;
40664109
}

Data/SQLite/testsuite/src/SQLiteTest.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ class SQLiteTest: public CppUnit::TestCase
148148
void testTransactionTypeProperty();
149149

150150
void testRecordsetCopyMove();
151+
void testAddBindingReuse();
151152

152153
void setUp();
153154
void tearDown();

Data/include/Poco/Data/Statement.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,12 @@ class Data_API Statement
180180
Statement& addBinding(C& bindingCont, bool reset)
181181
/// Registers binding container with the Statement.
182182
{
183-
if (reset) _pImpl->resetBinding();
184-
typename C::iterator itAB = bindingCont.begin();
185-
typename C::iterator itABEnd = bindingCont.end();
186-
for (; itAB != itABEnd; ++itAB) addBind(*itAB);
183+
if (reset)
184+
{
185+
_pImpl->resetBinding();
186+
_pImpl->bindings().clear();
187+
}
188+
for (auto& ab : bindingCont) addBind(ab);
187189
return *this;
188190
}
189191

Data/samples/CMakeLists.txt

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
1-
add_subdirectory(Binding)
2-
add_subdirectory(RecordSet)
3-
add_subdirectory(RowFormatter)
4-
add_subdirectory(Tuple)
5-
add_subdirectory(TypeHandler)
6-
add_subdirectory(WebNotifier)
7-
add_subdirectory(DBLogger)
1+
if(ENABLE_DATA_SQLITE)
2+
add_subdirectory(Binding)
3+
add_subdirectory(RecordSet)
4+
add_subdirectory(RowFormatter)
5+
add_subdirectory(Tuple)
6+
add_subdirectory(TypeHandler)
7+
add_subdirectory(DBLogger)
8+
if(ENABLE_NET)
9+
add_subdirectory(WebNotifier)
10+
else()
11+
message(STATUS "Data sample WebNotifier requires Net and is not being built")
12+
endif()
13+
else()
14+
message(STATUS "Data samples Binding, RecordSet, RowFormatter, Tuple, TypeHandler, WebNotifier, DBLogger require SQLite and are not being built")
15+
endif()

Foundation/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ else()
180180
endif(CYGWIN)
181181

182182
if(ENABLE_TRACE)
183-
target_link_libraries(Foundation PRIVATE Poco::Trace)
183+
target_link_libraries(Foundation PRIVATE "$<BUILD_LOCAL_INTERFACE:cpptrace::cpptrace>")
184184
endif()
185185

186186
if(CMAKE_SYSTEM MATCHES "SunOS")
@@ -204,7 +204,7 @@ if(MINGW)
204204
_WIN32
205205
MINGW32
206206
WINVER=0x500
207-
ODBCVER=0x0300
207+
ODBCVER=0x0350
208208
POCO_THREAD_STACK_SIZE
209209
)
210210
endif()

Foundation/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include $(POCO_BASE)/build/rules/global
88

99
ifdef POCO_ENABLE_TRACE
10-
INCLUDE += -I $(POCO_BASE)/Trace/include/Poco/Trace
10+
INCLUDE += -I$(POCO_BASE)/dependencies/cpptrace/include
1111
endif
1212

1313
objects = ArchiveStrategy Ascii ASCIIEncoding AsyncChannel AsyncNotificationCenter ActiveThreadPool\
@@ -85,7 +85,7 @@ target = PocoFoundation
8585
target_version = $(LIBVERSION)
8686
target_libs =
8787
ifdef POCO_ENABLE_TRACE
88-
target_libs += PocoTrace
88+
target_libs += cpptrace
8989
endif
9090

9191
ifeq ($(findstring MinGW, $(POCO_CONFIG)), MinGW)

0 commit comments

Comments
 (0)