From 5eb03ba814101fc7e3fd2085114d7d053e2c0def Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic <alex@pocoproject.org> Date: Sat, 27 Oct 2007 18:52:25 +0000 Subject: [PATCH] outline nvl --- Data/include/Poco/Data/RecordSet.h | 16 ++-------------- Data/src/RecordSet.cpp | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/Data/include/Poco/Data/RecordSet.h b/Data/include/Poco/Data/RecordSet.h index 3c1f0cba5..b4c66b1dd 100644 --- a/Data/include/Poco/Data/RecordSet.h +++ b/Data/include/Poco/Data/RecordSet.h @@ -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. diff --git a/Data/src/RecordSet.cpp b/Data/src/RecordSet.cpp index 20583a08e..7b96639b7 100644 --- a/Data/src/RecordSet.cpp +++ b/Data/src/RecordSet.cpp @@ -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