1 // 2 // Connector.h 3 // 4 // Library: Data 5 // Package: DataCore 6 // Module: Connector 7 // 8 // Definition of the Connector class. 9 // 10 // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. 11 // and Contributors. 12 // 13 // SPDX-License-Identifier: BSL-1.0 14 // 15 16 17 #ifndef Data_Connector_INCLUDED 18 #define Data_Connector_INCLUDED 19 20 21 #include "Poco/Data/Data.h" 22 #include "Poco/Data/SessionImpl.h" 23 #include "Poco/AutoPtr.h" 24 25 26 namespace Poco { 27 namespace Data { 28 29 30 class Data_API Connector 31 /// A Connector creates SessionImpl objects. 32 /// 33 /// Every connector library (like the SQLite or the ODBC connector) 34 /// provides a subclass of this class, an instance of which is 35 /// registered with the SessionFactory. 36 { 37 public: 38 Connector(); 39 /// Creates the Connector. 40 41 virtual ~Connector(); 42 /// Destroys the Connector. 43 44 virtual const std::string& name() const = 0; 45 /// Returns the name associated with this connector. 46 47 virtual Poco::AutoPtr<SessionImpl> createSession(const std::string& connectionString, 48 std::size_t timeout = SessionImpl::LOGIN_TIMEOUT_DEFAULT) = 0; 49 /// Create a SessionImpl object and initialize it with the given connectionString. 50 }; 51 52 53 } } // namespace Poco::Data 54 55 56 #endif // Data_Connector_INCLUDED 57