fixed GH #1236: Remove Poco::Data::Row::checkEmpty() as it prevents Row from being used with all NULL rows

This commit is contained in:
Guenter Obiltschnig 2016-04-11 10:38:33 +02:00
parent d82b6b3975
commit ed23f24639
3 changed files with 0 additions and 36 deletions

View File

@ -218,10 +218,6 @@ public:
private:
void init(const SortMapPtr& pSortMap, const RowFormatter::Ptr& pFormatter);
void checkEmpty(std::size_t pos, const Poco::Dynamic::Var& val);
/// Check if row contains only empty values and throws IllegalStateException
/// if that is the case.
ValueVec& values();
/// Returns the reference to values vector.

View File

@ -109,28 +109,10 @@ std::size_t Row::getPosition(const std::string& name)
}
void Row::checkEmpty(std::size_t pos, const Poco::Dynamic::Var& val)
{
bool empty = true;
SortMap::const_iterator it = _pSortMap->begin();
SortMap::const_iterator end = _pSortMap->end();
for (std::size_t cnt = 0; it != end; ++it, ++cnt)
{
if (cnt != pos)
empty = empty && _values[it->get<0>()].isEmpty();
}
if (empty && val.isEmpty())
throw IllegalStateException("All values are empty.");
}
void Row::addSortField(std::size_t pos)
{
poco_assert (pos <= _values.size());
checkEmpty(std::numeric_limits<std::size_t>::max(), _values[pos]);
SortMap::iterator it = _pSortMap->begin();
SortMap::iterator end = _pSortMap->end();
for (; it != end; ++it)
@ -177,8 +159,6 @@ void Row::addSortField(const std::string& name)
void Row::removeSortField(std::size_t pos)
{
checkEmpty(pos, Poco::Dynamic::Var());
SortMap::iterator it = _pSortMap->begin();
SortMap::iterator end = _pSortMap->end();
for (; it != end; ++it)

View File

@ -953,18 +953,6 @@ void DataTest::testRow()
fail ("must fail");
}catch (NotFoundException&) {}
try
{
row4.set("field1", Var());
row4.addSortField(1);
row4.removeSortField(0);
fail ("must fail - field 1 is empty");
}
catch (IllegalStateException&)
{
row4.removeSortField(1);
}
row4.set("field0", 0);
row4.set("field1", 1);
row4.set("field2", 2);