outline nvl

This commit is contained in:
Aleksandar Fabijanic 2007-10-27 18:52:25 +00:00
parent 98191f1b2b
commit 5eb03ba814
2 changed files with 20 additions and 14 deletions

View File

@ -179,25 +179,13 @@ public:
DynamicAny value(const std::string& name, std::size_t row) const;
/// Returns the data value at named column, row location.
DynamicAny nvl(const std::string& name, const DynamicAny& deflt) const
DynamicAny nvl(const std::string& name, const DynamicAny& deflt) const;
/// Returns the value in the named column of the current row
/// if the value is not NULL, or deflt otherwise.
{
if (isNull(name))
return deflt;
else
return value(name, _currentRow);
}
DynamicAny nvl(std::size_t index, const DynamicAny& deflt) const
DynamicAny nvl(std::size_t index, const DynamicAny& deflt) const;
/// Returns the value in the given column of the current row
/// if the value is not NULL, or deflt otherwise.
{
if (isNull(index, _currentRow))
return deflt;
else
return value(index, _currentRow);
}
const RowIterator& begin();
/// Moves the row cursor to the first row and returns the pointer to row.

View File

@ -203,4 +203,22 @@ bool RecordSet::moveLast()
}
DynamicAny RecordSet::nvl(const std::string& name, const DynamicAny& deflt) const
{
if (isNull(name))
return deflt;
else
return value(name, _currentRow);
}
DynamicAny RecordSet::nvl(std::size_t index, const DynamicAny& deflt) const
{
if (isNull(index, _currentRow))
return deflt;
else
return value(index, _currentRow);
}
} } // namespace Poco::Data