diff --git a/Data/PostgreSQL/Makefile b/Data/PostgreSQL/Makefile index 5882ea9ef..c3efddb2e 100644 --- a/Data/PostgreSQL/Makefile +++ b/Data/PostgreSQL/Makefile @@ -8,7 +8,7 @@ include $(POCO_BASE)/build/rules/global include PostgreSQL.make -objects = Extractor Binder SessionImpl Connector \ +objects = Extractor BinaryExtractor Binder SessionImpl Connector \ PostgreSQLStatementImpl PostgreSQLException \ SessionHandle StatementExecutor PostgreSQLTypes Utility diff --git a/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h new file mode 100644 index 000000000..f5701d25b --- /dev/null +++ b/Data/PostgreSQL/include/Poco/Data/PostgreSQL/BinaryExtractor.h @@ -0,0 +1,346 @@ +// +// BinaryExtractor.h +// +// Library: Data/PostgreSQL +// Package: PostgreSQL +// Module: Extractor +// +// Definition of the BinaryExtractor class. +// +// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. +// and Contributors. +// +// SPDX-License-Identifier: BSL-1.0 +// + + +#ifndef SQL_PostgreSQL_BinaryExtractor_INCLUDED +#define SQL_PostgreSQL_BinaryExtractor_INCLUDED + + +#include "Poco/Data/PostgreSQL/PostgreSQL.h" +#include "Poco/Data/PostgreSQL/PostgreSQLTypes.h" +#include "Poco/Data/PostgreSQL/StatementExecutor.h" +#include "Poco/Data/AbstractExtractor.h" +#include "Poco/Data/LOB.h" +#include "Poco/Types.h" +#include "Poco/Any.h" +#include "Poco/DynamicAny.h" +#include "Poco/Dynamic/Var.h" + + +namespace Poco { +namespace Data { +namespace PostgreSQL { + + +class PostgreSQL_API BinaryExtractor: public Poco::Data::AbstractExtractor + /// Extracts and converts data values from the result row returned by PostgreSQL. + /// If NULL is received, the incoming val value is not changed and false is returned +{ +public: + using Ptr = SharedPtr; + + BinaryExtractor(StatementExecutor& st); + /// Creates the Extractor. + + virtual ~BinaryExtractor(); + /// Destroys the Extractor. + + virtual bool extract(std::size_t pos, Poco::Int8& val); + /// Extracts an Int8. + + virtual bool extract(std::size_t pos, Poco::UInt8& val); + /// Extracts an UInt8. + + virtual bool extract(std::size_t pos, Poco::Int16& val); + /// Extracts an Int16. + + virtual bool extract(std::size_t pos, Poco::UInt16& val); + /// Extracts an UInt16. + + virtual bool extract(std::size_t pos, Poco::Int32& val); + /// Extracts an Int32. + + virtual bool extract(std::size_t pos, Poco::UInt32& val); + /// Extracts an UInt32. + + virtual bool extract(std::size_t pos, Poco::Int64& val); + /// Extracts an Int64. + + virtual bool extract(std::size_t pos, Poco::UInt64& val); + /// Extracts an UInt64. + +#ifndef POCO_INT64_IS_LONG + virtual bool extract(std::size_t pos, long& val); + /// Extracts a long. Returns false if null was received. + + virtual bool extract(std::size_t pos, unsigned long& val); + /// Extracts an unsigned long. Returns false if null was received. +#endif + + virtual bool extract(std::size_t pos, bool& val); + /// Extracts a boolean. + + virtual bool extract(std::size_t pos, float& val); + /// Extracts a float. + + virtual bool extract(std::size_t pos, double& val); + /// Extracts a double. + + virtual bool extract(std::size_t pos, char& val); + /// Extracts a single character. + + virtual bool extract(std::size_t pos, std::string& val); + /// Extracts a string. + + virtual bool extract(std::size_t pos, Poco::Data::BLOB& val); + /// Extracts a BLOB. + + virtual bool extract(std::size_t pos, Poco::Data::CLOB& val); + /// Extracts a CLOB. + + virtual bool extract(std::size_t pos, DateTime& val); + /// Extracts a DateTime. Returns false if null was received. + + virtual bool extract(std::size_t pos, Date& val); + /// Extracts a Date. Returns false if null was received. + + virtual bool extract(std::size_t pos, Time& val); + /// Extracts a Time. Returns false if null was received. + + virtual bool extract(std::size_t pos, UUID& val); + /// Extracts a UUID. Returns false if null was received. + + virtual bool extract(std::size_t pos, Any& val); + /// Extracts an Any. Returns false if null was received. + + virtual bool extract(std::size_t pos, Dynamic::Var& val); + /// Extracts a Dynamic::Var. Returns false if null was received. + + virtual bool isNull(std::size_t col, std::size_t row); + /// Returns true if the value at [col,row] position is null. + + virtual void reset(); + /// Resets any information internally cached by the extractor. + + //////////// + // Not implemented extract functions + //////////// + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an Int8 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an Int8 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an Int8 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an UInt8 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an UInt8 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an UInt8 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an Int16 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an Int16 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an Int16 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an UInt16 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an UInt16 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an UInt16 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an Int32 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an Int32 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an Int32 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an UInt32 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an UInt32 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an UInt32 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an Int64 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an Int64 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an Int64 list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts an UInt64 vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts an UInt64 deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts an UInt64 list. + +#ifndef POCO_INT64_IS_LONG + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a long vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a long deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a long list. +#endif + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a boolean vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a boolean deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a boolean list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a float vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a float deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a float list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a double vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a double deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a double list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a character vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a character deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a character list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a string vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a string deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a string list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a BLOB vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a BLOB deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a BLOB list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a CLOB vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a CLOB deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a CLOB list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a DateTime vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a DateTime deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a DateTime list. + + virtual bool extract(std::size_t pos, std::vector& val); + /// Extracts a Date vector. + + virtual bool extract(std::size_t pos, std::deque& val); + /// Extracts a Date deque. + + virtual bool extract(std::size_t pos, std::list& val); + /// Extracts a Date list. + + virtual bool extract(std::size_t pos, std::vector