| 1 | // |
|---|---|
| 2 | // SessionImpl.cpp |
| 3 | // |
| 4 | // Library: SQL |
| 5 | // Package: SQLCore |
| 6 | // Module: SessionImpl |
| 7 | // |
| 8 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
| 9 | // and Contributors. |
| 10 | // |
| 11 | // SPDX-License-Identifier: BSL-1.0 |
| 12 | // |
| 13 | |
| 14 | |
| 15 | #include "Poco/SQL/SessionImpl.h" |
| 16 | #include "Poco/Exception.h" |
| 17 | |
| 18 | |
| 19 | namespace Poco { |
| 20 | namespace SQL { |
| 21 | |
| 22 | |
| 23 | SessionImpl::SessionImpl(const std::string& rConnectionString, std::size_t timeout): |
| 24 | _connectionString(rConnectionString), |
| 25 | _loginTimeout(timeout) |
| 26 | { |
| 27 | } |
| 28 | |
| 29 | |
| 30 | SessionImpl::~SessionImpl() |
| 31 | { |
| 32 | } |
| 33 | |
| 34 | |
| 35 | void SessionImpl::reconnect() |
| 36 | { |
| 37 | close(); |
| 38 | open(); |
| 39 | } |
| 40 | |
| 41 | |
| 42 | void SessionImpl::setConnectionString(const std::string& rConnectionString) |
| 43 | { |
| 44 | if (isConnected()) |
| 45 | throw Poco::InvalidAccessException("Can not change connection string on connected session." |
| 46 | " Close the session first."); |
| 47 | |
| 48 | _connectionString = rConnectionString; |
| 49 | } |
| 50 | |
| 51 | |
| 52 | } } // namespace Poco::SQL |
| 53 |