make Row field names case-insensitive

This commit is contained in:
Aleksandar Fabijanic 2009-01-07 16:12:40 +00:00
parent 736cb1fcee
commit 2f7c6b4aa5
2 changed files with 9 additions and 5 deletions

View File

@ -36,6 +36,7 @@
#include "Poco/Data/Row.h"
#include "Poco/Data/SimpleRowFormatter.h"
#include "Poco/String.h"
#include "Poco/Exception.h"
@ -121,12 +122,9 @@ std::size_t Row::getPosition(const std::string& name)
NameVec::const_iterator end = _pNames->end();
std::size_t col = 0;
for (; it != end; ++it, ++col)
if (name == *it) break;
if (0 == icompare(name, *it)) return col;
if (it == end)
throw NotFoundException(name);
return col;
throw NotFoundException(name);
}

View File

@ -850,6 +850,12 @@ void DataTest::testRow()
assert (row["field3"] == 3);
assert (row["field4"] == 4);
assert (row["FIELD0"] == 0);
assert (row["FIELD1"] == 1);
assert (row["FIELD2"] == 2);
assert (row["FIELD3"] == 3);
assert (row["FIELD4"] == 4);
assert (row[0] == 0);
assert (row[1] == 1);
assert (row[2] == 2);