| 1 | // |
|---|---|
| 2 | // Connector.cpp |
| 3 | // |
| 4 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
| 5 | // and Contributors. |
| 6 | // |
| 7 | // SPDX-License-Identifier: BSL-1.0 |
| 8 | // |
| 9 | |
| 10 | |
| 11 | #include "Connector.h" |
| 12 | #include "SessionImpl.h" |
| 13 | #include "Poco/SQL/SessionFactory.h" |
| 14 | |
| 15 | |
| 16 | namespace Poco { |
| 17 | namespace SQL { |
| 18 | namespace Test { |
| 19 | |
| 20 | |
| 21 | const std::string Connector::KEY("test"); |
| 22 | |
| 23 | |
| 24 | Connector::Connector() |
| 25 | { |
| 26 | } |
| 27 | |
| 28 | |
| 29 | Connector::~Connector() |
| 30 | { |
| 31 | } |
| 32 | |
| 33 | |
| 34 | Poco::AutoPtr<Poco::SQL::SessionImpl> Connector::createSession(const std::string& connectionString, |
| 35 | std::size_t timeout) |
| 36 | { |
| 37 | return Poco::AutoPtr<Poco::SQL::SessionImpl>(new Poco::SQL::Test::SessionImpl(connectionString, timeout)); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | void Connector::addToFactory() |
| 42 | { |
| 43 | Poco::SQL::SessionFactory::instance().add(new Connector()); |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void Connector::removeFromFactory() |
| 48 | { |
| 49 | Poco::SQL::SessionFactory::instance().remove(KEY); |
| 50 | } |
| 51 | |
| 52 | |
| 53 | } } } // namespace Poco::SQL::Test |
| 54 |