| 1 | // |
| 2 | // Connector.h |
| 3 | // |
| 4 | // Definition of the Connector class. |
| 5 | // |
| 6 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
| 7 | // and Contributors. |
| 8 | // |
| 9 | // SPDX-License-Identifier: BSL-1.0 |
| 10 | // |
| 11 | |
| 12 | |
| 13 | #ifndef SQL_Test_Connector_INCLUDED |
| 14 | #define SQL_Test_Connector_INCLUDED |
| 15 | |
| 16 | |
| 17 | #include "Poco/SQL/Connector.h" |
| 18 | |
| 19 | |
| 20 | namespace Poco { |
| 21 | namespace SQL { |
| 22 | namespace Test { |
| 23 | |
| 24 | |
| 25 | class Connector: public Poco::SQL::Connector |
| 26 | /// Connector instantiates SessionImpl objects for testing. |
| 27 | { |
| 28 | public: |
| 29 | static const std::string KEY; |
| 30 | /// Keyword for creating test sessions. |
| 31 | |
| 32 | Connector(); |
| 33 | /// Creates the Connector. |
| 34 | |
| 35 | ~Connector(); |
| 36 | /// Destroys the Connector. |
| 37 | |
| 38 | const std::string& name() const; |
| 39 | /// Returns the name associated with this connector. |
| 40 | |
| 41 | Poco::AutoPtr<Poco::SQL::SessionImpl> createSession(const std::string& connectionString, |
| 42 | std::size_t timeout = SessionImpl::LOGIN_TIMEOUT_DEFAULT); |
| 43 | /// Creates a test SessionImpl object and initializes it with the given connectionString. |
| 44 | |
| 45 | static void addToFactory(); |
| 46 | /// Registers the Connector under the Keyword Connector::KEY at the Poco::SQL::SessionFactory. |
| 47 | |
| 48 | static void removeFromFactory(); |
| 49 | /// Unregisters the Connector under the Keyword Connector::KEY at the Poco::SQL::SessionFactory. |
| 50 | }; |
| 51 | |
| 52 | |
| 53 | /// |
| 54 | /// inlines |
| 55 | /// |
| 56 | inline const std::string& Connector::name() const |
| 57 | { |
| 58 | return KEY; |
| 59 | } |
| 60 | |
| 61 | |
| 62 | } } } // namespace Poco::SQL::Test |
| 63 | |
| 64 | |
| 65 | #endif // Data_Test_Connector_INCLUDED |
| 66 | |