diff options
author | AlexSm <alex@ydb.tech> | 2024-01-04 15:09:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-04 15:09:05 +0100 |
commit | dab291146f6cd7d35684e3a1150e5bb1c412982c (patch) | |
tree | 36ef35f6cacb6432845a4a33f940c95871036b32 /contrib/libs/poco | |
parent | 63660ad5e7512029fd0218e7a636580695a24e1f (diff) | |
download | ydb-dab291146f6cd7d35684e3a1150e5bb1c412982c.tar.gz |
Library import 5, delete go dependencies (#832)
* Library import 5, delete go dependencies
* Fix yt client
Diffstat (limited to 'contrib/libs/poco')
163 files changed, 0 insertions, 30205 deletions
diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractBinder.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractBinder.h deleted file mode 100644 index d88efba0a9..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractBinder.h +++ /dev/null @@ -1,373 +0,0 @@ -// -// AbstractBinder.h -// -// Library: Data -// Package: DataCore -// Module: AbstractBinder -// -// Definition of the AbstractBinder class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractBinder_INCLUDED -#define Data_AbstractBinder_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Date.h" -#include "Poco/Data/Time.h" -#include "Poco/Data/LOB.h" -#include "Poco/DateTime.h" -#include "Poco/Nullable.h" -#include "Poco/Any.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/UTFString.h" -#include <vector> -#include <deque> -#include <list> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -typedef NullType NullData; - - -namespace Keywords { - - -static const NullData null = NULL_GENERIC; - - -} // namespace Keywords - - -class Data_API AbstractBinder - /// Interface for Binding data types to placeholders. -{ -public: - typedef SharedPtr<AbstractBinder> Ptr; - - enum Direction - /// Binding direction for a parameter. - { - PD_IN, - PD_OUT, - PD_IN_OUT - }; - - AbstractBinder(); - /// Creates the AbstractBinder. - - virtual ~AbstractBinder(); - /// Destroys the AbstractBinder. - - virtual void bind(std::size_t pos, const Poco::Int8& val, Direction dir = PD_IN) = 0; - /// Binds an Int8. - - virtual void bind(std::size_t pos, const std::vector<Poco::Int8>& val, Direction dir = PD_IN); - /// Binds an Int8 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::Int8>& val, Direction dir = PD_IN); - /// Binds an Int8 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::Int8>& val, Direction dir = PD_IN); - /// Binds an Int8 list. - - virtual void bind(std::size_t pos, const Poco::UInt8& val, Direction dir = PD_IN) = 0; - /// Binds an UInt8. - - virtual void bind(std::size_t pos, const std::vector<Poco::UInt8>& val, Direction dir = PD_IN); - /// Binds an UInt8 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::UInt8>& val, Direction dir = PD_IN); - /// Binds an UInt8 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::UInt8>& val, Direction dir = PD_IN); - /// Binds an UInt8 list. - - virtual void bind(std::size_t pos, const Poco::Int16& val, Direction dir = PD_IN) = 0; - /// Binds an Int16. - - virtual void bind(std::size_t pos, const std::vector<Poco::Int16>& val, Direction dir = PD_IN); - /// Binds an Int16 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::Int16>& val, Direction dir = PD_IN); - /// Binds an Int16 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::Int16>& val, Direction dir = PD_IN); - /// Binds an Int16 list. - - virtual void bind(std::size_t pos, const Poco::UInt16& val, Direction dir = PD_IN) = 0; - /// Binds an UInt16. - - virtual void bind(std::size_t pos, const std::vector<Poco::UInt16>& val, Direction dir = PD_IN); - /// Binds an UInt16 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::UInt16>& val, Direction dir = PD_IN); - /// Binds an UInt16 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::UInt16>& val, Direction dir = PD_IN); - /// Binds an UInt16 list. - - virtual void bind(std::size_t pos, const Poco::Int32& val, Direction dir = PD_IN) = 0; - /// Binds an Int32. - - virtual void bind(std::size_t pos, const std::vector<Poco::Int32>& val, Direction dir = PD_IN); - /// Binds an Int32 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::Int32>& val, Direction dir = PD_IN); - /// Binds an Int32 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::Int32>& val, Direction dir = PD_IN); - /// Binds an Int32 list. - - virtual void bind(std::size_t pos, const Poco::UInt32& val, Direction dir = PD_IN) = 0; - /// Binds an UInt32. - - virtual void bind(std::size_t pos, const std::vector<Poco::UInt32>& val, Direction dir = PD_IN); - /// Binds an UInt32 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::UInt32>& val, Direction dir = PD_IN); - /// Binds an UInt32 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::UInt32>& val, Direction dir = PD_IN); - /// Binds an UInt32 list. - - virtual void bind(std::size_t pos, const Poco::Int64& val, Direction dir = PD_IN) = 0; - /// Binds an Int64. - - virtual void bind(std::size_t pos, const std::vector<Poco::Int64>& val, Direction dir = PD_IN); - /// Binds an Int64 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::Int64>& val, Direction dir = PD_IN); - /// Binds an Int64 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::Int64>& val, Direction dir = PD_IN); - /// Binds an Int64 list. - - virtual void bind(std::size_t pos, const Poco::UInt64& val, Direction dir = PD_IN) = 0; - /// Binds an UInt64. - - virtual void bind(std::size_t pos, const std::vector<Poco::UInt64>& val, Direction dir = PD_IN); - /// Binds an UInt64 vector. - - virtual void bind(std::size_t pos, const std::deque<Poco::UInt64>& val, Direction dir = PD_IN); - /// Binds an UInt64 deque. - - virtual void bind(std::size_t pos, const std::list<Poco::UInt64>& val, Direction dir = PD_IN); - /// Binds an UInt64 list. - -#ifndef POCO_LONG_IS_64_BIT - virtual void bind(std::size_t pos, const long& val, Direction dir = PD_IN) = 0; - /// Binds a long. - - virtual void bind(std::size_t pos, const unsigned long& val, Direction dir = PD_IN) = 0; - /// Binds an unsiged long. - - virtual void bind(std::size_t pos, const std::vector<long>& val, Direction dir = PD_IN); - /// Binds a long vector. - - virtual void bind(std::size_t pos, const std::deque<long>& val, Direction dir = PD_IN); - /// Binds a long deque. - - virtual void bind(std::size_t pos, const std::list<long>& val, Direction dir = PD_IN); - /// Binds a long list. -#endif - - virtual void bind(std::size_t pos, const bool& val, Direction dir = PD_IN) = 0; - /// Binds a boolean. - - virtual void bind(std::size_t pos, const std::vector<bool>& val, Direction dir = PD_IN); - /// Binds a boolean vector. - - virtual void bind(std::size_t pos, const std::deque<bool>& val, Direction dir = PD_IN); - /// Binds a boolean deque. - - virtual void bind(std::size_t pos, const std::list<bool>& val, Direction dir = PD_IN); - /// Binds a boolean list. - - virtual void bind(std::size_t pos, const float& val, Direction dir = PD_IN) = 0; - /// Binds a float. - - virtual void bind(std::size_t pos, const std::vector<float>& val, Direction dir = PD_IN); - /// Binds a float vector. - - virtual void bind(std::size_t pos, const std::deque<float>& val, Direction dir = PD_IN); - /// Binds a float deque. - - virtual void bind(std::size_t pos, const std::list<float>& val, Direction dir = PD_IN); - /// Binds a float list. - - virtual void bind(std::size_t pos, const double& val, Direction dir = PD_IN) = 0; - /// Binds a double. - - virtual void bind(std::size_t pos, const std::vector<double>& val, Direction dir = PD_IN); - /// Binds a double vector. - - virtual void bind(std::size_t pos, const std::deque<double>& val, Direction dir = PD_IN); - /// Binds a double deque. - - virtual void bind(std::size_t pos, const std::list<double>& val, Direction dir = PD_IN); - /// Binds a double list. - - virtual void bind(std::size_t pos, const char& val, Direction dir = PD_IN) = 0; - /// Binds a single character. - - virtual void bind(std::size_t pos, const std::vector<char>& val, Direction dir = PD_IN); - /// Binds a character vector. - - virtual void bind(std::size_t pos, const std::deque<char>& val, Direction dir = PD_IN); - /// Binds a character deque. - - virtual void bind(std::size_t pos, const std::list<char>& val, Direction dir = PD_IN); - /// Binds a character list. - - virtual void bind(std::size_t pos, const char* const& pVal, Direction dir = PD_IN) = 0; - /// Binds a const char ptr. - - virtual void bind(std::size_t pos, const std::string& val, Direction dir = PD_IN) = 0; - /// Binds a string. - - virtual void bind(std::size_t pos, const std::vector<std::string>& val, Direction dir = PD_IN); - /// Binds a string vector. - - virtual void bind(std::size_t pos, const std::deque<std::string>& val, Direction dir = PD_IN); - /// Binds a string deque. - - virtual void bind(std::size_t pos, const std::list<std::string>& val, Direction dir = PD_IN); - /// Binds a string list. - - virtual void bind(std::size_t pos, const UTF16String& val, Direction dir = PD_IN); - /// Binds a UTF-16 Unicode string. - - virtual void bind(std::size_t pos, const std::vector<UTF16String>& val, Direction dir = PD_IN); - /// Binds a UTF-16 Unicode string vector. - - virtual void bind(std::size_t pos, const std::deque<UTF16String>& val, Direction dir = PD_IN); - /// Binds a UTF-16 Unicode string deque. - - virtual void bind(std::size_t pos, const std::list<UTF16String>& val, Direction dir = PD_IN); - /// Binds a UTF-16 Unicode string list. - - virtual void bind(std::size_t pos, const BLOB& val, Direction dir = PD_IN) = 0; - /// Binds a BLOB. - - virtual void bind(std::size_t pos, const CLOB& val, Direction dir = PD_IN) = 0; - /// Binds a CLOB. - - virtual void bind(std::size_t pos, const std::vector<BLOB>& val, Direction dir = PD_IN); - /// Binds a BLOB vector. - - virtual void bind(std::size_t pos, const std::deque<BLOB>& val, Direction dir = PD_IN); - /// Binds a BLOB deque. - - virtual void bind(std::size_t pos, const std::list<BLOB>& val, Direction dir = PD_IN); - /// Binds a BLOB list. - - virtual void bind(std::size_t pos, const std::vector<CLOB>& val, Direction dir = PD_IN); - /// Binds a CLOB vector. - - virtual void bind(std::size_t pos, const std::deque<CLOB>& val, Direction dir = PD_IN); - /// Binds a CLOB deque. - - virtual void bind(std::size_t pos, const std::list<CLOB>& val, Direction dir = PD_IN); - /// Binds a CLOB list. - - virtual void bind(std::size_t pos, const DateTime& val, Direction dir = PD_IN) = 0; - /// Binds a DateTime. - - virtual void bind(std::size_t pos, const std::vector<DateTime>& val, Direction dir = PD_IN); - /// Binds a DateTime vector. - - virtual void bind(std::size_t pos, const std::deque<DateTime>& val, Direction dir = PD_IN); - /// Binds a DateTime deque. - - virtual void bind(std::size_t pos, const std::list<DateTime>& val, Direction dir = PD_IN); - /// Binds a DateTime list. - - virtual void bind(std::size_t pos, const Date& val, Direction dir = PD_IN) = 0; - /// Binds a Date. - - virtual void bind(std::size_t pos, const std::vector<Date>& val, Direction dir = PD_IN); - /// Binds a Date vector. - - virtual void bind(std::size_t pos, const std::deque<Date>& val, Direction dir = PD_IN); - /// Binds a Date deque. - - virtual void bind(std::size_t pos, const std::list<Date>& val, Direction dir = PD_IN); - /// Binds a Date list. - - virtual void bind(std::size_t pos, const Time& val, Direction dir = PD_IN) = 0; - /// Binds a Time. - - virtual void bind(std::size_t pos, const std::vector<Time>& val, Direction dir = PD_IN); - /// Binds a Time vector. - - virtual void bind(std::size_t pos, const std::deque<Time>& val, Direction dir = PD_IN); - /// Binds a Time deque. - - virtual void bind(std::size_t pos, const std::list<Time>& val, Direction dir = PD_IN); - /// Binds a Time list. - - virtual void bind(std::size_t pos, const NullData& val, Direction dir = PD_IN) = 0; - /// Binds a null. - - virtual void bind(std::size_t pos, const std::vector<NullData>& val, Direction dir = PD_IN); - /// Binds a null vector. - - virtual void bind(std::size_t pos, const std::deque<NullData>& val, Direction dir = PD_IN); - /// Binds a null deque. - - virtual void bind(std::size_t pos, const std::list<NullData>& val, Direction dir = PD_IN); - /// Binds a null list. - - void bind(std::size_t pos, const Any& val, Direction dir = PD_IN); - /// Binds an Any. - - void bind(std::size_t pos, const Poco::Dynamic::Var& val, Direction dir = PD_IN); - /// Binds a Var. - - virtual void reset(); - /// Resets a binder. No-op by default. Implement for binders that cache data. - - static bool isOutBound(Direction dir); - /// Returns true if direction is out bound; - - static bool isInBound(Direction dir); - /// Returns true if direction is in bound; -}; - - -// -// inlines -// -inline void AbstractBinder::reset() -{ - //no-op -} - - -inline bool AbstractBinder::isOutBound(Direction dir) -{ - return PD_OUT == dir || PD_IN_OUT == dir; -} - - -inline bool AbstractBinder::isInBound(Direction dir) -{ - return PD_IN == dir || PD_IN_OUT == dir; -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractBinder_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractBinding.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractBinding.h deleted file mode 100644 index 1c16da1a6f..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractBinding.h +++ /dev/null @@ -1,144 +0,0 @@ -// -// AbstractBinding.h -// -// Library: Data -// Package: DataCore -// Module: AbstractBinding -// -// Definition of the AbstractBinding class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractBinding_INCLUDED -#define Data_AbstractBinding_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractBinder.h" -#include "Poco/Any.h" -#include "Poco/RefCountedObject.h" -#include "Poco/AutoPtr.h" -#include <vector> -#include <list> -#include <deque> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -class Data_API AbstractBinding - /// AbstractBinding connects a value with a placeholder via an AbstractBinder interface. -{ -public: - typedef SharedPtr<AbstractBinding> Ptr; - typedef AbstractBinder::Ptr BinderPtr; - - enum Direction - { - PD_IN = AbstractBinder::PD_IN, - PD_OUT = AbstractBinder::PD_OUT, - PD_IN_OUT = AbstractBinder::PD_IN_OUT - }; - - AbstractBinding(const std::string& name = "", Direction direction = PD_IN, Poco::UInt32 bulkSize = 0); - /// Creates the AbstractBinding. - - virtual ~AbstractBinding(); - /// Destroys the AbstractBinding. - - void setBinder(BinderPtr pBinder); - /// Sets the object used for binding; object does NOT take ownership of the pointer. - - BinderPtr getBinder() const; - /// Returns the AbstractBinder used for binding data. - - virtual std::size_t numOfColumnsHandled() const = 0; - /// Returns the number of columns that the binding handles. - /// - /// The trivial case will be one single column but when - /// complex types are used this value can be larger than one. - - virtual std::size_t numOfRowsHandled() const = 0; - /// Returns the number of rows that the binding handles. - /// - /// The trivial case will be one single row but - /// for collection data types it can be larger. - - virtual bool canBind() const = 0; - /// Returns true if we have enough data to bind - - virtual void bind(std::size_t pos) = 0; - /// Binds a value to the given column position - - virtual void reset() = 0; - /// Allows a binding to be reused. - - AbstractBinder::Direction getDirection() const; - /// Returns the binding direction. - - const std::string& name() const; - /// Returns the name for this binding. - - bool isBulk() const; - /// Returns true if extraction is bulk. - - Poco::UInt32 bulkSize() const; - /// Returns the size of the bulk binding. - -private: - BinderPtr _pBinder; - std::string _name; - Direction _direction; - Poco::UInt32 _bulkSize; -}; - - -typedef std::vector<AbstractBinding::Ptr> AbstractBindingVec; -typedef std::deque<AbstractBinding::Ptr> AbstractBindingDeq; -typedef std::list<AbstractBinding::Ptr> AbstractBindingLst; - - -// -// inlines -// -inline AbstractBinder::Ptr AbstractBinding::getBinder() const -{ - return _pBinder; -} - - -inline const std::string& AbstractBinding::name() const -{ - return _name; -} - - -inline AbstractBinder::Direction AbstractBinding::getDirection() const -{ - return (AbstractBinder::Direction) _direction; -} - - -inline bool AbstractBinding::isBulk() const -{ - return _bulkSize > 0; -} - - -inline Poco::UInt32 AbstractBinding::bulkSize() const -{ - return _bulkSize; -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractBinding_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractExtraction.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractExtraction.h deleted file mode 100644 index d2ece0ec8e..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractExtraction.h +++ /dev/null @@ -1,278 +0,0 @@ -// -// AbstractExtraction.h -// -// Library: Data -// Package: DataCore -// Module: AbstractExtraction -// -// Definition of the AbstractExtraction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractExtraction_INCLUDED -#define Data_AbstractExtraction_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractExtractor.h" -#include "Poco/Data/AbstractPreparation.h" -#include "Poco/Data/Limit.h" -#include "Poco/RefCountedObject.h" -#include "Poco/UTFString.h" -#include "Poco/AutoPtr.h" -#include <vector> -#include <deque> -#include <list> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -class AbstractPreparator; - - -class Data_API AbstractExtraction - /// AbstractExtraction is the interface class that connects output positions to concrete values - /// retrieved via an AbstractExtractor. -{ -public: - typedef SharedPtr<AbstractExtraction> Ptr; - typedef SharedPtr<AbstractExtractor> ExtractorPtr; - typedef SharedPtr<AbstractPreparator> PreparatorPtr; - - AbstractExtraction(Poco::UInt32 limit = Limit::LIMIT_UNLIMITED, - Poco::UInt32 position = 0, bool bulk = false); - /// Creates the AbstractExtraction. A limit value equal to EXTRACT_UNLIMITED (0xffffffffu) - /// means that we extract as much data as possible during one execute. - /// Otherwise the limit value is used to partition data extracting to a limited amount of rows. - - virtual ~AbstractExtraction(); - /// Destroys the AbstractExtraction. - - void setExtractor(ExtractorPtr pExtractor); - /// Sets the class used for extracting the data. Does not take ownership of the pointer. - - ExtractorPtr getExtractor() const; - /// Retrieves the extractor object - - Poco::UInt32 position() const; - /// Returns the extraction position. - - virtual std::size_t numOfColumnsHandled() const = 0; - /// Returns the number of columns that the extraction handles. - /// - /// The trivial case will be one single column but when - /// complex types are used this value can be larger than one. - - virtual std::size_t numOfRowsHandled() const = 0; - /// Returns the number of rows that the extraction handles. - /// - /// The trivial case will be one single row but - /// for collection data types (ie vector) it can be larger. - - virtual std::size_t numOfRowsAllowed() const = 0; - /// Returns the upper limit on number of rows that the extraction will handle. - - virtual std::size_t extract(std::size_t pos) = 0; - /// Extracts a value from the param, starting at the given column position. - /// Returns the number of rows extracted. - - virtual void reset(); - /// Resets the extractor so that it can be re-used. - /// Does nothing in this implementation. - /// Implementations should override it for different behavior. - - virtual bool canExtract() const; - /// Returns true. Implementations should override it for different behavior. - - virtual AbstractPreparation::Ptr createPreparation(PreparatorPtr& pPrep, std::size_t pos) = 0; - /// Creates and returns shared pointer to Preparation object for the extracting object. - - void setLimit(Poco::UInt32 limit); - /// Sets the limit. - - Poco::UInt32 getLimit() const; - /// Gets the limit. - - virtual bool isNull(std::size_t row) const; - /// In implementations, this function returns true if value at row is null, - /// false otherwise. - /// Normal behavior is to replace nulls with default values. - /// However, extraction implementations may remember the underlying database - /// null values and be able to later provide information about them. - /// Here, this function throws NotImplementedException. - - bool isBulk() const; - /// Returns true if this is bulk extraction. - - void setEmptyStringIsNull(bool emptyStringIsNull); - /// Sets the empty string handling flag. - - bool getEmptyStringIsNull() const; - /// Returns the empty string handling flag. - - void setForceEmptyString(bool forceEmptyString); - /// Sets the force empty string flag. - - bool getForceEmptyString() const; - /// Returns the force empty string flag. - - template <typename T> - bool isValueNull(const T& /* str */, bool deflt) - /// Utility function to determine the nullness of the value. - /// This generic version always returns default value - /// (i.e. does nothing). The std::string overload does - /// the actual work. - /// - { - return deflt; - } - - bool isValueNull(const std::string& str, bool deflt); - /// Overload for const reference to std::string. - /// - /// Returns true when folowing conditions are met: - /// - /// - string is empty - /// - getEmptyStringIsNull() returns true - - bool isValueNull(const Poco::UTF16String& str, bool deflt); - /// Overload for const reference to UTF16String. - /// - /// Returns true when folowing conditions are met: - /// - /// - string is empty - /// - getEmptyStringIsNull() returns true - -private: - template <typename S> - bool isStringNull(const S& str, bool deflt) - { - if (getForceEmptyString()) return false; - - if (getEmptyStringIsNull() && str.empty()) - return true; - - return deflt; - } - - ExtractorPtr _pExtractor; - Poco::UInt32 _limit; - Poco::UInt32 _position; - bool _bulk; - bool _emptyStringIsNull; - bool _forceEmptyString; -}; - - -typedef std::vector<AbstractExtraction::Ptr> AbstractExtractionVec; -typedef std::vector<AbstractExtractionVec> AbstractExtractionVecVec; -typedef std::deque<AbstractExtraction::Ptr> AbstractExtractionDeq; -typedef std::vector<AbstractExtractionDeq> AbstractExtractionDeqVec; -typedef std::list<AbstractExtraction::Ptr> AbstractExtractionLst; -typedef std::vector<AbstractExtractionLst> AbstractExtractionLstVec; - - -// -// inlines -// -inline void AbstractExtraction::setExtractor(ExtractorPtr pExtractor) -{ - _pExtractor = pExtractor; -} - - -inline AbstractExtraction::ExtractorPtr AbstractExtraction::getExtractor() const -{ - return _pExtractor; -} - - -inline void AbstractExtraction::setLimit(Poco::UInt32 limit) -{ - _limit = limit; -} - - -inline Poco::UInt32 AbstractExtraction::getLimit() const -{ - return _limit; -} - - -inline bool AbstractExtraction::isNull(std::size_t /* row */) const -{ - throw NotImplementedException("Check for null values not implemented."); -} - - -inline Poco::UInt32 AbstractExtraction::position() const -{ - return _position; -} - - -inline bool AbstractExtraction::isBulk() const -{ - return _bulk; -} - - -inline void AbstractExtraction::reset() -{ -} - - -inline bool AbstractExtraction::canExtract() const -{ - return true; -} - - -inline void AbstractExtraction::setEmptyStringIsNull(bool emptyStringIsNull) -{ - _emptyStringIsNull = emptyStringIsNull; -} - - -inline bool AbstractExtraction::getEmptyStringIsNull() const -{ - return _emptyStringIsNull; -} - - -inline void AbstractExtraction::setForceEmptyString(bool forceEmptyString) -{ - _forceEmptyString = forceEmptyString; -} - - -inline bool AbstractExtraction::getForceEmptyString() const -{ - return _forceEmptyString; -} - - -inline bool AbstractExtraction::isValueNull(const std::string& str, bool deflt) -{ - return isStringNull(str, deflt); -} - - -inline bool AbstractExtraction::isValueNull(const Poco::UTF16String& str, bool deflt) -{ - return isStringNull(str, deflt); -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractExtraction_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractExtractor.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractExtractor.h deleted file mode 100644 index aa973bc29f..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractExtractor.h +++ /dev/null @@ -1,351 +0,0 @@ -// -// AbstractExtractor.h -// -// Library: Data -// Package: DataCore -// Module: AbstractExtractor -// -// Definition of the AbstractExtractor class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractExtractor_INCLUDED -#define Data_AbstractExtractor_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Constants.h" -#include "Poco/Data/LOB.h" -#include "Poco/UTFString.h" -#include <vector> -#include <deque> -#include <list> -#include <string> -#include <cstddef> - - -namespace Poco { - - -class DateTime; -class Any; - -namespace Dynamic { -class Var; -} - -namespace Data { - - -class Date; -class Time; - - -class Data_API AbstractExtractor - /// Interface used to extract data from a single result row. - /// If an extractor receives null it is not allowed to change val! -{ -public: - typedef SharedPtr<AbstractExtractor> Ptr; - - AbstractExtractor(); - /// Creates the AbstractExtractor. - - virtual ~AbstractExtractor(); - /// Destroys the AbstractExtractor. - - virtual bool extract(std::size_t pos, Poco::Int8& val) = 0; - /// Extracts an Int8. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::Int8>& val); - /// Extracts an Int8 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::Int8>& val); - /// Extracts an Int8 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::Int8>& val); - /// Extracts an Int8 list. - - virtual bool extract(std::size_t pos, Poco::UInt8& val) = 0; - /// Extracts an UInt8. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::UInt8>& val); - /// Extracts an UInt8 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::UInt8>& val); - /// Extracts an UInt8 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::UInt8>& val); - /// Extracts an UInt8 list. - - virtual bool extract(std::size_t pos, Poco::Int16& val) = 0; - /// Extracts an Int16. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::Int16>& val); - /// Extracts an Int16 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::Int16>& val); - /// Extracts an Int16 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::Int16>& val); - /// Extracts an Int16 list. - - virtual bool extract(std::size_t pos, Poco::UInt16& val) = 0; - /// Extracts an UInt16. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::UInt16>& val); - /// Extracts an UInt16 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::UInt16>& val); - /// Extracts an UInt16 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::UInt16>& val); - /// Extracts an UInt16 list. - - virtual bool extract(std::size_t pos, Poco::Int32& val) = 0; - /// Extracts an Int32. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::Int32>& val); - /// Extracts an Int32 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::Int32>& val); - /// Extracts an Int32 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::Int32>& val); - /// Extracts an Int32 list. - - virtual bool extract(std::size_t pos, Poco::UInt32& val) = 0; - /// Extracts an UInt32. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::UInt32>& val); - /// Extracts an UInt32 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::UInt32>& val); - /// Extracts an UInt32 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::UInt32>& val); - /// Extracts an UInt32 list. - - virtual bool extract(std::size_t pos, Poco::Int64& val) = 0; - /// Extracts an Int64. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::Int64>& val); - /// Extracts an Int64 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::Int64>& val); - /// Extracts an Int64 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::Int64>& val); - /// Extracts an Int64 list. - - virtual bool extract(std::size_t pos, Poco::UInt64& val) = 0; - /// Extracts an UInt64. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::UInt64>& val); - /// Extracts an UInt64 vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::UInt64>& val); - /// Extracts an UInt64 deque. - - virtual bool extract(std::size_t pos, std::list<Poco::UInt64>& val); - /// Extracts an UInt64 list. - -#ifndef POCO_LONG_IS_64_BIT - virtual bool extract(std::size_t pos, long& val) = 0; - /// Extracts a long. Returns false if null was received. - - virtual bool extract(std::size_t pos, unsigned long& val) = 0; - /// Extracts an unsigned long. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<long>& val); - /// Extracts a long vector. - - virtual bool extract(std::size_t pos, std::deque<long>& val); - /// Extracts a long deque. - - virtual bool extract(std::size_t pos, std::list<long>& val); - /// Extracts a long list. -#endif - - virtual bool extract(std::size_t pos, bool& val) = 0; - /// Extracts a boolean. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<bool>& val); - /// Extracts a boolean vector. - - virtual bool extract(std::size_t pos, std::deque<bool>& val); - /// Extracts a boolean deque. - - virtual bool extract(std::size_t pos, std::list<bool>& val); - /// Extracts a boolean list. - - virtual bool extract(std::size_t pos, float& val) = 0; - /// Extracts a float. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<float>& val); - /// Extracts a float vector. - - virtual bool extract(std::size_t pos, std::deque<float>& val); - /// Extracts a float deque. - - virtual bool extract(std::size_t pos, std::list<float>& val); - /// Extracts a float list. - - virtual bool extract(std::size_t pos, double& val) = 0; - /// Extracts a double. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<double>& val); - /// Extracts a double vector. - - virtual bool extract(std::size_t pos, std::deque<double>& val); - /// Extracts a double deque. - - virtual bool extract(std::size_t pos, std::list<double>& val); - /// Extracts a double list. - - virtual bool extract(std::size_t pos, char& val) = 0; - /// Extracts a single character. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<char>& val); - /// Extracts a character vector. - - virtual bool extract(std::size_t pos, std::deque<char>& val); - /// Extracts a character deque. - - virtual bool extract(std::size_t pos, std::list<char>& val); - /// Extracts a character list. - - virtual bool extract(std::size_t pos, std::string& val) = 0; - /// Extracts a string. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<std::string>& val); - /// Extracts a string vector. - - virtual bool extract(std::size_t pos, std::deque<std::string>& val); - /// Extracts a string deque. - - virtual bool extract(std::size_t pos, std::list<std::string>& val); - /// Extracts a string list. - - virtual bool extract(std::size_t pos, UTF16String& val); - /// Extracts a UTF16String. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<UTF16String>& val); - /// Extracts a UTF16String vector. - - virtual bool extract(std::size_t pos, std::deque<UTF16String>& val); - /// Extracts a UTF16String deque. - - virtual bool extract(std::size_t pos, std::list<UTF16String>& val); - /// Extracts a UTF16String list. - - virtual bool extract(std::size_t pos, BLOB& val) = 0; - /// Extracts a BLOB. Returns false if null was received. - - virtual bool extract(std::size_t pos, CLOB& val) = 0; - /// Extracts a CLOB. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<BLOB>& val); - /// Extracts a BLOB vector. - - virtual bool extract(std::size_t pos, std::deque<BLOB>& val); - /// Extracts a BLOB deque. - - virtual bool extract(std::size_t pos, std::list<BLOB>& val); - /// Extracts a BLOB list. - - virtual bool extract(std::size_t pos, std::vector<CLOB>& val); - /// Extracts a CLOB vector. - - virtual bool extract(std::size_t pos, std::deque<CLOB>& val); - /// Extracts a CLOB deque. - - virtual bool extract(std::size_t pos, std::list<CLOB>& val); - /// Extracts a CLOB list. - - virtual bool extract(std::size_t pos, DateTime& val) = 0; - /// Extracts a DateTime. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<DateTime>& val); - /// Extracts a DateTime vector. - - virtual bool extract(std::size_t pos, std::deque<DateTime>& val); - /// Extracts a DateTime deque. - - virtual bool extract(std::size_t pos, std::list<DateTime>& val); - /// Extracts a DateTime list. - - virtual bool extract(std::size_t pos, Date& val) = 0; - /// Extracts a Date. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Date>& val); - /// Extracts a Date vector. - - virtual bool extract(std::size_t pos, std::deque<Date>& val); - /// Extracts a Date deque. - - virtual bool extract(std::size_t pos, std::list<Date>& val); - /// Extracts a Date list. - - virtual bool extract(std::size_t pos, Time& val) = 0; - /// Extracts a Time. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Time>& val); - /// Extracts a Time vector. - - virtual bool extract(std::size_t pos, std::deque<Time>& val); - /// Extracts a Time deque. - - virtual bool extract(std::size_t pos, std::list<Time>& val); - /// Extracts a Time list. - - virtual bool extract(std::size_t pos, Any& val) = 0; - /// Extracts an Any. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Any>& val); - /// Extracts an Any vector. - - virtual bool extract(std::size_t pos, std::deque<Any>& val); - /// Extracts an Any deque. - - virtual bool extract(std::size_t pos, std::list<Any>& val); - /// Extracts an Any list. - - virtual bool extract(std::size_t pos, Poco::Dynamic::Var& val) = 0; - /// Extracts a Var. Returns false if null was received. - - virtual bool extract(std::size_t pos, std::vector<Poco::Dynamic::Var>& val); - /// Extracts a Var vector. - - virtual bool extract(std::size_t pos, std::deque<Poco::Dynamic::Var>& val); - /// Extracts a Var deque. - - virtual bool extract(std::size_t pos, std::list<Poco::Dynamic::Var>& val); - /// Extracts a Var list. - - virtual bool isNull(std::size_t col, std::size_t row = POCO_DATA_INVALID_ROW) = 0; - /// Returns true if the value at [col,row] position is null. - - virtual void reset(); - /// Resets any information internally cached by the extractor. -}; - - -/// -/// inlines -/// -inline void AbstractExtractor::reset() -{ - //default no-op -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractExtractor_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparation.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparation.h deleted file mode 100644 index 6d921572dc..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparation.h +++ /dev/null @@ -1,71 +0,0 @@ -// -// AbstractPreparation.h -// -// Library: Data -// Package: DataCore -// Module: AbstractPreparation -// -// Definition of the AbstractPreparation class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractPreparation_INCLUDED -#define Data_AbstractPreparation_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractPreparator.h" -#include "Poco/SharedPtr.h" -#include <cstddef> - - -namespace Poco { -namespace Data { - - -class Data_API AbstractPreparation - /// Interface for calling the appropriate AbstractPreparator method -{ -public: - typedef SharedPtr<AbstractPreparation> Ptr; - typedef AbstractPreparator::Ptr PreparatorPtr; - - AbstractPreparation(PreparatorPtr pPreparator); - /// Creates the AbstractPreparation. - - virtual ~AbstractPreparation(); - /// Destroys the AbstractPreparation. - - virtual void prepare() = 0; - /// Prepares data. - -protected: - AbstractPreparation(); - AbstractPreparation(const AbstractPreparation&); - AbstractPreparation& operator = (const AbstractPreparation&); - - PreparatorPtr preparation(); - /// Returns the preparation object - - PreparatorPtr _pPreparator; -}; - - -// -// inlines -// -inline AbstractPreparation::PreparatorPtr AbstractPreparation::preparation() -{ - return _pPreparator; -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractPreparation_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparator.h b/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparator.h deleted file mode 100644 index da086b051a..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/AbstractPreparator.h +++ /dev/null @@ -1,388 +0,0 @@ -// -// AbstractPreparator.h -// -// Library: Data -// Package: DataCore -// Module: AbstractPreparator -// -// Definition of the AbstractPreparator class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_AbstractPreparator_INCLUDED -#define Data_AbstractPreparator_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/RefCountedObject.h" -#include "Poco/Data/LOB.h" -#include "Poco/UTFString.h" -#include <vector> -#include <deque> -#include <list> -#include <cstddef> - - -namespace Poco { - - -class DateTime; -class Any; - -namespace Dynamic { -class Var; -} - - -namespace Data { - - -class Date; -class Time; - - -class Data_API AbstractPreparator - /// Interface used for database preparation where we first have to register all data types - /// (and memory output locations) before extracting data, e.g. ODBC. - /// Extract works as two-phase extract: first we call prepare once, then extract n-times. - /// There are cases (bulk operations using std::vector storage) when extract is called only once. - /// The value passed to a prepare() call is not used by the prepare, serving only as an indication - /// of the data type being prepared, thus all values are passed as const references. - /// Implementing this interface is not mandatory for a connector. Connectors that only extract data - /// after SQL execution (e.g. SQLite) do not need this functionality at all. -{ -public: - typedef SharedPtr<AbstractPreparator> Ptr; - - AbstractPreparator(Poco::UInt32 length = 1u); - /// Creates the AbstractPreparator. - - virtual ~AbstractPreparator(); - /// Destroys the AbstractPreparator. - - virtual void prepare(std::size_t pos, const Poco::Int8&) = 0; - /// Prepares an Int8. - - virtual void prepare(std::size_t pos, const std::vector<Poco::Int8>& val); - /// Prepares an Int8 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::Int8>& val); - /// Prepares an Int8 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::Int8>& val); - /// Prepares an Int8 list. - - virtual void prepare(std::size_t pos, const Poco::UInt8&) = 0; - /// Prepares an UInt8. - - virtual void prepare(std::size_t pos, const std::vector<Poco::UInt8>& val); - /// Prepares an UInt8 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::UInt8>& val); - /// Prepares an UInt8 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::UInt8>& val); - /// Prepares an UInt8 list. - - virtual void prepare(std::size_t pos, const Poco::Int16&) = 0; - /// Prepares an Int16. - - virtual void prepare(std::size_t pos, const std::vector<Poco::Int16>& val); - /// Prepares an Int16 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::Int16>& val); - /// Prepares an Int16 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::Int16>& val); - /// Prepares an Int16 list. - - virtual void prepare(std::size_t pos, const Poco::UInt16&) = 0; - /// Prepares an UInt16. - - virtual void prepare(std::size_t pos, const std::vector<Poco::UInt16>& val); - /// Prepares an UInt16 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::UInt16>& val); - /// Prepares an UInt16 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::UInt16>& val); - /// Prepares an UInt16 list. - - virtual void prepare(std::size_t pos, const Poco::Int32&) = 0; - /// Prepares an Int32. - - virtual void prepare(std::size_t pos, const std::vector<Poco::Int32>& val); - /// Prepares an Int32 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::Int32>& val); - /// Prepares an Int32 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::Int32>& val); - /// Prepares an Int32 list. - - virtual void prepare(std::size_t pos, const Poco::UInt32&) = 0; - /// Prepares an UInt32. - - virtual void prepare(std::size_t pos, const std::vector<Poco::UInt32>& val); - /// Prepares an UInt32 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::UInt32>& val); - /// Prepares an UInt32 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::UInt32>& val); - /// Prepares an UInt32 list. - - virtual void prepare(std::size_t pos, const Poco::Int64&) = 0; - /// Prepares an Int64. - - virtual void prepare(std::size_t pos, const std::vector<Poco::Int64>& val); - /// Prepares an Int64 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::Int64>& val); - /// Prepares an Int64 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::Int64>& val); - /// Prepares an Int64 list. - - virtual void prepare(std::size_t pos, const Poco::UInt64&) = 0; - /// Prepares an UInt64. - - virtual void prepare(std::size_t pos, const std::vector<Poco::UInt64>& val); - /// Prepares an UInt64 vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::UInt64>& val); - /// Prepares an UInt64 deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::UInt64>& val); - /// Prepares an UInt64 list. - -#ifndef POCO_LONG_IS_64_BIT - virtual void prepare(std::size_t pos, const long&) = 0; - /// Prepares a long. - - virtual void prepare(std::size_t pos, const unsigned long&) = 0; - /// Prepares an unsigned long. - - virtual void prepare(std::size_t pos, const std::vector<long>& val); - /// Prepares a long vector. - - virtual void prepare(std::size_t pos, const std::deque<long>& val); - /// Prepares a long deque. - - virtual void prepare(std::size_t pos, const std::list<long>& val); - /// Prepares a long list. -#endif - - virtual void prepare(std::size_t pos, const bool&) = 0; - /// Prepares a boolean. - - virtual void prepare(std::size_t pos, const std::vector<bool>& val); - /// Prepares a boolean vector. - - virtual void prepare(std::size_t pos, const std::deque<bool>& val); - /// Prepares a boolean deque. - - virtual void prepare(std::size_t pos, const std::list<bool>& val); - /// Prepares a boolean list. - - virtual void prepare(std::size_t pos, const float&) = 0; - /// Prepares a float. - - virtual void prepare(std::size_t pos, const std::vector<float>& val); - /// Prepares a float vector. - - virtual void prepare(std::size_t pos, const std::deque<float>& val); - /// Prepares a float deque. - - virtual void prepare(std::size_t pos, const std::list<float>& val); - /// Prepares a float list. - - virtual void prepare(std::size_t pos, const double&) = 0; - /// Prepares a double. - - virtual void prepare(std::size_t pos, const std::vector<double>& val); - /// Prepares a double vector. - - virtual void prepare(std::size_t pos, const std::deque<double>& val); - /// Prepares a double deque. - - virtual void prepare(std::size_t pos, const std::list<double>& val); - /// Prepares a double list. - - virtual void prepare(std::size_t pos, const char&) = 0; - /// Prepares a single character. - - virtual void prepare(std::size_t pos, const std::vector<char>& val); - /// Prepares a character vector. - - virtual void prepare(std::size_t pos, const std::deque<char>& val); - /// Prepares a character deque. - - virtual void prepare(std::size_t pos, const std::list<char>& val); - /// Prepares a character list. - - virtual void prepare(std::size_t pos, const std::string&) = 0; - /// Prepares a string. - - virtual void prepare(std::size_t pos, const std::vector<std::string>& val); - /// Prepares a string vector. - - virtual void prepare(std::size_t pos, const std::deque<std::string>& val); - /// Prepares a string deque. - - virtual void prepare(std::size_t pos, const std::list<std::string>& val); - /// Prepares a character list. - - virtual void prepare(std::size_t pos, const UTF16String&); - /// Prepares a UTF16String. - - virtual void prepare(std::size_t pos, const std::vector<UTF16String>& val); - /// Prepares a UTF16String vector. - - virtual void prepare(std::size_t pos, const std::deque<UTF16String>& val); - /// Prepares a UTF16String deque. - - virtual void prepare(std::size_t pos, const std::list<UTF16String>& val); - /// Prepares a UTF16String list. - - virtual void prepare(std::size_t pos, const BLOB&) = 0; - /// Prepares a BLOB. - - virtual void prepare(std::size_t pos, const CLOB&) = 0; - /// Prepares a CLOB. - - virtual void prepare(std::size_t pos, const std::vector<BLOB>& val); - /// Prepares a BLOB vector. - - virtual void prepare(std::size_t pos, const std::deque<BLOB>& val); - /// Prepares a BLOB deque. - - virtual void prepare(std::size_t pos, const std::list<BLOB>& val); - /// Prepares a BLOB list. - - virtual void prepare(std::size_t pos, const std::vector<CLOB>& val); - /// Prepares a CLOB vector. - - virtual void prepare(std::size_t pos, const std::deque<CLOB>& val); - /// Prepares a CLOB deque. - - virtual void prepare(std::size_t pos, const std::list<CLOB>& val); - /// Prepares a CLOB list. - - virtual void prepare(std::size_t pos, const DateTime&) = 0; - /// Prepares a DateTime. - - virtual void prepare(std::size_t pos, const std::vector<DateTime>& val); - /// Prepares a DateTime vector. - - virtual void prepare(std::size_t pos, const std::deque<DateTime>& val); - /// Prepares a DateTime deque. - - virtual void prepare(std::size_t pos, const std::list<DateTime>& val); - /// Prepares a DateTime list. - - virtual void prepare(std::size_t pos, const Date&) = 0; - /// Prepares a Date. - - virtual void prepare(std::size_t pos, const std::vector<Date>& val); - /// Prepares a Date vector. - - virtual void prepare(std::size_t pos, const std::deque<Date>& val); - /// Prepares a Date deque. - - virtual void prepare(std::size_t pos, const std::list<Date>& val); - /// Prepares a Date list. - - virtual void prepare(std::size_t pos, const Time&) = 0; - /// Prepares a Time. - - virtual void prepare(std::size_t pos, const std::vector<Time>& val); - /// Prepares a Time vector. - - virtual void prepare(std::size_t pos, const std::deque<Time>& val); - /// Prepares a Time deque. - - virtual void prepare(std::size_t pos, const std::list<Time>& val); - /// Prepares a Time list. - - virtual void prepare(std::size_t pos, const Any&) = 0; - /// Prepares an Any. - - virtual void prepare(std::size_t pos, const std::vector<Any>& val); - /// Prepares an Any vector. - - virtual void prepare(std::size_t pos, const std::deque<Any>& val); - /// Prepares an Any deque. - - virtual void prepare(std::size_t pos, const std::list<Any>& val); - /// Prepares an Any list. - - virtual void prepare(std::size_t pos, const Poco::Dynamic::Var&) = 0; - /// Prepares a Var. - - virtual void prepare(std::size_t pos, const std::vector<Poco::Dynamic::Var>& val); - /// Prepares a Var vector. - - virtual void prepare(std::size_t pos, const std::deque<Poco::Dynamic::Var>& val); - /// Prepares a Var deque. - - virtual void prepare(std::size_t pos, const std::list<Poco::Dynamic::Var>& val); - /// Prepares a Var list. - - void setLength(Poco::UInt32 length); - /// Sets the length of prepared data. - /// Needed only for data lengths greater than 1 (i.e. for - /// bulk operations). - - Poco::UInt32 getLength() const; - /// Returns the length of prepared data. Defaults to 1. - /// The length is greater than one for bulk operations. - - void setBulk(bool bulkPrep = true); - /// Sets bulk operation flag (always false at object creation time) - - bool isBulk() const; - /// Returns bulk operation flag. - -private: - Poco::UInt32 _length; - bool _bulk; -}; - - -/// -/// inlines -/// -inline void AbstractPreparator::setLength(Poco::UInt32 length) -{ - _length = length; -} - - -inline Poco::UInt32 AbstractPreparator::getLength() const -{ - return _length; -} - - -inline void AbstractPreparator::setBulk(bool bulkPrep) -{ - _bulk = bulkPrep; -} - - -inline bool AbstractPreparator::isBulk() const -{ - return _bulk; -} - - -} } // namespace Poco::Data - - -#endif // Data_AbstractPreparator_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/ArchiveStrategy.h b/contrib/libs/poco/Data/include/Poco/Data/ArchiveStrategy.h deleted file mode 100644 index 3b644c5f2f..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/ArchiveStrategy.h +++ /dev/null @@ -1,222 +0,0 @@ -// -// ArchiveStrategy.h -// -// Library: Data -// Package: Logging -// Module: ArchiveStrategy -// -// Definition of the ArchiveStrategy class and subclasses. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_ArchiveStrategy_INCLUDED -#define Data_ArchiveStrategy_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Session.h" -#include "Poco/DateTime.h" -#include "Poco/Timespan.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/SharedPtr.h" - - -namespace Poco { -namespace Data { - - -class Data_API ArchiveStrategy - /// The ArchiveStrategy is used by SQLChannel to archive log rows. -{ -public: - static const std::string DEFAULT_ARCHIVE_DESTINATION; - - ArchiveStrategy(const std::string& connector, - const std::string& connect, - const std::string& source, - const std::string& destination = DEFAULT_ARCHIVE_DESTINATION); - /// Creates archive strategy. - - virtual ~ArchiveStrategy(); - /// Destroys archive strategy. - - void open(); - /// Opens the session. - - virtual void archive() = 0; - /// Archives the rows. - - const std::string& getSource() const; - /// Returns the name of the source table containing rows to be archived. - - void setSource(const std::string& source); - /// Sets the name of the source table. - - const std::string& getDestination() const; - /// Returns the name of the destination table for rows to be archived. - - void setDestination(const std::string& destination); - /// Sets the name of the destination table. - - virtual const std::string& getThreshold() const = 0; - /// Returns the archive threshold. - - virtual void setThreshold(const std::string& threshold) = 0; - /// Sets the archive threshold. - -protected: - typedef Poco::SharedPtr<Session> SessionPtr; - typedef Poco::SharedPtr<Statement> StatementPtr; - - Session& session(); - - void setCopyStatement(); - void setDeleteStatement(); - void setCountStatement(); - - Statement& getCopyStatement(); - Statement& getDeleteStatement(); - Statement& getCountStatement(); -private: - - ArchiveStrategy(); - ArchiveStrategy(const ArchiveStrategy&); - ArchiveStrategy& operator = (const ArchiveStrategy&); - - std::string _connector; - std::string _connect; - SessionPtr _pSession; - StatementPtr _pCopyStatement; - StatementPtr _pDeleteStatement; - StatementPtr _pCountStatement; - std::string _source; - std::string _destination; -}; - - -// -// inlines -// - -inline const std::string& ArchiveStrategy::getSource() const -{ - return _source; -} - - -inline void ArchiveStrategy::setSource(const std::string& source) -{ - _source = source; -} - - -inline void ArchiveStrategy::setDestination(const std::string& destination) -{ - _destination = destination; -} - - -inline const std::string& ArchiveStrategy::getDestination() const -{ - return _destination; -} - - -inline Session& ArchiveStrategy::session() -{ - return *_pSession; -} - - -inline void ArchiveStrategy::setCopyStatement() -{ - _pCopyStatement = new Statement(*_pSession); -} - - -inline void ArchiveStrategy::setDeleteStatement() -{ - _pDeleteStatement = new Statement(*_pSession); -} - - -inline void ArchiveStrategy::setCountStatement() -{ - _pCountStatement = new Statement(*_pSession); -} - - -inline Statement& ArchiveStrategy::getCopyStatement() -{ - return *_pCopyStatement; -} - - -inline Statement& ArchiveStrategy::getDeleteStatement() -{ - return *_pDeleteStatement; -} - - -inline Statement& ArchiveStrategy::getCountStatement() -{ - return *_pCountStatement; -} - - - -// -// ArchiveByAgeStrategy -// -class Data_API ArchiveByAgeStrategy: public ArchiveStrategy - /// Archives rows scheduled for archiving. -{ -public: - ArchiveByAgeStrategy(const std::string& connector, - const std::string& connect, - const std::string& sourceTable, - const std::string& destinationTable = DEFAULT_ARCHIVE_DESTINATION); - - ~ArchiveByAgeStrategy(); - - void archive(); - - const std::string& getThreshold() const; - /// Returns the archive threshold. - - void setThreshold(const std::string& threshold); - /// Sets the archive threshold. - -private: - ArchiveByAgeStrategy(); - ArchiveByAgeStrategy(const ArchiveByAgeStrategy&); - ArchiveByAgeStrategy& operator = (const ArchiveByAgeStrategy&); - - void initStatements(); - - Timespan _maxAge; - std::string _ageString; - DateTime _archiveDateTime; - Poco::Dynamic::Var _archiveCount; -}; - - -// -// inlines -// - -inline const std::string& ArchiveByAgeStrategy::getThreshold() const -{ - return _ageString; -} - - -} } // namespace Poco::Data - - -#endif // Data_ArchiveStrategy_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Binding.h b/contrib/libs/poco/Data/include/Poco/Data/Binding.h deleted file mode 100644 index 464c3143e1..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Binding.h +++ /dev/null @@ -1,1496 +0,0 @@ -// -// Binding.h -// -// Library: Data -// Package: DataCore -// Module: Binding -// -// Definition of the Binding class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Binding_INCLUDED -#define Data_Binding_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractBinding.h" -#include "Poco/Data/DataException.h" -#include "Poco/Data/TypeHandler.h" -#include "Poco/SharedPtr.h" -#include "Poco/MetaProgramming.h" -#include "Poco/Bugcheck.h" -#include <vector> -#include <list> -#include <deque> -#include <set> -#include <map> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -template <class T> -class Binding: public AbstractBinding - /// Binding maps a value or multiple values (see Binding specializations for STL containers as - /// well as type handlers) to database column(s). Values to be bound can be either mapped - /// directly (by reference) or a copy can be created, depending on the value of the copy argument. - /// To pass a reference to a variable, it is recommended to pass it to the intermediate - /// utility function use(), which will create the proper binding. In cases when a reference - /// is passed to binding, the storage it refers to must be valid at the statement execution time. - /// To pass a copy of a variable, constant or string literal, use utility function bind(). - /// Variables can be passed as either copies or references (i.e. using either use() or bind()). - /// Constants, however, can only be passed as copies. this is best achieved using bind() utility - /// function. An attempt to pass a constant by reference shall result in compile-time error. -{ -public: - typedef T ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Binding<ValType> Type; - typedef SharedPtr<Type> Ptr; - - explicit Binding(T& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _bound(false) - /// Creates the Binding using the passed reference as bound value. - /// If copy is true, a copy of the value referred to is created. - { - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return 1u; - } - - bool canBind() const - { - return !_bound; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - TypeHandler<T>::bind(pos, _val, getBinder(), getDirection()); - _bound = true; - } - - void reset () - { - _bound = false; - AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); - } - -private: - const T& _val; - bool _bound; -}; - - - -template <class T> -class CopyBinding: public AbstractBinding - /// Binding maps a value or multiple values (see Binding specializations for STL containers as - /// well as type handlers) to database column(s). Values to be bound can be either mapped - /// directly (by reference) or a copy can be created, depending on the value of the copy argument. - /// To pass a reference to a variable, it is recommended to pass it to the intermediate - /// utility function use(), which will create the proper binding. In cases when a reference - /// is passed to binding, the storage it refers to must be valid at the statement execution time. - /// To pass a copy of a variable, constant or string literal, use utility function bind(). - /// Variables can be passed as either copies or references (i.e. using either use() or bind()). -{ -public: - typedef T ValType; - typedef SharedPtr<ValType> ValPtr; - typedef CopyBinding<ValType> Type; - typedef SharedPtr<Type> Ptr; - - explicit CopyBinding(T& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new T(val)), - _bound(false) - /// Creates the Binding using the passed reference as bound value. - /// If copy is true, a copy of the value referred to is created. - { - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return 1; - } - - bool canBind() const - { - return !_bound; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - TypeHandler<T>::bind(pos, *_pVal, getBinder(), getDirection()); - _bound = true; - } - - void reset () - { - _bound = false; - AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); - } - -private: - //typedef typename TypeWrapper<T>::TYPE ValueType; - ValPtr _pVal; - bool _bound; -}; - - -template <> -class Binding<const char*>: public AbstractBinding - /// Binding const char* specialization wraps char pointer into string. -{ -public: - typedef const char* ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Binding<const char*> Type; - typedef SharedPtr<Type> Ptr; - - explicit Binding(const char* pVal, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(pVal ? pVal : throw NullPointerException() ), - _bound(false) - /// Creates the Binding by copying the passed string. - { - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return 1u; - } - - std::size_t numOfRowsHandled() const - { - return 1u; - } - - bool canBind() const - { - return !_bound; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - TypeHandler<std::string>::bind(pos, _val, getBinder(), getDirection()); - _bound = true; - } - - void reset () - { - _bound = false; - AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); - } - -private: - std::string _val; - bool _bound; -}; - - - -template <> -class CopyBinding<const char*>: public AbstractBinding - /// Binding const char* specialization wraps char pointer into string. -{ -public: - typedef const char* ValType; - typedef SharedPtr<ValType> ValPtr; - typedef CopyBinding<const char*> Type; - typedef SharedPtr<Type> Ptr; - - explicit CopyBinding(const char* pVal, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(pVal ? pVal : throw NullPointerException() ), - _bound(false) - /// Creates the Binding by copying the passed string. - { - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return 1u; - } - - std::size_t numOfRowsHandled() const - { - return 1u; - } - - bool canBind() const - { - return !_bound; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - TypeHandler<std::string>::bind(pos, _val, getBinder(), getDirection()); - _bound = true; - } - - void reset () - { - _bound = false; - AbstractBinder::Ptr pBinder = getBinder(); - poco_assert_dbg (!pBinder.isNull()); - pBinder->reset(); - } - -private: - std::string _val; - bool _bound; -}; - - -template <class T> -class Binding<std::vector<T> >: public AbstractBinding - /// Specialization for std::vector. -{ -public: - typedef std::vector<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::vector<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class CopyBinding<std::vector<T> >: public AbstractBinding - /// Specialization for std::vector. -{ -public: - - typedef std::vector<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::vector<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::vector<T>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <> -class Binding<std::vector<bool> >: public AbstractBinding - /// Specialization for std::vector<bool>. - /// This specialization is necessary due to the nature of std::vector<bool>. - /// For details, see the standard library implementation of std::vector<bool> - /// or - /// S. Meyers: "Effective STL" (Copyright Addison-Wesley 2001), - /// Item 18: "Avoid using vector<bool>." - /// - /// The workaround employed here is using std::deque<bool> as an - /// internal replacement container. - /// - /// IMPORTANT: - /// Only IN binding is supported. -{ -public: - typedef std::vector<bool> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef ValType::const_iterator Iterator; - - explicit Binding(const std::vector<bool>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _deq(_val.begin(), _val.end()), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN != direction) - throw BindingException("Only IN direction is legal for std:vector<bool> binding."); - - if (numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return 1u; - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - - } - - void reset() - { - _begin = _deq.begin(); - _end = _deq.end(); - } - -private: - const std::vector<bool>& _val; - std::deque<bool> _deq; - std::deque<bool>::const_iterator _begin; - std::deque<bool>::const_iterator _end; -}; - - -template <> -class CopyBinding<std::vector<bool> >: public AbstractBinding - /// Specialization for std::vector<bool>. - /// This specialization is necessary due to the nature of std::vector<bool>. - /// For details, see the standard library implementation of std::vector<bool> - /// or - /// S. Meyers: "Effective STL" (Copyright Addison-Wesley 2001), - /// Item 18: "Avoid using vector<bool>." - /// - /// The workaround employed here is using std::deque<bool> as an - /// internal replacement container. - /// - /// IMPORTANT: - /// Only IN binding is supported. -{ -public: - typedef std::vector<bool> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef ValType::const_iterator Iterator; - - explicit CopyBinding(const std::vector<bool>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _deq(val.begin(), val.end()), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN != direction) - throw BindingException("Only IN direction is legal for std:vector<bool> binding."); - - if (numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return 1u; - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_deq.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<bool>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _deq.begin(); - _end = _deq.end(); - } - -private: - std::deque<bool> _deq; - std::deque<bool>::const_iterator _begin; - std::deque<bool>::const_iterator _end; -}; - - -template <class T> -class Binding<std::list<T> >: public AbstractBinding - /// Specialization for std::list. -{ -public: - typedef std::list<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::list<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _val.size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class CopyBinding<std::list<T> >: public AbstractBinding - /// Specialization for std::list. -{ -public: - typedef typename std::list<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(ValType& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::list<T>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class Binding<std::deque<T> >: public AbstractBinding - /// Specialization for std::deque. -{ -public: - typedef std::deque<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::deque<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _val.size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class CopyBinding<std::deque<T> >: public AbstractBinding - /// Specialization for std::deque. -{ -public: - typedef std::deque<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::deque<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::deque<T>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class Binding<std::set<T> >: public AbstractBinding - /// Specialization for std::set. -{ -public: - typedef std::set<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::set<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class CopyBinding<std::set<T> >: public AbstractBinding - /// Specialization for std::set. -{ -public: - typedef std::set<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::set<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::set<T>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class Binding<std::multiset<T> >: public AbstractBinding - /// Specialization for std::multiset. -{ -public: - typedef std::multiset<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::multiset<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class T> -class CopyBinding<std::multiset<T> >: public AbstractBinding - /// Specialization for std::multiset. -{ -public: - typedef std::multiset<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::multiset<T>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::multiset<T>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<T>::bind(pos, *_begin, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <class K, class V> -class Binding<std::map<K, V> >: public AbstractBinding - /// Specialization for std::map. -{ -public: - typedef std::map<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::map<K, V>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class K, class V> -class CopyBinding<std::map<K, V> >: public AbstractBinding - /// Specialization for std::map. -{ -public: - typedef std::map<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::map<K, V>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::map<K, V>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -template <class K, class V> -class Binding<std::multimap<K, V> >: public AbstractBinding - /// Specialization for std::multimap. -{ -public: - typedef std::multimap<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<Binding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit Binding(std::multimap<K, V>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _val(val), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~Binding() - /// Destroys the Binding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_val.size()); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _val.begin(); - _end = _val.end(); - } - -private: - const ValType& _val; - Iterator _begin; - Iterator _end; -}; - - -template <class K, class V> -class CopyBinding<std::multimap<K, V> >: public AbstractBinding - /// Specialization for std::multimap. -{ -public: - typedef std::multimap<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef SharedPtr<CopyBinding<ValType> > Ptr; - typedef typename ValType::const_iterator Iterator; - - explicit CopyBinding(std::multimap<K, V>& val, - const std::string& name = "", - Direction direction = PD_IN): - AbstractBinding(name, direction), - _pVal(new std::multimap<K, V>(val)), - _begin(), - _end() - /// Creates the Binding. - { - if (PD_IN == direction && numOfRowsHandled() == 0) - throw BindingException("It is illegal to bind to an empty data collection"); - reset(); - } - - ~CopyBinding() - /// Destroys the CopyBinding. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _pVal->size(); - } - - bool canBind() const - { - return _begin != _end; - } - - void bind(std::size_t pos) - { - poco_assert_dbg(!getBinder().isNull()); - poco_assert_dbg(canBind()); - TypeHandler<V>::bind(pos, _begin->second, getBinder(), getDirection()); - ++_begin; - } - - void reset() - { - _begin = _pVal->begin(); - _end = _pVal->end(); - } - -private: - ValPtr _pVal; - Iterator _begin; - Iterator _end; -}; - - -namespace Keywords { - - -template <typename T> -inline AbstractBinding::Ptr use(T& t, const std::string& name = "") - /// Convenience function for a more compact Binding creation. -{ - // If this fails to compile, a const ref was passed to use(). - // This can be resolved by either (a) using bind (which will copy the value), - // or (b) if the const ref is guaranteed to exist when execute is called - // (which can be much later!), by using the "useRef" keyword instead - poco_static_assert (!IsConst<T>::VALUE); - return new Binding<T>(t, name, AbstractBinding::PD_IN); -} - - -inline AbstractBinding::Ptr use(const NullData& t, const std::string& name = "") - /// NullData overload. -{ - return new Binding<NullData>(const_cast<NullData&>(t), name, AbstractBinding::PD_IN); -} - - -template <typename T> -inline AbstractBinding::Ptr useRef(T& t, const std::string& name = "") - /// Convenience function for a more compact Binding creation. -{ - return new Binding<T>(t, name, AbstractBinding::PD_IN); -} - - -template <typename T> -inline AbstractBinding::Ptr in(T& t, const std::string& name = "") - /// Convenience function for a more compact Binding creation. -{ - return use(t, name); -} - - -inline AbstractBinding::Ptr in(const NullData& t, const std::string& name = "") - /// NullData overload. -{ - return use(t, name); -} - - -template <typename T> -inline AbstractBinding::Ptr out(T& t) - /// Convenience function for a more compact Binding creation. -{ - poco_static_assert (!IsConst<T>::VALUE); - return new Binding<T>(t, "", AbstractBinding::PD_OUT); -} - - -template <typename T> -inline AbstractBinding::Ptr io(T& t) - /// Convenience function for a more compact Binding creation. -{ - poco_static_assert (!IsConst<T>::VALUE); - return new Binding<T>(t, "", AbstractBinding::PD_IN_OUT); -} - - -inline AbstractBindingVec& use(AbstractBindingVec& bv) - /// Convenience dummy function (for syntax purposes only). -{ - return bv; -} - - -inline AbstractBindingVec& in(AbstractBindingVec& bv) - /// Convenience dummy function (for syntax purposes only). -{ - return bv; -} - - -inline AbstractBindingVec& out(AbstractBindingVec& bv) - /// Convenience dummy function (for syntax purposes only). -{ - return bv; -} - - -inline AbstractBindingVec& io(AbstractBindingVec& bv) - /// Convenience dummy function (for syntax purposes only). -{ - return bv; -} - - -template <typename T> -inline AbstractBinding::Ptr bind(T t, const std::string& name) - /// Convenience function for a more compact Binding creation. - /// This funtion differs from use() in its value copy semantics. -{ - return new CopyBinding<T>(t, name, AbstractBinding::PD_IN); -} - - -template <typename T> -inline AbstractBinding::Ptr bind(T t) - /// Convenience function for a more compact Binding creation. - /// This funtion differs from use() in its value copy semantics. -{ - return Poco::Data::Keywords::bind(t, ""); -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_Binding_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Bulk.h b/contrib/libs/poco/Data/include/Poco/Data/Bulk.h deleted file mode 100644 index 7b30ae6335..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Bulk.h +++ /dev/null @@ -1,96 +0,0 @@ -// -// BulkExtraction.h -// -// Library: Data -// Package: DataCore -// Module: Bulk -// -// Definition of the BulkExtraction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Bulk_INCLUDED -#define Data_Bulk_INCLUDED - - -#include "Poco/Void.h" -#include "Poco/Data/Limit.h" - - -namespace Poco { -namespace Data { - - -class Data_API Bulk -{ -public: - Bulk(const Limit& limit); - /// Creates the Bulk. - - Bulk(Poco::UInt32 value); - /// Creates the Bulk. - - ~Bulk(); - /// Destroys the bulk. - - const Limit& limit() const; - /// Returns the limit asociated with this bulk object. - - Poco::UInt32 size() const; - /// Returns the value of the limit asociated with - /// this bulk object. - -private: - Bulk(); - - Limit _limit; -}; - - -/// -/// inlines -/// -inline const Limit& Bulk::limit() const -{ - return _limit; -} - - -inline Poco::UInt32 Bulk::size() const -{ - return _limit.value(); -} - - -namespace Keywords { - - -inline Bulk bulk(const Limit& limit = Limit(Limit::LIMIT_UNLIMITED, false, false)) - /// Convenience function for creation of bulk. -{ - return Bulk(limit); -} - - -inline void bulk(Void) - /// Dummy bulk function. Used for bulk binding creation - /// (see BulkBinding) and bulk extraction signalling to Statement. -{ -} - - -} // namespace Keywords - - -typedef void (*BulkFnType)(Void); - - -} } // namespace Poco::Data - - -#endif // Data_Bulk_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/BulkExtraction.h b/contrib/libs/poco/Data/include/Poco/Data/BulkExtraction.h deleted file mode 100644 index 75c25f69b7..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/BulkExtraction.h +++ /dev/null @@ -1,276 +0,0 @@ -// -// BulkExtraction.h -// -// Library: Data -// Package: DataCore -// Module: BulkExtraction -// -// Definition of the BulkExtraction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_BulkExtraction_INCLUDED -#define Data_BulkExtraction_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractExtraction.h" -#include "Poco/Data/Bulk.h" -#include "Poco/Data/Preparation.h" -#include <vector> - - -namespace Poco { -namespace Data { - - -template <class C> -class BulkExtraction: public AbstractExtraction - /// Specialization for bulk extraction of values from a query result set. - /// Bulk extraction support is provided only for following STL containers: - /// - std::vector - /// - std::deque - /// - std::list -{ -public: - typedef C ValType; - typedef typename C::value_type CValType; - typedef SharedPtr<ValType> ValPtr; - typedef BulkExtraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - BulkExtraction(C& result, Poco::UInt32 limit, const Position& pos = Position(0)): - AbstractExtraction(limit, pos.value(), true), - _rResult(result), - _default() - { - if (static_cast<Poco::UInt32>(result.size()) != limit) - result.resize(limit); - } - - BulkExtraction(C& result, const CValType& def, Poco::UInt32 limit, const Position& pos = Position(0)): - AbstractExtraction(limit, pos.value(), true), - _rResult(result), - _default(def) - { - if (static_cast<Poco::UInt32>(result.size()) != limit) - result.resize(limit); - } - - virtual ~BulkExtraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<C>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _rResult.size(); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - bool isNull(std::size_t row) const - { - try - { - return _nulls.at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - std::size_t extract(std::size_t col) - { - AbstractExtractor::Ptr pExt = getExtractor(); - TypeHandler<C>::extract(col, _rResult, _default, pExt); - typename C::iterator it = _rResult.begin(); - typename C::iterator end = _rResult.end(); - for (int row = 0; it !=end; ++it, ++row) - { - _nulls.push_back(isValueNull(*it, pExt->isNull(col, row))); - } - - return _rResult.size(); - } - - virtual void reset() - { - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t col) - { - Poco::UInt32 limit = getLimit(); - if (limit != _rResult.size()) _rResult.resize(limit); - pPrep->setLength(limit); - pPrep->setBulk(true); - return new Preparation<C>(pPrep, col, _rResult); - } - -protected: - const C& result() const - { - return _rResult; - } - -private: - C& _rResult; - CValType _default; - std::deque<bool> _nulls; -}; - - -template <class C> -class InternalBulkExtraction: public BulkExtraction<C> - /// Container Data Type specialization extension for extraction of values from a query result set. - /// - /// This class is intended for PocoData internal use - it is used by StatementImpl - /// to automaticaly create internal BulkExtraction in cases when statement returns data and no external storage - /// was supplied. It is later used by RecordSet to retrieve the fetched data after statement execution. - /// It takes ownership of the Column pointer supplied as constructor argument. Column object, in turn - /// owns the data container pointer. - /// - /// InternalBulkExtraction objects can not be copied or assigned. -{ -public: - typedef C ValType; - typedef typename C::value_type CValType; - typedef SharedPtr<ValType> ValPtr; - typedef InternalBulkExtraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - InternalBulkExtraction(C& result, - Column<C>* pColumn, - Poco::UInt32 limit, - const Position& pos = Position(0)): - BulkExtraction<C>(result, CValType(), limit, pos), - _pColumn(pColumn) - /// Creates InternalBulkExtraction. - { - } - - ~InternalBulkExtraction() - /// Destroys InternalBulkExtraction. - { - delete _pColumn; - } - - void reset() - { - _pColumn->reset(); - } - - const CValType& value(int index) const - { - try - { - return BulkExtraction<C>::result().at(index); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - bool isNull(std::size_t row) const - { - return BulkExtraction<C>::isNull(row); - } - - const Column<C>& column() const - { - return *_pColumn; - } - -private: - InternalBulkExtraction(); - InternalBulkExtraction(const InternalBulkExtraction&); - InternalBulkExtraction& operator = (const InternalBulkExtraction&); - - Column<C>* _pColumn; -}; - - -namespace Keywords { - - -template <typename T> -AbstractExtraction::Ptr into(std::vector<T>& t, const Bulk& bulk, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::vector bulk extraction support. -{ - return new BulkExtraction<std::vector<T> >(t, bulk.size(), pos); -} - - -template <typename T> -AbstractExtraction::Ptr into(std::vector<T>& t, BulkFnType, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::vector bulk extraction support. -{ - Poco::UInt32 size = static_cast<Poco::UInt32>(t.size()); - if (0 == size) throw InvalidArgumentException("Zero length not allowed."); - return new BulkExtraction<std::vector<T> >(t, size, pos); -} - - -template <typename T> -AbstractExtraction::Ptr into(std::deque<T>& t, const Bulk& bulk, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::deque bulk extraction support. -{ - return new BulkExtraction<std::deque<T> >(t, bulk.size(), pos); -} - - -template <typename T> -AbstractExtraction::Ptr into(std::deque<T>& t, BulkFnType, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::deque bulk extraction support. -{ - Poco::UInt32 size = static_cast<Poco::UInt32>(t.size()); - if (0 == size) throw InvalidArgumentException("Zero length not allowed."); - return new BulkExtraction<std::deque<T> >(t, size, pos); -} - - -template <typename T> -AbstractExtraction::Ptr into(std::list<T>& t, const Bulk& bulk, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::list bulk extraction support. -{ - return new BulkExtraction<std::list<T> >(t, bulk.size(), pos); -} - - -template <typename T> -AbstractExtraction::Ptr into(std::list<T>& t, BulkFnType, const Position& pos = Position(0)) - /// Convenience function to allow for a more compact creation of an extraction object - /// with std::list bulk extraction support. -{ - Poco::UInt32 size = static_cast<Poco::UInt32>(t.size()); - if (0 == size) throw InvalidArgumentException("Zero length not allowed."); - return new BulkExtraction<std::list<T> >(t, size, pos); -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_BulkExtraction_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Column.h b/contrib/libs/poco/Data/include/Poco/Data/Column.h deleted file mode 100644 index 22c44a2fa5..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Column.h +++ /dev/null @@ -1,490 +0,0 @@ -// -// Column.h -// -// Library: Data -// Package: DataCore -// Module: Column -// -// Definition of the Column class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Column_INCLUDED -#define Data_Column_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/MetaColumn.h" -#include "Poco/SharedPtr.h" -#include "Poco/RefCountedObject.h" -#include <vector> -#include <list> -#include <deque> - - -namespace Poco { -namespace Data { - - -template <class C> -class Column - /// Column class is column data container. - /// Data (a pointer to underlying STL container) is assigned to the class - /// at construction time. Construction with null pointer is not allowed. - /// This class owns the data assigned to it and deletes the storage on destruction. -{ -public: - typedef C Container; - typedef Poco::SharedPtr<C> ContainerPtr; - typedef typename C::const_iterator Iterator; - typedef typename C::const_reverse_iterator RIterator; - typedef typename C::size_type Size; - typedef typename C::value_type Type; - - Column(const MetaColumn& metaColumn, Container* pData): - _metaColumn(metaColumn), - _pData(pData) - /// Creates the Column. - { - if (!_pData) - throw NullPointerException("Container pointer must point to valid storage."); - } - - Column(const Column& col): - _metaColumn(col._metaColumn), - _pData(col._pData) - /// Creates the Column. - { - } - - ~Column() - /// Destroys the Column. - { - } - - Column& operator = (const Column& col) - /// Assignment operator. - { - Column tmp(col); - swap(tmp); - return *this; - } - - void swap(Column& other) - /// Swaps the column with another one. - { - using std::swap; - swap(_metaColumn, other._metaColumn); - swap(_pData, other._pData); - } - - Container& data() - /// Returns reference to contained data. - { - return *_pData; - } - - const Type& value(std::size_t row) const - /// Returns the field value in specified row. - { - try - { - return _pData->at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - const Type& operator [] (std::size_t row) const - /// Returns the field value in specified row. - { - return value(row); - } - - Size rowCount() const - /// Returns number of rows. - { - return _pData->size(); - } - - void reset() - /// Clears and shrinks the storage. - { - Container().swap(*_pData); - } - - const std::string& name() const - /// Returns column name. - { - return _metaColumn.name(); - } - - std::size_t length() const - /// Returns column maximum length. - { - return _metaColumn.length(); - } - - std::size_t precision() const - /// Returns column precision. - /// Valid for floating point fields only (zero for other data types). - { - return _metaColumn.precision(); - } - - std::size_t position() const - /// Returns column position. - { - return _metaColumn.position(); - } - - MetaColumn::ColumnDataType type() const - /// Returns column type. - { - return _metaColumn.type(); - } - - Iterator begin() const - /// Returns iterator pointing to the beginning of data storage vector. - { - return _pData->begin(); - } - - Iterator end() const - /// Returns iterator pointing to the end of data storage vector. - { - return _pData->end(); - } - -private: - Column(); - - MetaColumn _metaColumn; - ContainerPtr _pData; -}; - - -template <> -class Column<std::vector<bool> > - /// The std::vector<bool> specialization for the Column class. - /// - /// This specialization is necessary due to the nature of std::vector<bool>. - /// For details, see the standard library implementation of vector<bool> - /// or - /// S. Meyers: "Effective STL" (Copyright Addison-Wesley 2001), - /// Item 18: "Avoid using vector<bool>." - /// - /// The workaround employed here is using deque<bool> as an - /// internal "companion" container kept in sync with the vector<bool> - /// column data. -{ -public: - typedef std::vector<bool> Container; - typedef Poco::SharedPtr<Container> ContainerPtr; - typedef Container::const_iterator Iterator; - typedef Container::const_reverse_iterator RIterator; - typedef Container::size_type Size; - - Column(const MetaColumn& metaColumn, Container* pData): - _metaColumn(metaColumn), - _pData(pData) - /// Creates the Column. - { - poco_check_ptr (_pData); - _deque.assign(_pData->begin(), _pData->end()); - } - - Column(const Column& col): - _metaColumn(col._metaColumn), - _pData(col._pData) - /// Creates the Column. - { - _deque.assign(_pData->begin(), _pData->end()); - } - - ~Column() - /// Destroys the Column. - { - } - - Column& operator = (const Column& col) - /// Assignment operator. - { - Column tmp(col); - swap(tmp); - return *this; - } - - void swap(Column& other) - /// Swaps the column with another one. - { - using std::swap; - swap(_metaColumn, other._metaColumn); - swap(_pData, other._pData); - swap(_deque, other._deque); - } - - Container& data() - /// Returns reference to contained data. - { - return *_pData; - } - - const bool& value(std::size_t row) const - /// Returns the field value in specified row. - { - if (_deque.size() < _pData->size()) - _deque.resize(_pData->size()); - - try - { - return _deque.at(row) = _pData->at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - const bool& operator [] (std::size_t row) const - /// Returns the field value in specified row. - { - return value(row); - } - - Size rowCount() const - /// Returns number of rows. - { - return _pData->size(); - } - - void reset() - /// Clears and shrinks the storage. - { - Container().swap(*_pData); - _deque.clear(); - } - - const std::string& name() const - /// Returns column name. - { - return _metaColumn.name(); - } - - std::size_t length() const - /// Returns column maximum length. - { - return _metaColumn.length(); - } - - std::size_t precision() const - /// Returns column precision. - /// Valid for floating point fields only (zero for other data types). - { - return _metaColumn.precision(); - } - - std::size_t position() const - /// Returns column position. - { - return _metaColumn.position(); - } - - MetaColumn::ColumnDataType type() const - /// Returns column type. - { - return _metaColumn.type(); - } - - Iterator begin() const - /// Returns iterator pointing to the beginning of data storage vector. - { - return _pData->begin(); - } - - Iterator end() const - /// Returns iterator pointing to the end of data storage vector. - { - return _pData->end(); - } - -private: - Column(); - - MetaColumn _metaColumn; - ContainerPtr _pData; - mutable std::deque<bool> _deque; -}; - - -template <class T> -class Column<std::list<T> > - /// Column specialization for std::list -{ -public: - typedef std::list<T> Container; - typedef Poco::SharedPtr<Container> ContainerPtr; - typedef typename Container::const_iterator Iterator; - typedef typename Container::const_reverse_iterator RIterator; - typedef typename Container::size_type Size; - - Column(const MetaColumn& metaColumn, std::list<T>* pData): - _metaColumn(metaColumn), - _pData(pData) - /// Creates the Column. - { - poco_check_ptr (_pData); - } - - Column(const Column& col): - _metaColumn(col._metaColumn), - _pData(col._pData) - /// Creates the Column. - { - } - - ~Column() - /// Destroys the Column. - { - } - - Column& operator = (const Column& col) - /// Assignment operator. - { - Column tmp(col); - swap(tmp); - return *this; - } - - void swap(Column& other) - /// Swaps the column with another one. - { - using std::swap; - swap(_metaColumn, other._metaColumn); - swap(_pData, other._pData); - } - - Container& data() - /// Returns reference to contained data. - { - return *_pData; - } - - const T& value(std::size_t row) const - /// Returns the field value in specified row. - /// This is the std::list specialization and std::list - /// is not the optimal solution for cases where random - /// access is needed. - /// However, to allow for compatibility with other - /// containers, this functionality is provided here. - /// To alleviate the problem, an effort is made - /// to start iteration from beginning or end, - /// depending on the position requested. - { - if (row <= (std::size_t) (_pData->size() / 2)) - { - Iterator it = _pData->begin(); - Iterator end = _pData->end(); - for (int i = 0; it != end; ++it, ++i) - if (i == row) return *it; - } - else - { - row = _pData->size() - row; - RIterator it = _pData->rbegin(); - RIterator end = _pData->rend(); - for (int i = 1; it != end; ++it, ++i) - if (i == row) return *it; - } - - throw RangeException("Invalid row number."); - } - - const T& operator [] (std::size_t row) const - /// Returns the field value in specified row. - { - return value(row); - } - - Size rowCount() const - /// Returns number of rows. - { - return _pData->size(); - } - - void reset() - /// Clears the storage. - { - _pData->clear(); - } - - const std::string& name() const - /// Returns column name. - { - return _metaColumn.name(); - } - - std::size_t length() const - /// Returns column maximum length. - { - return _metaColumn.length(); - } - - std::size_t precision() const - /// Returns column precision. - /// Valid for floating point fields only (zero for other data types). - { - return _metaColumn.precision(); - } - - std::size_t position() const - /// Returns column position. - { - return _metaColumn.position(); - } - - MetaColumn::ColumnDataType type() const - /// Returns column type. - { - return _metaColumn.type(); - } - - Iterator begin() const - /// Returns iterator pointing to the beginning of data storage vector. - { - return _pData->begin(); - } - - Iterator end() const - /// Returns iterator pointing to the end of data storage vector. - { - return _pData->end(); - } - -private: - Column(); - - MetaColumn _metaColumn; - ContainerPtr _pData; -}; - - -template <typename C> -inline void swap(Column<C>& c1, Column<C>& c2) -{ - c1.swap(c2); -} - - -} } // namespace Poco::Data - - -#endif // Data_Column_INCLUDED - diff --git a/contrib/libs/poco/Data/include/Poco/Data/Connector.h b/contrib/libs/poco/Data/include/Poco/Data/Connector.h deleted file mode 100644 index ee922f4e0f..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Connector.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// Connector.h -// -// Library: Data -// Package: DataCore -// Module: Connector -// -// Definition of the Connector class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Connector_INCLUDED -#define Data_Connector_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/AutoPtr.h" - - -namespace Poco { -namespace Data { - - -class Data_API Connector - /// A Connector creates SessionImpl objects. - /// - /// Every connector library (like the SQLite or the ODBC connector) - /// provides a subclass of this class, an instance of which is - /// registered with the SessionFactory. -{ -public: - Connector(); - /// Creates the Connector. - - virtual ~Connector(); - /// Destroys the Connector. - - virtual const std::string& name() const = 0; - /// Returns the name associated with this connector. - - virtual Poco::AutoPtr<SessionImpl> createSession(const std::string& connectionString, - std::size_t timeout = SessionImpl::LOGIN_TIMEOUT_DEFAULT) = 0; - /// Create a SessionImpl object and initialize it with the given connectionString. -}; - - -} } // namespace Poco::Data - - -#endif // Data_Connector_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Constants.h b/contrib/libs/poco/Data/include/Poco/Data/Constants.h deleted file mode 100644 index 574c09bb4c..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Constants.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Data.h -// -// Library: Data -// Package: DataCore -// Module: Constants -// -// Constant definitions for the Poco Data library. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Constants_INCLUDED -#define Data_Constants_INCLUDED - - -#undef max -#include <limits> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -static const std::size_t POCO_DATA_INVALID_ROW = std::numeric_limits<std::size_t>::max(); - - -} } // namespace Poco::Data - - -#endif // Data_Constants_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Data.h b/contrib/libs/poco/Data/include/Poco/Data/Data.h deleted file mode 100644 index 8a9e532e95..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Data.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// Data.h -// -// Library: Data -// Package: DataCore -// Module: Data -// -// Basic definitions for the Poco Data library. -// This file must be the first file included by every other Data -// header file. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Data_INCLUDED -#define Data_Data_INCLUDED - - -#include "Poco/Foundation.h" - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the Data_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// Data_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && defined(POCO_DLL) - #if defined(Data_EXPORTS) - #define Data_API __declspec(dllexport) - #else - #define Data_API __declspec(dllimport) - #endif -#endif - - -#if !defined(Data_API) - #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) - #define Data_API __attribute__ ((visibility ("default"))) - #else - #define Data_API - #endif -#endif - - -// -// Automatically link Data library. -// -#if defined(_MSC_VER) - #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Data_EXPORTS) - #pragma comment(lib, "PocoData" POCO_LIB_SUFFIX) - #endif -#endif - - -#endif // Data_Data_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/DataException.h b/contrib/libs/poco/Data/include/Poco/Data/DataException.h deleted file mode 100644 index cc976e2fac..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/DataException.h +++ /dev/null @@ -1,50 +0,0 @@ -// -// DataException.h -// -// Library: Data -// Package: DataCore -// Module: DataException -// -// Definition of the DataException class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_DataException_INCLUDED -#define Data_DataException_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace Data { - - -POCO_DECLARE_EXCEPTION(Data_API, DataException, Poco::IOException) -POCO_DECLARE_EXCEPTION(Data_API, RowDataMissingException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, UnknownDataBaseException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, UnknownTypeException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, ExecutionException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, BindingException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, ExtractException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, LimitException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, NotSupportedException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, SessionUnavailableException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, SessionPoolExhaustedException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, SessionPoolExistsException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, NoDataException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, LengthExceededException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, ConnectionFailedException, DataException) -POCO_DECLARE_EXCEPTION(Data_API, NotConnectedException, DataException) - - -} } // namespace Poco::Data - - -#endif // Data_DataException_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Date.h b/contrib/libs/poco/Data/include/Poco/Data/Date.h deleted file mode 100644 index 4ac234bb75..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Date.h +++ /dev/null @@ -1,225 +0,0 @@ -// -// Date.h -// -// Library: Data -// Package: DataCore -// Module: Date -// -// Definition of the Date class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Date_INCLUDED -#define Data_Date_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Dynamic/VarHolder.h" -#include "Poco/Exception.h" - - -namespace Poco { - -class DateTime; - -namespace Dynamic { - -class Var; - -} - -namespace Data { - - -class Time; - - -class Data_API Date - /// Date class wraps a DateTime and exposes date related interface. - /// The purpose of this class is binding/extraction support for date fields. -{ -public: - Date(); - /// Creates the Date - - Date(int year, int month, int day); - /// Creates the Date - - Date(const DateTime& dt); - /// Creates the Date from DateTime - - ~Date(); - /// Destroys the Date. - - int year() const; - /// Returns the year. - - int month() const; - /// Returns the month. - - int day() const; - /// Returns the day. - - void assign(int year, int month, int day); - /// Assigns date. - - Date& operator = (const Date& d); - /// Assignment operator for Date. - - Date& operator = (const DateTime& dt); - /// Assignment operator for DateTime. - - Date& operator = (const Poco::Dynamic::Var& var); - /// Assignment operator for Var. - - bool operator == (const Date& date) const; - /// Equality operator. - - bool operator != (const Date& date) const; - /// Inequality operator. - - bool operator < (const Date& date) const; - /// Less then operator. - - bool operator > (const Date& date) const; - /// Greater then operator. - -private: - int _year; - int _month; - int _day; -}; - - -// -// inlines -// -inline int Date::year() const -{ - return _year; -} - - -inline int Date::month() const -{ - return _month; -} - - -inline int Date::day() const -{ - return _day; -} - - -inline Date& Date::operator = (const Date& d) -{ - assign(d.year(), d.month(), d.day()); - return *this; -} - - -inline Date& Date::operator = (const DateTime& dt) -{ - assign(dt.year(), dt.month(), dt.day()); - return *this; -} - - -inline bool Date::operator == (const Date& date) const -{ - return _year == date.year() && - _month == date.month() && - _day == date.day(); -} - - -inline bool Date::operator != (const Date& date) const -{ - return !(*this == date); -} - - -inline bool Date::operator > (const Date& date) const -{ - return !(*this == date) && !(*this < date); -} - - -} } // namespace Poco::Data - - -// -// VarHolderImpl<Date> -// - - -namespace Poco { -namespace Dynamic { - - -template <> -class VarHolderImpl<Poco::Data::Date>: public VarHolder -{ -public: - VarHolderImpl(const Poco::Data::Date& val): _val(val) - { - } - - ~VarHolderImpl() - { - } - - const std::type_info& type() const - { - return typeid(Poco::Data::Date); - } - - void convert(Poco::Timestamp& val) const - { - DateTime dt; - dt.assign(_val.year(), _val.month(), _val.day()); - val = dt.timestamp(); - } - - void convert(Poco::DateTime& val) const - { - val.assign(_val.year(), _val.month(), _val.day()); - } - - void convert(Poco::LocalDateTime& val) const - { - val.assign(_val.year(), _val.month(), _val.day()); - } - - void convert(std::string& val) const - { - DateTime dt(_val.year(), _val.month(), _val.day()); - val = DateTimeFormatter::format(dt, "%Y/%m/%d"); - } - - VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const - { - return cloneHolder(pVarHolder, _val); - } - - const Poco::Data::Date& value() const - { - return _val; - } - -private: - VarHolderImpl(); - Poco::Data::Date _val; -}; - - -} } // namespace Poco::Dynamic - - -#endif // Data_Date_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/DynamicDateTime.h b/contrib/libs/poco/Data/include/Poco/Data/DynamicDateTime.h deleted file mode 100644 index 0ed8730540..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/DynamicDateTime.h +++ /dev/null @@ -1,47 +0,0 @@ -// -// DynamicDateTime.h -// -// Library: Data -// Package: DataCore -// Module: DynamicDateTime -// -// Definition of the Date and Time cast operators for Poco::Dynamic::Var. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_DynamicDateTime_INCLUDED -#define Data_DynamicDateTime_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Date.h" -#include "Poco/Data/Time.h" -#include "Poco/Dynamic/Var.h" - - -namespace Poco { -namespace Data { - -class Date; -class Time; - -} } // namespace Poco::Data - - -namespace Poco { -namespace Dynamic { - - -template <> Data_API Var::operator Poco::Data::Date () const; -template <> Data_API Var::operator Poco::Data::Time () const; - - -} } // namespace Poco::Dynamic - - -#endif // Data_DynamicDateTime_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/DynamicLOB.h b/contrib/libs/poco/Data/include/Poco/Data/DynamicLOB.h deleted file mode 100644 index 1ed817d26e..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/DynamicLOB.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// DynamicLOB.h -// -// Library: Data -// Package: DataCore -// Module: DynamicLOB -// -// Definition of the Poco::Dynamic::Var LOB cast operators. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_DynamicLOB_INCLUDED -#define Data_DynamicLOB_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/LOB.h" -#include "Poco/Dynamic/Var.h" - - -namespace Poco { -namespace Data { - -template <typename T> class LOB; -typedef LOB<unsigned char> BLOB; -typedef LOB<char> CLOB; - -} } // namespace Poco::Data - - -namespace Poco { -namespace Dynamic { - -template <> Data_API Var::operator Poco::Data::CLOB () const; -template <> Data_API Var::operator Poco::Data::BLOB () const; - -} } // namespace Poco::Dynamic - - -#endif // Data_DynamicLOB_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Extraction.h b/contrib/libs/poco/Data/include/Poco/Data/Extraction.h deleted file mode 100644 index c7453e23c9..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Extraction.h +++ /dev/null @@ -1,869 +0,0 @@ -// -// Extraction.h -// -// Library: Data -// Package: DataCore -// Module: Extraction -// -// Definition of the Extraction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Extraction_INCLUDED -#define Data_Extraction_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractExtraction.h" -#include "Poco/Data/Preparation.h" -#include "Poco/Data/TypeHandler.h" -#include "Poco/Data/Column.h" -#include "Poco/Data/Position.h" -#include "Poco/Data/DataException.h" -#include <set> -#include <vector> -#include <list> -#include <deque> -#include <map> -#include <cstddef> - - -namespace Poco { -namespace Data { - - -template <class T> -class Extraction: public AbstractExtraction - /// Concrete Data Type specific extraction of values from a query result set. -{ -public: - typedef T ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(T& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(), - _extracted(false), - _null(false) - /// Creates an Extraction object at specified position. - /// Uses an empty object T as default value. - { - } - - Extraction(T& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def), - _extracted(false), - _null(false) - /// Creates an Extraction object at specified position. - /// Uses the provided def object as default value. - { - } - - ~Extraction() - /// Destroys the Extraction object. - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _extracted ? 1u : 0; - } - - std::size_t numOfRowsAllowed() const - { - return 1u; - } - - bool isNull(std::size_t /* row */ = 0) const - { - return _null; - } - - std::size_t extract(std::size_t pos) - { - if (_extracted) throw ExtractException("value already extracted"); - _extracted = true; - AbstractExtractor::Ptr pExt = getExtractor(); - TypeHandler<T>::extract(pos, _rResult, _default, pExt); - _null = isValueNull<T>(_rResult, pExt->isNull(pos)); - - return 1u; - } - - void reset() - { - _extracted = false; - } - - bool canExtract() const - { - return !_extracted; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _rResult); - } - -private: - T& _rResult; - T _default; - bool _extracted; - bool _null; -}; - - -template <class T> -class Extraction<std::vector<T> >: public AbstractExtraction - /// Vector Data Type specialization for extraction of values from a query result set. -{ -public: - - typedef std::vector<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::vector<T>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::vector<T>& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - virtual ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - bool isNull(std::size_t row) const - { - try - { - return _nulls.at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - std::size_t extract(std::size_t pos) - { - AbstractExtractor::Ptr pExt = getExtractor(); - _rResult.push_back(_default); - TypeHandler<T>::extract(pos, _rResult.back(), _default, pExt); - _nulls.push_back(isValueNull(_rResult.back(), pExt->isNull(pos))); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _default); - } - - void reset() - { - _nulls.clear(); - } - -protected: - - const std::vector<T>& result() const - { - return _rResult; - } - -private: - std::vector<T>& _rResult; - T _default; - std::deque<bool> _nulls; -}; - - -template <> -class Extraction<std::vector<bool> >: public AbstractExtraction - /// Vector bool specialization for extraction of values from a query result set. -{ -public: - typedef std::vector<bool> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::vector<bool>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::vector<bool>& result, const bool& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - virtual ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<bool>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - bool isNull(std::size_t row) const - { - try - { - return _nulls.at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - std::size_t extract(std::size_t pos) - { - AbstractExtractor::Ptr pExt = getExtractor(); - - bool tmp = _default; - TypeHandler<bool>::extract(pos, tmp, _default, pExt); - _rResult.push_back(tmp); - _nulls.push_back(pExt->isNull(pos)); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<bool>(pPrep, pos, _default); - } - - void reset() - { - _nulls.clear(); - } - -protected: - - const std::vector<bool>& result() const - { - return _rResult; - } - -private: - std::vector<bool>& _rResult; - bool _default; - std::deque<bool> _nulls; -}; - - -template <class T> -class Extraction<std::list<T> >: public AbstractExtraction - /// List Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::list<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::list<T>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::list<T>& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - virtual ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _rResult.size(); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - bool isNull(std::size_t row) const - { - try - { - return _nulls.at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - std::size_t extract(std::size_t pos) - { - AbstractExtractor::Ptr pExt = getExtractor(); - _rResult.push_back(_default); - TypeHandler<T>::extract(pos, _rResult.back(), _default, pExt); - _nulls.push_back(isValueNull(_rResult.back(), pExt->isNull(pos))); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _default); - } - - void reset() - { - _nulls.clear(); - } - -protected: - - const std::list<T>& result() const - { - return _rResult; - } - -private: - std::list<T>& _rResult; - T _default; - std::deque<bool> _nulls; -}; - - -template <class T> -class Extraction<std::deque<T> >: public AbstractExtraction - /// Deque Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::deque<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::deque<T>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::deque<T>& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - virtual ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return _rResult.size(); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - bool isNull(std::size_t row) const - { - try - { - return _nulls.at(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - std::size_t extract(std::size_t pos) - { - AbstractExtractor::Ptr pExt = getExtractor(); - _rResult.push_back(_default); - TypeHandler<T>::extract(pos, _rResult.back(), _default, pExt); - _nulls.push_back(isValueNull(_rResult.back(), pExt->isNull(pos))); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _default); - } - - void reset() - { - _nulls.clear(); - } - -protected: - - const std::deque<T>& result() const - { - return _rResult; - } - -private: - std::deque<T>& _rResult; - T _default; - std::deque<bool> _nulls; -}; - - -template <class C> -class InternalExtraction: public Extraction<C> - /// Container Data Type specialization extension for extraction of values from a query result set. - /// - /// This class is intended for PocoData internal use - it is used by StatementImpl - /// to automaticaly create internal Extraction in cases when statement returns data and no external storage - /// was supplied. It is later used by RecordSet to retrieve the fetched data after statement execution. - /// It takes ownership of the Column pointer supplied as constructor argument. Column object, in turn - /// owns the data container pointer. - /// - /// InternalExtraction objects can not be copied or assigned. -{ -public: - typedef typename C::value_type ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - - InternalExtraction(C& result, Column<C>* pColumn, const Position& pos = Position(0)): - Extraction<C>(result, ValType(), pos), - _pColumn(pColumn) - /// Creates InternalExtraction. - { - } - - ~InternalExtraction() - /// Destroys InternalExtraction. - { - delete _pColumn; - } - - void reset() - { - Extraction<C>::reset(); - _pColumn->reset(); - } - - const ValType& value(int index) const - { - try - { - return Extraction<C>::result().at(index); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } - } - - bool isNull(std::size_t row) const - { - return Extraction<C>::isNull(row); - } - - const Column<C>& column() const - { - return *_pColumn; - } - -private: - InternalExtraction(); - InternalExtraction(const InternalExtraction&); - InternalExtraction& operator = (const InternalExtraction&); - - Column<C>* _pColumn; -}; - - -template <class T> -class Extraction<std::set<T> >: public AbstractExtraction - /// Set Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::set<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - typedef typename ValType::iterator Iterator; - - Extraction(std::set<T>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::set<T>& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - std::size_t extract(std::size_t pos) - { - T tmp; - TypeHandler<T>::extract(pos, tmp, _default, getExtractor()); - _rResult.insert(tmp); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _default); - } - -private: - std::set<T>& _rResult; - T _default; -}; - - -template <class T> -class Extraction<std::multiset<T> >: public AbstractExtraction - /// Multiset Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::multiset<T> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::multiset<T>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::multiset<T>& result, const T& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<T>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - std::size_t extract(std::size_t pos) - { - T tmp; - TypeHandler<T>::extract(pos, tmp, _default, getExtractor()); - _rResult.insert(tmp); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<T>(pPrep, pos, _default); - } - -private: - std::multiset<T>& _rResult; - T _default; -}; - - -template <class K, class V> -class Extraction<std::map<K, V> >: public AbstractExtraction - /// Map Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::map<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::map<K, V>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::map<K, V>& result, const V& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - std::size_t extract(std::size_t pos) - { - V tmp; - TypeHandler<V>::extract(pos, tmp, _default, getExtractor()); - _rResult.insert(std::make_pair(tmp(), tmp)); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<V>(pPrep, pos, _default); - } - -private: - std::map<K, V>& _rResult; - V _default; -}; - - -template <class K, class V> -class Extraction<std::multimap<K, V> >: public AbstractExtraction - /// Multimap Data Type specialization for extraction of values from a query result set. -{ -public: - typedef std::multimap<K, V> ValType; - typedef SharedPtr<ValType> ValPtr; - typedef Extraction<ValType> Type; - typedef SharedPtr<Type> Ptr; - - Extraction(std::multimap<K, V>& result, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default() - { - _rResult.clear(); - } - - Extraction(std::multimap<K, V>& result, const V& def, const Position& pos = Position(0)): - AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), - _default(def) - { - _rResult.clear(); - } - - ~Extraction() - { - } - - std::size_t numOfColumnsHandled() const - { - return TypeHandler<V>::size(); - } - - std::size_t numOfRowsHandled() const - { - return static_cast<std::size_t>(_rResult.size()); - } - - std::size_t numOfRowsAllowed() const - { - return getLimit(); - } - - std::size_t extract(std::size_t pos) - { - V tmp; - TypeHandler<V>::extract(pos, tmp, _default, getExtractor()); - _rResult.insert(std::make_pair(tmp(), tmp)); - return 1u; - } - - AbstractPreparation::Ptr createPreparation(AbstractPreparator::Ptr& pPrep, std::size_t pos) - { - return new Preparation<V>(pPrep, pos, _default); - } - -private: - std::multimap<K, V>& _rResult; - V _default; -}; - - -namespace Keywords { - - -template <typename T> -inline AbstractExtraction::Ptr into(T& t) - /// Convenience function to allow for a more compact creation of an extraction object. -{ - return new Extraction<T>(t); -} - - -template <typename T> -inline AbstractExtraction::Ptr into(T& t, const Position& pos) - /// Convenience function to allow for a more compact creation of an extraction object - /// with multiple recordset support. -{ - return new Extraction<T>(t, pos); -} - - -template <typename T> -inline AbstractExtraction::Ptr into(T& t, const Position& pos, const T& def) - /// 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>(t, def, pos); -} - - -inline AbstractExtractionVecVec& into(AbstractExtractionVecVec& evv) - /// Convenience dummy function (for syntax purposes only). -{ - return evv; -} - - -inline AbstractExtractionVec& into(AbstractExtractionVec& ev) - /// Convenience dummy function (for syntax purposes only). -{ - return ev; -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_Extraction_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/LOB.h b/contrib/libs/poco/Data/include/Poco/Data/LOB.h deleted file mode 100644 index d90b09fc9b..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/LOB.h +++ /dev/null @@ -1,313 +0,0 @@ -// -// LOB.h -// -// Library: Data -// Package: DataCore -// Module: LOB -// -// Definition of the LOB class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_LOB_INCLUDED -#define Data_LOB_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/SharedPtr.h" -#include "Poco/Dynamic/VarHolder.h" -#include "Poco/Exception.h" -#include <vector> -#include <algorithm> - - -namespace Poco { -namespace Data { - - -template <typename T> -class LOB - /// Representation of a Large OBject. - /// - /// A LOB can hold arbitrary data. - /// The maximum size depends on the underlying database. - /// - /// The LOBInputStream and LOBOutputStream classes provide - /// a convenient way to access the data in a LOB. -{ -public: - typedef typename std::vector<T>::const_iterator Iterator; - typedef T ValueType; - typedef typename std::vector<T> Container; - typedef Poco::SharedPtr<Container> ContentPtr; - - LOB(): _pContent(new std::vector<T>()) - /// Creates an empty LOB. - { - } - - LOB(const std::vector<T>& content): - _pContent(new std::vector<T>(content)) - /// Creates the LOB, content is deep-copied. - { - } - - LOB(const T* const pContent, std::size_t size): - _pContent(new std::vector<T>(pContent, pContent + size)) - /// Creates the LOB by deep-copying pContent. - { - } - - LOB(const std::basic_string<T>& content): - _pContent(new std::vector<T>(content.begin(), content.end())) - /// Creates a LOB from a string. - { - } - - LOB(const LOB& other): _pContent(other._pContent) - /// Creates a LOB by copying another one. - { - } - - ~LOB() - /// Destroys the LOB. - { - } - - LOB& operator = (const LOB& other) - /// Assignment operator. - { - LOB tmp(other); - swap(tmp); - return *this; - } - - bool operator == (const LOB& other) const - /// Compares for equality LOB by value. - { - return *_pContent == *other._pContent; - } - - bool operator != (const LOB& other) const - /// Compares for inequality LOB by value. - { - return *_pContent != *other._pContent; - } - - void swap(LOB& other) - /// Swaps the LOB with another one. - { - using std::swap; - swap(_pContent, other._pContent); - } - - const std::vector<T>& content() const - /// Returns the content. - { - return *_pContent; - } - - const T* rawContent() const - /// Returns the raw content. - /// - /// If the LOB is empty, returns NULL. - { - if (_pContent->empty()) - return 0; - else - return &(*_pContent)[0]; - } - - void assignVal(std::size_t count, const T& val) - /// Assigns raw content to internal storage. - { - ContentPtr tmp = new Container(count, val); - _pContent.swap(tmp); - } - - void assignRaw(const T* ptr, std::size_t count) - /// Assigns raw content to internal storage. - { - poco_assert_dbg (ptr); - LOB tmp(ptr, count); - swap(tmp); - } - - void appendRaw(const T* pChar, std::size_t count) - /// Assigns raw content to internal storage. - { - poco_assert_dbg (pChar); - _pContent->insert(_pContent->end(), pChar, pChar+count); - } - - void clear(bool doCompact = false) - /// Clears the content of the blob. - /// If doCompact is true, trims the excess capacity. - { - _pContent->clear(); - if (doCompact) compact(); - } - - void compact() - /// Trims the internal storage excess capacity. - { - std::vector<T>(*_pContent).swap(*_pContent); - } - - Iterator begin() const - { - return _pContent->begin(); - } - - Iterator end() const - { - return _pContent->end(); - } - - std::size_t size() const - /// Returns the size of the LOB in bytes. - { - return static_cast<std::size_t>(_pContent->size()); - } - -private: - ContentPtr _pContent; -}; - - -typedef LOB<unsigned char> BLOB; -typedef LOB<char> CLOB; - - -// -// inlines -// - - -} } // namespace Poco::Data - - -namespace std -{ - template<> - inline void swap<Poco::Data::BLOB>(Poco::Data::BLOB& b1, - Poco::Data::BLOB& b2) - /// Full template specalization of std:::swap for BLOB - { - b1.swap(b2); - } - - template<> - inline void swap<Poco::Data::CLOB>(Poco::Data::CLOB& c1, - Poco::Data::CLOB& c2) - /// Full template specalization of std:::swap for CLOB - { - c1.swap(c2); - } -} - - -namespace Poco { namespace Data -{ - template <typename T> - inline void swap(LOB<T>& b1, LOB<T>& b2) - { - b1.swap(b2); - } -} } - - -// -// VarHolderImpl<LOB> -// - - -namespace Poco { -namespace Dynamic { - - -template <> -class VarHolderImpl<Poco::Data::BLOB>: public VarHolder -{ -public: - VarHolderImpl(const Poco::Data::BLOB& val): _val(val) - { - } - - ~VarHolderImpl() - { - } - - const std::type_info& type() const - { - return typeid(Poco::Data::BLOB); - } - - void convert(std::string& val) const - { - val.assign(_val.begin(), _val.end()); - } - - VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const - { - return cloneHolder(pVarHolder, _val); - } - - const Poco::Data::BLOB& value() const - { - return _val; - } - -private: - VarHolderImpl(); - Poco::Data::BLOB _val; -}; - - -template <> -class VarHolderImpl<Poco::Data::CLOB>: public VarHolder -{ -public: - VarHolderImpl(const Poco::Data::CLOB& val): _val(val) - { - } - - ~VarHolderImpl() - { - } - - const std::type_info& type() const - { - return typeid(Poco::Data::CLOB); - } - - void convert(std::string& val) const - { - val.assign(_val.begin(), _val.end()); - } - - VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const - { - return cloneHolder(pVarHolder, _val); - } - - const Poco::Data::CLOB& value() const - { - return _val; - } - -private: - VarHolderImpl(); - Poco::Data::CLOB _val; -}; - - -} } // namespace Poco::Dynamic - - -#endif // Data_LOB_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Limit.h b/contrib/libs/poco/Data/include/Poco/Data/Limit.h deleted file mode 100644 index f45ec3e98b..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Limit.h +++ /dev/null @@ -1,113 +0,0 @@ -// -// Limit.h -// -// Library: Data -// Package: DataCore -// Module: Limit -// -// Definition of the Limit class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Limit_INCLUDED -#define Data_Limit_INCLUDED - - -#include "Poco/Data/Data.h" - - -namespace Poco { -namespace Data { - - -class Data_API Limit - /// Limit stores information how many rows a query should return. -{ -public: - typedef Poco::UInt32 SizeT; - - enum Type - { - LIMIT_UNLIMITED = ~((SizeT) 0) - }; - - Limit(SizeT value, bool hardLimit = false, bool isLowerLimit = false); - /// Creates the Limit. - /// - /// Value contains the upper row hint, if hardLimit is set to true, the limit acts as a hard - /// border, ie. every query must return exactly value rows, returning more than value objects will throw an exception! - /// LowerLimits always act as hard-limits! - /// - /// A value of LIMIT_UNLIMITED disables the limit. - - ~Limit(); - /// Destroys the Limit. - - SizeT value() const; - /// Returns the value of the limit - - bool isHardLimit() const; - /// Returns true if the limit is a hard limit. - - bool isLowerLimit() const; - /// Returns true if the limit is a lower limit, otherwise it is an upperLimit - - bool operator == (const Limit& other) const; - /// Equality operator. - - bool operator != (const Limit& other) const; - /// Inequality operator. - -private: - SizeT _value; - bool _hardLimit; - bool _isLowerLimit; -}; - - -// -// inlines -// -inline Poco::UInt32 Limit::value() const -{ - return _value; -} - - -inline bool Limit::isHardLimit() const -{ - return _hardLimit; -} - - -inline bool Limit::isLowerLimit() const -{ - return _isLowerLimit; -} - - -inline bool Limit::operator == (const Limit& other) const -{ - return other._value == _value && - other._hardLimit == _hardLimit && - other._isLowerLimit == _isLowerLimit; -} - - -inline bool Limit::operator != (const Limit& other) const -{ - return other._value != _value || - other._hardLimit != _hardLimit || - other._isLowerLimit != _isLowerLimit; -} - - -} } // namespace Poco::Data - - -#endif // Data_Limit_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/MetaColumn.h b/contrib/libs/poco/Data/include/Poco/Data/MetaColumn.h deleted file mode 100644 index 65410a07dc..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/MetaColumn.h +++ /dev/null @@ -1,188 +0,0 @@ -// -// MetaColumn.h -// -// Library: Data -// Package: DataCore -// Module: MetaColumn -// -// Definition of the MetaColumn class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_MetaColumn_INCLUDED -#define Data_MetaColumn_INCLUDED - - -#include "Poco/Data/Data.h" -#include <cstddef> - - -namespace Poco { -namespace Data { - - -class Data_API MetaColumn - /// MetaColumn class contains column metadata information. -{ -public: - enum ColumnDataType - { - FDT_BOOL, - FDT_INT8, - FDT_UINT8, - FDT_INT16, - FDT_UINT16, - FDT_INT32, - FDT_UINT32, - FDT_INT64, - FDT_UINT64, - FDT_FLOAT, - FDT_DOUBLE, - FDT_STRING, - FDT_WSTRING, - FDT_BLOB, - FDT_CLOB, - FDT_DATE, - FDT_TIME, - FDT_TIMESTAMP, - FDT_UNKNOWN - }; - - MetaColumn(); - /// Creates the MetaColumn. - - explicit MetaColumn(std::size_t position, - const std::string& name = "", - ColumnDataType type = FDT_UNKNOWN, - std::size_t length = 0, - std::size_t precision = 0, - bool nullable = false); - /// Creates the MetaColumn. - - virtual ~MetaColumn(); - /// Destroys the MetaColumn. - - const std::string& name() const; - /// Returns column name. - - std::size_t length() const; - /// Returns column maximum length. - - std::size_t precision() const; - /// Returns column precision. - /// Valid for floating point fields only - /// (zero for other data types). - - std::size_t position() const; - /// Returns column position. - - ColumnDataType type() const; - /// Returns column type. - - bool isNullable() const; - /// Returns true if column allows null values, false otherwise. - -protected: - void setName(const std::string& name); - /// Sets the column name. - - void setLength(std::size_t length); - /// Sets the column length. - - void setPrecision(std::size_t precision); - /// Sets the column precision. - - void setType(ColumnDataType type); - /// Sets the column data type. - - void setNullable(bool nullable); - /// Sets the column nullability. - -private: - std::string _name; - std::size_t _length; - std::size_t _precision; - std::size_t _position; - ColumnDataType _type; - bool _nullable; -}; - - -/// -/// inlines -/// -inline const std::string& MetaColumn::name() const -{ - return _name; -} - - -inline std::size_t MetaColumn::length() const -{ - return _length; -} - - -inline std::size_t MetaColumn::precision() const -{ - return _precision; -} - - -inline std::size_t MetaColumn::position() const -{ - return _position; -} - - -inline MetaColumn::ColumnDataType MetaColumn::type() const -{ - return _type; -} - - -inline bool MetaColumn::isNullable() const -{ - return _nullable; -} - - -inline void MetaColumn::setName(const std::string& name) -{ - _name = name; -} - - -inline void MetaColumn::setLength(std::size_t length) -{ - _length = length; -} - - -inline void MetaColumn::setPrecision(std::size_t precision) -{ - _precision = precision; -} - - -inline void MetaColumn::setType(ColumnDataType type) -{ - _type = type; -} - - -inline void MetaColumn::setNullable(bool nullable) -{ - _nullable = nullable; -} - - -} } // namespace Poco::Data - - -#endif // Data_MetaColumn_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/PooledSessionHolder.h b/contrib/libs/poco/Data/include/Poco/Data/PooledSessionHolder.h deleted file mode 100644 index 8924589fbe..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/PooledSessionHolder.h +++ /dev/null @@ -1,99 +0,0 @@ -// -// PooledSessionHolder.h -// -// Library: Data -// Package: SessionPooling -// Module: PooledSessionHolder -// -// Definition of the PooledSessionHolder class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_PooledSessionHolder_INCLUDED -#define Data_PooledSessionHolder_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/AutoPtr.h" -#include "Poco/Timestamp.h" -#include "Poco/Mutex.h" - - -namespace Poco { -namespace Data { - - -class SessionPool; - - -class Data_API PooledSessionHolder: public Poco::RefCountedObject - /// This class is used by SessionPool to manage SessionImpl objects. -{ -public: - PooledSessionHolder(SessionPool& owner, SessionImpl* pSessionImpl); - /// Creates the PooledSessionHolder. - - ~PooledSessionHolder(); - /// Destroys the PooledSessionHolder. - - SessionImpl* session(); - /// Returns a pointer to the SessionImpl. - - SessionPool& owner(); - /// Returns a reference to the SessionHolder's owner. - - void access(); - /// Updates the last access timestamp. - - int idle() const; - /// Returns the number of seconds the session has not been used. - -private: - SessionPool& _owner; - Poco::AutoPtr<SessionImpl> _pImpl; - Poco::Timestamp _lastUsed; - mutable Poco::FastMutex _mutex; -}; - - -// -// inlines -// -inline SessionImpl* PooledSessionHolder::session() -{ - return _pImpl; -} - - -inline SessionPool& PooledSessionHolder::owner() -{ - return _owner; -} - - -inline void PooledSessionHolder::access() -{ - Poco::FastMutex::ScopedLock lock(_mutex); - - _lastUsed.update(); -} - - -inline int PooledSessionHolder::idle() const -{ - Poco::FastMutex::ScopedLock lock(_mutex); - - return (int) (_lastUsed.elapsed()/Poco::Timestamp::resolution()); -} - - -} } // namespace Poco::Data - - -#endif // Data_PooledSessionHolder_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/PooledSessionImpl.h b/contrib/libs/poco/Data/include/Poco/Data/PooledSessionImpl.h deleted file mode 100644 index 1d11028eec..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/PooledSessionImpl.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// PooledSessionImpl.h -// -// Library: Data -// Package: SessionPooling -// Module: PooledSessionImpl -// -// Definition of the PooledSessionImpl class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_PooledSessionImpl_INCLUDED -#define Data_PooledSessionImpl_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/Data/PooledSessionHolder.h" -#include "Poco/AutoPtr.h" - - -namespace Poco { -namespace Data { - - -class SessionPool; - - -class Data_API PooledSessionImpl: public SessionImpl - /// PooledSessionImpl is a decorator created by - /// SessionPool that adds session pool - /// management to SessionImpl objects. -{ -public: - PooledSessionImpl(PooledSessionHolder* pHolder); - /// Creates the PooledSessionImpl. - - ~PooledSessionImpl(); - /// Destroys the PooledSessionImpl. - - // SessionImpl - StatementImpl* createStatementImpl(); - void begin(); - void commit(); - void rollback(); - void open(const std::string& connect = ""); - void close(); - bool isConnected(); - void setConnectionTimeout(std::size_t timeout); - std::size_t getConnectionTimeout(); - bool canTransact(); - bool isTransaction(); - void setTransactionIsolation(Poco::UInt32); - Poco::UInt32 getTransactionIsolation(); - bool hasTransactionIsolation(Poco::UInt32); - bool isTransactionIsolation(Poco::UInt32); - const std::string& connectorName() const; - void setFeature(const std::string& name, bool state); - bool getFeature(const std::string& name); - void setProperty(const std::string& name, const Poco::Any& value); - Poco::Any getProperty(const std::string& name); - -protected: - SessionImpl* access() const; - /// Updates the last access timestamp, - /// verifies validity of the session - /// and returns the session if it is valid. - /// - /// Throws an SessionUnavailableException if the - /// session is no longer valid. - - SessionImpl* impl() const; - /// Returns a pointer to the SessionImpl. - -private: - mutable Poco::AutoPtr<PooledSessionHolder> _pHolder; -}; - - -// -// inlines -// -inline SessionImpl* PooledSessionImpl::impl() const -{ - return _pHolder->session(); -} - - -} } // namespace Poco::Data - - -#endif // Data_PooledSessionImpl_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Position.h b/contrib/libs/poco/Data/include/Poco/Data/Position.h deleted file mode 100644 index 727d27b74e..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Position.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// PositionExtraction.h -// -// Library: Data -// Package: DataCore -// Module: Position -// -// Definition of the PositionExtraction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Position_INCLUDED -#define Data_Position_INCLUDED - - -#include "Poco/Data/Limit.h" - - -namespace Poco { -namespace Data { - - -class Data_API Position - /// Utility class wrapping unsigned integer. Used to - /// indicate the recordset position in batch SQL statements. -{ -public: - Position(Poco::UInt32 value); - /// Creates the Position. - - ~Position(); - /// Destroys the Position. - - Poco::UInt32 value() const; - /// Returns the position value. - -private: - Position(); - - Poco::UInt32 _value; -}; - - -/// -/// inlines -/// -inline Poco::UInt32 Position::value() const -{ - return _value; -} - - -namespace Keywords { - - -template <typename T> -inline Position from(const T& value) - /// Convenience function for creation of position. -{ - return Position(value); -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_Position_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Preparation.h b/contrib/libs/poco/Data/include/Poco/Data/Preparation.h deleted file mode 100644 index f573a2099f..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Preparation.h +++ /dev/null @@ -1,161 +0,0 @@ -// -// Preparation.h -// -// Library: Data -// Package: DataCore -// Module: Preparation -// -// Definition of the Preparation class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Preparation_INCLUDED -#define Data_Preparation_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractPreparation.h" -#include "Poco/Data/TypeHandler.h" -#include <cstddef> -#include <vector> - - -namespace Poco { -namespace Data { - - -template<typename T> -class Preparation: public AbstractPreparation - /// Class for calling the appropriate AbstractPreparator method. -{ -public: - Preparation(AbstractPreparator::Ptr& pPreparator, std::size_t pos, T& val): - AbstractPreparation(pPreparator), - _pos(pos), - _val(val) - /// Creates the Preparation. - { - } - - ~Preparation() - /// Destroys the Preparation. - { - } - - void prepare() - /// Prepares data. - { - TypeHandler<T>::prepare(_pos, _val, preparation()); - } - -private: - std::size_t _pos; - T& _val; -}; - - -template<typename T> -class Preparation<std::vector<T> >: public AbstractPreparation - /// Preparation specialization for std::vector. - /// This specialization is needed for bulk operations to enforce - /// the whole vector preparation, rather than only individual contained values. -{ -public: - Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::vector<T>& val = std::vector<T>()): - AbstractPreparation(pPreparator), - _pos(pos), - _val(val) - /// Creates the Preparation. - { - } - - ~Preparation() - /// Destroys the Preparation. - { - } - - void prepare() - /// Prepares data. - { - TypeHandler<std::vector<T> >::prepare(_pos, _val, preparation()); - } - -private: - std::size_t _pos; - std::vector<T>& _val; -}; - - -template<typename T> -class Preparation<std::deque<T> >: public AbstractPreparation - /// Preparation specialization for std::deque. - /// This specialization is needed for bulk operations to enforce - /// the whole deque preparation, rather than only individual contained values. -{ -public: - Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::deque<T>& val = std::deque<T>()): - AbstractPreparation(pPreparator), - _pos(pos), - _val(val) - /// Creates the Preparation. - { - } - - ~Preparation() - /// Destroys the Preparation. - { - } - - void prepare() - /// Prepares data. - { - TypeHandler<std::deque<T> >::prepare(_pos, _val, preparation()); - } - -private: - std::size_t _pos; - std::deque<T>& _val; -}; - - -template<typename T> -class Preparation<std::list<T> >: public AbstractPreparation - /// Preparation specialization for std::list. - /// This specialization is needed for bulk operations to enforce - /// the whole list preparation, rather than only individual contained values. -{ -public: - Preparation(AbstractPreparator::Ptr pPreparator, std::size_t pos, std::list<T>& val = std::list<T>()): - AbstractPreparation(pPreparator), - _pos(pos), - _val(val) - /// Creates the Preparation. - { - } - - ~Preparation() - /// Destroys the Preparation. - { - } - - void prepare() - /// Prepares data. - { - TypeHandler<std::list<T> >::prepare(_pos, _val, preparation()); - } - -private: - std::size_t _pos; - std::list<T>& _val; -}; - - -} } // namespace Poco::Data - - -#endif // Data_Preparation_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Range.h b/contrib/libs/poco/Data/include/Poco/Data/Range.h deleted file mode 100644 index 8f0ab042e8..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Range.h +++ /dev/null @@ -1,104 +0,0 @@ -// -// Range.h -// -// Library: Data -// Package: DataCore -// Module: Range -// -// Definition of the Range class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Range_INCLUDED -#define Data_Range_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Limit.h" - - -namespace Poco { -namespace Data { - - -class Data_API Range - /// Range stores information how many rows a query should return. -{ -public: - Range(Limit::SizeT lowValue, Limit::SizeT upValue, bool hardLimit); - /// Creates the Range. lowValue must be smaller equal than upValue - - ~Range(); - /// Destroys the Limit. - - const Limit& lower() const; - /// Returns the lower limit - - const Limit& upper() const; - /// Returns the upper limit - -private: - Limit _lower; - Limit _upper; -}; - - -// -// inlines -// -inline const Limit& Range::lower() const -{ - return _lower; -} - - -inline const Limit& Range::upper() const -{ - return _upper; -} - - -namespace Keywords { - - -template <typename T> -Limit limit(T lim, bool hard = false) - /// Creates an upperLimit -{ - return Limit(static_cast<Limit::SizeT>(lim), hard, false); -} - - -template <typename T> -Limit upperLimit(T lim, bool hard = false) -{ - return limit(lim, hard); -} - - -template <typename T> -Limit lowerLimit(T lim) -{ - return Limit(static_cast<Limit::SizeT>(lim), true, true); -} - - -template <typename T> -Range range(T low, T upp, bool hard = false) -{ - return Range(static_cast<Limit::SizeT>(low), static_cast<Limit::SizeT>(upp), hard); -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_Range_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/RecordSet.h b/contrib/libs/poco/Data/include/Poco/Data/RecordSet.h deleted file mode 100644 index 050b389272..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/RecordSet.h +++ /dev/null @@ -1,653 +0,0 @@ -// -// RecordSet.h -// -// Library: Data -// Package: DataCore -// Module: RecordSet -// -// Definition of the RecordSet class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_RecordSet_INCLUDED -#define Data_RecordSet_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Session.h" -#include "Poco/Data/Extraction.h" -#include "Poco/Data/BulkExtraction.h" -#include "Poco/Data/Statement.h" -#include "Poco/Data/RowIterator.h" -#include "Poco/Data/RowFilter.h" -#include "Poco/Data/LOB.h" -#include "Poco/String.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/Exception.h" -#include "Poco/AutoPtr.h" -#include <ostream> -#include <limits> - - -namespace Poco { -namespace Data { - - -class RowFilter; - - -class Data_API RecordSet: private Statement - /// RecordSet provides access to data returned from a query. - /// Data access indices (row and column) are 0-based, as usual in C++. - /// - /// Recordset provides navigation methods to iterate through the - /// recordset, retrieval methods to extract data, and methods - /// to get metadata (type, etc.) about columns. - /// - /// To work with a RecordSet, first create a Statement, execute it, and - /// create the RecordSet from the Statement, as follows: - /// - /// Statement select(session); - /// select << "SELECT * FROM Person"; - /// select.execute(); - /// RecordSet rs(select); - /// - /// The shorter way to do the above is following: - /// - /// RecordSet rs(session, "SELECT * FROM Person"[, new SimpleRowFormatter]); - /// - /// The third (optional) argument passed to the Recordset constructor is a RowFormatter - /// implementation. The formatter is used in conjunction with << operator for recordset - /// data formating. - /// - /// The number of rows in the RecordSet can be limited by specifying - /// a limit for the Statement. -{ -public: - typedef std::map<std::size_t, Row*> RowMap; - typedef const RowIterator ConstIterator; - typedef RowIterator Iterator; - - using Statement::isNull; - using Statement::subTotalRowCount; - - static const std::size_t UNKNOWN_TOTAL_ROW_COUNT; - - explicit RecordSet(const Statement& rStatement, - RowFormatter::Ptr pRowFormatter = 0); - /// Creates the RecordSet. - - RecordSet(Session& rSession, - const std::string& query, - RowFormatter::Ptr pRowFormatter = 0); - /// Creates the RecordSet. - - RecordSet(Session& rSession, - const std::string& query, - const RowFormatter& rowFormatter); - /// Creates the RecordSet. - - template <class RF> - RecordSet(Session& rSession, const std::string& query, const RF& rowFormatter): - Statement((rSession << query, Keywords::now)), - _currentRow(0), - _pBegin(new RowIterator(this, 0 == rowsExtracted())), - _pEnd(new RowIterator(this, true)), - _totalRowCount(UNKNOWN_TOTAL_ROW_COUNT) - /// Creates the RecordSet. - { - setRowFormatter(Keywords::format(rowFormatter)); - } - - RecordSet(const RecordSet& other); - /// Copy-creates the recordset. - - ~RecordSet(); - /// Destroys the RecordSet. - - void setRowFormatter(RowFormatter::Ptr pRowFormatter); - /// Assigns the row formatter to the statement and all recordset rows. - - Statement& operator = (const Statement& stmt); - /// Assignment operator. - - std::size_t rowCount() const; - /// Returns the number of rows in the RecordSet. - /// The number of rows reported is dependent on filtering. - /// Due to the need for filter conditions checking, - /// this function may suffer significant performance penalty - /// for large recordsets, so it should be used judiciously. - /// Use totalRowCount() to obtain the total number of rows. - - std::size_t extractedRowCount() const; - /// Returns the number of rows extracted during the last statement - /// execution. - /// The number of rows reported is independent of filtering. - - std::size_t totalRowCount() const; - //@ deprecated - /// Replaced with subTotalRowCount() and getTotalRowCount(). - - std::size_t getTotalRowCount() const; - /// Returns the total number of rows in the RecordSet. - /// The number of rows reported is independent of filtering. - /// If the total row count has not been set externally - /// (either explicitly or implicitly through SQL), the value - /// returned shall only be accurate if the statement limit - /// is less or equal to the total row count. - - void setTotalRowCount(std::size_t totalRowCount); - /// Explicitly sets the total row count. - - void setTotalRowCount(const std::string& sql); - /// Implicitly sets the total row count. - /// The supplied sql must return exactly one column - /// and one row. The returned value must be an unsigned - /// integer. The value is set as the total number of rows. - - std::size_t columnCount() const; - /// Returns the number of columns in the recordset. - - template <class C> - const Column<C>& column(const std::string& name) const - /// Returns the reference to the first Column with the specified name. - { - if (isBulkExtraction()) - { - typedef InternalBulkExtraction<C> E; - return columnImpl<C,E>(name); - } - else - { - typedef InternalExtraction<C> E; - return columnImpl<C,E>(name); - } - } - - template <class C> - const Column<C>& column(std::size_t pos) const - /// Returns the reference to column at specified position. - { - if (isBulkExtraction()) - { - typedef InternalBulkExtraction<C> E; - return columnImpl<C,E>(pos); - } - else - { - typedef InternalExtraction<C> E; - return columnImpl<C,E>(pos); - } - } - - Row& row(std::size_t pos); - /// Returns reference to row at position pos. - /// Rows are lazy-created and cached. - - template <class T> - const T& value(std::size_t col, std::size_t row, bool useFilter = true) const - /// Returns the reference to data value at [col, row] location. - { - if (useFilter && isFiltered() && !isAllowed(row)) - throw InvalidAccessException("Row not allowed"); - - switch (storage()) - { - case STORAGE_VECTOR: - { - typedef typename std::vector<T> C; - return column<C>(col).value(row); - } - case STORAGE_LIST: - { - typedef typename std::list<T> C; - return column<C>(col).value(row); - } - case STORAGE_DEQUE: - case STORAGE_UNKNOWN: - { - typedef typename std::deque<T> C; - return column<C>(col).value(row); - } - default: - throw IllegalStateException("Invalid storage setting."); - } - } - - template <class T> - const T& value(const std::string& name, std::size_t row, bool useFilter = true) const - /// Returns the reference to data value at named column, row location. - { - if (useFilter && isFiltered() && !isAllowed(row)) - throw InvalidAccessException("Row not allowed"); - - switch (storage()) - { - case STORAGE_VECTOR: - { - typedef typename std::vector<T> C; - return column<C>(name).value(row); - } - case STORAGE_LIST: - { - typedef typename std::list<T> C; - return column<C>(name).value(row); - } - case STORAGE_DEQUE: - case STORAGE_UNKNOWN: - { - typedef typename std::deque<T> C; - return column<C>(name).value(row); - } - default: - throw IllegalStateException("Invalid storage setting."); - } - } - - Poco::Dynamic::Var value(std::size_t col, std::size_t row, bool checkFiltering = true) const; - /// Returns the data value at column, row location. - - Poco::Dynamic::Var value(const std::string& name, std::size_t row, bool checkFiltering = true) const; - /// Returns the data value at named column, row location. - - template <typename T> - Poco::Dynamic::Var nvl(const std::string& name, const T& deflt = T()) 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 Poco::Dynamic::Var(deflt); - else - return value(name, _currentRow); - } - - template <typename T> - Poco::Dynamic::Var nvl(std::size_t index, const T& deflt = T()) 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 Poco::Dynamic::Var(deflt); - else - return value(index, _currentRow); - } - - ConstIterator& begin() const; - /// Returns the const row iterator. - - ConstIterator& end() const; - /// Returns the const row iterator. - - Iterator begin(); - /// Returns the row iterator. - - Iterator end(); - /// Returns the row iterator. - - bool moveFirst(); - /// Moves the row cursor to the first row. - /// - /// Returns true if there is at least one row in the RecordSet, - /// false otherwise. - - bool moveNext(); - /// Moves the row cursor to the next row. - /// - /// Returns true if the row is available, or false - /// if the end of the record set has been reached and - /// no more rows are available. - - bool movePrevious(); - /// Moves the row cursor to the previous row. - /// - /// Returns true if the row is available, or false - /// if there are no more rows available. - - bool moveLast(); - /// Moves the row cursor to the last row. - /// - /// Returns true if there is at least one row in the RecordSet, - /// false otherwise. - - using Statement::reset; - /// Don't hide base class method. - - void reset(const Statement& stmt); - /// Resets the RecordSet and assigns a new statement. - /// Should be called after the given statement has been reset, - /// assigned a new SQL statement, and executed. - /// - /// Does not remove the associated RowFilter or RowFormatter. - - Poco::Dynamic::Var value(const std::string& name); - /// Returns the value in the named column of the current row. - - Poco::Dynamic::Var value(std::size_t index); - /// Returns the value in the given column of the current row. - - Poco::Dynamic::Var operator [] (const std::string& name); - /// Returns the value in the named column of the current row. - - Poco::Dynamic::Var operator [] (std::size_t index); - /// Returns the value in the named column of the current row. - - MetaColumn::ColumnDataType columnType(std::size_t pos) const; - /// Returns the type for the column at specified position. - - MetaColumn::ColumnDataType columnType(const std::string& name) const; - /// Returns the type for the column with specified name. - - const std::string& columnName(std::size_t pos) const; - /// Returns column name for the column at specified position. - - std::size_t columnLength(std::size_t pos) const; - /// Returns column maximum length for the column at specified position. - - std::size_t columnLength(const std::string& name) const; - /// Returns column maximum length for the column with specified name. - - std::size_t columnPrecision(std::size_t pos) const; - /// Returns column precision for the column at specified position. - /// Valid for floating point fields only (zero for other data types). - - std::size_t columnPrecision(const std::string& name) const; - /// Returns column precision for the column with specified name. - /// Valid for floating point fields only (zero for other data types). - - bool isNull(const std::string& name) const; - /// Returns true if column value of the current row is null. - - std::ostream& copyNames(std::ostream& os) const; - /// Copies the column names to the target output stream. - /// Copied string is formatted by the current RowFormatter. - - void formatNames() const; - /// Formats names using the current RowFormatter. - - std::ostream& copyValues(std::ostream& os, - std::size_t offset = 0, - std::size_t length = RowIterator::POSITION_END) const; - /// Copies the data values to the supplied output stream. - /// The data set to be copied is starting at the specified offset - /// from the recordset beginning. The number of rows to be copied - /// is specified by length argument. - /// An invalid combination of offset/length arguments shall - /// cause RangeException to be thrown. - /// Copied string is formatted by the current RowFormatter. - - void formatValues(std::size_t offset, std::size_t length) const; - /// Formats values using the current RowFormatter. - /// The data set to be formatted is starting at the specified offset - /// from the recordset beginning. The number of rows to be copied - /// is specified by length argument. - /// An invalid combination of offset/length arguments shall - /// cause RangeException to be thrown. - - std::ostream& copy(std::ostream& os, - std::size_t offset = 0, - std::size_t length = RowIterator::POSITION_END) const; - /// Copies the column names and values to the target output stream. - /// Copied strings are formatted by the current RowFormatter. - - bool isFiltered() const; - /// Returns true if recordset is filtered. - -private: - RecordSet(); - - template<class C, class E> - std::size_t columnPosition(const std::string& name) const - /// Returns the position of the column with specified name. - { - typedef typename C::value_type T; - typedef const E* ExtractionVecPtr; - - bool typeFound = false; - - const AbstractExtractionVec& rExtractions = extractions(); - AbstractExtractionVec::const_iterator it = rExtractions.begin(); - AbstractExtractionVec::const_iterator end = rExtractions.end(); - - for (; it != end; ++it) - { - ExtractionVecPtr pExtraction = dynamic_cast<ExtractionVecPtr>(it->get()); - - if (pExtraction) - { - typeFound = true; - const Column<C>& col = pExtraction->column(); - if (0 == Poco::icompare(name, col.name())) - return col.position(); - } - } - - if (typeFound) - throw NotFoundException(Poco::format("Column name: %s", name)); - else - throw NotFoundException(Poco::format("Column type: %s, name: %s", std::string(typeid(T).name()), name)); - } - - template <class C, class E> - const Column<C>& columnImpl(const std::string& name) const - /// Returns the reference to the first Column with the specified name. - { - return columnImpl<C,E>(columnPosition<C,E>(name)); - } - - template <class C, class E> - const Column<C>& columnImpl(std::size_t pos) const - /// Returns the reference to column at specified position. - { - typedef typename C::value_type T; - typedef const E* ExtractionVecPtr; - - const AbstractExtractionVec& rExtractions = extractions(); - - std::size_t s = rExtractions.size(); - if (0 == s || pos >= s) - throw RangeException(Poco::format("Invalid column index: %z", pos)); - - ExtractionVecPtr pExtraction = dynamic_cast<ExtractionVecPtr>(rExtractions[pos].get()); - - if (pExtraction) - { - return pExtraction->column(); - } - else - { - throw Poco::BadCastException(Poco::format("Type cast failed!\nColumn: %z\nTarget type:\t%s", - pos, - std::string(typeid(T).name()))); - } - } - - bool isAllowed(std::size_t row) const; - /// Returns true if the specified row is allowed by the - /// currently active filter. - - void filter(const Poco::AutoPtr<RowFilter>& pFilter); - /// Sets the filter for the RecordSet. - - const Poco::AutoPtr<RowFilter>& getFilter() const; - /// Returns the filter associated with the RecordSet. - - std::size_t _currentRow; - RowIterator* _pBegin; - RowIterator* _pEnd; - RowMap _rowMap; - Poco::AutoPtr<RowFilter> _pFilter; - std::size_t _totalRowCount; - - friend class RowIterator; - friend class RowFilter; -}; - - -/// -/// inlines -/// - - -inline Data_API std::ostream& operator << (std::ostream &os, const RecordSet& rs) -{ - return rs.copy(os); -} - - -inline std::size_t RecordSet::getTotalRowCount() const -{ - if (UNKNOWN_TOTAL_ROW_COUNT == _totalRowCount) - return subTotalRowCount(); - else - return _totalRowCount; -} - - -inline std::size_t RecordSet::totalRowCount() const -{ - return getTotalRowCount(); -} - - -inline void RecordSet::setTotalRowCount(std::size_t totalRowCount) -{ - _totalRowCount = totalRowCount; -} - - -inline std::size_t RecordSet::extractedRowCount() const -{ - return rowsExtracted(); -} - - -inline std::size_t RecordSet::columnCount() const -{ - return static_cast<std::size_t>(extractions().size()); -} - - -inline Statement& RecordSet::operator = (const Statement& stmt) -{ - reset(stmt); - return *this; -} - - -inline Poco::Dynamic::Var RecordSet::value(const std::string& name) -{ - return value(name, _currentRow); -} - - -inline Poco::Dynamic::Var RecordSet::value(std::size_t index) -{ - return value(index, _currentRow); -} - - -inline Poco::Dynamic::Var RecordSet::operator [] (const std::string& name) -{ - return value(name, _currentRow); -} - - -inline Poco::Dynamic::Var RecordSet::operator [] (std::size_t index) -{ - return value(index, _currentRow); -} - - -inline MetaColumn::ColumnDataType RecordSet::columnType(std::size_t pos)const -{ - return metaColumn(static_cast<UInt32>(pos)).type(); -} - - -inline MetaColumn::ColumnDataType RecordSet::columnType(const std::string& name)const -{ - return metaColumn(name).type(); -} - - -inline const std::string& RecordSet::columnName(std::size_t pos) const -{ - return metaColumn(static_cast<UInt32>(pos)).name(); -} - - -inline std::size_t RecordSet::columnLength(std::size_t pos) const -{ - return metaColumn(static_cast<UInt32>(pos)).length(); -} - - -inline std::size_t RecordSet::columnLength(const std::string& name)const -{ - return metaColumn(name).length(); -} - - -inline std::size_t RecordSet::columnPrecision(std::size_t pos) const -{ - return metaColumn(static_cast<UInt32>(pos)).precision(); -} - - -inline std::size_t RecordSet::columnPrecision(const std::string& name)const -{ - return metaColumn(name).precision(); -} - - -inline bool RecordSet::isNull(const std::string& name) const -{ - return isNull(metaColumn(name).position(), _currentRow); -} - - -inline RecordSet::ConstIterator& RecordSet::begin() const -{ - return *_pBegin; -} - - -inline RecordSet::ConstIterator& RecordSet::end() const -{ - return *_pEnd; -} - - -inline RecordSet::Iterator RecordSet::begin() -{ - return *_pBegin; -} - - -inline RecordSet::Iterator RecordSet::end() -{ - return *_pEnd; -} - - -inline const Poco::AutoPtr<RowFilter>& RecordSet::getFilter() const -{ - return _pFilter; -} - - -inline void RecordSet::formatNames() const -{ - (*_pBegin)->formatNames(); -} - - -} } // namespace Poco::Data - - -#endif // Data_RecordSet_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Row.h b/contrib/libs/poco/Data/include/Poco/Data/Row.h deleted file mode 100644 index 6144967803..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Row.h +++ /dev/null @@ -1,312 +0,0 @@ -// -// Row.h -// -// Library: Data -// Package: DataCore -// Module: Row -// -// Definition of the Row class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Row_INCLUDED -#define Data_Row_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/RowFormatter.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/Tuple.h" -#include "Poco/SharedPtr.h" -#include <vector> -#include <string> -#include <ostream> - - -namespace Poco { -namespace Data { - - -class RecordSet; - - -class Data_API Row - /// Row class provides a data type for RecordSet iteration purposes. - /// Dereferencing a RowIterator returns Row. - /// Rows are sortable. The sortability is maintained at all times (i.e. there - /// is always at least one column specified as a sorting criteria) . - /// The default and minimal sorting criteria is the first field (position 0). - /// The default sorting criteria can be replaced with any other field by - /// calling replaceSortField() member function. - /// Additional fields can be added to sorting criteria, in which case the - /// field precedence corresponds to addition order (i.e. later added fields - /// have lower sorting precedence). - /// These features make Row suitable for use with standard sorted - /// containers and algorithms. The main constraint is that all the rows from - /// a set that is being sorted must have the same sorting criteria (i.e., the same - /// set of fields must be in sorting criteria in the same order). Since rows don't - /// know about each other, it is the programmer's responsibility to ensure this - /// constraint is satisfied. - /// Field names are a shared pointer to a vector of strings. For efficiency sake, - /// a constructor taking a shared pointer to names vector argument is provided. - /// The stream operator is provided for Row data type as a free-standing function. -{ -public: - typedef RowFormatter::NameVec NameVec; - typedef RowFormatter::NameVecPtr NameVecPtr; - typedef RowFormatter::ValueVec ValueVec; - - enum ComparisonType - { - COMPARE_AS_EMPTY, - COMPARE_AS_INTEGER, - COMPARE_AS_FLOAT, - COMPARE_AS_STRING - }; - - typedef Tuple<std::size_t, ComparisonType> SortTuple; - typedef std::vector<SortTuple> SortMap; - /// The type for map holding fields used for sorting criteria. - /// Fields are added sequentially and have precedence that - /// corresponds to field adding sequence order (rather than field's - /// position in the row). - /// This requirement rules out use of std::map due to its sorted nature. - typedef SharedPtr<SortMap> SortMapPtr; - - Row(); - /// Creates the Row. - - Row(NameVecPtr pNames, - const RowFormatter::Ptr& pFormatter = 0); - /// Creates the Row. - - Row(NameVecPtr pNames, - const SortMapPtr& pSortMap, - const RowFormatter::Ptr& pFormatter = 0); - /// Creates the Row. - - ~Row(); - /// Destroys the Row. - - Poco::Dynamic::Var& get(std::size_t col); - /// Returns the reference to data value at column location. - - Poco::Dynamic::Var& operator [] (std::size_t col); - /// Returns the reference to data value at column location. - - Poco::Dynamic::Var& operator [] (const std::string& name); - /// Returns the reference to data value at named column location. - - template <typename T> - void append(const std::string& name, const T& val) - /// Appends the value to the row. - { - if (!_pNames) _pNames = new NameVec; - _values.push_back(val); - _pNames->push_back(name); - if (1 == _values.size()) addSortField(0); - } - - template <typename T> - void set(std::size_t pos, const T& val) - /// Assigns the value to the row. - { - try - { - _values.at(pos) = val; - } - catch (std::out_of_range&) - { - throw RangeException("Invalid column number."); - } - } - - template <typename T> - void set(const std::string& name, const T& val) - /// Assigns the value to the row. - { - NameVec::iterator it = _pNames->begin(); - NameVec::iterator end = _pNames->end(); - for (int i = 0; it != end; ++it, ++i) - { - if (*it == name) - return set(i, val); - } - - std::ostringstream os; - os << "Column with name " << name << " not found."; - throw NotFoundException(os.str()); - } - - std::size_t fieldCount() const; - /// Returns the number of fields in this row. - - void reset(); - /// Resets the row by clearing all field names and values. - - void separator(const std::string& sep); - /// Sets the separator. - - void addSortField(std::size_t pos); - /// Adds the field used for sorting. - - void addSortField(const std::string& name); - /// Adds the field used for sorting. - - void removeSortField(std::size_t pos); - /// Removes the field used for sorting. - - void removeSortField(const std::string& name); - /// Removes the field used for sorting. - - void replaceSortField(std::size_t oldPos, std::size_t newPos); - /// Replaces the field used for sorting. - - void replaceSortField(const std::string& oldName, const std::string& newName); - /// Replaces the field used for sorting. - - void resetSort(); - /// Resets the sorting criteria to field 0 only. - - const std::string& namesToString() const; - /// Converts the column names to string. - - void formatNames() const; - /// Fomats the column names. - - const std::string& valuesToString() const; - /// Converts the row values to string and returns the formated string. - - void formatValues() const; - /// Fomats the row values. - - bool operator == (const Row& other) const; - /// Equality operator. - - bool operator != (const Row& other) const; - /// Inequality operator. - - bool operator < (const Row& other) const; - /// Less-than operator. - - const NameVecPtr names() const; - /// Returns the shared pointer to names vector. - - const ValueVec& values() const; - /// Returns the const reference to values vector. - - void setFormatter(const RowFormatter::Ptr& pFormatter = 0); - /// Sets the formatter for this row and takes the - /// shared ownership of it. - - const RowFormatter& getFormatter() const; - /// Returns the reference to the formatter. - - void setSortMap(const SortMapPtr& pSortMap = 0); - /// Adds the sorting fields entry and takes the - /// shared ownership of it. - - const SortMapPtr& getSortMap() const; - /// Returns the reference to the sorting fields. - -private: - void init(const SortMapPtr& pSortMap, const RowFormatter::Ptr& pFormatter); - - ValueVec& values(); - /// Returns the reference to values vector. - - std::size_t getPosition(const std::string& name); - bool isEqualSize(const Row& other) const; - bool isEqualType(const Row& other) const; - - NameVecPtr _pNames; - ValueVec _values; - SortMapPtr _pSortMap; - mutable RowFormatter::Ptr _pFormatter; - mutable std::string _nameStr; - mutable std::string _valueStr; -}; - - -Data_API std::ostream& operator << (std::ostream &os, const Row& row); - - -/// -/// inlines -/// -inline std::size_t Row::fieldCount() const -{ - return static_cast<std::size_t>(_values.size()); -} - - -inline void Row::reset() -{ - _pNames->clear(); - _values.clear(); -} - - -inline const Row::NameVecPtr Row::names() const -{ - return _pNames; -} - - -inline const Row::ValueVec& Row::values() const -{ - return _values; -} - - -inline Row::ValueVec& Row::values() -{ - return _values; -} - - -inline Poco::Dynamic::Var& Row::operator [] (std::size_t col) -{ - return get(col); -} - - -inline Poco::Dynamic::Var& Row::operator [] (const std::string& name) -{ - return get(getPosition(name)); -} - - -inline const RowFormatter& Row::getFormatter() const -{ - return *_pFormatter; -} - - -inline const Row::SortMapPtr& Row::getSortMap() const -{ - return _pSortMap; -} - - -inline const std::string& Row::valuesToString() const -{ - return _pFormatter->formatValues(values(), _valueStr); -} - - -inline void Row::formatValues() const -{ - return _pFormatter->formatValues(values()); -} - - -} } // namespace Poco::Data - - -#endif // Data_Row_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/RowFilter.h b/contrib/libs/poco/Data/include/Poco/Data/RowFilter.h deleted file mode 100644 index 0b0febd2dc..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/RowFilter.h +++ /dev/null @@ -1,276 +0,0 @@ -// -// RowFilter.h -// -// Library: Data -// Package: DataCore -// Module: RowFilter -// -// Definition of the RowFilter class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_RowFilter_INCLUDED -#define Data_RowFilter_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Dynamic/Var.h" -#include "Poco/Tuple.h" -#include "Poco/String.h" -#include "Poco/RefCountedObject.h" -#include "Poco/AutoPtr.h" -#include <map> -#include <list> -#include <utility> - - -namespace Poco { -namespace Data { - - -class RecordSet; - - -class Data_API RowFilter: public RefCountedObject - /// RowFilter class provides row filtering functionality. - /// A filter contains a set of criteria (field name, value and - /// logical operation) for row filtering. - /// Additionally, a row filter contains a map of pointers to other - /// filters with related logical operations between filters. - /// RowFilter is typically added to recordset in order to filter - /// its content. Since the recordset own iteration is dependent upon - /// filtering, whenever the filtering criteria is changed, - /// the filter automatically notifies all associated recordsets - /// by rewinding them to the first position. -{ -public: - enum Comparison - { - VALUE_LESS_THAN, - VALUE_LESS_THAN_OR_EQUAL, - VALUE_EQUAL, - VALUE_GREATER_THAN, - VALUE_GREATER_THAN_OR_EQUAL, - VALUE_NOT_EQUAL, - VALUE_IS_NULL - }; - - enum LogicOperator - { - OP_AND, - OP_OR, - OP_NOT - }; - - typedef bool (*CompT)(const Poco::Dynamic::Var&, const Poco::Dynamic::Var&); - typedef AutoPtr<RowFilter> Ptr; - typedef std::map<std::string, Comparison> Comparisons; - typedef Tuple<Poco::Dynamic::Var, Comparison, LogicOperator> ComparisonEntry; - typedef std::multimap<std::string, ComparisonEntry> ComparisonMap; - typedef std::map<AutoPtr<RowFilter>, LogicOperator> FilterMap; - - RowFilter(RecordSet* pRecordSet); - /// Creates the top-level RowFilter and associates it with the recordset. - - RowFilter(Ptr pParent, LogicOperator op = OP_OR); - /// Creates child RowFilter and associates it with the parent filter. - - ~RowFilter(); - /// Destroys the RowFilter. - - void addFilter(Ptr pFilter, LogicOperator comparison); - /// Appends another filter to this one. - - void removeFilter(Ptr pFilter); - /// Removes filter from this filter. - - bool has(Ptr pFilter) const; - /// Returns true if this filter is parent of pFilter; - - template <typename T> - void add(const std::string& name, Comparison comparison, const T& value, LogicOperator op = OP_OR) - /// Adds value to the filter. - { - rewindRecordSet(); - _comparisonMap.insert(ComparisonMap::value_type(toUpper(name), - ComparisonEntry(value, comparison, op))); - } - - template <typename T> - void add(const std::string& name, const std::string& comp, const T& value, LogicOperator op = OP_OR) - /// Adds value to the filter. - { - add(name, getComparison(comp), value, op); - } - - template <typename T> - void addAnd(const std::string& name, const std::string& comp, const T& value) - /// Adds logically AND-ed value to the filter. - { - add(name, getComparison(comp), value, OP_AND); - } - - template <typename T> - void addOr(const std::string& name, const std::string& comp, const T& value) - /// Adds logically OR-ed value to the filter. - { - add(name, getComparison(comp), value, OP_OR); - } - - int remove(const std::string& name); - /// Removes named comparisons from the filter. - /// All comparisons with specified name are removed. - /// Returns the number of comparisons removed. - - void toggleNot(); - /// Togless the NOT operator for this filter; - - bool isNot() const; - /// Returns true if filter is NOT-ed, false otherwise. - - bool isEmpty() const; - /// Returns true if there is not filtering criteria specified. - - bool isAllowed(std::size_t row) const; - /// Returns true if name and value are allowed. - - bool exists(const std::string& name) const; - /// Returns true if name is known to this row filter. - -private: - RowFilter(); - RowFilter(const RowFilter&); - RowFilter& operator=(const RowFilter&); - - void init(); - - static bool equal(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool notEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool less(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool greater(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool lessOrEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool greaterOrEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool logicalAnd(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool logicalOr(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2); - static bool isNull(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var&); - - static void doCompare(Poco::Dynamic::Var& ret, - Poco::Dynamic::Var& val, - CompT comp, - const ComparisonEntry& ce); - - RecordSet& recordSet() const; - - Comparison getComparison(const std::string& comp) const; - - void rewindRecordSet(); - - Comparisons _comparisons; - ComparisonMap _comparisonMap; - mutable RecordSet* _pRecordSet; - Ptr _pParent; - FilterMap _filterMap; - bool _not; - - friend class RecordSet; -}; - - -/// -/// inlines -/// - - -inline bool RowFilter::has(Ptr pFilter) const -{ - return _filterMap.find(pFilter) != _filterMap.end(); -} - - -inline bool RowFilter::isEmpty() const -{ - return _comparisonMap.size() == 0; -} - - -inline bool RowFilter::exists(const std::string& name) const -{ - return _comparisonMap.find(name) != _comparisonMap.end(); -} - - -inline void RowFilter::toggleNot() -{ - _not = !_not; -} - - -inline bool RowFilter::isNot() const -{ - return _not; -} - - -inline bool RowFilter::equal(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 == p2; -} - - -inline bool RowFilter::notEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 != p2; -} - - -inline bool RowFilter::less(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 < p2; -} - - -inline bool RowFilter::greater(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 > p2; -} - - -inline bool RowFilter::lessOrEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 <= p2; -} - - -inline bool RowFilter::greaterOrEqual(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 >= p2; -} - - -inline bool RowFilter::logicalAnd(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 && p2; -} - - -inline bool RowFilter::logicalOr(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var& p2) -{ - return p1 || p2; -} - - -inline bool RowFilter::isNull(const Poco::Dynamic::Var& p1, const Poco::Dynamic::Var&) -{ - return p1.isEmpty(); -} - - -} } // namespace Poco::Data - - -#endif // Data_RowFilter_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/RowFormatter.h b/contrib/libs/poco/Data/include/Poco/Data/RowFormatter.h deleted file mode 100644 index a2a0c8614e..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/RowFormatter.h +++ /dev/null @@ -1,231 +0,0 @@ -// -// RowFormatter.h -// -// Library: Data -// Package: DataCore -// Module: RowFormatter -// -// Definition of the RowFormatter class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_RowFormatter_INCLUDED -#define Data_RowFormatter_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/SharedPtr.h" -#include "Poco/RefCountedObject.h" -#include "Poco/Dynamic/Var.h" -#include <sstream> -#include <vector> - - -namespace Poco { -namespace Data { - - -class Data_API RowFormatter - /// Row formatter is an abstract class providing definition for row formatting functionality. - /// For custom formatting strategies, inherit from this class and override formatNames() - /// and formatValues() member functions. - /// - /// Row formatter can be either passed to the RecordSet at construction time, - /// like in the following example: - /// - /// RecordSet rs(session. "SELECT * FROM Table", new MyRowFormater); - /// - /// or it can be supplied to the statement as in the following example: - /// - /// MyRowFormatter rf - /// session << "SELECT * FROM Table", format(rf); - /// - /// If no formatter is externally supplied to the statement, the SimpleRowFormatter is used. - /// Statement always has the ownership of the row formatter and shares - /// it with rows through RecordSet. - /// - /// To accomodate for various formatting needs, a formatter can operate in two modes: - /// - /// - progressive: formatted individual row strings are gemerated and returned from each - /// call to formatValues; - /// std::string& formatNames(const NameVecPtr, std::string&) and - /// std::string& formatValues(const ValueVec&, std::string&) member calls should be - /// used in this case; this is the default mode - /// - /// - bulk: formatted resulting string is accumulated internally and obtained at - /// the end of iteration via toString() member function; - /// void formatNames(const NameVecPtr) and - /// void formatValues(const ValueVec&) member calls should be used in this case - /// - /// When formatter is used in conjunction with Row/RecordSet, the formatting members corresponding - /// to the formater mode are expected to be implemented. If a call is propagated to this parent - /// class, the functions do nothing or silently return empty string respectively. - /// -{ -public: - typedef SharedPtr<RowFormatter> Ptr; - typedef std::vector<std::string> NameVec; - typedef SharedPtr<std::vector<std::string> > NameVecPtr; - typedef std::vector<Poco::Dynamic::Var> ValueVec; - - static const int INVALID_ROW_COUNT = -1; - - enum Mode - { - FORMAT_PROGRESSIVE, - FORMAT_BULK - }; - - RowFormatter(const std::string& prefix = "", - const std::string& postfix = "", - Mode mode = FORMAT_PROGRESSIVE); - /// Creates the RowFormatter and sets the prefix and postfix to specified values. - - virtual ~RowFormatter(); - /// Destroys the RowFormatter. - - virtual std::string& formatNames(const NameVecPtr pNames, std::string& formattedNames); - /// Should be implemented to format the row fields names and return the formatted string. - /// The default implementation clears the names string and returns it. - - virtual void formatNames(const NameVecPtr pNames); - /// Should be implemented to format the row fields names. - /// The default implementation does nothing. - - virtual std::string& formatValues(const ValueVec& vals, std::string& formattedValues); - /// Should be implemented to format the row fields values and return the formatted string. - /// The default implementation clears the values string and returns it. - - virtual void formatValues(const ValueVec& vals); - /// Should be implemented to format the row fields values. - /// The default implementation does nothing. - - virtual const std::string& toString(); - /// Throws NotImplementedException. Formatters operating in bulk mode should - /// implement this member function to return valid pointer to the formatted result. - - virtual int rowCount() const; - /// Returns INVALID_ROW_COUNT. Must be implemented by inheriting classes - /// which maintain count of processed rows. - - int getTotalRowCount() const; - /// Returns zero. Must be implemented by inheriting classes. - /// Typically, total row count shall be set up front through - /// setTotalRowCount() call. - - void setTotalRowCount(int count); - /// Sets total row count. - - virtual const std::string& prefix() const; - /// Returns prefix string; - - virtual const std::string& postfix() const; - /// Returns postfix string; - - void reset(); - /// Resets the formatter by setting prefix and postfix - /// to empty strings and row count to INVALID_ROW_COUNT. - - Mode getMode() const; - /// Returns the formater mode. - - void setMode(Mode mode); - /// Sets the fromatter mode. - -protected: - - void setPrefix(const std::string& prefix); - /// Sets the prefix for the formatter. - - void setPostfix(const std::string& postfix); - /// Sets the postfix for the formatter - -private: - - mutable std::string _prefix; - mutable std::string _postfix; - Mode _mode; - int _totalRowCount; -}; - - -/// -/// inlines -/// -inline int RowFormatter::rowCount() const -{ - return INVALID_ROW_COUNT; -} - - -inline int RowFormatter::getTotalRowCount() const -{ - return _totalRowCount; -} - - -inline void RowFormatter::setTotalRowCount(int count) -{ - _totalRowCount = count; -} - - -inline void RowFormatter::setPrefix(const std::string& prefix) -{ - _prefix = prefix; -} - - -inline void RowFormatter::setPostfix(const std::string& postfix) -{ - _postfix = postfix; -} - - -inline const std::string& RowFormatter::prefix() const -{ - return _prefix; -} - - -inline const std::string& RowFormatter::postfix() const -{ - return _postfix; -} - - -inline RowFormatter::Mode RowFormatter::getMode() const -{ - return _mode; -} - - -inline void RowFormatter::setMode(Mode mode) -{ - _mode = mode; -} - - -namespace Keywords { - - -template <typename T> -inline RowFormatter::Ptr format(const T& formatter) - /// Utility function used to pass formatter to the statement. -{ - return new T(formatter); -} - - -} // namespace Keywords - - -} } // namespace Poco::Data - - -#endif // Data_RowFormatter_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/RowIterator.h b/contrib/libs/poco/Data/include/Poco/Data/RowIterator.h deleted file mode 100644 index 32ca45bd43..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/RowIterator.h +++ /dev/null @@ -1,150 +0,0 @@ -// -// RowIterator.h -// -// Library: Data -// Package: DataCore -// Module: RowIterator -// -// Definition of the RowIterator class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_RowIterator_INCLUDED -#define Data_RowIterator_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Row.h" -#include "Poco/Dynamic/Var.h" -#include <iterator> -#include <algorithm> - - -namespace Poco { -namespace Data { - - -class RecordSet; - - -class Data_API RowIterator - /// RowIterator class. -{ -public: - typedef std::bidirectional_iterator_tag iterator_category; - typedef Row value_type; - typedef std::ptrdiff_t difference_type; - typedef Row* pointer; - typedef Row& reference; - - static const std::size_t POSITION_END; - /// End position indicator. - - RowIterator(RecordSet* pRecordSet, bool positionEnd); - /// Creates the RowIterator and positions it at the end of - /// the recordset if positionEnd is true. Otherwise, it is - /// positioned at the beginning. - - RowIterator(const RowIterator& other); - /// Creates a copy of other RowIterator. - - ~RowIterator(); - /// Destroys the RowIterator. - - RowIterator& operator = (const RowIterator& other); - /// Assigns the other RowIterator. - - bool operator == (const RowIterator& other) const; - /// Equality operator. - - bool operator != (const RowIterator& other) const; - /// Inequality operator. - - Row& operator * () const; - /// Returns reference to the current row. - - Row* operator -> () const; - /// Returns pointer to the current row. - - const RowIterator& operator ++ () const; - /// Advances by one position and returns current position. - - RowIterator operator ++ (int) const; - /// Advances by one position and returns copy of the iterator with - /// previous current position. - - const RowIterator& operator -- () const; - /// Goes back by one position and returns copy of the iterator with - /// previous current position. - - RowIterator operator -- (int) const; - /// Goes back by one position and returns previous current position. - - RowIterator operator + (std::size_t diff) const; - /// Returns a copy the RowIterator advanced by diff positions. - - RowIterator operator - (std::size_t diff) const; - /// Returns a copy the RowIterator backed by diff positions. - /// Throws RangeException if diff is larger than current position. - - void swap(RowIterator& other); - /// Swaps the RowIterator with another one. - -private: - RowIterator(); - - void increment() const; - /// Increments the iterator position by one. - /// Throws RangeException if position is out of range. - - void decrement() const; - /// Decrements the iterator position by one. - /// Throws RangeException if position is out of range. - - void setPosition(std::size_t pos) const; - /// Sets the iterator position. - /// Throws RangeException if position is out of range. - - RecordSet* _pRecordSet; - mutable std::size_t _position; -}; - - -/// -/// inlines -/// - - -inline bool RowIterator::operator == (const RowIterator& other) const -{ - return _pRecordSet == other._pRecordSet && _position == other._position; -} - - -inline bool RowIterator::operator != (const RowIterator& other) const -{ - return _pRecordSet != other._pRecordSet || _position != other._position; -} - - -} } // namespace Poco::Data - - -namespace std -{ - template<> - inline void swap<Poco::Data::RowIterator>(Poco::Data::RowIterator& s1, - Poco::Data::RowIterator& s2) - /// Full template specalization of std:::swap for RowIterator - { - s1.swap(s2); - } -} - - -#endif // Data_RowIterator_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SQLChannel.h b/contrib/libs/poco/Data/include/Poco/Data/SQLChannel.h deleted file mode 100644 index e76d67626a..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SQLChannel.h +++ /dev/null @@ -1,217 +0,0 @@ -// -// SQLChannel.h -// -// Library: Data -// Package: Logging -// Module: SQLChannel -// -// Definition of the SQLChannel class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SQLChannel_INCLUDED -#define Data_SQLChannel_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Connector.h" -#include "Poco/Data/Session.h" -#include "Poco/Data/Statement.h" -#include "Poco/Data/ArchiveStrategy.h" -#include "Poco/Channel.h" -#include "Poco/Message.h" -#include "Poco/AutoPtr.h" -#include "Poco/String.h" - - -namespace Poco { -namespace Data { - - -class Data_API SQLChannel: public Poco::Channel - /// This Channel implements logging to a SQL database. - /// The channel is dependent on the schema. The DDL for - /// table creation (subject to target DDL dialect dependent - /// modifications) is: - /// - /// "CREATE TABLE T_POCO_LOG (Source VARCHAR, - /// Name VARCHAR, - /// ProcessId INTEGER, - /// Thread VARCHAR, - /// ThreadId INTEGER, - /// Priority INTEGER, - /// Text VARCHAR, - /// DateTime DATE)" - /// - /// The table name is configurable through "table" property. - /// Other than DateTime filed name used for optiona time-based archiving purposes, currently the - /// field names are not mandated. However, it is recomended to use names as specified above. - /// - /// To provide as non-intrusive operation as possbile, the log entries are cached and - /// inserted into the target database asynchronously by default . The blocking, however, will occur - /// before the next entry insertion with default timeout of 1 second. The default settings can be - /// overriden (see async, timeout and throw properties for details). - /// If throw property is false, insertion timeouts are ignored, otherwise a TimeoutException is thrown. - /// To force insertion of every entry, set timeout to 0. This setting, however, introduces - /// a risk of long blocking periods in case of remote server communication delays. -{ -public: - SQLChannel(); - /// Creates SQLChannel. - - SQLChannel(const std::string& connector, - const std::string& connect, - const std::string& name = "-"); - /// Creates a SQLChannel with the given connector, connect string, timeout, table and name. - /// The connector must be already registered. - - void open(); - /// Opens the SQLChannel. - - void close(); - /// Closes the SQLChannel. - - void log(const Message& msg); - /// Sends the message's text to the syslog service. - - void setProperty(const std::string& name, const std::string& value); - /// Sets the property with the given value. - /// - /// The following properties are supported: - /// * name: The name used to identify the source of log messages. - /// Defaults to "-". - /// - /// * target: The target data storage type ("SQLite", "ODBC", ...). - /// - /// * connector: The target data storage connector name. - /// - /// * connect: The target data storage connection string. - /// - /// * table: Destination log table name. Defaults to "T_POCO_LOG". - /// Table must exist in the target database. - /// - /// * keep: Max row age for the log table. To disable archiving, - /// set this property to empty string or "forever". - /// - /// * archive: Archive table name. Defaults to "T_POCO_LOG_ARCHIVE". - /// Table must exist in the target database. To disable archiving, - /// set this property to empty string. - /// - /// * async: Indicates asynchronous execution. When excuting asynchronously, - /// messages are sent to the target using asyncronous execution. - /// However, prior to the next message being processed and sent to - /// the target, the previous operation must have been either completed - /// or timed out (see timeout and throw properties for details on - /// how abnormal conditos are handled). - /// - /// * timeout: Timeout (ms) to wait for previous log operation completion. - /// Values "0" and "" mean no timeout. Only valid when logging - /// is asynchronous, otherwise ignored. - /// - /// * throw: Boolean value indicating whether to throw in case of timeout. - /// Setting this property to false may result in log entries being lost. - /// True values are (case insensitive) "true", "t", "yes", "y". - /// Anything else yields false. - - std::string getProperty(const std::string& name) const; - /// Returns the value of the property with the given name. - - std::size_t wait(); - /// Waits for the completion of the previous operation and returns - /// the result. If chanel is in synchronous mode, returns 0 immediately. - - static void registerChannel(); - /// Registers the channel with the global LoggingFactory. - - static const std::string PROP_CONNECT; - static const std::string PROP_CONNECTOR; - static const std::string PROP_NAME; - static const std::string PROP_TABLE; - static const std::string PROP_ARCHIVE_TABLE; - static const std::string PROP_MAX_AGE; - static const std::string PROP_ASYNC; - static const std::string PROP_TIMEOUT; - static const std::string PROP_THROW; - -protected: - ~SQLChannel(); - -private: - typedef Poco::SharedPtr<Session> SessionPtr; - typedef Poco::SharedPtr<Statement> StatementPtr; - typedef Poco::Message::Priority Priority; - typedef Poco::SharedPtr<ArchiveStrategy> StrategyPtr; - - void initLogStatement(); - /// Initiallizes the log statement. - - void initArchiveStatements(); - /// Initiallizes the archive statement. - - void logAsync(const Message& msg); - /// Waits for previous operation completion and - /// calls logSync(). If the previous operation times out, - /// and _throw is true, TimeoutException is thrown, oterwise - /// the timeout is ignored and log entry is lost. - - void logSync(const Message& msg); - /// Inserts the message in the target database. - - bool isTrue(const std::string& value) const; - /// Returns true is value is "true", "t", "yes" or "y". - /// Case insensitive. - - std::string _connector; - std::string _connect; - SessionPtr _pSession; - StatementPtr _pLogStatement; - std::string _name; - std::string _table; - int _timeout; - bool _throw; - bool _async; - - // members for log entry cache (needed for async mode) - std::string _source; - long _pid; - std::string _thread; - long _tid; - int _priority; - std::string _text; - DateTime _dateTime; - - StrategyPtr _pArchiveStrategy; -}; - - -// -// inlines -// - -inline std::size_t SQLChannel::wait() -{ - if (_async && _pLogStatement) - return _pLogStatement->wait(_timeout); - - return 0; -} - - -inline bool SQLChannel::isTrue(const std::string& value) const -{ - return ((0 == icompare(value, "true")) || - (0 == icompare(value, "t")) || - (0 == icompare(value, "yes")) || - (0 == icompare(value, "y"))); -} - - -} } // namespace Poco::Data - - -#endif // Data_SQLChannel_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Session.h b/contrib/libs/poco/Data/include/Poco/Data/Session.h deleted file mode 100644 index 29ac3c65bb..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Session.h +++ /dev/null @@ -1,498 +0,0 @@ -// -// Session.h -// -// Library: Data -// Package: DataCore -// Module: Session -// -// Definition of the Session class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Session_INCLUDED -#define Data_Session_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/Data/Statement.h" -#include "Poco/Data/StatementCreator.h" -#include "Poco/Data/Binding.h" -#include "Poco/AutoPtr.h" -#include "Poco/Any.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -class StatementImpl; - - -class Data_API Session - /// A Session holds a connection to a Database and creates Statement objects. - /// - /// Sessions are always created via the SessionFactory: - /// - /// Session ses(SessionFactory::instance().create(connectorKey, connectionString)); - /// - /// where the first param presents the type of session one wants to create (e.g., for SQLite one would choose "SQLite", - /// for ODBC the key is "ODBC") and the second param is the connection string that the session implementation - /// requires to connect to the database. The format of the connection string is specific to the actual connector. - /// - /// A simpler form to create the session is to pass the connector key and connection string directly to - /// the Session constructor. - /// - /// A concrete example to open an SQLite database stored in the file "dummy.db" would be - /// - /// Session ses("SQLite", "dummy.db"); - /// - /// Via a Session one can create two different types of statements. First, statements that should only be executed once and immediately, and - /// second, statements that should be executed multiple times, using a separate execute() call. - /// The simple one is immediate execution: - /// - /// ses << "CREATE TABLE Dummy (data INTEGER(10))", now; - /// - /// The now at the end of the statement is required, otherwise the statement - /// would not be executed. - /// - /// If one wants to reuse a Statement (and avoid the overhead of repeatedly parsing an SQL statement) - /// one uses an explicit Statement object and its execute() method: - /// - /// int i = 0; - /// Statement stmt = (ses << "INSERT INTO Dummy VALUES(:data)", use(i)); - /// - /// for (i = 0; i < 100; ++i) - /// { - /// stmt.execute(); - /// } - /// - /// The above example assigns the variable i to the ":data" placeholder in the SQL query. The query is parsed and compiled exactly - /// once, but executed 100 times. At the end the values 0 to 99 will be present in the Table "DUMMY". - /// - /// A faster implementaton of the above code will simply create a vector of int - /// and use the vector as parameter to the use clause (you could also use set or multiset instead): - /// - /// std::vector<int> data; - /// for (int i = 0; i < 100; ++i) - /// { - /// data.push_back(i); - /// } - /// ses << "INSERT INTO Dummy VALUES(:data)", use(data); - /// - /// NEVER try to bind to an empty collection. This will give a BindingException at run-time! - /// - /// Retrieving data from a database works similar, you could use simple data types, vectors, sets or multiset as your targets: - /// - /// std::set<int> retData; - /// ses << "SELECT * FROM Dummy", into(retData)); - /// - /// Due to the blocking nature of the above call it is possible to partition the data retrieval into chunks by setting a limit to - /// the maximum number of rows retrieved from the database: - /// - /// std::set<int> retData; - /// Statement stmt = (ses << "SELECT * FROM Dummy", into(retData), limit(50)); - /// while (!stmt.done()) - /// { - /// stmt.execute(); - /// } - /// - /// The "into" keyword is used to inform the statement where output results should be placed. The limit value ensures - /// that during each run at most 50 rows are retrieved. Assuming Dummy contains 100 rows, retData will contain 50 - /// elements after the first run and 100 after the second run, i.e. - /// the collection is not cleared between consecutive runs. After the second execute stmt.done() will return true. - /// - /// A prepared Statement will behave exactly the same but a further call to execute() will simply reset the Statement, - /// execute it again and append more data to the result set. - /// - /// Note that it is possible to append several "bind" or "into" clauses to the statement. Theoretically, one could also have several - /// limit clauses but only the last one that was added will be effective. - /// Also several preconditions must be met concerning binds and intos. - /// Take the following example: - /// - /// ses << "CREATE TABLE Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3))"; - /// std::vector<std::string> nameVec; // [...] add some elements - /// std::vector<int> ageVec; // [...] add some elements - /// ses << "INSERT INTO Person (LastName, Age) VALUES(:ln, :age)", use(nameVec), use(ageVec); - /// - /// The size of all use parameters MUST be the same, otherwise an exception is thrown. Furthermore, - /// the amount of use clauses must match the number of wildcards in the query (to be more precise: - /// each binding has a numberOfColumnsHandled() value which defaults to 1. The sum of all these values - /// must match the wildcard count in the query. - /// However, this is only important if you have written your own TypeHandler specializations. - /// If you plan to map complex object types to tables see the TypeHandler documentation. - /// For now, we simply assume we have written one TypeHandler for Person objects. Instead of having n different vectors, - /// we have one collection: - /// - /// std::vector<Person> people; // [...] add some elements - /// ses << "INSERT INTO Person (LastName, FirstName, Age) VALUES(:ln, :fn, :age)", use(people); - /// - /// which will insert all Person objects from the people vector to the database (and again, you can use set, multiset too, - /// even map and multimap if Person provides an operator() which returns the key for the map). - /// The same works for a SELECT statement with "into" clauses: - /// - /// std::vector<Person> people; - /// ses << "SELECT * FROM PERSON", into(people); - /// - /// Mixing constants or variables with manipulators is allowed provided there are corresponding placeholders for the constants provided in - /// the SQL string, such as in following example: - /// - /// std::vector<Person> people; - /// ses << "SELECT * FROM %s", into(people), "PERSON"; - /// - /// Formatting only kicks in if there are values to be injected into the SQL string, otherwise it is skipped. - /// If the formatting will occur and the percent sign is part of the query itself, it can be passed to the query by entering it twice (%%). - /// However, if no formatting is used, one percent sign is sufficient as the string will be passed unaltered. - /// For complete list of supported data types with their respective specifications, see the documentation for format in Foundation. -{ -public: - static const std::size_t LOGIN_TIMEOUT_DEFAULT = SessionImpl::LOGIN_TIMEOUT_DEFAULT; - static const Poco::UInt32 TRANSACTION_READ_UNCOMMITTED = 0x00000001L; - static const Poco::UInt32 TRANSACTION_READ_COMMITTED = 0x00000002L; - static const Poco::UInt32 TRANSACTION_REPEATABLE_READ = 0x00000004L; - static const Poco::UInt32 TRANSACTION_SERIALIZABLE = 0x00000008L; - - Session(Poco::AutoPtr<SessionImpl> ptrImpl); - /// Creates the Session. - - Session(const std::string& connector, - const std::string& connectionString, - std::size_t timeout = LOGIN_TIMEOUT_DEFAULT); - /// Creates a new session, using the given connector (which must have - /// been registered), and connectionString. - - Session(const std::string& connection, - std::size_t timeout = LOGIN_TIMEOUT_DEFAULT); - /// Creates a new session, using the given connection (must be in - /// "connection:///connectionString" format). - - Session(const Session&); - /// Creates a session by copying another one. - - Session& operator = (const Session&); - /// Assignment operator. - - ~Session(); - /// Destroys the Session. - - void swap(Session& other); - /// Swaps the session with another one. - - template <typename T> - Statement operator << (const T& t) - /// Creates a Statement with the given data as SQLContent - { - return _statementCreator << t; - } - - StatementImpl* createStatementImpl(); - /// Creates a StatementImpl. - - void open(const std::string& connect = ""); - /// Opens the session using the supplied string. - /// Can also be used with default empty string to - /// reconnect a disconnected session. - /// If the connection is not established, - /// a ConnectionFailedException is thrown. - /// Zero timout means indefinite - - void close(); - /// Closes the session. - - bool isConnected(); - /// Returns true iff session is connected, false otherwise. - - void reconnect(); - /// Closes the session and opens it. - - void setLoginTimeout(std::size_t timeout); - /// Sets the session login timeout value. - - std::size_t getLoginTimeout() const; - /// Returns the session login timeout value. - - void setConnectionTimeout(std::size_t timeout); - /// Sets the session connection timeout value. - - std::size_t getConnectionTimeout(); - /// Returns the session connection timeout value. - - void begin(); - /// Starts a transaction. - - void commit(); - /// Commits and ends a transaction. - - void rollback(); - /// Rolls back and ends a transaction. - - bool canTransact(); - /// Returns true if session has transaction capabilities. - - bool isTransaction(); - /// Returns true iff a transaction is in progress, false otherwise. - - void setTransactionIsolation(Poco::UInt32); - /// Sets the transaction isolation level. - - Poco::UInt32 getTransactionIsolation(); - /// Returns the transaction isolation level. - - bool hasTransactionIsolation(Poco::UInt32 ti); - /// Returns true iff the transaction isolation level corresponding - /// to the supplied bitmask is supported. - - bool isTransactionIsolation(Poco::UInt32 ti); - /// Returns true iff the transaction isolation level corresponds - /// to the supplied bitmask. - - std::string connector() const; - /// Returns the connector name for this session. - - std::string uri() const; - /// Returns the URI for this session. - - static std::string uri(const std::string& connector, - const std::string& connectionString); - /// Utility function that teturns the URI formatted from supplied - /// arguments as "connector:///connectionString". - - void setFeature(const std::string& name, bool state); - /// Set the state of a feature. - /// - /// Features are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested feature is - /// not supported by the underlying implementation. - - bool getFeature(const std::string& name) const; - /// Look up the state of a feature. - /// - /// Features are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested feature is - /// not supported by the underlying implementation. - - void setProperty(const std::string& name, const Poco::Any& value); - /// Set the value of a property. - /// - /// Properties are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested property is - /// not supported by the underlying implementation. - - Poco::Any getProperty(const std::string& name) const; - /// Look up the value of a property. - /// - /// Properties are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested property is - /// not supported by the underlying implementation. - - SessionImpl* impl(); - /// Returns a pointer to the underlying SessionImpl. - -private: - Session(); - - Poco::AutoPtr<SessionImpl> _pImpl; - StatementCreator _statementCreator; -}; - - -// -// inlines -// -inline StatementImpl* Session::createStatementImpl() -{ - return _pImpl->createStatementImpl(); -} - - -inline void Session::open(const std::string& connect) -{ - _pImpl->open(connect); -} - - -inline void Session::close() -{ - _pImpl->close(); -} - - -inline bool Session::isConnected() -{ - return _pImpl->isConnected(); -} - - -inline void Session::reconnect() -{ - _pImpl->reconnect(); -} - - -inline void Session::setLoginTimeout(std::size_t timeout) -{ - _pImpl->setLoginTimeout(timeout); -} - - -inline std::size_t Session::getLoginTimeout() const -{ - return _pImpl->getLoginTimeout(); -} - - -inline void Session::setConnectionTimeout(std::size_t timeout) -{ - _pImpl->setConnectionTimeout(timeout); -} - - -inline std::size_t Session::getConnectionTimeout() -{ - return _pImpl->getConnectionTimeout(); -} - - -inline void Session::begin() -{ - return _pImpl->begin(); -} - - -inline void Session::commit() -{ - return _pImpl->commit(); -} - - -inline void Session::rollback() -{ - return _pImpl->rollback(); -} - - -inline bool Session::canTransact() -{ - return _pImpl->canTransact(); -} - - -inline bool Session::isTransaction() -{ - return _pImpl->isTransaction(); -} - - -inline void Session::setTransactionIsolation(Poco::UInt32 ti) -{ - _pImpl->setTransactionIsolation(ti); -} - - -inline Poco::UInt32 Session::getTransactionIsolation() -{ - return _pImpl->getTransactionIsolation(); -} - - -inline bool Session::hasTransactionIsolation(Poco::UInt32 ti) -{ - return _pImpl->hasTransactionIsolation(ti); -} - - -inline bool Session::isTransactionIsolation(Poco::UInt32 ti) -{ - return _pImpl->isTransactionIsolation(ti); -} - - -inline std::string Session::connector() const -{ - return _pImpl->connectorName(); -} - - -inline std::string Session::uri(const std::string& connector, - const std::string& connectionString) -{ - return SessionImpl::uri(connector, connectionString); -} - - -inline std::string Session::uri() const -{ - return _pImpl->uri(); -} - - -inline void Session::setFeature(const std::string& name, bool state) -{ - _pImpl->setFeature(name, state); -} - - -inline bool Session::getFeature(const std::string& name) const -{ - return const_cast<SessionImpl*>(_pImpl.get())->getFeature(name); -} - - -inline void Session::setProperty(const std::string& name, const Poco::Any& value) -{ - _pImpl->setProperty(name, value); -} - - -inline Poco::Any Session::getProperty(const std::string& name) const -{ - return const_cast<SessionImpl*>(_pImpl.get())->getProperty(name); -} - - -inline SessionImpl* Session::impl() -{ - return _pImpl; -} - - -} } // namespace Poco::Data - - -namespace std -{ - template<> - inline void swap<Poco::Data::Session>(Poco::Data::Session& s1, - Poco::Data::Session& s2) - /// Full template specalization of std:::swap for Session - { - s1.swap(s2); - } -} - - -namespace Poco { namespace Data -{ - inline void swap(Session& s1, Session& s2) - { - s1.swap(s2); - } -} } - - - -#endif // Data_Session_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SessionFactory.h b/contrib/libs/poco/Data/include/Poco/Data/SessionFactory.h deleted file mode 100644 index 0185a8a381..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SessionFactory.h +++ /dev/null @@ -1,99 +0,0 @@ -// -// SessionFactory.h -// -// Library: Data -// Package: DataCore -// Module: SessionFactory -// -// Definition of the SessionFactory class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SessionFactory_INCLUDED -#define Data_SessionFactory_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Connector.h" -#include "Poco/Data/Session.h" -#include "Poco/Mutex.h" -#include "Poco/SharedPtr.h" -#include "Poco/String.h" -#include <map> - - -namespace Poco { -namespace Data { - - -class Data_API SessionFactory - /// A SessionFactory is a singleton class that stores Connectors and allows to - /// create Sessions of the required type: - /// - /// Session ses(SessionFactory::instance().create(connector, connectionString)); - /// - /// where the first param presents the type of session one wants to create (e.g. for SQLite one would choose "SQLite") - /// and the second param is the connection string that the connector requires to connect to the database. - /// - /// A concrete example to open an SQLite database stored in the file "dummy.db" would be - /// - /// Session ses(SessionFactory::instance().create(SQLite::Connector::KEY, "dummy.db")); - /// - /// An even simpler way to create a session is to use the two argument constructor of Session, which - /// automatically invokes the SessionFactory: - /// - /// Session ses("SQLite", "dummy.db"); -{ -public: - - static SessionFactory& instance(); - /// returns the static instance of the singleton. - - void add(Connector* pIn); - /// Registers a Connector under its key at the factory. If a registration for that - /// key is already active, the first registration will be kept, only its reference count will be increased. - /// Always takes ownership of parameter pIn. - - void remove(const std::string& key); - /// Lowers the reference count for the Connector registered under that key. If the count reaches zero, - /// the object is removed. - - Session create(const std::string& key, - const std::string& connectionString, - std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT); - /// Creates a Session for the given key with the connectionString. Throws an Poco:Data::UnknownDataBaseException - /// if no Connector is registered for that key. - - Session create(const std::string& uri, - std::size_t timeout = Session::LOGIN_TIMEOUT_DEFAULT); - /// Creates a Session for the given URI (must be in key:///connectionString format). - /// Throws a Poco:Data::UnknownDataBaseException if no Connector is registered for the key. - -private: - SessionFactory(); - ~SessionFactory(); - SessionFactory(const SessionFactory&); - SessionFactory& operator = (const SessionFactory&); - - struct SessionInfo - { - int cnt; - Poco::SharedPtr<Connector> ptrSI; - SessionInfo(Connector* pSI); - }; - - typedef std::map<std::string, SessionInfo, Poco::CILess> Connectors; - Connectors _connectors; - Poco::FastMutex _mutex; -}; - - -} } // namespace Poco::Data - - -#endif // Data_SessionFactory_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SessionImpl.h b/contrib/libs/poco/Data/include/Poco/Data/SessionImpl.h deleted file mode 100644 index 223c2bf978..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SessionImpl.h +++ /dev/null @@ -1,221 +0,0 @@ -// -// SessionImpl.h -// -// Library: Data -// Package: DataCore -// Module: SessionImpl -// -// Definition of the SessionImpl class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SessionImpl_INCLUDED -#define Data_SessionImpl_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/RefCountedObject.h" -#include "Poco/String.h" -#include "Poco/Format.h" -#include "Poco/Any.h" - - -namespace Poco { -namespace Data { - - -class StatementImpl; - - -class Data_API SessionImpl: public Poco::RefCountedObject - /// Interface for Session functionality that subclasses must extend. - /// SessionImpl objects are noncopyable. -{ -public: - static const std::size_t LOGIN_TIMEOUT_INFINITE = 0; - /// Infinite connection/login timeout. - - static const std::size_t LOGIN_TIMEOUT_DEFAULT = 60; - /// Default connection/login timeout in seconds. - - static const std::size_t CONNECTION_TIMEOUT_INFINITE = 0; - /// Infinite connection/login timeout. - - static const std::size_t CONNECTION_TIMEOUT_DEFAULT = CONNECTION_TIMEOUT_INFINITE; - /// Default connection/login timeout in seconds. - - SessionImpl(const std::string& connectionString, - std::size_t timeout = LOGIN_TIMEOUT_DEFAULT); - /// Creates the SessionImpl. - - virtual ~SessionImpl(); - /// Destroys the SessionImpl. - - virtual StatementImpl* createStatementImpl() = 0; - /// Creates a StatementImpl. - - virtual void open(const std::string& connectionString = "") = 0; - /// Opens the session using the supplied string. - /// Can also be used with default empty string to reconnect - /// a disconnected session. - /// If the connection is not established within requested timeout - /// (specified in seconds), a ConnectionFailedException is thrown. - /// Zero timout means indefinite - - virtual void close() = 0; - /// Closes the connection. - - virtual bool isConnected() = 0; - /// Returns true if session is connected, false otherwise. - - void setLoginTimeout(std::size_t timeout); - /// Sets the session login timeout value. - - std::size_t getLoginTimeout() const; - /// Returns the session login timeout value. - - virtual void setConnectionTimeout(std::size_t timeout) = 0; - /// Sets the session connection timeout value. - - virtual std::size_t getConnectionTimeout() = 0; - /// Returns the session connection timeout value. - - void reconnect(); - /// Closes the connection and opens it again. - - virtual void begin() = 0; - /// Starts a transaction. - - virtual void commit() = 0; - /// Commits and ends a transaction. - - virtual void rollback() = 0; - /// Aborts a transaction. - - virtual bool canTransact() = 0; - /// Returns true if session has transaction capabilities. - - virtual bool isTransaction() = 0; - /// Returns true iff a transaction is a transaction is in progress, false otherwise. - - virtual void setTransactionIsolation(Poco::UInt32) = 0; - /// Sets the transaction isolation level. - - virtual Poco::UInt32 getTransactionIsolation() = 0; - /// Returns the transaction isolation level. - - virtual bool hasTransactionIsolation(Poco::UInt32) = 0; - /// Returns true iff the transaction isolation level corresponding - /// to the supplied bitmask is supported. - - virtual bool isTransactionIsolation(Poco::UInt32) = 0; - /// Returns true iff the transaction isolation level corresponds - /// to the supplied bitmask. - - virtual const std::string& connectorName() const = 0; - /// Returns the name of the connector. - - const std::string& connectionString() const; - /// Returns the connection string. - - static std::string uri(const std::string& connector, const std::string& connectionString); - /// Returns formatted URI. - - std::string uri() const; - /// Returns the URI for this session. - - virtual void setFeature(const std::string& name, bool state) = 0; - /// Set the state of a feature. - /// - /// Features are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested feature is - /// not supported by the underlying implementation. - - virtual bool getFeature(const std::string& name) = 0; - /// Look up the state of a feature. - /// - /// Features are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested feature is - /// not supported by the underlying implementation. - - virtual void setProperty(const std::string& name, const Poco::Any& value) = 0; - /// Set the value of a property. - /// - /// Properties are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested property is - /// not supported by the underlying implementation. - - virtual Poco::Any getProperty(const std::string& name) = 0; - /// Look up the value of a property. - /// - /// Properties are a generic extension mechanism for session implementations. - /// and are defined by the underlying SessionImpl instance. - /// - /// Throws a NotSupportedException if the requested property is - /// not supported by the underlying implementation. - -protected: - void setConnectionString(const std::string& connectionString); - /// Sets the connection string. Should only be called on - /// disconnetced sessions. Throws InvalidAccessException when called on - /// a connected session. - -private: - SessionImpl(); - SessionImpl(const SessionImpl&); - SessionImpl& operator = (const SessionImpl&); - - std::string _connectionString; - std::size_t _loginTimeout; -}; - - -// -// inlines -// -inline const std::string& SessionImpl::connectionString() const -{ - return _connectionString; -} - - -inline void SessionImpl::setLoginTimeout(std::size_t timeout) -{ - _loginTimeout = timeout; -} - - -inline std::size_t SessionImpl::getLoginTimeout() const -{ - return _loginTimeout; -} - - -inline std::string SessionImpl::uri(const std::string& connector, - const std::string& connectionString) -{ - return format("%s:///%s", connector, connectionString); -} - - -inline std::string SessionImpl::uri() const -{ - return uri(connectorName(), connectionString()); -} - - -} } // namespace Poco::Data - - -#endif // Data_SessionImpl_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SessionPool.h b/contrib/libs/poco/Data/include/Poco/Data/SessionPool.h deleted file mode 100644 index 6994c331e6..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SessionPool.h +++ /dev/null @@ -1,233 +0,0 @@ -// -// SessionPool.h -// -// Library: Data -// Package: SessionPooling -// Module: SessionPool -// -// Definition of the SessionPool class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SessionPool_INCLUDED -#define Data_SessionPool_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/PooledSessionHolder.h" -#include "Poco/Data/PooledSessionImpl.h" -#include "Poco/Data/Session.h" -#include "Poco/HashMap.h" -#include "Poco/Any.h" -#include "Poco/Timer.h" -#include "Poco/Mutex.h" -#include <list> - - -namespace Poco { -namespace Data { - - -class Data_API SessionPool: public RefCountedObject - /// This class implements session pooling for POCO Data. - /// - /// Creating a connection to a database is often a time consuming - /// operation. Therefore it makes sense to reuse a session object - /// once it is no longer needed. - /// - /// A SessionPool manages a collection of SessionImpl objects - /// (decorated with a PooledSessionImpl). - /// - /// When a SessionImpl object is requested, the SessionPool first - /// looks in its set of already initialized SessionImpl for an - /// available object. If one is found, it is returned to the - /// client and marked as "in-use". If no SessionImpl is available, - /// the SessionPool attempts to create a new one for the client. - /// To avoid excessive creation of SessionImpl objects, a limit - /// can be set on the maximum number of objects. - /// Sessions found not to be connected to the database are purged - /// from the pool whenever one of the following events occurs: - /// - /// - JanitorTimer event - /// - get() request - /// - putBack() request - /// - /// Not connected idle sessions can not exist. - /// - /// Usage example: - /// - /// SessionPool pool("ODBC", "..."); - /// ... - /// Session sess(pool.get()); - /// ... -{ -public: - SessionPool(const std::string& connector, - const std::string& connectionString, - int minSessions = 1, - int maxSessions = 32, - int idleTime = 60); - /// Creates the SessionPool for sessions with the given connector - /// and connectionString. - /// - /// The pool allows for at most maxSessions sessions to be created. - /// If a session has been idle for more than idleTime seconds, and more than - /// minSessions sessions are in the pool, the session is automatically destroyed. - - ~SessionPool(); - /// Destroys the SessionPool. - - Session get(); - /// Returns a Session. - /// - /// If there are unused sessions available, one of the - /// unused sessions is recycled. Otherwise, a new session - /// is created. - /// - /// If the maximum number of sessions for this pool has - /// already been created, a SessionPoolExhaustedException - /// is thrown. - - template <typename T> - Session get(const std::string& name, const T& value) - /// Returns a Session with requested property set. - /// The property can be different from the default pool - /// value, in which case it is reset back to the pool - /// value when the session is reclaimed by the pool. - { - Session s = get(); - _addPropertyMap.insert(AddPropertyMap::value_type(s.impl(), - std::make_pair(name, s.getProperty(name)))); - s.setProperty(name, value); - - return s; - } - - Session get(const std::string& name, bool value); - /// Returns a Session with requested feature set. - /// The feature can be different from the default pool - /// value, in which case it is reset back to the pool - /// value when the session is reclaimed by the pool. - - int capacity() const; - /// Returns the maximum number of sessions the SessionPool will manage. - - int used() const; - /// Returns the number of sessions currently in use. - - int idle() const; - /// Returns the number of idle sessions. - - int dead(); - /// Returns the number of not connected active sessions. - - int allocated() const; - /// Returns the number of allocated sessions. - - int available() const; - /// Returns the number of available (idle + remaining capacity) sessions. - - std::string name() const; - /// Returns the name for this pool. - - static std::string name(const std::string& connector, - const std::string& connectionString); - /// Returns the name formatted from supplied arguments as "connector:///connectionString". - - void setFeature(const std::string& name, bool state); - /// Sets feature for all the sessions. - - bool getFeature(const std::string& name); - /// Returns the requested feature. - - void setProperty(const std::string& name, const Poco::Any& value); - /// Sets property for all sessions. - - Poco::Any getProperty(const std::string& name); - /// Returns the requested property. - - void shutdown(); - /// Shuts down the session pool. - - bool isActive() const; - /// Returns true if session pool is active (not shut down). - -protected: - virtual void customizeSession(Session& session); - /// Can be overridden by subclass to perform custom initialization - /// of a newly created database session. - /// - /// The default implementation does nothing. - - typedef Poco::AutoPtr<PooledSessionHolder> PooledSessionHolderPtr; - typedef Poco::AutoPtr<PooledSessionImpl> PooledSessionImplPtr; - typedef std::list<PooledSessionHolderPtr> SessionList; - typedef Poco::HashMap<std::string, bool> FeatureMap; - typedef Poco::HashMap<std::string, Poco::Any> PropertyMap; - - void purgeDeadSessions(); - int deadImpl(SessionList& rSessions); - void applySettings(SessionImpl* pImpl); - void putBack(PooledSessionHolderPtr pHolder); - void onJanitorTimer(Poco::Timer&); - -private: - typedef std::pair<std::string, Poco::Any> PropertyPair; - typedef std::pair<std::string, bool> FeaturePair; - typedef std::map<SessionImpl*, PropertyPair> AddPropertyMap; - typedef std::map<SessionImpl*, FeaturePair> AddFeatureMap; - - SessionPool(const SessionPool&); - SessionPool& operator = (const SessionPool&); - - void closeAll(SessionList& sessionList); - - std::string _connector; - std::string _connectionString; - int _minSessions; - int _maxSessions; - int _idleTime; - int _nSessions; - SessionList _idleSessions; - SessionList _activeSessions; - Poco::Timer _janitorTimer; - FeatureMap _featureMap; - PropertyMap _propertyMap; - bool _shutdown; - AddPropertyMap _addPropertyMap; - AddFeatureMap _addFeatureMap; - mutable - Poco::Mutex _mutex; - - friend class PooledSessionImpl; -}; - - -inline std::string SessionPool::name(const std::string& connector, - const std::string& connectionString) -{ - return Session::uri(connector, connectionString); -} - - -inline std::string SessionPool::name() const -{ - return name(_connector, _connectionString); -} - - -inline bool SessionPool::isActive() const -{ - return !_shutdown; -} - - -} } // namespace Poco::Data - - -#endif // Data_SessionPool_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SessionPoolContainer.h b/contrib/libs/poco/Data/include/Poco/Data/SessionPoolContainer.h deleted file mode 100644 index 15c3e83b99..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SessionPoolContainer.h +++ /dev/null @@ -1,114 +0,0 @@ -// -// SessionPoolContainer.h -// -// Library: Data -// Package: SessionPooling -// Module: SessionPoolContainer -// -// Definition of the SessionPoolContainer class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SessionPoolContainer_INCLUDED -#define Data_SessionPoolContainer_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Session.h" -#include "Poco/Data/SessionPool.h" -#include "Poco/String.h" -#include "Poco/Mutex.h" - - -namespace Poco { -namespace Data { - - -class Data_API SessionPoolContainer - /// This class implements container of session pools. -{ -public: - SessionPoolContainer(); - /// Creates the SessionPoolContainer for sessions with the given session parameters. - - ~SessionPoolContainer(); - /// Destroys the SessionPoolContainer. - - void add(SessionPool* pPool); - /// Adds existing session pool to the container. - /// Throws SessionPoolExistsException if pool already exists. - - Session add(const std::string& sessionKey, - const std::string& connectionString, - int minSessions = 1, - int maxSessions = 32, - int idleTime = 60); - /// Adds a new session pool to the container and returns a Session from - /// newly created pool. If pool already exists, request to add is silently - /// ignored and session is returned from the existing pool. - - bool has(const std::string& name) const; - /// Returns true if the requested name exists, false otherwise. - - bool isActive(const std::string& sessionKey, - const std::string& connectionString = "") const; - /// Returns true if the session is active (i.e. not shut down). - /// If connectionString is empty string, sessionKey must be a - /// fully qualified session name as registered with the pool - /// container. - - Session get(const std::string& name); - /// Returns the requested Session. - /// Throws NotFoundException if session is not found. - - SessionPool& getPool(const std::string& name); - /// Returns a SessionPool reference. - /// Throws NotFoundException if session is not found. - - void remove(const std::string& name); - /// Removes a SessionPool. - - int count() const; - /// Returns the number of session pols in the container. - - void shutdown(); - /// Shuts down all the held pools. - -private: - typedef std::map<std::string, AutoPtr<SessionPool>, Poco::CILess> SessionPoolMap; - - SessionPoolContainer(const SessionPoolContainer&); - SessionPoolContainer& operator = (const SessionPoolContainer&); - - SessionPoolMap _sessionPools; - Poco::FastMutex _mutex; -}; - - -inline bool SessionPoolContainer::has(const std::string& name) const -{ - return _sessionPools.find(name) != _sessionPools.end(); -} - - -inline void SessionPoolContainer::remove(const std::string& name) -{ - _sessionPools.erase(name); -} - - -inline int SessionPoolContainer::count() const -{ - return static_cast<int>(_sessionPools.size()); -} - - -} } // namespace Poco::Data - - -#endif // Data_SessionPoolContainer_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/SimpleRowFormatter.h b/contrib/libs/poco/Data/include/Poco/Data/SimpleRowFormatter.h deleted file mode 100644 index 2ddfdac9cc..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/SimpleRowFormatter.h +++ /dev/null @@ -1,122 +0,0 @@ -// -// RowFormatter.h -// -// Library: Data -// Package: DataCore -// Module: SimpleRowFormatter -// -// Definition of the RowFormatter class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_SimpleRowFormatter_INCLUDED -#define Data_SimpleRowFormatter_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/RowFormatter.h" - - -namespace Poco { -namespace Data { - - -class Data_API SimpleRowFormatter: public RowFormatter - /// A simple row formatting class. -{ -public: - //typedef RowFormatter::NameVec NameVec; - //typedef RowFormatter::NameVecPtr NameVecPtr; - //typedef RowFormatter::ValueVec ValueVec; - - static const int DEFAULT_COLUMN_WIDTH = 16; - static const int DEFAULT_SPACING = 1; - - SimpleRowFormatter(std::streamsize columnWidth = DEFAULT_COLUMN_WIDTH, std::streamsize spacing = DEFAULT_SPACING); - /// Creates the SimpleRowFormatter and sets the column width to specified value. - - SimpleRowFormatter(const SimpleRowFormatter& other); - /// Creates the copy of the supplied SimpleRowFormatter. - - SimpleRowFormatter& operator = (const SimpleRowFormatter& row); - /// Assignment operator. - - ~SimpleRowFormatter(); - /// Destroys the SimpleRowFormatter. - - void swap(SimpleRowFormatter& other); - /// Swaps the row formatter with another one. - - std::string& formatNames(const NameVecPtr pNames, std::string& formattedNames); - /// Formats the row field names. - - std::string& formatValues(const ValueVec& vals, std::string& formattedValues); - /// Formats the row values. - - int rowCount() const; - /// Returns row count. - - void setColumnWidth(std::streamsize width); - /// Sets the column width. - - std::streamsize getColumnWidth() const; - /// Returns the column width. - - std::streamsize getSpacing() const; - /// Returns the spacing. - -private: - std::streamsize _colWidth; - std::streamsize _spacing; - int _rowCount; -}; - - -/// -/// inlines -/// -inline int SimpleRowFormatter::rowCount() const -{ - return _rowCount; -} - - -inline void SimpleRowFormatter::setColumnWidth(std::streamsize columnWidth) -{ - _colWidth = columnWidth; -} - - -inline std::streamsize SimpleRowFormatter::getColumnWidth() const -{ - return _colWidth; -} - - -inline std::streamsize SimpleRowFormatter::getSpacing() const -{ - return _spacing; -} - - -} } // namespace Poco::Data - - -namespace std -{ - template<> - inline void swap<Poco::Data::SimpleRowFormatter>(Poco::Data::SimpleRowFormatter& s1, - Poco::Data::SimpleRowFormatter& s2) - /// Full template specalization of std:::swap for SimpleRowFormatter - { - s1.swap(s2); - } -} - - -#endif // Data_SimpleRowFormatter_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Statement.h b/contrib/libs/poco/Data/include/Poco/Data/Statement.h deleted file mode 100644 index e17e4bc615..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Statement.h +++ /dev/null @@ -1,825 +0,0 @@ -// -// Statement.h -// -// Library: Data -// Package: DataCore -// Module: Statement -// -// Definition of the Statement class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Statement_INCLUDED -#define Data_Statement_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/StatementImpl.h" -#include "Poco/Data/Binding.h" -#include "Poco/Data/Range.h" -#include "Poco/Data/Bulk.h" -#include "Poco/Data/Row.h" -#include "Poco/Data/SimpleRowFormatter.h" -#include "Poco/SharedPtr.h" -#include "Poco/Mutex.h" -#include "Poco/ActiveMethod.h" -#include "Poco/ActiveResult.h" -#include "Poco/Format.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -class AbstractBinding; -class AbstractExtraction; -class Session; -class Limit; - - -class Data_API Statement - /// A Statement is used to execute SQL statements. - /// It does not contain code of its own. - /// Its main purpose is to forward calls to the concrete StatementImpl stored inside. - /// Statement execution can be synchronous or asynchronous. - /// Synchronous ececution is achieved through execute() call, while asynchronous is - /// achieved through executeAsync() method call. - /// An asynchronously executing statement should not be copied during the execution. - /// - /// Note: - /// - /// Once set as asynchronous through 'async' manipulator, statement remains - /// asynchronous for all subsequent execution calls, both execute() and executeAsync(). - /// However, calling executAsync() on a synchronous statement shall execute - /// asynchronously but without altering the underlying statement's synchronous nature. - /// - /// Once asynchronous, a statement can be reverted back to synchronous state in two ways: - /// - /// 1) By calling setAsync(false) - /// 2) By means of 'sync' or 'reset' manipulators - /// - /// See individual functions documentation for more details. - /// - /// Statement owns the RowFormatter, which can be provided externaly through setFormatter() - /// member function. - /// If no formatter is externally supplied to the statement, the SimpleRowFormatter is lazy - /// created and used. -{ -public: - typedef void (*Manipulator)(Statement&); - - typedef ActiveResult<std::size_t> Result; - typedef SharedPtr<Result> ResultPtr; - typedef ActiveMethod<std::size_t, bool, StatementImpl> AsyncExecMethod; - typedef SharedPtr<AsyncExecMethod> AsyncExecMethodPtr; - - static const int WAIT_FOREVER = -1; - - enum Storage - { - STORAGE_DEQUE = StatementImpl::STORAGE_DEQUE_IMPL, - STORAGE_VECTOR = StatementImpl::STORAGE_VECTOR_IMPL, - STORAGE_LIST = StatementImpl::STORAGE_LIST_IMPL, - STORAGE_UNKNOWN = StatementImpl::STORAGE_UNKNOWN_IMPL - }; - - Statement(StatementImpl::Ptr pImpl); - /// Creates the Statement. - - explicit Statement(Session& session); - /// Creates the Statement for the given Session. - /// - /// The following: - /// - /// Statement stmt(sess); - /// stmt << "SELECT * FROM Table", ... - /// - /// is equivalent to: - /// - /// Statement stmt(sess << "SELECT * FROM Table", ...); - /// - /// but in some cases better readable. - - ~Statement(); - /// Destroys the Statement. - - Statement(const Statement& stmt); - /// Copy constructor. - /// If the statement has been executed asynchronously and has not been - /// synchronized prior to copy operation (i.e. is copied while executing), - /// this constructor shall synchronize it. - - Statement& operator = (const Statement& stmt); - /// Assignment operator. - - void swap(Statement& other); - /// Swaps the statement with another one. - - template <typename T> - Statement& operator << (const T& t) - /// Concatenates data with the SQL statement string. - { - _pImpl->add(t); - return *this; - } - - Statement& operator , (Manipulator manip); - /// Handles manipulators, such as now, async, etc. - - Statement& operator , (AbstractBinding::Ptr pBind); - /// Registers the Binding with the Statement by calling addBind(). - - Statement& addBind(AbstractBinding::Ptr pBind); - /// Registers a single binding with the statement. - - void removeBind(const std::string& name); - /// Removes the all the bindings with specified name from the statement. - - Statement& operator , (AbstractBindingVec& bindVec); - /// Registers the Binding vector with the Statement. - - template <typename C> - Statement& addBinding(C& bindingCont, bool reset) - /// Registers binding container with the Statement. - { - if (reset) _pImpl->resetBinding(); - typename C::iterator itAB = bindingCont.begin(); - typename C::iterator itABEnd = bindingCont.end(); - for (; itAB != itABEnd; ++itAB) addBind(*itAB); - return *this; - } - - template <typename C> - Statement& bind(const C& value) - /// Adds a binding to the Statement. This can be used to implement - /// generic binding mechanisms and is a nicer syntax for: - /// - /// statement , bind(value); - { - (*this) , Keywords::bind(value); - return *this; - } - - Statement& operator , (AbstractExtraction::Ptr extract); - /// Registers objects used for extracting data with the Statement by - /// calling addExtract(). - - Statement& operator , (AbstractExtractionVec& extVec); - /// Registers the extraction vector with the Statement. - /// The vector is registered at position 0 (i.e. for the first returned data set). - - Statement& operator , (AbstractExtractionVecVec& extVecVec); - /// Registers the vector of extraction vectors with the Statement. - - template <typename C> - Statement& addExtraction(C& val, bool reset) - /// Registers extraction container with the Statement. - { - if (reset) _pImpl->resetExtraction(); - typename C::iterator itAE = val.begin(); - typename C::iterator itAEEnd = val.end(); - for (; itAE != itAEEnd; ++itAE) addExtract(*itAE); - return *this; - } - - template <typename C> - Statement& addExtractions(C& val) - /// Registers container of extraction containers with the Statement. - { - _pImpl->resetExtraction(); - typename C::iterator itAEV = val.begin(); - typename C::iterator itAEVEnd = val.end(); - for (; itAEV != itAEVEnd; ++itAEV) addExtraction(*itAEV, false); - return *this; - } - - Statement& addExtract(AbstractExtraction::Ptr pExtract); - /// Registers a single extraction with the statement. - - Statement& operator , (const Bulk& bulk); - /// Sets the bulk execution mode (both binding and extraction) for this - /// statement.Statement must not have any extractors or binders set at the - /// time when this operator is applied. - /// Failure to adhere to the above constraint shall result in - /// InvalidAccessException. - - Statement& operator , (BulkFnType); - /// Sets the bulk execution mode (both binding and extraction) for this - /// statement.Statement must not have any extractors or binders set at the - /// time when this operator is applied. - /// Additionally, this function requires limit to be set in order to - /// determine the bulk size. - /// Failure to adhere to the above constraints shall result in - /// InvalidAccessException. - - Statement& operator , (const Limit& extrLimit); - /// Sets a limit on the maximum number of rows a select is allowed to return. - /// - /// Set per default to zero to Limit::LIMIT_UNLIMITED, which disables the limit. - - Statement& operator , (RowFormatter::Ptr pRowFformatter); - /// Sets the row formatter for the statement. - - Statement& operator , (const Range& extrRange); - /// Sets a an extraction range for the maximum number of rows a select is allowed to return. - /// - /// Set per default to Limit::LIMIT_UNLIMITED which disables the range. - - Statement& operator , (char value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::UInt8 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::Int8 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::UInt16 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::Int16 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::UInt32 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::Int32 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - -#ifndef POCO_LONG_IS_64_BIT - Statement& operator , (long value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (unsigned long value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. -#endif - Statement& operator , (Poco::UInt64 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (Poco::Int64 value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (double value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (float value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (bool value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (const std::string& value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - Statement& operator , (const char* value); - /// Adds the value to the list of values to be supplied to the SQL string formatting function. - - const std::string& toString() const; - /// Creates a string from the accumulated SQL statement. - - std::size_t execute(bool reset = true); - /// Executes the statement synchronously or asynchronously. - /// Stops when either a limit is hit or the whole statement was executed. - /// Returns the number of rows extracted from the database (for statements - /// returning data) or number of rows affected (for all other statements). - /// If reset is true (default), associated storage is reset and reused. - /// Otherwise, the results from this execution step are appended. - /// Reset argument has no meaning for unlimited statements that return all rows. - /// If isAsync() returns true, the statement is executed asynchronously - /// and the return value from this function is zero. - /// The result of execution (i.e. number of returned or affected rows) can be - /// obtained by calling wait() on the statement at a later point in time. - - const Result& executeAsync(bool reset = true); - /// Executes the statement asynchronously. - /// Stops when either a limit is hit or the whole statement was executed. - /// Returns immediately. Calling wait() (on either the result returned from this - /// call or the statement itself) returns the number of rows extracted or number - /// of rows affected by the statement execution. - /// When executed on a synchronous statement, this method does not alter the - /// statement's synchronous nature. - - void setAsync(bool async = true); - /// Sets the asynchronous flag. If this flag is true, executeAsync() is called - /// from the now() manipulator. This setting does not affect the statement's - /// capability to be executed synchronously by directly calling execute(). - - bool isAsync() const; - /// Returns true if statement was marked for asynchronous execution. - - std::size_t wait(long milliseconds = WAIT_FOREVER); - /// Waits for the execution completion for asynchronous statements or - /// returns immediately for synchronous ones. The return value for - /// asynchronous statement is the execution result (i.e. number of - /// rows retrieved). For synchronous statements, the return value is zero. - - bool initialized(); - /// Returns true if the statement was initialized (i.e. not executed yet). - - bool paused(); - /// Returns true if the statement was paused (a range limit stopped it - /// and there is more work to do). - - bool done(); - /// Returns true if the statement was completely executed or false if a range limit stopped it - /// and there is more work to do. When no limit is set, it will always return true after calling execute(). - - Statement& reset(Session& session); - /// Resets the Statement so that it can be filled with a new SQL command. - - bool canModifyStorage(); - /// Returns true if statement is in a state that allows the internal storage to be modified. - - Storage storage() const; - /// Returns the internal storage type for the statement. - - void setStorage(const std::string& storage); - /// Sets the internal storage type for the statement. - - const std::string& getStorage() const; - /// Returns the internal storage type for the statement. - - std::size_t columnsExtracted(int dataSet = StatementImpl::USE_CURRENT_DATA_SET) const; - /// Returns the number of columns returned for current data set. - /// Default value indicates current data set (if any). - - std::size_t rowsExtracted(int dataSet = StatementImpl::USE_CURRENT_DATA_SET) const; - /// Returns the number of rows returned for current data set during last statement - /// execution. Default value indicates current data set (if any). - - std::size_t subTotalRowCount(int dataSet = StatementImpl::USE_CURRENT_DATA_SET) const; - /// Returns the number of rows extracted so far for the data set. - /// Default value indicates current data set (if any). - - std::size_t extractionCount() const; - /// Returns the number of extraction storage buffers associated - /// with the current data set. - - std::size_t dataSetCount() const; - /// Returns the number of data sets associated with the statement. - - std::size_t nextDataSet(); - /// Returns the index of the next data set. - - std::size_t previousDataSet(); - /// Returns the index of the previous data set. - - bool hasMoreDataSets() const; - /// Returns false if the current data set index points to the last - /// data set. Otherwise, it returns true. - - void setRowFormatter(RowFormatter::Ptr pRowFormatter); - /// Sets the row formatter for this statement. - /// Statement takes the ownership of the formatter. - -protected: - typedef StatementImpl::Ptr ImplPtr; - - const AbstractExtractionVec& extractions() const; - /// Returns the extractions vector. - - const MetaColumn& metaColumn(std::size_t pos) const; - /// Returns the type for the column at specified position. - - const MetaColumn& metaColumn(const std::string& name) const; - /// Returns the type for the column with specified name. - - bool isNull(std::size_t col, std::size_t row) const; - /// Returns true if the current row value at column pos is null. - - bool isBulkExtraction() const; - /// Returns true if this statement extracts data in bulk. - - ImplPtr impl() const; - /// Returns pointer to statement implementation. - - const RowFormatter::Ptr& getRowFormatter(); - /// Returns the row formatter for this statement. - - Session session(); - /// Returns the underlying session. - -private: - - const Result& doAsyncExec(bool reset = true); - /// Asynchronously executes the statement. - - template <typename T> - Statement& commaPODImpl(const T& val) - { - _arguments.push_back(val); - return *this; - } - - StatementImpl::Ptr _pImpl; - - // asynchronous execution related members - bool _async; - mutable ResultPtr _pResult; - Mutex _mutex; - AsyncExecMethodPtr _pAsyncExec; - std::vector<Any> _arguments; - RowFormatter::Ptr _pRowFormatter; - mutable std::string _stmtString; -}; - -// -// inlines - -inline std::size_t Statement::subTotalRowCount(int dataSet) const -{ - return _pImpl->subTotalRowCount(dataSet); -} - - -namespace Keywords { - - -// -// Manipulators -// - -inline void Data_API now(Statement& statement) - /// Enforces immediate execution of the statement. - /// If _isAsync flag has been set, execution is invoked asynchronously. -{ - statement.execute(); -} - - -inline void Data_API sync(Statement& statement) - /// Sets the _isAsync flag to false, signalling synchronous execution. - /// Synchronous execution is default, so specifying this manipulator - /// only makes sense if async() was called for the statement before. -{ - statement.setAsync(false); -} - - -inline void Data_API async(Statement& statement) - /// Sets the _async flag to true, signalling asynchronous execution. -{ - statement.setAsync(true); -} - - -inline void Data_API deque(Statement& statement) - /// Sets the internal storage to std::deque. - /// std::deque is default storage, so specifying this manipulator - /// only makes sense if list() or deque() were called for the statement before. -{ - if (!statement.canModifyStorage()) - throw InvalidAccessException("Storage not modifiable."); - - statement.setStorage("deque"); -} - - -inline void Data_API vector(Statement& statement) - /// Sets the internal storage to std::vector. -{ - if (!statement.canModifyStorage()) - throw InvalidAccessException("Storage not modifiable."); - - statement.setStorage("vector"); -} - - -inline void Data_API list(Statement& statement) - /// Sets the internal storage to std::list. -{ - if (!statement.canModifyStorage()) - throw InvalidAccessException("Storage not modifiable."); - - statement.setStorage("list"); -} - - -inline void Data_API reset(Statement& statement) - /// Sets all internal settings to their respective default values. -{ - if (!statement.canModifyStorage()) - throw InvalidAccessException("Storage not modifiable."); - - statement.setStorage("deque"); - statement.setAsync(false); -} - - -} // namespace Keywords - - -// -// inlines -// - -inline Statement& Statement::operator , (RowFormatter::Ptr pRowFformatter) -{ - _pRowFormatter = pRowFformatter; - return *this; -} - - -inline Statement& Statement::operator , (char value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::UInt8 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::Int8 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::UInt16 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::Int16 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::UInt32 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::Int32 value) -{ - return commaPODImpl(value); -} - - -#ifndef POCO_LONG_IS_64_BIT -inline Statement& Statement::operator , (long value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (unsigned long value) -{ - return commaPODImpl(value); -} -#endif - - -inline Statement& Statement::operator , (Poco::UInt64 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (Poco::Int64 value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (double value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (float value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (bool value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (const std::string& value) -{ - return commaPODImpl(value); -} - - -inline Statement& Statement::operator , (const char* value) -{ - return commaPODImpl(std::string(value)); -} - - -inline void Statement::removeBind(const std::string& name) -{ - _pImpl->removeBind(name); -} - - -inline Statement& Statement::operator , (AbstractBinding::Ptr pBind) -{ - return addBind(pBind); -} - - -inline Statement& Statement::operator , (AbstractBindingVec& bindVec) -{ - return addBinding(bindVec, false); -} - - -inline Statement& Statement::operator , (AbstractExtraction::Ptr pExtract) -{ - return addExtract(pExtract); -} - - -inline Statement& Statement::operator , (AbstractExtractionVec& extVec) -{ - return addExtraction(extVec, false); -} - - -inline Statement& Statement::operator , (AbstractExtractionVecVec& extVecVec) -{ - return addExtractions(extVecVec); -} - - -inline Statement::ImplPtr Statement::impl() const -{ - return _pImpl; -} - - -inline const std::string& Statement::toString() const -{ - return _stmtString = _pImpl->toString(); -} - -inline const AbstractExtractionVec& Statement::extractions() const -{ - return _pImpl->extractions(); -} - - -inline const MetaColumn& Statement::metaColumn(std::size_t pos) const -{ - return _pImpl->metaColumn(pos); -} - - -inline const MetaColumn& Statement::metaColumn(const std::string& name) const -{ - return _pImpl->metaColumn(name); -} - - -inline void Statement::setStorage(const std::string& storage) -{ - _pImpl->setStorage(storage); -} - - -inline std::size_t Statement::extractionCount() const -{ - return _pImpl->extractionCount(); -} - - -inline std::size_t Statement::columnsExtracted(int dataSet) const -{ - return _pImpl->columnsExtracted(dataSet); -} - - -inline std::size_t Statement::rowsExtracted(int dataSet) const -{ - return _pImpl->rowsExtracted(dataSet); -} - - -inline std::size_t Statement::dataSetCount() const -{ - return _pImpl->dataSetCount(); -} - - -inline std::size_t Statement::nextDataSet() -{ - return _pImpl->activateNextDataSet(); -} - - -inline std::size_t Statement::previousDataSet() -{ - return _pImpl->activatePreviousDataSet(); -} - - -inline bool Statement::hasMoreDataSets() const -{ - return _pImpl->hasMoreDataSets(); -} - - -inline Statement::Storage Statement::storage() const -{ - return static_cast<Storage>(_pImpl->getStorage()); -} - - -inline bool Statement::canModifyStorage() -{ - return (0 == extractionCount()) && (initialized() || done()); -} - - -inline bool Statement::initialized() -{ - return _pImpl->getState() == StatementImpl::ST_INITIALIZED; -} - - -inline bool Statement::paused() -{ - return _pImpl->getState() == StatementImpl::ST_PAUSED; -} - - -inline bool Statement::done() -{ - return _pImpl->getState() == StatementImpl::ST_DONE; -} - - -inline bool Statement::isNull(std::size_t col, std::size_t row) const -{ - return _pImpl->isNull(col, row); -} - - -inline bool Statement::isBulkExtraction() const -{ - return _pImpl->isBulkExtraction(); -} - - -inline bool Statement::isAsync() const -{ - return _async; -} - - -inline void Statement::setRowFormatter(RowFormatter::Ptr pRowFormatter) -{ - _pRowFormatter = pRowFormatter; -} - - -inline const RowFormatter::Ptr& Statement::getRowFormatter() -{ - if (!_pRowFormatter) _pRowFormatter = new SimpleRowFormatter; - return _pRowFormatter; -} - - -} } // namespace Poco::Data - - -namespace std -{ - template<> - inline void swap<Poco::Data::Statement>(Poco::Data::Statement& s1, - Poco::Data::Statement& s2) - /// Full template specalization of std:::swap for Statement - { - s1.swap(s2); - } -} - - -namespace Poco { namespace Data -{ - inline void swap(Statement& s1, Statement& s2) - { - s1.swap(s2); - } -} } - - -#endif // Data_Statement_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/StatementCreator.h b/contrib/libs/poco/Data/include/Poco/Data/StatementCreator.h deleted file mode 100644 index ca27804173..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/StatementCreator.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// StatementCreator.h -// -// Library: Data -// Package: DataCore -// Module: StatementCreator -// -// Definition of the StatementCreator class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_StatementCreator_INCLUDED -#define Data_StatementCreator_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/Data/Statement.h" -#include "Poco/AutoPtr.h" - - -namespace Poco { -namespace Data { - - -class Data_API StatementCreator - /// A StatementCreator creates Statements. -{ -public: - StatementCreator(); - /// Creates an unitialized StatementCreator. - - StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl); - /// Creates a StatementCreator. - - StatementCreator(const StatementCreator& other); - /// Creates a StatementCreator by copying another one. - - ~StatementCreator(); - /// Destroys the StatementCreator. - - StatementCreator& operator = (const StatementCreator& other); - /// Assignment operator. - - void swap(StatementCreator& other); - /// Swaps the StatementCreator with another one. - - template <typename T> - Statement operator << (const T& t) - /// Creates a Statement. - { - if (!_ptrImpl->isConnected()) - throw NotConnectedException(_ptrImpl->connectionString()); - - Statement stmt(_ptrImpl->createStatementImpl()); - stmt << t; - return stmt; - } - -private: - Poco::AutoPtr<SessionImpl> _ptrImpl; -}; - - -} } // namespace Poco::Data - - -#endif // Data_StatementCreator_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/StatementImpl.h b/contrib/libs/poco/Data/include/Poco/Data/StatementImpl.h deleted file mode 100644 index d9371a7403..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/StatementImpl.h +++ /dev/null @@ -1,632 +0,0 @@ -// -// StatementImpl.h -// -// Library: Data -// Package: DataCore -// Module: StatementImpl -// -// Definition of the StatementImpl class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_StatementImpl_INCLUDED -#define Data_StatementImpl_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractBinding.h" -#include "Poco/Data/AbstractExtraction.h" -#include "Poco/Data/Range.h" -#include "Poco/Data/Bulk.h" -#include "Poco/Data/Column.h" -#include "Poco/Data/Extraction.h" -#include "Poco/Data/BulkExtraction.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/RefCountedObject.h" -#include "Poco/String.h" -#include "Poco/Format.h" -#include "Poco/Exception.h" -#include <vector> -#include <list> -#include <deque> -#include <string> -#include <sstream> - - -namespace Poco { -namespace Data { - - -class Data_API StatementImpl - /// StatementImpl interface that subclasses must implement to define database dependent query execution. - /// - /// StatementImpl's are noncopyable. -{ -public: - typedef Poco::SharedPtr<StatementImpl> Ptr; - - enum State - { - ST_INITIALIZED, - ST_COMPILED, - ST_BOUND, - ST_PAUSED, - ST_DONE, - ST_RESET - }; - - enum Storage - { - STORAGE_DEQUE_IMPL, - STORAGE_VECTOR_IMPL, - STORAGE_LIST_IMPL, - STORAGE_UNKNOWN_IMPL - }; - - enum BulkType - { - BULK_UNDEFINED, - /// Bulk mode not defined yet. - BULK_BINDING, - /// Binding in bulk mode. - /// If extraction is present in the same statement, - /// it must also be bulk. - BULK_EXTRACTION, - /// Extraction in bulk mode. - /// If binding is present in the same statement, - /// it must also be bulk. - BULK_FORBIDDEN - /// Bulk forbidden. - /// Happens when the statement has already been - /// configured as non-bulk. - }; - - static const std::string DEQUE; - static const std::string VECTOR; - static const std::string LIST; - static const std::string UNKNOWN; - - static const int USE_CURRENT_DATA_SET = -1; - - StatementImpl(SessionImpl& rSession); - /// Creates the StatementImpl. - - virtual ~StatementImpl(); - /// Destroys the StatementImpl. - - template <typename T> - void add(const T& t) - /// Appends SQL statement (fragments). - { - _ostr << t; - } - - void addBind(AbstractBinding::Ptr pBinding); - /// Registers the Binding with the StatementImpl. - - void removeBind(const std::string& name); - /// Unregisters all the bindings having specified name with the StatementImpl. - /// Bindings are released and, if this class was the sole owner, deleted. - - void addExtract(AbstractExtraction::Ptr pExtraction); - /// Registers objects used for extracting data with the StatementImpl. - - void setExtractionLimit(const Limit& extrLimit); - /// Changes the extractionLimit to extrLimit. - /// Per default no limit (EXTRACT_UNLIMITED) is set. - - std::string toString() const; - /// Create a string version of the SQL statement. - - std::size_t execute(const bool& reset = true); - /// Executes a statement. Returns the number of rows - /// extracted for statements returning data or number of rows - /// affected for all other statements (insert, update, delete). - /// If reset is true (default), the underlying bound storage is - /// reset and reused. In case of containers, this means they are - /// cleared and resized to accomodate the number of rows returned by - /// this execution step. When reset is false, data is appended to the - /// bound containers during multiple execute calls. - - void reset(); - /// Resets the statement, so that we can reuse all bindings and re-execute again. - - State getState() const; - /// Returns the state of the Statement. - - void setStorage(Storage storage); - /// Sets the storage type for this statement; - - void setStorage(const std::string& storage); - /// Sets the storage type for this statement; - - Storage getStorage() const; - /// Returns the storage type for this statement. - - std::size_t extractionCount() const; - /// Returns the number of extraction storage buffers associated - /// with the statement. - - std::size_t dataSetCount() const; - /// Returns the number of data sets associated with the statement. - -protected: - virtual std::size_t columnsReturned() const = 0; - /// Returns number of columns returned by query. - - virtual int affectedRowCount() const = 0; - /// Returns the number of affected rows. - /// Used to find out the number of rows affected by insert, delete or update. - /// - /// Some back-ends may return a negative number in certain circumstances (e.g. - /// some ODBC drivers when this function is called after a select statement - /// execution). - - virtual const MetaColumn& metaColumn(std::size_t pos) const = 0; - /// Returns column meta data. - - const MetaColumn& metaColumn(const std::string& name) const; - /// Returns column meta data. - - virtual bool hasNext() = 0; - /// Returns true if a call to next() will return data. - /// - /// Note that the implementation must support - /// several consecutive calls to hasNext without data getting lost, - /// ie. hasNext(); hasNext(); next() must be equal to hasNext(); next(); - - virtual std::size_t next() = 0; - /// Retrieves the next row or set of rows from the resultset and - /// returns the number of rows retreved. - /// - /// Will throw, if the resultset is empty. - /// Expects the statement to be compiled and bound. - - virtual bool canBind() const = 0; - /// Returns true if another bind is possible. - - virtual bool canCompile() const = 0; - /// Returns true if another compile is possible. - - virtual void compileImpl() = 0; - /// Compiles the statement, doesn't bind yet. - - virtual void bindImpl() = 0; - /// Binds parameters. - - virtual AbstractExtraction::ExtractorPtr extractor() = 0; - /// Returns the concrete extractor used by the statement. - - const AbstractExtractionVec& extractions() const; - /// Returns the const reference to extractions vector. - - AbstractExtractionVec& extractions(); - /// Returns the reference to extractions vector. - - void fixupExtraction(); - /// Sets the AbstractExtractor at the extractors. - - Limit::SizeT getExtractionLimit(); - /// Returns the extraction limit value. - - const Limit& extractionLimit() const; - /// Returns the extraction limit. - - std::size_t columnsExtracted(int dataSet = USE_CURRENT_DATA_SET) const; - /// Returns the number of columns that the extractors handle. - - std::size_t rowsExtracted(int dataSet = USE_CURRENT_DATA_SET) const; - /// Returns the number of rows extracted for current data set. - /// Default value (USE_CURRENT_DATA_SET) indicates current data set (if any). - - std::size_t subTotalRowCount(int dataSet = USE_CURRENT_DATA_SET) const; - /// Returns the number of rows extracted so far for the data set. - /// Default value indicates current data set (if any). - - void makeExtractors(std::size_t count); - /// Determines the type of the internal extraction container and - /// calls the extraction creation function (addInternalExtract) - /// with appropriate data type and container type arguments. - /// - /// This function is only called in cases when there is data - /// returned by query, but no data storage supplied by user. - /// - /// The type of the internal container is determined in the - /// following order: - /// 1. If statement has the container type set, the type is used. - /// 2. If statement does not have the container type set, - /// session is queried for container type setting. If the - /// session container type setting is found, it is used. - /// 3. If neither session nor statement have the internal - /// container type set, std::deque is used. - /// - /// Supported internal extraction container types are: - /// - std::deque (default) - /// - std::vector - /// - std::list - - SessionImpl& session(); - /// Rteurns session associated with this statement. - - virtual AbstractBinding::BinderPtr binder() = 0; - /// Returns the concrete binder used by the statement. - - const AbstractBindingVec& bindings() const; - /// Returns the const reference to bindings vector. - - AbstractBindingVec& bindings(); - /// Returns the reference to bindings. - - void fixupBinding(); - /// Sets the AbstractBinder at the bindings. - - void resetBinding(); - /// Resets binding so it can be reused again. - - virtual bool isStoredProcedure() const; - /// Returns true if the statement is stored procedure. - /// Used as a help to determine whether to automatically create the - /// internal extractions when no outside extraction is supplied. - /// The reason for this function is to prevent unnecessary internal - /// extraction creation in cases (behavior exhibited by some ODBC drivers) - /// when there is data available from the stored procedure call - /// statement execution but no external extraction is supplied (as is - /// usually the case when stored procedures are called). In such cases - /// no storage is needed because output parameters serve as storage. - /// At the Data framework level, this function always returns false. - /// When connector-specific behavior is desired, it should be overriden - /// by the statement implementation. - - std::size_t currentDataSet() const; - /// Returns the current data set. - - std::size_t activateNextDataSet(); - /// Returns the next data set index, or throws NoDataException if the last - /// data set was reached. - - std::size_t activatePreviousDataSet(); - /// Returns the previous data set index, or throws NoDataException if the last - /// data set was reached. - - bool hasMoreDataSets() const; - /// Returns true if there are data sets not activated yet. - -private: - void compile(); - /// Compiles the statement. - - void bind(); - /// Binds the statement, if not yet bound. - - std::size_t executeWithLimit(); - /// Executes with an upper limit set. Returns the number of rows - /// extracted for statements returning data or number of rows - /// affected for all other statements (insert, update, delete). - - std::size_t executeWithoutLimit(); - /// Executes without an upper limit set. Returns the number of rows - /// extracted for statements returning data or number of rows - /// affected for all other statements (insert, update, delete). - - void resetExtraction(); - /// Resets extraction so it can be reused again. - - template <class C> - SharedPtr<InternalExtraction<C> > createExtract(const MetaColumn& mc) - { - C* pData = new C; - Column<C>* pCol = new Column<C>(mc, pData); - return new InternalExtraction<C>(*pData, pCol, Poco::UInt32(currentDataSet())); - } - - template <class C> - SharedPtr<InternalBulkExtraction<C> > createBulkExtract(const MetaColumn& mc) - { - C* pData = new C; - Column<C>* pCol = new Column<C>(mc, pData); - return new InternalBulkExtraction<C>(*pData, - pCol, - static_cast<Poco::UInt32>(getExtractionLimit()), - Position(static_cast<Poco::UInt32>(currentDataSet()))); - } - - template <class T> - void addInternalExtract(const MetaColumn& mc) - /// Creates and adds the internal extraction. - /// - /// The decision about internal extraction container is done - /// in a following way: - /// - /// If this statement has _storage member set, that setting - /// overrides the session setting for storage, otherwise the - /// session setting is used. - /// If neither this statement nor the session have the storage - /// type set, std::deque is the default container type used. - { - std::string storage; - - switch (_storage) - { - case STORAGE_DEQUE_IMPL: - storage = DEQUE; break; - case STORAGE_VECTOR_IMPL: - storage = VECTOR; break; - case STORAGE_LIST_IMPL: - storage = LIST; break; - case STORAGE_UNKNOWN_IMPL: - storage = AnyCast<std::string>(session().getProperty("storage")); - break; - } - - if (storage.empty()) storage = DEQUE; - - if (0 == icompare(DEQUE, storage)) - { - if (!isBulkExtraction()) - addExtract(createExtract<std::deque<T> >(mc)); - else - addExtract(createBulkExtract<std::deque<T> >(mc)); - } - else if (0 == icompare(VECTOR, storage)) - { - if (!isBulkExtraction()) - addExtract(createExtract<std::vector<T> >(mc)); - else - addExtract(createBulkExtract<std::vector<T> >(mc)); - } - else if (0 == icompare(LIST, storage)) - { - if (!isBulkExtraction()) - addExtract(createExtract<std::list<T> >(mc)); - else - addExtract(createBulkExtract<std::list<T> >(mc)); - } - } - - bool isNull(std::size_t col, std::size_t row) const; - /// Returns true if the value in [col, row] is null. - - void forbidBulk(); - /// Forbids bulk operations. - - void setBulkBinding(); - /// Sets the bulk binding flag. - - void setBulkExtraction(const Bulk& l); - /// Sets the bulk extraction flag and extraction limit. - - void resetBulk(); - /// Resets the bulk extraction and binding flag. - - bool bulkBindingAllowed() const; - /// Returns true if statement can be set to bind data in bulk. - /// Once bulk binding is set for a statement, it can be - /// neither altered nor mixed with non-bulk mode binding. - - bool bulkExtractionAllowed() const; - /// Returns true if statement can be set to extract data in bulk. - /// Once bulk extraction is set for a statement, it can be - /// neither altered nor mixed with non-bulk mode extraction. - - bool isBulkBinding() const; - /// Returns true if statement is set to bind data in bulk. - - bool isBulkExtraction() const; - /// Returns true if statement is set to extract data in bulk. - - bool isBulkSupported() const; - /// Returns true if connector and session support bulk operation. - - void formatSQL(std::vector<Any>& arguments); - /// Formats the SQL string by filling in placeholders with values from supplied vector. - - void assignSubTotal(bool reset); - - StatementImpl(const StatementImpl& stmt); - StatementImpl& operator = (const StatementImpl& stmt); - - typedef std::vector<std::size_t> CountVec; - - State _state; - Limit _extrLimit; - std::size_t _lowerLimit; - std::vector<int> _columnsExtracted; - SessionImpl& _rSession; - Storage _storage; - std::ostringstream _ostr; - AbstractBindingVec _bindings; - AbstractExtractionVecVec _extractors; - std::size_t _curDataSet; - BulkType _bulkBinding; - BulkType _bulkExtraction; - CountVec _subTotalRowCount; - - friend class Statement; -}; - - -// -// inlines -// - - -inline void StatementImpl::addBind(AbstractBinding::Ptr pBinding) -{ - poco_check_ptr (pBinding); - _bindings.push_back(pBinding); -} - - -inline std::string StatementImpl::toString() const -{ - return _ostr.str(); -} - - -inline const AbstractBindingVec& StatementImpl::bindings() const -{ - return _bindings; -} - - -inline AbstractBindingVec& StatementImpl::bindings() -{ - return _bindings; -} - - -inline const AbstractExtractionVec& StatementImpl::extractions() const -{ - poco_assert (_curDataSet < _extractors.size()); - return _extractors[_curDataSet]; -} - - -inline AbstractExtractionVec& StatementImpl::extractions() -{ - poco_assert (_curDataSet < _extractors.size()); - return _extractors[_curDataSet]; -} - - -inline StatementImpl::State StatementImpl::getState() const -{ - return _state; -} - - -inline SessionImpl& StatementImpl::session() -{ - return _rSession; -} - - -inline void StatementImpl::setStorage(Storage storage) -{ - _storage = storage; -} - - -inline StatementImpl::Storage StatementImpl::getStorage() const -{ - return _storage; -} - - -inline std::size_t StatementImpl::extractionCount() const -{ - return static_cast<std::size_t>(extractions().size()); -} - - -inline std::size_t StatementImpl::dataSetCount() const -{ - return static_cast<std::size_t>(_extractors.size()); -} - - -inline bool StatementImpl::isStoredProcedure() const -{ - return false; -} - - -inline bool StatementImpl::isNull(std::size_t col, std::size_t row) const -{ - try - { - return extractions().at(col)->isNull(row); - } - catch (std::out_of_range& ex) - { - throw RangeException(ex.what()); - } -} - - -inline std::size_t StatementImpl::currentDataSet() const -{ - return _curDataSet; -} - - -inline Limit::SizeT StatementImpl::getExtractionLimit() -{ - return _extrLimit.value(); -} - - -inline const Limit& StatementImpl::extractionLimit() const -{ - return _extrLimit; -} - - -inline void StatementImpl::forbidBulk() -{ - _bulkBinding = BULK_FORBIDDEN; - _bulkExtraction = BULK_FORBIDDEN; -} - - -inline void StatementImpl::setBulkBinding() -{ - _bulkBinding = BULK_BINDING; -} - - -inline bool StatementImpl::bulkBindingAllowed() const -{ - return BULK_UNDEFINED == _bulkBinding || - BULK_BINDING == _bulkBinding; -} - - -inline bool StatementImpl::bulkExtractionAllowed() const -{ - return BULK_UNDEFINED == _bulkExtraction || - BULK_EXTRACTION == _bulkExtraction; -} - - -inline bool StatementImpl::isBulkBinding() const -{ - return BULK_BINDING == _bulkBinding; -} - - -inline bool StatementImpl::isBulkExtraction() const -{ - return BULK_EXTRACTION == _bulkExtraction; -} - - -inline void StatementImpl::resetBulk() -{ - _bulkExtraction = BULK_UNDEFINED; - _bulkBinding = BULK_UNDEFINED;\ - setExtractionLimit(Limit(Limit::LIMIT_UNLIMITED, false, false)); -} - - -inline bool StatementImpl::isBulkSupported() const -{ - return _rSession.getFeature("bulk"); -} - - -inline bool StatementImpl::hasMoreDataSets() const -{ - return currentDataSet() + 1 < dataSetCount(); -} - - -} } // namespace Poco::Data - - -#endif // Data_StatementImpl_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Time.h b/contrib/libs/poco/Data/include/Poco/Data/Time.h deleted file mode 100644 index 07116906b0..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Time.h +++ /dev/null @@ -1,229 +0,0 @@ -// -// Time.h -// -// Library: Data -// Package: DataCore -// Module: Time -// -// Definition of the Time class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_Time_INCLUDED -#define Data_Time_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Dynamic/VarHolder.h" -#include "Poco/Exception.h" - - -namespace Poco { - -namespace Dynamic { - -class Var; - -} - -class DateTime; - -namespace Data { - - -class Date; - - -class Data_API Time - /// Time class wraps a DateTime and exposes time related interface. - /// The purpose of this class is binding/extraction support for time fields. -{ -public: - Time(); - /// Creates the Time - - Time(int hour, int minute, int second); - /// Creates the Time - - Time(const DateTime& dt); - /// Creates the Time from DateTime - - ~Time(); - /// Destroys the Time. - - int hour() const; - /// Returns the hour. - - int minute() const; - /// Returns the minute. - - int second() const; - /// Returns the second. - - void assign(int hour, int minute, int second); - /// Assigns time. - - Time& operator = (const Time& t); - /// Assignment operator for Time. - - Time& operator = (const DateTime& dt); - /// Assignment operator for DateTime. - - Time& operator = (const Poco::Dynamic::Var& var); - /// Assignment operator for Var. - - bool operator == (const Time& time) const; - /// Equality operator. - - bool operator != (const Time& time) const; - /// Inequality operator. - - bool operator < (const Time& time) const; - /// Less then operator. - - bool operator > (const Time& time) const; - /// Greater then operator. - -private: - int _hour; - int _minute; - int _second; -}; - - -// -// inlines -// -inline int Time::hour() const -{ - return _hour; -} - - -inline int Time::minute() const -{ - return _minute; -} - - -inline int Time::second() const -{ - return _second; -} - - -inline Time& Time::operator = (const Time& t) -{ - assign(t.hour(), t.minute(), t.second()); - return *this; -} - - -inline Time& Time::operator = (const DateTime& dt) -{ - assign(dt.hour(), dt.minute(), dt.second()); - return *this; -} - - -inline bool Time::operator == (const Time& time) const -{ - return _hour == time.hour() && - _minute == time.minute() && - _second == time.second(); -} - - -inline bool Time::operator != (const Time& time) const -{ - return !(*this == time); -} - - -inline bool Time::operator > (const Time& time) const -{ - return !(*this == time) && !(*this < time); -} - - -} } // namespace Poco::Data - - -// -// VarHolderImpl<Time> -// - - -namespace Poco { -namespace Dynamic { - - -template <> -class VarHolderImpl<Poco::Data::Time>: public VarHolder -{ -public: - VarHolderImpl(const Poco::Data::Time& val): _val(val) - { - } - - ~VarHolderImpl() - { - } - - const std::type_info& type() const - { - return typeid(Poco::Data::Time); - } - - void convert(Poco::Timestamp& val) const - { - Poco::DateTime dt; - dt.assign(dt.year(), dt.month(), dt.day(), _val.hour(), _val.minute(), _val.second()); - val = dt.timestamp(); - } - - void convert(Poco::DateTime& val) const - { - Poco::DateTime dt; - dt.assign(dt.year(), dt.month(), dt.day(), _val.hour(), _val.minute(), _val.second()); - val = dt; - } - - void convert(Poco::LocalDateTime& val) const - { - Poco::LocalDateTime ldt; - ldt.assign(ldt.year(), ldt.month(), ldt.day(), _val.hour(), _val.minute(), _val.second()); - val = ldt; - } - - void convert(std::string& val) const - { - DateTime dt(0, 1, 1, _val.hour(), _val.minute(), _val.second()); - val = DateTimeFormatter::format(dt, "%H:%M:%S"); - } - - VarHolder* clone(Placeholder<VarHolder>* pVarHolder = 0) const - { - return cloneHolder(pVarHolder, _val); - } - - const Poco::Data::Time& value() const - { - return _val; - } - -private: - VarHolderImpl(); - Poco::Data::Time _val; -}; - - -} } // namespace Poco::Dynamic - - -#endif // Data_Time_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/Transaction.h b/contrib/libs/poco/Data/include/Poco/Data/Transaction.h deleted file mode 100644 index a8fdc4699b..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/Transaction.h +++ /dev/null @@ -1,194 +0,0 @@ -// -// Transaction.h -// -// Library: Data -// Package: DataCore -// Module: Transaction -// -// Definition of the Transaction class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - - -#ifndef Data_Transaction_INCLUDED -#define Data_Transaction_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/Session.h" -#include "Poco/Logger.h" - - -namespace Poco { -namespace Data { - - -class Data_API Transaction - /// Transaction helps with transactions in domain logic. - /// When an Transaction object is created, it first checks whether a - /// transaction is in progress. If not, a new transaction is created. - /// When the Transaction is destroyed, and commit() has been called, - /// nothing is done. Otherwise, the current transaction is rolled back. - /// See Transaction for more details and purpose of this template. -{ -public: - Transaction(Poco::Data::Session& session, Poco::Logger* pLogger = 0); - /// Creates the Transaction and starts it, using the given database session and logger. - - Transaction(Poco::Data::Session& session, bool start); - /// Creates the Transaction, using the given database session. - /// If start is true, transaction is started, otherwise begin() must be called - /// to start the transaction. - - template <typename T> - Transaction(Poco::Data::Session& rSession, T& t, Poco::Logger* pLogger = 0): - _rSession(rSession), - _pLogger(pLogger) - /// Creates the Transaction, using the given database session, transactor and logger. - /// The transactor type must provide operator () overload taking non-const Session - /// reference as an argument. - /// - /// When transaction is created using this constructor, it is executed and - /// commited automatically. If no error occurs, rollback is disabled and does - /// not occur at destruction time. If an error occurs resulting in exception being - /// thrown, the transaction is rolled back and exception propagated to calling code. - /// - /// Example usage: - /// - /// struct Transactor - /// { - /// void operator () (Session& session) const - /// { - /// // do something ... - /// } - /// }; - /// - /// Transactor tr; - /// Transaction tn(session, tr); - { - try { transact(t); } - catch (...) - { - if (_pLogger) _pLogger->error("Error executing transaction."); - rollback(); - throw; - } - } - - ~Transaction(); - /// Destroys the Transaction. - /// Rolls back the current database transaction if it has not been commited - /// (by calling commit()), or rolled back (by calling rollback()). - /// - /// If an exception is thrown during rollback, the exception is logged - /// and no further action is taken. - - void setIsolation(Poco::UInt32 ti); - /// Sets the transaction isolation level. - - Poco::UInt32 getIsolation(); - /// Returns the transaction isolation level. - - bool hasIsolation(Poco::UInt32 ti); - /// Returns true iff the transaction isolation level corresponding - /// to the supplied bitmask is supported. - - bool isIsolation(Poco::UInt32 ti); - /// Returns true iff the transaction isolation level corresponds - /// to the supplied bitmask. - - void execute(const std::string& sql, bool doCommit = true); - /// Executes and, if doCommit is true, commits the transaction. - /// Passing true value for commit disables rollback during destruction - /// of this Transaction object. - - void execute(const std::vector<std::string>& sql); - /// Executes all the SQL statements supplied in the vector and, after the last - /// one is sucesfully executed, commits the transaction. - /// If an error occurs during execution, transaction is rolled back. - /// Passing true value for commit disables rollback during destruction - /// of this Transaction object. - - template <typename T> - void transact(T& t) - /// Executes the transactor and, unless transactor throws an exception, - /// commits the transaction. - { - if (!isActive()) begin(); - t(_rSession); - commit(); - } - - void commit(); - /// Commits the current transaction. - - void rollback(); - /// Rolls back the current transaction. - - bool isActive(); - /// Returns false after the transaction has been committed or rolled back, - /// true if the transaction is ongoing. - - void setLogger(Poco::Logger* pLogger); - /// Sets the logger for this transaction. - /// Transaction does not take the ownership of the pointer. - -private: - Transaction(); - Transaction(const Transaction&); - Transaction& operator = (const Transaction&); - - void begin(); - /// Begins the transaction if the session is already not in transaction. - /// Otherwise does nothing. - - Session _rSession; - Logger* _pLogger; -}; - - -inline bool Transaction::isActive() -{ - return _rSession.isTransaction(); -} - - -inline void Transaction::setIsolation(Poco::UInt32 ti) -{ - _rSession.setTransactionIsolation(ti); -} - - -inline Poco::UInt32 Transaction::getIsolation() -{ - return _rSession.getTransactionIsolation(); -} - - -inline bool Transaction::hasIsolation(Poco::UInt32 ti) -{ - return _rSession.isTransactionIsolation(ti); -} - - -inline bool Transaction::isIsolation(Poco::UInt32 ti) -{ - return _rSession.isTransactionIsolation(ti); -} - - -inline void Transaction::setLogger(Poco::Logger* pLogger) -{ - _pLogger = pLogger; -} - - -} } // namespace Poco::Data - - -#endif // Data_Transaction_INCLUDED diff --git a/contrib/libs/poco/Data/include/Poco/Data/TypeHandler.h b/contrib/libs/poco/Data/include/Poco/Data/TypeHandler.h deleted file mode 100644 index 4a2424cd1e..0000000000 --- a/contrib/libs/poco/Data/include/Poco/Data/TypeHandler.h +++ /dev/null @@ -1,2090 +0,0 @@ -// -// TypeHandler.h -// -// Library: Data -// Package: DataCore -// Module: TypeHandler -// -// Definition of the TypeHandler class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Data_TypeHandler_INCLUDED -#define Data_TypeHandler_INCLUDED - - -#include "Poco/Data/Data.h" -#include "Poco/Data/AbstractBinder.h" -#include "Poco/Data/AbstractExtractor.h" -#include "Poco/Data/AbstractPreparator.h" -#include "Poco/Nullable.h" -#include "Poco/Tuple.h" -#include "Poco/AutoPtr.h" -#include "Poco/SharedPtr.h" -#include <cstddef> - - -namespace Poco { -namespace Data { - - -class AbstractTypeHandler - /// Parent class for type handlers. - /// The reason for this class is to prevent instantiations of type handlers. - /// For documentation on type handlers, see TypeHandler class. -{ -protected: - AbstractTypeHandler(); - ~AbstractTypeHandler(); - AbstractTypeHandler(const AbstractTypeHandler&); - AbstractTypeHandler& operator = (const AbstractTypeHandler&); -}; - - -template <class T> -class TypeHandler: public AbstractTypeHandler - /// Converts Rows to a Type and the other way around. Provide template specializations to support your own complex types. - /// - /// Take as example the following (simplified) class: - /// class Person - /// { - /// private: - /// std::string _lastName; - /// std::string _firstName; - /// int _age; - /// public: - /// const std::string& getLastName(); - /// [...] // other set/get methods (returning const reference), a default constructor, - /// [...] // optional < operator (for set, multiset) or function operator (for map, multimap) - /// }; - /// - /// The TypeHandler must provide a custom bind, size, prepare and extract method: - /// - /// template <> - /// class TypeHandler<struct Person> - /// { - /// public: - /// static std::size_t size() - /// { - /// return 3; // lastName + firstname + age occupy three columns - /// } - /// - /// static void bind(std::size_t pos, const Person& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - /// { - /// // the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3)) - /// // Note that we advance pos by the number of columns the datatype uses! For string/int this is one. - /// poco_assert_dbg (!pBinder.isNull()); - /// TypeHandler<std::string>::bind(pos++, obj.getLastName(), pBinder, dir); - /// TypeHandler<std::string>::bind(pos++, obj.getFirstName(), pBinder, dir); - /// TypeHandler<int>::bind(pos++, obj.getAge(), pBinder, dir); - /// } - /// - /// static void prepare(std::size_t pos, const Person& obj, AbstractPreparator::Ptr pPreparator) - /// { - /// // the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3)) - /// poco_assert_dbg (!pPreparator.isNull()); - /// TypeHandler<std::string>::prepare(pos++, obj.getLastName(), pPreparator); - /// TypeHandler<std::string>::prepare(pos++, obj.getFirstName(), pPreparator); - /// TypeHandler<int>::prepare(pos++, obj.getAge(), pPreparator); - /// } - /// - /// static void extract(std::size_t pos, Person& obj, const Person& defVal, AbstractExtractor::Ptr pExt) - /// { - /// // defVal is the default person we should use if we encunter NULL entries, so we take the individual fields - /// // as defaults. You can do more complex checking, ie return defVal if only one single entry of the fields is null etc... - /// poco_assert_dbg (!pExt.isNull()); - /// std::string lastName; - /// std::string firstName; - /// int age = 0; - /// // the table is defined as Person (LastName VARCHAR(30), FirstName VARCHAR, Age INTEGER(3)) - /// TypeHandler<std::string>::extract(pos++, lastName, defVal.getLastName(), pExt); - /// TypeHandler<std::string>::extract(pos++, firstName, defVal.getFirstName(), pExt); - /// TypeHandler<int>::extract(pos++, age, defVal.getAge(), pExt); - /// obj.setLastName(lastName); - /// obj.setFirstName(firstName); - /// obj.setAge(age); - /// } - /// }; - /// - /// Note that the TypeHandler template specialization must always be declared in the namespace Poco::Data. - /// Apart from that no further work is needed. One can now use Person with into and use clauses. -{ -public: - static void bind(std::size_t pos, const T& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - pBinder->bind(pos, obj, dir); - } - - static std::size_t size() - { - return 1u; - } - - static void extract(std::size_t pos, T& obj, const T& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - if (!pExt->extract(pos, obj)) obj = defVal; - } - - static void prepare(std::size_t pos, const T& obj, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - pPreparator->prepare(pos, obj); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - -template <class T> -class TypeHandler<std::deque<T> >: public AbstractTypeHandler - /// Specialization of type handler for std::deque. -{ -public: - static void bind(std::size_t pos, const std::deque<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - pBinder->bind(pos, obj, dir); - } - - static std::size_t size() - { - return 1u; - } - - static void extract(std::size_t pos, std::deque<T>& obj, const T& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - if (!pExt->extract(pos, obj)) - obj.assign(obj.size(), defVal); - } - - static void prepare(std::size_t pos, const std::deque<T>& obj, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - pPreparator->prepare(pos, obj); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - -template <class T> -class TypeHandler<std::vector<T> >: public AbstractTypeHandler - /// Specialization of type handler for std::vector. -{ -public: - static void bind(std::size_t pos, const std::vector<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - pBinder->bind(pos, obj, dir); - } - - static std::size_t size() - { - return 1u; - } - - static void extract(std::size_t pos, std::vector<T>& obj, const T& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - if (!pExt->extract(pos, obj)) - obj.assign(obj.size(), defVal); - } - - static void prepare(std::size_t pos, const std::vector<T>& obj, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - pPreparator->prepare(pos, obj); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - -template <class T> -class TypeHandler<std::list<T> >: public AbstractTypeHandler - /// Specialization of type handler for std::list. -{ -public: - static void bind(std::size_t pos, const std::list<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - pBinder->bind(pos, obj, dir); - } - - static std::size_t size() - { - return 1u; - } - - static void extract(std::size_t pos, std::list<T>& obj, const T& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - if (!pExt->extract(pos, obj)) - obj.assign(obj.size(), defVal); - } - - static void prepare(std::size_t pos, const std::list<T>& obj, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - pPreparator->prepare(pos, obj); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - -template <typename T> -class TypeHandler<Nullable<T> > - /// Specialization of type handler for Nullable. -{ -public: - - static void bind(std::size_t pos, const Nullable<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - if (obj.isNull()) - { - pBinder->bind(pos++, Poco::Data::Keywords::null, dir); - } - else - { - pBinder->bind(pos++, obj.value(), dir); - } - } - - static void prepare(std::size_t pos, const Nullable<T>& obj, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - if (obj.isNull()) - { - pPreparator->prepare(pos++, Poco::Data::Keywords::null); - } - else - { - pPreparator->prepare(pos++, obj.value()); - } - } - - static std::size_t size() - { - return 1u; - } - - static void extract(std::size_t pos, Nullable<T>& obj, const Nullable<T>& , AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - T val; - - if (pExt->extract(pos++, val)) - { - obj = val; - } - else - { - obj.clear(); - } - } - -private: - - TypeHandler(); - ~TypeHandler(); - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -/// Poco::Tuple TypeHandler specializations - -// define this macro to nothing for smaller code size -#define POCO_TUPLE_TYPE_HANDLER_INLINE inline - - -template <typename TupleType, typename Type, int N> -POCO_TUPLE_TYPE_HANDLER_INLINE -void tupleBind(std::size_t& pos, TupleType tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) -{ - TypeHandler<Type>::bind(pos, tuple.template get<N>(), pBinder, dir); - pos += TypeHandler<Type>::size(); -} - - -template <typename TupleType, typename Type, int N> -POCO_TUPLE_TYPE_HANDLER_INLINE -void tuplePrepare(std::size_t& pos, TupleType tuple, AbstractPreparator::Ptr pPreparator) -{ - TypeHandler<Type>::prepare(pos, tuple.template get<N>(), pPreparator); - pos += TypeHandler<Type>::size(); -} - - -template <typename TupleType, typename DefValType, typename Type, int N> -POCO_TUPLE_TYPE_HANDLER_INLINE -void tupleExtract(std::size_t& pos, TupleType tuple, DefValType defVal, AbstractExtractor::Ptr pExt) -{ - Poco::Data::TypeHandler<Type>::extract(pos, tuple.template get<N>(), - defVal.template get<N>(), pExt); - pos += TypeHandler<Type>::size(); -} - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14, - class T15, - class T16, - class T17, - class T18, - class T19> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T15, 15>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T16, 16>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T17, 17>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T18, 18>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T19, 19>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T15, 15>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T16, 16>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T17, 17>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T18, 18>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T19, 19>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size() + - TypeHandler<T15>::size() + - TypeHandler<T16>::size() + - TypeHandler<T17>::size() + - TypeHandler<T18>::size() + - TypeHandler<T19>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T15, 15>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T16, 16>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T17, 17>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T18, 18>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T19, 19>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14, - class T15, - class T16, - class T17, - class T18> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T15, 15>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T16, 16>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T17, 17>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T18, 18>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T15, 15>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T16, 16>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T17, 17>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T18, 18>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size() + - TypeHandler<T15>::size() + - TypeHandler<T16>::size() + - TypeHandler<T17>::size() + - TypeHandler<T18>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T15, 15>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T16, 16>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T17, 17>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T18, 18>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14, - class T15, - class T16, - class T17> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T15, 15>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T16, 16>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T17, 17>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T15, 15>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T16, 16>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T17, 17>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size() + - TypeHandler<T15>::size() + - TypeHandler<T16>::size() + - TypeHandler<T17>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T15, 15>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T16, 16>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T17, 17>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14, - class T15, - class T16> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T15, 15>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T16, 16>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T15, 15>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T16, 16>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size() + - TypeHandler<T15>::size() + - TypeHandler<T16>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T15, 15>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T16, 16>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14, - class T15> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T15, 15>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T15, 15>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size() + - TypeHandler<T15>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T15, 15>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13, - class T14> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T14, 14>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T14, 14>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size() + - TypeHandler<T14>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T14, 14>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12, - class T13> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T13, 13>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T13, 13>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size() + - TypeHandler<T13>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T13, 13>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11, - class T12> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T12, 12>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T12, 12>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size() + - TypeHandler<T12>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T12, 12>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10, - class T11> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T11, 11>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T11, 11>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size() + - TypeHandler<T11>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T11, 11>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, - class T1, - class T2, - class T3, - class T4, - class T5, - class T6, - class T7, - class T8, - class T9, - class T10> -class TypeHandler<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T10, 10>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T10, 10>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size() + - TypeHandler<T10>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T10, 10>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8, class T9> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T9, 9>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T9, 9>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size() + - TypeHandler<T9>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T9, 9>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7, class T8> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, T8, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T8, 8>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T8, 8>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size() + - TypeHandler<T8>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T8, 8>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4, class T5, class T6, class T7> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, T7, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T7, 7>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T7, 7>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size() + - TypeHandler<T7>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T7, 7>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4, class T5, class T6> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, T6, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T6, 6>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T6, 6>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size() + - TypeHandler<T6>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T6, 6>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4, class T5> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, T5, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T5, 5>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T5, 5>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size() + - TypeHandler<T5>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T5, 5>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3, class T4> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, T4, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T4, 4>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T4, 4>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size() + - TypeHandler<T4>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T4, 4>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2, class T3> -class TypeHandler<Poco::Tuple<T0, T1, T2, T3, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, T3, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T3, 3>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T3, 3>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size() + - TypeHandler<T3>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T3, 3>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1, class T2> - class TypeHandler<Poco::Tuple<T0, T1, T2, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, T2, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T2, 2>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T2, 2>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size() + - TypeHandler<T2>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T2, 2>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0, class T1> -class TypeHandler<Poco::Tuple<T0, T1, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, T1, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - tupleBind<TupleConstRef, T1, 1>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - tuplePrepare<TupleConstRef, T1, 1>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size() + - TypeHandler<T1>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - tupleExtract<TupleRef, TupleConstRef, T1, 1>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class T0> -class TypeHandler<Poco::Tuple<T0, NullTypeList> > -{ -public: - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList> >::CONSTREFTYPE TupleConstRef; - typedef typename Poco::TypeWrapper<Poco::Tuple<T0, NullTypeList> >::REFTYPE TupleRef; - - static void bind(std::size_t pos, TupleConstRef tuple, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - poco_assert_dbg (!pBinder.isNull()); - tupleBind<TupleConstRef, T0, 0>(pos, tuple, pBinder, dir); - } - - static void prepare(std::size_t pos, TupleConstRef tuple, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - tuplePrepare<TupleConstRef, T0, 0>(pos, tuple, pPreparator); - } - - static std::size_t size() - { - return TypeHandler<T0>::size(); - } - - static void extract(std::size_t pos, TupleRef tuple, TupleConstRef defVal, - AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - tupleExtract<TupleRef, TupleConstRef, T0, 0>(pos, tuple, defVal, pExt); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator=(const TypeHandler&); -}; - - -template <class K, class V> -class TypeHandler<std::pair<K, V> >: public AbstractTypeHandler -{ -public: - static void bind(std::size_t pos, const std::pair<K, V>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - TypeHandler<K>::bind(pos, obj.first, pBinder, dir); - pos += TypeHandler<K>::size(); - TypeHandler<V>::bind(pos, obj.second, pBinder, dir); - } - - static std::size_t size() - { - return static_cast<std::size_t>(TypeHandler<K>::size() + TypeHandler<V>::size()); - } - - static void extract(std::size_t pos, std::pair<K, V>& obj, const std::pair<K, V>& defVal, AbstractExtractor::Ptr pExt) - { - TypeHandler<K>::extract(pos, obj.first, defVal.first, pExt); - pos += TypeHandler<K>::size(); - TypeHandler<V>::extract(pos, obj.second, defVal.second, pExt); - } - - static void prepare(std::size_t pos, const std::pair<K, V>& obj, AbstractPreparator::Ptr pPreparator) - { - TypeHandler<K>::prepare(pos, obj.first, pPreparator); - pos += TypeHandler<K>::size(); - TypeHandler<V>::prepare(pos, obj.second, pPreparator); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - -template <class T> -class TypeHandler<Poco::AutoPtr<T> >: public AbstractTypeHandler - /// Specialization of type handler for Poco::AutoPtr -{ -public: - static void bind(std::size_t pos, const Poco::AutoPtr<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - // *obj will trigger a nullpointer exception if empty: this is on purpose - TypeHandler<T>::bind(pos, *obj, pBinder, dir); - } - - static std::size_t size() - { - return static_cast<std::size_t>(TypeHandler<T>::size()); - } - - static void extract(std::size_t pos, Poco::AutoPtr<T>& obj, const Poco::AutoPtr<T>& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - - obj = Poco::AutoPtr<T>(new T()); - if (defVal) - TypeHandler<T>::extract(pos, *obj, *defVal, pExt); - else - TypeHandler<T>::extract(pos, *obj, *obj, pExt); - } - - static void prepare(std::size_t pos, const Poco::AutoPtr<T>&, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - TypeHandler<T>::prepare(pos, T(), pPreparator); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - - -template <class T> -class TypeHandler<Poco::SharedPtr<T> >: public AbstractTypeHandler - /// Specialization of type handler for Poco::SharedPtr -{ -public: - static void bind(std::size_t pos, const Poco::SharedPtr<T>& obj, AbstractBinder::Ptr pBinder, AbstractBinder::Direction dir) - { - // *obj will trigger a nullpointer exception if empty - TypeHandler<T>::bind(pos, *obj, pBinder, dir); - } - - static std::size_t size() - { - return static_cast<std::size_t>(TypeHandler<T>::size()); - } - - static void extract(std::size_t pos, Poco::SharedPtr<T>& obj, const Poco::SharedPtr<T>& defVal, AbstractExtractor::Ptr pExt) - { - poco_assert_dbg (!pExt.isNull()); - - obj = Poco::SharedPtr<T>(new T()); - if (defVal) - TypeHandler<T>::extract(pos, *obj, *defVal, pExt); - else - TypeHandler<T>::extract(pos, *obj, *obj, pExt); - } - - static void prepare(std::size_t pos, const Poco::SharedPtr<T>&, AbstractPreparator::Ptr pPreparator) - { - poco_assert_dbg (!pPreparator.isNull()); - TypeHandler<T>::prepare(pos, T(), pPreparator); - } - -private: - TypeHandler(const TypeHandler&); - TypeHandler& operator = (const TypeHandler&); -}; - - -} } // namespace Poco::Data - - -#endif // Data_TypeHandler_INCLUDED diff --git a/contrib/libs/poco/Data/src/AbstractBinder.cpp b/contrib/libs/poco/Data/src/AbstractBinder.cpp deleted file mode 100644 index 0455a31060..0000000000 --- a/contrib/libs/poco/Data/src/AbstractBinder.cpp +++ /dev/null @@ -1,527 +0,0 @@ -// -// AbstractBinder.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractBinder -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractBinder.h" -#include "Poco/Data/Date.h" -#include "Poco/Data/Time.h" -#include "Poco/Data/LOB.h" -#include "Poco/Data/DataException.h" -#include "Poco/DateTime.h" -#include "Poco/Any.h" -#include "Poco/Dynamic/Var.h" - - -namespace Poco { -namespace Data { - - -AbstractBinder::AbstractBinder() -{ -} - - -AbstractBinder::~AbstractBinder() -{ -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::Int8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::Int8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::Int8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::UInt8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::UInt8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::UInt8>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::Int16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::Int16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::Int16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::UInt16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::UInt16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::UInt16>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::Int32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::Int32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::Int32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::UInt32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::UInt32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::UInt32>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::Int64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::Int64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::Int64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Poco::UInt64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Poco::UInt64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Poco::UInt64>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -#ifndef POCO_LONG_IS_64_BIT -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<long>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<long>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<long>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} -#endif - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<bool>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<bool>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<bool>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<float>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<float>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<float>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<double>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<double>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<double>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<char>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<char>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<char>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<std::string>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<std::string>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<std::string>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const UTF16String& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("UTF16String binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<UTF16String>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<UTF16String>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<UTF16String>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<BLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<BLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<BLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<CLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<CLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<CLOB>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<DateTime>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<DateTime>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<DateTime>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Date>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Date>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Date>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<Time>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<Time>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<Time>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::vector<NullData>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::vector binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::deque<NullData>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::deque binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t /*pos*/, const std::list<NullData>& /*val*/, Direction /*dir*/) -{ - throw NotImplementedException("std::list binder must be implemented."); -} - - -void AbstractBinder::bind(std::size_t pos, const Any& val, Direction dir) -{ - const std::type_info& type = val.type(); - - if(type == typeid(Int32)) - bind(pos, RefAnyCast<Int32>(val), dir); - else if(type == typeid(std::string)) - bind(pos, RefAnyCast<std::string>(val), dir); - else if (type == typeid(Poco::UTF16String)) - bind(pos, RefAnyCast<Poco::UTF16String>(val), dir); - else if (type == typeid(bool)) - bind(pos, RefAnyCast<bool>(val), dir); - else if(type == typeid(char)) - bind(pos, RefAnyCast<char>(val), dir); - else if(type == typeid(Int8)) - bind(pos, RefAnyCast<Int8>(val), dir); - else if(type == typeid(UInt8)) - bind(pos, RefAnyCast<UInt8>(val), dir); - else if(type == typeid(Int16)) - bind(pos, RefAnyCast<Int16>(val), dir); - else if(type == typeid(UInt16)) - bind(pos, RefAnyCast<UInt16>(val), dir); - else if(type == typeid(UInt32)) - bind(pos, RefAnyCast<UInt32>(val), dir); - else if(type == typeid(Int64)) - bind(pos, RefAnyCast<Int64>(val), dir); - else if(type == typeid(UInt64)) - bind(pos, RefAnyCast<UInt64>(val), dir); - else if(type == typeid(float)) - bind(pos, RefAnyCast<float>(val), dir); - else if(type == typeid(double)) - bind(pos, RefAnyCast<double>(val), dir); - else if(type == typeid(DateTime)) - bind(pos, RefAnyCast<DateTime>(val), dir); - else if(type == typeid(Date)) - bind(pos, RefAnyCast<Date>(val), dir); - else if(type == typeid(Time)) - bind(pos, RefAnyCast<Time>(val), dir); - else if(type == typeid(BLOB)) - bind(pos, RefAnyCast<BLOB>(val), dir); - else if(type == typeid(void)) - bind(pos, Keywords::null, dir); -#ifndef POCO_LONG_IS_64_BIT - else if(type == typeid(long)) - bind(pos, RefAnyCast<long>(val), dir); -#endif - else - throw UnknownTypeException(std::string(val.type().name())); -} - - -void AbstractBinder::bind(std::size_t pos, const Poco::Dynamic::Var& val, Direction dir) -{ - const std::type_info& type = val.type(); - - if(type == typeid(Int32)) - bind(pos, val.extract<Int32>(), dir); - else if(type == typeid(std::string)) - bind(pos, val.extract<std::string>(), dir); - else if (type == typeid(Poco::UTF16String)) - bind(pos, val.extract<Poco::UTF16String>(), dir); - else if (type == typeid(bool)) - bind(pos, val.extract<bool>(), dir); - else if(type == typeid(char)) - bind(pos, val.extract<char>(), dir); - else if(type == typeid(Int8)) - bind(pos, val.extract<Int8>(), dir); - else if(type == typeid(UInt8)) - bind(pos, val.extract<UInt8>(), dir); - else if(type == typeid(Int16)) - bind(pos, val.extract<Int16>(), dir); - else if(type == typeid(UInt16)) - bind(pos, val.extract<UInt16>(), dir); - else if(type == typeid(UInt32)) - bind(pos, val.extract<UInt32>(), dir); - else if(type == typeid(Int64)) - bind(pos, val.extract<Int64>(), dir); - else if(type == typeid(UInt64)) - bind(pos, val.extract<UInt64>(), dir); - else if(type == typeid(float)) - bind(pos, val.extract<float>(), dir); - else if(type == typeid(double)) - bind(pos, val.extract<double>(), dir); - else if(type == typeid(DateTime)) - bind(pos, val.extract<DateTime>(), dir); - else if(type == typeid(Date)) - bind(pos, val.extract<Date>(), dir); - else if(type == typeid(Time)) - bind(pos, val.extract<Time>(), dir); - else if(type == typeid(BLOB)) - bind(pos, val.extract<BLOB>(), dir); - else if(type == typeid(void)) - bind(pos, Keywords::null, dir); -#ifndef POCO_LONG_IS_64_BIT - else if(type == typeid(long)) - bind(pos, val.extract<long>(), dir); -#endif - else - throw UnknownTypeException(std::string(val.type().name())); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/AbstractBinding.cpp b/contrib/libs/poco/Data/src/AbstractBinding.cpp deleted file mode 100644 index d30ccd1d8b..0000000000 --- a/contrib/libs/poco/Data/src/AbstractBinding.cpp +++ /dev/null @@ -1,45 +0,0 @@ -// -// AbstractBinding.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractBinding -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractBinding.h" - - -namespace Poco { -namespace Data { - - -AbstractBinding::AbstractBinding(const std::string& name, - Direction direction, - Poco::UInt32 bulkSize): - _pBinder(0), - _name(name), - _direction(direction), - _bulkSize(bulkSize) -{ -} - - -AbstractBinding::~AbstractBinding() -{ -} - - -void AbstractBinding::setBinder(BinderPtr pBinder) -{ - poco_check_ptr (pBinder); - _pBinder = pBinder; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/AbstractExtraction.cpp b/contrib/libs/poco/Data/src/AbstractExtraction.cpp deleted file mode 100644 index ac3f83927e..0000000000 --- a/contrib/libs/poco/Data/src/AbstractExtraction.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// AbstractExtraction.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractExtraction -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractExtraction.h" - - -namespace Poco { -namespace Data { - - -AbstractExtraction::AbstractExtraction(Poco::UInt32 limit, - Poco::UInt32 position, - bool bulk): - _pExtractor(0), - _limit(limit), - _position(position), - _bulk(bulk), - _emptyStringIsNull(false), - _forceEmptyString(false) -{ -} - - -AbstractExtraction::~AbstractExtraction() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/AbstractExtractor.cpp b/contrib/libs/poco/Data/src/AbstractExtractor.cpp deleted file mode 100644 index 9c17301040..0000000000 --- a/contrib/libs/poco/Data/src/AbstractExtractor.cpp +++ /dev/null @@ -1,437 +0,0 @@ -// -// AbstractExtractor.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractExtractor -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractExtractor.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace Data { - - -AbstractExtractor::AbstractExtractor() -{ -} - - -AbstractExtractor::~AbstractExtractor() -{ -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -#ifndef POCO_LONG_IS_64_BIT -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<long>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<long>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<long>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} -#endif - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<bool>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<bool>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<bool>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<float>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<float>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<float>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<double>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<double>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<double>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<char>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<char>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<char>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<std::string>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<std::string>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<std::string>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, UTF16String& /*val*/) -{ - throw NotImplementedException("UTF16String extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::vector<UTF16String> extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::deque<UTF16String> extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::list<UTF16String> extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<BLOB>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<BLOB>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<BLOB>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<CLOB>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<CLOB>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<CLOB>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<DateTime>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<DateTime>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<DateTime>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Date>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Date>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Date>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Time>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Time>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Time>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Any>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Any>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Any>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::vector<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::vector extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::deque<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::deque extractor must be implemented."); -} - - -bool AbstractExtractor::extract(std::size_t /*pos*/, std::list<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::list extractor must be implemented."); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/AbstractPreparation.cpp b/contrib/libs/poco/Data/src/AbstractPreparation.cpp deleted file mode 100644 index 0d8f4c690c..0000000000 --- a/contrib/libs/poco/Data/src/AbstractPreparation.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// AbstractPreparation.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractPreparation -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractPreparation.h" - - -namespace Poco { -namespace Data { - - -AbstractPreparation::AbstractPreparation(PreparatorPtr pPreparator): - _pPreparator(pPreparator) -{ - poco_assert_dbg (_pPreparator); -} - - -AbstractPreparation::~AbstractPreparation() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/AbstractPreparator.cpp b/contrib/libs/poco/Data/src/AbstractPreparator.cpp deleted file mode 100644 index ceb1d1ac7a..0000000000 --- a/contrib/libs/poco/Data/src/AbstractPreparator.cpp +++ /dev/null @@ -1,438 +0,0 @@ -// -// AbstractPreparator.cpp -// -// Library: Data -// Package: DataCore -// Module: AbstractPreparator -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/AbstractPreparator.h" - - -namespace Poco { -namespace Data { - - -AbstractPreparator::AbstractPreparator(Poco::UInt32 length): - _length(length), - _bulk(false) -{ -} - - -AbstractPreparator::~AbstractPreparator() -{ -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::Int8>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::UInt8>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::Int16>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::UInt16>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::Int32>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::UInt32>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::Int64>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::UInt64>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -#ifndef POCO_LONG_IS_64_BIT -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<long>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<long>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<long>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} -#endif - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<bool>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<bool>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<bool>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<float>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<float>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<float>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<double>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<double>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<double>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<char>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<char>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<char>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<std::string>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<std::string>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<std::string>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const UTF16String& /*val*/) -{ - throw NotImplementedException("UTF16String preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::vector<UTF16String> preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::deque<UTF16String> preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<UTF16String>& /*val*/) -{ - throw NotImplementedException("std::list<UTF16String> preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<BLOB>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<BLOB>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<BLOB>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<CLOB>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<CLOB>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<CLOB>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<DateTime>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<DateTime>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<DateTime>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Date>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Date>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Date>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Time>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Time>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Time>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Any>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Any>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Any>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::vector<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::vector preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::deque<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::deque preparator must be implemented."); -} - - -void AbstractPreparator::prepare(std::size_t /*pos*/, const std::list<Poco::Dynamic::Var>& /*val*/) -{ - throw NotImplementedException("std::list preparator must be implemented."); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/ArchiveStrategy.cpp b/contrib/libs/poco/Data/src/ArchiveStrategy.cpp deleted file mode 100644 index 2d8842ba20..0000000000 --- a/contrib/libs/poco/Data/src/ArchiveStrategy.cpp +++ /dev/null @@ -1,146 +0,0 @@ -// -// ArchiveStrategy.cpp -// -// Library: Data -// Package: Logging -// Module: ArchiveStrategy -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/ArchiveStrategy.h" -#include "Poco/Ascii.h" - -namespace Poco { -namespace Data { - - -using namespace Keywords; - -// -// ArchiveStrategy -// - - -const std::string ArchiveStrategy::DEFAULT_ARCHIVE_DESTINATION = "T_POCO_LOG_ARCHIVE"; - - -ArchiveStrategy::ArchiveStrategy(const std::string& connector, - const std::string& connect, - const std::string& source, - const std::string& destination): - _connector(connector), - _connect(connect), - _source(source), - _destination(destination) -{ - open(); -} - - -ArchiveStrategy::~ArchiveStrategy() -{ -} - - -void ArchiveStrategy::open() -{ - if (_connector.empty() || _connect.empty()) - throw IllegalStateException("Connector and connect string must be non-empty."); - - _pSession = new Session(_connector, _connect); -} - - -// -// ArchiveByAgeStrategy -// - - -ArchiveByAgeStrategy::ArchiveByAgeStrategy(const std::string& connector, - const std::string& connect, - const std::string& sourceTable, - const std::string& destinationTable): - ArchiveStrategy(connector, connect, sourceTable, destinationTable) -{ - initStatements(); -} - - -ArchiveByAgeStrategy::~ArchiveByAgeStrategy() -{ -} - - -void ArchiveByAgeStrategy::archive() -{ - if (!session().isConnected()) open(); - - DateTime now; - _archiveDateTime = now - _maxAge; - getCountStatement().execute(); - if (_archiveCount > 0) - { - getCopyStatement().execute(); - getDeleteStatement().execute(); - } -} - - -void ArchiveByAgeStrategy::initStatements() -{ - std::string src = getSource(); - std::string dest = getDestination(); - - setCountStatement(); - _archiveCount = 0; - std::string sql; - Poco::format(sql, "SELECT COUNT(*) FROM %s WHERE DateTime < ?", src); - getCountStatement() << sql, into(_archiveCount), use(_archiveDateTime); - - setCopyStatement(); - sql.clear(); - Poco::format(sql, "INSERT INTO %s SELECT * FROM %s WHERE DateTime < ?", dest, src); - getCopyStatement() << sql, use(_archiveDateTime); - - setDeleteStatement(); - sql.clear(); - Poco::format(sql, "DELETE FROM %s WHERE DateTime < ?", src); - getDeleteStatement() << sql, use(_archiveDateTime); -} - - -void ArchiveByAgeStrategy::setThreshold(const std::string& age) -{ - std::string::const_iterator it = age.begin(); - std::string::const_iterator end = age.end(); - int n = 0; - while (it != end && Ascii::isSpace(*it)) ++it; - while (it != end && Ascii::isDigit(*it)) { n *= 10; n += *it++ - '0'; } - while (it != end && Ascii::isSpace(*it)) ++it; - std::string unit; - while (it != end && Ascii::isAlpha(*it)) unit += *it++; - - Timespan::TimeDiff factor = Timespan::SECONDS; - if (unit == "minutes") - factor = Timespan::MINUTES; - else if (unit == "hours") - factor = Timespan::HOURS; - else if (unit == "days") - factor = Timespan::DAYS; - else if (unit == "weeks") - factor = 7*Timespan::DAYS; - else if (unit == "months") - factor = 30*Timespan::DAYS; - else if (unit != "seconds") - throw InvalidArgumentException("setMaxAge", age); - - _maxAge = factor * n; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Bulk.cpp b/contrib/libs/poco/Data/src/Bulk.cpp deleted file mode 100644 index 1def562266..0000000000 --- a/contrib/libs/poco/Data/src/Bulk.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// -// Bulk.cpp -// -// Library: Data -// Package: DataCore -// Module: Bulk -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Bulk.h" - - -namespace Poco { -namespace Data { - - -Bulk::Bulk(const Limit& limit): _limit(limit.value(), false, false) -{ -} - - -Bulk::Bulk(Poco::UInt32 value): _limit(value, false, false) -{ -} - - -Bulk::~Bulk() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Connector.cpp b/contrib/libs/poco/Data/src/Connector.cpp deleted file mode 100644 index c721ae2a92..0000000000 --- a/contrib/libs/poco/Data/src/Connector.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Connector.cpp -// -// Library: Data -// Package: DataCore -// Module: Connector -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Connector.h" - - -namespace Poco { -namespace Data { - - -Connector::Connector() -{ -} - - -Connector::~Connector() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/DataException.cpp b/contrib/libs/poco/Data/src/DataException.cpp deleted file mode 100644 index b5bc7275b9..0000000000 --- a/contrib/libs/poco/Data/src/DataException.cpp +++ /dev/null @@ -1,41 +0,0 @@ -// -// DataException.cpp -// -// Library: Data -// Package: DataCore -// Module: DataException -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/DataException.h" -#include <typeinfo> - - -namespace Poco { -namespace Data { - - -POCO_IMPLEMENT_EXCEPTION(DataException, Poco::IOException, "Database Exception") -POCO_IMPLEMENT_EXCEPTION(RowDataMissingException, DataException, "Data for row missing") -POCO_IMPLEMENT_EXCEPTION(UnknownDataBaseException, DataException, "Type of data base unknown") -POCO_IMPLEMENT_EXCEPTION(UnknownTypeException, DataException, "Type of data unknown") -POCO_IMPLEMENT_EXCEPTION(ExecutionException, DataException, "Execution error") -POCO_IMPLEMENT_EXCEPTION(BindingException, DataException, "Binding error") -POCO_IMPLEMENT_EXCEPTION(ExtractException, DataException, "Extraction error") -POCO_IMPLEMENT_EXCEPTION(LimitException, DataException, "Limit error") -POCO_IMPLEMENT_EXCEPTION(NotSupportedException, DataException, "Feature or property not supported") -POCO_IMPLEMENT_EXCEPTION(SessionUnavailableException, DataException, "Session is unavailable") -POCO_IMPLEMENT_EXCEPTION(SessionPoolExhaustedException, DataException, "No more sessions available from the session pool") -POCO_IMPLEMENT_EXCEPTION(SessionPoolExistsException, DataException, "Session already exists in the pool") -POCO_IMPLEMENT_EXCEPTION(NoDataException, DataException, "No data found") -POCO_IMPLEMENT_EXCEPTION(LengthExceededException, DataException, "Data too long") -POCO_IMPLEMENT_EXCEPTION(ConnectionFailedException, DataException, "Connection attempt failed") -POCO_IMPLEMENT_EXCEPTION(NotConnectedException, DataException, "Not connected to data source") - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Date.cpp b/contrib/libs/poco/Data/src/Date.cpp deleted file mode 100644 index 542d9a9812..0000000000 --- a/contrib/libs/poco/Data/src/Date.cpp +++ /dev/null @@ -1,142 +0,0 @@ -// -// Date.cpp -// -// Library: Data -// Package: DataCore -// Module: Date -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Date.h" -#include "Poco/DateTime.h" -#include "Poco/NumberFormatter.h" -#include "Poco/Data/DynamicDateTime.h" -#include "Poco/Dynamic/Var.h" - - -using Poco::DateTime; -using Poco::Dynamic::Var; -using Poco::NumberFormatter; - - -namespace Poco { -namespace Data { - - -Date::Date() -{ - DateTime dt; - assign(dt.year(), dt.month(), dt.day()); -} - - -Date::Date(int year, int month, int day) -{ - assign(year, month, day); -} - - -Date::Date(const DateTime& dt) -{ - assign(dt.year(), dt.month(), dt.day()); -} - - -Date::~Date() -{ -} - - -void Date::assign(int year, int month, int day) -{ - if (year < 0 || year > 9999) - throw InvalidArgumentException("Year must be between 0 and 9999"); - - if (month < 1 || month > 12) - throw InvalidArgumentException("Month must be between 1 and 12"); - - if (day < 1 || day > DateTime::daysOfMonth(year, month)) - throw InvalidArgumentException("Month must be between 1 and " + - NumberFormatter::format(DateTime::daysOfMonth(year, month))); - - _year = year; - _month = month; - _day = day; -} - - -bool Date::operator < (const Date& date) const -{ - int year = date.year(); - - if (_year < year) return true; - else if (_year > year) return false; - else // years equal - { - int month = date.month(); - if (_month < month) return true; - else - if (_month > month) return false; - else // months equal - if (_day < date.day()) return true; - } - - return false; -} - - -Date& Date::operator = (const Var& var) -{ -#ifndef __GNUC__ -// g++ used to choke on this, newer versions seem to digest it fine -// TODO: determine the version able to handle it properly - *this = var.extract<Date>(); -#else - *this = var.operator Date(); -#endif - return *this; -} - - -} } // namespace Poco::Data - - -#ifdef __GNUC__ -// only needed for g++ (see comment in Date::operator = above) - -namespace Poco { -namespace Dynamic { - - -using Poco::Data::Date; -using Poco::DateTime; - - -template <> -Var::operator Date () const -{ - VarHolder* pHolder = content(); - - if (!pHolder) - throw InvalidAccessException("Can not convert empty value."); - - if (typeid(Date) == pHolder->type()) - return extract<Date>(); - else - { - Poco::DateTime result; - pHolder->convert(result); - return Date(result); - } -} - - -} } // namespace Poco::Dynamic - - -#endif // __GNUC__ diff --git a/contrib/libs/poco/Data/src/DynamicLOB.cpp b/contrib/libs/poco/Data/src/DynamicLOB.cpp deleted file mode 100644 index 5dfe3df857..0000000000 --- a/contrib/libs/poco/Data/src/DynamicLOB.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// DynamicLOB.cpp -// -// Library: Data -// Package: DataCore -// Module: DynamicLOB -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifdef __GNUC__ -// TODO: determine g++ version able to do the right thing without these specializations - -#include "Poco/Data/DynamicLOB.h" -#include "Poco/Data/LOB.h" -#include "Poco/Dynamic/Var.h" - - -namespace Poco { -namespace Dynamic { - - -using Poco::Data::CLOB; -using Poco::Data::BLOB; - - -template <> -Var::operator CLOB () const -{ - VarHolder* pHolder = content(); - - if (!pHolder) - throw InvalidAccessException("Can not convert empty value."); - - if (typeid(CLOB) == pHolder->type()) - return extract<CLOB>(); - else - { - std::string result; - pHolder->convert(result); - return CLOB(result); - } -} - - -template <> -Var::operator BLOB () const -{ - VarHolder* pHolder = content(); - - if (!pHolder) - throw InvalidAccessException("Can not convert empty value."); - - if (typeid(BLOB) == pHolder->type()) - return extract<BLOB>(); - else - { - std::string result; - pHolder->convert(result); - return BLOB(reinterpret_cast<const unsigned char*>(result.data()), - result.size()); - } -} - - -} } // namespace Poco::Data - - -#endif // __GNUC__ - diff --git a/contrib/libs/poco/Data/src/Limit.cpp b/contrib/libs/poco/Data/src/Limit.cpp deleted file mode 100644 index 3a111e34f9..0000000000 --- a/contrib/libs/poco/Data/src/Limit.cpp +++ /dev/null @@ -1,35 +0,0 @@ -// -// Limit.cpp -// -// Library: Data -// Package: DataCore -// Module: Limit -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Limit.h" - - -namespace Poco { -namespace Data { - - -Limit::Limit(SizeT value, bool hardLimit, bool isLowerLimit) : - _value(value), - _hardLimit(hardLimit), - _isLowerLimit(isLowerLimit) -{ -} - - -Limit::~Limit() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/MetaColumn.cpp b/contrib/libs/poco/Data/src/MetaColumn.cpp deleted file mode 100644 index 7b937e6a44..0000000000 --- a/contrib/libs/poco/Data/src/MetaColumn.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// -// MetaColumn.cpp -// -// Library: Data -// Package: DataCore -// Module: MetaColumn -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/MetaColumn.h" - - -namespace Poco { -namespace Data { - - -MetaColumn::MetaColumn(): - _length(), - _precision(), - _position(), - _type(), - _nullable() -{ -} - - -MetaColumn::MetaColumn(std::size_t position, - const std::string& name, - ColumnDataType type, - std::size_t length, - std::size_t precision, - bool nullable): - _name(name), - _length(length), - _precision(precision), - _position(position), - _type(type), - _nullable(nullable) -{ -} - - -MetaColumn::~MetaColumn() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/PooledSessionHolder.cpp b/contrib/libs/poco/Data/src/PooledSessionHolder.cpp deleted file mode 100644 index 80d35e2a61..0000000000 --- a/contrib/libs/poco/Data/src/PooledSessionHolder.cpp +++ /dev/null @@ -1,34 +0,0 @@ -// -// PooledSessionHolder.cpp -// -// Library: Data -// Package: SessionPooling -// Module: PooledSessionHolder -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/PooledSessionHolder.h" - - -namespace Poco { -namespace Data { - - -PooledSessionHolder::PooledSessionHolder(SessionPool& owner, SessionImpl* pSessionImpl): - _owner(owner), - _pImpl(pSessionImpl, true) -{ -} - - -PooledSessionHolder::~PooledSessionHolder() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/PooledSessionImpl.cpp b/contrib/libs/poco/Data/src/PooledSessionImpl.cpp deleted file mode 100644 index 2acf2f9d83..0000000000 --- a/contrib/libs/poco/Data/src/PooledSessionImpl.cpp +++ /dev/null @@ -1,192 +0,0 @@ -// -// PooledSessionImpl.cpp -// -// Library: Data -// Package: SessionPooling -// Module: PooledSessionImpl -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/PooledSessionImpl.h" -#include "Poco/Data/DataException.h" -#include "Poco/Data/SessionPool.h" - - -namespace Poco { -namespace Data { - - -PooledSessionImpl::PooledSessionImpl(PooledSessionHolder* pHolder): - SessionImpl(pHolder->session()->connectionString(), - pHolder->session()->getLoginTimeout()), - _pHolder(pHolder, true) -{ -} - - -PooledSessionImpl::~PooledSessionImpl() -{ - try - { - close(); - } - catch (...) - { - poco_unexpected(); - } -} - - -StatementImpl* PooledSessionImpl::createStatementImpl() -{ - return access()->createStatementImpl(); -} - - -void PooledSessionImpl::begin() -{ - return access()->begin(); -} - - -void PooledSessionImpl::commit() -{ - return access()->commit(); -} - - -bool PooledSessionImpl::isConnected() -{ - return access()->isConnected(); -} - - -void PooledSessionImpl::setConnectionTimeout(std::size_t timeout) -{ - return access()->setConnectionTimeout(timeout); -} - - -std::size_t PooledSessionImpl::getConnectionTimeout() -{ - return access()->getConnectionTimeout(); -} - - -bool PooledSessionImpl::canTransact() -{ - return access()->canTransact(); -} - - -bool PooledSessionImpl::isTransaction() -{ - return access()->isTransaction(); -} - - -void PooledSessionImpl::setTransactionIsolation(Poco::UInt32 ti) -{ - access()->setTransactionIsolation(ti); -} - - -Poco::UInt32 PooledSessionImpl::getTransactionIsolation() -{ - return access()->getTransactionIsolation(); -} - - -bool PooledSessionImpl::hasTransactionIsolation(Poco::UInt32 ti) -{ - return access()->hasTransactionIsolation(ti); -} - - -bool PooledSessionImpl::isTransactionIsolation(Poco::UInt32 ti) -{ - return access()->isTransactionIsolation(ti); -} - - -void PooledSessionImpl::rollback() -{ - return access()->rollback(); -} - - -void PooledSessionImpl::open(const std::string& connect) -{ - access()->open(connect); -} - - -void PooledSessionImpl::close() -{ - if (_pHolder) - { - if (isTransaction()) - { - try - { - rollback(); - } - catch (...) - { - // Something's wrong with the session. Get rid of it. - access()->close(); - } - } - _pHolder->owner().putBack(_pHolder); - _pHolder = 0; - } -} - - -const std::string& PooledSessionImpl::connectorName() const -{ - return access()->connectorName(); -} - - -void PooledSessionImpl::setFeature(const std::string& name, bool state) -{ - access()->setFeature(name, state); -} - - -bool PooledSessionImpl::getFeature(const std::string& name) -{ - return access()->getFeature(name); -} - - -void PooledSessionImpl::setProperty(const std::string& name, const Poco::Any& value) -{ - access()->setProperty(name, value); -} - - -Poco::Any PooledSessionImpl::getProperty(const std::string& name) -{ - return access()->getProperty(name); -} - - -SessionImpl* PooledSessionImpl::access() const -{ - if (_pHolder) - { - _pHolder->access(); - return impl(); - } - else throw SessionUnavailableException(); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Position.cpp b/contrib/libs/poco/Data/src/Position.cpp deleted file mode 100644 index 64db6fca70..0000000000 --- a/contrib/libs/poco/Data/src/Position.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Position.cpp -// -// Library: Data -// Package: DataCore -// Module: Position -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Position.h" - - -namespace Poco { -namespace Data { - - -Position::Position(Poco::UInt32 value): _value(value) -{ -} - - -Position::~Position() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Range.cpp b/contrib/libs/poco/Data/src/Range.cpp deleted file mode 100644 index d41fde130d..0000000000 --- a/contrib/libs/poco/Data/src/Range.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Range.cpp -// -// Library: Data -// Package: DataCore -// Module: Range -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Range.h" -#include "Poco/Data/DataException.h" - - -namespace Poco { -namespace Data { - - -using namespace Keywords; - - -Range::Range(Limit::SizeT lowValue, Limit::SizeT upValue, bool hardLimit) : - _lower(lowerLimit(lowValue)), - _upper(upperLimit(upValue, hardLimit)) -{ - if (lowValue > upValue) - throw LimitException("lowerLimit > upperLimit!"); -} - - -Range::~Range() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/RecordSet.cpp b/contrib/libs/poco/Data/src/RecordSet.cpp deleted file mode 100644 index 0d8c143a98..0000000000 --- a/contrib/libs/poco/Data/src/RecordSet.cpp +++ /dev/null @@ -1,392 +0,0 @@ -// -// RecordSet.cpp -// -// Library: Data -// Package: DataCore -// Module: RecordSet -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/RecordSet.h" -#include "Poco/Data/RowFilter.h" -#include "Poco/Data/Date.h" -#include "Poco/Data/Time.h" -#include "Poco/Data/DataException.h" -#include "Poco/DateTime.h" -#include "Poco/UTFString.h" - - -using namespace Poco::Data::Keywords; -using Poco::DateTime; -using Poco::UTF16String; - - -namespace Poco { -namespace Data { - - -const std::size_t RecordSet::UNKNOWN_TOTAL_ROW_COUNT = std::numeric_limits<std::size_t>::max(); - - -RecordSet::RecordSet(const Statement& rStatement, - RowFormatter::Ptr pRowFormatter): - Statement(rStatement), - _currentRow(0), - _pBegin(new RowIterator(this, 0 == rowsExtracted())), - _pEnd(new RowIterator(this, true)), - _totalRowCount(UNKNOWN_TOTAL_ROW_COUNT) -{ - if (pRowFormatter) setRowFormatter(pRowFormatter); -} - - -RecordSet::RecordSet(Session& rSession, - const std::string& query, - RowFormatter::Ptr pRowFormatter): - Statement((rSession << query, now)), - _currentRow(0), - _pBegin(new RowIterator(this, 0 == rowsExtracted())), - _pEnd(new RowIterator(this, true)), - _totalRowCount(UNKNOWN_TOTAL_ROW_COUNT) -{ - if (pRowFormatter) setRowFormatter(pRowFormatter); -} - - -RecordSet::RecordSet(const RecordSet& other): - Statement(other.impl()), - _currentRow(other._currentRow), - _pBegin(new RowIterator(this, 0 == rowsExtracted())), - _pEnd(new RowIterator(this, true)), - _pFilter(other._pFilter), - _totalRowCount(other._totalRowCount) -{ -} - - -RecordSet::~RecordSet() -{ - try - { - delete _pBegin; - delete _pEnd; - - RowMap::iterator it = _rowMap.begin(); - RowMap::iterator end = _rowMap.end(); - for (; it != end; ++it) delete it->second; - } - catch (...) - { - poco_unexpected(); - } -} - - -void RecordSet::reset(const Statement& stmt) -{ - delete _pBegin; - _pBegin = 0; - delete _pEnd; - _pEnd = 0; - _currentRow = 0; - _totalRowCount = UNKNOWN_TOTAL_ROW_COUNT; - - RowMap::iterator it = _rowMap.begin(); - RowMap::iterator end = _rowMap.end(); - for (; it != end; ++it) delete it->second; - _rowMap.clear(); - - Statement::operator = (stmt); - - _pBegin = new RowIterator(this, 0 == rowsExtracted()); - _pEnd = new RowIterator(this, true); -} - - -Poco::Dynamic::Var RecordSet::value(std::size_t col, std::size_t row, bool useFilter) const -{ - if (useFilter && isFiltered() && !isAllowed(row)) - throw InvalidAccessException("Row not allowed"); - - if (isNull(col, row)) return Poco::Dynamic::Var(); - - switch (columnType(col)) - { - case MetaColumn::FDT_BOOL: return value<bool>(col, row, useFilter); - case MetaColumn::FDT_INT8: return value<Int8>(col, row, useFilter); - case MetaColumn::FDT_UINT8: return value<UInt8>(col, row, useFilter); - case MetaColumn::FDT_INT16: return value<Int16>(col, row, useFilter); - case MetaColumn::FDT_UINT16: return value<UInt16>(col, row, useFilter); - case MetaColumn::FDT_INT32: return value<Int32>(col, row, useFilter); - case MetaColumn::FDT_UINT32: return value<UInt32>(col, row, useFilter); - case MetaColumn::FDT_INT64: return value<Int64>(col, row, useFilter); - case MetaColumn::FDT_UINT64: return value<UInt64>(col, row, useFilter); - case MetaColumn::FDT_FLOAT: return value<float>(col, row, useFilter); - case MetaColumn::FDT_DOUBLE: return value<double>(col, row, useFilter); - case MetaColumn::FDT_STRING: return value<std::string>(col, row, useFilter); - case MetaColumn::FDT_WSTRING: return value<UTF16String>(col, row, useFilter); - case MetaColumn::FDT_BLOB: return value<BLOB>(col, row, useFilter); - case MetaColumn::FDT_CLOB: return value<CLOB>(col, row, useFilter); - case MetaColumn::FDT_DATE: return value<Date>(col, row, useFilter); - case MetaColumn::FDT_TIME: return value<Time>(col, row, useFilter); - case MetaColumn::FDT_TIMESTAMP: return value<DateTime>(col, row); - default: - throw UnknownTypeException("Data type not supported."); - } -} - - -Poco::Dynamic::Var RecordSet::value(const std::string& name, std::size_t row, bool useFilter) const -{ - if (useFilter && isFiltered() && !isAllowed(row)) - throw InvalidAccessException("Row not allowed"); - - if (isNull(metaColumn(name).position(), row)) return Poco::Dynamic::Var(); - - switch (columnType(name)) - { - case MetaColumn::FDT_BOOL: return value<bool>(name, row, useFilter); - case MetaColumn::FDT_INT8: return value<Int8>(name, row, useFilter); - case MetaColumn::FDT_UINT8: return value<UInt8>(name, row, useFilter); - case MetaColumn::FDT_INT16: return value<Int16>(name, row, useFilter); - case MetaColumn::FDT_UINT16: return value<UInt16>(name, row, useFilter); - case MetaColumn::FDT_INT32: return value<Int32>(name, row, useFilter); - case MetaColumn::FDT_UINT32: return value<UInt32>(name, row, useFilter); - case MetaColumn::FDT_INT64: return value<Int64>(name, row, useFilter); - case MetaColumn::FDT_UINT64: return value<UInt64>(name, row, useFilter); - case MetaColumn::FDT_FLOAT: return value<float>(name, row, useFilter); - case MetaColumn::FDT_DOUBLE: return value<double>(name, row, useFilter); - case MetaColumn::FDT_STRING: return value<std::string>(name, row, useFilter); - case MetaColumn::FDT_WSTRING: return value<UTF16String>(name, row, useFilter); - case MetaColumn::FDT_BLOB: return value<BLOB>(name, row, useFilter); - case MetaColumn::FDT_DATE: return value<Date>(name, row, useFilter); - case MetaColumn::FDT_TIME: return value<Time>(name, row, useFilter); - case MetaColumn::FDT_TIMESTAMP: return value<DateTime>(name, row, useFilter); - default: - throw UnknownTypeException("Data type not supported."); - } -} - - -Row& RecordSet::row(std::size_t pos) -{ - std::size_t rowCnt = rowCount(); - if (0 == rowCnt || pos > rowCnt - 1) - throw RangeException("Invalid recordset row requested."); - - RowMap::const_iterator it = _rowMap.find(pos); - Row* pRow = 0; - std::size_t columns = columnCount(); - if (it == _rowMap.end()) - { - if (_rowMap.size()) - { - //reuse first row column names and sorting fields to save some memory - pRow = new Row(_rowMap.begin()->second->names(), - _rowMap.begin()->second->getSortMap(), - getRowFormatter()); - - for (std::size_t col = 0; col < columns; ++col) - pRow->set(col, value(col, pos)); - } - else - { - pRow = new Row; - pRow->setFormatter(getRowFormatter()); - for (std::size_t col = 0; col < columns; ++col) - pRow->append(metaColumn(static_cast<UInt32>(col)).name(), value(col, pos)); - } - - _rowMap.insert(RowMap::value_type(pos, pRow)); - } - else - { - pRow = it->second; - poco_check_ptr (pRow); - } - - return *pRow; -} - - -std::size_t RecordSet::rowCount() const -{ - poco_assert (extractions().size()); - std::size_t rc = subTotalRowCount(); - if (!isFiltered()) return rc; - - std::size_t counter = 0; - for (int row = 0; row < rc; ++row) - { - if (isAllowed(row)) ++counter; - } - - return counter; -} - - -bool RecordSet::isAllowed(std::size_t row) const -{ - if (!isFiltered()) return true; - return _pFilter->isAllowed(row); -} - - -bool RecordSet::moveFirst() -{ - if (subTotalRowCount() > 0) - { - if (!isFiltered()) - { - _currentRow = 0; - return true; - } - - std::size_t currentRow = 0; - while (!isAllowed(currentRow)) - { - if (currentRow >= subTotalRowCount() - 1) return false; - ++currentRow; - } - - _currentRow = currentRow; - return true; - } - else return false; -} - - -bool RecordSet::moveNext() -{ - std::size_t currentRow = _currentRow; - do - { - if (currentRow >= subTotalRowCount() - 1) return false; - ++currentRow; - } while (isFiltered() && !isAllowed(currentRow)); - - _currentRow = currentRow; - return true; -} - - -bool RecordSet::movePrevious() -{ - std::size_t currentRow = _currentRow; - do - { - if (currentRow <= 0) return false; - --currentRow; - } while (isFiltered() && !isAllowed(currentRow)); - - _currentRow = currentRow; - return true; -} - - -bool RecordSet::moveLast() -{ - if (subTotalRowCount() > 0) - { - std::size_t currentRow = subTotalRowCount() - 1; - if (!isFiltered()) - { - _currentRow = currentRow; - return true; - } - - while (!isAllowed(currentRow)) - { - if (currentRow <= 0) return false; - --currentRow; - } - - _currentRow = currentRow; - return true; - } - else return false; -} - - -void RecordSet::setRowFormatter(RowFormatter::Ptr pRowFormatter) -{ - pRowFormatter->setTotalRowCount(static_cast<int>(getTotalRowCount())); - Statement::setRowFormatter(pRowFormatter); - RowMap::iterator it = _rowMap.begin(); - RowMap::iterator end = _rowMap.end(); - for (; it != end; ++it) it->second->setFormatter(getRowFormatter()); -} - - -std::ostream& RecordSet::copyNames(std::ostream& os) const -{ - std::string names = (*_pBegin)->namesToString(); - if (!names.empty()) os << names; - return os; -} - - -std::ostream& RecordSet::copyValues(std::ostream& os, std::size_t offset, std::size_t length) const -{ - RowIterator it = *_pBegin + offset; - RowIterator end = (RowIterator::POSITION_END != length) ? it + length : *_pEnd; - std::copy(it, end, std::ostream_iterator<Row>(os)); - return os; -} - - -void RecordSet::formatValues(std::size_t offset, std::size_t length) const -{ - RowIterator it = *_pBegin + offset; - RowIterator end = (RowIterator::POSITION_END != length) ? it + length : *_pEnd; - std::string val; - for (; it != end; ++it) it->formatValues(); -} - - -std::ostream& RecordSet::copy(std::ostream& os, std::size_t offset, std::size_t length) const -{ - RowFormatter& rf = const_cast<RowFormatter&>((*_pBegin)->getFormatter()); - rf.setTotalRowCount(static_cast<int>(getTotalRowCount())); - if (RowFormatter::FORMAT_PROGRESSIVE == rf.getMode()) - { - os << rf.prefix(); - copyNames(os); - copyValues(os, offset, length); - os << rf.postfix(); - } - else - { - formatNames(); - formatValues(offset, length); - os << rf.toString(); - } - - return os; -} - - -void RecordSet::filter(const Poco::AutoPtr<RowFilter>& pFilter) -{ - _pFilter = pFilter; -} - - -bool RecordSet::isFiltered() const -{ - return _pFilter && !_pFilter->isEmpty(); -} - - -void RecordSet::setTotalRowCount(const std::string& sql) -{ - session() << sql, into(_totalRowCount), now; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Row.cpp b/contrib/libs/poco/Data/src/Row.cpp deleted file mode 100644 index d078536bd5..0000000000 --- a/contrib/libs/poco/Data/src/Row.cpp +++ /dev/null @@ -1,369 +0,0 @@ -// -// Row.cpp -// -// Library: Data -// Package: DataCore -// Module: Row -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Row.h" -#include "Poco/Data/SimpleRowFormatter.h" -#include "Poco/String.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace Data { - - -std::ostream& operator << (std::ostream &os, const Row& row) -{ - os << row.valuesToString(); - return os; -} - - -Row::Row(): - _pNames(0), - _pSortMap(new SortMap), - _pFormatter(new SimpleRowFormatter) -{ -} - - -Row::Row(NameVecPtr pNames, - const RowFormatter::Ptr& pFormatter): _pNames(pNames) -{ - if (!_pNames) throw NullPointerException(); - init(0, pFormatter); -} - - -Row::Row(NameVecPtr pNames, - const SortMapPtr& pSortMap, - const RowFormatter::Ptr& pFormatter): _pNames(pNames) -{ - if (!_pNames) throw NullPointerException(); - init(pSortMap, pFormatter); -} - - -void Row::init(const SortMapPtr& pSortMap, const RowFormatter::Ptr& pFormatter) -{ - setFormatter(pFormatter); - setSortMap(pSortMap); - - NameVec::size_type sz = _pNames->size(); - if (sz) - { - _values.resize(sz); - // Row sortability in the strict weak ordering sense is - // an invariant, hence we must start with a zero here. - // If null value is later retrieved from DB, the - // Var::empty() call should be used to empty - // the corresponding Row value. - _values[0] = 0; - addSortField(0); - } -} - - -Row::~Row() -{ -} - - -Poco::Dynamic::Var& Row::get(std::size_t col) -{ - try - { - return _values.at(col); - } - catch (std::out_of_range& re) - { - throw RangeException(re.what()); - } -} - - -std::size_t Row::getPosition(const std::string& name) -{ - if (!_pNames) - throw NullPointerException(); - - NameVec::const_iterator it = _pNames->begin(); - NameVec::const_iterator end = _pNames->end(); - std::size_t col = 0; - for (; it != end; ++it, ++col) - if (0 == icompare(name, *it)) return col; - - throw NotFoundException(name); -} - - -void Row::addSortField(std::size_t pos) -{ - poco_assert (pos <= _values.size()); - - SortMap::iterator it = _pSortMap->begin(); - SortMap::iterator end = _pSortMap->end(); - for (; it != end; ++it) - { - if (it->get<0>() == pos) return; - } - - ComparisonType ct; - if (_values[pos].isEmpty()) - { - ct = COMPARE_AS_EMPTY; - } - else if ((_values[pos].type() == typeid(Poco::Int8)) || - (_values[pos].type() == typeid(Poco::UInt8)) || - (_values[pos].type() == typeid(Poco::Int16)) || - (_values[pos].type() == typeid(Poco::UInt16)) || - (_values[pos].type() == typeid(Poco::Int32)) || - (_values[pos].type() == typeid(Poco::UInt32)) || - (_values[pos].type() == typeid(Poco::Int64)) || - (_values[pos].type() == typeid(Poco::UInt64)) || - (_values[pos].type() == typeid(bool))) - { - ct = COMPARE_AS_INTEGER; - } - else if ((_values[pos].type() == typeid(float)) || - (_values[pos].type() == typeid(double))) - { - ct = COMPARE_AS_FLOAT; - } - else - { - ct = COMPARE_AS_STRING; - } - - _pSortMap->push_back(SortTuple(pos, ct)); -} - - -void Row::addSortField(const std::string& name) -{ - addSortField(getPosition(name)); -} - - -void Row::removeSortField(std::size_t pos) -{ - SortMap::iterator it = _pSortMap->begin(); - SortMap::iterator end = _pSortMap->end(); - for (; it != end; ++it) - { - if (it->get<0>() == pos) - { - _pSortMap->erase(it); - return; - } - } -} - - -void Row::removeSortField(const std::string& name) -{ - removeSortField(getPosition(name)); -} - - -void Row::replaceSortField(std::size_t oldPos, std::size_t newPos) -{ - poco_assert (oldPos <= _values.size()); - poco_assert (newPos <= _values.size()); - - ComparisonType ct; - - if (_values[newPos].isEmpty()) - { - ct = COMPARE_AS_EMPTY; - } - else if ((_values[newPos].type() == typeid(Poco::Int8)) || - (_values[newPos].type() == typeid(Poco::UInt8)) || - (_values[newPos].type() == typeid(Poco::Int16)) || - (_values[newPos].type() == typeid(Poco::UInt16)) || - (_values[newPos].type() == typeid(Poco::Int32)) || - (_values[newPos].type() == typeid(Poco::UInt32)) || - (_values[newPos].type() == typeid(Poco::Int64)) || - (_values[newPos].type() == typeid(Poco::UInt64)) || - (_values[newPos].type() == typeid(bool))) - { - ct = COMPARE_AS_INTEGER; - } - else if ((_values[newPos].type() == typeid(float)) || - (_values[newPos].type() == typeid(double))) - { - ct = COMPARE_AS_FLOAT; - } - else - { - ct = COMPARE_AS_STRING; - } - - SortMap::iterator it = _pSortMap->begin(); - SortMap::iterator end = _pSortMap->end(); - for (; it != end; ++it) - { - if (it->get<0>() == oldPos) - { - *it = SortTuple(newPos, ct); - return; - } - } - - throw NotFoundException("Field not found"); -} - - -void Row::replaceSortField(const std::string& oldName, const std::string& newName) -{ - replaceSortField(getPosition(oldName), getPosition(newName)); -} - - -void Row::resetSort() -{ - _pSortMap->clear(); - if (_values.size()) addSortField(0); -} - - -bool Row::isEqualSize(const Row& other) const -{ - return (other._values.size() == _values.size()); -} - - -bool Row::isEqualType(const Row& other) const -{ - std::vector<Poco::Dynamic::Var>::const_iterator it = _values.begin(); - std::vector<Poco::Dynamic::Var>::const_iterator end = _values.end(); - for (int i = 0; it != end; ++it, ++i) - { - if (it->type() != other._values[i].type()) - return false; - } - - return true; -} - - -bool Row::operator == (const Row& other) const -{ - if (!isEqualSize(other)) return false; - if (!isEqualType(other)) return false; - - std::vector<Poco::Dynamic::Var>::const_iterator it = _values.begin(); - std::vector<Poco::Dynamic::Var>::const_iterator end = _values.end(); - for (int i = 0; it != end; ++it, ++i) - { - if ((*it).convert<std::string>() != other._values[i].convert<std::string>()) - return false; - } - - return true; -} - - -bool Row::operator != (const Row& other) const -{ - return !(*this == other); -} - - -bool Row::operator < (const Row& other) const -{ - if (*_pSortMap != *other._pSortMap) - throw InvalidAccessException("Rows compared have different sorting criteria."); - - SortMap::const_iterator it = _pSortMap->begin(); - SortMap::const_iterator end = _pSortMap->end(); - for (; it != end; ++it) - { - switch (it->get<1>()) - { - case COMPARE_AS_EMPTY: - return false; - - case COMPARE_AS_INTEGER: - if (_values[it->get<0>()].convert<Poco::Int64>() < - other._values[it->get<0>()].convert<Poco::Int64>()) - return true; - else if (_values[it->get<0>()].convert<Poco::Int64>() != - other._values[it->get<0>()].convert<Poco::Int64>()) - return false; - break; - - case COMPARE_AS_FLOAT: - if (_values[it->get<0>()].convert<double>() < - other._values[it->get<0>()].convert<double>()) - return true; - else if (_values[it->get<0>()].convert<double>() != - other._values[it->get<0>()].convert<double>()) - return false; - break; - - case COMPARE_AS_STRING: - if (_values[it->get<0>()].convert<std::string>() < - other._values[it->get<0>()].convert<std::string>()) - return true; - else if (_values[it->get<0>()].convert<std::string>() != - other._values[it->get<0>()].convert<std::string>()) - return false; - break; - - default: - throw IllegalStateException("Unknown comparison criteria."); - } - } - - return false; -} - - -void Row::setFormatter(const RowFormatter::Ptr& pFormatter) -{ - if (pFormatter.get()) - _pFormatter = pFormatter; - else - _pFormatter = new SimpleRowFormatter; -} - - -void Row::setSortMap(const SortMapPtr& pSortMap) -{ - if (pSortMap.get()) - _pSortMap = pSortMap; - else - _pSortMap = new SortMap; -} - - -const std::string& Row::namesToString() const -{ - if (!_pNames) - throw NullPointerException(); - - return _pFormatter->formatNames(names(), _nameStr); -} - - -void Row::formatNames() const -{ - if (!_pNames) - throw NullPointerException(); - - return _pFormatter->formatNames(names()); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/RowFilter.cpp b/contrib/libs/poco/Data/src/RowFilter.cpp deleted file mode 100644 index 9fd0b62879..0000000000 --- a/contrib/libs/poco/Data/src/RowFilter.cpp +++ /dev/null @@ -1,225 +0,0 @@ -// -// RowFilter.cpp -// -// Library: Data -// Package: DataCore -// Module: RowFilter -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/RowFilter.h" -#include "Poco/Data/RecordSet.h" -#include "Poco/String.h" -#include "Poco/Exception.h" -#include <functional> - - -namespace Poco { -namespace Data { - - -RowFilter::RowFilter(RecordSet* pRecordSet): _pRecordSet(pRecordSet), _not(false) -{ - poco_check_ptr(pRecordSet); - init(); - duplicate(); - _pRecordSet->filter(this); -} - - -RowFilter::RowFilter(Ptr pParent, LogicOperator op): _pRecordSet(0), - _pParent(pParent), - _not(false) -{ - poco_check_ptr(_pParent.get()); - init(); - duplicate(); - _pParent->addFilter(this, op); -} - - -void RowFilter::init() -{ - _comparisons.insert(Comparisons::value_type("<", VALUE_LESS_THAN)); - _comparisons.insert(Comparisons::value_type("<=", VALUE_LESS_THAN_OR_EQUAL)); - _comparisons.insert(Comparisons::value_type("=", VALUE_EQUAL)); - _comparisons.insert(Comparisons::value_type("==", VALUE_EQUAL)); - _comparisons.insert(Comparisons::value_type(">", VALUE_GREATER_THAN)); - _comparisons.insert(Comparisons::value_type(">=", VALUE_GREATER_THAN_OR_EQUAL)); - _comparisons.insert(Comparisons::value_type("<>", VALUE_NOT_EQUAL)); - _comparisons.insert(Comparisons::value_type("!=", VALUE_NOT_EQUAL)); - _comparisons.insert(Comparisons::value_type("IS NULL", VALUE_IS_NULL)); -} - - -RowFilter::~RowFilter() -{ - try - { - if (_pRecordSet) _pRecordSet->filter(0); - if (_pParent && _pParent->has(this)) - _pParent->removeFilter(this); - release(); - } - catch (...) - { - poco_unexpected(); - } -} - - -bool RowFilter::isAllowed(std::size_t row) const -{ - Poco::Dynamic::Var retVal; - const RecordSet& rs = recordSet(); - - std::size_t columns = rs.columnCount(); - ComparisonMap::const_iterator it = _comparisonMap.begin(); - ComparisonMap::const_iterator end = _comparisonMap.end(); - for (; it != end; ++it) - { - for (std::size_t col = 0; col < columns; ++col) - { - const std::string name = toUpper(rs.metaColumn(static_cast<UInt32>(col)).name()); - if (_comparisonMap.find(name) == _comparisonMap.end()) continue; - - Poco::Dynamic::Var ret; - CompT compOp = 0; - Poco::Dynamic::Var val = rs.value(col, row, false); - - switch (it->second.get<1>()) - { - case VALUE_LESS_THAN: - compOp = less; break; - case VALUE_LESS_THAN_OR_EQUAL: - compOp = lessOrEqual; break; - case VALUE_EQUAL: - compOp = equal; break; - case VALUE_GREATER_THAN: - compOp = greater; break; - case VALUE_GREATER_THAN_OR_EQUAL: - compOp = greaterOrEqual; break; - case VALUE_NOT_EQUAL: - compOp = notEqual; break; - case VALUE_IS_NULL: - compOp = isNull; break; - default: - throw IllegalStateException("Unsupported comparison criteria."); - } - - doCompare(ret, val, compOp, it->second); - if (retVal.isEmpty()) retVal = ret; - else retVal = retVal || ret; - } - } - - // iterate through children - FilterMap::const_iterator fIt = _filterMap.begin(); - FilterMap::const_iterator fEnd = _filterMap.end(); - for (; fIt != fEnd; ++fIt) - { - if (OP_OR == fIt->second) - { - if (retVal.isEmpty()) - retVal = fIt->first->isAllowed(row); - else - retVal = retVal || fIt->first->isAllowed(row); - } - else if (OP_AND == fIt->second) - { - if (retVal.isEmpty()) - retVal = fIt->first->isAllowed(row); - else - retVal = retVal && fIt->first->isAllowed(row); - } - else - throw IllegalStateException("Unknown logical operation."); - } - - if (retVal.isEmpty()) retVal = true; // no filtering found - return (!_not) && retVal.extract<bool>(); -} - - -int RowFilter::remove(const std::string& name) -{ - poco_check_ptr (_pRecordSet); - _pRecordSet->moveFirst(); - return static_cast<int>(_comparisonMap.erase(toUpper(name))); -} - - -RowFilter::Comparison RowFilter::getComparison(const std::string& comp) const -{ - Comparisons::const_iterator it = _comparisons.find(toUpper(comp)); - if (it == _comparisons.end()) - throw NotFoundException("Comparison not found", comp); - - return it->second; -} - - -void RowFilter::addFilter(Ptr pFilter, LogicOperator comparison) -{ - poco_check_ptr (_pRecordSet); - - pFilter->_pRecordSet = _pRecordSet; - _pRecordSet->moveFirst(); - _filterMap.insert(FilterMap::value_type(pFilter, comparison)); -} - - -void RowFilter::removeFilter(Ptr pFilter) -{ - poco_check_ptr (_pRecordSet); - - _pRecordSet->moveFirst(); - _filterMap.erase(pFilter); - pFilter->_pRecordSet = 0; - pFilter->_pParent = 0; -} - - -void RowFilter::doCompare(Poco::Dynamic::Var& ret, - Poco::Dynamic::Var& val, - CompT comp, - const ComparisonEntry& ce) -{ - if (ret.isEmpty()) ret = comp(val, ce.get<0>()); - else - { - if (ce.get<2>() == OP_OR) - ret = ret || comp(val, ce.get<0>()); - else if (ce.get<2>() == OP_AND) - ret = ret && comp(val, ce.get<0>()); - else - throw IllegalStateException("Unknown logical operation."); - } -} - - -RecordSet& RowFilter::recordSet() const -{ - if (!_pRecordSet) - { - Ptr pParent = _pParent; - while (pParent && !_pRecordSet) - _pRecordSet = pParent->_pRecordSet; - } - poco_check_ptr (_pRecordSet); - return *_pRecordSet; -} - - -void RowFilter::rewindRecordSet() -{ - if (_pRecordSet) _pRecordSet->moveFirst(); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/RowFormatter.cpp b/contrib/libs/poco/Data/src/RowFormatter.cpp deleted file mode 100644 index ebb463ac63..0000000000 --- a/contrib/libs/poco/Data/src/RowFormatter.cpp +++ /dev/null @@ -1,80 +0,0 @@ -// -// RowFormatter.cpp -// -// Library: Data -// Package: DataCore -// Module: RowFormatter -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/RowFormatter.h" -#include "Poco/Exception.h" -#include <iomanip> - - -namespace Poco { -namespace Data { - - -RowFormatter::RowFormatter(const std::string& prefix, - const std::string& postfix, - Mode mode): - _prefix(prefix), - _postfix(postfix), - _mode(mode), - _totalRowCount(0) -{ -} - - -RowFormatter::~RowFormatter() -{ -} - - -std::string& RowFormatter::formatNames(const NameVecPtr pNames, std::string& formattedNames) -{ - formattedNames.clear(); - return formattedNames; -} - - -void RowFormatter::formatNames(const NameVecPtr pNames) -{ - return; -} - - -std::string& RowFormatter::formatValues(const ValueVec& /*vals*/, std::string& formattedValues) -{ - formattedValues.clear(); - return formattedValues; -} - - -void RowFormatter::formatValues(const ValueVec& /*vals*/) -{ - return; -} - - -const std::string& RowFormatter::toString() -{ - throw NotImplementedException("RowFormatter::toString()"); -} - - -void RowFormatter::reset() -{ - _prefix = ""; - _postfix = ""; - _totalRowCount = INVALID_ROW_COUNT; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/RowIterator.cpp b/contrib/libs/poco/Data/src/RowIterator.cpp deleted file mode 100644 index c7e1f45c3e..0000000000 --- a/contrib/libs/poco/Data/src/RowIterator.cpp +++ /dev/null @@ -1,207 +0,0 @@ -// -// RowIterator.cpp -// -// Library: Data -// Package: DataCore -// Module: RowIterator -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/RowIterator.h" -#include "Poco/Data/RecordSet.h" -#undef min -#undef max -#include <limits> - - -namespace Poco { -namespace Data { - - -const std::size_t RowIterator::POSITION_END = std::numeric_limits<std::size_t>::max(); - - -RowIterator::RowIterator(RecordSet* pRecordSet, bool positionEnd): - _pRecordSet(pRecordSet), - _position(positionEnd ? POSITION_END : 0) -{ -} - - -RowIterator::RowIterator(const RowIterator& other): - _pRecordSet(other._pRecordSet), - _position(other._position) -{ -} - - -RowIterator::~RowIterator() -{ -} - - -RowIterator& RowIterator::operator = (const RowIterator& other) -{ - RowIterator tmp(other); - swap(tmp); - return *this; -} - - -void RowIterator::swap(RowIterator& other) -{ - using std::swap; - - swap(_pRecordSet, other._pRecordSet); - swap(_position, other._position); -} - - -void RowIterator::increment() const -{ - if (POSITION_END == _position) - throw RangeException("End of iterator reached."); - - if (_position < _pRecordSet->subTotalRowCount() - 1) - ++_position; - else - _position = POSITION_END; - - if (_pRecordSet->getFilter() && POSITION_END != _position) - { - while (!_pRecordSet->isAllowed(_position)) - { - increment(); - if (POSITION_END == _position) break; - } - } -} - - -void RowIterator::decrement() const -{ - if (0 == _position) - throw RangeException("Beginning of iterator reached."); - else if (POSITION_END == _position) - _position = _pRecordSet->subTotalRowCount() - 1; - else - --_position; - - if (_pRecordSet->getFilter() && 0 != _position) - { - while (!_pRecordSet->isAllowed(_position)) - { - decrement(); - if (0 == _position) break; - } - } -} - - -void RowIterator::setPosition(std::size_t pos) const -{ - if (_position == pos) return; - - if (_pRecordSet->getFilter()) - { - std::size_t start = _position; - if (_position > pos) - { - std::size_t end = _position - pos; - for (; start > end; --start) - { - if (pos) --pos; - else throw RangeException("Invalid position argument."); - } - } - else - { - std::size_t end = pos - _position; - for (; start < end; ++start) - { - if (_pRecordSet->subTotalRowCount() != pos) ++pos; - else throw RangeException("Invalid position argument."); - } - } - } - - if (pos < _pRecordSet->subTotalRowCount()) - _position = pos; - else if (pos == _pRecordSet->subTotalRowCount()) - _position = POSITION_END; - else - throw RangeException("Invalid position argument."); -} - - -Row& RowIterator::operator * () const -{ - if (POSITION_END == _position) - throw InvalidAccessException("End of iterator reached."); - - return _pRecordSet->row(_position); -} - - -Row* RowIterator::operator -> () const -{ - if (POSITION_END == _position) - throw InvalidAccessException("End of iterator reached."); - - return &_pRecordSet->row(_position); -} - - -const RowIterator& RowIterator::operator ++ () const -{ - increment(); - return *this; -} - - -RowIterator RowIterator::operator ++ (int) const -{ - RowIterator old(*this); - increment(); - return old; -} - - -const RowIterator& RowIterator::operator -- () const -{ - decrement(); - return *this; -} - - -RowIterator RowIterator::operator -- (int) const -{ - RowIterator old(*this); - decrement(); - return old; -} - - -RowIterator RowIterator::operator + (std::size_t diff) const -{ - RowIterator ri(*this); - ri.setPosition(_position + diff); - return ri; -} - - -RowIterator RowIterator::operator - (std::size_t diff) const -{ - if (diff > _position) throw RangeException("Invalid position argument."); - RowIterator ri(*this); - ri.setPosition(_position - diff); - return ri; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SQLChannel.cpp b/contrib/libs/poco/Data/src/SQLChannel.cpp deleted file mode 100644 index bd23fc9a5b..0000000000 --- a/contrib/libs/poco/Data/src/SQLChannel.cpp +++ /dev/null @@ -1,296 +0,0 @@ -// -// SQLChannel.cpp -// -// Library: Data -// Package: Logging -// Module: SQLChannel -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SQLChannel.h" -#include "Poco/Data/SessionFactory.h" -#include "Poco/DateTime.h" -#include "Poco/LoggingFactory.h" -#include "Poco/Instantiator.h" -#include "Poco/NumberParser.h" -#include "Poco/NumberFormatter.h" -#include "Poco/Format.h" - - -namespace Poco { -namespace Data { - - -using namespace Keywords; - - -const std::string SQLChannel::PROP_CONNECTOR("connector"); -const std::string SQLChannel::PROP_CONNECT("connect"); -const std::string SQLChannel::PROP_NAME("name"); -const std::string SQLChannel::PROP_TABLE("table"); -const std::string SQLChannel::PROP_ARCHIVE_TABLE("archive"); -const std::string SQLChannel::PROP_MAX_AGE("keep"); -const std::string SQLChannel::PROP_ASYNC("async"); -const std::string SQLChannel::PROP_TIMEOUT("timeout"); -const std::string SQLChannel::PROP_THROW("throw"); - - -SQLChannel::SQLChannel(): - _name("-"), - _table("T_POCO_LOG"), - _timeout(1000), - _throw(true), - _async(true), - _pid(), - _tid(), - _priority() -{ -} - - -SQLChannel::SQLChannel(const std::string& connector, - const std::string& connect, - const std::string& name): - _connector(connector), - _connect(connect), - _name(name), - _table("T_POCO_LOG"), - _timeout(1000), - _throw(true), - _async(true), - _pid(), - _tid(), - _priority() -{ - open(); -} - - -SQLChannel::~SQLChannel() -{ - try - { - close(); - } - catch (...) - { - poco_unexpected(); - } -} - - -void SQLChannel::open() -{ - if (_connector.empty() || _connect.empty()) - throw IllegalStateException("Connector and connect string must be non-empty."); - - _pSession = new Session(_connector, _connect); - initLogStatement(); -} - - -void SQLChannel::close() -{ - wait(); -} - - -void SQLChannel::log(const Message& msg) -{ - if (_async) logAsync(msg); - else logSync(msg); -} - - -void SQLChannel::logAsync(const Message& msg) -{ - poco_check_ptr (_pLogStatement); - if (0 == wait() && !_pLogStatement->done() && !_pLogStatement->initialized()) - { - if (_throw) - throw TimeoutException("Timed out waiting for previous statement completion"); - else return; - } - - if (!_pSession || !_pSession->isConnected()) open(); - logSync(msg); -} - - -void SQLChannel::logSync(const Message& msg) -{ - if (_pArchiveStrategy) _pArchiveStrategy->archive(); - - _source = msg.getSource(); - _pid = msg.getPid(); - _thread = msg.getThread(); - _tid = msg.getTid(); - _priority = msg.getPriority(); - _text = msg.getText(); - _dateTime = msg.getTime(); - if (_source.empty()) _source = _name; - - try - { - _pLogStatement->execute(); - } - catch (Exception&) - { - if (_throw) throw; - } -} - - -void SQLChannel::setProperty(const std::string& name, const std::string& value) -{ - if (name == PROP_NAME) - { - _name = value; - if (_name.empty()) _name = "-"; - } - else if (name == PROP_CONNECTOR) - { - _connector = value; - close(); open(); - } - else if (name == PROP_CONNECT) - { - _connect = value; - close(); open(); - } - else if (name == PROP_TABLE) - { - _table = value; - initLogStatement(); - } - else if (name == PROP_ARCHIVE_TABLE) - { - if (value.empty()) - { - _pArchiveStrategy = 0; - } - else if (_pArchiveStrategy) - { - _pArchiveStrategy->setDestination(value); - } - else - { - _pArchiveStrategy = new ArchiveByAgeStrategy(_connector, _connect, _table, value); - } - } - else if (name == PROP_MAX_AGE) - { - if (value.empty() || "forever" == value) - { - _pArchiveStrategy = 0; - } - else if (_pArchiveStrategy) - { - _pArchiveStrategy->setThreshold(value); - } - else - { - ArchiveByAgeStrategy* p = new ArchiveByAgeStrategy(_connector, _connect, _table); - p->setThreshold(value); - _pArchiveStrategy = p; - } - } - else if (name == PROP_ASYNC) - { - _async = isTrue(value); - initLogStatement(); - } - else if (name == PROP_TIMEOUT) - { - if (value.empty() || '0' == value[0]) - _timeout = Statement::WAIT_FOREVER; - else - _timeout = NumberParser::parse(value); - } - else if (name == PROP_THROW) - { - _throw = isTrue(value); - } - else - { - Channel::setProperty(name, value); - } -} - - -std::string SQLChannel::getProperty(const std::string& name) const -{ - if (name == PROP_NAME) - { - if (_name != "-") return _name; - else return ""; - } - else if (name == PROP_CONNECTOR) - { - return _connector; - } - else if (name == PROP_CONNECT) - { - return _connect; - } - else if (name == PROP_TABLE) - { - return _table; - } - else if (name == PROP_ARCHIVE_TABLE) - { - return _pArchiveStrategy ? _pArchiveStrategy->getDestination() : "" ; - } - else if (name == PROP_MAX_AGE) - { - return _pArchiveStrategy ? _pArchiveStrategy->getThreshold() : "forever"; - } - else if (name == PROP_TIMEOUT) - { - return NumberFormatter::format(_timeout); - } - else if (name == PROP_THROW) - { - if (_throw) return "true"; - else return "false"; - } - else - { - return Channel::getProperty(name); - } -} - - -void SQLChannel::initLogStatement() -{ - _pLogStatement = new Statement(*_pSession); - - std::string sql; - Poco::format(sql, "INSERT INTO %s VALUES (?,?,?,?,?,?,?,?)", _table); - *_pLogStatement << sql, - use(_source), - use(_name), - use(_pid), - use(_thread), - use(_tid), - use(_priority), - use(_text), - use(_dateTime); - - if (_async) _pLogStatement->setAsync(); -} - - -void SQLChannel::registerChannel() -{ - Poco::LoggingFactory::defaultFactory().registerChannelClass("SQLChannel", - new Poco::Instantiator<SQLChannel, Poco::Channel>); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Session.cpp b/contrib/libs/poco/Data/src/Session.cpp deleted file mode 100644 index e2cc6b6dd3..0000000000 --- a/contrib/libs/poco/Data/src/Session.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// -// Session.cpp -// -// Library: Data -// Package: DataCore -// Module: Session -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Session.h" -#include "Poco/Data/SessionFactory.h" -#include "Poco/String.h" -#include "Poco/URI.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -Session::Session(Poco::AutoPtr<SessionImpl> pImpl): - _pImpl(pImpl), - _statementCreator(pImpl) -{ - poco_check_ptr (pImpl.get()); -} - - -Session::Session(const std::string& connector, - const std::string& connectionString, - std::size_t timeout) -{ - Session newSession(SessionFactory::instance().create(connector, connectionString, timeout)); - swap(newSession); -} - - -Session::Session(const std::string& connection, - std::size_t timeout) -{ - Session newSession(SessionFactory::instance().create(connection, timeout)); - swap(newSession); -} - - -Session::Session(const Session& other): _pImpl(other._pImpl), - _statementCreator(other._pImpl) -{ -} - - -Session::~Session() -{ -} - - -Session& Session::operator = (const Session& other) -{ - Session tmp(other); - swap(tmp); - return *this; -} - - -void Session::swap(Session& other) -{ - using std::swap; - swap(_statementCreator, other._statementCreator); - swap(_pImpl, other._pImpl); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SessionFactory.cpp b/contrib/libs/poco/Data/src/SessionFactory.cpp deleted file mode 100644 index bcc5c412f1..0000000000 --- a/contrib/libs/poco/Data/src/SessionFactory.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// -// SessionFactory.cpp -// -// Library: Data -// Package: DataCore -// Module: SessionFactory -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SessionFactory.h" -#include "Poco/URI.h" -#include "Poco/String.h" - - -namespace Poco { -namespace Data { - - -SessionFactory::SessionFactory() -{ -} - - -SessionFactory::~SessionFactory() -{ -} - - -SessionFactory& SessionFactory::instance() -{ - static SessionFactory sf; - return sf; -} - - -void SessionFactory::add(Connector* pIn) -{ - Poco::FastMutex::ScopedLock lock(_mutex); - SessionInfo info(pIn); - std::pair<Connectors::iterator, bool> res = - _connectors.insert(std::make_pair(pIn->name(), info)); - if (!res.second) res.first->second.cnt++; -} - - -void SessionFactory::remove(const std::string& key) -{ - Poco::FastMutex::ScopedLock lock(_mutex); - Connectors::iterator it = _connectors.find(key); - poco_assert (_connectors.end() != it); - - --(it->second.cnt); - if (it->second.cnt == 0) _connectors.erase(it); -} - - -Session SessionFactory::create(const std::string& key, - const std::string& connectionString, - std::size_t timeout) -{ - Poco::SharedPtr<Connector> ptrSI; - { - Poco::FastMutex::ScopedLock lock(_mutex); - Connectors::iterator it = _connectors.find(key); - if (_connectors.end() == it) throw Poco::NotFoundException(key); - ptrSI = it->second.ptrSI; - } - return Session(ptrSI->createSession(connectionString, timeout)); -} - - -Session SessionFactory::create(const std::string& uri, - std::size_t timeout) -{ - URI u(uri); - poco_assert (!u.getPath().empty()); - return create(u.getScheme(), u.getPath().substr(1), timeout); -} - - -SessionFactory::SessionInfo::SessionInfo(Connector* pSI): - cnt(1), - ptrSI(pSI) -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SessionImpl.cpp b/contrib/libs/poco/Data/src/SessionImpl.cpp deleted file mode 100644 index a422f75169..0000000000 --- a/contrib/libs/poco/Data/src/SessionImpl.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// -// SessionImpl.cpp -// -// Library: Data -// Package: DataCore -// Module: SessionImpl -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SessionImpl.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace Data { - - -SessionImpl::SessionImpl(const std::string& connectionString, std::size_t timeout): - _connectionString(connectionString), - _loginTimeout(timeout) -{ -} - - -SessionImpl::~SessionImpl() -{ -} - - -void SessionImpl::reconnect() -{ - close(); - open(); -} - - -void SessionImpl::setConnectionString(const std::string& connectionString) -{ - if (isConnected()) - throw Poco::InvalidAccessException("Can not change connection string on connected session." - " Close the session first."); - - _connectionString = connectionString; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SessionPool.cpp b/contrib/libs/poco/Data/src/SessionPool.cpp deleted file mode 100644 index 095b38cfc3..0000000000 --- a/contrib/libs/poco/Data/src/SessionPool.cpp +++ /dev/null @@ -1,308 +0,0 @@ -// -// SessionPool.cpp -// -// Library: Data -// Package: SessionPooling -// Module: SessionPool -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SessionPool.h" -#include "Poco/Data/SessionFactory.h" -#include "Poco/Data/DataException.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -SessionPool::SessionPool(const std::string& connector, const std::string& connectionString, int minSessions, int maxSessions, int idleTime): - _connector(connector), - _connectionString(connectionString), - _minSessions(minSessions), - _maxSessions(maxSessions), - _idleTime(idleTime), - _nSessions(0), - _janitorTimer(1000*idleTime, 1000*idleTime/4), - _shutdown(false) -{ - Poco::TimerCallback<SessionPool> callback(*this, &SessionPool::onJanitorTimer); - _janitorTimer.start(callback); -} - - -SessionPool::~SessionPool() -{ - try - { - shutdown(); - } - catch (...) - { - poco_unexpected(); - } -} - - -Session SessionPool::get(const std::string& name, bool value) -{ - Session s = get(); - _addFeatureMap.insert(AddFeatureMap::value_type(s.impl(), - std::make_pair(name, s.getFeature(name)))); - s.setFeature(name, value); - - return s; -} - - -Session SessionPool::get() -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) throw InvalidAccessException("Session pool has been shut down."); - - purgeDeadSessions(); - - if (_idleSessions.empty()) - { - if (_nSessions < _maxSessions) - { - Session newSession(SessionFactory::instance().create(_connector, _connectionString)); - applySettings(newSession.impl()); - customizeSession(newSession); - - PooledSessionHolderPtr pHolder(new PooledSessionHolder(*this, newSession.impl())); - _idleSessions.push_front(pHolder); - ++_nSessions; - } - else throw SessionPoolExhaustedException(_connector); - } - - PooledSessionHolderPtr pHolder(_idleSessions.front()); - PooledSessionImplPtr pPSI(new PooledSessionImpl(pHolder)); - - _activeSessions.push_front(pHolder); - _idleSessions.pop_front(); - return Session(pPSI); -} - - -void SessionPool::purgeDeadSessions() -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) return; - - SessionList::iterator it = _idleSessions.begin(); - for (; it != _idleSessions.end(); ) - { - if (!(*it)->session()->isConnected()) - { - it = _idleSessions.erase(it); - --_nSessions; - } - else ++it; - } -} - - -int SessionPool::capacity() const -{ - return _maxSessions; -} - - -int SessionPool::used() const -{ - Poco::Mutex::ScopedLock lock(_mutex); - return (int) _activeSessions.size(); -} - - -int SessionPool::idle() const -{ - Poco::Mutex::ScopedLock lock(_mutex); - return (int) _idleSessions.size(); -} - - -int SessionPool::dead() -{ - Poco::Mutex::ScopedLock lock(_mutex); - int count = 0; - - SessionList::iterator it = _activeSessions.begin(); - SessionList::iterator itEnd = _activeSessions.end(); - for (; it != itEnd; ++it) - { - if (!(*it)->session()->isConnected()) - ++count; - } - - return count; -} - - -int SessionPool::allocated() const -{ - Poco::Mutex::ScopedLock lock(_mutex); - return _nSessions; -} - - -int SessionPool::available() const -{ - if (_shutdown) return 0; - return _maxSessions - used(); -} - - -void SessionPool::setFeature(const std::string& name, bool state) -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) throw InvalidAccessException("Session pool has been shut down."); - - if (_nSessions > 0) - throw InvalidAccessException("Features can not be set after the first session was created."); - - _featureMap.insert(FeatureMap::ValueType(name, state)); -} - - -bool SessionPool::getFeature(const std::string& name) -{ - FeatureMap::ConstIterator it = _featureMap.find(name); - if (_shutdown) throw InvalidAccessException("Session pool has been shut down."); - - if (_featureMap.end() == it) - throw NotFoundException("Feature not found:" + name); - - return it->second; -} - - -void SessionPool::setProperty(const std::string& name, const Poco::Any& value) -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) throw InvalidAccessException("Session pool has been shut down."); - - if (_nSessions > 0) - throw InvalidAccessException("Properties can not be set after first session was created."); - - _propertyMap.insert(PropertyMap::ValueType(name, value)); -} - - -Poco::Any SessionPool::getProperty(const std::string& name) -{ - PropertyMap::ConstIterator it = _propertyMap.find(name); - - if (_propertyMap.end() == it) - throw NotFoundException("Property not found:" + name); - - return it->second; -} - - -void SessionPool::applySettings(SessionImpl* pImpl) -{ - FeatureMap::Iterator fmIt = _featureMap.begin(); - FeatureMap::Iterator fmEnd = _featureMap.end(); - for (; fmIt != fmEnd; ++fmIt) pImpl->setFeature(fmIt->first, fmIt->second); - - PropertyMap::Iterator pmIt = _propertyMap.begin(); - PropertyMap::Iterator pmEnd = _propertyMap.end(); - for (; pmIt != pmEnd; ++pmIt) pImpl->setProperty(pmIt->first, pmIt->second); -} - - -void SessionPool::customizeSession(Session&) -{ -} - - -void SessionPool::putBack(PooledSessionHolderPtr pHolder) -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) return; - - SessionList::iterator it = std::find(_activeSessions.begin(), _activeSessions.end(), pHolder); - if (it != _activeSessions.end()) - { - if (pHolder->session()->isConnected()) - { - // reverse settings applied at acquisition time, if any - AddPropertyMap::iterator pIt = _addPropertyMap.find(pHolder->session()); - if (pIt != _addPropertyMap.end()) - pHolder->session()->setProperty(pIt->second.first, pIt->second.second); - - AddFeatureMap::iterator fIt = _addFeatureMap.find(pHolder->session()); - if (fIt != _addFeatureMap.end()) - pHolder->session()->setFeature(fIt->second.first, fIt->second.second); - - // re-apply the default pool settings - applySettings(pHolder->session()); - - pHolder->access(); - _idleSessions.push_front(pHolder); - } - else --_nSessions; - - _activeSessions.erase(it); - } - else - { - poco_bugcheck_msg("Unknown session passed to SessionPool::putBack()"); - } -} - - -void SessionPool::onJanitorTimer(Poco::Timer&) -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) return; - - SessionList::iterator it = _idleSessions.begin(); - while (_nSessions > _minSessions && it != _idleSessions.end()) - { - if ((*it)->idle() > _idleTime || !(*it)->session()->isConnected()) - { - try { (*it)->session()->close(); } - catch (...) { } - it = _idleSessions.erase(it); - --_nSessions; - } - else ++it; - } -} - - -void SessionPool::shutdown() -{ - Poco::Mutex::ScopedLock lock(_mutex); - if (_shutdown) return; - _shutdown = true; - _janitorTimer.stop(); - closeAll(_idleSessions); - closeAll(_activeSessions); -} - - -void SessionPool::closeAll(SessionList& sessionList) -{ - SessionList::iterator it = sessionList.begin(); - for (; it != sessionList.end();) - { - try { (*it)->session()->close(); } - catch (...) { } - it = sessionList.erase(it); - if (_nSessions > 0) --_nSessions; - } -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SessionPoolContainer.cpp b/contrib/libs/poco/Data/src/SessionPoolContainer.cpp deleted file mode 100644 index 1fd1bb292c..0000000000 --- a/contrib/libs/poco/Data/src/SessionPoolContainer.cpp +++ /dev/null @@ -1,122 +0,0 @@ -// -// SessionPoolContainer.cpp -// -// Library: Data -// Package: SessionPooling -// Module: SessionPoolContainer -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SessionPoolContainer.h" -#include "Poco/Data/SessionFactory.h" -#include "Poco/Data/DataException.h" -#include "Poco/URI.h" -#include "Poco/String.h" -#include "Poco/Exception.h" -#include <algorithm> - - -using Poco::FastMutex; - - -namespace Poco { -namespace Data { - - -SessionPoolContainer::SessionPoolContainer() -{ -} - - -SessionPoolContainer::~SessionPoolContainer() -{ -} - - -void SessionPoolContainer::add(SessionPool* pPool) -{ - poco_check_ptr (pPool); - - FastMutex::ScopedLock lock(_mutex); - if (_sessionPools.find(pPool->name()) != _sessionPools.end()) - throw SessionPoolExistsException("Session pool already exists: " + pPool->name()); - - pPool->duplicate(); - _sessionPools.insert(SessionPoolMap::value_type(pPool->name(), pPool)); -} - - -Session SessionPoolContainer::add(const std::string& sessionKey, - const std::string& connectionString, - int minSessions, - int maxSessions, - int idleTime) -{ - std::string name = SessionPool::name(sessionKey, connectionString); - - FastMutex::ScopedLock lock(_mutex); - SessionPoolMap::iterator it = _sessionPools.find(name); - - // pool already exists, silently return a session from it - if (it != _sessionPools.end()) return it->second->get(); - - SessionPool* pSP = - new SessionPool(sessionKey, connectionString, minSessions, maxSessions, idleTime); - - std::pair<SessionPoolMap::iterator, bool> ins = - _sessionPools.insert(SessionPoolMap::value_type(name, pSP)); - - return ins.first->second->get(); -} - - -bool SessionPoolContainer::isActive(const std::string& sessionKey, - const std::string& connectionString) const -{ - std::string name = connectionString.empty() ? - sessionKey : SessionPool::name(sessionKey, connectionString); - - SessionPoolMap::const_iterator it = _sessionPools.find(name); - if (it != _sessionPools.end() && it->second->isActive()) - { - return true; - } - - return false; -} - - -Session SessionPoolContainer::get(const std::string& name) -{ - return getPool(name).get(); -} - - -SessionPool& SessionPoolContainer::getPool(const std::string& name) -{ - URI uri(name); - std::string path = uri.getPath(); - poco_assert (!path.empty()); - std::string n = Session::uri(uri.getScheme(), path.substr(1)); - - FastMutex::ScopedLock lock(_mutex); - SessionPoolMap::iterator it = _sessionPools.find(n); - if (_sessionPools.end() == it) throw NotFoundException(n); - return *it->second; -} - - -void SessionPoolContainer::shutdown() -{ - SessionPoolMap::iterator it = _sessionPools.begin(); - SessionPoolMap::iterator end = _sessionPools.end(); - for (; it != end; ++it) it->second->shutdown(); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/SimpleRowFormatter.cpp b/contrib/libs/poco/Data/src/SimpleRowFormatter.cpp deleted file mode 100644 index 839eb86e52..0000000000 --- a/contrib/libs/poco/Data/src/SimpleRowFormatter.cpp +++ /dev/null @@ -1,113 +0,0 @@ -// -// RowFormatter.cpp -// -// Library: Data -// Package: DataCore -// Module: RowFormatter -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/SimpleRowFormatter.h" -#include "Poco/Exception.h" -#include <iomanip> - - -namespace Poco { -namespace Data { - - -SimpleRowFormatter::SimpleRowFormatter(std::streamsize columnWidth, std::streamsize spacing): - _colWidth(columnWidth), _spacing(spacing), _rowCount(0) -{ -} - - -SimpleRowFormatter::SimpleRowFormatter(const SimpleRowFormatter& other): - RowFormatter(other.prefix(), other.postfix()), - _colWidth(other._colWidth), - _spacing(other._spacing), - _rowCount(0) -{ -} - - -SimpleRowFormatter::~SimpleRowFormatter() -{ -} - - -SimpleRowFormatter& SimpleRowFormatter::operator = (const SimpleRowFormatter& row) -{ - SimpleRowFormatter tmp(row); - swap(tmp); - return *this; -} - - -void SimpleRowFormatter::swap(SimpleRowFormatter& other) -{ - using std::swap; - - setPrefix(other.prefix()); - setPostfix(other.postfix()); - swap(_colWidth, other._colWidth); - swap(_spacing, other._spacing); -} - - -std::string& SimpleRowFormatter::formatNames(const NameVecPtr pNames, std::string& formattedNames) -{ - _rowCount = 0; - - std::ostringstream str; - std::string line(std::string::size_type(pNames->size()*_colWidth + (pNames->size() - 1)*_spacing), '-'); - std::string space(_spacing, ' '); - NameVec::const_iterator it = pNames->begin(); - NameVec::const_iterator end = pNames->end(); - for (; it != end; ++it) - { - if (it != pNames->begin()) str << space; - str << std::left << std::setw(_colWidth) << *it; - } - str << std::endl << line << std::endl; - - return formattedNames = str.str(); -} - - -std::string& SimpleRowFormatter::formatValues(const ValueVec& vals, std::string& formattedValues) -{ - std::ostringstream str; - std::string space(_spacing, ' '); - ValueVec::const_iterator it = vals.begin(); - ValueVec::const_iterator end = vals.end(); - for (; it != end; ++it) - { - if (it != vals.begin()) str << space; - if (it->isNumeric()) - { - str << std::right - << std::fixed - << std::setprecision(2); - } - else str << std::left; - - if (!it->isEmpty()) - str << std::setw(_colWidth) << it->convert<std::string>(); - else - str << std::setw(_colWidth) << "null"; - } - str << std::endl; - - ++_rowCount; - - return formattedValues = str.str(); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Statement.cpp b/contrib/libs/poco/Data/src/Statement.cpp deleted file mode 100644 index d4c470ae83..0000000000 --- a/contrib/libs/poco/Data/src/Statement.cpp +++ /dev/null @@ -1,296 +0,0 @@ -// -// Statement.cpp -// -// Library: Data -// Package: DataCore -// Module: Statement -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Statement.h" -#include "Poco/Data/DataException.h" -#include "Poco/Data/Extraction.h" -#include "Poco/Data/Session.h" -#include "Poco/Data/Bulk.h" -#include "Poco/Any.h" -#include "Poco/Tuple.h" -#include "Poco/ActiveMethod.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -Statement::Statement(StatementImpl::Ptr pImpl): - _pImpl(pImpl), - _async(false) -{ - poco_check_ptr (pImpl); -} - - -Statement::Statement(Session& session): - _async(false) -{ - reset(session); -} - - -Statement::Statement(const Statement& stmt): - _pImpl(stmt._pImpl), - _async(stmt._async), - _pResult(stmt._pResult), - _pAsyncExec(stmt._pAsyncExec), - _arguments(stmt._arguments), - _pRowFormatter(stmt._pRowFormatter) -{ -} - - -Statement::~Statement() -{ -} - - -Statement& Statement::operator = (const Statement& stmt) -{ - Statement tmp(stmt); - swap(tmp); - return *this; -} - - -void Statement::swap(Statement& other) -{ - using std::swap; - - swap(_pImpl, other._pImpl); - swap(_async, other._async); - swap(_pAsyncExec, other._pAsyncExec); - swap(_pResult, other._pResult); - _arguments.swap(other._arguments); - swap(_pRowFormatter, other._pRowFormatter); -} - - -Statement& Statement::reset(Session& session) -{ - Statement stmt(session.createStatementImpl()); - swap(stmt); - return *this; -} - - -std::size_t Statement::execute(bool reset) -{ - Mutex::ScopedLock lock(_mutex); - bool isDone = done(); - if (initialized() || paused() || isDone) - { - if (_arguments.size()) - { - _pImpl->formatSQL(_arguments); - _arguments.clear(); - } - - if (!isAsync()) - { - if (isDone) _pImpl->reset(); - return _pImpl->execute(reset); - } - else - { - doAsyncExec(); - return 0; - } - } - else throw InvalidAccessException("Statement still executing."); -} - - -const Statement::Result& Statement::executeAsync(bool reset) -{ - Mutex::ScopedLock lock(_mutex); - if (initialized() || paused() || done()) - return doAsyncExec(reset); - else - throw InvalidAccessException("Statement still executing."); -} - - -const Statement::Result& Statement::doAsyncExec(bool reset) -{ - if (done()) _pImpl->reset(); - if (!_pAsyncExec) - _pAsyncExec = new AsyncExecMethod(_pImpl, &StatementImpl::execute); - _pResult = new Result((*_pAsyncExec)(reset)); - return *_pResult; -} - - -void Statement::setAsync(bool async) -{ - _async = async; - if (_async && !_pAsyncExec) - _pAsyncExec = new AsyncExecMethod(_pImpl, &StatementImpl::execute); -} - - -std::size_t Statement::wait(long milliseconds) -{ - if (!_pResult) return 0; - bool success = true; - if (WAIT_FOREVER != milliseconds) - success = _pResult->tryWait(milliseconds); - else - _pResult->wait(); - - if (_pResult->exception()) - throw *_pResult->exception(); - else if (!success) - throw TimeoutException("Statement timed out."); - - return _pResult->data(); -} - - -const std::string& Statement::getStorage() const -{ - switch (storage()) - { - case STORAGE_VECTOR: - return StatementImpl::VECTOR; - case STORAGE_LIST: - return StatementImpl::LIST; - case STORAGE_DEQUE: - return StatementImpl::DEQUE; - case STORAGE_UNKNOWN: - return StatementImpl::UNKNOWN; - } - - throw IllegalStateException("Invalid storage setting."); -} - - -Statement& Statement::operator , (Manipulator manip) -{ - manip(*this); - return *this; -} - - -Statement& Statement::addBind(AbstractBinding::Ptr pBind) -{ - if (pBind->isBulk()) - { - if (!_pImpl->isBulkSupported()) - throw InvalidAccessException("Bulk not supported by this session."); - - if(_pImpl->bulkBindingAllowed()) - _pImpl->setBulkBinding(); - else - throw InvalidAccessException("Bulk and non-bulk binding modes can not be mixed."); - } - else _pImpl->forbidBulk(); - - _pImpl->addBind(pBind); - return *this; -} - - -Statement& Statement::addExtract(AbstractExtraction::Ptr pExtract) -{ - if (pExtract->isBulk()) - { - if (!_pImpl->isBulkSupported()) - throw InvalidAccessException("Bulk not supported by this session."); - - if(_pImpl->bulkExtractionAllowed()) - { - Bulk b(pExtract->getLimit()); - _pImpl->setBulkExtraction(b); - } - else - throw InvalidAccessException("Bulk and non-bulk extraction modes can not be mixed."); - } - else _pImpl->forbidBulk(); - - _pImpl->addExtract(pExtract); - return *this; -} - - -Statement& Statement::operator , (const Limit& extrLimit) -{ - if (_pImpl->isBulkExtraction() && _pImpl->extractionLimit() != extrLimit) - throw InvalidArgumentException("Limit for bulk extraction already set."); - - _pImpl->setExtractionLimit(extrLimit); - return *this; -} - - -Statement& Statement::operator , (const Range& extrRange) -{ - if (_pImpl->isBulkExtraction()) - throw InvalidAccessException("Can not set range for bulk extraction."); - - _pImpl->setExtractionLimit(extrRange.lower()); - _pImpl->setExtractionLimit(extrRange.upper()); - return *this; -} - - -Statement& Statement::operator , (const Bulk& bulk) -{ - if (!_pImpl->isBulkSupported()) - throw InvalidAccessException("Bulk not supported by this session."); - - if (0 == _pImpl->extractions().size() && - 0 == _pImpl->bindings().size() && - _pImpl->bulkExtractionAllowed() && - _pImpl->bulkBindingAllowed()) - { - _pImpl->setBulkExtraction(bulk); - _pImpl->setBulkBinding(); - } - else - throw InvalidAccessException("Can not set bulk operations."); - - return *this; -} - - -Statement& Statement::operator , (BulkFnType) -{ - const Limit& limit(_pImpl->extractionLimit()); - if (limit.isHardLimit() || - limit.isLowerLimit() || - Limit::LIMIT_UNLIMITED == limit.value()) - { - throw InvalidAccessException("Bulk is only allowed with limited extraction," - "non-hard and zero-based limits."); - } - - Bulk bulk(limit); - _pImpl->setBulkExtraction(bulk); - _pImpl->setBulkBinding(); - - return *this; -} - - -Session Statement::session() -{ - Poco::AutoPtr<SessionImpl> ps(&impl()->session(), true); - return Session(ps); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/StatementCreator.cpp b/contrib/libs/poco/Data/src/StatementCreator.cpp deleted file mode 100644 index 6fd944aa00..0000000000 --- a/contrib/libs/poco/Data/src/StatementCreator.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// -// StatementCreator.cpp -// -// Library: Data -// Package: DataCore -// Module: StatementCreator -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/StatementCreator.h" -#include <algorithm> - - -namespace Poco { -namespace Data { - - -StatementCreator::StatementCreator() -{ -} - - -StatementCreator::StatementCreator(Poco::AutoPtr<SessionImpl> ptrImpl): - _ptrImpl(ptrImpl) -{ -} - - -StatementCreator::StatementCreator(const StatementCreator& other): - _ptrImpl(other._ptrImpl) -{ -} - - -StatementCreator& StatementCreator::operator = (const StatementCreator& other) -{ - StatementCreator tmp(other); - swap(tmp); - return *this; -} - - -void StatementCreator::swap(StatementCreator& other) -{ - using std::swap; - swap(_ptrImpl, other._ptrImpl); -} - - -StatementCreator::~StatementCreator() -{ -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/StatementImpl.cpp b/contrib/libs/poco/Data/src/StatementImpl.cpp deleted file mode 100644 index 43d2c362c1..0000000000 --- a/contrib/libs/poco/Data/src/StatementImpl.cpp +++ /dev/null @@ -1,476 +0,0 @@ -// -// StatementImpl.cpp -// -// Library: Data -// Package: DataCore -// Module: StatementImpl -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/StatementImpl.h" -#include "Poco/Data/SessionImpl.h" -#include "Poco/Data/DataException.h" -#include "Poco/Data/AbstractBinder.h" -#include "Poco/Data/Extraction.h" -#include "Poco/Data/LOB.h" -#include "Poco/Data/Date.h" -#include "Poco/Data/Time.h" -#include "Poco/SharedPtr.h" -#include "Poco/DateTime.h" -#include "Poco/Exception.h" -#include "Poco/Data/DataException.h" - - -using Poco::icompare; - - -namespace Poco { -namespace Data { - - -using namespace Keywords; - - -const std::string StatementImpl::VECTOR = "vector"; -const std::string StatementImpl::LIST = "list"; -const std::string StatementImpl::DEQUE = "deque"; -const std::string StatementImpl::UNKNOWN = "unknown"; - - -StatementImpl::StatementImpl(SessionImpl& rSession): - _state(ST_INITIALIZED), - _extrLimit(upperLimit(Limit::LIMIT_UNLIMITED, false)), - _lowerLimit(0), - _rSession(rSession), - _storage(STORAGE_UNKNOWN_IMPL), - _ostr(), - _curDataSet(0), - _bulkBinding(BULK_UNDEFINED), - _bulkExtraction(BULK_UNDEFINED) -{ - if (!_rSession.isConnected()) - throw NotConnectedException(_rSession.connectionString()); - - _extractors.resize(1); - _columnsExtracted.resize(1, 0); - _subTotalRowCount.resize(1, 0); -} - - -StatementImpl::~StatementImpl() -{ -} - - -std::size_t StatementImpl::execute(const bool& reset) -{ - if (reset) resetExtraction(); - - if (!_rSession.isConnected()) - { - _state = ST_DONE; - throw NotConnectedException(_rSession.connectionString()); - } - - std::size_t lim = 0; - if (_lowerLimit > _extrLimit.value()) - throw LimitException("Illegal Statement state. Upper limit must not be smaller than the lower limit."); - - do - { - compile(); - if (_extrLimit.value() == Limit::LIMIT_UNLIMITED) - lim += executeWithoutLimit(); - else - lim += executeWithLimit(); - } while (canCompile()); - - if (_extrLimit.value() == Limit::LIMIT_UNLIMITED) - _state = ST_DONE; - - if (lim < _lowerLimit) - throw LimitException("Did not receive enough data."); - - assignSubTotal(reset); - - return lim; -} - - -void StatementImpl::assignSubTotal(bool reset) -{ - if (_extractors.size() == _subTotalRowCount.size()) - { - CountVec::iterator it = _subTotalRowCount.begin(); - CountVec::iterator end = _subTotalRowCount.end(); - for (int counter = 0; it != end; ++it, ++counter) - { - if (_extractors[counter].size()) - { - if (reset) - *it = CountVec::value_type(_extractors[counter][0]->numOfRowsHandled()); - else - *it += CountVec::value_type(_extractors[counter][0]->numOfRowsHandled()); - } - } - } -} - - -std::size_t StatementImpl::executeWithLimit() -{ - poco_assert (_state != ST_DONE); - std::size_t count = 0; - std::size_t limit = _extrLimit.value(); - - do - { - bind(); - while (count < limit && hasNext()) - count += next(); - } while (count < limit && canBind()); - - if (!canBind() && (!hasNext() || limit == 0)) - _state = ST_DONE; - else if (hasNext() && limit == count && _extrLimit.isHardLimit()) - throw LimitException("HardLimit reached (retrieved more data than requested)."); - else - _state = ST_PAUSED; - - int affectedRows = affectedRowCount(); - if (count == 0) - { - if (affectedRows > 0) - return affectedRows; - } - - return count; -} - - -std::size_t StatementImpl::executeWithoutLimit() -{ - poco_assert (_state != ST_DONE); - std::size_t count = 0; - - do - { - bind(); - while (hasNext()) count += next(); - } while (canBind()); - - int affectedRows = affectedRowCount(); - if (count == 0) - { - if (affectedRows > 0) - return affectedRows; - } - - return count; -} - - -void StatementImpl::compile() -{ - if (_state == ST_INITIALIZED || - _state == ST_RESET || - _state == ST_BOUND) - { - compileImpl(); - _state = ST_COMPILED; - - if (!extractions().size() && !isStoredProcedure()) - { - std::size_t cols = columnsReturned(); - if (cols) makeExtractors(cols); - } - - fixupExtraction(); - fixupBinding(); - } -} - - -void StatementImpl::bind() -{ - if (_state == ST_COMPILED) - { - bindImpl(); - _state = ST_BOUND; - } - else if (_state == ST_BOUND) - { - if (!hasNext()) - { - if (canBind()) bindImpl(); - else _state = ST_DONE; - } - } -} - - -void StatementImpl::reset() -{ - resetBinding(); - resetExtraction(); - _state = ST_RESET; -} - - -void StatementImpl::setExtractionLimit(const Limit& extrLimit) -{ - if (!extrLimit.isLowerLimit()) - _extrLimit = extrLimit; - else - _lowerLimit = extrLimit.value(); -} - - -void StatementImpl::setBulkExtraction(const Bulk& b) -{ - Limit::SizeT limit = getExtractionLimit(); - if (Limit::LIMIT_UNLIMITED != limit && b.size() != limit) - throw InvalidArgumentException("Can not set limit for statement."); - - setExtractionLimit(b.limit()); - _bulkExtraction = BULK_EXTRACTION; -} - - -void StatementImpl::fixupExtraction() -{ - CountVec::iterator sIt = _subTotalRowCount.begin(); - CountVec::iterator sEnd = _subTotalRowCount.end(); - for (; sIt != sEnd; ++sIt) *sIt = 0; - - if (_curDataSet >= _columnsExtracted.size()) - { - _columnsExtracted.resize(_curDataSet + 1, 0); - _subTotalRowCount.resize(_curDataSet + 1, 0); - } - - Poco::Data::AbstractExtractionVec::iterator it = extractions().begin(); - Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end(); - for (; it != itEnd; ++it) - { - (*it)->setExtractor(extractor()); - (*it)->setLimit(_extrLimit.value()), - _columnsExtracted[_curDataSet] += (int)(*it)->numOfColumnsHandled(); - } -} - - -void StatementImpl::fixupBinding() -{ - // no need to call binder().reset(); here will be called before each bind anyway - AbstractBindingVec::iterator it = bindings().begin(); - AbstractBindingVec::iterator itEnd = bindings().end(); - for (; it != itEnd; ++it) (*it)->setBinder(binder()); -} - - -void StatementImpl::resetBinding() -{ - AbstractBindingVec::iterator it = bindings().begin(); - AbstractBindingVec::iterator itEnd = bindings().end(); - for (; it != itEnd; ++it) (*it)->reset(); -} - - -void StatementImpl::resetExtraction() -{ - Poco::Data::AbstractExtractionVec::iterator it = extractions().begin(); - Poco::Data::AbstractExtractionVec::iterator itEnd = extractions().end(); - for (; it != itEnd; ++it) (*it)->reset(); - - poco_assert (_curDataSet < _columnsExtracted.size()); - _columnsExtracted[_curDataSet] = 0; -} - - -void StatementImpl::setStorage(const std::string& storage) -{ - if (0 == icompare(DEQUE, storage)) - _storage = STORAGE_DEQUE_IMPL; - else if (0 == icompare(VECTOR, storage)) - _storage = STORAGE_VECTOR_IMPL; - else if (0 == icompare(LIST, storage)) - _storage = STORAGE_LIST_IMPL; - else if (0 == icompare(UNKNOWN, storage)) - _storage = STORAGE_UNKNOWN_IMPL; - else - throw NotFoundException(); -} - - -void StatementImpl::makeExtractors(std::size_t count) -{ - for (int i = 0; i < count; ++i) - { - const MetaColumn& mc = metaColumn(i); - switch (mc.type()) - { - case MetaColumn::FDT_BOOL: - addInternalExtract<bool>(mc); break; - case MetaColumn::FDT_INT8: - addInternalExtract<Int8>(mc); break; - case MetaColumn::FDT_UINT8: - addInternalExtract<UInt8>(mc); break; - case MetaColumn::FDT_INT16: - addInternalExtract<Int16>(mc); break; - case MetaColumn::FDT_UINT16: - addInternalExtract<UInt16>(mc); break; - case MetaColumn::FDT_INT32: - addInternalExtract<Int32>(mc); break; - case MetaColumn::FDT_UINT32: - addInternalExtract<UInt32>(mc); break; - case MetaColumn::FDT_INT64: - addInternalExtract<Int64>(mc); break; - case MetaColumn::FDT_UINT64: - addInternalExtract<UInt64>(mc); break; - case MetaColumn::FDT_FLOAT: - addInternalExtract<float>(mc); break; - case MetaColumn::FDT_DOUBLE: - addInternalExtract<double>(mc); break; - case MetaColumn::FDT_STRING: - addInternalExtract<std::string>(mc); break; - case MetaColumn::FDT_WSTRING: - addInternalExtract<Poco::UTF16String>(mc); break; - case MetaColumn::FDT_BLOB: - addInternalExtract<BLOB>(mc); break; - case MetaColumn::FDT_DATE: - addInternalExtract<Date>(mc); break; - case MetaColumn::FDT_TIME: - addInternalExtract<Time>(mc); break; - case MetaColumn::FDT_TIMESTAMP: - addInternalExtract<DateTime>(mc); break; - default: - throw Poco::InvalidArgumentException("Data type not supported."); - } - } -} - - -const MetaColumn& StatementImpl::metaColumn(const std::string& name) const -{ - std::size_t cols = columnsReturned(); - for (std::size_t i = 0; i < cols; ++i) - { - const MetaColumn& column = metaColumn(i); - if (0 == icompare(column.name(), name)) return column; - } - - throw NotFoundException(format("Invalid column name: %s", name)); -} - - -std::size_t StatementImpl::activateNextDataSet() -{ - if (_curDataSet + 1 < dataSetCount()) - return ++_curDataSet; - else - throw NoDataException("End of data sets reached."); -} - - -std::size_t StatementImpl::activatePreviousDataSet() -{ - if (_curDataSet > 0) - return --_curDataSet; - else - throw NoDataException("Beginning of data sets reached."); -} - - -void StatementImpl::addExtract(AbstractExtraction::Ptr pExtraction) -{ - poco_check_ptr (pExtraction); - std::size_t pos = pExtraction->position(); - if (pos >= _extractors.size()) - _extractors.resize(pos + 1); - - pExtraction->setEmptyStringIsNull( - _rSession.getFeature("emptyStringIsNull")); - - pExtraction->setForceEmptyString( - _rSession.getFeature("forceEmptyString")); - - _extractors[pos].push_back(pExtraction); -} - - -void StatementImpl::removeBind(const std::string& name) -{ - bool found = false; - - AbstractBindingVec::iterator it = _bindings.begin(); - for (; it != _bindings.end();) - { - if ((*it)->name() == name) - { - it = _bindings.erase(it); - found = true; - } - else ++it; - } - - if (!found) - throw NotFoundException(name); -} - - -std::size_t StatementImpl::columnsExtracted(int dataSet) const -{ - if (USE_CURRENT_DATA_SET == dataSet) dataSet = static_cast<int>(_curDataSet); - if (_columnsExtracted.size() > 0) - { - poco_assert (dataSet >= 0 && dataSet < _columnsExtracted.size()); - return _columnsExtracted[dataSet]; - } - - return 0; -} - - -std::size_t StatementImpl::rowsExtracted(int dataSet) const -{ - if (USE_CURRENT_DATA_SET == dataSet) dataSet = static_cast<int>(_curDataSet); - if (extractions().size() > 0) - { - poco_assert (dataSet >= 0 && dataSet < _extractors.size()); - if (_extractors[dataSet].size() > 0) - return _extractors[dataSet][0]->numOfRowsHandled(); - } - - return 0; -} - - -std::size_t StatementImpl::subTotalRowCount(int dataSet) const -{ - if (USE_CURRENT_DATA_SET == dataSet) dataSet = static_cast<int>(_curDataSet); - if (_subTotalRowCount.size() > 0) - { - poco_assert (dataSet >= 0 && dataSet < _subTotalRowCount.size()); - return _subTotalRowCount[dataSet]; - } - - return 0; -} - - -void StatementImpl::formatSQL(std::vector<Any>& arguments) -{ - std::string sql; - Poco::format(sql, _ostr.str(), arguments); - _ostr.str(""); - _ostr << sql; -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/src/Time.cpp b/contrib/libs/poco/Data/src/Time.cpp deleted file mode 100644 index de54b96e74..0000000000 --- a/contrib/libs/poco/Data/src/Time.cpp +++ /dev/null @@ -1,139 +0,0 @@ -// -// Time.cpp -// -// Library: Data -// Package: DataCore -// Module: Time -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Time.h" -#include "Poco/Data/DynamicDateTime.h" -#include "Poco/DateTime.h" -#include "Poco/Dynamic/Var.h" - - -using Poco::DateTime; -using Poco::Dynamic::Var; - - -namespace Poco { -namespace Data { - - -Time::Time() -{ - DateTime dt; - assign(dt.hour(), dt.minute(), dt.second()); -} - - -Time::Time(int hour, int minute, int second) -{ - assign(hour, minute, second); -} - - -Time::Time(const DateTime& dt) -{ - assign(dt.hour(), dt.minute(), dt.second()); -} - - -Time::~Time() -{ -} - - -void Time::assign(int hour, int minute, int second) -{ - if (hour < 0 || hour > 23) - throw InvalidArgumentException("Hour must be between 0 and 23."); - - if (minute < 0 || minute > 59) - throw InvalidArgumentException("Minute must be between 0 and 59."); - - if (second < 0 || second > 59) - throw InvalidArgumentException("Second must be between 0 and 59."); - - _hour = hour; - _minute = minute; - _second = second; -} - - -bool Time::operator < (const Time& time) const -{ - int hour = time.hour(); - - if (_hour < hour) return true; - else if (_hour > hour) return false; - else // hours equal - { - int minute = time.minute(); - if (_minute < minute) return true; - else - if (_minute > minute) return false; - else // minutes equal - if (_second < time.second()) return true; - } - - return false; -} - - -Time& Time::operator = (const Var& var) -{ -#ifndef __GNUC__ -// g++ used to choke on this, newer versions seem to digest it fine -// TODO: determine the version able to handle it properly - *this = var.extract<Time>(); -#else - *this = var.operator Time(); -#endif - return *this; -} - - -} } // namespace Poco::Data - - -#ifdef __GNUC__ -// only needed for g++ (see comment in Time::operator = above) - -namespace Poco { -namespace Dynamic { - - -using Poco::Data::Time; -using Poco::DateTime; - - -template <> -Var::operator Time () const -{ - VarHolder* pHolder = content(); - - if (!pHolder) - throw InvalidAccessException("Can not convert empty value."); - - if (typeid(Time) == pHolder->type()) - return extract<Time>(); - else - { - Poco::DateTime result; - pHolder->convert(result); - return Time(result); - } -} - - -} } // namespace Poco::Dynamic - - -#endif // __GNUC__ diff --git a/contrib/libs/poco/Data/src/Transaction.cpp b/contrib/libs/poco/Data/src/Transaction.cpp deleted file mode 100644 index 21da65304d..0000000000 --- a/contrib/libs/poco/Data/src/Transaction.cpp +++ /dev/null @@ -1,124 +0,0 @@ -// -// Transaction.cpp -// -// Library: Data -// Package: DataCore -// Module: Transaction -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Data/Transaction.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace Data { - - -Transaction::Transaction(Poco::Data::Session& rSession, Poco::Logger* pLogger): - _rSession(rSession), - _pLogger(pLogger) -{ - begin(); -} - - -Transaction::Transaction(Poco::Data::Session& rSession, bool start): - _rSession(rSession), - _pLogger(0) -{ - if (start) begin(); -} - - -Transaction::~Transaction() -{ - try - { - if (_rSession.isTransaction()) - { - try - { - if (_pLogger) - _pLogger->debug("Rolling back transaction."); - - _rSession.rollback(); - } - catch (Poco::Exception& exc) - { - if (_pLogger) - _pLogger->error("Error while rolling back database transaction: %s", exc.displayText()); - } - catch (...) - { - if (_pLogger) - _pLogger->error("Error while rolling back database transaction."); - } - } - } - catch (...) - { - poco_unexpected(); - } -} - - -void Transaction::begin() -{ - if (!_rSession.isTransaction()) - _rSession.begin(); - else - throw InvalidAccessException("Transaction in progress."); -} - - -void Transaction::execute(const std::string& sql, bool doCommit) -{ - if (!_rSession.isTransaction()) _rSession.begin(); - _rSession << sql, Keywords::now; - if (doCommit) commit(); -} - - -void Transaction::execute(const std::vector<std::string>& sql) -{ - try - { - std::vector<std::string>::const_iterator it = sql.begin(); - std::vector<std::string>::const_iterator end = sql.end(); - for (; it != end; ++it) execute(*it, it + 1 == end ? true : false); - return; - } - catch (Exception& ex) - { - if (_pLogger) _pLogger->log(ex); - } - - rollback(); -} - - -void Transaction::commit() -{ - if (_pLogger) - _pLogger->debug("Committing transaction."); - - _rSession.commit(); -} - - -void Transaction::rollback() -{ - if (_pLogger) - _pLogger->debug("Rolling back transaction."); - - _rSession.rollback(); -} - - -} } // namespace Poco::Data diff --git a/contrib/libs/poco/Data/ya.make b/contrib/libs/poco/Data/ya.make deleted file mode 100644 index 90560966c3..0000000000 --- a/contrib/libs/poco/Data/ya.make +++ /dev/null @@ -1,85 +0,0 @@ -# Generated by devtools/yamaker. - -LIBRARY() - -LICENSE(BSL-1.0) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -PEERDIR( - contrib/libs/poco/Foundation -) - -ADDINCL( - GLOBAL contrib/libs/poco/Data/include - contrib/libs/poco/Data/src - contrib/libs/poco/Foundation/include -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -CFLAGS( - -DPOCO_ENABLE_CPP11 - -DPOCO_ENABLE_CPP14 - -DPOCO_NO_AUTOMATIC_LIBS - -DPOCO_UNBUNDLED - -DTHREADSAFE -) - -IF (OS_DARWIN) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_NO_STAT64 - ) -ELSEIF (OS_LINUX) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_HAVE_FD_EPOLL - ) -ELSEIF (OS_WINDOWS) - CFLAGS( - -DPOCO_OS_FAMILY_WINDOWS - ) -ENDIF() - -SRCS( - src/AbstractBinder.cpp - src/AbstractBinding.cpp - src/AbstractExtraction.cpp - src/AbstractExtractor.cpp - src/AbstractPreparation.cpp - src/AbstractPreparator.cpp - src/ArchiveStrategy.cpp - src/Bulk.cpp - src/Connector.cpp - src/DataException.cpp - src/Date.cpp - src/DynamicLOB.cpp - src/Limit.cpp - src/MetaColumn.cpp - src/PooledSessionHolder.cpp - src/PooledSessionImpl.cpp - src/Position.cpp - src/Range.cpp - src/RecordSet.cpp - src/Row.cpp - src/RowFilter.cpp - src/RowFormatter.cpp - src/RowIterator.cpp - src/SQLChannel.cpp - src/Session.cpp - src/SessionFactory.cpp - src/SessionImpl.cpp - src/SessionPool.cpp - src/SessionPoolContainer.cpp - src/SimpleRowFormatter.cpp - src/Statement.cpp - src/StatementCreator.cpp - src/StatementImpl.cpp - src/Time.cpp - src/Transaction.cpp -) - -END() diff --git a/contrib/libs/poco/Foundation/include/Poco/AbstractCache.h b/contrib/libs/poco/Foundation/include/Poco/AbstractCache.h deleted file mode 100644 index 37cfc25b1e..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/AbstractCache.h +++ /dev/null @@ -1,366 +0,0 @@ -// -// AbstractCache.h -// -// Library: Foundation -// Package: Cache -// Module: AbstractCache -// -// Definition of the AbstractCache class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_AbstractCache_INCLUDED -#define Foundation_AbstractCache_INCLUDED - - -#include "Poco/KeyValueArgs.h" -#include "Poco/ValidArgs.h" -#include "Poco/Mutex.h" -#include "Poco/Exception.h" -#include "Poco/FIFOEvent.h" -#include "Poco/EventArgs.h" -#include "Poco/Delegate.h" -#include "Poco/SharedPtr.h" -#include <map> -#include <set> -#include <cstddef> - - -namespace Poco { - - -template <class TKey, class TValue, class TStrategy, class TMutex = FastMutex, class TEventMutex = FastMutex> -class AbstractCache - /// An AbstractCache is the interface of all caches. -{ -public: - FIFOEvent<const KeyValueArgs<TKey, TValue >, TEventMutex > Add; - FIFOEvent<const KeyValueArgs<TKey, TValue >, TEventMutex > Update; - FIFOEvent<const TKey, TEventMutex> Remove; - FIFOEvent<const TKey, TEventMutex> Get; - FIFOEvent<const EventArgs, TEventMutex> Clear; - - typedef std::map<TKey, SharedPtr<TValue > > DataHolder; - typedef typename DataHolder::iterator Iterator; - typedef typename DataHolder::const_iterator ConstIterator; - typedef std::set<TKey> KeySet; - - AbstractCache() - { - initialize(); - } - - AbstractCache(const TStrategy& strat): _strategy(strat) - { - initialize(); - } - - virtual ~AbstractCache() - { - try - { - uninitialize(); - } - catch (...) - { - poco_unexpected(); - } - } - - void add(const TKey& key, const TValue& val) - /// Adds the key value pair to the cache. - /// If for the key already an entry exists, it will be overwritten. - { - typename TMutex::ScopedLock lock(_mutex); - doAdd(key, val); - } - - void update(const TKey& key, const TValue& val) - /// Adds the key value pair to the cache. Note that adding a NULL SharedPtr will fail! - /// If for the key already an entry exists, it will be overwritten. - /// The difference to add is that no remove or add events are thrown in this case, - /// just a simply silent update is performed - /// If the key doesnot exist the behavior is equal to add, ie. an add event is thrown - { - typename TMutex::ScopedLock lock(_mutex); - doUpdate(key, val); - } - - void add(const TKey& key, SharedPtr<TValue > val) - /// Adds the key value pair to the cache. Note that adding a NULL SharedPtr will fail! - /// If for the key already an entry exists, it will be overwritten, ie. first a remove event - /// is thrown, then a add event - { - typename TMutex::ScopedLock lock(_mutex); - doAdd(key, val); - } - - void update(const TKey& key, SharedPtr<TValue > val) - /// Adds the key value pair to the cache. Note that adding a NULL SharedPtr will fail! - /// If for the key already an entry exists, it will be overwritten. - /// The difference to add is that no remove or add events are thrown in this case, - /// just an Update is thrown - /// If the key doesnot exist the behavior is equal to add, ie. an add event is thrown - { - typename TMutex::ScopedLock lock(_mutex); - doUpdate(key, val); - } - - void remove(const TKey& key) - /// Removes an entry from the cache. If the entry is not found, - /// the remove is ignored. - { - typename TMutex::ScopedLock lock(_mutex); - Iterator it = _data.find(key); - doRemove(it); - } - - bool has(const TKey& key) const - /// Returns true if the cache contains a value for the key. - { - typename TMutex::ScopedLock lock(_mutex); - return doHas(key); - } - - SharedPtr<TValue> get(const TKey& key) - /// Returns a SharedPtr of the value. The SharedPointer will remain valid - /// even when cache replacement removes the element. - /// If for the key no value exists, an empty SharedPtr is returned. - { - typename TMutex::ScopedLock lock(_mutex); - return doGet (key); - } - - void clear() - /// Removes all elements from the cache. - { - typename TMutex::ScopedLock lock(_mutex); - doClear(); - } - - std::size_t size() - /// Returns the number of cached elements - { - typename TMutex::ScopedLock lock(_mutex); - doReplace(); - return _data.size(); - } - - void forceReplace() - /// Forces cache replacement. Note that Poco's cache strategy use for efficiency reason no background thread - /// which periodically triggers cache replacement. Cache Replacement is only started when the cache is modified - /// from outside, i.e. add is called, or when a user tries to access an cache element via get. - /// In some cases, i.e. expire based caching where for a long time no access to the cache happens, - /// it might be desirable to be able to trigger cache replacement manually. - { - typename TMutex::ScopedLock lock(_mutex); - doReplace(); - } - - std::set<TKey> getAllKeys() - /// Returns a copy of all keys stored in the cache - { - typename TMutex::ScopedLock lock(_mutex); - doReplace(); - ConstIterator it = _data.begin(); - ConstIterator itEnd = _data.end(); - std::set<TKey> result; - for (; it != itEnd; ++it) - result.insert(it->first); - - return result; - } - -protected: - mutable FIFOEvent<ValidArgs<TKey> > IsValid; - mutable FIFOEvent<KeySet> Replace; - - void initialize() - /// Sets up event registration. - { - Add += Delegate<TStrategy, const KeyValueArgs<TKey, TValue> >(&_strategy, &TStrategy::onAdd); - Update += Delegate<TStrategy, const KeyValueArgs<TKey, TValue> >(&_strategy, &TStrategy::onUpdate); - Remove += Delegate<TStrategy, const TKey>(&_strategy, &TStrategy::onRemove); - Get += Delegate<TStrategy, const TKey>(&_strategy, &TStrategy::onGet); - Clear += Delegate<TStrategy, const EventArgs>(&_strategy, &TStrategy::onClear); - IsValid += Delegate<TStrategy, ValidArgs<TKey> >(&_strategy, &TStrategy::onIsValid); - Replace += Delegate<TStrategy, KeySet>(&_strategy, &TStrategy::onReplace); - } - - void uninitialize() - /// Reverts event registration. - { - Add -= Delegate<TStrategy, const KeyValueArgs<TKey, TValue> >(&_strategy, &TStrategy::onAdd ); - Update -= Delegate<TStrategy, const KeyValueArgs<TKey, TValue> >(&_strategy, &TStrategy::onUpdate); - Remove -= Delegate<TStrategy, const TKey>(&_strategy, &TStrategy::onRemove); - Get -= Delegate<TStrategy, const TKey>(&_strategy, &TStrategy::onGet); - Clear -= Delegate<TStrategy, const EventArgs>(&_strategy, &TStrategy::onClear); - IsValid -= Delegate<TStrategy, ValidArgs<TKey> >(&_strategy, &TStrategy::onIsValid); - Replace -= Delegate<TStrategy, KeySet>(&_strategy, &TStrategy::onReplace); - } - - void doAdd(const TKey& key, const TValue& val) - /// Adds the key value pair to the cache. - /// If for the key already an entry exists, it will be overwritten. - { - Iterator it = _data.find(key); - doRemove(it); - - KeyValueArgs<TKey, TValue> args(key, val); - Add.notify(this, args); - _data.insert(std::make_pair(key, SharedPtr<TValue>(new TValue(val)))); - - doReplace(); - } - - void doAdd(const TKey& key, SharedPtr<TValue>& val) - /// Adds the key value pair to the cache. - /// If for the key already an entry exists, it will be overwritten. - { - Iterator it = _data.find(key); - doRemove(it); - - KeyValueArgs<TKey, TValue> args(key, *val); - Add.notify(this, args); - _data.insert(std::make_pair(key, val)); - - doReplace(); - } - - void doUpdate(const TKey& key, const TValue& val) - /// Adds the key value pair to the cache. - /// If for the key already an entry exists, it will be overwritten. - { - KeyValueArgs<TKey, TValue> args(key, val); - Iterator it = _data.find(key); - if (it == _data.end()) - { - Add.notify(this, args); - _data.insert(std::make_pair(key, SharedPtr<TValue>(new TValue(val)))); - } - else - { - Update.notify(this, args); - it->second = SharedPtr<TValue>(new TValue(val)); - } - - doReplace(); - } - - void doUpdate(const TKey& key, SharedPtr<TValue>& val) - /// Adds the key value pair to the cache. - /// If for the key already an entry exists, it will be overwritten. - { - KeyValueArgs<TKey, TValue> args(key, *val); - Iterator it = _data.find(key); - if (it == _data.end()) - { - Add.notify(this, args); - _data.insert(std::make_pair(key, val)); - } - else - { - Update.notify(this, args); - it->second = val; - } - - doReplace(); - } - - void doRemove(Iterator it) - /// Removes an entry from the cache. If the entry is not found - /// the remove is ignored. - { - if (it != _data.end()) - { - Remove.notify(this, it->first); - _data.erase(it); - } - } - - bool doHas(const TKey& key) const - /// Returns true if the cache contains a value for the key - { - // ask the strategy if the key is valid - ConstIterator it = _data.find(key); - bool result = false; - - if (it != _data.end()) - { - ValidArgs<TKey> args(key); - IsValid.notify(this, args); - result = args.isValid(); - } - - return result; - } - - SharedPtr<TValue> doGet(const TKey& key) - /// Returns a SharedPtr of the cache entry, returns 0 if for - /// the key no value was found - { - Iterator it = _data.find(key); - SharedPtr<TValue> result; - - if (it != _data.end()) - { - // inform all strategies that a read-access to an element happens - Get.notify(this, key); - // ask all strategies if the key is valid - ValidArgs<TKey> args(key); - IsValid.notify(this, args); - - if (!args.isValid()) - { - doRemove(it); - } - else - { - result = it->second; - } - } - - return result; - } - - void doClear() - { - static EventArgs _emptyArgs; - Clear.notify(this, _emptyArgs); - _data.clear(); - } - - void doReplace() - { - std::set<TKey> delMe; - Replace.notify(this, delMe); - // delMe contains the to be removed elements - typename std::set<TKey>::const_iterator it = delMe.begin(); - typename std::set<TKey>::const_iterator endIt = delMe.end(); - - for (; it != endIt; ++it) - { - Iterator itH = _data.find(*it); - doRemove(itH); - } - } - - TStrategy _strategy; - mutable DataHolder _data; - mutable TMutex _mutex; - -private: - AbstractCache(const AbstractCache& aCache); - AbstractCache& operator = (const AbstractCache& aCache); -}; - - -} // namespace Poco - - -#endif // Foundation_AbstractCache_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/AbstractStrategy.h b/contrib/libs/poco/Foundation/include/Poco/AbstractStrategy.h deleted file mode 100644 index 8d0ac25a22..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/AbstractStrategy.h +++ /dev/null @@ -1,77 +0,0 @@ -// -// AbstractStrategy.h -// -// Library: Foundation -// Package: Cache -// Module: AbstractCache -// -// Definition of the AbstractStrategy class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_AbstractStrategy_INCLUDED -#define Foundation_AbstractStrategy_INCLUDED - - -#include "Poco/KeyValueArgs.h" -#include "Poco/ValidArgs.h" -#include "Poco/EventArgs.h" -#include <set> - - -namespace Poco { - - -template <class TKey, class TValue> -class AbstractStrategy - /// An AbstractStrategy is the interface for all strategies. -{ -public: - AbstractStrategy() - { - } - - virtual ~AbstractStrategy() - { - } - - virtual void onUpdate(const void* pSender, const KeyValueArgs <TKey, TValue>& args) - /// Updates an existing entry. - { - onRemove(pSender,args.key()); - onAdd(pSender, args); - } - - virtual void onAdd(const void* pSender, const KeyValueArgs <TKey, TValue>& key) = 0; - /// Adds the key to the strategy. - /// If for the key already an entry exists, an exception will be thrown. - - virtual void onRemove(const void* pSender, const TKey& key) = 0; - /// Removes an entry from the strategy. If the entry is not found - /// the remove is ignored. - - virtual void onGet(const void* pSender, const TKey& key) = 0; - /// Informs the strategy that a read-access happens to an element. - - virtual void onClear(const void* pSender, const EventArgs& args) = 0; - /// Removes all elements from the cache. - - virtual void onIsValid(const void* pSender, ValidArgs<TKey>& key) = 0; - /// Used to query if a key is still valid (i.e. cached). - - virtual void onReplace(const void* pSender, std::set<TKey>& elemsToRemove) = 0; - /// Used by the Strategy to indicate which elements should be removed from - /// the cache. Note that onReplace does not change the current list of keys. - /// The cache object is reponsible to remove the elements. -}; - - -} // namespace Poco - - -#endif // Foundation_AbstractStrategy_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/AccessExpireCache.h b/contrib/libs/poco/Foundation/include/Poco/AccessExpireCache.h deleted file mode 100644 index bb5c571526..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/AccessExpireCache.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// AccessExpireCache.h -// -// Library: Foundation -// Package: Cache -// Module: AccessExpireCache -// -// Definition of the AccessExpireCache class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_AccessExpireCache_INCLUDED -#define Foundation_AccessExpireCache_INCLUDED - - -#include "Poco/AbstractCache.h" -#include "Poco/AccessExpireStrategy.h" - - -namespace Poco { - - -template < - class TKey, - class TValue, - class TMutex = FastMutex, - class TEventMutex = FastMutex -> -class AccessExpireCache: public AbstractCache<TKey, TValue, AccessExpireStrategy<TKey, TValue>, TMutex, TEventMutex> - /// An AccessExpireCache caches entries for a fixed time period (per default 10 minutes). - /// Entries expire when they are not accessed with get() during this time period. Each access resets - /// the start time for expiration. - /// Be careful when using an AccessExpireCache. A cache is often used - /// like cache.has(x) followed by cache.get x). Note that it could happen - /// that the "has" call works, then the current execution thread gets descheduled, time passes, - /// the entry gets invalid, thus leading to an empty SharedPtr being returned - /// when "get" is invoked. -{ -public: - AccessExpireCache(Timestamp::TimeDiff expire = 600000): - AbstractCache<TKey, TValue, AccessExpireStrategy<TKey, TValue>, TMutex, TEventMutex>(AccessExpireStrategy<TKey, TValue>(expire)) - { - } - - ~AccessExpireCache() - { - } - -private: - AccessExpireCache(const AccessExpireCache& aCache); - AccessExpireCache& operator = (const AccessExpireCache& aCache); -}; - - -} // namespace Poco - - -#endif // Foundation_AccessExpireCache_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/AccessExpireStrategy.h b/contrib/libs/poco/Foundation/include/Poco/AccessExpireStrategy.h deleted file mode 100644 index 3bfa45c21f..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/AccessExpireStrategy.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// AccessExpireStrategy.h -// -// Library: Foundation -// Package: Cache -// Module: AccessExpireStrategy -// -// Definition of the AccessExpireStrategy class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_AccessExpireStrategy_INCLUDED -#define Foundation_AccessExpireStrategy_INCLUDED - - -#include "Poco/KeyValueArgs.h" -#include "Poco/ValidArgs.h" -#include "Poco/ExpireStrategy.h" -#include "Poco/Bugcheck.h" -#include "Poco/Timestamp.h" -#include "Poco/EventArgs.h" -#include <set> -#include <map> - - -namespace Poco { - - -template < - class TKey, - class TValue -> -class AccessExpireStrategy: public ExpireStrategy<TKey, TValue> - /// An AccessExpireStrategy implements time and access based expiration of cache entries -{ -public: - AccessExpireStrategy(Timestamp::TimeDiff expireTimeInMilliSec): ExpireStrategy<TKey, TValue>(expireTimeInMilliSec) - /// Create an expire strategy. Note that the smallest allowed caching time is 25ms. - /// Anything lower than that is not useful with current operating systems. - { - } - - ~AccessExpireStrategy() - { - } - - void onGet(const void*, const TKey& key) - { - // get triggers an update to the expiration time - typename ExpireStrategy<TKey, TValue>::Iterator it = this->_keys.find(key); - if (it != this->_keys.end()) - { - if (!it->second->first.isElapsed(this->_expireTime)) // don't extend if already expired - { - this->_keyIndex.erase(it->second); - Timestamp now; - typename ExpireStrategy<TKey, TValue>::IndexIterator itIdx = - this->_keyIndex.insert(typename ExpireStrategy<TKey, TValue>::TimeIndex::value_type(now, key)); - it->second = itIdx; - } - } - } -}; - - -} // namespace Poco - - -#endif // Foundation_AccessExpireStrategy_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/Activity.h b/contrib/libs/poco/Foundation/include/Poco/Activity.h deleted file mode 100644 index a7297f144f..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/Activity.h +++ /dev/null @@ -1,208 +0,0 @@ -// -// Activity.h -// -// Library: Foundation -// Package: Threading -// Module: ActiveObjects -// -// Definition of the Activity template class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_Activity_INCLUDED -#define Foundation_Activity_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/RunnableAdapter.h" -#include "Poco/ThreadPool.h" -#include "Poco/Event.h" -#include "Poco/Mutex.h" - - -namespace Poco { - - -template <class C> -class Activity: public Runnable - /// This template class helps to implement active objects. - /// An active object uses threads to decouple method - /// execution from method invocation, or to perform tasks - /// autonomously, without intervention of a caller. - /// - /// An activity is a (typically longer running) method - /// that executes within its own task. Activities can - /// be started automatically (upon object construction) - /// or manually at a later time. Activities can also - /// be stopped at any time. However, to make stopping - /// an activity work, the method implementing the - /// activity has to check periodically whether it - /// has been requested to stop, and if so, return. - /// Activities are stopped before the object they belong to is - /// destroyed. Methods implementing activities cannot have arguments - /// or return values. - /// - /// Activity objects are used as follows: - /// - /// class ActiveObject - /// { - /// public: - /// ActiveObject(): - /// _activity(this, &ActiveObject::runActivity) - /// { - /// ... - /// } - /// - /// ... - /// - /// protected: - /// void runActivity() - /// { - /// while (!_activity.isStopped()) - /// { - /// ... - /// } - /// } - /// - /// private: - /// Activity<ActiveObject> _activity; - /// }; -{ -public: - typedef RunnableAdapter<C> RunnableAdapterType; - typedef typename RunnableAdapterType::Callback Callback; - - Activity(C* pOwner, Callback method): - _pOwner(pOwner), - _runnable(*pOwner, method), - _stopped(true), - _running(false), - _done(false) - /// Creates the activity. Call start() to - /// start it. - { - poco_check_ptr (pOwner); - } - - ~Activity() - /// Stops and destroys the activity. - { - try - { - stop(); - wait(); - } - catch (...) - { - poco_unexpected(); - } - } - - void start() - /// Starts the activity by acquiring a - /// thread for it from the default thread pool. - { - start(ThreadPool::defaultPool()); - } - - void start(ThreadPool& pool) - { - FastMutex::ScopedLock lock(_mutex); - - if (!_running) - { - _done.reset(); - _stopped = false; - _running = true; - try - { - pool.start(*this); - } - catch (...) - { - _running = false; - throw; - } - } - } - - void stop() - /// Requests to stop the activity. - { - FastMutex::ScopedLock lock(_mutex); - - _stopped = true; - } - - void wait() - /// Waits for the activity to complete. - { - if (_running) - { - _done.wait(); - } - } - - void wait(long milliseconds) - /// Waits the given interval for the activity to complete. - /// An TimeoutException is thrown if the activity does not - /// complete within the given interval. - { - if (_running) - { - _done.wait(milliseconds); - } - } - - bool isStopped() const - /// Returns true if the activity has been requested to stop. - { - return _stopped; - } - - bool isRunning() const - /// Returns true if the activity is running. - { - return _running; - } - -protected: - void run() - { - try - { - _runnable.run(); - } - catch (...) - { - _running = false; - _done.set(); - throw; - } - _running = false; - _done.set(); - } - -private: - Activity(); - Activity(const Activity&); - Activity& operator = (const Activity&); - - C* _pOwner; - RunnableAdapterType _runnable; - volatile bool _stopped; - volatile bool _running; - Event _done; - FastMutex _mutex; -}; - - -} // namespace Poco - - -#endif // Foundation_Activity_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/ExpireStrategy.h b/contrib/libs/poco/Foundation/include/Poco/ExpireStrategy.h deleted file mode 100644 index 40e49eae8c..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/ExpireStrategy.h +++ /dev/null @@ -1,132 +0,0 @@ -// -// ExpireStrategy.h -// -// Library: Foundation -// Package: Cache -// Module: ExpireStrategy -// -// Definition of the ExpireStrategy class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_ExpireStrategy_INCLUDED -#define Foundation_ExpireStrategy_INCLUDED - - -#include "Poco/KeyValueArgs.h" -#include "Poco/ValidArgs.h" -#include "Poco/AbstractStrategy.h" -#include "Poco/Bugcheck.h" -#include "Poco/Timestamp.h" -#include "Poco/EventArgs.h" -#include <set> -#include <map> - - -namespace Poco { - - -template < - class TKey, - class TValue -> -class ExpireStrategy: public AbstractStrategy<TKey, TValue> - /// An ExpireStrategy implements time based expiration of cache entries -{ -public: - typedef std::multimap<Timestamp, TKey> TimeIndex; - typedef typename TimeIndex::iterator IndexIterator; - typedef typename TimeIndex::const_iterator ConstIndexIterator; - typedef std::map<TKey, IndexIterator> Keys; - typedef typename Keys::iterator Iterator; - -public: - ExpireStrategy(Timestamp::TimeDiff expireTimeInMilliSec): _expireTime(expireTimeInMilliSec * 1000) - /// Create an expire strategy. Note that the smallest allowed caching time is 25ms. - /// Anything lower than that is not useful with current operating systems. - { - if (_expireTime < 25000) throw InvalidArgumentException("expireTime must be at least 25 ms"); - } - - ~ExpireStrategy() - { - } - - void onAdd(const void*, const KeyValueArgs <TKey, TValue>& args) - { - Timestamp now; - typename TimeIndex::value_type tiValue(now, args.key()); - IndexIterator it = _keyIndex.insert(tiValue); - typename Keys::value_type kValue(args.key(), it); - std::pair<Iterator, bool> stat = _keys.insert(kValue); - if (!stat.second) - { - _keyIndex.erase(stat.first->second); - stat.first->second = it; - } - } - - void onRemove(const void*, const TKey& key) - { - Iterator it = _keys.find(key); - if (it != _keys.end()) - { - _keyIndex.erase(it->second); - _keys.erase(it); - } - } - - void onGet(const void*, const TKey& /*key*/) - { - // get triggers no changes in an expire - } - - void onClear(const void*, const EventArgs& /*args*/) - { - _keys.clear(); - _keyIndex.clear(); - } - - void onIsValid(const void*, ValidArgs<TKey>& args) - { - Iterator it = _keys.find(args.key()); - if (it != _keys.end()) - { - if (it->second->first.isElapsed(_expireTime)) - { - args.invalidate(); - } - } - else //not found: probably removed by onReplace - args.invalidate(); - } - - void onReplace(const void*, std::set<TKey>& elemsToRemove) - { - // Note: replace only informs the cache which elements - // it would like to remove! - // it does not remove them on its own! - IndexIterator it = _keyIndex.begin(); - while (it != _keyIndex.end() && it->first.isElapsed(_expireTime)) - { - elemsToRemove.insert(it->second); - ++it; - } - } - -protected: - Timestamp::TimeDiff _expireTime; - Keys _keys; /// For faster replacement of keys, the iterator points to the _keyIndex map - TimeIndex _keyIndex; /// Maps time to key value -}; - - -} // namespace Poco - - -#endif // Foundation_ExpireStrategy_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/FIFOEvent.h b/contrib/libs/poco/Foundation/include/Poco/FIFOEvent.h deleted file mode 100644 index 404044c392..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/FIFOEvent.h +++ /dev/null @@ -1,63 +0,0 @@ -// -// FIFOEvent.h -// -// Library: Foundation -// Package: Events -// Module: FIFOEvent -// -// Implementation of the FIFOEvent template. -// -// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_FIFOEvent_INCLUDED -#define Foundation_FIFOEvent_INCLUDED - - -#include "Poco/AbstractEvent.h" -#include "Poco/FIFOStrategy.h" -#include "Poco/AbstractDelegate.h" - - -namespace Poco { - - -//@ deprecated -template <class TArgs, class TMutex = FastMutex> -class FIFOEvent: public AbstractEvent < - TArgs, - FIFOStrategy<TArgs, AbstractDelegate<TArgs> >, - AbstractDelegate<TArgs>, - TMutex -> - /// A FIFOEvent uses internally a FIFOStrategy which guarantees - /// that delegates are invoked in the order they were added to - /// the event. - /// - /// Note that as of release 1.4.2, this is the default behavior - /// implemented by BasicEvent, so this class is provided - /// for backwards compatibility only. -{ -public: - FIFOEvent() - { - } - - ~FIFOEvent() - { - } - -private: - FIFOEvent(const FIFOEvent& e); - FIFOEvent& operator = (const FIFOEvent& e); -}; - - -} // namespace Poco - - -#endif // Foundation_FIFOEvent_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/FIFOStrategy.h b/contrib/libs/poco/Foundation/include/Poco/FIFOStrategy.h deleted file mode 100644 index 79c2276043..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/FIFOStrategy.h +++ /dev/null @@ -1,59 +0,0 @@ -// -// FIFOStrategy.h -// -// Library: Foundation -// Package: Events -// Module: FIFOStragegy -// -// Implementation of the FIFOStrategy template. -// -// Copyright (c) 2006-2011, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_FIFOStrategy_INCLUDED -#define Foundation_FIFOStrategy_INCLUDED - - -#include "Poco/DefaultStrategy.h" - - -namespace Poco { - - -//@ deprecated -template <class TArgs, class TDelegate> -class FIFOStrategy: public DefaultStrategy<TArgs, TDelegate> - /// Note: As of release 1.4.2, DefaultStrategy already - /// implements FIFO behavior, so this class is provided - /// for backwards compatibility only. -{ -public: - FIFOStrategy() - { - } - - FIFOStrategy(const FIFOStrategy& s): - DefaultStrategy<TArgs, TDelegate>(s) - { - } - - ~FIFOStrategy() - { - } - - FIFOStrategy& operator = (const FIFOStrategy& s) - { - DefaultStrategy<TArgs, TDelegate>::operator = (s); - return *this; - } -}; - - -} // namespace Poco - - -#endif // Foundation_FIFOStrategy_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/HashMap.h b/contrib/libs/poco/Foundation/include/Poco/HashMap.h deleted file mode 100644 index 5153f2b164..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/HashMap.h +++ /dev/null @@ -1,228 +0,0 @@ -// -// HashMap.h -// -// Library: Foundation -// Package: Hashing -// Module: HashMap -// -// Definition of the HashMap class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_HashMap_INCLUDED -#define Foundation_HashMap_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/LinearHashTable.h" -#include "Poco/Exception.h" -#include <utility> - - -namespace Poco { - - -template <class Key, class Value> -struct HashMapEntry - /// This class template is used internally by HashMap. -{ - Key first; - Value second; - - HashMapEntry(): - first(), - second() - { - } - - HashMapEntry(const Key& key): - first(key), - second() - { - } - - HashMapEntry(const Key& key, const Value& value): - first(key), - second(value) - { - } - - bool operator == (const HashMapEntry& entry) const - { - return first == entry.first; - } - - bool operator != (const HashMapEntry& entry) const - { - return first != entry.first; - } -}; - - -template <class HME, class KeyHashFunc> -struct HashMapEntryHash - /// This class template is used internally by HashMap. -{ - std::size_t operator () (const HME& entry) const - { - return _func(entry.first); - } - -private: - KeyHashFunc _func; -}; - - -template <class Key, class Mapped, class HashFunc = Hash<Key> > -class HashMap - /// This class implements a map using a LinearHashTable. - /// - /// A HashMap can be used just like a std::map. -{ -public: - typedef Key KeyType; - typedef Mapped MappedType; - typedef Mapped& Reference; - typedef const Mapped& ConstReference; - typedef Mapped* Pointer; - typedef const Mapped* ConstPointer; - - typedef HashMapEntry<Key, Mapped> ValueType; - typedef std::pair<KeyType, MappedType> PairType; - - typedef HashMapEntryHash<ValueType, HashFunc> HashType; - typedef LinearHashTable<ValueType, HashType> HashTable; - - typedef typename HashTable::Iterator Iterator; - typedef typename HashTable::ConstIterator ConstIterator; - - HashMap() - /// Creates an empty HashMap. - { - } - - HashMap(std::size_t initialReserve): - _table(initialReserve) - /// Creates the HashMap with room for initialReserve entries. - { - } - - HashMap& operator = (const HashMap& map) - /// Assigns another HashMap. - { - HashMap tmp(map); - swap(tmp); - return *this; - } - - void swap(HashMap& map) - /// Swaps the HashMap with another one. - { - _table.swap(map._table); - } - - ConstIterator begin() const - { - return _table.begin(); - } - - ConstIterator end() const - { - return _table.end(); - } - - Iterator begin() - { - return _table.begin(); - } - - Iterator end() - { - return _table.end(); - } - - ConstIterator find(const KeyType& key) const - { - ValueType value(key); - return _table.find(value); - } - - Iterator find(const KeyType& key) - { - ValueType value(key); - return _table.find(value); - } - - std::size_t count(const KeyType& key) const - { - ValueType value(key); - return _table.find(value) != _table.end() ? 1 : 0; - } - - std::pair<Iterator, bool> insert(const PairType& pair) - { - ValueType value(pair.first, pair.second); - return _table.insert(value); - } - - std::pair<Iterator, bool> insert(const ValueType& value) - { - return _table.insert(value); - } - - void erase(Iterator it) - { - _table.erase(it); - } - - void erase(const KeyType& key) - { - Iterator it = find(key); - _table.erase(it); - } - - void clear() - { - _table.clear(); - } - - std::size_t size() const - { - return _table.size(); - } - - bool empty() const - { - return _table.empty(); - } - - ConstReference operator [] (const KeyType& key) const - { - ConstIterator it = _table.find(key); - if (it != _table.end()) - return it->second; - else - throw NotFoundException(); - } - - Reference operator [] (const KeyType& key) - { - ValueType value(key); - std::pair<Iterator, bool> res = _table.insert(value); - return res.first->second; - } - -private: - HashTable _table; -}; - - -} // namespace Poco - - -#endif // Foundation_HashMap_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/KeyValueArgs.h b/contrib/libs/poco/Foundation/include/Poco/KeyValueArgs.h deleted file mode 100644 index cdcc4e1cec..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/KeyValueArgs.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// KeyValueArgs.h -// -// Library: Foundation -// Package: Cache -// Module: KeyValueArgs -// -// Definition of the KeyValueArgs class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_KeyValueArgs_INCLUDED -#define Foundation_KeyValueArgs_INCLUDED - - -#include "Poco/Foundation.h" - - -namespace Poco { - - -template <class TKey, class TValue> -class KeyValueArgs - /// Simply event arguments class to transfer a key and a value via an event call. - /// Note that key and value are *NOT* copied, only references to them are stored. -{ -public: - KeyValueArgs(const TKey& aKey, const TValue& aVal): - _key(aKey), - _value(aVal) - { - } - - KeyValueArgs(const KeyValueArgs& args): - _key(args._key), - _value(args._value) - { - } - - ~KeyValueArgs() - { - } - - const TKey& key() const - /// Returns a reference to the key, - { - return _key; - } - - const TValue& value() const - /// Returns a Reference to the value. - { - return _value; - } - -protected: - const TKey& _key; - const TValue& _value; - -private: - KeyValueArgs& operator = (const KeyValueArgs& args); -}; - - -} // namespace Poco - - -#endif // Foundation_KeyValueArgs_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/LRUCache.h b/contrib/libs/poco/Foundation/include/Poco/LRUCache.h deleted file mode 100644 index 7f8f0debd9..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/LRUCache.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// LRUCache.h -// -// Library: Foundation -// Package: Cache -// Module: LRUCache -// -// Definition of the LRUCache class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_LRUCache_INCLUDED -#define Foundation_LRUCache_INCLUDED - - -#include "Poco/AbstractCache.h" -#include "Poco/LRUStrategy.h" - - -namespace Poco { - - -template < - class TKey, - class TValue, - class TMutex = FastMutex, - class TEventMutex = FastMutex -> -class LRUCache: public AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex> - /// An LRUCache implements Least Recently Used caching. The default size for a cache is 1024 entries. -{ -public: - LRUCache(long size = 1024): - AbstractCache<TKey, TValue, LRUStrategy<TKey, TValue>, TMutex, TEventMutex>(LRUStrategy<TKey, TValue>(size)) - { - } - - ~LRUCache() - { - } - -private: - LRUCache(const LRUCache& aCache); - LRUCache& operator = (const LRUCache& aCache); -}; - - -} // namespace Poco - - -#endif // Foundation_LRUCache_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/LRUStrategy.h b/contrib/libs/poco/Foundation/include/Poco/LRUStrategy.h deleted file mode 100644 index 795623872e..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/LRUStrategy.h +++ /dev/null @@ -1,140 +0,0 @@ -// -// LRUStrategy.h -// -// Library: Foundation -// Package: Cache -// Module: LRUStrategy -// -// Definition of the LRUStrategy class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_LRUStrategy_INCLUDED -#define Foundation_LRUStrategy_INCLUDED - - -#include "Poco/KeyValueArgs.h" -#include "Poco/ValidArgs.h" -#include "Poco/AbstractStrategy.h" -#include "Poco/EventArgs.h" -#include "Poco/Exception.h" -#include <list> -#include <map> -#include <cstddef> - - -namespace Poco { - - -template <class TKey, class TValue> -class LRUStrategy: public AbstractStrategy<TKey, TValue> - /// An LRUStrategy implements least recently used cache replacement. -{ -public: - typedef std::list<TKey> Keys; - typedef typename Keys::iterator Iterator; - typedef typename Keys::const_iterator ConstIterator; - typedef std::map<TKey, Iterator> KeyIndex; - typedef typename KeyIndex::iterator IndexIterator; - typedef typename KeyIndex::const_iterator ConstIndexIterator; - -public: - LRUStrategy(std::size_t size): - _size(size) - { - if (_size < 1) throw InvalidArgumentException("size must be > 0"); - } - - ~LRUStrategy() - { - } - - void onAdd(const void*, const KeyValueArgs <TKey, TValue>& args) - { - _keys.push_front(args.key()); - std::pair<IndexIterator, bool> stat = _keyIndex.insert(std::make_pair(args.key(), _keys.begin())); - if (!stat.second) - { - stat.first->second = _keys.begin(); - } - } - - void onRemove(const void*, const TKey& key) - { - IndexIterator it = _keyIndex.find(key); - - if (it != _keyIndex.end()) - { - _keys.erase(it->second); - _keyIndex.erase(it); - } - } - - void onGet(const void*, const TKey& key) - { - // LRU: in case of an hit, move to begin - IndexIterator it = _keyIndex.find(key); - - if (it != _keyIndex.end()) - { - _keys.splice(_keys.begin(), _keys, it->second); //_keys.erase(it->second)+_keys.push_front(key); - it->second = _keys.begin(); - } - } - - void onClear(const void*, const EventArgs& /*args*/) - { - _keys.clear(); - _keyIndex.clear(); - } - - void onIsValid(const void*, ValidArgs<TKey>& args) - { - if (_keyIndex.find(args.key()) == _keyIndex.end()) - { - args.invalidate(); - } - } - - void onReplace(const void*, std::set<TKey>& elemsToRemove) - { - // Note: replace only informs the cache which elements - // it would like to remove! - // it does not remove them on its own! - std::size_t curSize = _keyIndex.size(); - - if (curSize < _size) - { - return; - } - - std::size_t diff = curSize - _size; - Iterator it = --_keys.end(); //--keys can never be invoked on an empty list due to the minSize==1 requirement of LRU - std::size_t i = 0; - - while (i++ < diff) - { - elemsToRemove.insert(*it); - if (it != _keys.begin()) - { - --it; - } - } - } - -protected: - std::size_t _size; /// Number of keys the cache can store. - Keys _keys; - KeyIndex _keyIndex; /// For faster access to _keys -}; - - -} // namespace Poco - - -#endif // Foundation_LRUStrategy_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/LinearHashTable.h b/contrib/libs/poco/Foundation/include/Poco/LinearHashTable.h deleted file mode 100644 index ac18b4b95a..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/LinearHashTable.h +++ /dev/null @@ -1,503 +0,0 @@ -// -// LinearHashTable.h -// -// Library: Foundation -// Package: Hashing -// Module: LinearHashTable -// -// Definition of the LinearHashTable class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_LinearHashTable_INCLUDED -#define Foundation_LinearHashTable_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Hash.h" -#include <functional> -#include <algorithm> -#include <vector> -#include <utility> -#include <cstddef> - - -namespace Poco { - - -template <class Value, class HashFunc = Hash<Value> > -class LinearHashTable - /// This class implements a linear hash table. - /// - /// In a linear hash table, the available address space - /// grows or shrinks dynamically. A linar hash table thus - /// supports any number of insertions or deletions without - /// lookup or insertion performance deterioration. - /// - /// Linear hashing was discovered by Witold Litwin in 1980 - /// and described in the paper LINEAR HASHING: A NEW TOOL FOR FILE AND TABLE ADDRESSING. - /// - /// For more information on linear hashing, see <http://en.wikipedia.org/wiki/Linear_hash>. - /// - /// The LinearHashTable is not thread safe. - /// - /// Value must support comparison for equality. - /// - /// Find, insert and delete operations are basically O(1) with regard - /// to the total number of elements in the table, and O(N) with regard - /// to the number of elements in the bucket where the element is stored. - /// On average, every bucket stores one element; the exact number depends - /// on the quality of the hash function. In most cases, the maximum number of - /// elements in a bucket should not exceed 3. -{ -public: - typedef Value ValueType; - typedef Value& Reference; - typedef const Value& ConstReference; - typedef Value* Pointer; - typedef const Value* ConstPointer; - typedef HashFunc Hash; - typedef std::vector<Value> Bucket; - typedef std::vector<Bucket> BucketVec; - typedef typename Bucket::iterator BucketIterator; - typedef typename BucketVec::iterator BucketVecIterator; - - class ConstIterator: public std::iterator<std::forward_iterator_tag, Value> - { - public: - ConstIterator(): _initialized(false) - { - } - - ConstIterator(const BucketVecIterator& vecIt, const BucketVecIterator& endIt, const BucketIterator& buckIt): - _vecIt(vecIt), - _endIt(endIt), - _buckIt(buckIt), - _initialized(true) - { - } - - ConstIterator(const ConstIterator& it): - _vecIt(it._vecIt), - _endIt(it._endIt), - _buckIt(it._buckIt), - _initialized(it._initialized) - - { - } - - ConstIterator& operator = (const ConstIterator& it) - { - ConstIterator tmp(it); - swap(tmp); - return *this; - } - - void swap(ConstIterator& it) - { - using std::swap; - // uninitialized iterators crash when swapped - if (_initialized) - { - swap(_vecIt, it._vecIt); - swap(_endIt, it._endIt); - swap(_buckIt, it._buckIt); - swap(_initialized, it._initialized); - } - else - { - _vecIt = it._vecIt; - _endIt = it._endIt; - _buckIt = it._buckIt; - _initialized = it._initialized; - } - } - - bool operator == (const ConstIterator& it) const - { - return _vecIt == it._vecIt && (_vecIt == _endIt || _buckIt == it._buckIt); - } - - bool operator != (const ConstIterator& it) const - { - return _vecIt != it._vecIt || (_vecIt != _endIt && _buckIt != it._buckIt); - } - - const typename Bucket::value_type& operator * () const - { - return *_buckIt; - } - - const typename Bucket::value_type* operator -> () const - { - return &*_buckIt; - } - - ConstIterator& operator ++ () // prefix - { - if (_vecIt != _endIt) - { - ++_buckIt; - while (_vecIt != _endIt && _buckIt == _vecIt->end()) - { - ++_vecIt; - if (_vecIt != _endIt) _buckIt = _vecIt->begin(); - } - } - return *this; - } - - ConstIterator operator ++ (int) // postfix - { - ConstIterator tmp(*this); - ++*this; - return tmp; - } - - protected: - BucketVecIterator _vecIt; - BucketVecIterator _endIt; - BucketIterator _buckIt; - bool _initialized; - - friend class LinearHashTable; - }; - - class Iterator: public ConstIterator - { - public: - Iterator() - { - } - - Iterator(const BucketVecIterator& vecIt, const BucketVecIterator& endIt, const BucketIterator& buckIt): - ConstIterator(vecIt, endIt, buckIt) - { - } - - Iterator(const Iterator& it): - ConstIterator(it) - { - } - - Iterator& operator = (const Iterator& it) - { - Iterator tmp(it); - ConstIterator::swap(tmp); - return *this; - } - - void swap(Iterator& it) - { - ConstIterator::swap(it); - } - - typename Bucket::value_type& operator * () - { - return *this->_buckIt; - } - - const typename Bucket::value_type& operator * () const - { - return *this->_buckIt; - } - - typename Bucket::value_type* operator -> () - { - return &*this->_buckIt; - } - - const typename Bucket::value_type* operator -> () const - { - return &*this->_buckIt; - } - - Iterator& operator ++ () // prefix - { - ConstIterator::operator ++ (); - return *this; - } - - Iterator operator ++ (int) // postfix - { - Iterator tmp(*this); - ++*this; - return tmp; - } - - friend class LinearHashTable; - }; - - LinearHashTable(std::size_t initialReserve = 64): - _split(0), - _front(1), - _size(0) - /// Creates the LinearHashTable, using the given initialReserve. - { - _buckets.reserve(calcSize(initialReserve)); - _buckets.push_back(Bucket()); - } - - LinearHashTable(const LinearHashTable& table): - _buckets(table._buckets), - _split(table._split), - _front(table._front), - _size(table._size) - /// Creates the LinearHashTable by copying another one. - { - } - - ~LinearHashTable() - /// Destroys the LinearHashTable. - { - } - - LinearHashTable& operator = (const LinearHashTable& table) - /// Assigns another LinearHashTable. - { - LinearHashTable tmp(table); - swap(tmp); - return *this; - } - - void swap(LinearHashTable& table) - /// Swaps the LinearHashTable with another one. - { - using std::swap; - swap(_buckets, table._buckets); - swap(_split, table._split); - swap(_front, table._front); - swap(_size, table._size); - } - - ConstIterator begin() const - /// Returns an iterator pointing to the first entry, if one exists. - { - BucketVecIterator it(_buckets.begin()); - BucketVecIterator end(_buckets.end()); - while (it != end && it->empty()) - { - ++it; - } - if (it == end) - return this->end(); - else - return ConstIterator(it, end, it->begin()); - } - - ConstIterator end() const - /// Returns an iterator pointing to the end of the table. - { - return ConstIterator(_buckets.end(), _buckets.end(), _buckets.front().end()); - } - - Iterator begin() - /// Returns an iterator pointing to the first entry, if one exists. - { - BucketVecIterator it(_buckets.begin()); - BucketVecIterator end(_buckets.end()); - while (it != end && it->empty()) - { - ++it; - } - if (it == end) - return this->end(); - else - return Iterator(it, end, it->begin()); - } - - Iterator end() - /// Returns an iterator pointing to the end of the table. - { - return Iterator(_buckets.end(), _buckets.end(), _buckets.front().end()); - } - - ConstIterator find(const Value& value) const - /// Finds an entry in the table. - { - std::size_t addr = bucketAddress(value); - BucketVecIterator it(_buckets.begin() + addr); - BucketIterator buckIt(std::find(it->begin(), it->end(), value)); - if (buckIt != it->end()) - return ConstIterator(it, _buckets.end(), buckIt); - else - return end(); - } - - Iterator find(const Value& value) - /// Finds an entry in the table. - { - std::size_t addr = bucketAddress(value); - BucketVecIterator it(_buckets.begin() + addr); - BucketIterator buckIt(std::find(it->begin(), it->end(), value)); - if (buckIt != it->end()) - return Iterator(it, _buckets.end(), buckIt); - else - return end(); - } - - std::size_t count(const Value& value) const - /// Returns the number of elements with the given - /// value, with is either 1 or 0. - { - return find(value) != end() ? 1 : 0; - } - - std::pair<Iterator, bool> insert(const Value& value) - /// Inserts an element into the table. - /// - /// If the element already exists in the table, - /// a pair(iterator, false) with iterator pointing to the - /// existing element is returned. - /// Otherwise, the element is inserted an a - /// pair(iterator, true) with iterator - /// pointing to the new element is returned. - { - std::size_t hash = _hash(value); - std::size_t addr = bucketAddressForHash(hash); - BucketVecIterator it(_buckets.begin() + addr); - BucketIterator buckIt(std::find(it->begin(), it->end(), value)); - if (buckIt == it->end()) - { - split(); - addr = bucketAddressForHash(hash); - it = _buckets.begin() + addr; - buckIt = it->insert(it->end(), value); - ++_size; - return std::make_pair(Iterator(it, _buckets.end(), buckIt), true); - } - else - { - return std::make_pair(Iterator(it, _buckets.end(), buckIt), false); - } - } - - void erase(Iterator it) - /// Erases the element pointed to by it. - { - if (it != end()) - { - it._vecIt->erase(it._buckIt); - --_size; - merge(); - } - } - - void erase(const Value& value) - /// Erases the element with the given value, if it exists. - { - Iterator it = find(value); - erase(it); - } - - void clear() - /// Erases all elements. - { - LinearHashTable empty; - swap(empty); - } - - std::size_t size() const - /// Returns the number of elements in the table. - { - return _size; - } - - bool empty() const - /// Returns true iff the table is empty. - { - return _size == 0; - } - - std::size_t buckets() const - /// Returns the number of allocated buckets. - { - return _buckets.size(); - } - -protected: - std::size_t bucketAddress(const Value& value) const - { - std::size_t n = _hash(value); - if (n % _front >= _split) - return n % _front; - else - return n % (2*_front); - } - - std::size_t bucketAddressForHash(std::size_t hash) - { - if (hash % _front >= _split) - return hash % _front; - else - return hash % (2*_front); - } - - void split() - { - if (_split == _front) - { - _split = 0; - _front *= 2; - _buckets.reserve(_front*2); - } - Bucket tmp; - _buckets.push_back(tmp); - _buckets[_split].swap(tmp); - ++_split; - for (BucketIterator it = tmp.begin(); it != tmp.end(); ++it) - { - using std::swap; - std::size_t addr = bucketAddress(*it); - _buckets[addr].push_back(Value()); - swap(*it, _buckets[addr].back()); - } - } - - void merge() - { - if (_split == 0) - { - _front /= 2; - _split = _front; - } - --_split; - Bucket tmp; - tmp.swap(_buckets.back()); - _buckets.pop_back(); - for (BucketIterator it = tmp.begin(); it != tmp.end(); ++it) - { - using std::swap; - std::size_t addr = bucketAddress(*it); - _buckets[addr].push_back(Value()); - swap(*it, _buckets[addr].back()); - } - } - - static std::size_t calcSize(std::size_t initialSize) - { - std::size_t size = 32; - while (size < initialSize) size *= 2; - return size; - } - -private: - // Evil hack: _buckets must be mutable because both ConstIterator and Iterator hold - // ordinary iterator's (not const_iterator's). - mutable BucketVec _buckets; - std::size_t _split; - std::size_t _front; - std::size_t _size; - HashFunc _hash; -}; - - -} // namespace Poco - - -#endif // Foundation_LinearHashTable_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/PBKDF2Engine.h b/contrib/libs/poco/Foundation/include/Poco/PBKDF2Engine.h deleted file mode 100644 index 357d482afe..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/PBKDF2Engine.h +++ /dev/null @@ -1,149 +0,0 @@ -// -// PBKDF2Engine.h -// -// Library: Foundation -// Package: Crypt -// Module: PBKDF2Engine -// -// Definition of the PBKDF2Engine class. -// -// Copyright (c) 2014, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_PBKDF2Engine_INCLUDED -#define Foundation_PBKDF2Engine_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/DigestEngine.h" -#include "Poco/ByteOrder.h" -#include <algorithm> - - -namespace Poco { - - -template <class PRF> -class PBKDF2Engine: public DigestEngine - /// This class implementes the Password-Based Key Derivation Function 2, - /// as specified in RFC 2898. The underlying DigestEngine (HMACEngine, etc.), - /// which must accept the passphrase as constructor argument (std::string), - /// must be given as template argument. - /// - /// PBKDF2 (Password-Based Key Derivation Function 2) is a key derivation function - /// that is part of RSA Laboratories' Public-Key Cryptography Standards (PKCS) series, - /// specifically PKCS #5 v2.0, also published as Internet Engineering Task Force's - /// RFC 2898. It replaces an earlier standard, PBKDF1, which could only produce - /// derived keys up to 160 bits long. - /// - /// PBKDF2 applies a pseudorandom function, such as a cryptographic hash, cipher, or - /// HMAC to the input password or passphrase along with a salt value and repeats the - /// process many times to produce a derived key, which can then be used as a - /// cryptographic key in subsequent operations. The added computational work makes - /// password cracking much more difficult, and is known as key stretching. - /// When the standard was written in 2000, the recommended minimum number of - /// iterations was 1000, but the parameter is intended to be increased over time as - /// CPU speeds increase. Having a salt added to the password reduces the ability to - /// use precomputed hashes (rainbow tables) for attacks, and means that multiple - /// passwords have to be tested individually, not all at once. The standard - /// recommends a salt length of at least 64 bits. [Wikipedia] - /// - /// The PBKDF2 algorithm is implemented as a DigestEngine. The passphrase is specified - /// by calling update(). - /// - /// Example (WPA2): - /// PBKDF2Engine<HMACEngine<SHA1Engine> > pbkdf2(ssid, 4096, 256); - /// pbkdf2.update(passphrase); - /// DigestEngine::Digest d = pbkdf2.digest(); -{ -public: - enum - { - PRF_DIGEST_SIZE = PRF::DIGEST_SIZE - }; - - PBKDF2Engine(const std::string& salt, unsigned c = 4096, Poco::UInt32 dkLen = PRF_DIGEST_SIZE): - _s(salt), - _c(c), - _dkLen(dkLen) - { - _result.reserve(_dkLen + PRF_DIGEST_SIZE); - } - - ~PBKDF2Engine() - { - } - - std::size_t digestLength() const - { - return _dkLen; - } - - void reset() - { - _p.clear(); - _result.clear(); - } - - const DigestEngine::Digest& digest() - { - Poco::UInt32 i = 1; - while (_result.size() < _dkLen) - { - f(i++); - } - _result.resize(_dkLen); - return _result; - } - -protected: - void updateImpl(const void* data, std::size_t length) - { - _p.append(reinterpret_cast<const char*>(data), length); - } - - void f(Poco::UInt32 i) - { - PRF prf(_p); - prf.update(_s); - Poco::UInt32 iBE = Poco::ByteOrder::toBigEndian(i); - prf.update(&iBE, sizeof(iBE)); - Poco::DigestEngine::Digest up = prf.digest(); - Poco::DigestEngine::Digest ux = up; - poco_assert_dbg(ux.size() == PRF_DIGEST_SIZE); - for (unsigned k = 1; k < _c; k++) - { - prf.reset(); - prf.update(&up[0], up.size()); - Poco::DigestEngine::Digest u = prf.digest(); - poco_assert_dbg(u.size() == PRF_DIGEST_SIZE); - for (int ui = 0; ui < PRF_DIGEST_SIZE; ui++) - { - ux[ui] ^= u[ui]; - } - std::swap(up, u); - } - _result.insert(_result.end(), ux.begin(), ux.end()); - } - -private: - PBKDF2Engine(); - PBKDF2Engine(const PBKDF2Engine&); - PBKDF2Engine& operator = (const PBKDF2Engine&); - - std::string _p; - std::string _s; - unsigned _c; - Poco::UInt32 _dkLen; - DigestEngine::Digest _result; -}; - - -} // namespace Poco - - -#endif // Foundation_PBKDF2Engine_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h b/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h deleted file mode 100644 index 571871be98..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/RunnableAdapter.h +++ /dev/null @@ -1,78 +0,0 @@ -// -// RunnableAdapter.h -// -// Library: Foundation -// Package: Threading -// Module: Thread -// -// Definition of the RunnableAdapter template class. -// -// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_RunnableAdapter_INCLUDED -#define Foundation_RunnableAdapter_INCLUDED - - -#include "Poco/Foundation.h" -#include "Poco/Runnable.h" - - -namespace Poco { - - -template <class C> -class RunnableAdapter: public Runnable - /// This adapter simplifies using ordinary methods as - /// targets for threads. - /// Usage: - /// RunnableAdapter<MyClass> ra(myObject, &MyObject::doSomething)); - /// Thread thr; - /// thr.Start(ra); - /// - /// For using a freestanding or static member function as a thread - /// target, please see the ThreadTarget class. -{ -public: - typedef void (C::*Callback)(); - - RunnableAdapter(C& object, Callback method): _pObject(&object), _method(method) - { - } - - RunnableAdapter(const RunnableAdapter& ra): _pObject(ra._pObject), _method(ra._method) - { - } - - ~RunnableAdapter() - { - } - - RunnableAdapter& operator = (const RunnableAdapter& ra) - { - _pObject = ra._pObject; - _method = ra._method; - return *this; - } - - void run() - { - (_pObject->*_method)(); - } - -private: - RunnableAdapter(); - - C* _pObject; - Callback _method; -}; - - -} // namespace Poco - - -#endif // Foundation_RunnableAdapter_INCLUDED diff --git a/contrib/libs/poco/Foundation/include/Poco/ValidArgs.h b/contrib/libs/poco/Foundation/include/Poco/ValidArgs.h deleted file mode 100644 index 7928a0fe8b..0000000000 --- a/contrib/libs/poco/Foundation/include/Poco/ValidArgs.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// ValidArgs.h -// -// Library: Foundation -// Package: Cache -// Module: ValidArgs -// -// Definition of the ValidArgs class. -// -// Copyright (c) 2006, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Foundation_ValidArgs_INCLUDED -#define Foundation_ValidArgs_INCLUDED - - -#include "Poco/Foundation.h" - - -namespace Poco { - - -template <class TKey> -class ValidArgs -{ -public: - ValidArgs(const TKey& key): - _key(key), - _isValid(true) - { - } - - ValidArgs(const ValidArgs& args): - _key(args._key), - _isValid(args._isValid) - { - } - - ~ValidArgs() - { - } - - const TKey& key() const - { - return _key; - } - - bool isValid() const - { - return _isValid; - } - - void invalidate() - { - _isValid = false; - } - -protected: - const TKey& _key; - bool _isValid; - -private: - ValidArgs& operator = (const ValidArgs& args); -}; - - -} // namespace Poco - - -#endif // Foundation_ValidArgs_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Array.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Array.h deleted file mode 100644 index ee306bb01f..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Array.h +++ /dev/null @@ -1,110 +0,0 @@ -// -// Array.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Array -// -// Definition of the Array class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Array_INCLUDED -#define MongoDB_Array_INCLUDED - - -#include "Poco/NumberFormatter.h" -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Document.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Array: public Document - /// This class represents a BSON Array. -{ -public: - typedef SharedPtr<Array> Ptr; - - Array(); - /// Creates an empty Array. - - virtual ~Array(); - /// Destroys the Array. - - template<typename T> - T get(int pos) const - /// Returns the element at the given index and tries to convert - /// it to the template type. If the element is not found, a - /// Poco::NotFoundException will be thrown. If the element cannot be - /// converted a BadCastException will be thrown. - { - return Document::get<T>(Poco::NumberFormatter::format(pos)); - } - - template<typename T> - T get(int pos, const T& deflt) const - /// Returns the element at the given index and tries to convert - /// it to the template type. If the element is not found, or - /// has the wrong type, the deflt argument will be returned. - { - return Document::get<T>(Poco::NumberFormatter::format(pos), deflt); - } - - Element::Ptr get(int pos) const; - /// Returns the element at the given index. - /// An empty element will be returned if the element is not found. - - template<typename T> - bool isType(int pos) const - /// Returns true if the type of the element equals the TypeId of ElementTrait, - /// otherwise false. - { - return Document::isType<T>(Poco::NumberFormatter::format(pos)); - } - - std::string toString(int indent = 0) const; - /// Returns a string representation of the Array. -}; - - -// BSON Embedded Array -// spec: document -template<> -struct ElementTraits<Array::Ptr> -{ - enum { TypeId = 0x04 }; - - static std::string toString(const Array::Ptr& value, int indent = 0) - { - //TODO: - return value.isNull() ? "null" : value->toString(indent); - } -}; - - -template<> -inline void BSONReader::read<Array::Ptr>(Array::Ptr& to) -{ - to->read(_reader); -} - - -template<> -inline void BSONWriter::write<Array::Ptr>(Array::Ptr& from) -{ - from->write(_writer); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Array_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONReader.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONReader.h deleted file mode 100644 index 3c5d9ba3e5..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONReader.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// BSONReader.h -// -// Library: MongoDB -// Package: MongoDB -// Module: BSONReader -// -// Definition of the BSONReader class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_BSONReader_INCLUDED -#define MongoDB_BSONReader_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/BinaryReader.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API BSONReader - /// Class for reading BSON using a Poco::BinaryReader -{ -public: - BSONReader(const Poco::BinaryReader& reader): - _reader(reader) - /// Creates the BSONReader using the given BinaryWriter. - { - } - - virtual ~BSONReader() - /// Destroys the BSONReader. - { - } - - template<typename T> - void read(T& t) - /// Reads the value from the reader. The default implementation uses the >> operator to - /// the given argument. Special types can write their own version. - { - _reader >> t; - } - - std::string readCString(); - /// Reads a cstring from the reader. - /// A cstring is a string terminated with a 0x00. - -private: - Poco::BinaryReader _reader; -}; - - -// -// inlines -// -inline std::string BSONReader::readCString() -{ - std::string val; - while(_reader.good()) - { - char c; - _reader >> c; - if ( _reader.good() ) - { - if (c == 0x00) return val; - else val += c; - } - } - return val; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_BSONReader_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONWriter.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONWriter.h deleted file mode 100644 index 01c9491e7c..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/BSONWriter.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// BSONWriter.h -// -// Library: MongoDB -// Package: MongoDB -// Module: BSONWriter -// -// Definition of the BSONWriter class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_BSONWriter_INCLUDED -#define MongoDB_BSONWriter_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/BinaryWriter.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API BSONWriter - /// Class for writing BSON using a Poco::BinaryWriter. -{ -public: - BSONWriter(const Poco::BinaryWriter& writer): - _writer(writer) - /// Creates the BSONWriter. - { - } - - virtual ~BSONWriter() - /// Destroys the BSONWriter. - { - } - - template<typename T> - void write(T& t) - /// Writes the value to the writer. The default implementation uses - /// the << operator. Special types can write their own version. - { - _writer << t; - } - - void writeCString(const std::string& value); - /// Writes a cstring to the writer. A cstring is a string - /// terminated a null character. - -private: - Poco::BinaryWriter _writer; -}; - - -// -// inlines -// -inline void BSONWriter::writeCString(const std::string& value) -{ - _writer.writeRaw(value); - _writer << (unsigned char) 0x00; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_BSONWriter_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Binary.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Binary.h deleted file mode 100644 index 1698ea9eb8..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Binary.h +++ /dev/null @@ -1,155 +0,0 @@ -// -// Binary.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Binary -// -// Definition of the Binary class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Binary_INCLUDED -#define MongoDB_Binary_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Element.h" -#include "Poco/Base64Encoder.h" -#include "Poco/Buffer.h" -#include "Poco/StreamCopier.h" -#include "Poco/MemoryStream.h" -#include "Poco/UUID.h" -#include <sstream> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Binary - /// Implements BSON Binary. - /// - /// A Binary stores its data in a Poco::Buffer<unsigned char>. -{ -public: - typedef SharedPtr<Binary> Ptr; - - Binary(); - /// Creates an empty Binary with subtype 0. - - Binary(Poco::Int32 size, unsigned char subtype); - /// Creates a Binary with a buffer of the given size and the given subtype. - - Binary(const UUID& uuid); - /// Creates a Binary containing an UUID. - - Binary(const std::string& data, unsigned char subtype = 0); - /// Creates a Binary with the contents of the given string and the given subtype. - - Binary(const void* data, Poco::Int32 size, unsigned char subtype = 0); - /// Creates a Binary with the contents of the given buffer and the given subtype. - - virtual ~Binary(); - /// Destroys the Binary. - - Buffer<unsigned char>& buffer(); - /// Returns a reference to the internal buffer - - unsigned char subtype() const; - /// Returns the subtype. - - void subtype(unsigned char type); - /// Sets the subtype. - - std::string toString(int indent = 0) const; - /// Returns the contents of the Binary as Base64-encoded string. - - std::string toRawString() const; - /// Returns the raw content of the Binary as a string. - - UUID uuid() const; - /// Returns the UUID when the binary subtype is 0x04. - /// Otherwise, throws a Poco::BadCastException. - -private: - Buffer<unsigned char> _buffer; - unsigned char _subtype; -}; - - -// -// inlines -// -inline unsigned char Binary::subtype() const -{ - return _subtype; -} - - -inline void Binary::subtype(unsigned char type) -{ - _subtype = type; -} - - -inline Buffer<unsigned char>& Binary::buffer() -{ - return _buffer; -} - - -inline std::string Binary::toRawString() const -{ - return std::string(reinterpret_cast<const char*>(_buffer.begin()), _buffer.size()); -} - - -// BSON Embedded Document -// spec: binary -template<> -struct ElementTraits<Binary::Ptr> -{ - enum { TypeId = 0x05 }; - - static std::string toString(const Binary::Ptr& value, int /*indent*/ = 0) - { - return value.isNull() ? "" : value->toString(); - } -}; - - -template<> -inline void BSONReader::read<Binary::Ptr>(Binary::Ptr& to) -{ - Poco::Int32 size; - _reader >> size; - - to->buffer().resize(size); - - unsigned char subtype; - _reader >> subtype; - to->subtype(subtype); - - _reader.readRaw((char*) to->buffer().begin(), size); -} - - -template<> -inline void BSONWriter::write<Binary::Ptr>(Binary::Ptr& from) -{ - _writer << (Poco::Int32) from->buffer().size(); - _writer << from->subtype(); - _writer.writeRaw((char*) from->buffer().begin(), from->buffer().size()); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Binary_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Connection.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Connection.h deleted file mode 100644 index 202ae90713..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Connection.h +++ /dev/null @@ -1,164 +0,0 @@ -// -// Connection.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Connection -// -// Definition of the Connection class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Connection_INCLUDED -#define MongoDB_Connection_INCLUDED - - -#include "Poco/Net/SocketAddress.h" -#include "Poco/Net/StreamSocket.h" -#include "Poco/Mutex.h" -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/MongoDB/ResponseMessage.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Connection - /// Represents a connection to a MongoDB server - /// using the MongoDB wire protocol. - /// - /// See https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/ - /// for more information on the wire protocol. -{ -public: - typedef Poco::SharedPtr<Connection> Ptr; - - class MongoDB_API SocketFactory - { - public: - SocketFactory(); - /// Creates the SocketFactory. - - virtual ~SocketFactory(); - /// Destroys the SocketFactory. - - virtual Poco::Net::StreamSocket createSocket(const std::string& host, int port, Poco::Timespan connectTimeout, bool secure); - /// Creates a Poco::Net::StreamSocket (if secure is false), or a - /// Poco::Net::SecureStreamSocket (if secure is true) connected to the - /// given host and port number. - /// - /// The default implementation will throw a Poco::NotImplementedException - /// if secure is true. - }; - - Connection(); - /// Creates an unconnected Connection. - /// - /// Use this when you want to connect later on. - - Connection(const std::string& hostAndPort); - /// Creates a Connection connected to the given MongoDB instance at host:port. - /// - /// The host and port must be separated with a colon. - - Connection(const std::string& uri, SocketFactory& socketFactory); - /// Creates a Connection connected to the given MongoDB instance at the - /// given URI. - /// - /// See the corresponding connect() method for more information. - - Connection(const std::string& host, int port); - /// Creates a Connection connected to the given MongoDB instance at host and port. - - Connection(const Poco::Net::SocketAddress& addrs); - /// Creates a Connection connected to the given MongoDB instance at the given address. - - Connection(const Poco::Net::StreamSocket& socket); - /// Creates a Connection connected to the given MongoDB instance using the given socket, - /// which must already be connected. - - virtual ~Connection(); - /// Destroys the Connection. - - Poco::Net::SocketAddress address() const; - /// Returns the address of the MongoDB server. - - void connect(const std::string& hostAndPort); - /// Connects to the given MongoDB server. - /// - /// The host and port must be separated with a colon. - - void connect(const std::string& uri, SocketFactory& socketFactory); - /// Connects to the given MongoDB instance at the given URI. - /// - /// The URI must be in standard MongoDB connection string URI format: - /// - /// mongodb://<user>:<password>@hostname.com:<port>/database-name?options - /// - /// The following options are supported: - /// - /// - ssl: If ssl=true is specified, a custom SocketFactory subclass creating - /// a SecureStreamSocket must be supplied. - /// - connectTimeoutMS: Socket connection timeout in milliseconds. - /// - socketTimeoutMS: Socket send/receive timeout in milliseconds. - /// - authMechanism: Authentication mechanism. Only "SCRAM-SHA-1" (default) - /// and "MONGODB-CR" are supported. - /// - /// Unknown options are silently ignored. - /// - /// Will also attempt to authenticate using the specified credentials, - /// using Database::authenticate(). - /// - /// Throws a Poco::NoPermissionException if authentication fails. - - void connect(const std::string& host, int port); - /// Connects to the given MongoDB server. - - void connect(const Poco::Net::SocketAddress& addrs); - /// Connects to the given MongoDB server. - - void connect(const Poco::Net::StreamSocket& socket); - /// Connects using an already connected socket. - - void disconnect(); - /// Disconnects from the MongoDB server. - - void sendRequest(RequestMessage& request); - /// Sends a request to the MongoDB server. - /// - /// Used for one-way requests without a response. - - void sendRequest(RequestMessage& request, ResponseMessage& response); - /// Sends a request to the MongoDB server and receives the response. - /// - /// Use this when a response is expected: only a "query" or "getmore" - /// request will return a response. - -protected: - void connect(); - -private: - Poco::Net::SocketAddress _address; - Poco::Net::StreamSocket _socket; -}; - - -// -// inlines -// -inline Net::SocketAddress Connection::address() const -{ - return _address; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Connection_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Cursor.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Cursor.h deleted file mode 100644 index b9816b0db1..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Cursor.h +++ /dev/null @@ -1,74 +0,0 @@ -// -// Cursor.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Cursor -// -// Definition of the Cursor class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Cursor_INCLUDED -#define MongoDB_Cursor_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Connection.h" -#include "Poco/MongoDB/QueryRequest.h" -#include "Poco/MongoDB/ResponseMessage.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Cursor: public Document - /// Cursor is an helper class for querying multiple documents. -{ -public: - Cursor(const std::string& dbname, const std::string& collectionName, QueryRequest::Flags flags = QueryRequest::QUERY_DEFAULT); - /// Creates a Cursor for the given database and collection, using the specified flags. - - Cursor(const std::string& fullCollectionName, QueryRequest::Flags flags = QueryRequest::QUERY_DEFAULT); - /// Creates a Cursor for the given database and collection ("database.collection"), using the specified flags. - - virtual ~Cursor(); - /// Destroys the Cursor. - - ResponseMessage& next(Connection& connection); - /// Tries to get the next documents. As long as ResponseMessage has a - /// cursor ID next can be called to retrieve the next bunch of documents. - /// - /// The cursor must be killed (see kill()) when not all documents are needed. - - QueryRequest& query(); - /// Returns the associated query. - - void kill(Connection& connection); - /// Kills the cursor and reset it so that it can be reused. - -private: - QueryRequest _query; - ResponseMessage _response; -}; - - -// -// inlines -// -inline QueryRequest& Cursor::query() -{ - return _query; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Cursor_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Database.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Database.h deleted file mode 100644 index ab276eecb3..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Database.h +++ /dev/null @@ -1,162 +0,0 @@ -// -// Database.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Database -// -// Definition of the Database class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Database_INCLUDED -#define MongoDB_Database_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Connection.h" -#include "Poco/MongoDB/Document.h" -#include "Poco/MongoDB/QueryRequest.h" -#include "Poco/MongoDB/InsertRequest.h" -#include "Poco/MongoDB/UpdateRequest.h" -#include "Poco/MongoDB/DeleteRequest.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Database - /// Database is a helper class for creating requests. MongoDB works with - /// collection names and uses the part before the first dot as the name of - /// the database. -{ -public: - explicit Database(const std::string& name); - /// Creates a Database for the database with the given name. - - virtual ~Database(); - /// Destroys the Database. - - bool authenticate(Connection& connection, const std::string& username, const std::string& password, const std::string& method = AUTH_SCRAM_SHA1); - /// Authenticates against the database using the given connection, - /// username and password, as well as authentication method. - /// - /// "MONGODB-CR" (default prior to MongoDB 3.0) and - /// "SCRAM-SHA-1" (default starting in 3.0) are the only supported - /// authentication methods. - /// - /// Returns true if authentication was successful, otherwise false. - /// - /// May throw a Poco::ProtocolException if authentication fails for a reason other than - /// invalid credentials. - - Int64 count(Connection& connection, const std::string& collectionName) const; - /// Sends a count request for the given collection to MongoDB. - /// - /// If the command fails, -1 is returned. - - Poco::SharedPtr<Poco::MongoDB::QueryRequest> createCommand() const; - /// Creates a QueryRequest for a command. - - Poco::SharedPtr<Poco::MongoDB::QueryRequest> createCountRequest(const std::string& collectionName) const; - /// Creates a QueryRequest to count the given collection. - /// The collectionname must not contain the database name. - - Poco::SharedPtr<Poco::MongoDB::DeleteRequest> createDeleteRequest(const std::string& collectionName) const; - /// Creates a DeleteRequest to delete documents in the given collection. - /// The collectionname must not contain the database name. - - Poco::SharedPtr<Poco::MongoDB::InsertRequest> createInsertRequest(const std::string& collectionName) const; - /// Creates an InsertRequest to insert new documents in the given collection. - /// The collectionname must not contain the database name. - - Poco::SharedPtr<Poco::MongoDB::QueryRequest> createQueryRequest(const std::string& collectionName) const; - /// Creates a QueryRequest. - /// The collectionname must not contain the database name. - - Poco::SharedPtr<Poco::MongoDB::UpdateRequest> createUpdateRequest(const std::string& collectionName) const; - /// Creates an UpdateRequest. - /// The collectionname must not contain the database name. - - Poco::MongoDB::Document::Ptr ensureIndex(Connection& connection, - const std::string& collection, - const std::string& indexName, - Poco::MongoDB::Document::Ptr keys, - bool unique = false, - bool background = false, - int version = 0, - int ttl = 0); - /// Creates an index. The document returned is the result of a getLastError call. - /// For more info look at the ensureIndex information on the MongoDB website. - - Document::Ptr getLastErrorDoc(Connection& connection) const; - /// Sends the getLastError command to the database and returns the error document. - - std::string getLastError(Connection& connection) const; - /// Sends the getLastError command to the database and returns the err element - /// from the error document. When err is null, an empty string is returned. - - static const std::string AUTH_MONGODB_CR; - /// Default authentication mechanism prior to MongoDB 3.0. - - static const std::string AUTH_SCRAM_SHA1; - /// Default authentication mechanism for MongoDB 3.0. - -protected: - bool authCR(Connection& connection, const std::string& username, const std::string& password); - bool authSCRAM(Connection& connection, const std::string& username, const std::string& password); - -private: - std::string _dbname; -}; - - -// -// inlines -// -inline Poco::SharedPtr<Poco::MongoDB::QueryRequest> Database::createCommand() const -{ - Poco::SharedPtr<Poco::MongoDB::QueryRequest> cmd = createQueryRequest("$cmd"); - cmd->setNumberToReturn(1); - return cmd; -} - - -inline Poco::SharedPtr<Poco::MongoDB::DeleteRequest> -Database::createDeleteRequest(const std::string& collectionName) const -{ - return new Poco::MongoDB::DeleteRequest(_dbname + '.' + collectionName); -} - - -inline Poco::SharedPtr<Poco::MongoDB::InsertRequest> -Database::createInsertRequest(const std::string& collectionName) const -{ - return new Poco::MongoDB::InsertRequest(_dbname + '.' + collectionName); -} - - -inline Poco::SharedPtr<Poco::MongoDB::QueryRequest> -Database::createQueryRequest(const std::string& collectionName) const -{ - return new Poco::MongoDB::QueryRequest(_dbname + '.' + collectionName); -} - - -inline Poco::SharedPtr<Poco::MongoDB::UpdateRequest> -Database::createUpdateRequest(const std::string& collectionName) const -{ - return new Poco::MongoDB::UpdateRequest(_dbname + '.' + collectionName); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Database_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/DeleteRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/DeleteRequest.h deleted file mode 100644 index 8f3486d07f..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/DeleteRequest.h +++ /dev/null @@ -1,113 +0,0 @@ -// -// DeleteRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: DeleteRequest -// -// Definition of the DeleteRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_DeleteRequest_INCLUDED -#define MongoDB_DeleteRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/MongoDB/Document.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API DeleteRequest: public RequestMessage - /// A DeleteRequest is used to delete one ore more documents from a database. - /// - /// Specific flags for this request - /// - DELETE_DEFAULT: default delete operation - /// - DELETE_SINGLE_REMOVE: delete only the first document -{ -public: - enum Flags - { - DELETE_DEFAULT = 0, - /// Default - - DELETE_SINGLE_REMOVE = 1 - /// Delete only the first document. - }; - - DeleteRequest(const std::string& collectionName, Flags flags = DELETE_DEFAULT); - /// Creates a DeleteRequest for the given collection using the given flags. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". - - DeleteRequest(const std::string& collectionName, bool justOne); - /// Creates a DeleteRequest for the given collection. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". - /// - /// If justOne is true, only the first matching document will - /// be removed (the same as using flag DELETE_SINGLE_REMOVE). - - virtual ~DeleteRequest(); - /// Destructor - - Flags flags() const; - /// Returns the flags. - - void flags(Flags flag); - /// Sets the flags. - - Document& selector(); - /// Returns the selector document. - -protected: - void buildRequest(BinaryWriter& writer); - /// Writes the OP_DELETE request to the writer. - -private: - Flags _flags; - std::string _fullCollectionName; - Document _selector; -}; - - -/// -/// inlines -/// -inline DeleteRequest::Flags DeleteRequest::flags() const -{ - return _flags; -} - - -inline void DeleteRequest::flags(DeleteRequest::Flags flags) -{ - _flags = flags; -} - - -inline Document& DeleteRequest::selector() -{ - return _selector; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_DeleteRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Document.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Document.h deleted file mode 100644 index 674a1f789f..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Document.h +++ /dev/null @@ -1,277 +0,0 @@ -// -// Document.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Document -// -// Definition of the Document class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Document_INCLUDED -#define MongoDB_Document_INCLUDED - - -#include "Poco/BinaryReader.h" -#include "Poco/BinaryWriter.h" -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Element.h" -#include <algorithm> -#include <cstdlib> - - -namespace Poco { -namespace MongoDB { - - -class ElementFindByName -{ -public: - ElementFindByName(const std::string& name): - _name(name) - { - } - - bool operator()(const Element::Ptr& element) - { - return !element.isNull() && element->name() == _name; - } - -private: - std::string _name; -}; - - -class MongoDB_API Document - /// Represents a MongoDB (BSON) document. -{ -public: - typedef SharedPtr<Document> Ptr; - typedef std::vector<Document::Ptr> Vector; - - Document(); - /// Creates an empty Document. - - virtual ~Document(); - /// Destroys the Document. - - Document& addElement(Element::Ptr element); - /// Add an element to the document. - /// - /// The active document is returned to allow chaining of the add methods. - - template<typename T> - Document& add(const std::string& name, T value) - /// Creates an element with the given name and value and - /// adds it to the document. - /// - /// The active document is returned to allow chaining of the add methods. - { - return addElement(new ConcreteElement<T>(name, value)); - } - - Document& add(const std::string& name, const char* value) - /// Creates an element with the given name and value and - /// adds it to the document. - /// - /// The active document is returned to allow chaining of the add methods. - { - return addElement(new ConcreteElement<std::string>(name, std::string(value))); - } - - Document& addNewDocument(const std::string& name); - /// Create a new document and add it to this document. - /// Unlike the other add methods, this method returns - /// a reference to the new document. - - void clear(); - /// Removes all elements from the document. - - void elementNames(std::vector<std::string>& keys) const; - /// Puts all element names into std::vector. - - bool empty() const; - /// Returns true if the document doesn't contain any documents. - - bool exists(const std::string& name); - /// Returns true if the document has an element with the given name. - - template<typename T> - T get(const std::string& name) const - /// Returns the element with the given name and tries to convert - /// it to the template type. When the element is not found, a - /// NotFoundException will be thrown. When the element can't be - /// converted a BadCastException will be thrown. - { - Element::Ptr element = get(name); - if (element.isNull()) - { - throw NotFoundException(name); - } - else - { - if (ElementTraits<T>::TypeId == element->type()) - { - ConcreteElement<T>* concrete = dynamic_cast<ConcreteElement<T>* >(element.get()); - if (concrete != 0) - { - return concrete->value(); - } - } - throw BadCastException("Invalid type mismatch!"); - } - } - - template<typename T> - T get(const std::string& name, const T& def) const - /// Returns the element with the given name and tries to convert - /// it to the template type. When the element is not found, or - /// has the wrong type, the def argument will be returned. - { - Element::Ptr element = get(name); - if (element.isNull()) - { - return def; - } - - if (ElementTraits<T>::TypeId == element->type()) - { - ConcreteElement<T>* concrete = dynamic_cast<ConcreteElement<T>* >(element.get()); - if (concrete != 0) - { - return concrete->value(); - } - } - - return def; - } - - Element::Ptr get(const std::string& name) const; - /// Returns the element with the given name. - /// An empty element will be returned when the element is not found. - - Int64 getInteger(const std::string& name) const; - /// Returns an integer. Useful when MongoDB returns Int32, Int64 - /// or double for a number (count for example). This method will always - /// return an Int64. When the element is not found, a - /// Poco::NotFoundException will be thrown. - - template<typename T> - bool isType(const std::string& name) const - /// Returns true when the type of the element equals the TypeId of ElementTrait. - { - Element::Ptr element = get(name); - if (element.isNull()) - { - return false; - } - - return ElementTraits<T>::TypeId == element->type(); - } - - void read(BinaryReader& reader); - /// Reads a document from the reader - - std::size_t size() const; - /// Returns the number of elements in the document. - - virtual std::string toString(int indent = 0) const; - /// Returns a String representation of the document. - - void write(BinaryWriter& writer); - /// Writes a document to the reader - -protected: - ElementSet _elements; -}; - - -// -// inlines -// -inline Document& Document::addElement(Element::Ptr element) -{ - _elements.push_back(element); - return *this; -} - - -inline Document& Document::addNewDocument(const std::string& name) -{ - Document::Ptr newDoc = new Document(); - add(name, newDoc); - return *newDoc; -} - - -inline void Document::clear() -{ - _elements.clear(); -} - - -inline bool Document::empty() const -{ - return _elements.empty(); -} - - -inline void Document::elementNames(std::vector<std::string>& keys) const -{ - for (ElementSet::const_iterator it = _elements.begin(); it != _elements.end(); ++it) - { - keys.push_back((*it)->name()); - } -} - - -inline bool Document::exists(const std::string& name) -{ - return std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name)) != _elements.end(); -} - - -inline std::size_t Document::size() const -{ - return _elements.size(); -} - - -// BSON Embedded Document -// spec: document -template<> -struct ElementTraits<Document::Ptr> -{ - enum { TypeId = 0x03 }; - - static std::string toString(const Document::Ptr& value, int indent = 0) - { - return value.isNull() ? "null" : value->toString(indent); - } -}; - - -template<> -inline void BSONReader::read<Document::Ptr>(Document::Ptr& to) -{ - to->read(_reader); -} - - -template<> -inline void BSONWriter::write<Document::Ptr>(Document::Ptr& from) -{ - from->write(_writer); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Document_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Element.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Element.h deleted file mode 100644 index ff0de5b6df..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Element.h +++ /dev/null @@ -1,403 +0,0 @@ -// -// Element.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Element -// -// Definition of the Element class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Element_INCLUDED -#define MongoDB_Element_INCLUDED - - -#include "Poco/BinaryReader.h" -#include "Poco/BinaryWriter.h" -#include "Poco/SharedPtr.h" -#include "Poco/Timestamp.h" -#include "Poco/Nullable.h" -#include "Poco/NumberFormatter.h" -#include "Poco/DateTimeFormatter.h" -#include "Poco/UTF8String.h" -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/BSONReader.h" -#include "Poco/MongoDB/BSONWriter.h" -#include <string> -#include <sstream> -#include <iomanip> -#include <list> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Element - /// Represents an Element of a Document or an Array. -{ -public: - typedef Poco::SharedPtr<Element> Ptr; - - explicit Element(const std::string& name); - /// Creates the Element with the given name. - - virtual ~Element(); - /// Destructor - - const std::string& name() const; - /// Returns the name of the element. - - virtual std::string toString(int indent = 0) const = 0; - /// Returns a string representation of the element. - - virtual int type() const = 0; - /// Returns the MongoDB type of the element. - -private: - virtual void read(BinaryReader& reader) = 0; - virtual void write(BinaryWriter& writer) = 0; - - friend class Document; - std::string _name; -}; - - -// -// inlines -// -inline const std::string& Element::name() const -{ - return _name; -} - - -typedef std::list<Element::Ptr> ElementSet; - - -template<typename T> -struct ElementTraits -{ -}; - - -// BSON Floating point -// spec: double -template<> -struct ElementTraits<double> -{ - enum { TypeId = 0x01 }; - - static std::string toString(const double& value, int /*indent*/ = 0) - { - return Poco::NumberFormatter::format(value); - } -}; - - -// BSON UTF-8 string -// spec: int32 (byte*) "\x00" -// int32 is the number bytes in byte* + 1 (for trailing "\x00") -template<> -struct ElementTraits<std::string> -{ - enum { TypeId = 0x02 }; - - static std::string toString(const std::string& value, int /*indent*/ = 0) - { - std::ostringstream oss; - - oss << '"'; - - for (std::string::const_iterator it = value.begin(); it != value.end(); ++it) - { - switch (*it) - { - case '"': - oss << "\\\""; - break; - case '\\': - oss << "\\\\"; - break; - case '\b': - oss << "\\b"; - break; - case '\f': - oss << "\\f"; - break; - case '\n': - oss << "\\n"; - break; - case '\r': - oss << "\\r"; - break; - case '\t': - oss << "\\t"; - break; - default: - { - if ( *it > 0 && *it <= 0x1F ) - { - oss << "\\u" << std::hex << std::uppercase << std::setfill('0') << std::setw(4) << static_cast<int>(*it); - } - else - { - oss << *it; - } - break; - } - } - } - oss << '"'; - return oss.str(); - } -}; - - -template<> -inline void BSONReader::read<std::string>(std::string& to) -{ - Poco::Int32 size; - _reader >> size; - _reader.readRaw(size, to); - to.erase(to.end() - 1); // remove terminating 0 -} - - -template<> -inline void BSONWriter::write<std::string>(std::string& from) -{ - _writer << (Poco::Int32) (from.length() + 1); - writeCString(from); -} - - -// BSON bool -// spec: "\x00" "\x01" -template<> -struct ElementTraits<bool> -{ - enum { TypeId = 0x08 }; - - static std::string toString(const bool& value, int /*indent*/ = 0) - { - return value ? "true" : "false"; - } -}; - - -template<> -inline void BSONReader::read<bool>(bool& to) -{ - unsigned char b; - _reader >> b; - to = b != 0; -} - - -template<> -inline void BSONWriter::write<bool>(bool& from) -{ - unsigned char b = from ? 0x01 : 0x00; - _writer << b; -} - - -// BSON 32-bit integer -// spec: int32 -template<> -struct ElementTraits<Int32> -{ - enum { TypeId = 0x10 }; - - - static std::string toString(const Int32& value, int /*indent*/ = 0) - { - return Poco::NumberFormatter::format(value); - } -}; - - -// BSON UTC datetime -// spec: int64 -template<> -struct ElementTraits<Timestamp> -{ - enum { TypeId = 0x09 }; - - static std::string toString(const Timestamp& value, int /*indent*/ = 0) - { - std::string result; - result.append(1, '"'); - result.append(DateTimeFormatter::format(value, "%Y-%m-%dT%H:%M:%s%z")); - result.append(1, '"'); - return result; - } -}; - - -template<> -inline void BSONReader::read<Timestamp>(Timestamp& to) -{ - Poco::Int64 value; - _reader >> value; - to = Timestamp::fromEpochTime(static_cast<std::time_t>(value / 1000)); - to += (value % 1000 * 1000); -} - - -template<> -inline void BSONWriter::write<Timestamp>(Timestamp& from) -{ - _writer << (from.epochMicroseconds() / 1000); -} - - -typedef Nullable<unsigned char> NullValue; - - -// BSON Null Value -// spec: -template<> -struct ElementTraits<NullValue> -{ - enum { TypeId = 0x0A }; - - static std::string toString(const NullValue& /*value*/, int /*indent*/ = 0) - { - return "null"; - } -}; - - -template<> -inline void BSONReader::read<NullValue>(NullValue& /*to*/) -{ -} - - -template<> -inline void BSONWriter::write<NullValue>(NullValue& /*from*/) -{ -} - - -struct BSONTimestamp -{ - Poco::Timestamp ts; - Poco::Int32 inc; -}; - - -// BSON Timestamp -// spec: int64 -template<> -struct ElementTraits<BSONTimestamp> -{ - enum { TypeId = 0x11 }; - - static std::string toString(const BSONTimestamp& value, int /*indent*/ = 0) - { - std::string result; - result.append(1, '"'); - result.append(DateTimeFormatter::format(value.ts, "%Y-%m-%dT%H:%M:%s%z")); - result.append(1, ' '); - result.append(NumberFormatter::format(value.inc)); - result.append(1, '"'); - return result; - } -}; - - -template<> -inline void BSONReader::read<BSONTimestamp>(BSONTimestamp& to) -{ - Poco::Int64 value; - _reader >> value; - to.inc = value & 0xffffffff; - value >>= 32; - to.ts = Timestamp::fromEpochTime(static_cast<std::time_t>(value)); -} - - -template<> -inline void BSONWriter::write<BSONTimestamp>(BSONTimestamp& from) -{ - Poco::Int64 value = from.ts.epochMicroseconds() / 1000; - value <<= 32; - value += from.inc; - _writer << value; -} - - -// BSON 64-bit integer -// spec: int64 -template<> -struct ElementTraits<Int64> -{ - enum { TypeId = 0x12 }; - - static std::string toString(const Int64& value, int /*indent*/ = 0) - { - return NumberFormatter::format(value); - } -}; - - -template<typename T> -class ConcreteElement: public Element -{ -public: - ConcreteElement(const std::string& name, const T& init): - Element(name), - _value(init) - { - } - - virtual ~ConcreteElement() - { - } - - - T value() const - { - return _value; - } - - - std::string toString(int indent = 0) const - { - return ElementTraits<T>::toString(_value, indent); - } - - - int type() const - { - return ElementTraits<T>::TypeId; - } - - void read(BinaryReader& reader) - { - BSONReader(reader).read(_value); - } - - void write(BinaryWriter& writer) - { - BSONWriter(writer).write(_value); - } - -private: - T _value; -}; - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Element_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/GetMoreRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/GetMoreRequest.h deleted file mode 100644 index f6c3f65ab0..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/GetMoreRequest.h +++ /dev/null @@ -1,89 +0,0 @@ -// -// GetMoreRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: GetMoreRequest -// -// Definition of the GetMoreRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_GetMoreRequest_INCLUDED -#define MongoDB_GetMoreRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API GetMoreRequest: public RequestMessage - /// A GetMoreRequest is used to query the database for more documents in a collection - /// after a query request is send (OP_GETMORE). -{ -public: - GetMoreRequest(const std::string& collectionName, Int64 cursorID); - /// Creates a GetMoreRequest for the give collection and cursor. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". The cursorID has been returned by the response on the query request. - /// By default the numberToReturn is set to 100. - - virtual ~GetMoreRequest(); - /// Destroys the GetMoreRequest. - - Int32 getNumberToReturn() const; - /// Returns the limit of returned documents. - - void setNumberToReturn(Int32 n); - /// Sets the limit of returned documents. - - Int64 cursorID() const; - /// Returns the cursor ID. - -protected: - void buildRequest(BinaryWriter& writer); - -private: - std::string _fullCollectionName; - Int32 _numberToReturn; - Int64 _cursorID; -}; - - -// -// inlines -// -inline Int32 GetMoreRequest::getNumberToReturn() const -{ - return _numberToReturn; -} - - -inline void GetMoreRequest::setNumberToReturn(Int32 n) -{ - _numberToReturn = n; -} - - -inline Int64 GetMoreRequest::cursorID() const -{ - return _cursorID; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_GetMoreRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/InsertRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/InsertRequest.h deleted file mode 100644 index f9ed8a20b5..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/InsertRequest.h +++ /dev/null @@ -1,97 +0,0 @@ -// -// InsertRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: InsertRequest -// -// Definition of the InsertRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_InsertRequest_INCLUDED -#define MongoDB_InsertRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/MongoDB/Document.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API InsertRequest: public RequestMessage - /// A request for inserting one or more documents to the database - /// (OP_INSERT). -{ -public: - enum Flags - { - INSERT_DEFAULT = 0, - /// If specified, perform a normal insert operation. - - INSERT_CONTINUE_ON_ERROR = 1 - /// If set, the database will not stop processing a bulk insert if one - /// fails (e.g. due to duplicate IDs). This makes bulk insert behave similarly - /// to a series of single inserts, except lastError will be set if any insert - /// fails, not just the last one. If multiple errors occur, only the most - /// recent will be reported. - }; - - InsertRequest(const std::string& collectionName, Flags flags = INSERT_DEFAULT); - /// Creates an InsertRequest. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". - - virtual ~InsertRequest(); - /// Destroys the InsertRequest. - - Document& addNewDocument(); - /// Adds a new document for insertion. A reference to the empty document is - /// returned. InsertRequest is the owner of the Document and will free it - /// on destruction. - - Document::Vector& documents(); - /// Returns the documents to insert into the database. - -protected: - void buildRequest(BinaryWriter& writer); - -private: - Int32 _flags; - std::string _fullCollectionName; - Document::Vector _documents; -}; - - -// -// inlines -// -inline Document& InsertRequest::addNewDocument() -{ - Document::Ptr doc = new Document(); - _documents.push_back(doc); - return *doc; -} - - -inline Document::Vector& InsertRequest::documents() -{ - return _documents; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_InsertRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/JavaScriptCode.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/JavaScriptCode.h deleted file mode 100644 index f9951a68ca..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/JavaScriptCode.h +++ /dev/null @@ -1,105 +0,0 @@ -// -// JavaScriptCode.h -// -// Library: MongoDB -// Package: MongoDB -// Module: JavaScriptCode -// -// Definition of the JavaScriptCode class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_JavaScriptCode_INCLUDED -#define MongoDB_JavaScriptCode_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/BSONReader.h" -#include "Poco/MongoDB/BSONWriter.h" -#include "Poco/MongoDB/Element.h" -#include "Poco/SharedPtr.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API JavaScriptCode - /// Represents JavaScript type in BSON. -{ -public: - typedef SharedPtr<JavaScriptCode> Ptr; - - JavaScriptCode(); - /// Creates an empty JavaScriptCode object. - - virtual ~JavaScriptCode(); - /// Destroys the JavaScriptCode. - - void setCode(const std::string& code); - /// Sets the JavaScript code. - - std::string getCode() const; - /// Returns the JavaScript code. - -private: - std::string _code; -}; - - -// -// inlines -// -inline void JavaScriptCode::setCode(const std::string& code) -{ - _code = code; -} - - -inline std::string JavaScriptCode::getCode() const -{ - return _code; -} - - -// BSON JavaScript code -// spec: string -template<> -struct ElementTraits<JavaScriptCode::Ptr> -{ - enum { TypeId = 0x0D }; - - static std::string toString(const JavaScriptCode::Ptr& value, int /*indent*/ = 0) - { - return value.isNull() ? "" : value->getCode(); - } -}; - - -template<> -inline void BSONReader::read<JavaScriptCode::Ptr>(JavaScriptCode::Ptr& to) -{ - std::string code; - BSONReader(_reader).read(code); - to = new JavaScriptCode(); - to->setCode(code); -} - - -template<> -inline void BSONWriter::write<JavaScriptCode::Ptr>(JavaScriptCode::Ptr& from) -{ - std::string code = from->getCode(); - BSONWriter(_writer).write(code); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_JavaScriptCode_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/KillCursorsRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/KillCursorsRequest.h deleted file mode 100644 index 83a808535b..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/KillCursorsRequest.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// KillCursorsRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: KillCursorsRequest -// -// Definition of the KillCursorsRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_KillCursorsRequest_INCLUDED -#define MongoDB_KillCursorsRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API KillCursorsRequest: public RequestMessage - /// Class for creating an OP_KILL_CURSORS client request. This - /// request is used to kill cursors, which are still open, - /// returned by query requests. -{ -public: - KillCursorsRequest(); - /// Creates a KillCursorsRequest. - - virtual ~KillCursorsRequest(); - /// Destroys the KillCursorsRequest. - - std::vector<Int64>& cursors(); - /// The internal list of cursors. - -protected: - void buildRequest(BinaryWriter& writer); - std::vector<Int64> _cursors; -}; - - -// -// inlines -// -inline std::vector<Int64>& KillCursorsRequest::cursors() -{ - return _cursors; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_KillCursorsRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Message.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Message.h deleted file mode 100644 index f3f1edb439..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/Message.h +++ /dev/null @@ -1,73 +0,0 @@ -// -// Message.h -// -// Library: MongoDB -// Package: MongoDB -// Module: Message -// -// Definition of the Message class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_Message_INCLUDED -#define MongoDB_Message_INCLUDED - - -#include "Poco/Net/Socket.h" -#include "Poco/BinaryReader.h" -#include "Poco/BinaryWriter.h" -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/MessageHeader.h" -#include <sstream> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API Message - /// Base class for all messages send or retrieved from MongoDB server. -{ -public: - explicit Message(MessageHeader::OpCode opcode); - /// Creates a Message using the given OpCode. - - virtual ~Message(); - /// Destructor - - MessageHeader& header(); - /// Returns the message header - -protected: - MessageHeader _header; - - void messageLength(Poco::Int32 length); - /// Sets the message length in the message header -}; - - -// -// inlines -// -inline MessageHeader& Message::header() -{ - return _header; -} - - -inline void Message::messageLength(Poco::Int32 length) -{ - poco_assert(length > 0); - _header.setMessageLength(length); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_Message_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MessageHeader.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MessageHeader.h deleted file mode 100644 index 1f86612aa0..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MessageHeader.h +++ /dev/null @@ -1,130 +0,0 @@ -// -// MessageHeader.h -// -// Library: MongoDB -// Package: MongoDB -// Module: MessageHeader -// -// Definition of the MessageHeader class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_MessageHeader_INCLUDED -#define MongoDB_MessageHeader_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/MessageHeader.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API MessageHeader - /// Represents the message header which is always prepended to a - /// MongoDB request or response message. -{ -public: - static const unsigned int MSG_HEADER_SIZE = 16; - - enum OpCode - { - OP_REPLY = 1, - OP_MSG = 1000, - OP_UPDATE = 2001, - OP_INSERT = 2002, - OP_QUERY = 2004, - OP_GET_MORE = 2005, - OP_DELETE = 2006, - OP_KILL_CURSORS = 2007 - }; - - explicit MessageHeader(OpCode); - /// Creates the MessageHeader using the given OpCode. - - virtual ~MessageHeader(); - /// Destroys the MessageHeader. - - void read(BinaryReader& reader); - /// Reads the header using the given BinaryReader. - - void write(BinaryWriter& writer); - /// Writes the header using the given BinaryWriter. - - Int32 getMessageLength() const; - /// Returns the message length. - - OpCode opCode() const; - /// Returns the OpCode. - - Int32 getRequestID() const; - /// Returns the request ID of the current message. - - void setRequestID(Int32 id); - /// Sets the request ID of the current message. - - Int32 responseTo() const; - /// Returns the request id from the original request. - -private: - void setMessageLength(Int32 length); - /// Sets the message length. - - Int32 _messageLength; - Int32 _requestID; - Int32 _responseTo; - OpCode _opCode; - - friend class Message; -}; - - -// -// inlines -// -inline MessageHeader::OpCode MessageHeader::opCode() const -{ - return _opCode; -} - - -inline Int32 MessageHeader::getMessageLength() const -{ - return _messageLength; -} - - -inline void MessageHeader::setMessageLength(Int32 length) -{ - poco_assert (_messageLength >= 0); - _messageLength = MSG_HEADER_SIZE + length; -} - - -inline void MessageHeader::setRequestID(Int32 id) -{ - _requestID = id; -} - - -inline Int32 MessageHeader::getRequestID() const -{ - return _requestID; -} - -inline Int32 MessageHeader::responseTo() const -{ - return _responseTo; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_MessageHeader_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MongoDB.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MongoDB.h deleted file mode 100644 index 8e2126f129..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/MongoDB.h +++ /dev/null @@ -1,64 +0,0 @@ -// -// MongoDB.h -// -// Library: MongoDB -// Package: MongoDB -// Module: MongoDB -// -// Basic definitions for the Poco MongoDB library. -// This file must be the first file included by every other MongoDB -// header file. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDBMongoDB_INCLUDED -#define MongoDBMongoDB_INCLUDED - - -#include "Poco/Foundation.h" - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the MongoDB_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// MongoDB_API functions as being imported from a DLL, whereas this DLL sees symbols -// defined with this macro as being exported. -// - - -#if defined(_WIN32) && defined(POCO_DLL) - #if defined(MongoDB_EXPORTS) - #define MongoDB_API __declspec(dllexport) - #else - #define MongoDB_API __declspec(dllimport) - #endif -#endif - - -#if !defined(MongoDB_API) - #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) - #define MongoDB_API __attribute__ ((visibility ("default"))) - #else - #define MongoDB_API - #endif -#endif - - -// -// Automatically link MongoDB library. -// -#if defined(_MSC_VER) - #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(MongoDB_EXPORTS) - #pragma comment(lib, "PocoMongoDB" POCO_LIB_SUFFIX) - #endif -#endif - - -#endif // MongoDBMongoDB_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ObjectId.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ObjectId.h deleted file mode 100644 index 2f21f2e2f6..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ObjectId.h +++ /dev/null @@ -1,146 +0,0 @@ -// -// Array.h -// -// Library: MongoDB -// Package: MongoDB -// Module: ObjectId -// -// Definition of the ObjectId class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_ObjectId_INCLUDED -#define MongoDB_ObjectId_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Element.h" -#include "Poco/Timestamp.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API ObjectId - /// ObjectId is a 12-byte BSON type, constructed using: - /// - /// - a 4-byte timestamp, - /// - a 3-byte machine identifier, - /// - a 2-byte process id, and - /// - a 3-byte counter, starting with a random value. - /// - /// In MongoDB, documents stored in a collection require a unique _id field that acts - /// as a primary key. Because ObjectIds are small, most likely unique, and fast to generate, - /// MongoDB uses ObjectIds as the default value for the _id field if the _id field is not - /// specified; i.e., the mongod adds the _id field and generates a unique ObjectId to assign - /// as its value. -{ -public: - typedef SharedPtr<ObjectId> Ptr; - - explicit ObjectId(const std::string& id); - /// Creates an ObjectId from a string. - /// - /// The string must contain a hexadecimal representation - /// of an object ID. This means a string of 24 characters. - - ObjectId(const ObjectId& copy); - /// Creates an ObjectId by copying another one. - - virtual ~ObjectId(); - /// Destroys the ObjectId. - - Timestamp timestamp() const; - /// Returns the timestamp which is stored in the first four bytes of the id - - std::string toString(const std::string& fmt = "%02x") const; - /// Returns the id in string format. The fmt parameter - /// specifies the formatting used for individual members - /// of the ID char array. - -private: - ObjectId(); - - static int fromHex(char c); - static char fromHex(const char* c); - - unsigned char _id[12]; - - friend class BSONWriter; - friend class BSONReader; - friend class Document; -}; - - -// -// inlines -// -inline Timestamp ObjectId::timestamp() const -{ - int time; - char* T = (char *) &time; - T[0] = _id[3]; - T[1] = _id[2]; - T[2] = _id[1]; - T[3] = _id[0]; - return Timestamp::fromEpochTime((time_t) time); -} - - -inline int ObjectId::fromHex(char c) -{ - if ( '0' <= c && c <= '9' ) - return c - '0'; - if ( 'a' <= c && c <= 'f' ) - return c - 'a' + 10; - if ( 'A' <= c && c <= 'F' ) - return c - 'A' + 10; - return 0xff; -} - - -inline char ObjectId::fromHex(const char* c) -{ - return (char)((fromHex(c[0]) << 4 ) | fromHex(c[1])); -} - - -// BSON Embedded Document -// spec: ObjectId -template<> -struct ElementTraits<ObjectId::Ptr> -{ - enum { TypeId = 0x07 }; - - static std::string toString(const ObjectId::Ptr& id, int /*indent*/ = 0, - const std::string& fmt = "%02x") - { - return id->toString(fmt); - } -}; - - -template<> -inline void BSONReader::read<ObjectId::Ptr>(ObjectId::Ptr& to) -{ - _reader.readRaw((char*) to->_id, 12); -} - - -template<> -inline void BSONWriter::write<ObjectId::Ptr>(ObjectId::Ptr& from) -{ - _writer.writeRaw((char*) from->_id, 12); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_ObjectId_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/QueryRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/QueryRequest.h deleted file mode 100644 index 410828749b..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/QueryRequest.h +++ /dev/null @@ -1,187 +0,0 @@ -// -// QueryRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: QueryRequest -// -// Definition of the QueryRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_QueryRequest_INCLUDED -#define MongoDB_QueryRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/MongoDB/Document.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API QueryRequest: public RequestMessage - /// A request to query documents in a MongoDB database - /// using an OP_QUERY request. -{ -public: - enum Flags - { - QUERY_DEFAULT = 0, - /// Do not set any flags. - - QUERY_TAILABLE_CURSOR = 2, - /// Tailable means cursor is not closed when the last data is retrieved. - /// Rather, the cursor marks the final object’s position. - /// You can resume using the cursor later, from where it was located, - /// if more data were received. Like any "latent cursor", the cursor may - /// become invalid at some point (CursorNotFound) – for example if the final - /// object it references were deleted. - - QUERY_SLAVE_OK = 4, - /// Allow query of replica slave. Normally these return an error except - /// for namespace "local". - - // QUERY_OPLOG_REPLAY = 8 (internal replication use only - drivers should not implement) - - QUERY_NO_CURSOR_TIMEOUT = 16, - /// The server normally times out idle cursors after an inactivity period - /// (10 minutes) to prevent excess memory use. Set this option to prevent that. - - QUERY_AWAIT_DATA = 32, - /// Use with QUERY_TAILABLECURSOR. If we are at the end of the data, block for - /// a while rather than returning no data. After a timeout period, we do - /// return as normal. - - QUERY_EXHAUST = 64, - /// Stream the data down full blast in multiple "more" packages, on the - /// assumption that the client will fully read all data queried. - /// Faster when you are pulling a lot of data and know you want to pull - /// it all down. - /// Note: the client is not allowed to not read all the data unless it - /// closes the connection. - - QUERY_PARTIAL = 128 - /// Get partial results from a mongos if some shards are down - /// (instead of throwing an error). - }; - - QueryRequest(const std::string& collectionName, Flags flags = QUERY_DEFAULT); - /// Creates a QueryRequest. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". - - virtual ~QueryRequest(); - /// Destroys the QueryRequest. - - Flags getFlags() const; - /// Returns the flags. - - void setFlags(Flags flag); - /// Set the flags. - - std::string fullCollectionName() const; - /// Returns the <db>.<collection> used for this query. - - Int32 getNumberToSkip() const; - /// Returns the number of documents to skip. - - void setNumberToSkip(Int32 n); - /// Sets the number of documents to skip. - - Int32 getNumberToReturn() const; - /// Returns the number of documents to return. - - void setNumberToReturn(Int32 n); - /// Sets the number of documents to return (limit). - - Document& selector(); - /// Returns the selector document. - - Document& returnFieldSelector(); - /// Returns the field selector document. - -protected: - void buildRequest(BinaryWriter& writer); - -private: - Flags _flags; - std::string _fullCollectionName; - Int32 _numberToSkip; - Int32 _numberToReturn; - Document _selector; - Document _returnFieldSelector; -}; - - -// -// inlines -// -inline QueryRequest::Flags QueryRequest::getFlags() const -{ - return _flags; -} - - -inline void QueryRequest::setFlags(QueryRequest::Flags flags) -{ - _flags = flags; -} - - -inline std::string QueryRequest::fullCollectionName() const -{ - return _fullCollectionName; -} - - -inline Document& QueryRequest::selector() -{ - return _selector; -} - - -inline Document& QueryRequest::returnFieldSelector() -{ - return _returnFieldSelector; -} - - -inline Int32 QueryRequest::getNumberToSkip() const -{ - return _numberToSkip; -} - - -inline void QueryRequest::setNumberToSkip(Int32 n) -{ - _numberToSkip = n; -} - - -inline Int32 QueryRequest::getNumberToReturn() const -{ - return _numberToReturn; -} - - -inline void QueryRequest::setNumberToReturn(Int32 n) -{ - _numberToReturn = n; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_QueryRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RegularExpression.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RegularExpression.h deleted file mode 100644 index dedc9ea0a5..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RegularExpression.h +++ /dev/null @@ -1,129 +0,0 @@ -// -// RegularExpression.h -// -// Library: MongoDB -// Package: MongoDB -// Module: RegularExpression -// -// Definition of the RegularExpression class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_RegularExpression_INCLUDED -#define MongoDB_RegularExpression_INCLUDED - - -#include "Poco/RegularExpression.h" -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Element.h" - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API RegularExpression - /// Represents a regular expression in BSON format. -{ -public: - typedef SharedPtr<RegularExpression> Ptr; - - RegularExpression(); - /// Creates an empty RegularExpression. - - RegularExpression(const std::string& pattern, const std::string& options); - /// Creates a RegularExpression using the given pattern and options. - - virtual ~RegularExpression(); - /// Destroys the RegularExpression. - - SharedPtr<Poco::RegularExpression> createRE() const; - /// Tries to create a Poco::RegularExpression from the MongoDB regular expression. - - std::string getOptions() const; - /// Returns the options string. - - void setOptions(const std::string& options); - /// Sets the options string. - - std::string getPattern() const; - /// Returns the pattern. - - void setPattern(const std::string& pattern); - /// Sets the pattern. - -private: - std::string _pattern; - std::string _options; -}; - - -/// -/// inlines -/// -inline std::string RegularExpression::getPattern() const -{ - return _pattern; -} - - -inline void RegularExpression::setPattern(const std::string& pattern) -{ - _pattern = pattern; -} - - -inline std::string RegularExpression::getOptions() const -{ - return _options; -} - - -inline void RegularExpression::setOptions(const std::string& options) -{ - _options = options; -} - - -// BSON Regex -// spec: cstring cstring -template<> -struct ElementTraits<RegularExpression::Ptr> -{ - enum { TypeId = 0x0B }; - - static std::string toString(const RegularExpression::Ptr& /*value*/, int /*indent*/ = 0) - { - //TODO - return "RE: not implemented yet"; - } -}; - - -template<> -inline void BSONReader::read<RegularExpression::Ptr>(RegularExpression::Ptr& to) -{ - std::string pattern = readCString(); - std::string options = readCString(); - - to = new RegularExpression(pattern, options); -} - - -template<> -inline void BSONWriter::write<RegularExpression::Ptr>(RegularExpression::Ptr& from) -{ - writeCString(from->getPattern()); - writeCString(from->getOptions()); -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_RegularExpression_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ReplicaSet.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ReplicaSet.h deleted file mode 100644 index 1f7cd93d64..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ReplicaSet.h +++ /dev/null @@ -1,58 +0,0 @@ -// -// ReplicaSet.h -// -// Library: MongoDB -// Package: MongoDB -// Module: ReplicaSet -// -// Definition of the ReplicaSet class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_ReplicaSet_INCLUDED -#define MongoDB_ReplicaSet_INCLUDED - - -#include "Poco/Net/SocketAddress.h" -#include "Poco/MongoDB/Connection.h" -#include <vector> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API ReplicaSet - /// Class for working with a MongoDB replica set. -{ -public: - explicit ReplicaSet(const std::vector<Net::SocketAddress>& addresses); - /// Creates the ReplicaSet using the given server addresses. - - virtual ~ReplicaSet(); - /// Destroys the ReplicaSet. - - Connection::Ptr findMaster(); - /// Tries to find the master MongoDB instance from the addresses - /// passed to the constructor. - /// - /// Returns the Connection to the master, or null if no master - /// instance was found. - -protected: - Connection::Ptr isMaster(const Net::SocketAddress& host); - -private: - std::vector<Net::SocketAddress> _addresses; -}; - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_ReplicaSet_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RequestMessage.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RequestMessage.h deleted file mode 100644 index 9ebb4a5693..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/RequestMessage.h +++ /dev/null @@ -1,51 +0,0 @@ -// -// RequestMessage.h -// -// Library: MongoDB -// Package: MongoDB -// Module: RequestMessage -// -// Definition of the RequestMessage class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_RequestMessage_INCLUDED -#define MongoDB_RequestMessage_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Message.h" -#include <ostream> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API RequestMessage: public Message - /// Base class for a request sent to the MongoDB server. -{ -public: - explicit RequestMessage(MessageHeader::OpCode opcode); - /// Creates a RequestMessage using the given opcode. - - virtual ~RequestMessage(); - /// Destroys the RequestMessage. - - void send(std::ostream& ostr); - /// Writes the request to stream. - -protected: - virtual void buildRequest(BinaryWriter& ss) = 0; -}; - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_RequestMessage_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ResponseMessage.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ResponseMessage.h deleted file mode 100644 index dd9ecd23ee..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/ResponseMessage.h +++ /dev/null @@ -1,108 +0,0 @@ -// -// ResponseMessage.h -// -// Library: MongoDB -// Package: MongoDB -// Module: ResponseMessage -// -// Definition of the ResponseMessage class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_ResponseMessage_INCLUDED -#define MongoDB_ResponseMessage_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/Message.h" -#include "Poco/MongoDB/Document.h" -#include <istream> -#include <cstdlib> - - -namespace Poco { -namespace MongoDB { - - -class MongoDB_API ResponseMessage: public Message - /// This class represents a response (OP_REPLY) from MongoDB. -{ -public: - ResponseMessage(); - /// Creates an empty ResponseMessage. - - virtual ~ResponseMessage(); - /// Destroys the ResponseMessage. - - Int64 cursorID() const; - /// Returns the cursor ID. - - void clear(); - /// Clears the response. - - std::size_t count() const; - /// Returns the number of documents in the response. - - Document::Vector& documents(); - /// Returns a vector containing the received documents. - - bool empty() const; - /// Returns true if the response does not contain any documents. - - bool hasDocuments() const; - /// Returns true if there is at least one document in the response. - - void read(std::istream& istr); - /// Reads the response from the stream. - -private: - Int32 _responseFlags; - Int64 _cursorID; - Int32 _startingFrom; - Int32 _numberReturned; - Document::Vector _documents; -}; - - -// -// inlines -// -inline std::size_t ResponseMessage::count() const -{ - return _documents.size(); -} - - -inline bool ResponseMessage::empty() const -{ - return _documents.size() == 0; -} - - -inline Int64 ResponseMessage::cursorID() const -{ - return _cursorID; -} - - -inline Document::Vector& ResponseMessage::documents() -{ - return _documents; -} - - -inline bool ResponseMessage::hasDocuments() const -{ - return _documents.size() > 0; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_ResponseMessage_INCLUDED diff --git a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/UpdateRequest.h b/contrib/libs/poco/MongoDB/include/Poco/MongoDB/UpdateRequest.h deleted file mode 100644 index 0aa14bcd71..0000000000 --- a/contrib/libs/poco/MongoDB/include/Poco/MongoDB/UpdateRequest.h +++ /dev/null @@ -1,114 +0,0 @@ -// -// UpdateRequest.h -// -// Library: MongoDB -// Package: MongoDB -// Module: UpdateRequest -// -// Definition of the UpdateRequest class. -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef MongoDB_UpdateRequest_INCLUDED -#define MongoDB_UpdateRequest_INCLUDED - - -#include "Poco/MongoDB/MongoDB.h" -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/MongoDB/Document.h" - - -namespace Poco { -namespace MongoDB { - - -class UpdateRequest: public RequestMessage - /// This request is used to update a document in a database - /// using the OP_UPDATE client request. -{ -public: - enum Flags - { - UPDATE_DEFAULT = 0, - /// If set, the database will insert the supplied object into the - /// collection if no matching document is found. - - UPDATE_UPSERT = 1, - /// If set, the database will update all matching objects in the collection. - /// Otherwise only updates first matching doc. - - UPDATE_MULTIUPDATE = 2 - /// If set to, updates multiple documents that meet the query criteria. - /// Otherwise only updates one document. - }; - - UpdateRequest(const std::string& collectionName, Flags flags = UPDATE_DEFAULT); - /// Creates the UpdateRequest. - /// - /// The full collection name is the concatenation of the database - /// name with the collection name, using a "." for the concatenation. For example, - /// for the database "foo" and the collection "bar", the full collection name is - /// "foo.bar". - - virtual ~UpdateRequest(); - /// Destroys the UpdateRequest. - - Document& selector(); - /// Returns the selector document. - - Document& update(); - /// Returns the document to update. - - Flags flags() const; - /// Returns the flags - - void flags(Flags flags); - /// Sets the flags - -protected: - void buildRequest(BinaryWriter& writer); - -private: - Flags _flags; - std::string _fullCollectionName; - Document _selector; - Document _update; -}; - - -// -// inlines -// -inline UpdateRequest::Flags UpdateRequest::flags() const -{ - return _flags; -} - - -inline void UpdateRequest::flags(UpdateRequest::Flags flags) -{ - _flags = flags; -} - - -inline Document& UpdateRequest::selector() -{ - return _selector; -} - - -inline Document& UpdateRequest::update() -{ - return _update; -} - - -} } // namespace Poco::MongoDB - - -#endif // MongoDB_UpdateRequest_INCLUDED diff --git a/contrib/libs/poco/MongoDB/src/Array.cpp b/contrib/libs/poco/MongoDB/src/Array.cpp deleted file mode 100644 index c6d96d1371..0000000000 --- a/contrib/libs/poco/MongoDB/src/Array.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// -// Array.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Array -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Array.h" -#include <sstream> - - -namespace Poco { -namespace MongoDB { - - -Array::Array(): - Document() -{ -} - - -Array::~Array() -{ -} - - -Element::Ptr Array::get(int pos) const -{ - std::string name = Poco::NumberFormatter::format(pos); - return Document::get(name); -} - - -std::string Array::toString(int indent) const -{ - std::ostringstream oss; - - oss << "["; - - if (indent > 0) oss << std::endl; - - for (ElementSet::const_iterator it = _elements.begin(); it != _elements.end(); ++it) - { - if (it != _elements.begin()) - { - oss << ","; - if (indent > 0) oss << std::endl; - } - - for (int i = 0; i < indent; ++i) oss << ' '; - - oss << (*it)->toString(indent > 0 ? indent + 2 : 0); - } - - if (indent > 0) - { - oss << std::endl; - if (indent >= 2) indent -= 2; - for (int i = 0; i < indent; ++i) oss << ' '; - } - - oss << "]"; - - return oss.str(); -} - - -} } // Namespace Poco::Mongo diff --git a/contrib/libs/poco/MongoDB/src/Binary.cpp b/contrib/libs/poco/MongoDB/src/Binary.cpp deleted file mode 100644 index f53ee8a557..0000000000 --- a/contrib/libs/poco/MongoDB/src/Binary.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -// Binary.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Binary -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Binary.h" - - -namespace Poco { -namespace MongoDB { - - -Binary::Binary(): - _buffer(0), - _subtype(0) -{ -} - - -Binary::Binary(Poco::Int32 size, unsigned char subtype): - _buffer(size), - _subtype(subtype) -{ -} - - -Binary::Binary(const UUID& uuid): - _buffer(128 / 8), - _subtype(0x04) -{ - unsigned char szUUID[16]; - uuid.copyTo((char*) szUUID); - _buffer.assign(szUUID, 16); -} - - - -Binary::Binary(const std::string& data, unsigned char subtype): - _buffer(reinterpret_cast<const unsigned char*>(data.data()), data.size()), - _subtype(subtype) -{ -} - - -Binary::Binary(const void* data, Poco::Int32 size, unsigned char subtype): - _buffer(reinterpret_cast<const unsigned char*>(data), size), - _subtype(subtype) -{ -} - - -Binary::~Binary() -{ -} - - -std::string Binary::toString(int /*indent*/) const -{ - std::ostringstream oss; - Base64Encoder encoder(oss); - MemoryInputStream mis((const char*) _buffer.begin(), _buffer.size()); - StreamCopier::copyStream(mis, encoder); - encoder.close(); - return oss.str(); -} - - -UUID Binary::uuid() const -{ - if (_subtype == 0x04 && _buffer.size() == 16) - { - UUID uuid; - uuid.copyFrom((const char*) _buffer.begin()); - return uuid; - } - throw BadCastException("Invalid subtype"); -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Connection.cpp b/contrib/libs/poco/MongoDB/src/Connection.cpp deleted file mode 100644 index 3037792740..0000000000 --- a/contrib/libs/poco/MongoDB/src/Connection.cpp +++ /dev/null @@ -1,235 +0,0 @@ -// -// Connection.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Connection -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Net/SocketStream.h" -#include "Poco/MongoDB/Connection.h" -#include "Poco/MongoDB/Database.h" -#include "Poco/URI.h" -#include "Poco/Format.h" -#include "Poco/NumberParser.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace MongoDB { - - -Connection::SocketFactory::SocketFactory() -{ -} - - -Connection::SocketFactory::~SocketFactory() -{ -} - - -Poco::Net::StreamSocket Connection::SocketFactory::createSocket(const std::string& host, int port, Poco::Timespan connectTimeout, bool secure) -{ - if (!secure) - { - Poco::Net::SocketAddress addr(host, static_cast<UInt16>(port)); - Poco::Net::StreamSocket socket; - if (connectTimeout > 0) - socket.connect(addr, connectTimeout); - else - socket.connect(addr); - return socket; - } - else throw Poco::NotImplementedException("Default SocketFactory implementation does not support SecureStreamSocket"); -} - - -Connection::Connection(): - _address(), - _socket() -{ -} - - -Connection::Connection(const std::string& hostAndPort): - _address(hostAndPort), - _socket() -{ - connect(); -} - - -Connection::Connection(const std::string& uri, SocketFactory& socketFactory): - _address(), - _socket() -{ - connect(uri, socketFactory); -} - - -Connection::Connection(const std::string& host, int port): - _address(host, static_cast<UInt16>(port)), - _socket() -{ - connect(); -} - - -Connection::Connection(const Poco::Net::SocketAddress& addrs): - _address(addrs), - _socket() -{ - connect(); -} - - -Connection::Connection(const Poco::Net::StreamSocket& socket): - _address(socket.peerAddress()), - _socket(socket) -{ -} - - -Connection::~Connection() -{ - try - { - disconnect(); - } - catch (...) - { - } -} - - -void Connection::connect() -{ - _socket.connect(_address); -} - - -void Connection::connect(const std::string& hostAndPort) -{ - _address = Poco::Net::SocketAddress(hostAndPort); - connect(); -} - - -void Connection::connect(const std::string& host, int port) -{ - _address = Poco::Net::SocketAddress(host, static_cast<UInt16>(port)); - connect(); -} - - -void Connection::connect(const Poco::Net::SocketAddress& addrs) -{ - _address = addrs; - connect(); -} - - -void Connection::connect(const Poco::Net::StreamSocket& socket) -{ - _address = socket.peerAddress(); - _socket = socket; -} - - -void Connection::connect(const std::string& uri, SocketFactory& socketFactory) -{ - Poco::URI theURI(uri); - if (theURI.getScheme() != "mongodb") throw Poco::UnknownURISchemeException(uri); - - std::string userInfo = theURI.getUserInfo(); - std::string host = theURI.getHost(); - Poco::UInt16 port = theURI.getPort(); - if (port == 0) port = 27017; - - std::string databaseName = theURI.getPath(); - if (!databaseName.empty() && databaseName[0] == '/') databaseName.erase(0, 1); - if (databaseName.empty()) databaseName = "admin"; - - bool ssl = false; - Poco::Timespan connectTimeout; - Poco::Timespan socketTimeout; - std::string authMechanism = Database::AUTH_SCRAM_SHA1; - - Poco::URI::QueryParameters params = theURI.getQueryParameters(); - for (Poco::URI::QueryParameters::const_iterator it = params.begin(); it != params.end(); ++it) - { - if (it->first == "ssl") - { - ssl = (it->second == "true"); - } - else if (it->first == "connectTimeoutMS") - { - connectTimeout = static_cast<Poco::Timespan::TimeDiff>(1000)*Poco::NumberParser::parse(it->second); - } - else if (it->first == "socketTimeoutMS") - { - socketTimeout = static_cast<Poco::Timespan::TimeDiff>(1000)*Poco::NumberParser::parse(it->second); - } - else if (it->first == "authMechanism") - { - authMechanism = it->second; - } - } - - connect(socketFactory.createSocket(host, port, connectTimeout, ssl)); - - if (socketTimeout > 0) - { - _socket.setSendTimeout(socketTimeout); - _socket.setReceiveTimeout(socketTimeout); - } - - if (!userInfo.empty()) - { - std::string username; - std::string password; - std::string::size_type pos = userInfo.find(':'); - if (pos != std::string::npos) - { - username.assign(userInfo, 0, pos++); - password.assign(userInfo, pos, userInfo.size() - pos); - } - else username = userInfo; - - Database database(databaseName); - if (!database.authenticate(*this, username, password, authMechanism)) - throw Poco::NoPermissionException(Poco::format("Access to MongoDB database %s denied for user %s", databaseName, username)); - } -} - - -void Connection::disconnect() -{ - _socket.close(); -} - - -void Connection::sendRequest(RequestMessage& request) -{ - Poco::Net::SocketOutputStream sos(_socket); - request.send(sos); -} - - -void Connection::sendRequest(RequestMessage& request, ResponseMessage& response) -{ - sendRequest(request); - - Poco::Net::SocketInputStream sis(_socket); - response.read(sis); -} - - -} } // Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Cursor.cpp b/contrib/libs/poco/MongoDB/src/Cursor.cpp deleted file mode 100644 index 69031e0ab6..0000000000 --- a/contrib/libs/poco/MongoDB/src/Cursor.cpp +++ /dev/null @@ -1,77 +0,0 @@ -// -// Cursor.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Cursor -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Cursor.h" -#include "Poco/MongoDB/GetMoreRequest.h" -#include "Poco/MongoDB/KillCursorsRequest.h" - - -namespace Poco { -namespace MongoDB { - - -Cursor::Cursor(const std::string& db, const std::string& collection, QueryRequest::Flags flags): - _query(db + '.' + collection, flags) -{ -} - - -Cursor::Cursor(const std::string& fullCollectionName, QueryRequest::Flags flags): - _query(fullCollectionName, flags) -{ -} - - -Cursor::~Cursor() -{ - try - { - poco_assert_dbg(!_response.cursorID()); - } - catch (...) - { - } -} - - -ResponseMessage& Cursor::next(Connection& connection) -{ - if (_response.cursorID() == 0) - { - connection.sendRequest(_query, _response); - } - else - { - Poco::MongoDB::GetMoreRequest getMore(_query.fullCollectionName(), _response.cursorID()); - getMore.setNumberToReturn(_query.getNumberToReturn()); - _response.clear(); - connection.sendRequest(getMore, _response); - } - return _response; -} - - -void Cursor::kill(Connection& connection) -{ - if (_response.cursorID() != 0) - { - KillCursorsRequest killRequest; - killRequest.cursors().push_back(_response.cursorID()); - connection.sendRequest(killRequest); - } - _response.clear(); -} - - -} } // Namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Database.cpp b/contrib/libs/poco/MongoDB/src/Database.cpp deleted file mode 100644 index 71a90124e5..0000000000 --- a/contrib/libs/poco/MongoDB/src/Database.cpp +++ /dev/null @@ -1,397 +0,0 @@ -// -// Database.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Database -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Database.h" -#include "Poco/MongoDB/Binary.h" -#include "Poco/MD5Engine.h" -#include "Poco/SHA1Engine.h" -#include "Poco/PBKDF2Engine.h" -#include "Poco/HMACEngine.h" -#include "Poco/Base64Decoder.h" -#include "Poco/MemoryStream.h" -#include "Poco/StreamCopier.h" -#include "Poco/Exception.h" -#include "Poco/RandomStream.h" -#include "Poco/Random.h" -#include "Poco/Format.h" -#include "Poco/NumberParser.h" -#include <sstream> -#include <map> - - -namespace Poco { -namespace MongoDB { - - -const std::string Database::AUTH_MONGODB_CR("MONGODB-CR"); -const std::string Database::AUTH_SCRAM_SHA1("SCRAM-SHA-1"); - - -namespace -{ - std::map<std::string, std::string> parseKeyValueList(const std::string& str) - { - std::map<std::string, std::string> kvm; - std::string::const_iterator it = str.begin(); - std::string::const_iterator end = str.end(); - while (it != end) - { - std::string k; - std::string v; - while (it != end && *it != '=') k += *it++; - if (it != end) ++it; - while (it != end && *it != ',') v += *it++; - if (it != end) ++it; - kvm[k] = v; - } - return kvm; - } - - std::string decodeBase64(const std::string& base64) - { - Poco::MemoryInputStream istr(base64.data(), base64.size()); - Poco::Base64Decoder decoder(istr); - std::string result; - Poco::StreamCopier::copyToString(decoder, result); - return result; - } - - std::string encodeBase64(const std::string& data) - { - std::ostringstream ostr; - Poco::Base64Encoder encoder(ostr); - encoder.rdbuf()->setLineLength(0); - encoder << data; - encoder.close(); - return ostr.str(); - } - - std::string digestToBinaryString(Poco::DigestEngine& engine) - { - Poco::DigestEngine::Digest d = engine.digest(); - return std::string(reinterpret_cast<const char*>(&d[0]), d.size()); - } - - std::string digestToHexString(Poco::DigestEngine& engine) - { - Poco::DigestEngine::Digest d = engine.digest(); - return Poco::DigestEngine::digestToHex(d); - } - - std::string digestToBase64(Poco::DigestEngine& engine) - { - return encodeBase64(digestToBinaryString(engine)); - } - - std::string hashCredentials(const std::string& username, const std::string& password) - { - Poco::MD5Engine md5; - md5.update(username); - md5.update(std::string(":mongo:")); - md5.update(password); - return digestToHexString(md5); - } - - std::string createNonce() - { - Poco::MD5Engine md5; - Poco::RandomInputStream randomStream; - Poco::Random random; - for (int i = 0; i < 4; i++) - { - md5.update(static_cast<char>(randomStream.get())); - md5.update(random.nextChar()); - } - return digestToHexString(md5); - } -} - - -Database::Database(const std::string& db): - _dbname(db) -{ -} - - -Database::~Database() -{ -} - - -bool Database::authenticate(Connection& connection, const std::string& username, const std::string& password, const std::string& method) -{ - if (username.empty()) throw Poco::InvalidArgumentException("empty username"); - if (password.empty()) throw Poco::InvalidArgumentException("empty password"); - - if (method == AUTH_MONGODB_CR) - return authCR(connection, username, password); - else if (method == AUTH_SCRAM_SHA1) - return authSCRAM(connection, username, password); - else - throw Poco::InvalidArgumentException("authentication method", method); -} - - -bool Database::authCR(Connection& connection, const std::string& username, const std::string& password) -{ - std::string nonce; - Poco::SharedPtr<QueryRequest> pCommand = createCommand(); - pCommand->selector().add<Poco::Int32>("getnonce", 1); - - ResponseMessage response; - connection.sendRequest(*pCommand, response); - if (response.documents().size() > 0) - { - Document::Ptr pDoc = response.documents()[0]; - if (pDoc->getInteger("ok") != 1) return false; - nonce = pDoc->get<std::string>("nonce", ""); - if (nonce.empty()) throw Poco::ProtocolException("no nonce received"); - } - else throw Poco::ProtocolException("empty response for getnonce"); - - std::string credsDigest = hashCredentials(username, password); - - Poco::MD5Engine md5; - md5.update(nonce); - md5.update(username); - md5.update(credsDigest); - std::string key = digestToHexString(md5); - - pCommand = createCommand(); - pCommand->selector() - .add<Poco::Int32>("authenticate", 1) - .add<std::string>("user", username) - .add<std::string>("nonce", nonce) - .add<std::string>("key", key); - - connection.sendRequest(*pCommand, response); - if (response.documents().size() > 0) - { - Document::Ptr pDoc = response.documents()[0]; - return pDoc->getInteger("ok") == 1; - } - else throw Poco::ProtocolException("empty response for authenticate"); -} - - -bool Database::authSCRAM(Connection& connection, const std::string& username, const std::string& password) -{ - std::string clientNonce(createNonce()); - std::string clientFirstMsg = Poco::format("n=%s,r=%s", username, clientNonce); - - Poco::SharedPtr<QueryRequest> pCommand = createCommand(); - pCommand->selector() - .add<Poco::Int32>("saslStart", 1) - .add<std::string>("mechanism", AUTH_SCRAM_SHA1) - .add<Binary::Ptr>("payload", new Binary(Poco::format("n,,%s", clientFirstMsg))) - .add<bool>("authAuthorize", true); - - ResponseMessage response; - connection.sendRequest(*pCommand, response); - - Int32 conversationId = 0; - std::string serverFirstMsg; - - if (response.documents().size() > 0) - { - Document::Ptr pDoc = response.documents()[0]; - if (pDoc->getInteger("ok") == 1) - { - Binary::Ptr pPayload = pDoc->get<Binary::Ptr>("payload"); - serverFirstMsg = pPayload->toRawString(); - conversationId = pDoc->get<Int32>("conversationId"); - } - else return false; - } - else throw Poco::ProtocolException("empty response for saslStart"); - - std::map<std::string, std::string> kvm = parseKeyValueList(serverFirstMsg); - const std::string serverNonce = kvm["r"]; - const std::string salt = decodeBase64(kvm["s"]); - const unsigned iterations = Poco::NumberParser::parseUnsigned(kvm["i"]); - const Poco::UInt32 dkLen = 20; - - std::string hashedPassword = hashCredentials(username, password); - - Poco::PBKDF2Engine<Poco::HMACEngine<Poco::SHA1Engine> > pbkdf2(salt, iterations, dkLen); - pbkdf2.update(hashedPassword); - std::string saltedPassword = digestToBinaryString(pbkdf2); - - std::string clientFinalNoProof = Poco::format("c=biws,r=%s", serverNonce); - std::string authMessage = Poco::format("%s,%s,%s", clientFirstMsg, serverFirstMsg, clientFinalNoProof); - - Poco::HMACEngine<Poco::SHA1Engine> hmacKey(saltedPassword); - hmacKey.update(std::string("Client Key")); - std::string clientKey = digestToBinaryString(hmacKey); - - Poco::SHA1Engine sha1; - sha1.update(clientKey); - std::string storedKey = digestToBinaryString(sha1); - - Poco::HMACEngine<Poco::SHA1Engine> hmacSig(storedKey); - hmacSig.update(authMessage); - std::string clientSignature = digestToBinaryString(hmacSig); - - std::string clientProof(clientKey); - for (std::size_t i = 0; i < clientProof.size(); i++) - { - clientProof[i] ^= clientSignature[i]; - } - - std::string clientFinal = Poco::format("%s,p=%s", clientFinalNoProof, encodeBase64(clientProof)); - - pCommand = createCommand(); - pCommand->selector() - .add<Poco::Int32>("saslContinue", 1) - .add<Poco::Int32>("conversationId", conversationId) - .add<Binary::Ptr>("payload", new Binary(clientFinal)); - - std::string serverSecondMsg; - connection.sendRequest(*pCommand, response); - if (response.documents().size() > 0) - { - Document::Ptr pDoc = response.documents()[0]; - if (pDoc->getInteger("ok") == 1) - { - Binary::Ptr pPayload = pDoc->get<Binary::Ptr>("payload"); - serverSecondMsg = pPayload->toRawString(); - } - else return false; - } - else throw Poco::ProtocolException("empty response for saslContinue"); - - Poco::HMACEngine<Poco::SHA1Engine> hmacSKey(saltedPassword); - hmacSKey.update(std::string("Server Key")); - std::string serverKey = digestToBinaryString(hmacSKey); - - Poco::HMACEngine<Poco::SHA1Engine> hmacSSig(serverKey); - hmacSSig.update(authMessage); - std::string serverSignature = digestToBase64(hmacSSig); - - kvm = parseKeyValueList(serverSecondMsg); - std::string serverSignatureReceived = kvm["v"]; - - if (serverSignature != serverSignatureReceived) - throw Poco::ProtocolException("server signature verification failed"); - - pCommand = createCommand(); - pCommand->selector() - .add<Poco::Int32>("saslContinue", 1) - .add<Poco::Int32>("conversationId", conversationId) - .add<Binary::Ptr>("payload", new Binary); - - connection.sendRequest(*pCommand, response); - if (response.documents().size() > 0) - { - Document::Ptr pDoc = response.documents()[0]; - return pDoc->getInteger("ok") == 1; - } - else throw Poco::ProtocolException("empty response for saslContinue"); -} - - -Int64 Database::count(Connection& connection, const std::string& collectionName) const -{ - Poco::SharedPtr<Poco::MongoDB::QueryRequest> countRequest = createCountRequest(collectionName); - - Poco::MongoDB::ResponseMessage response; - connection.sendRequest(*countRequest, response); - - if (response.documents().size() > 0) - { - Poco::MongoDB::Document::Ptr doc = response.documents()[0]; - return doc->getInteger("n"); - } - - return -1; -} - - -Poco::MongoDB::Document::Ptr Database::ensureIndex(Connection& connection, const std::string& collection, const std::string& indexName, Poco::MongoDB::Document::Ptr keys, bool unique, bool background, int version, int ttl) -{ - Poco::MongoDB::Document::Ptr index = new Poco::MongoDB::Document(); - index->add("ns", _dbname + "." + collection); - index->add("name", indexName); - index->add("key", keys); - - if (version > 0) - { - index->add("version", version); - } - - if (unique) - { - index->add("unique", true); - } - - if (background) - { - index->add("background", true); - } - - if (ttl > 0) - { - index->add("expireAfterSeconds", ttl); - } - - Poco::SharedPtr<Poco::MongoDB::InsertRequest> insertRequest = createInsertRequest("system.indexes"); - insertRequest->documents().push_back(index); - connection.sendRequest(*insertRequest); - - return getLastErrorDoc(connection); -} - - -Document::Ptr Database::getLastErrorDoc(Connection& connection) const -{ - Document::Ptr errorDoc; - - Poco::SharedPtr<Poco::MongoDB::QueryRequest> request = createQueryRequest("$cmd"); - request->setNumberToReturn(1); - request->selector().add("getLastError", 1); - - Poco::MongoDB::ResponseMessage response; - connection.sendRequest(*request, response); - - if (response.documents().size() > 0) - { - errorDoc = response.documents()[0]; - } - - return errorDoc; -} - - -std::string Database::getLastError(Connection& connection) const -{ - Document::Ptr errorDoc = getLastErrorDoc(connection); - if (!errorDoc.isNull() && errorDoc->isType<std::string>("err")) - { - return errorDoc->get<std::string>("err"); - } - - return ""; -} - - -Poco::SharedPtr<Poco::MongoDB::QueryRequest> Database::createCountRequest(const std::string& collectionName) const -{ - Poco::SharedPtr<Poco::MongoDB::QueryRequest> request = createQueryRequest("$cmd"); - request->setNumberToReturn(1); - request->selector().add("count", collectionName); - return request; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/DeleteRequest.cpp b/contrib/libs/poco/MongoDB/src/DeleteRequest.cpp deleted file mode 100644 index 67a88c3330..0000000000 --- a/contrib/libs/poco/MongoDB/src/DeleteRequest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// DeleteRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: DeleteRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/DeleteRequest.h" - - -namespace Poco { -namespace MongoDB { - - -DeleteRequest::DeleteRequest(const std::string& collectionName, DeleteRequest::Flags flags): - RequestMessage(MessageHeader::OP_DELETE), - _flags(flags), - _fullCollectionName(collectionName), - _selector() -{ -} - - -DeleteRequest::DeleteRequest(const std::string& collectionName, bool justOne): - RequestMessage(MessageHeader::OP_DELETE), - _flags(justOne ? DELETE_SINGLE_REMOVE : DELETE_DEFAULT), - _fullCollectionName(collectionName), - _selector() -{ -} - - -DeleteRequest::~DeleteRequest() -{ -} - - -void DeleteRequest::buildRequest(BinaryWriter& writer) -{ - writer << 0; // 0 - reserved for future use - BSONWriter(writer).writeCString(_fullCollectionName); - writer << _flags; - _selector.write(writer); -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Document.cpp b/contrib/libs/poco/MongoDB/src/Document.cpp deleted file mode 100644 index 114fc99389..0000000000 --- a/contrib/libs/poco/MongoDB/src/Document.cpp +++ /dev/null @@ -1,219 +0,0 @@ -// -// Document.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Document -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Document.h" -#include "Poco/MongoDB/Binary.h" -#include "Poco/MongoDB/ObjectId.h" -#include "Poco/MongoDB/Array.h" -#include "Poco/MongoDB/RegularExpression.h" -#include "Poco/MongoDB/JavaScriptCode.h" -#include <sstream> - - -namespace Poco { -namespace MongoDB { - - -Document::Document() -{ -} - - -Document::~Document() -{ -} - - -Element::Ptr Document::get(const std::string& name) const -{ - Element::Ptr element; - - ElementSet::const_iterator it = std::find_if(_elements.begin(), _elements.end(), ElementFindByName(name)); - if (it != _elements.end()) - { - return *it; - } - - return element; -} - - -Int64 Document::getInteger(const std::string& name) const -{ - Element::Ptr element = get(name); - if (element.isNull()) throw Poco::NotFoundException(name); - - if (ElementTraits<double>::TypeId == element->type()) - { - ConcreteElement<double>* concrete = dynamic_cast<ConcreteElement<double>*>(element.get()); - if (concrete) return static_cast<Int64>(concrete->value()); - } - else if (ElementTraits<Int32>::TypeId == element->type()) - { - ConcreteElement<Int32>* concrete = dynamic_cast<ConcreteElement<Int32>*>(element.get()); - if (concrete) return concrete->value(); - } - else if (ElementTraits<Int64>::TypeId == element->type()) - { - ConcreteElement<Int64>* concrete = dynamic_cast<ConcreteElement<Int64>*>(element.get()); - if (concrete) return concrete->value(); - } - throw Poco::BadCastException("Invalid type mismatch!"); -} - - -void Document::read(BinaryReader& reader) -{ - int size; - reader >> size; - - unsigned char type; - reader >> type; - - while (type != '\0') - { - Element::Ptr element; - - std::string name = BSONReader(reader).readCString(); - - switch (type) - { - case ElementTraits<double>::TypeId: - element = new ConcreteElement<double>(name, 0); - break; - case ElementTraits<Int32>::TypeId: - element = new ConcreteElement<Int32>(name, 0); - break; - case ElementTraits<std::string>::TypeId: - element = new ConcreteElement<std::string>(name, ""); - break; - case ElementTraits<Document::Ptr>::TypeId: - element = new ConcreteElement<Document::Ptr>(name, new Document); - break; - case ElementTraits<Array::Ptr>::TypeId: - element = new ConcreteElement<Array::Ptr>(name, new Array); - break; - case ElementTraits<Binary::Ptr>::TypeId: - element = new ConcreteElement<Binary::Ptr>(name, new Binary); - break; - case ElementTraits<ObjectId::Ptr>::TypeId: - element = new ConcreteElement<ObjectId::Ptr>(name, new ObjectId); - break; - case ElementTraits<bool>::TypeId: - element = new ConcreteElement<bool>(name, false); - break; - case ElementTraits<Poco::Timestamp>::TypeId: - element = new ConcreteElement<Poco::Timestamp>(name, Poco::Timestamp()); - break; - case ElementTraits<BSONTimestamp>::TypeId: - element = new ConcreteElement<BSONTimestamp>(name, BSONTimestamp()); - break; - case ElementTraits<NullValue>::TypeId: - element = new ConcreteElement<NullValue>(name, NullValue(0)); - break; - case ElementTraits<RegularExpression::Ptr>::TypeId: - element = new ConcreteElement<RegularExpression::Ptr>(name, new RegularExpression()); - break; - case ElementTraits<JavaScriptCode::Ptr>::TypeId: - element = new ConcreteElement<JavaScriptCode::Ptr>(name, new JavaScriptCode()); - break; - case ElementTraits<Int64>::TypeId: - element = new ConcreteElement<Int64>(name, 0); - break; - default: - { - std::stringstream ss; - ss << "Element " << name << " contains an unsupported type 0x" << std::hex << (int) type; - throw Poco::NotImplementedException(ss.str()); - } - //TODO: x0F -> JavaScript code with scope - // xFF -> Min Key - // x7F -> Max Key - } - - element->read(reader); - _elements.push_back(element); - - reader >> type; - } -} - - -std::string Document::toString(int indent) const -{ - std::ostringstream oss; - - oss << '{'; - - if (indent > 0) oss << std::endl; - - - for (ElementSet::const_iterator it = _elements.begin(); it != _elements.end(); ++it) - { - if (it != _elements.begin()) - { - oss << ','; - if (indent > 0) oss << std::endl; - } - - for (int i = 0; i < indent; ++i) oss << ' '; - - oss << '"' << (*it)->name() << '"'; - oss << (indent > 0 ? " : " : ":"); - - oss << (*it)->toString(indent > 0 ? indent + 2 : 0); - } - - if (indent > 0) - { - oss << std::endl; - if (indent >= 2) indent -= 2; - - for (int i = 0; i < indent; ++i) oss << ' '; - } - - oss << '}'; - - return oss.str(); -} - - -void Document::write(BinaryWriter& writer) -{ - if (_elements.empty()) - { - writer << 5; - } - else - { - std::stringstream sstream; - Poco::BinaryWriter tempWriter(sstream); - for (ElementSet::iterator it = _elements.begin(); it != _elements.end(); ++it) - { - tempWriter << static_cast<unsigned char>((*it)->type()); - BSONWriter(tempWriter).writeCString((*it)->name()); - Element::Ptr element = *it; - element->write(tempWriter); - } - tempWriter.flush(); - - Poco::Int32 len = static_cast<Poco::Int32>(5 + sstream.tellp()); /* 5 = sizeof(len) + 0-byte */ - writer << len; - writer.writeRaw(sstream.str()); - } - writer << '\0'; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Element.cpp b/contrib/libs/poco/MongoDB/src/Element.cpp deleted file mode 100644 index 89629e0503..0000000000 --- a/contrib/libs/poco/MongoDB/src/Element.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Element.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Element -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Element.h" - - -namespace Poco { -namespace MongoDB { - - -Element::Element(const std::string& name) : _name(name) -{ -} - - -Element::~Element() -{ -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/GetMoreRequest.cpp b/contrib/libs/poco/MongoDB/src/GetMoreRequest.cpp deleted file mode 100644 index f8a6b73c6a..0000000000 --- a/contrib/libs/poco/MongoDB/src/GetMoreRequest.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// GetMoreRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: GetMoreRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/GetMoreRequest.h" -#include "Poco/MongoDB/Element.h" - - -namespace Poco { -namespace MongoDB { - - -GetMoreRequest::GetMoreRequest(const std::string& collectionName, Int64 cursorID): - RequestMessage(MessageHeader::OP_GET_MORE), - _fullCollectionName(collectionName), - _numberToReturn(100), - _cursorID(cursorID) -{ -} - - -GetMoreRequest::~GetMoreRequest() -{ -} - - -void GetMoreRequest::buildRequest(BinaryWriter& writer) -{ - writer << 0; // 0 - reserved for future use - BSONWriter(writer).writeCString(_fullCollectionName); - writer << _numberToReturn; - writer << _cursorID; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/InsertRequest.cpp b/contrib/libs/poco/MongoDB/src/InsertRequest.cpp deleted file mode 100644 index ec8dc9cf94..0000000000 --- a/contrib/libs/poco/MongoDB/src/InsertRequest.cpp +++ /dev/null @@ -1,49 +0,0 @@ -// -// InsertRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: InsertRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/InsertRequest.h" - - -namespace Poco { -namespace MongoDB { - - -InsertRequest::InsertRequest(const std::string& collectionName, Flags flags): - RequestMessage(MessageHeader::OP_INSERT), - _flags(flags), - _fullCollectionName(collectionName) -{ -} - - -InsertRequest::~InsertRequest() -{ -} - - -void InsertRequest::buildRequest(BinaryWriter& writer) -{ - poco_assert (!_documents.empty()); - - writer << _flags; - BSONWriter bsonWriter(writer); - bsonWriter.writeCString(_fullCollectionName); - for (Document::Vector::iterator it = _documents.begin(); it != _documents.end(); ++it) - { - bsonWriter.write(*it); - } -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/JavaScriptCode.cpp b/contrib/libs/poco/MongoDB/src/JavaScriptCode.cpp deleted file mode 100644 index 41f5fcabe6..0000000000 --- a/contrib/libs/poco/MongoDB/src/JavaScriptCode.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// JavaScriptCode.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: JavaScriptCode -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/JavaScriptCode.h" - - -namespace Poco { -namespace MongoDB { - - -JavaScriptCode::JavaScriptCode() -{ - -} - - -JavaScriptCode::~JavaScriptCode() -{ -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/KillCursorsRequest.cpp b/contrib/libs/poco/MongoDB/src/KillCursorsRequest.cpp deleted file mode 100644 index 6baa0e0be8..0000000000 --- a/contrib/libs/poco/MongoDB/src/KillCursorsRequest.cpp +++ /dev/null @@ -1,44 +0,0 @@ -// -// KillCursorsRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: KillCursorsRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/KillCursorsRequest.h" - - -namespace Poco { -namespace MongoDB { - - -KillCursorsRequest::KillCursorsRequest(): - RequestMessage(MessageHeader::OP_KILL_CURSORS) -{ -} - - -KillCursorsRequest::~KillCursorsRequest() -{ -} - - -void KillCursorsRequest::buildRequest(BinaryWriter& writer) -{ - writer << 0; // 0 - reserved for future use - writer << static_cast<Poco::UInt64>(_cursors.size()); - for (std::vector<Int64>::iterator it = _cursors.begin(); it != _cursors.end(); ++it) - { - writer << *it; - } -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/Message.cpp b/contrib/libs/poco/MongoDB/src/Message.cpp deleted file mode 100644 index c29d282d15..0000000000 --- a/contrib/libs/poco/MongoDB/src/Message.cpp +++ /dev/null @@ -1,33 +0,0 @@ -// -// Message.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: Message -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Message.h" - - -namespace Poco { -namespace MongoDB { - - -Message::Message(MessageHeader::OpCode opcode): - _header(opcode) -{ -} - - -Message::~Message() -{ -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/MessageHeader.cpp b/contrib/libs/poco/MongoDB/src/MessageHeader.cpp deleted file mode 100644 index 222121243d..0000000000 --- a/contrib/libs/poco/MongoDB/src/MessageHeader.cpp +++ /dev/null @@ -1,63 +0,0 @@ -// -// MessageHeader.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: MessageHeader -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/Message.h" -#include "Poco/Exception.h" - - -namespace Poco { -namespace MongoDB { - - -MessageHeader::MessageHeader(OpCode opCode): - _messageLength(0), - _requestID(0), - _responseTo(0), - _opCode(opCode) -{ -} - - -MessageHeader::~MessageHeader() -{ -} - - -void MessageHeader::read(BinaryReader& reader) -{ - reader >> _messageLength; - reader >> _requestID; - reader >> _responseTo; - - Int32 opCode; - reader >> opCode; - _opCode = (OpCode) opCode; - - if (!reader.good()) - { - throw IOException("Failed to read from socket"); - } -} - - -void MessageHeader::write(BinaryWriter& writer) -{ - writer << _messageLength; - writer << _requestID; - writer << _responseTo; - writer << (Int32) _opCode; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/ObjectId.cpp b/contrib/libs/poco/MongoDB/src/ObjectId.cpp deleted file mode 100644 index 3065a2ffc3..0000000000 --- a/contrib/libs/poco/MongoDB/src/ObjectId.cpp +++ /dev/null @@ -1,66 +0,0 @@ -// -// ObjectId.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: ObjectId -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/ObjectId.h" -#include "Poco/Format.h" -#include <cstring> - - -namespace Poco { -namespace MongoDB { - - -ObjectId::ObjectId() -{ - std::memset(_id, 0, sizeof(_id)); -} - - -ObjectId::ObjectId(const std::string& id) -{ - poco_assert_dbg(id.size() == 24); - - const char* p = id.c_str(); - for (std::size_t i = 0; i < 12; ++i) - { - _id[i] = fromHex(p); - p += 2; - } -} - - -ObjectId::ObjectId(const ObjectId& copy) -{ - std::memcpy(_id, copy._id, sizeof(_id)); -} - - -ObjectId::~ObjectId() -{ -} - - -std::string ObjectId::toString(const std::string& fmt) const -{ - std::string s; - - for (int i = 0; i < 12; ++i) - { - s += format(fmt, (unsigned int) _id[i]); - } - return s; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/QueryRequest.cpp b/contrib/libs/poco/MongoDB/src/QueryRequest.cpp deleted file mode 100644 index 7044335ba3..0000000000 --- a/contrib/libs/poco/MongoDB/src/QueryRequest.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// -// QueryRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: QueryRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/QueryRequest.h" - - -namespace Poco { -namespace MongoDB { - - -QueryRequest::QueryRequest(const std::string& collectionName, QueryRequest::Flags flags): - RequestMessage(MessageHeader::OP_QUERY), - _flags(flags), - _fullCollectionName(collectionName), - _numberToSkip(0), - _numberToReturn(100), - _selector(), - _returnFieldSelector() -{ -} - - -QueryRequest::~QueryRequest() -{ -} - - -void QueryRequest::buildRequest(BinaryWriter& writer) -{ - writer << _flags; - BSONWriter(writer).writeCString(_fullCollectionName); - writer << _numberToSkip; - writer << _numberToReturn; - _selector.write(writer); - - if (!_returnFieldSelector.empty()) - { - _returnFieldSelector.write(writer); - } -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/RegularExpression.cpp b/contrib/libs/poco/MongoDB/src/RegularExpression.cpp deleted file mode 100644 index e95e7da82e..0000000000 --- a/contrib/libs/poco/MongoDB/src/RegularExpression.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// RegularExpression.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: RegularExpression -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/RegularExpression.h" -#include <sstream> - - -namespace Poco { -namespace MongoDB { - - -RegularExpression::RegularExpression() -{ -} - - -RegularExpression::RegularExpression(const std::string& pattern, const std::string& options): - _pattern(pattern), - _options(options) -{ -} - - -RegularExpression::~RegularExpression() -{ -} - - -SharedPtr<Poco::RegularExpression> RegularExpression::createRE() const -{ - int options = 0; - for (std::string::const_iterator optIt = _options.begin(); optIt != _options.end(); ++optIt) - { - switch (*optIt) - { - case 'i': // Case Insensitive - options |= Poco::RegularExpression::RE_CASELESS; - break; - case 'm': // Multiline matching - options |= Poco::RegularExpression::RE_MULTILINE; - break; - case 'x': // Verbose mode - //No equivalent in Poco - break; - case 'l': // \w \W Locale dependent - //No equivalent in Poco - break; - case 's': // Dotall mode - options |= Poco::RegularExpression::RE_DOTALL; - break; - case 'u': // \w \W Unicode - //No equivalent in Poco - break; - } - } - return new Poco::RegularExpression(_pattern, options); -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/ReplicaSet.cpp b/contrib/libs/poco/MongoDB/src/ReplicaSet.cpp deleted file mode 100644 index b56fea4931..0000000000 --- a/contrib/libs/poco/MongoDB/src/ReplicaSet.cpp +++ /dev/null @@ -1,89 +0,0 @@ -// -// ReplicaSet.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: ReplicaSet -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/ReplicaSet.h" -#include "Poco/MongoDB/QueryRequest.h" -#include "Poco/MongoDB/ResponseMessage.h" - - -namespace Poco { -namespace MongoDB { - - -ReplicaSet::ReplicaSet(const std::vector<Net::SocketAddress> &addresses): - _addresses(addresses) -{ -} - - -ReplicaSet::~ReplicaSet() -{ -} - - -Connection::Ptr ReplicaSet::findMaster() -{ - Connection::Ptr master; - - for (std::vector<Net::SocketAddress>::iterator it = _addresses.begin(); it != _addresses.end(); ++it) - { - master = isMaster(*it); - if (!master.isNull()) - { - break; - } - } - - return master; -} - - -Connection::Ptr ReplicaSet::isMaster(const Net::SocketAddress& address) -{ - Connection::Ptr conn = new Connection(); - - try - { - conn->connect(address); - - QueryRequest request("admin.$cmd"); - request.setNumberToReturn(1); - request.selector().add("isMaster", 1); - - ResponseMessage response; - conn->sendRequest(request, response); - - if (response.documents().size() > 0) - { - Document::Ptr doc = response.documents()[0]; - if (doc->get<bool>("ismaster")) - { - return conn; - } - else if (doc->exists("primary")) - { - return isMaster(Net::SocketAddress(doc->get<std::string>("primary"))); - } - } - } - catch (...) - { - conn = 0; - } - - return 0; -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/RequestMessage.cpp b/contrib/libs/poco/MongoDB/src/RequestMessage.cpp deleted file mode 100644 index 6391d96619..0000000000 --- a/contrib/libs/poco/MongoDB/src/RequestMessage.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// -// RequestMessage.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: RequestMessage -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/RequestMessage.h" -#include "Poco/Net/SocketStream.h" -#include "Poco/StreamCopier.h" - - -namespace Poco { -namespace MongoDB { - - -RequestMessage::RequestMessage(MessageHeader::OpCode opcode): - Message(opcode) -{ -} - - -RequestMessage::~RequestMessage() -{ -} - - -void RequestMessage::send(std::ostream& ostr) -{ - std::stringstream ss; - BinaryWriter requestWriter(ss); - buildRequest(requestWriter); - requestWriter.flush(); - - messageLength(static_cast<Poco::Int32>(ss.tellp())); - - BinaryWriter socketWriter(ostr, BinaryWriter::LITTLE_ENDIAN_BYTE_ORDER); - _header.write(socketWriter); - StreamCopier::copyStream(ss, ostr); - ostr.flush(); -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/ResponseMessage.cpp b/contrib/libs/poco/MongoDB/src/ResponseMessage.cpp deleted file mode 100644 index 3254ace63e..0000000000 --- a/contrib/libs/poco/MongoDB/src/ResponseMessage.cpp +++ /dev/null @@ -1,70 +0,0 @@ -// -// ResponseMessage.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: ResponseMessage -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/ResponseMessage.h" -#include "Poco/Net/SocketStream.h" - - -namespace Poco { -namespace MongoDB { - - -ResponseMessage::ResponseMessage(): - Message(MessageHeader::OP_REPLY), - _responseFlags(0), - _cursorID(0), - _startingFrom(0), - _numberReturned(0) -{ -} - - -ResponseMessage::~ResponseMessage() -{ -} - - -void ResponseMessage::clear() -{ - _responseFlags = 0; - _startingFrom = 0; - _cursorID = 0; - _numberReturned = 0; - _documents.clear(); -} - - -void ResponseMessage::read(std::istream& istr) -{ - clear(); - - BinaryReader reader(istr, BinaryReader::LITTLE_ENDIAN_BYTE_ORDER); - - _header.read(reader); - - reader >> _responseFlags; - reader >> _cursorID; - reader >> _startingFrom; - reader >> _numberReturned; - - for (int i = 0; i < _numberReturned; ++i) - { - Document::Ptr doc = new Document(); - doc->read(reader); - _documents.push_back(doc); - } -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/src/UpdateRequest.cpp b/contrib/libs/poco/MongoDB/src/UpdateRequest.cpp deleted file mode 100644 index 2af4621ff6..0000000000 --- a/contrib/libs/poco/MongoDB/src/UpdateRequest.cpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// UpdateRequest.cpp -// -// Library: MongoDB -// Package: MongoDB -// Module: UpdateRequest -// -// Copyright (c) 2012, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/MongoDB/UpdateRequest.h" - - -namespace Poco { -namespace MongoDB { - - -UpdateRequest::UpdateRequest(const std::string& collectionName, UpdateRequest::Flags flags): - RequestMessage(MessageHeader::OP_UPDATE), - _flags(flags), - _fullCollectionName(collectionName), - _selector(), - _update() -{ -} - - -UpdateRequest::~UpdateRequest() -{ -} - - -void UpdateRequest::buildRequest(BinaryWriter& writer) -{ - writer << 0; // 0 - reserved for future use - BSONWriter(writer).writeCString(_fullCollectionName); - writer << _flags; - _selector.write(writer); - _update.write(writer); -} - - -} } // namespace Poco::MongoDB diff --git a/contrib/libs/poco/MongoDB/ya.make b/contrib/libs/poco/MongoDB/ya.make deleted file mode 100644 index fed2fa8db4..0000000000 --- a/contrib/libs/poco/MongoDB/ya.make +++ /dev/null @@ -1,72 +0,0 @@ -# Generated by devtools/yamaker. - -LIBRARY() - -LICENSE(BSL-1.0) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -PEERDIR( - contrib/libs/poco/Foundation - contrib/libs/poco/Net -) - -ADDINCL( - GLOBAL contrib/libs/poco/MongoDB/include - contrib/libs/poco/Foundation/include - contrib/libs/poco/MongoDB/src - contrib/libs/poco/Net/include -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -CFLAGS( - -DPOCO_ENABLE_CPP11 - -DPOCO_ENABLE_CPP14 - -DPOCO_NO_AUTOMATIC_LIBS - -DPOCO_UNBUNDLED -) - -IF (OS_DARWIN) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_NO_STAT64 - ) -ELSEIF (OS_LINUX) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_HAVE_FD_EPOLL - ) -ELSEIF (OS_WINDOWS) - CFLAGS( - -DPOCO_OS_FAMILY_WINDOWS - ) -ENDIF() - -SRCS( - src/Array.cpp - src/Binary.cpp - src/Connection.cpp - src/Cursor.cpp - src/Database.cpp - src/DeleteRequest.cpp - src/Document.cpp - src/Element.cpp - src/GetMoreRequest.cpp - src/InsertRequest.cpp - src/JavaScriptCode.cpp - src/KillCursorsRequest.cpp - src/Message.cpp - src/MessageHeader.cpp - src/ObjectId.cpp - src/QueryRequest.cpp - src/RegularExpression.cpp - src/ReplicaSet.cpp - src/RequestMessage.cpp - src/ResponseMessage.cpp - src/UpdateRequest.cpp -) - -END() diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Array.h b/contrib/libs/poco/Redis/include/Poco/Redis/Array.h deleted file mode 100644 index 3430ad6952..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Array.h +++ /dev/null @@ -1,322 +0,0 @@ -// -// Array.h -// -// Library: Redis -// Package: Redis -// Module: Array -// -// Definition of the Array class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Array_INCLUDED -#define Redis_Array_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/Redis/Type.h" -#include "Poco/Redis/Exception.h" -#include <vector> -#include <sstream> - - -namespace Poco { -namespace Redis { - - -class Redis_API Array - /// Represents a Redis Array. An Array can contain Integers, Strings, - /// Bulk Strings, Errors and other Arrays. It can also contain a Null - /// value. -{ -public: - typedef std::vector<RedisType::Ptr>::const_iterator const_iterator; - - Array(); - /// Creates an Array. As long as there are no elements added, - /// the array will contain a Null value. - - Array(const Array& copy); - /// Creates an Array by copying another one. - - virtual ~Array(); - /// Destroys the Array. - - template<typename T> - Array& operator<<(const T& arg) - /// Adds the argument to the array. - /// - /// Note: a std::string will be added as a BulkString because this - /// is commonly used for representing strings in Redis. If you - /// really need a simple string, use addSimpleString(). - { - return add(arg); - } - - Array& operator<<(const char* s); - /// Special implementation for const char*. - /// - /// Note: the specialization creates a BulkString. If you need - /// a simple string, call addSimpleString(). - - Array& operator<<(const std::vector<std::string>& strings); - /// Special implementation for a vector with strings. - /// All strings will be added as a BulkString. - - Array& add(); - /// Adds an Null BulkString. - - template<typename T> - Array& add(const T& arg) - /// Adds an element to the array. - /// - /// Note: the specialization for std::string will add a BulkString! - /// If you really need a simple string, call addSimpleString. - { - addRedisType(new Type<T>(arg)); - return *this; - } - - Array& add(const char* s); - /// Special implementation for const char*. - /// - /// Note: the specialization creates a BulkString. If you need - /// a simple string, call addSimpleString. - - Array& add(const std::vector<std::string>& strings); - /// Special implementation for a vector with strings. - /// All strings will be added as a BulkString. - - Array& addRedisType(RedisType::Ptr value); - /// Adds a Redis element. - - Array& addSimpleString(const std::string& value); - /// Adds a simple string (can't contain newline characters!). - - const_iterator begin() const; - /// Returns an iterator to the start of the array. - /// - /// Note: this can throw a NullValueException when this is a Null array. - - void clear(); - /// Removes all elements from the array. - - const_iterator end() const; - /// Returns an iterator to the end of the array. - /// - /// Note: this can throw a NullValueException when this is a Null array. - - template<typename T> - T get(size_t pos) const - /// Returns the element on the given position and tries to convert - /// to the template type. A Poco::BadCastException will be thrown when the - /// the conversion fails. An Poco::InvalidArgumentException will be thrown - /// when the index is out of range. When the array is a Null array - /// a Poco::NullValueException is thrown. - { - if ( _elements.isNull() ) throw NullValueException(); - - if ( pos >= _elements.value().size() ) throw InvalidArgumentException(); - - RedisType::Ptr element = _elements.value().at(pos); - if ( RedisTypeTraits<T>::TypeId == element->type() ) - { - Type<T>* concrete = dynamic_cast<Type<T>* >(element.get()); - if ( concrete != NULL ) return concrete->value(); - } - throw BadCastException(); - } - - int getType(size_t pos) const; - /// Returns the type of the element. This can throw a Poco::NullValueException - /// when this array is a Null array. An Poco::InvalidArgumentException will - /// be thrown when the index is out of range. - - bool isNull() const; - /// Returns true when this is a Null array. - - void makeNull(); - /// Turns the array into a Null array. When the array already has some - /// elements, the array will be cleared. - - std::string toString() const; - /// Returns the String representation as specified in the - /// Redis Protocol specification. - - size_t size() const; - /// Returns the size of the array. - /// - /// Note: this can throw a NullValueException when this is a Null array. - -private: - void checkNull(); - /// Checks for null array and sets a new vector if true. - - Nullable<std::vector<RedisType::Ptr> > _elements; -}; - - -// -// inlines -// - - -inline Array& Array::operator<<(const char* s) -{ - BulkString value(s); - return add(value); -} - - -inline Array& Array::operator<<(const std::vector<std::string>& strings) -{ - return add(strings); -} - - -inline Array& Array::add() -{ - BulkString value; - return add(value); -} - - -template<> -inline Array& Array::add(const std::string& arg) -{ - BulkString value(arg); - return add(value); -} - - -inline Array& Array::add(const char* s) -{ - BulkString value(s); - return add(value); -} - - -inline Array& Array::add(const std::vector<std::string>& strings) -{ - for(std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); ++it) - { - add(*it); - } - return *this; -} - - -inline Array& Array::addSimpleString(const std::string& value) -{ - return addRedisType(new Type<std::string>(value)); -} - - -inline Array::const_iterator Array::begin() const -{ - return _elements.value().begin(); -} - - -inline void Array::checkNull() -{ - std::vector<RedisType::Ptr> v; - if ( _elements.isNull() ) _elements.assign(v); -} - - -inline void Array::clear() -{ - if ( !_elements.isNull() ) - { - _elements.value().clear(); - } -} - - -inline Array::const_iterator Array::end() const -{ - return _elements.value().end(); -} - - -inline bool Array::isNull() const -{ - return _elements.isNull(); -} - - -inline void Array::makeNull() -{ - if ( !_elements.isNull() ) _elements.value().clear(); - - _elements.clear(); -} - - -inline size_t Array::size() const -{ - return _elements.value().size(); -} - - -template<> -struct RedisTypeTraits<Array> -{ - enum { TypeId = RedisType::REDIS_ARRAY }; - - static const char marker = '*'; - - static std::string toString(const Array& value) - { - std::stringstream result; - result << marker; - if ( value.isNull() ) - { - result << "-1" << LineEnding::NEWLINE_CRLF; - } - else - { - result << value.size() << LineEnding::NEWLINE_CRLF; - for(std::vector<RedisType::Ptr>::const_iterator it = value.begin(); - it != value.end(); ++it) - { - result << (*it)->toString(); - } - } - return result.str(); - } - - static void read(RedisInputStream& input, Array& value) - { - value.clear(); - - Int64 length = NumberParser::parse64(input.getline()); - - if ( length != -1 ) - { - for(int i = 0; i < length; ++i) - { - char mark = static_cast<char>(input.get()); - RedisType::Ptr element = RedisType::createRedisType(mark); - - if ( element.isNull() ) - throw RedisException("Wrong answer received from Redis server"); - - element->read(input); - value.addRedisType(element); - } - } - } -}; - - -} } // namespace Poco::Redis - - -#endif // Redis_Array_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/AsyncReader.h b/contrib/libs/poco/Redis/include/Poco/Redis/AsyncReader.h deleted file mode 100644 index 040ce3292a..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/AsyncReader.h +++ /dev/null @@ -1,98 +0,0 @@ -// -// AsyncReader.h -// -// Library: Redis -// Package: Redis -// Module: AsyncReader -// -// Definition of the AsyncReader class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_AsyncReader_INCLUDED -#define Redis_AsyncReader_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/Redis/Client.h" -#include "Poco/Redis/RedisEventArgs.h" -#include "Poco/Activity.h" - - -namespace Poco { -namespace Redis { - - -class Redis_API AsyncReader - /// Wrapper around a Redis client to read messages asynchronously. Use this - /// for publish/subscribe. The redisResponse event is used to notify that - /// a message is received. When a reader is started for a Redis server, - /// you should use execute<void>, because this class is responsible for - /// reading all replies. -{ -public: - BasicEvent<RedisEventArgs> redisResponse; - /// Event that is fired when a message is received. - - BasicEvent<RedisEventArgs> redisException; - /// Event that is fired when an error occurred. - - AsyncReader(Client& client); - /// Creates the AsyncReader using the given Client. - - virtual ~AsyncReader(); - /// Destroys the AsyncReader. - - bool isStopped(); - /// Returns true if the activity is not running, false when it is. - - void start(); - /// Starts the activity to read replies from the Redis server. - - void stop(); - /// Stops the read activity. - -protected: - void runActivity(); - -private: - AsyncReader(const AsyncReader&); - AsyncReader& operator = (const AsyncReader&); - - Client& _client; - Activity<AsyncReader> _activity; -}; - - -// -// inlines -// - - -inline bool AsyncReader::isStopped() -{ - return _activity.isStopped(); -} - - -inline void AsyncReader::start() -{ - _activity.start(); -} - - -inline void AsyncReader::stop() -{ - _activity.stop(); -} - - -} } // namespace Poco::Redis - - -#endif //Redis_AsyncReader_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Client.h b/contrib/libs/poco/Redis/include/Poco/Redis/Client.h deleted file mode 100644 index 6b204ae6c6..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Client.h +++ /dev/null @@ -1,239 +0,0 @@ -// -// Client.h -// -// Library: Redis -// Package: Redis -// Module: Client -// -// Definition of the Client class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Client_INCLUDED -#define Redis_Client_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/Redis/Array.h" -#include "Poco/Redis/Error.h" -#include "Poco/Redis/RedisStream.h" -#include "Poco/Net/SocketAddress.h" -#include "Poco/Timespan.h" - - -namespace Poco { -namespace Redis { - - -class Redis_API Client - /// Represents a connection to a Redis server. - /// - /// A command is always made from an Array and a reply can be a signed 64 - /// bit integer, a simple string, a bulk string, an array or an error. The - /// first element of the command array is the Redis command. A simple string - /// is a string that cannot contain a CR or LF character. A bulk string is - /// implemented as a typedef for Poco::Nullable<std::string>. This is - /// because a bulk string can represent a Null value. - /// - /// BulkString bs = client.execute<BulkString>(...); - /// if ( bs.isNull() ) - /// { - /// // We have a Null value - /// } - /// else - /// { - /// // We have a string value - /// } - /// - /// To create Redis commands, the factory methods of the Command class can - /// be used or the Array class can be used directly. - /// - /// Command llen = Command::llen("list"); - /// - /// is the same as: - /// - /// Array command; - /// command.add("LLEN").add("list"); - /// - /// or: - /// - /// Array command; - /// command << "LLEN" << "list"; - /// - /// or even: - /// - /// Command command("LLEN"); - /// command << "list"; -{ -public: - typedef SharedPtr<Client> Ptr; - - Client(); - /// Creates an unconnected Client. - /// Use this when you want to connect later on. - - Client(const std::string& hostAndPort); - /// Constructor which connects to the given Redis host/port. - /// The host and port must be separated with a colon. - - Client(const std::string& host, int port); - /// Constructor which connects to the given Redis host/port. - - Client(const Net::SocketAddress& addrs); - /// Constructor which connects to the given Redis host/port. - - virtual ~Client(); - /// Destroys the Client. - - Net::SocketAddress address() const; - /// Returns the address of the Redis connection. - - void connect(const std::string& hostAndPort); - /// Connects to the given Redis server. The host and port must be - /// separated with a colon. - - void connect(const std::string& host, int port); - /// Connects to the given Redis server. - - void connect(const Net::SocketAddress& addrs); - /// Connects to the given Redis server. - - void connect(const std::string& hostAndPort, const Timespan& timeout); - /// Connects to the given Redis server. The host and port must be - /// separated with a colon. - - void connect(const std::string& host, int port, const Timespan& timeout); - /// Connects to the given Redis server. - - void connect(const Net::SocketAddress& addrs, const Timespan& timeout); - /// Connects to the given Redis server. - - void disconnect(); - /// Disconnects from the Redis server. - - bool isConnected() const; - /// Returns true iff the Client is connected to a Redis server. - - template<typename T> - T execute(const Array& command) - /// Sends the Redis Command to the server. It gets the reply - /// and tries to convert it to the given template type. - /// - /// A specialization exists for type void, which doesn't read - /// the reply. If the server sends a reply, it is your - /// responsibility to read it. Use this for pipelining. - /// - /// A Poco::BadCastException will be thrown when the reply couldn't be - /// converted. Supported types are Int64, std::string, BulkString, - /// Array and void. When the reply is an Error, it will throw - /// a RedisException. - { - T result = T(); - writeCommand(command, true); - readReply(result); - return result; - } - - void flush(); - /// Flush the output buffer to Redis. Use this when commands - /// are stored in the buffer to send them all at once to Redis. - - RedisType::Ptr sendCommand(const Array& command); - /// Sends a Redis command to the server and returns the reply. - /// Use this when the type of the reply isn't known. - - RedisType::Ptr readReply(); - /// Read a reply from the Redis server. - - template<typename T> - void readReply(T& result) - /// Read a reply from the Redis server and tries to convert that reply - /// to the template type. When the reply is a Redis error, it will - /// throw a RedisException. A BadCastException will be thrown, when - /// the reply is not of the given type. - { - RedisType::Ptr redisResult = readReply(); - if (redisResult->type() == RedisTypeTraits<Error>::TypeId) - { - Type<Error>* error = dynamic_cast<Type<Error>*>(redisResult.get()); - throw RedisException(error->value().getMessage()); - } - - if (redisResult->type() == RedisTypeTraits<T>::TypeId) - { - Type<T>* type = dynamic_cast<Type<T>*>(redisResult.get()); - if (type != NULL) result = type->value(); - } - else throw BadCastException(); - } - - Array sendCommands(const std::vector<Array>& commands); - /// Sends all commands (pipelining) to the Redis server before - /// getting all replies. - - void setReceiveTimeout(const Timespan& timeout); - /// Sets a receive timeout. - -private: - Client(const Client&); - Client& operator = (const Client&); - - void connect(); - /// Connects to the Redis server - - void connect(const Timespan& timeout); - /// Connects to the Redis server and sets a timeout. - - void writeCommand(const Array& command, bool flush); - /// Sends a request to the Redis server. Use readReply to get the - /// answer. Can also be used for pipelining commands. Make sure you - /// call readReply as many times as you called writeCommand, even when - /// an error occurred on a command. - - Net::SocketAddress _address; - Net::StreamSocket _socket; - RedisInputStream* _input; - RedisOutputStream* _output; -}; - - -// -// inlines -// - - -inline Net::SocketAddress Client::address() const -{ - return _address; -} - - -template<> inline -void Client::execute<void>(const Array& command) -{ - writeCommand(command, false); -} - - -inline void Client::flush() -{ - poco_assert(_output); - _output->flush(); -} - - -inline void Client::setReceiveTimeout(const Timespan& timeout) -{ - _socket.setReceiveTimeout(timeout); -} - - -} } // namespace Poco::Redis - - -#endif // Redis_Client_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Command.h b/contrib/libs/poco/Redis/include/Poco/Redis/Command.h deleted file mode 100644 index 627441c654..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Command.h +++ /dev/null @@ -1,279 +0,0 @@ -// -// Command.h -// -// Library: Redis -// Package: Redis -// Module: Command -// -// Definition of the Command class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Command_INCLUDED -#define Redis_Command_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/Redis/Array.h" -#include <vector> -#include <map> - - -namespace Poco { -namespace Redis { - - -class Redis_API Command: public Array - /// Helper class for creating commands. This class contains - /// factory methods for commonly used Redis commands. - /// - /// There are two ways of building commands: - /// - /// 1. Use this class and the factory methods - /// 2. Use the Array or Command class and build the command using the add - /// method or << operator. - /// - /// For example: - /// - /// Command cmd = Command::set("mykey", "Hello"); - /// - /// is the same as: - /// - /// Array cmd; - /// cmd << "SET" << "mykey" << "Hello"; - /// -{ -public: - typedef std::vector<std::string> StringVec; - - Command(const std::string& command); - /// Creates a command. - - Command(const Command& copy); - /// Creates a command by copying another one. - - virtual ~Command(); - /// Destroys the command. - - static Command append(const std::string& key, const std::string& value); - /// Creates and returns an APPEND command. - - static Command blpop(const StringVec& lists, Int64 timeout = 0); - /// Creates and returns a BLPOP command. - - static Command brpop(const StringVec& lists, Int64 timeout = 0); - /// Creates and returns a BRPOP command. - - static Command brpoplpush(const std::string& sourceList, const std::string& destinationList, Int64 timeout = 0); - /// Creates and returns a BRPOPLPUSH command. - - static Command decr(const std::string& key, Int64 by = 0); - /// Creates and returns an DECR or DECRBY command. Calls DECR when by is omitted or zero. - - static Command del(const std::string& key); - /// Creates and returns an DEL command. - - static Command del(const StringVec& keys); - /// Creates and returns an DEL command. - - static Command get(const std::string& key); - /// Creates and returns an GET command. - - static Command exists(const std::string& key); - /// Creates and returns an EXISTS command. - - static Command hdel(const std::string& hash, const std::string& field); - /// Creates and returns an HDEL command. - - static Command hdel(const std::string& hash, const StringVec& fields); - /// Creates and returns an HDEL command. - - static Command hexists(const std::string& hash, const std::string& field); - /// Creates and returns an HEXISTS command. - - static Command hget(const std::string& hash, const std::string& field); - /// Creates and returns an HGET command. - - static Command hgetall(const std::string& hash); - /// Creates and returns an HGETALL command. - - static Command hincrby(const std::string& hash, const std::string& field, Int64 by = 1); - /// Creates and returns an HINCRBY command. - - static Command hkeys(const std::string& hash); - /// Creates and returns an HKEYS command. - - static Command hlen(const std::string& hash); - /// Creates and returns an HLEN command. - - static Command hmget(const std::string& hash, const StringVec& fields); - /// Creates and returns an HMGET command. - - static Command hmset(const std::string& hash, std::map<std::string, std::string>& fields); - /// Creates and returns a HMSET command. - - static Command hset(const std::string& hash, const std::string& field, const std::string& value, bool create = true); - /// Creates and returns an HSET or HSETNX (when create is false) command. - - static Command hset(const std::string& hash, const std::string& field, Int64 value, bool create = true); - /// Creates and returns an HSET or HSETNX (when create is false) command. - - static Command hstrlen(const std::string& hash, const std::string& field); - /// Creates and returns an HSTRLEN command (Available for Redis 3.2). - - static Command hvals(const std::string& hash); - /// Creates and returns an HVALS command. - - static Command incr(const std::string& key, Int64 by = 0); - /// Creates and returns an INCR or INCRBY command. Calls INCR when by is omitted or zero. - - static Command lindex(const std::string& list, Int64 index = 0); - /// Creates and returns a LINDEX command. - - static Command linsert(const std::string& list, bool before, const std::string& reference, const std::string& value); - /// Creates and returns a LINSERT command. - - static Command llen(const std::string& list); - /// Creates and returns a LLEN command. - - static Command lpop(const std::string& list); - /// Creates and returns a LPOP command. - - static Command lpush(const std::string& list, const std::string& value, bool create = true); - /// Creates and returns a LPUSH or LPUSHX (when create is false) command. - - static Command lpush(const std::string& list, const StringVec& value, bool create = true); - /// Creates and returns a LPUSH or LPUSHX (when create is false) command. - - static Command lrange(const std::string& list, Int64 start = 0, Int64 stop = -1); - /// Creates and returns a LRANGE command. When start and stop is omitted an LRANGE - /// command will returned that returns all items of the list. - - static Command lrem(const std::string& list, Int64 count, const std::string& value); - /// Creates and returns a LREM command. - - static Command lset(const std::string& list, Int64 index, const std::string& value); - /// Creates and returns a LSET command. - - static Command ltrim(const std::string& list, Int64 start = 0, Int64 stop = -1); - /// Creates and returns a LTRIM command. - - static Command mget(const StringVec& keys); - /// Creates and returns a MGET command. - - static Command mset(const std::map<std::string, std::string>& keyvalues, bool create = true); - /// Creates and returns a MSET or MSETNX (when create is false) command. - - static Command sadd(const std::string& set, const std::string& value); - /// Creates and returns a SADD command. - - static Command sadd(const std::string& set, const StringVec& values); - /// Creates and returns a SADD command. - - static Command scard(const std::string& set); - /// Creates and returns a SCARD command. - - static Command sdiff(const std::string& set1, const std::string& set2); - /// Creates and returns a SDIFF command.Creates and returns - - static Command sdiff(const std::string& set, const StringVec& sets); - /// Creates and returns a SDIFF command. - - static Command sdiffstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Creates and returns a SDIFFSTORE command. - - static Command sdiffstore(const std::string& set, const StringVec& sets); - /// Creates and returns a SDIFFSTORE command. - - static Command set(const std::string& key, const std::string& value, bool overwrite = true, const Poco::Timespan& expireTime = 0, bool create = true); - /// Creates and returns a SET command to set the key with a value. - - static Command set(const std::string& key, Int64 value, bool overwrite = true, const Poco::Timespan& expireTime = 0, bool create = true); - /// Creates and returns a SET command to set the key with a value. - - static Command sinter(const std::string& set1, const std::string& set2); - /// Creates and returns a SINTER command. - - static Command sinter(const std::string& set, const StringVec& sets); - /// Creates and returns a SINTER command. - - static Command sinterstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Creates and returns a SINTERSTORE command. - - static Command sinterstore(const std::string& set, const StringVec& sets); - /// Creates and returns a SINTERSTORE command. - - static Command sismember(const std::string& set, const std::string& member); - /// Creates and returns a SISMEMBER command. - - static Command smembers(const std::string& set); - /// Creates and returns a SMEMBERS command. - - static Command smove(const std::string& source, const std::string& destination, const std::string& member); - /// Creates and returns a SMOVE command. - - static Command spop(const std::string& set, Int64 count = 0); - /// Creates and returns a SPOP command. - - static Command srandmember(const std::string& set, Int64 count = 0); - /// Creates and returns a SRANDMEMBER command. - - static Command srem(const std::string& set, const std::string& member); - /// Creates and returns a SREM command. - - static Command srem(const std::string& set, const StringVec& members); - /// Creates and returns a SREM command. - - static Command sunion(const std::string& set1, const std::string& set2); - /// Creates and returns a SUNION command. - - static Command sunion(const std::string& set, const StringVec& sets); - /// Creates and returns a SUNION command. - - static Command sunionstore(const std::string& set, const std::string& set1, const std::string& set2); - /// Creates and returns a SUNIONSTORE command. - - static Command sunionstore(const std::string& set, const StringVec& sets); - /// Creates and returns a SUNIONSTORE command. - - static Command rename(const std::string& key, const std::string& newName, bool overwrite = true); - /// Creates and returns a RENAME or RENAMENX when overwrite is false. - - static Command rpop(const std::string& list); - /// Creates and returns a RPOP command. - - static Command rpoplpush(const std::string& sourceList, const std::string& destinationList); - /// Creates and returns a RPOPLPUSH command. - - static Command rpush(const std::string& list, const std::string& value, bool create = true); - /// Creates and returns a RPUSH or RPUSHX (when create is false) command. - - static Command rpush(const std::string& list, const StringVec& value, bool create = true); - /// Creates and returns a RPUSH or RPUSHX (when create is false) command. - - static Command expire(const std::string& key, Int64 seconds); - /// Creates and returns an EXPIRE command. - - static Command ping(); - /// Creates and returns a PING command. - - static Command multi(); - /// Creates and returns a MULTI command. - - static Command exec(); - /// Creates and returns a EXEC command. - - static Command discard(); - /// Creates and returns a DISCARD command. -}; - - -} } // namespace Poco::Redis - - -#endif // Redis_Command_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Error.h b/contrib/libs/poco/Redis/include/Poco/Redis/Error.h deleted file mode 100644 index ddc8155bd5..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Error.h +++ /dev/null @@ -1,91 +0,0 @@ -// -// Error.h -// -// Library: Redis -// Package: Redis -// Module: Error -// -// Definition of the Error class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Error_INCLUDED -#define Redis_Error_INCLUDED - - -#include "Poco/Redis/Type.h" - - -namespace Poco { -namespace Redis { - - -class Redis_API Error - /// Represent a Redis error. -{ -public: - Error(); - /// Creates an empty Error. - - Error(const std::string& message); - /// Creates an Error with the given message. - - virtual ~Error(); - /// Destroys the Error. - - const std::string& getMessage() const; - /// Returns the error message. - - void setMessage(const std::string& message); - /// Sets the error message. - -private: - std::string _message; -}; - - -// -// inlines -// - - -inline const std::string& Error::getMessage() const -{ - return _message; -} - - -inline void Error::setMessage(const std::string& message) -{ - _message = message; -} - - -template<> -struct RedisTypeTraits<Error> -{ - enum { TypeId = RedisType::REDIS_ERROR }; - - static const char marker = '-'; - - static std::string toString(const Error& value) - { - return marker + value.getMessage() + LineEnding::NEWLINE_CRLF; - } - - static void read(RedisInputStream& input, Error& value) - { - value.setMessage(input.getline()); - } -}; - - -} } // namespace Poco::Redis - - -#endif // Redis_Error_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Exception.h b/contrib/libs/poco/Redis/include/Poco/Redis/Exception.h deleted file mode 100644 index 445442821a..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Exception.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// Exception.h -// -// Library: Redis -// Package: Redis -// Module: Exception -// -// Definition of the Exception class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Exception_INCLUDED -#define Redis_Exception_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/Exception.h" -#include <typeinfo> - - -namespace Poco { -namespace Redis { - - -POCO_DECLARE_EXCEPTION(Redis_API, RedisException, Exception) - - -} } // namespace Poco::Redis - - -#endif // Redis_Exception_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Redis.h b/contrib/libs/poco/Redis/include/Poco/Redis/Redis.h deleted file mode 100644 index bddc260b2d..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Redis.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// Redis.h -// -// Library: Redis -// Package: Redis -// Module: Redis -// -// Basic definitions for the Poco Redis library. -// This file must be the first file included by every other Redis -// header file. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef RedisRedis_INCLUDED -#define RedisRedis_INCLUDED - - -#include "Poco/Foundation.h" - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the Redis_EXPORTS -// symbol defined on the command line. This symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// Redis_API functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && defined(POCO_DLL) - #if defined(Redis_EXPORTS) - #define Redis_API __declspec(dllexport) - #else - #define Redis_API __declspec(dllimport) - #endif -#endif - - -#if !defined(Redis_API) - #if !defined(POCO_NO_GCC_API_ATTRIBUTE) && defined (__GNUC__) && (__GNUC__ >= 4) - #define Redis_API __attribute__ ((visibility ("default"))) - #else - #define Redis_API - #endif -#endif - - -// -// Automatically link Redis library. -// -#if defined(_MSC_VER) - #if !defined(POCO_NO_AUTOMATIC_LIBS) && !defined(Redis_EXPORTS) - #pragma comment(lib, "PocoRedis" POCO_LIB_SUFFIX) - #endif -#endif - - -#endif // RedisRedis_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/RedisEventArgs.h b/contrib/libs/poco/Redis/include/Poco/Redis/RedisEventArgs.h deleted file mode 100644 index 6150078980..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/RedisEventArgs.h +++ /dev/null @@ -1,99 +0,0 @@ -// -// RedisEventArgs.h -// -// Library: Redis -// Package: Redis -// Module: RedisEventArgs -// -// Definition of the RedisEventArgs class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_RedisEventArgs_INCLUDED -#define Redis_RedisEventArgs_INCLUDED - - -#include "Poco/Redis/Type.h" - - -namespace Poco { -namespace Redis { - - -class Redis_API RedisEventArgs - /// Event arguments for AsyncReader events. -{ -public: - RedisEventArgs(RedisType::Ptr message); - /// Creates the RedisEventArgs from the given message. - - RedisEventArgs(Exception* e); - /// Creates the RedisEventArgs from the given Redis Exception. - - ~RedisEventArgs(); - /// Destroys the RedisEventArgs. - - RedisType::Ptr message() const; - /// Returns the message retrieved from the Redis server. - /// This can be a NULL pointer when this event is about an exception. - - const Exception* exception() const; - /// Returns the exception if any, otherwise it returns null pointer. - - void stop(); - /// When called, the AsyncReader will stop. - /// - /// Note: The AsyncReader will always stop when this is an exception - /// event. Use this for example for pub/sub when there are no - /// subcribers anymore. - - bool isStopped() const; - /// Returns true when the AsyncReader will stop. - -private: - RedisType::Ptr _message; - - Exception* _exception; - - bool _stop; -}; - - -// -// inlines -// - - -inline RedisType::Ptr RedisEventArgs::message() const -{ - return _message; -} - - -inline const Exception* RedisEventArgs::exception() const -{ - return _exception; -} - - -inline bool RedisEventArgs::isStopped() const -{ - return _stop; -} - - -inline void RedisEventArgs::stop() -{ - _stop = true; -} - - -} } // namespace Poco::Redis - - -#endif // Redis_RedisEventArgs_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/RedisStream.h b/contrib/libs/poco/Redis/include/Poco/Redis/RedisStream.h deleted file mode 100644 index c750f38a1b..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/RedisStream.h +++ /dev/null @@ -1,114 +0,0 @@ -// -// RedisStream.h -// -// Library: Redis -// Package: Redis -// Module: RedisStream -// -// Definition of the RedisStream class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_RedisStream_INCLUDED -#define Redis_RedisStream_INCLUDED - - -#include "Poco/Redis/Redis.h" -#include "Poco/BufferedStreamBuf.h" -#include "Poco/Net/StreamSocket.h" -#include <istream> -#include <ostream> - - -namespace Poco { -namespace Redis { - - -class RedisStreamBuf: public BufferedStreamBuf - /// BufferedStreamBuf for Redis. -{ -public: - RedisStreamBuf(Net::StreamSocket& redis); - /// Constructor - - ~RedisStreamBuf(); - /// Destructor - - std::string readLine(); - /// Reads a line from Redis (until \r\n is encountered). - -protected: - int readFromDevice(char* buffer, std::streamsize length); - int writeToDevice(const char* buffer, std::streamsize length); - -private: - enum - { - STREAM_BUFFER_SIZE = 1024 - }; - - Net::StreamSocket& _redis; -}; - - -class RedisIOS: public virtual std::ios -{ -public: - RedisIOS(Net::StreamSocket& redis); - /// Creates the RedisIOS with the given socket. - - ~RedisIOS(); - /// Destroys the RedisIOS. - /// - /// Flushes the buffer, but does not close the socket. - - RedisStreamBuf* rdbuf(); - /// Returns a pointer to the internal RedisStreamBuf. - - void close(); - /// Flushes the stream. - -protected: - RedisStreamBuf _buf; -}; - - -class Redis_API RedisOutputStream: public RedisIOS, public std::ostream - /// An output stream for writing to a Redis server. -{ -public: - RedisOutputStream(Net::StreamSocket& redis); - /// Creates the RedisOutputStream with the given socket. - - ~RedisOutputStream(); - /// Destroys the RedisOutputStream. - /// - /// Flushes the buffer. -}; - - -class Redis_API RedisInputStream: public RedisIOS, public std::istream - /// An input stream for reading from a Redis server. -{ -public: - RedisInputStream(Net::StreamSocket& redis); - /// Creates the RedisInputStream with the given socket. - - ~RedisInputStream(); - /// Destroys the RedisInputStream. - - std::string getline(); - /// Redis uses \r\n as delimiter. This getline version removes - /// the \r from the result. -}; - - -} } // namespace Poco::Redis - - -#endif // Redis_RedisStream_INCLUDED diff --git a/contrib/libs/poco/Redis/include/Poco/Redis/Type.h b/contrib/libs/poco/Redis/include/Poco/Redis/Type.h deleted file mode 100644 index 79c534f1a8..0000000000 --- a/contrib/libs/poco/Redis/include/Poco/Redis/Type.h +++ /dev/null @@ -1,293 +0,0 @@ -// -// Type.h -// -// Library: Redis -// Package: Redis -// Module: Type -// -// Definition of the Type class. -// -// Copyright (c) 2016, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#ifndef Redis_Type_INCLUDED -#define Redis_Type_INCLUDED - - -#include "Poco/LineEndingConverter.h" -#include "Poco/NumberFormatter.h" -#include "Poco/NumberParser.h" -#include "Poco/SharedPtr.h" -#include "Poco/Nullable.h" -#include "Poco/Redis/Redis.h" -#include "Poco/Redis/RedisStream.h" - - -namespace Poco { -namespace Redis { - - -class Redis_API RedisType - /// Base class for all Redis types. This class makes it possible to store - /// element with different types in Array. -{ -public: - enum Types - { - REDIS_INTEGER, /// Redis Integer - REDIS_SIMPLE_STRING, /// Redis Simple String - REDIS_BULK_STRING, /// Redis Bulkstring - REDIS_ARRAY, /// Redis Array - REDIS_ERROR /// Redis Error - }; - - typedef SharedPtr<RedisType> Ptr; - - RedisType(); - /// Creates the RedisType. - - virtual ~RedisType(); - /// Destroys the RedisType. - - bool isArray() const; - /// Returns true when the value is a Redis array. - - bool isBulkString() const; - /// Returns true when the value is a Redis bulkstring. - - bool isError() const; - /// Returns true when the value is a Redis error. - - bool isInteger() const; - /// Returns true when the value is a Redis integer (64 bit integer). - - bool isSimpleString() const; - /// Returns true when the value is a simple string. - - virtual int type() const = 0; - /// Returns the type of the value. - - virtual void read(RedisInputStream& input) = 0; - /// Reads the value from the stream. - - virtual std::string toString() const = 0; - /// Converts the value to a RESP (REdis Serialization Protocol) string. - - static RedisType::Ptr createRedisType(char marker); - /// Create a Redis type based on the marker: - /// - /// - '+': a simple string (std::string) - /// - '-': an error (Error) - /// - '$': a bulk string (BulkString) - /// - '*': an array (Array) - /// - ':': a signed 64 bit integer (Int64) -}; - - -// -// inlines -// - - -inline bool RedisType::isArray() const -{ - return type() == REDIS_ARRAY; -} - - -inline bool RedisType::isBulkString() const -{ - return type() == REDIS_BULK_STRING; -} - - -inline bool RedisType::isError() const -{ - return type() == REDIS_ERROR; -} - - -inline bool RedisType::isInteger() const -{ - return type() == REDIS_INTEGER; -} - - -inline bool RedisType::isSimpleString() const -{ - return type() == REDIS_SIMPLE_STRING; -} - - -template<typename T> -struct RedisTypeTraits -{ -}; - - -template<> -struct RedisTypeTraits<Int64> -{ - enum - { - TypeId = RedisType::REDIS_INTEGER - }; - - static const char marker = ':'; - - static std::string toString(const Int64& value) - { - return marker + NumberFormatter::format(value) + "\r\n"; - } - - static void read(RedisInputStream& input, Int64& value) - { - std::string number = input.getline(); - value = NumberParser::parse64(number); - } -}; - - -template<> -struct RedisTypeTraits<std::string> -{ - enum - { - TypeId = RedisType::REDIS_SIMPLE_STRING - }; - - static const char marker = '+'; - - static std::string toString(const std::string& value) - { - return marker + value + LineEnding::NEWLINE_CRLF; - } - - static void read(RedisInputStream& input, std::string& value) - { - value = input.getline(); - } -}; - - -typedef Nullable<std::string> BulkString; - /// A bulk string is a string that can contain a NULL value. - /// So, BulkString is a typedef for Nullable<std::string>. - - -template<> -struct RedisTypeTraits<BulkString> -{ - enum - { - TypeId = RedisType::REDIS_BULK_STRING - }; - - static const char marker = '$'; - - static std::string toString(const BulkString& value) - { - if ( value.isNull() ) - { - return marker + std::string("-1") + LineEnding::NEWLINE_CRLF; - } - else - { - std::string s = value.value(); - return marker - + NumberFormatter::format(s.length()) - + LineEnding::NEWLINE_CRLF - + s - + LineEnding::NEWLINE_CRLF; - } - } - - static void read(RedisInputStream& input, BulkString& value) - { - value.clear(); - - std::string line = input.getline(); - int length = NumberParser::parse(line); - - if ( length >= 0 ) - { - std::string s; - s.resize(length, ' '); - input.read(&*s.begin(), length); - value.assign(s); - - input.getline(); // Read and ignore /r/n - } - } -}; - - -template<typename T> -class Type: public RedisType - /// Template class for all Redis types. This class will use - /// RedisTypeTraits structure for calling the type specific code. -{ -public: - Type() - /// Creates the Type. - { - } - - Type(const T& t) : _value(t) - /// Creates the Type from another one. - { - } - - Type(const Type& copy) : _value(copy._value) - /// Creates the Type by copying another one. - { - } - - virtual ~Type() - /// Destroys the Type. - { - } - - int type() const - /// Returns the type of the value - { - return RedisTypeTraits<T>::TypeId; - } - - void read(RedisInputStream& socket) - /// Reads the value from the stream (RESP). - { - RedisTypeTraits<T>::read(socket, _value); - } - - std::string toString() const - /// Converts the value to a string based on the RESP protocol. - { - return RedisTypeTraits<T>::toString(_value); - } - - T& value() - /// Returns the value - { - return _value; - } - - const T& value() const - /// Returns a const value - { - return _value; - } - -private: - T _value; -}; - - -} } // namespace Poco/Redis - - -#endif // Redis_Type_INCLUDED diff --git a/contrib/libs/poco/Redis/src/Array.cpp b/contrib/libs/poco/Redis/src/Array.cpp deleted file mode 100644 index 47938d5b4f..0000000000 --- a/contrib/libs/poco/Redis/src/Array.cpp +++ /dev/null @@ -1,67 +0,0 @@ -// -// Array.h -// -// Library: Redis -// Package: Redis -// Module: Array -// -// Implementation of the Array class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Array.h" - - -namespace Poco { -namespace Redis { - - -Array::Array() -{ -} - - -Array::Array(const Array& copy): - _elements(copy._elements) -{ -} - - -Array::~Array() -{ -} - - -Array& Array::addRedisType(RedisType::Ptr value) -{ - checkNull(); - - _elements.value().push_back(value); - - return *this; -} - - -int Array::getType(size_t pos) const -{ - if (_elements.isNull()) throw NullValueException(); - - if (pos >= _elements.value().size()) throw InvalidArgumentException(); - - RedisType::Ptr element = _elements.value().at(pos); - return element->type(); -} - - -std::string Array::toString() const -{ - return RedisTypeTraits<Array>::toString(*this); -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/AsyncReader.cpp b/contrib/libs/poco/Redis/src/AsyncReader.cpp deleted file mode 100644 index d59d418ac7..0000000000 --- a/contrib/libs/poco/Redis/src/AsyncReader.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// -// AsyncReader.cpp -// -// Library: Redis -// Package: Redis -// Module: AsyncReader -// -// Implementation of the AsyncReader class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/AsyncReader.h" - - -namespace Poco { -namespace Redis { - - -AsyncReader::AsyncReader(Client& client): - _client(client), - _activity(this, &AsyncReader::runActivity) -{ -} - - -AsyncReader::~AsyncReader() -{ - stop(); -} - - -void AsyncReader::runActivity() -{ - while (!_activity.isStopped()) - { - try - { - RedisType::Ptr reply = _client.readReply(); - - RedisEventArgs args(reply); - redisResponse.notify(this, args); - - if ( args.isStopped() ) stop(); - } - catch (Exception& e) - { - RedisEventArgs args(&e); - redisException.notify(this, args); - stop(); - } - if (!_activity.isStopped()) Thread::trySleep(100); - } -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/Client.cpp b/contrib/libs/poco/Redis/src/Client.cpp deleted file mode 100644 index 6486fbdb41..0000000000 --- a/contrib/libs/poco/Redis/src/Client.cpp +++ /dev/null @@ -1,213 +0,0 @@ -// -// Client.cpp -// -// Library: Redis -// Package: Redis -// Module: Client -// -// Implementation of the Client class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Client.h" -#include "Poco/Redis/Exception.h" - - -namespace Poco { -namespace Redis { - - -Client::Client(): - _address(), - _socket(), - _input(0), - _output(0) -{ -} - - -Client::Client(const std::string& hostAndPort): - _address(hostAndPort), - _socket(), - _input(0), - _output(0) -{ - connect(); -} - - -Client::Client(const std::string& host, int port): - _address(host, port), - _socket(), - _input(0), - _output(0) -{ - connect(); -} - - -Client::Client(const Net::SocketAddress& addrs): - _address(addrs), - _socket(), - _input(0), - _output(0) -{ - connect(); -} - - -Client::~Client() -{ - delete _input; - delete _output; -} - - -void Client::connect() -{ - poco_assert(! _input); - poco_assert(! _output); - - _socket = Net::StreamSocket(_address); - _input = new RedisInputStream(_socket); - _output = new RedisOutputStream(_socket); -} - - -void Client::connect(const std::string& hostAndPort) -{ - _address = Net::SocketAddress(hostAndPort); - connect(); -} - - -void Client::connect(const std::string& host, int port) -{ - _address = Net::SocketAddress(host, static_cast<UInt16>(port)); - connect(); -} - - -void Client::connect(const Net::SocketAddress& addrs) -{ - _address = addrs; - connect(); -} - - -void Client::connect(const Timespan& timeout) -{ - poco_assert(! _input); - poco_assert(! _output); - - _socket = Net::StreamSocket(); - _socket.connect(_address, timeout); - _input = new RedisInputStream(_socket); - _output = new RedisOutputStream(_socket); -} - - -void Client::connect(const std::string& hostAndPort, const Timespan& timeout) -{ - _address = Net::SocketAddress(hostAndPort); - connect(timeout); -} - - -void Client::connect(const std::string& host, int port, const Timespan& timeout) -{ - _address = Net::SocketAddress(host, static_cast<UInt16>(port)); - connect(timeout); -} - - -void Client::connect(const Net::SocketAddress& addrs, const Timespan& timeout) -{ - _address = addrs; - connect(timeout); -} - - -void Client::disconnect() -{ - delete _input; - _input = 0; - - delete _output; - _output = 0; - - _socket.close(); -} - - -bool Client::isConnected() const -{ - return _input != 0; -} - - -void Client::writeCommand(const Array& command, bool doFlush) -{ - poco_assert(_output); - - std::string commandStr = command.toString(); - - _output->write(commandStr.c_str(), commandStr.length()); - if (doFlush) _output->flush(); -} - - -RedisType::Ptr Client::readReply() -{ - poco_assert(_input); - - int c = _input->get(); - if (c == -1) - { - disconnect(); - throw RedisException("Lost connection to Redis server"); - } - RedisType::Ptr result = RedisType::createRedisType(c); - if (result.isNull()) - { - throw RedisException("Invalid Redis type returned"); - } - - result->read(*_input); - - return result; -} - - -RedisType::Ptr Client::sendCommand(const Array& command) -{ - writeCommand(command, true); - return readReply(); -} - - -Array Client::sendCommands(const std::vector<Array>& commands) -{ - Array results; - - for (std::vector<Array>::const_iterator it = commands.begin(); it != commands.end(); ++it) - { - writeCommand(*it, false); - } - _output->flush(); - - for (int i = 0; i < commands.size(); ++i) - { - results.addRedisType(readReply()); - } - - return results; -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/Command.cpp b/contrib/libs/poco/Redis/src/Command.cpp deleted file mode 100644 index 0c2de1e172..0000000000 --- a/contrib/libs/poco/Redis/src/Command.cpp +++ /dev/null @@ -1,738 +0,0 @@ -// -// Command.cpp -// -// Library: Redis -// Package: Redis -// Module: Command -// -// Implementation of the Command class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Command.h" -#include "Poco/NumberFormatter.h" - - -namespace Poco { -namespace Redis { - - -Command::Command(const std::string& command): Array() -{ - add(command); -} - - -Command::Command(const Command& copy): Array(copy) -{ -} - - -Command::~Command() -{ -} - - -Command Command::append(const std::string& key, const std::string& value) -{ - Command cmd("APPEND"); - - cmd << key << value; - - return cmd; -} - - -Command Command::blpop(const StringVec& lists, Int64 timeout) -{ - Command cmd("BLPOP"); - - cmd << lists << NumberFormatter::format(timeout); - - return cmd; -} - - -Command Command::brpop(const StringVec& lists, Int64 timeout) -{ - Command cmd("BRPOP"); - - cmd << lists << NumberFormatter::format(timeout); - - return cmd; -} - - -Command Command::brpoplpush(const std::string& sourceList, const std::string& destinationList, Int64 timeout) -{ - Command cmd("BRPOPLPUSH"); - - cmd << sourceList << destinationList << NumberFormatter::format(timeout); - - return cmd; -} - - -Command Command::decr(const std::string& key, Int64 by) -{ - Command cmd(by == 0 ? "DECR" : "DECRBY"); - - cmd << key; - if ( by > 0 ) cmd << NumberFormatter::format(by); - - return cmd; -} - - -Command Command::del(const std::string& key) -{ - Command cmd("DEL"); - - cmd << key; - - return cmd; -} - - -Command Command::del(const StringVec& keys) -{ - Command cmd("DEL"); - - cmd << keys; - - return cmd; -} - - -Command Command::get(const std::string& key) -{ - Command cmd("GET"); - - cmd << key; - - return cmd; -} - - -Command Command::exists(const std::string& key) -{ - Command cmd("EXISTS"); - - cmd << key; - - return cmd; -} - - -Command Command::hdel(const std::string& hash, const std::string& field) -{ - Command cmd("HDEL"); - - cmd << hash << field; - - return cmd; -} - - -Command Command::hdel(const std::string& hash, const StringVec& fields) -{ - Command cmd("HDEL"); - - cmd << hash << fields; - - return cmd; -} - - -Command Command::hexists(const std::string& hash, const std::string& field) -{ - Command cmd("HEXISTS"); - - cmd << hash << field; - - return cmd; -} - - -Command Command::hget(const std::string& hash, const std::string& field) -{ - Command cmd("HGET"); - - cmd << hash << field; - - return cmd; -} - - -Command Command::hgetall(const std::string& hash) -{ - Command cmd("HGETALL"); - - cmd << hash; - - return cmd; -} - - -Command Command::hincrby(const std::string& hash, const std::string& field, Int64 by) -{ - Command cmd("HINCRBY"); - - cmd << hash << field << NumberFormatter::format(by); - - return cmd; -} - - -Command Command::hkeys(const std::string& hash) -{ - Command cmd("HKEYS"); - - cmd << hash; - - return cmd; -} - - -Command Command::hlen(const std::string& hash) -{ - Command cmd("HLEN"); - - cmd << hash; - - return cmd; -} - - -Command Command::hmget(const std::string& hash, const StringVec& fields) -{ - Command cmd("HMGET"); - - cmd << hash << fields; - - return cmd; -} - - -Command Command::hmset(const std::string& hash, std::map<std::string, std::string>& fields) -{ - Command cmd("HMSET"); - - cmd << hash; - for(std::map<std::string, std::string>::const_iterator it = fields.begin(); it != fields.end(); ++it) - { - cmd << it->first << it->second; - } - - return cmd; -} - - -Command Command::hset(const std::string& hash, const std::string& field, const std::string& value, bool create) -{ - Command cmd(create ? "HSET" : "HSETNX"); - - cmd << hash << field << value; - - return cmd; -} - - -Command Command::hset(const std::string& hash, const std::string& field, Int64 value, bool create) -{ - return hset(hash, field, NumberFormatter::format(value), create); -} - - -Command Command::hstrlen(const std::string& hash, const std::string& field) -{ - Command cmd("HSTRLEN"); - - cmd << hash << field; - - return cmd; -} - - -Command Command::hvals(const std::string& hash) -{ - Command cmd("HVALS"); - - cmd << hash; - - return cmd; -} - - -Command Command::incr(const std::string& key, Int64 by) -{ - Command cmd(by == 0 ? "INCR" : "INCRBY"); - - cmd << key; - if ( by > 0 ) cmd << NumberFormatter::format(by); - - return cmd; -} - - -Command Command::lindex(const std::string& list, Int64 index) -{ - Command cmd("LINDEX"); - - cmd << list << NumberFormatter::format(index); - - return cmd; -} - - -Command Command::linsert(const std::string& list, bool before, const std::string& reference, const std::string& value) -{ - Command cmd("LINSERT"); - - cmd << list << (before ? "BEFORE" : "AFTER") << reference << value; - return cmd; -} - - -Command Command::llen(const std::string& list) -{ - Command cmd("LLEN"); - - cmd << list; - - return cmd; -} - - -Command Command::lpop(const std::string& list) -{ - Command cmd("LPOP"); - - cmd << list; - - return cmd; -} - - -Command Command::lpush(const std::string& list, const std::string& value, bool create) -{ - Command cmd(create ? "LPUSH" : "LPUSHX"); - - cmd << list << value; - - return cmd; -} - - -Command Command::lpush(const std::string& list, const StringVec& values, bool create) -{ - Command cmd(create ? "LPUSH" : "LPUSHX"); - - cmd << list << values; - - return cmd; -} - - -Command Command::lrange(const std::string& list, Int64 start, Int64 stop) -{ - Command cmd("LRANGE"); - - cmd << list << NumberFormatter::format(start) << NumberFormatter::format(stop); - - return cmd; -} - - -Command Command::lrem(const std::string& list, Int64 count, const std::string& value) -{ - Command cmd("LREM"); - - cmd << list << NumberFormatter::format(count) << value; - - return cmd; -} - - -Command Command::lset(const std::string& list, Int64 index, const std::string& value) -{ - Command cmd("LSET"); - - cmd << list << NumberFormatter::format(index) << value; - - return cmd; -} - - -Command Command::ltrim(const std::string& list, Int64 start, Int64 stop) -{ - Command cmd("LTRIM"); - - cmd << list << NumberFormatter::format(start) << NumberFormatter::format(stop); - - return cmd; -} - - -Command Command::mget(const StringVec& keys) -{ - Command cmd("MGET"); - - cmd << keys; - - return cmd; -} - - -Command Command::mset(const std::map<std::string, std::string>& keyvalues, bool create) -{ - Command cmd(create ? "MSET" : "MSETNX"); - - for(std::map<std::string, std::string>::const_iterator it = keyvalues.begin(); it != keyvalues.end(); ++it) - { - cmd << it->first << it->second; - } - - return cmd; -} - - -Command Command::sadd(const std::string& set, const std::string& value) -{ - Command cmd("SADD"); - - cmd << set << value; - - return cmd; -} - - -Command Command::sadd(const std::string& set, const StringVec& values) -{ - Command cmd("SADD"); - - cmd << set << values; - - return cmd; -} - - -Command Command::scard(const std::string& set) -{ - Command cmd("SCARD"); - - cmd << set; - - return cmd; -} - - -Command Command::sdiff(const std::string& set1, const std::string& set2) -{ - Command cmd("SDIFF"); - - cmd << set1 << set2; - - return cmd; -} - - -Command Command::sdiff(const std::string& set, const StringVec& sets) -{ - Command cmd("SDIFF"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::sdiffstore(const std::string& set, const std::string& set1, const std::string& set2) -{ - Command cmd("SDIFFSTORE"); - - cmd << set << set1 << set2; - - return cmd; -} - - -Command Command::sdiffstore(const std::string& set, const StringVec& sets) -{ - Command cmd("SDIFFSTORE"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::set(const std::string& key, const std::string& value, bool overwrite, const Poco::Timespan& expireTime, bool create) -{ - Command cmd("SET"); - - cmd << key << value; - if (! overwrite) cmd << "NX"; - if (! create) cmd << "XX"; - if (expireTime.totalMicroseconds() > 0) cmd << "PX" << expireTime.totalMilliseconds(); - - return cmd; -} - - -Command Command::set(const std::string& key, Int64 value, bool overwrite, const Poco::Timespan& expireTime, bool create) -{ - return set(key, NumberFormatter::format(value), overwrite, expireTime, create); -} - - -Command Command::sinter(const std::string& set1, const std::string& set2) -{ - Command cmd("SINTER"); - - cmd << set1 << set2; - - return cmd; -} - - -Command Command::sinter(const std::string& set, const StringVec& sets) -{ - Command cmd("SINTER"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::sinterstore(const std::string& set, const std::string& set1, const std::string& set2) -{ - Command cmd("SINTERSTORE"); - - cmd << set << set1 << set2; - - return cmd; -} - - -Command Command::sinterstore(const std::string& set, const StringVec& sets) -{ - Command cmd("SINTERSTORE"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::sismember(const std::string& set, const std::string& member) -{ - Command cmd("SISMEMBER"); - - cmd << set << member; - - return cmd; -} - - -Command Command::smembers(const std::string& set) -{ - Command cmd("SMEMBERS"); - - cmd << set; - - return cmd; -} - - -Command Command::smove(const std::string& source, const std::string& destination, const std::string& member) -{ - Command cmd("SMOVE"); - - cmd << source << destination << member; - - return cmd; -} - - -Command Command::spop(const std::string& set, Int64 count) -{ - Command cmd("SPOP"); - - cmd << set; - if( count != 0 ) cmd << NumberFormatter::format(count); - - return cmd; -} - - -Command Command::srandmember(const std::string& set, Int64 count) -{ - Command cmd("SRANDMEMBER"); - - cmd << set; - if( count != 0 ) cmd << NumberFormatter::format(count); - - return cmd; -} - - -Command Command::srem(const std::string& set1, const std::string& member) -{ - Command cmd("SREM"); - - cmd << set1 << member; - - return cmd; -} - - -Command Command::srem(const std::string& set, const StringVec& members) -{ - Command cmd("SREM"); - - cmd << set << members; - - return cmd; -} - - -Command Command::sunion(const std::string& set1, const std::string& set2) -{ - Command cmd("SUNION"); - - cmd << set1 << set2; - - return cmd; -} - - -Command Command::sunion(const std::string& set, const StringVec& sets) -{ - Command cmd("SUNION"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::sunionstore(const std::string& set, const std::string& set1, const std::string& set2) -{ - Command cmd("SUNIONSTORE"); - - cmd << set << set1 << set2; - - return cmd; -} - - -Command Command::sunionstore(const std::string& set, const StringVec& sets) -{ - Command cmd("SUNIONSTORE"); - - cmd << set << sets; - - return cmd; -} - - -Command Command::rename(const std::string& key, const std::string& newName, bool overwrite) -{ - Command cmd(overwrite ? "RENAME" : "RENAMENX"); - - cmd << key << newName; - - return cmd; -} - - -Command Command::rpop(const std::string& list) -{ - Command cmd("RPOP"); - - cmd << list; - - return cmd; -} - - -Command Command::rpoplpush(const std::string& sourceList, const std::string& destinationList) -{ - Command cmd("RPOPLPUSH"); - - cmd << sourceList << destinationList; - - return cmd; -} - - -Command Command::rpush(const std::string& list, const std::string& value, bool create) -{ - Command cmd(create ? "RPUSH" : "RPUSHX"); - - cmd << list << value; - - return cmd; -} - - -Command Command::rpush(const std::string& list, const StringVec& values, bool create) -{ - Command cmd(create ? "RPUSH" : "RPUSHX"); - - cmd << list << values; - - return cmd; -} - - -Command Command::expire(const std::string& key, Int64 seconds) -{ - Command cmd("EXPIRE"); - - cmd << key << NumberFormatter::format(seconds); - - return cmd; -} - - -Command Command::ping() -{ - Command cmd("PING"); - - return cmd; -} - - -Command Command::multi() -{ - Command cmd("MULTI"); - - return cmd; -} - - -Command Command::exec() -{ - Command cmd("EXEC"); - - return cmd; -} - - -Command Command::discard() -{ - Command cmd("DISCARD"); - - return cmd; -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/Error.cpp b/contrib/libs/poco/Redis/src/Error.cpp deleted file mode 100644 index 47f7cb766f..0000000000 --- a/contrib/libs/poco/Redis/src/Error.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// -// Error.cpp -// -// Library: Redis -// Package: Redis -// Module: Error -// -// Implementation of the Error class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Error.h" - - -namespace Poco { -namespace Redis { - - -Error::Error() -{ -} - - -Error::Error(const std::string& message): _message(message) -{ -} - - -Error::~Error() -{ -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/Exception.cpp b/contrib/libs/poco/Redis/src/Exception.cpp deleted file mode 100644 index e2829f12a5..0000000000 --- a/contrib/libs/poco/Redis/src/Exception.cpp +++ /dev/null @@ -1,27 +0,0 @@ -// -// Exception.h -// -// Library: Redis -// Package: Redis -// Module: Exception -// -// Implementation of the Exception class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Exception.h" - - -namespace Poco { -namespace Redis { - - -POCO_IMPLEMENT_EXCEPTION(RedisException, Exception, "Redis Exception") - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/RedisEventArgs.cpp b/contrib/libs/poco/Redis/src/RedisEventArgs.cpp deleted file mode 100644 index 014da2bb83..0000000000 --- a/contrib/libs/poco/Redis/src/RedisEventArgs.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// RedisEventArgs.cpp -// -// Library: Redis -// Package: Redis -// Module: RedisEventArgs -// -// Implementation of the RedisEventArgs class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/RedisEventArgs.h" - - -namespace Poco { -namespace Redis { - - -RedisEventArgs::RedisEventArgs(RedisType::Ptr pMessage): - _message(pMessage), - _exception(0), - _stop(false) -{ -} - - -RedisEventArgs::RedisEventArgs(Exception* pException): - _message(), - _exception(pException ? pException->clone() : 0), - _stop(false) -{ -} - - -RedisEventArgs::~RedisEventArgs() -{ - delete _exception; -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/RedisStream.cpp b/contrib/libs/poco/Redis/src/RedisStream.cpp deleted file mode 100644 index a81eb29396..0000000000 --- a/contrib/libs/poco/Redis/src/RedisStream.cpp +++ /dev/null @@ -1,133 +0,0 @@ -// -// RedisStream.cpp -// -// Library: Redis -// Package: Redis -// Module: RedisStream -// -// Implementation of the RedisStream class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/RedisStream.h" -#include <iostream> - - -namespace Poco { -namespace Redis { - - -// -// RedisStreamBuf -// - - -RedisStreamBuf::RedisStreamBuf(Net::StreamSocket& redis): - BufferedStreamBuf(STREAM_BUFFER_SIZE, std::ios::in | std::ios::out), - _redis(redis) -{ -} - - -RedisStreamBuf::~RedisStreamBuf() -{ -} - - -int RedisStreamBuf::readFromDevice(char* buffer, std::streamsize len) -{ - return _redis.receiveBytes(buffer, len); -} - - -int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length) -{ - return _redis.sendBytes(buffer, length); -} - - -// -// RedisIOS -// - - -RedisIOS::RedisIOS(Net::StreamSocket& redis): - _buf(redis) -{ - poco_ios_init(&_buf); -} - - -RedisIOS::~RedisIOS() -{ - try - { - _buf.sync(); - } - catch (...) - { - } -} - - -RedisStreamBuf* RedisIOS::rdbuf() -{ - return &_buf; -} - - -void RedisIOS::close() -{ - _buf.sync(); -} - - -// -// RedisOutputStream -// - - -RedisOutputStream::RedisOutputStream(Net::StreamSocket& redis): - RedisIOS(redis), - std::ostream(&_buf) -{ -} - - -RedisOutputStream::~RedisOutputStream() -{ -} - - -RedisInputStream::RedisInputStream(Net::StreamSocket& redis): - RedisIOS(redis), - std::istream(&_buf) -{ -} - - -// -// RedisInputStream -// - - -RedisInputStream::~RedisInputStream() -{ -} - - -std::string RedisInputStream::getline() -{ - std::string line; - std::getline(*this, line); - if ( line.size() > 0 ) line.erase(line.end() - 1); - return line; -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/src/Type.cpp b/contrib/libs/poco/Redis/src/Type.cpp deleted file mode 100644 index 83a5044888..0000000000 --- a/contrib/libs/poco/Redis/src/Type.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// -// Type.h -// -// Library: Redis -// Package: Redis -// Module: Type -// -// Implementation of the Type class. -// -// Copyright (c) 2015, Applied Informatics Software Engineering GmbH. -// and Contributors. -// -// SPDX-License-Identifier: BSL-1.0 -// - - -#include "Poco/Redis/Type.h" -#include "Poco/Redis/Error.h" -#include "Poco/Redis/Array.h" - - -namespace Poco { -namespace Redis { - - -RedisType::RedisType() -{ -} - - -RedisType::~RedisType() -{ -} - - -RedisType::Ptr RedisType::createRedisType(char marker) -{ - RedisType::Ptr result; - - switch(marker) - { - case RedisTypeTraits<Int64>::marker : - result = new Type<Int64>(); - break; - case RedisTypeTraits<std::string>::marker : - result = new Type<std::string>(); - break; - case RedisTypeTraits<BulkString>::marker : - result = new Type<BulkString>(); - break; - case RedisTypeTraits<Array>::marker : - result = new Type<Array>(); - break; - case RedisTypeTraits<Error>::marker : - result = new Type<Error>(); - break; - } - return result; -} - - -} } // namespace Poco::Redis diff --git a/contrib/libs/poco/Redis/ya.make b/contrib/libs/poco/Redis/ya.make deleted file mode 100644 index 1696f42d7f..0000000000 --- a/contrib/libs/poco/Redis/ya.make +++ /dev/null @@ -1,60 +0,0 @@ -# Generated by devtools/yamaker. - -LIBRARY() - -LICENSE(BSL-1.0) - -LICENSE_TEXTS(.yandex_meta/licenses.list.txt) - -PEERDIR( - contrib/libs/poco/Foundation - contrib/libs/poco/Net -) - -ADDINCL( - GLOBAL contrib/libs/poco/Redis/include - contrib/libs/poco/Foundation/include - contrib/libs/poco/Net/include - contrib/libs/poco/Redis/src -) - -NO_COMPILER_WARNINGS() - -NO_UTIL() - -CFLAGS( - -DPOCO_ENABLE_CPP11 - -DPOCO_ENABLE_CPP14 - -DPOCO_NO_AUTOMATIC_LIBS - -DPOCO_UNBUNDLED -) - -IF (OS_DARWIN) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_NO_STAT64 - ) -ELSEIF (OS_LINUX) - CFLAGS( - -DPOCO_OS_FAMILY_UNIX - -DPOCO_HAVE_FD_EPOLL - ) -ELSEIF (OS_WINDOWS) - CFLAGS( - -DPOCO_OS_FAMILY_WINDOWS - ) -ENDIF() - -SRCS( - src/Array.cpp - src/AsyncReader.cpp - src/Client.cpp - src/Command.cpp - src/Error.cpp - src/Exception.cpp - src/RedisEventArgs.cpp - src/RedisStream.cpp - src/Type.cpp -) - -END() |