1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2025-07-09 10:27:10 +02:00

Update POCO to 1.11.0

This commit is contained in:
Sandu Liviu Catalin
2021-08-22 18:07:06 +03:00
parent 151077c799
commit 7a3d92d1d1
450 changed files with 25219 additions and 6528 deletions

View File

@ -176,6 +176,13 @@ void Binder::bind(std::size_t pos, const Time& val, Direction dir)
}
void Binder::bind(std::size_t pos, const UUID& val, Direction dir)
{
poco_assert(dir == PD_IN);
realBind(pos, Poco::Data::MetaColumn::FDT_UUID, &val, sizeof(UUID));
}
void Binder::bind(std::size_t pos, const NullData&, Direction dir)
{
poco_assert(dir == PD_IN);
@ -198,8 +205,8 @@ Binder::bindVector() const
void Binder::updateBindVectorToCurrentValues()
{
InputParameterVector::iterator itr = _bindVector.begin();
InputParameterVector::iterator itrEnd = _bindVector.end();
InputParameterVector::iterator itr = _bindVector.begin();
InputParameterVector::iterator itrEnd = _bindVector.end();
for (; itr != itrEnd; ++itr)
{
@ -293,6 +300,14 @@ void Binder::updateBindVectorToCurrentValues()
const Poco::Data::CLOB& clob = * static_cast<const Poco::Data::CLOB*>(itr->pData());
itr->setNonStringVersionRepresentation(static_cast<const void*> (clob.rawContent()), clob.size());
}
break;
case Poco::Data::MetaColumn::FDT_UUID:
{
const Poco::UUID& uuid = * static_cast<const Poco::UUID*>(itr->pData());
itr->setStringVersionRepresentation(uuid.toString());
}
break;
case Poco::Data::MetaColumn::FDT_UNKNOWN:
default:

View File

@ -17,6 +17,8 @@
#include "Poco/Data/Time.h"
#include "Poco/NumberParser.h"
#include "Poco/DateTimeParser.h"
#include "Poco/MemoryStream.h"
#include "Poco/HexBinaryDecoder.h"
#include <limits>
@ -42,14 +44,10 @@ bool Extractor::extract(std::size_t pos, Poco::Int8& val)
OutputParameter outputParameter = extractPreamble(pos);
int tempVal = 0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParse(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse(outputParameter.pData(), tempVal))
{
return false;
}
val = static_cast<Int8>(tempVal);
return true;
@ -61,15 +59,11 @@ bool Extractor::extract(std::size_t pos, Poco::UInt8& val)
OutputParameter outputParameter = extractPreamble(pos);
unsigned int tempVal = 0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter)|| !Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), tempVal))
{
return false;
}
val = static_cast<Int8>(tempVal);
val = static_cast<UInt8>(tempVal);
return true;
}
@ -80,15 +74,11 @@ bool Extractor::extract(std::size_t pos, Poco::Int16& val)
OutputParameter outputParameter = extractPreamble(pos);
int tempVal = 0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParse(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse(outputParameter.pData(), tempVal))
{
return false;
}
val = static_cast<Int8>(tempVal);
val = static_cast<Int16>(tempVal);
return true;
}
@ -99,15 +89,11 @@ bool Extractor::extract(std::size_t pos, Poco::UInt16& val)
OutputParameter outputParameter = extractPreamble(pos);
unsigned int tempVal = 0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), tempVal))
{
return false;
}
val = static_cast<Int8>(tempVal);
val = static_cast<UInt16>(tempVal);
return true;
}
@ -117,9 +103,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int32& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParse(outputParameter.pData(), val)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse(outputParameter.pData(), val))
{
return false;
}
@ -132,9 +116,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt32& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), val)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseUnsigned(outputParameter.pData(), val))
{
return false;
}
@ -147,9 +129,7 @@ bool Extractor::extract(std::size_t pos, Poco::Int64& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParse64(outputParameter.pData(), val)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse64(outputParameter.pData(), val))
{
return false;
}
@ -162,9 +142,7 @@ bool Extractor::extract(std::size_t pos, Poco::UInt64& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseUnsigned64(outputParameter.pData(), val)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseUnsigned64(outputParameter.pData(), val))
{
return false;
}
@ -179,13 +157,10 @@ bool Extractor::extract(std::size_t pos, long& val)
OutputParameter outputParameter = extractPreamble(pos);
Poco::Int64 tempVal = 0;
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse64(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParse64(outputParameter.pData(), tempVal))
{
return false;
}
val = (long)tempVal;
return true;
@ -197,14 +172,10 @@ bool Extractor::extract(std::size_t pos, unsigned long& val)
OutputParameter outputParameter = extractPreamble(pos);
Poco::UInt64 tempVal = 0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseUnsigned64(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseUnsigned64(outputParameter.pData(), tempVal))
{
return false;
}
val = (unsigned long)tempVal;
return true;
@ -216,19 +187,12 @@ bool Extractor::extract(std::size_t pos, bool& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter))
if (isColumnNull(outputParameter))
{
return false;
}
if ('t' == *outputParameter.pData())
{
val = true;
}
else
{
val = false;
}
val = 't' == *outputParameter.pData();
return true;
}
@ -239,15 +203,11 @@ bool Extractor::extract(std::size_t pos, float& val)
OutputParameter outputParameter = extractPreamble(pos);
double tempVal = 0.0;
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseFloat(outputParameter.pData(), tempVal)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseFloat(outputParameter.pData(), tempVal))
{
return false;
}
val = (float)tempVal;
val = static_cast<float>(tempVal);
return true;
}
@ -257,9 +217,7 @@ bool Extractor::extract(std::size_t pos, double& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if ( isColumnNull(outputParameter)
|| ! Poco::NumberParser::tryParseFloat(outputParameter.pData(), val)
)
if (isColumnNull(outputParameter) || !Poco::NumberParser::tryParseFloat(outputParameter.pData(), val))
{
return false;
}
@ -272,11 +230,10 @@ bool Extractor::extract(std::size_t pos, char& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if (isColumnNull(outputParameter))
if (isColumnNull(outputParameter))
{
return false;
}
val = *outputParameter.pData();
return true;
@ -291,7 +248,6 @@ bool Extractor::extract(std::size_t pos, std::string& val)
{
return false;
}
val.assign(outputParameter.pData(), outputParameter.size());
return true;
@ -309,31 +265,24 @@ bool Extractor::extract(std::size_t pos, Poco::Data::BLOB& val)
// convert the PostgreSQL text format to binary and append to the BLOB
// Format: \x10843029479abcf ... two characters for every byte
//
// The code below can be made more efficient by converting more than one byte at a time
// also if BLOB had a resize method it would be useful to allocate memory in one
// attempt.
//
const char * pBLOB = reinterpret_cast<const char*>(outputParameter.pData());
std::size_t BLOBSize = outputParameter.size();
std::size_t blobSize = outputParameter.size();
val = Poco::Data::BLOB(); // don't share contents with _default
if ( '\\' == pBLOB[0]
&& 'x' == pBLOB[1] // preamble to BYTEA data format in text form is \x
)
if (blobSize > 2 && '\\' == pBLOB[0] && 'x' == pBLOB[1]) // preamble to BYTEA data format in text form is \x
{
BLOBSize -= 2; // lose the preamble
BLOBSize /= 2; // each byte is encoded as two text characters
blobSize -= 2; // lose the preamble
for (int i = 0; i < BLOBSize * 2; i += 2)
Poco::MemoryInputStream mistr(pBLOB + 2, blobSize);
Poco::HexBinaryDecoder decoder(mistr);
auto* pDecoderBuf = decoder.rdbuf();
blobSize /= 2;
val.resize(blobSize);
char* pData = reinterpret_cast<char*>(val.rawContent());
while (blobSize-- > 0)
{
std::string buffer(&pBLOB[i + 2], 2);
unsigned int binaryBuffer = 0;
if (Poco::NumberParser::tryParseHex(buffer, binaryBuffer))
{
UInt8 finalBinaryBuffer = static_cast<UInt8>(binaryBuffer); // downsize
val.appendRaw(&finalBinaryBuffer, 1);
}
*pData++ = pDecoderBuf->sbumpc();
}
}
return true;
@ -348,7 +297,6 @@ bool Extractor::extract(std::size_t pos, Poco::Data::CLOB& val)
{
return false;
}
val.assignRaw(outputParameter.pData(), outputParameter.size());
return true;
@ -366,14 +314,11 @@ bool Extractor::extract(std::size_t pos, DateTime& val)
int tzd = -1;
DateTime dateTime;
if (! DateTimeParser::tryParse(outputParameter.pData(), dateTime, tzd))
if (!DateTimeParser::tryParse(outputParameter.pData(), dateTime, tzd))
{
return false;
}
dateTime.makeUTC(tzd);
val = dateTime;
return true;
@ -388,17 +333,13 @@ bool Extractor::extract(std::size_t pos, Date& val)
{
return false;
}
int tzd = -1;
DateTime dateTime;
if (! DateTimeParser::tryParse(outputParameter.pData(), dateTime, tzd))
if (!DateTimeParser::tryParse(outputParameter.pData(), dateTime, tzd))
{
return false;
}
dateTime.makeUTC(tzd);
val.assign(dateTime.year(), dateTime.month(), dateTime.day());
return true;
@ -413,10 +354,8 @@ bool Extractor::extract(std::size_t pos, Time& val)
{
return false;
}
int tzd = -1;
DateTime dateTime;
if (! DateTimeParser::tryParse("%H:%M:%s%z", outputParameter.pData(), dateTime, tzd))
{
return false;
@ -431,15 +370,28 @@ bool Extractor::extract(std::size_t pos, Time& val)
}
bool Extractor::extract(std::size_t pos, UUID& val)
{
OutputParameter outputParameter = extractPreamble(pos);
if (isColumnNull(outputParameter))
{
return false;
}
return val.tryParse(outputParameter.pData());
}
bool Extractor::extract(std::size_t pos, Any& val)
{
return extractStringImpl (pos, val);
return extractStringImpl(pos, val);
}
bool Extractor::extract(std::size_t pos, Dynamic::Var& val)
{
return extractStringImpl (pos, val);
return extractToDynamic(pos, val);
}
@ -462,8 +414,7 @@ void Extractor::reset()
}
const OutputParameter&
Extractor::extractPreamble(std::size_t aPosition) const
const OutputParameter& Extractor::extractPreamble(std::size_t aPosition) const
{
if (_statementExecutor.columnsReturned() <= aPosition)
{
@ -474,11 +425,125 @@ Extractor::extractPreamble(std::size_t aPosition) const
}
bool
Extractor::isColumnNull (const OutputParameter& anOutputParameter) const
bool Extractor::isColumnNull(const OutputParameter& anOutputParameter) const
{
return anOutputParameter.isNull()
|| 0 == anOutputParameter.pData();
return anOutputParameter.isNull() || 0 == anOutputParameter.pData();
}
bool Extractor::extractToDynamic(std::size_t pos, Dynamic::Var& val)
{
OutputParameter outputParameter = _statementExecutor.resultColumn(pos);
if (isColumnNull(outputParameter))
{
return false;
}
const std::string tempString{outputParameter.pData(), outputParameter.size()};
const Oid oid = outputParameter.internalFieldType();
bool success = false;
switch (oid)
{
case BOOLOID:
{
success = true;
if (tempString[0] == 't')
val = true;
else
val = false;
break;
}
case INT2OID:
case INT4OID:
case INT8OID:
{
Poco::Int64 tempValue = 0;
success = Poco::NumberParser::tryParse64(tempString, tempValue);
if (success)
val = tempValue;
break;
}
// floating point
case FLOAT8OID:
case FLOAT4OID:
case NUMERICOID:
{
double tempValue = 0;
success = Poco::NumberParser::tryParseFloat(tempString, tempValue);
if (success)
val = tempValue;
break;
}
// character strings
case CHAROID:
case BPCHAROID:
case VARCHAROID:
default:
{
success = true;
val = tempString;
break;
}
// BLOB, CLOB
case BYTEAOID:
{
Poco::Data::BLOB blob;
success = extract(pos, blob);
if (success)
val = blob;
break;
}
case TEXTOID:
{
Poco::Data::CLOB clob;
success = extract(pos, clob);
if (success)
val = clob;
break;
}
// date
case DATEOID:
{
Date d;
success = extract(pos, d);
if (success)
val = d;
break;
}
// time
case TIMEOID:
case TIMETZOID:
{
Time t;
success = extract(pos, t);
if (success)
val = t;
break;
}
//timestamp
case TIMESTAMPOID:
case TIMESTAMPZOID:
{
DateTime dt;
success = extract(pos, dt);
if (success)
val = dt;
break;
}
case UUIDOID:
{
UUID uuid;
success = extract(pos, uuid);
if (success)
val = uuid;
break;
}
}
return success;
}
@ -487,381 +552,381 @@ Extractor::isColumnNull (const OutputParameter& anOutputParameter) const
//////////////
bool Extractor::extract(std::size_t , std::vector<Poco::Int8>&)
bool Extractor::extract(std::size_t, std::vector<Poco::Int8>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int8>&)
bool Extractor::extract(std::size_t, std::deque<Poco::Int8>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int8>&)
bool Extractor::extract(std::size_t, std::list<Poco::Int8>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt8>&)
bool Extractor::extract(std::size_t, std::vector<Poco::UInt8>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt8>&)
bool Extractor::extract(std::size_t, std::deque<Poco::UInt8>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt8>&)
bool Extractor::extract(std::size_t, std::list<Poco::UInt8>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int16>&)
bool Extractor::extract(std::size_t, std::vector<Poco::Int16>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int16>&)
bool Extractor::extract(std::size_t, std::deque<Poco::Int16>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int16>&)
bool Extractor::extract(std::size_t, std::list<Poco::Int16>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt16>&)
bool Extractor::extract(std::size_t, std::vector<Poco::UInt16>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt16>&)
bool Extractor::extract(std::size_t, std::deque<Poco::UInt16>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt16>&)
bool Extractor::extract(std::size_t, std::list<Poco::UInt16>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int32>&)
bool Extractor::extract(std::size_t, std::vector<Poco::Int32>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int32>&)
bool Extractor::extract(std::size_t, std::deque<Poco::Int32>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int32>&)
bool Extractor::extract(std::size_t, std::list<Poco::Int32>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt32>&)
bool Extractor::extract(std::size_t, std::vector<Poco::UInt32>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt32>&)
bool Extractor::extract(std::size_t, std::deque<Poco::UInt32>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt32>&)
bool Extractor::extract(std::size_t, std::list<Poco::UInt32>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::Int64>&)
bool Extractor::extract(std::size_t, std::vector<Poco::Int64>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::Int64>&)
bool Extractor::extract(std::size_t, std::deque<Poco::Int64>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::Int64>&)
bool Extractor::extract(std::size_t, std::list<Poco::Int64>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Poco::UInt64>&)
bool Extractor::extract(std::size_t, std::vector<Poco::UInt64>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Poco::UInt64>&)
bool Extractor::extract(std::size_t, std::deque<Poco::UInt64>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Poco::UInt64>&)
bool Extractor::extract(std::size_t, std::list<Poco::UInt64>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#ifndef POCO_INT64_IS_LONG
bool Extractor::extract(std::size_t , std::vector<long>&)
bool Extractor::extract(std::size_t, std::vector<long>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<long>&)
bool Extractor::extract(std::size_t, std::deque<long>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<long>&)
bool Extractor::extract(std::size_t, std::list<long>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
#endif
bool Extractor::extract(std::size_t , std::vector<bool>&)
bool Extractor::extract(std::size_t, std::vector<bool>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<bool>&)
bool Extractor::extract(std::size_t, std::deque<bool>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<bool>&)
bool Extractor::extract(std::size_t, std::list<bool>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<float>&)
bool Extractor::extract(std::size_t, std::vector<float>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<float>&)
bool Extractor::extract(std::size_t, std::deque<float>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<float>&)
bool Extractor::extract(std::size_t, std::list<float>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<double>&)
bool Extractor::extract(std::size_t, std::vector<double>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<double>&)
bool Extractor::extract(std::size_t, std::deque<double>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<double>&)
bool Extractor::extract(std::size_t, std::list<double>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<char>&)
bool Extractor::extract(std::size_t, std::vector<char>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<char>&)
bool Extractor::extract(std::size_t, std::deque<char>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<char>&)
bool Extractor::extract(std::size_t, std::list<char>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<std::string>&)
bool Extractor::extract(std::size_t, std::vector<std::string>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<std::string>&)
bool Extractor::extract(std::size_t, std::deque<std::string>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<std::string>&)
bool Extractor::extract(std::size_t, std::list<std::string>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<BLOB>&)
bool Extractor::extract(std::size_t, std::vector<BLOB>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<BLOB>&)
bool Extractor::extract(std::size_t, std::deque<BLOB>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<BLOB>&)
bool Extractor::extract(std::size_t, std::list<BLOB>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<CLOB>&)
bool Extractor::extract(std::size_t, std::vector<CLOB>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<CLOB>&)
bool Extractor::extract(std::size_t, std::deque<CLOB>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<CLOB>&)
bool Extractor::extract(std::size_t, std::list<CLOB>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<DateTime>&)
bool Extractor::extract(std::size_t, std::vector<DateTime>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<DateTime>&)
bool Extractor::extract(std::size_t, std::deque<DateTime>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<DateTime>&)
bool Extractor::extract(std::size_t, std::list<DateTime>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Date>&)
bool Extractor::extract(std::size_t, std::vector<Date>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Date>&)
bool Extractor::extract(std::size_t, std::deque<Date>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Date>&)
bool Extractor::extract(std::size_t, std::list<Date>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Time>&)
bool Extractor::extract(std::size_t, std::vector<Time>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Time>&)
bool Extractor::extract(std::size_t, std::deque<Time>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Time>&)
bool Extractor::extract(std::size_t, std::list<Time>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Any>&)
bool Extractor::extract(std::size_t, std::vector<Any>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Any>&)
bool Extractor::extract(std::size_t, std::deque<Any>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Any>&)
bool Extractor::extract(std::size_t, std::list<Any>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::vector<Dynamic::Var>&)
bool Extractor::extract(std::size_t, std::vector<Dynamic::Var>&)
{
throw NotImplementedException("std::vector extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::deque<Dynamic::Var>&)
bool Extractor::extract(std::size_t, std::deque<Dynamic::Var>&)
{
throw NotImplementedException("std::deque extractor must be implemented.");
}
bool Extractor::extract(std::size_t , std::list<Dynamic::Var>&)
bool Extractor::extract(std::size_t, std::list<Dynamic::Var>&)
{
throw NotImplementedException("std::list extractor must be implemented.");
}

View File

@ -108,8 +108,7 @@ bool PostgreSQLStatementImpl::canBind() const
{
bool ret = false;
if ((_statementExecutor.state() >= StatementExecutor::STMT_COMPILED)
&& !bindings().empty())
if ((_statementExecutor.state() >= StatementExecutor::STMT_COMPILED) && !bindings().empty())
{
ret = (*bindings().begin())->canBind();
}

View File

@ -94,6 +94,11 @@ Poco::Data::MetaColumn::ColumnDataType oidToColumnDataType(const Oid anOID)
cdt = Poco::Data::MetaColumn::FDT_TIMESTAMP;
break;
//uuid
case UUIDOID:
cdt = Poco::Data::MetaColumn::FDT_BLOB;
break;
// everything else is a string
default:
cdt = Poco::Data::MetaColumn::FDT_STRING;

View File

@ -86,7 +86,7 @@ void SessionHandle::connect(const std::string& aConnectionString)
_pConnection = PQconnectdb(aConnectionString.c_str());
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw ConnectionFailedException(std::string("Connection Error: ") + lastErrorNoLock());
}
@ -151,6 +151,7 @@ void SessionHandle::disconnect()
}
}
// TODO: Figure out what happens if a connection is reset with a pending transaction
bool SessionHandle::reset()
{
@ -174,7 +175,7 @@ std::string SessionHandle::lastError() const
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
return std::string();
}
@ -196,7 +197,7 @@ void SessionHandle::startTransaction()
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -223,7 +224,7 @@ void SessionHandle::commit()
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -247,7 +248,7 @@ void SessionHandle::rollback()
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -291,7 +292,7 @@ void SessionHandle::setAsynchronousCommit(bool aShouldAsynchronousCommit)
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -318,7 +319,7 @@ void SessionHandle::cancel()
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -335,7 +336,7 @@ void SessionHandle::setTransactionIsolation(Poco::UInt32 aTI)
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -345,7 +346,7 @@ void SessionHandle::setTransactionIsolation(Poco::UInt32 aTI)
return;
}
if (! hasTransactionIsolation(aTI))
if (!hasTransactionIsolation(aTI))
{
throw Poco::InvalidArgumentException("setTransactionIsolation()");
}
@ -354,12 +355,12 @@ void SessionHandle::setTransactionIsolation(Poco::UInt32 aTI)
switch (aTI)
{
case Session::TRANSACTION_READ_COMMITTED:
isolationLevel = POSTGRESQL_READ_COMMITTED; break;
case Session::TRANSACTION_REPEATABLE_READ:
isolationLevel = POSTGRESQL_REPEATABLE_READ; break;
case Session::TRANSACTION_SERIALIZABLE:
isolationLevel = POSTGRESQL_SERIALIZABLE; break;
case Session::TRANSACTION_READ_COMMITTED:
isolationLevel = POSTGRESQL_READ_COMMITTED; break;
case Session::TRANSACTION_REPEATABLE_READ:
isolationLevel = POSTGRESQL_REPEATABLE_READ; break;
case Session::TRANSACTION_SERIALIZABLE:
isolationLevel = POSTGRESQL_SERIALIZABLE; break;
}
PGresult* pPQResult = PQexec(_pConnection, Poco::format("SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL %s", isolationLevel).c_str());
@ -393,12 +394,12 @@ void SessionHandle::deallocatePreparedStatement(const std::string& aPreparedStat
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
if (! _inTransaction)
if (!_inTransaction)
{
deallocatePreparedStatementNoLock(aPreparedStatementToDeAllocate);
}
@ -431,7 +432,7 @@ void SessionHandle::deallocatePreparedStatementNoLock(const std::string& aPrepar
void SessionHandle::deallocateStoredPreparedStatements()
{
// DO NOT ACQUIRE THE MUTEX IN PRIVATE METHODS
while (! _preparedStatementsToBeDeallocated.empty())
while (!_preparedStatementsToBeDeallocated.empty())
{
deallocatePreparedStatementNoLock(_preparedStatementsToBeDeallocated.back());
@ -444,7 +445,7 @@ int SessionHandle::serverVersion() const
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -457,7 +458,7 @@ int SessionHandle::serverProcessID() const
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -470,7 +471,7 @@ int SessionHandle::protocoVersion() const
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -483,7 +484,7 @@ std::string SessionHandle::clientEncoding() const
{
Poco::FastMutex::ScopedLock mutexLocker(_sessionMutex);
if (! isConnectedNoLock())
if (!isConnectedNoLock())
{
throw NotConnectedException();
}
@ -502,7 +503,7 @@ SessionParametersMap SessionHandle::setConnectionInfoParameters(PQconninfoOption
{
SessionParametersMap sessionParametersMap;
while (0 != pConnInfOpt->keyword)
while (pConnInfOpt->keyword)
{
try
{
@ -542,7 +543,7 @@ SessionParametersMap SessionHandle::connectionDefaultParameters()
SessionParametersMap SessionHandle::connectionParameters() const
{
if (! isConnected())
if (!isConnected())
{
throw NotConnectedException();
}

View File

@ -38,7 +38,7 @@ namespace
{
std::string connectionString;
for (std::map<std::string, std::string>::const_iterator citr = anOptionsMap.begin(); citr != anOptionsMap.end(); ++citr)
for (auto citr = anOptionsMap.begin(); citr != anOptionsMap.end(); ++citr)
{
connectionString.append(citr->first);
connectionString.append("=");
@ -57,7 +57,8 @@ namespace PostgreSQL {
SessionImpl::SessionImpl(const std::string& aConnectionString, std::size_t aLoginTimeout):
Poco::Data::AbstractSessionImpl<SessionImpl>(aConnectionString, aLoginTimeout)
Poco::Data::AbstractSessionImpl<SessionImpl>(aConnectionString, aLoginTimeout),
_connectorName("postgresql")
{
setProperty("handle", static_cast<SessionHandle*>(&_sessionHandle));
setConnectionTimeout(CONNECTION_TIMEOUT_DEFAULT);
@ -92,7 +93,7 @@ void SessionImpl::open(const std::string& aConnectionString)
throw ConnectionException("Session already connected");
}
if (! aConnectionString.empty())
if (!aConnectionString.empty())
{
setConnectionString(aConnectionString);
}

View File

@ -46,7 +46,6 @@ namespace
Poco::RegularExpression::Match match = { 0 , 0 }; // Match is a struct, not a class :-(
std::size_t startingPosition = 0;
while (match.offset != std::string::npos)
{
try
@ -110,7 +109,7 @@ StatementExecutor::State StatementExecutor::state() const
void StatementExecutor::prepare(const std::string& aSQLStatement)
{
if (! _sessionHandle.isConnected()) throw NotConnectedException();
if (!_sessionHandle.isConnected()) throw NotConnectedException();
if (_state >= STMT_COMPILED) return;
// clear out the metadata. One way or another it is now obsolete.
@ -160,7 +159,7 @@ void StatementExecutor::prepare(const std::string& aSQLStatement)
{
PQResultClear resultClearer(ptrPGResult);
if (! ptrPGResult || PQresultStatus(ptrPGResult) != PGRES_COMMAND_OK)
if (!ptrPGResult || PQresultStatus(ptrPGResult) != PGRES_COMMAND_OK)
{
throw StatementException(std::string("postgresql_stmt_describe error: ") +
PQresultErrorMessage (ptrPGResult) + " " + aSQLStatement);
@ -186,7 +185,7 @@ void StatementExecutor::prepare(const std::string& aSQLStatement)
void StatementExecutor::bindParams(const InputParameterVector& anInputParameterVector)
{
if (! _sessionHandle.isConnected()) throw NotConnectedException();
if (!_sessionHandle.isConnected()) throw NotConnectedException();
if (_state < STMT_COMPILED) throw StatementException("Statement is not compiled yet");
@ -203,7 +202,7 @@ void StatementExecutor::bindParams(const InputParameterVector& anInputParameterV
void StatementExecutor::execute()
{
if (! _sessionHandle.isConnected()) throw NotConnectedException();
if (!_sessionHandle.isConnected()) throw NotConnectedException();
if (_state < STMT_COMPILED) throw StatementException("Statement is not compiled yet");
@ -225,8 +224,8 @@ void StatementExecutor::execute()
std::vector<int> parameterLengthVector;
std::vector<int> parameterFormatVector;
InputParameterVector::const_iterator cItr = _inputParameterVector.begin();
InputParameterVector::const_iterator cItrEnd = _inputParameterVector.end();
InputParameterVector::const_iterator cItr = _inputParameterVector.begin();
InputParameterVector::const_iterator cItrEnd = _inputParameterVector.end();
for (; cItr != cItrEnd; ++cItr)
{
@ -315,7 +314,7 @@ void StatementExecutor::execute()
bool StatementExecutor::fetch()
{
if (! _sessionHandle.isConnected())
if (!_sessionHandle.isConnected())
{
throw NotConnectedException();
}

View File

@ -27,13 +27,9 @@ namespace PostgreSQL {
std::string Utility::serverInfo(SessionHandle* aHandlePtr)
{
std::string srvrInfo = "Process ID: ";
srvrInfo.append(Poco::NumberFormatter::format(aHandlePtr->serverProcessID()));
srvrInfo.append(" Protocol Version: ");
srvrInfo.append(Poco::NumberFormatter::format(aHandlePtr->protocoVersion()));
return srvrInfo;
}
@ -61,7 +57,6 @@ std::string Utility::hostInfo(SessionHandle* aHandlePtr)
SessionParametersMap parametersMap = aHandlePtr->connectionParameters();
SessionParametersMap::const_iterator cItr = parametersMap.find("host");
if (parametersMap.end() == cItr)
{
return std::string();