mirror of
https://github.com/pocoproject/poco.git
synced 2025-02-21 06:37:42 +01:00
#3099: Fixed Postgres extraction into Dynamic::Var
This commit is contained in:
parent
1ba0f8e45b
commit
4615774f57
@ -343,6 +343,7 @@ private:
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
bool extractToDynamic(std::size_t pos, Dynamic::Var& val);
|
||||
|
||||
// Prevent VC8 warning "operator= could not be generated"
|
||||
Extractor& operator=(const Extractor&);
|
||||
|
@ -433,13 +433,13 @@ bool Extractor::extract(std::size_t pos, Time& val)
|
||||
|
||||
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 +462,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 +473,118 @@ 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;
|
||||
}
|
||||
|
||||
std::string tempString { outputParameter.pData(), outputParameter.size() };
|
||||
const Oid oid = outputParameter.internalFieldType();
|
||||
|
||||
Dynamic::Var resultValue;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@ -487,381 +593,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.");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user