Skip to content

Commit

Permalink
#3041: PostgreSQL and TEXT column type
Browse files Browse the repository at this point in the history
  • Loading branch information
obiltschnig committed Jun 15, 2021
1 parent 417bbc4 commit 1ba0f8e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 30 deletions.
17 changes: 9 additions & 8 deletions Data/src/RecordSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())),
Expand All @@ -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())),
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand All @@ -210,15 +211,15 @@ 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());

for (std::size_t col = 0; col < columns; ++col)
pRow->set(col, value(col, pos));
}
else
else
{
pRow = new Row;
pRow->setFormatter(getRowFormatter());
Expand All @@ -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);
Expand Down
46 changes: 24 additions & 22 deletions Data/src/StatementImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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))
Expand All @@ -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:
Expand Down Expand Up @@ -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(
Expand All @@ -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;
Expand Down Expand Up @@ -446,7 +448,7 @@ std::size_t StatementImpl::rowsExtracted(int dataSet) const
if (_extractors[dataSet].size() > 0)
return _extractors[dataSet][0]->numOfRowsHandled();
}

return 0;
}

Expand All @@ -459,7 +461,7 @@ std::size_t StatementImpl::subTotalRowCount(int dataSet) const
poco_assert (dataSet >= 0 && dataSet < _subTotalRowCount.size());
return _subTotalRowCount[dataSet];
}

return 0;
}

Expand Down

0 comments on commit 1ba0f8e

Please sign in to comment.