mirror of
https://github.com/pocoproject/poco.git
synced 2024-12-13 10:32:57 +01:00
#3041: PostgreSQL and TEXT column type
This commit is contained in:
parent
417bbc41ca
commit
1ba0f8e45b
@ -34,7 +34,7 @@ const std::size_t RecordSet::UNKNOWN_TOTAL_ROW_COUNT = std::numeric_limits<std::
|
||||
|
||||
|
||||
RecordSet::RecordSet(const Statement& rStatement,
|
||||
RowFormatter::Ptr pRowFormatter):
|
||||
RowFormatter::Ptr pRowFormatter):
|
||||
Statement(rStatement),
|
||||
_currentRow(0),
|
||||
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
|
||||
@ -45,9 +45,9 @@ RecordSet::RecordSet(const Statement& rStatement,
|
||||
}
|
||||
|
||||
|
||||
RecordSet::RecordSet(Session& rSession,
|
||||
const std::string& query,
|
||||
RowFormatter::Ptr pRowFormatter):
|
||||
RecordSet::RecordSet(Session& rSession,
|
||||
const std::string& query,
|
||||
RowFormatter::Ptr pRowFormatter):
|
||||
Statement((rSession << query, now)),
|
||||
_currentRow(0),
|
||||
_pBegin(new RowIterator(this, 0 == rowsExtracted())),
|
||||
@ -119,7 +119,7 @@ void RecordSet::reset(const Statement& stmt)
|
||||
_pEnd = 0;
|
||||
_currentRow = 0;
|
||||
_totalRowCount = UNKNOWN_TOTAL_ROW_COUNT;
|
||||
|
||||
|
||||
RowMap::iterator it = _rowMap.begin();
|
||||
RowMap::iterator end = _rowMap.end();
|
||||
for (; it != end; ++it) delete it->second;
|
||||
@ -188,6 +188,7 @@ Poco::Dynamic::Var RecordSet::value(const std::string& name, std::size_t row, bo
|
||||
case MetaColumn::FDT_STRING: return value<std::string>(name, row, useFilter);
|
||||
case MetaColumn::FDT_WSTRING: return value<UTF16String>(name, row, useFilter);
|
||||
case MetaColumn::FDT_BLOB: return value<BLOB>(name, row, useFilter);
|
||||
case MetaColumn::FDT_CLOB: return value<CLOB>(name, row, useFilter);
|
||||
case MetaColumn::FDT_DATE: return value<Date>(name, row, useFilter);
|
||||
case MetaColumn::FDT_TIME: return value<Time>(name, row, useFilter);
|
||||
case MetaColumn::FDT_TIMESTAMP: return value<DateTime>(name, row, useFilter);
|
||||
@ -210,7 +211,7 @@ Row& RecordSet::row(std::size_t pos)
|
||||
{
|
||||
if (_rowMap.size())
|
||||
{
|
||||
//reuse first row column names and sorting fields to save some memory
|
||||
//reuse first row column names and sorting fields to save some memory
|
||||
pRow = new Row(_rowMap.begin()->second->names(),
|
||||
_rowMap.begin()->second->getSortMap(),
|
||||
getRowFormatter());
|
||||
@ -218,7 +219,7 @@ Row& RecordSet::row(std::size_t pos)
|
||||
for (std::size_t col = 0; col < columns; ++col)
|
||||
pRow->set(col, value(col, pos));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
pRow = new Row;
|
||||
pRow->setFormatter(getRowFormatter());
|
||||
@ -228,7 +229,7 @@ Row& RecordSet::row(std::size_t pos)
|
||||
|
||||
_rowMap.insert(RowMap::value_type(pos, pRow));
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
pRow = it->second;
|
||||
poco_check_ptr (pRow);
|
||||
|
@ -131,15 +131,15 @@ std::size_t StatementImpl::executeWithLimit()
|
||||
do
|
||||
{
|
||||
bind();
|
||||
while (count < limit && hasNext())
|
||||
while (count < limit && hasNext())
|
||||
count += next();
|
||||
} while (count < limit && canBind());
|
||||
|
||||
if (!canBind() && (!hasNext() || limit == 0))
|
||||
if (!canBind() && (!hasNext() || limit == 0))
|
||||
_state = ST_DONE;
|
||||
else if (hasNext() && limit == count && _extrLimit.isHardLimit())
|
||||
throw LimitException("HardLimit reached (retrieved more data than requested).");
|
||||
else
|
||||
else
|
||||
_state = ST_PAUSED;
|
||||
|
||||
int affectedRows = affectedRowCount();
|
||||
@ -177,8 +177,8 @@ std::size_t StatementImpl::executeWithoutLimit()
|
||||
|
||||
void StatementImpl::compile()
|
||||
{
|
||||
if (_state == ST_INITIALIZED ||
|
||||
_state == ST_RESET ||
|
||||
if (_state == ST_INITIALIZED ||
|
||||
_state == ST_RESET ||
|
||||
_state == ST_BOUND)
|
||||
{
|
||||
compileImpl();
|
||||
@ -298,7 +298,7 @@ void StatementImpl::setStorage(const std::string& storage)
|
||||
if (0 == icompare(DEQUE, storage))
|
||||
_storage = STORAGE_DEQUE_IMPL;
|
||||
else if (0 == icompare(VECTOR, storage))
|
||||
_storage = STORAGE_VECTOR_IMPL;
|
||||
_storage = STORAGE_VECTOR_IMPL;
|
||||
else if (0 == icompare(LIST, storage))
|
||||
_storage = STORAGE_LIST_IMPL;
|
||||
else if (0 == icompare(UNKNOWN, storage))
|
||||
@ -317,32 +317,34 @@ void StatementImpl::makeExtractors(std::size_t count)
|
||||
{
|
||||
case MetaColumn::FDT_BOOL:
|
||||
addInternalExtract<bool>(mc); break;
|
||||
case MetaColumn::FDT_INT8:
|
||||
case MetaColumn::FDT_INT8:
|
||||
addInternalExtract<Int8>(mc); break;
|
||||
case MetaColumn::FDT_UINT8:
|
||||
case MetaColumn::FDT_UINT8:
|
||||
addInternalExtract<UInt8>(mc); break;
|
||||
case MetaColumn::FDT_INT16:
|
||||
case MetaColumn::FDT_INT16:
|
||||
addInternalExtract<Int16>(mc); break;
|
||||
case MetaColumn::FDT_UINT16:
|
||||
case MetaColumn::FDT_UINT16:
|
||||
addInternalExtract<UInt16>(mc); break;
|
||||
case MetaColumn::FDT_INT32:
|
||||
case MetaColumn::FDT_INT32:
|
||||
addInternalExtract<Int32>(mc); break;
|
||||
case MetaColumn::FDT_UINT32:
|
||||
case MetaColumn::FDT_UINT32:
|
||||
addInternalExtract<UInt32>(mc); break;
|
||||
case MetaColumn::FDT_INT64:
|
||||
case MetaColumn::FDT_INT64:
|
||||
addInternalExtract<Int64>(mc); break;
|
||||
case MetaColumn::FDT_UINT64:
|
||||
case MetaColumn::FDT_UINT64:
|
||||
addInternalExtract<UInt64>(mc); break;
|
||||
case MetaColumn::FDT_FLOAT:
|
||||
case MetaColumn::FDT_FLOAT:
|
||||
addInternalExtract<float>(mc); break;
|
||||
case MetaColumn::FDT_DOUBLE:
|
||||
case MetaColumn::FDT_DOUBLE:
|
||||
addInternalExtract<double>(mc); break;
|
||||
case MetaColumn::FDT_STRING:
|
||||
case MetaColumn::FDT_STRING:
|
||||
addInternalExtract<std::string>(mc); break;
|
||||
case MetaColumn::FDT_WSTRING:
|
||||
addInternalExtract<Poco::UTF16String>(mc); break;
|
||||
case MetaColumn::FDT_BLOB:
|
||||
case MetaColumn::FDT_BLOB:
|
||||
addInternalExtract<BLOB>(mc); break;
|
||||
case MetaColumn::FDT_CLOB:
|
||||
addInternalExtract<CLOB>(mc); break;
|
||||
case MetaColumn::FDT_DATE:
|
||||
addInternalExtract<Date>(mc); break;
|
||||
case MetaColumn::FDT_TIME:
|
||||
@ -391,7 +393,7 @@ void StatementImpl::addExtract(AbstractExtraction::Ptr pExtraction)
|
||||
{
|
||||
poco_check_ptr (pExtraction);
|
||||
std::size_t pos = pExtraction->position();
|
||||
if (pos >= _extractors.size())
|
||||
if (pos >= _extractors.size())
|
||||
_extractors.resize(pos + 1);
|
||||
|
||||
pExtraction->setEmptyStringIsNull(
|
||||
@ -411,7 +413,7 @@ void StatementImpl::removeBind(const std::string& name)
|
||||
AbstractBindingVec::iterator it = _bindings.begin();
|
||||
for (; it != _bindings.end();)
|
||||
{
|
||||
if ((*it)->name() == name)
|
||||
if ((*it)->name() == name)
|
||||
{
|
||||
it = _bindings.erase(it);
|
||||
found = true;
|
||||
@ -446,7 +448,7 @@ std::size_t StatementImpl::rowsExtracted(int dataSet) const
|
||||
if (_extractors[dataSet].size() > 0)
|
||||
return _extractors[dataSet][0]->numOfRowsHandled();
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -459,7 +461,7 @@ std::size_t StatementImpl::subTotalRowCount(int dataSet) const
|
||||
poco_assert (dataSet >= 0 && dataSet < _subTotalRowCount.size());
|
||||
return _subTotalRowCount[dataSet];
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user