From 5d93d2bba17a3cd8a912838cf9db85d5cd724b49 Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic Date: Thu, 13 Sep 2012 04:04:55 +0000 Subject: [PATCH] SF #3567118: Fix Nullable handling in trunk --- Data/include/Poco/Data/Extraction.h | 3 ++- Data/include/Poco/Data/StatementImpl.h | 4 ++-- Data/include/Poco/Data/TypeHandler.h | 2 +- Foundation/include/Poco/Nullable.h | 11 +++++++++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Data/include/Poco/Data/Extraction.h b/Data/include/Poco/Data/Extraction.h index 892f56a16..8a33d3e09 100644 --- a/Data/include/Poco/Data/Extraction.h +++ b/Data/include/Poco/Data/Extraction.h @@ -786,7 +786,8 @@ inline Extraction* into(T& t, const Position& pos) template inline Extraction* into(T& t, const Position& pos, const T& def) - /// Convenience function to allow for a more compact creation of an extraction object with the given default + /// Convenience function to allow for a more compact creation of an extraction object + /// with multiple recordset support and the given default { return new Extraction(t, def, pos); } diff --git a/Data/include/Poco/Data/StatementImpl.h b/Data/include/Poco/Data/StatementImpl.h index 2839094ef..e2f0a8a86 100644 --- a/Data/include/Poco/Data/StatementImpl.h +++ b/Data/include/Poco/Data/StatementImpl.h @@ -338,7 +338,7 @@ private: { C* pData = new C; Column* pCol = new Column(mc, pData); - return new InternalExtraction(*pData, pCol, static_cast(currentDataSet())); + return new InternalExtraction(*pData, pCol, Position(currentDataSet())); } template @@ -349,7 +349,7 @@ private: return new InternalBulkExtraction(*pData, pCol, static_cast(getExtractionLimit()), - static_cast(currentDataSet())); + Position(currentDataSet())); } template diff --git a/Data/include/Poco/Data/TypeHandler.h b/Data/include/Poco/Data/TypeHandler.h index 982a8a0bb..c7161cf95 100644 --- a/Data/include/Poco/Data/TypeHandler.h +++ b/Data/include/Poco/Data/TypeHandler.h @@ -314,7 +314,7 @@ public: if (pExt->extract(pos++, val)) { - obj.value(val); + obj = val; } else { diff --git a/Foundation/include/Poco/Nullable.h b/Foundation/include/Poco/Nullable.h index 04c610c92..c31c28d84 100644 --- a/Foundation/include/Poco/Nullable.h +++ b/Foundation/include/Poco/Nullable.h @@ -182,6 +182,17 @@ public: return !(*this == other) && !(*this < other); } + C& value() + /// Returns the Nullable's value. + /// + /// Throws a NullValueException if the Nullable is empty. + { + if (!_isNull) + return _value; + else + throw NullValueException(); + } + const C& value() const /// Returns the Nullable's value. ///