4747#include " Poco/Data/ODBC/ODBCMetaColumn.h"
4848#include " Poco/Data/ODBC/Error.h"
4949#include " Poco/Data/ODBC/Utility.h"
50+ #include " Poco/Data/Date.h"
51+ #include " Poco/Data/Time.h"
5052#include " Poco/DateTime.h"
5153#include " Poco/Any.h"
5254#include " Poco/DynamicAny.h"
@@ -398,6 +400,15 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
398400 return true ;
399401 }
400402
403+ template <typename T, typename NT >
404+ bool extAny (std::size_t pos, T& val)
405+ {
406+ NT i;
407+ extract (pos, i);
408+ val = i;
409+ return true ;
410+ }
411+
401412 template <typename T>
402413 bool extractImpl (std::size_t pos, T& val)
403414 // / Utility function for extraction of Any and DynamicAny.
@@ -407,46 +418,52 @@ class ODBC_API Extractor: public Poco::Data::AbstractExtractor
407418 switch (column.type ())
408419 {
409420 case MetaColumn::FDT_INT8 :
410- { Poco::Int8 i = 0 ; extract (pos, i); val = i; return true ; }
421+ { return extAny<T, Poco::Int8> (pos, val) ; }
411422
412423 case MetaColumn::FDT_UINT8 :
413- { Poco::UInt8 i = 0 ; extract (pos, i ); val = i; return true ; }
424+ { return extAny<T, Poco::UInt8> (pos, val ); }
414425
415426 case MetaColumn::FDT_INT16 :
416- { Poco::Int16 i = 0 ; extract (pos, i ); val = i; return true ; }
427+ { return extAny<T, Poco::Int16> (pos, val ); }
417428
418429 case MetaColumn::FDT_UINT16 :
419- { Poco::UInt16 i = 0 ; extract (pos, i); val = i; return true ; }
430+ { return extAny<T, Poco::UInt16> (pos, val) ; }
420431
421432 case MetaColumn::FDT_INT32 :
422- { Poco::Int32 i = 0 ; extract (pos, i); val = i; return true ; }
433+ { return extAny<T, Poco::Int32> (pos, val) ; }
423434
424435 case MetaColumn::FDT_UINT32 :
425- { Poco::UInt32 i = 0 ; extract (pos, i); val = i; return true ; }
436+ { return extAny<T, Poco::UInt32> (pos, val) ; }
426437
427438 case MetaColumn::FDT_INT64 :
428- { Poco::Int64 i = 0 ; extract (pos, i ); val = i; return true ; }
439+ { return extAny<T, Poco::Int64> (pos, val ); }
429440
430441 case MetaColumn::FDT_UINT64 :
431- { Poco::UInt64 i = 0 ; extract (pos, i); val = i; return true ; }
442+ { return extAny<T, Poco::UInt64> (pos, val) ; }
432443
433444 case MetaColumn::FDT_BOOL :
434- { bool b; extract (pos, b); val = b; return true ; }
445+ { return extAny<T, bool > (pos, val) ; }
435446
436447 case MetaColumn::FDT_FLOAT :
437- { float f; extract (pos, f); val = f; return true ; }
448+ { return extAny<T, float > (pos, val) ; }
438449
439450 case MetaColumn::FDT_DOUBLE :
440- { double d; extract (pos, d); val = d; return true ; }
451+ { return extAny<T, double > (pos, val) ; }
441452
442453 case MetaColumn::FDT_STRING :
443- { std::string s; extract (pos, s ); val = s; return true ; }
454+ { return extAny<T, std::string> (pos, val ); }
444455
445456 case MetaColumn::FDT_BLOB :
446- { Poco::Data::BLOB b; extract (pos, b); val = b; return true ; }
457+ { return extAny<T, Poco::Data::BLOB >(pos, val); }
458+
459+ case MetaColumn::FDT_DATE :
460+ { return extAny<T, Poco::Data::Date>(pos, val); }
461+
462+ case MetaColumn::FDT_TIME :
463+ { return extAny<T, Poco::Data::Time>(pos, val); }
447464
448465 case MetaColumn::FDT_TIMESTAMP :
449- { Poco::DateTime b; extract (pos, b); val = b; return true ; }
466+ { return extAny<T, Poco::DateTime> (pos, val) ; }
450467
451468 default :
452469 throw DataFormatException (" Unsupported data type." );
0 commit comments