Typehandler simplification and other modernizations in Poco::Data (#5136)

* TypeHandler for std::tuple, used to implement TypeHandler for Poco::Tuple

* Removed obsolete using declarations in Data.cppm

* TypeHander: added missing typename

* Explicitly delete constructors of AbstractTypeHandler

* TypeHandler specialization for std::optional

* Data/MySQL: modernize loops and usage of virtual/override

* Poco::Tuple: formatting fix

* Poco::Data: more consistent usage of virtual/override and = delete

* Added test cases for std::tuple and std::optional (for MySQL and PostgreSQL)

* Poco::Data: more override annotations

* Added testcases for st::tuple and std::optional to SQLite.

* chore(Data): Improvements suggested by clang-tidy

---------

Co-authored-by: Matej Kenda <matejken@gmail.com>
This commit is contained in:
Friedrich Wilckens
2025-12-23 02:01:37 -08:00
committed by GitHub
parent 1850dc16aa
commit 7313ccfb27
63 changed files with 1292 additions and 6319 deletions

View File

@@ -85,14 +85,12 @@ std::size_t MySQLStatementImpl::next()
if (!hasNext())
throw StatementException("No data received");
Poco::Data::AbstractExtractionVec::iterator it = extractions().begin();
Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end();
std::size_t pos = 0;
for (; it != itEnd; ++it)
for (auto& ex: extractions())
{
(*it)->extract(pos);
pos += (*it)->numOfColumnsHandled();
ex->extract(pos);
pos += ex->numOfColumnsHandled();
}
_hasNext = NEXT_DONTKNOW;
@@ -139,16 +137,14 @@ void MySQLStatementImpl::compileImpl()
void MySQLStatementImpl::bindImpl()
{
Poco::Data::AbstractBindingVec& binds = bindings();
std::size_t pos = 0;
Poco::Data::AbstractBindingVec::iterator it = binds.begin();
Poco::Data::AbstractBindingVec::iterator itEnd = binds.end();
for (; it != itEnd && (*it)->canBind(); ++it)
{
(*it)->bind(pos);
pos += (*it)->numOfColumnsHandled();
}
std::size_t pos = 0;
for (auto& b: bindings())
{
if (!b->canBind())
break;
b->bind(pos);
pos += b->numOfColumnsHandled();
}
_stmt.bindParams(_pBinder->getBindArray(), _pBinder->size());
try
{