fix include order

This commit is contained in:
Günter Obiltschnig 2021-04-16 08:07:53 +02:00
parent fff8eb6f45
commit 65cfa49dd9
2 changed files with 75 additions and 74 deletions

View File

@ -18,13 +18,13 @@
#define Data_ODBC_Extractor_INCLUDED
#include "Poco/Data/Constants.h"
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/AbstractExtractor.h"
#include "Poco/Data/ODBC/Preparator.h"
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
#include "Poco/Data/ODBC/Error.h"
#include "Poco/Data/ODBC/Utility.h"
#include "Poco/Data/Constants.h"
#include "Poco/Data/AbstractExtractor.h"
#include "Poco/Data/Date.h"
#include "Poco/Data/Time.h"
#include "Poco/DateTime.h"
@ -52,7 +52,7 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
public:
typedef Preparator::Ptr PreparatorPtr;
Extractor(const StatementHandle& rStmt,
Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator);
/// Creates the Extractor.
@ -304,7 +304,7 @@ public:
bool extract(std::size_t pos, std::list<Poco::DateTime>& val);
/// Extracts a DateTime list.
bool extract(std::size_t pos, Poco::Any& val);
/// Extracts an Any.
@ -339,7 +339,7 @@ public:
/// Returns true if the value at [col,row] is null.
void reset();
/// Resets the internally cached length indicators.
/// Resets the internally cached length indicators.
private:
static const int CHUNK_SIZE = 1024;
@ -365,7 +365,7 @@ private:
{
if (isNull(pos)) return false;
poco_assert_dbg (typeid(T) == _pPreparator->at(pos).type());
val = *AnyCast<T>(&_pPreparator->at(pos));
val = *AnyCast<T>(&_pPreparator->at(pos));
return true;
}
@ -384,7 +384,7 @@ private:
bool extractBoundImplContainer(std::size_t pos, std::vector<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::deque<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::list<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::list<std::string>& values);
bool extractBoundImplContainer(std::size_t pos, std::vector<Poco::UTF16String>& values);
bool extractBoundImplContainer(std::size_t pos, std::deque<Poco::UTF16String>& values);
bool extractBoundImplContainer(std::size_t pos, std::list<Poco::UTF16String>& values);
@ -466,8 +466,8 @@ private:
resizeLengths(pos);
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
&value, //returned value
0, //buffer length (ignored)
@ -475,10 +475,10 @@ private:
if (Utility::isError(rc))
throw StatementException(_rStmt, "SQLGetData()");
if (isNullLengthIndicator(_lengths[pos]))
if (isNullLengthIndicator(_lengths[pos]))
return false;
else
else
{
//for fixed-length data, buffer must be large enough
//otherwise, driver may write past the end
@ -567,7 +567,7 @@ private:
case MetaColumn::FDT_TIMESTAMP:
{ return extAny<T, Poco::DateTime>(pos, val); }
default:
default:
throw DataFormatException("Unsupported data type.");
}
@ -575,8 +575,8 @@ private:
}
bool isNullLengthIndicator(SQLLEN val) const;
/// The reason for this utility wrapper are platforms where
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
/// The reason for this utility wrapper are platforms where
/// SQLLEN macro (a.k.a. SQLINTEGER) yields 64-bit value,
/// while SQL_NULL_DATA (#define'd as -1 literal) remains 32-bit.
SQLINTEGER columnSize(std::size_t pos) const;
@ -640,42 +640,42 @@ inline bool Extractor::extractBoundImplContainer(std::size_t pos, std::list<Poco
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::vector<Poco::Data::CLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::deque<Poco::Data::CLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::list<Poco::Data::CLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::vector<Poco::Data::BLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::deque<Poco::Data::BLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
}
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
inline bool Extractor::extractBoundImplContainer(std::size_t pos,
std::list<Poco::Data::BLOB>& values)
{
return extractBoundImplContainerLOB(pos, values);
@ -702,7 +702,7 @@ inline void Extractor::reset()
inline void Extractor::resizeLengths(std::size_t pos)
{
if (pos >= _lengths.size())
if (pos >= _lengths.size())
_lengths.resize(pos + 1, (SQLLEN) 0);
}

View File

@ -12,6 +12,7 @@
//
#include "Poco/Data/ODBC/ODBC.h"
#include "Poco/Data/ODBC/Extractor.h"
#include "Poco/Data/ODBC/ODBCMetaColumn.h"
#include "Poco/Data/ODBC/Utility.h"
@ -33,9 +34,9 @@ const std::string Extractor::FLD_SIZE_EXCEEDED_FMT = "Specified data size (%z by
"to increase the maximum allowed data size\n";
Extractor::Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator):
_rStmt(rStmt),
Extractor::Extractor(const StatementHandle& rStmt,
Preparator::Ptr pPreparator):
_rStmt(rStmt),
_pPreparator(pPreparator),
_dataExtraction(pPreparator->getDataExtraction())
{
@ -106,7 +107,7 @@ bool Extractor::extractBoundImpl<Poco::Data::Date>(std::size_t pos, Poco::Data::
template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::size_t pos,
std::vector<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
@ -116,7 +117,7 @@ bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Date> >(std::s
template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Date> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Date> >(std::size_t pos,
std::deque<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
@ -126,7 +127,7 @@ bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Date> >(std::si
template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Date> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Date> >(std::size_t pos,
std::list<Poco::Data::Date>& val)
{
std::vector<SQL_DATE_STRUCT>& ds = RefAnyCast<std::vector<SQL_DATE_STRUCT> >(_pPreparator->at(pos));
@ -150,7 +151,7 @@ bool Extractor::extractBoundImpl<Poco::Data::Time>(std::size_t pos, Poco::Data::
template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Time> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Time> >(std::size_t pos,
std::vector<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
@ -160,7 +161,7 @@ bool Extractor::extractBoundImplContainer<std::vector<Poco::Data::Time> >(std::s
template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Time> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Time> >(std::size_t pos,
std::deque<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
@ -170,7 +171,7 @@ bool Extractor::extractBoundImplContainer<std::deque<Poco::Data::Time> >(std::si
template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Time> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::list<Poco::Data::Time> >(std::size_t pos,
std::list<Poco::Data::Time>& val)
{
std::vector<SQL_TIME_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIME_STRUCT> >(_pPreparator->at(pos));
@ -194,7 +195,7 @@ bool Extractor::extractBoundImpl<Poco::DateTime>(std::size_t pos, Poco::DateTime
template<>
bool Extractor::extractBoundImplContainer<std::vector<Poco::DateTime> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<Poco::DateTime> >(std::size_t pos,
std::vector<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
@ -204,7 +205,7 @@ bool Extractor::extractBoundImplContainer<std::vector<Poco::DateTime> >(std::siz
template<>
bool Extractor::extractBoundImplContainer<std::deque<Poco::DateTime> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::deque<Poco::DateTime> >(std::size_t pos,
std::deque<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
@ -214,7 +215,7 @@ bool Extractor::extractBoundImplContainer<std::deque<Poco::DateTime> >(std::size
template<>
bool Extractor::extractBoundImplContainer<std::list<Poco::DateTime> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::list<Poco::DateTime> >(std::size_t pos,
std::list<Poco::DateTime>& val)
{
std::vector<SQL_TIMESTAMP_STRUCT>& ds = RefAnyCast<std::vector<SQL_TIMESTAMP_STRUCT> >(_pPreparator->at(pos));
@ -224,7 +225,7 @@ bool Extractor::extractBoundImplContainer<std::list<Poco::DateTime> >(std::size_
template<>
bool Extractor::extractBoundImplContainer<std::vector<bool> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::vector<bool> >(std::size_t pos,
std::vector<bool>& val)
{
std::size_t length = _pPreparator->getLength();
@ -235,7 +236,7 @@ bool Extractor::extractBoundImplContainer<std::vector<bool> >(std::size_t pos,
template<>
bool Extractor::extractBoundImplContainer<std::deque<bool> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::deque<bool> >(std::size_t pos,
std::deque<bool>& val)
{
std::size_t length = _pPreparator->getLength();
@ -246,7 +247,7 @@ bool Extractor::extractBoundImplContainer<std::deque<bool> >(std::size_t pos,
template<>
bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
bool Extractor::extractBoundImplContainer<std::list<bool> >(std::size_t pos,
std::list<bool>& val)
{
std::size_t length = _pPreparator->getLength();
@ -262,13 +263,13 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
std::size_t maxSize = _pPreparator->getMaxFieldSize();
std::size_t fetchedSize = 0;
std::size_t totalSize = 0;
SQLLEN len;
const int bufSize = CHUNK_SIZE;
Poco::Buffer<char> apChar(bufSize);
char* pChar = apChar.begin();
SQLRETURN rc = 0;
val.clear();
resizeLengths(pos);
@ -276,8 +277,8 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
{
std::memset(pChar, 0, bufSize);
len = 0;
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
pChar, //returned value
bufSize, //buffer length
@ -301,9 +302,9 @@ bool Extractor::extractManualImpl<std::string>(std::size_t pos, std::string& val
_lengths[pos] += len;
fetchedSize = _lengths[pos] > CHUNK_SIZE ? CHUNK_SIZE : _lengths[pos];
totalSize += fetchedSize;
if (totalSize <= maxSize)
if (totalSize <= maxSize)
val.append(pChar, fetchedSize);
else
else
throw DataException(format(FLD_SIZE_EXCEEDED_FMT, fetchedSize, maxSize));
}while (true);
@ -367,8 +368,8 @@ bool Extractor::extractManualImpl<UTF16String>(std::size_t pos, UTF16String& val
template<>
bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
Poco::Data::CLOB& val,
bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
Poco::Data::CLOB& val,
SQLSMALLINT cType)
{
std::size_t maxSize = _pPreparator->getMaxFieldSize();
@ -380,7 +381,7 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
Poco::Buffer<char> apChar(bufSize);
char* pChar = apChar.begin();
SQLRETURN rc = 0;
val.clear();
resizeLengths(pos);
@ -388,13 +389,13 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
{
std::memset(pChar, 0, bufSize);
len = 0;
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
pChar, //returned value
bufSize, //buffer length
&len); //length indicator
_lengths[pos] += len;
if (SQL_NO_DATA != rc && Utility::isError(rc))
@ -411,9 +412,9 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
fetchedSize = len > CHUNK_SIZE ? CHUNK_SIZE : len;
totalSize += fetchedSize;
if (totalSize <= maxSize)
if (totalSize <= maxSize)
val.appendRaw(pChar, fetchedSize);
else
else
throw DataException(format(FLD_SIZE_EXCEEDED_FMT, fetchedSize, maxSize));
}while (true);
@ -423,26 +424,26 @@ bool Extractor::extractManualImpl<Poco::Data::CLOB>(std::size_t pos,
template<>
bool Extractor::extractManualImpl<Poco::Data::Date>(std::size_t pos,
Poco::Data::Date& val,
bool Extractor::extractManualImpl<Poco::Data::Date>(std::size_t pos,
Poco::Data::Date& val,
SQLSMALLINT cType)
{
SQL_DATE_STRUCT ds;
resizeLengths(pos);
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
&ds, //returned value
sizeof(ds), //buffer length
&_lengths[pos]); //length indicator
if (Utility::isError(rc))
throw StatementException(_rStmt, "SQLGetData()");
if (isNullLengthIndicator(_lengths[pos]))
if (isNullLengthIndicator(_lengths[pos]))
return false;
else
else
Utility::dateSync(val, ds);
return true;
@ -450,26 +451,26 @@ bool Extractor::extractManualImpl<Poco::Data::Date>(std::size_t pos,
template<>
bool Extractor::extractManualImpl<Poco::Data::Time>(std::size_t pos,
Poco::Data::Time& val,
bool Extractor::extractManualImpl<Poco::Data::Time>(std::size_t pos,
Poco::Data::Time& val,
SQLSMALLINT cType)
{
SQL_TIME_STRUCT ts;
resizeLengths(pos);
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
&ts, //returned value
sizeof(ts), //buffer length
&_lengths[pos]); //length indicator
if (Utility::isError(rc))
throw StatementException(_rStmt, "SQLGetData()");
if (isNullLengthIndicator(_lengths[pos]))
if (isNullLengthIndicator(_lengths[pos]))
return false;
else
else
Utility::timeSync(val, ts);
return true;
@ -477,26 +478,26 @@ bool Extractor::extractManualImpl<Poco::Data::Time>(std::size_t pos,
template<>
bool Extractor::extractManualImpl<Poco::DateTime>(std::size_t pos,
Poco::DateTime& val,
bool Extractor::extractManualImpl<Poco::DateTime>(std::size_t pos,
Poco::DateTime& val,
SQLSMALLINT cType)
{
SQL_TIMESTAMP_STRUCT ts;
resizeLengths(pos);
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
SQLRETURN rc = SQLGetData(_rStmt,
(SQLUSMALLINT) pos + 1,
cType, //C data type
&ts, //returned value
sizeof(ts), //buffer length
&_lengths[pos]); //length indicator
if (Utility::isError(rc))
throw StatementException(_rStmt, "SQLGetData()");
if (isNullLengthIndicator(_lengths[pos]))
if (isNullLengthIndicator(_lengths[pos]))
return false;
else
else
Utility::dateTimeSync(val, ts);
return true;
@ -1307,10 +1308,10 @@ bool Extractor::isNull(std::size_t col, std::size_t row)
try
{
return isNullLengthIndicator(_lengths.at(col));
}
}
catch (std::out_of_range& ex)
{
throw RangeException(ex.what());
throw RangeException(ex.what());
}
}
else