| 1 | // |
| 2 | // SessionImpl.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 "SessionImpl.h" |
| 12 | #include "TestStatementImpl.h" |
| 13 | #include "Connector.h" |
| 14 | |
| 15 | |
| 16 | namespace Poco { |
| 17 | namespace SQL { |
| 18 | namespace Test { |
| 19 | |
| 20 | |
| 21 | SessionImpl::SessionImpl(const std::string& init, std::size_t timeout): |
| 22 | Poco::SQL::AbstractSessionImpl<SessionImpl>(init, timeout), |
| 23 | _f(false), |
| 24 | _connected(true) |
| 25 | { |
| 26 | addFeature("f1" , &SessionImpl::setF, &SessionImpl::getF); |
| 27 | addFeature("f2" , 0, &SessionImpl::getF); |
| 28 | addFeature("f3" , &SessionImpl::setF, 0); |
| 29 | addFeature("connected" , &SessionImpl::setConnected, &SessionImpl::getConnected); |
| 30 | addProperty("p1" , &SessionImpl::setP, &SessionImpl::getP); |
| 31 | addProperty("p2" , 0, &SessionImpl::getP); |
| 32 | addProperty("p3" , &SessionImpl::setP, &SessionImpl::getP); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | SessionImpl::~SessionImpl() |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | |
| 41 | void SessionImpl::open(const std::string& connectionString) |
| 42 | { |
| 43 | _connected = true; |
| 44 | } |
| 45 | |
| 46 | |
| 47 | void SessionImpl::close() |
| 48 | { |
| 49 | _connected = false; |
| 50 | } |
| 51 | |
| 52 | |
| 53 | void SessionImpl::reset() |
| 54 | { |
| 55 | } |
| 56 | |
| 57 | |
| 58 | bool SessionImpl::isConnected() const |
| 59 | { |
| 60 | return _connected; |
| 61 | } |
| 62 | |
| 63 | |
| 64 | void SessionImpl::setConnectionTimeout(std::size_t timeout) |
| 65 | { |
| 66 | } |
| 67 | |
| 68 | |
| 69 | std::size_t SessionImpl::getConnectionTimeout() const |
| 70 | { |
| 71 | return 0; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | StatementImpl::Ptr SessionImpl::createStatementImpl() |
| 76 | { |
| 77 | return new TestStatementImpl(*this); |
| 78 | } |
| 79 | |
| 80 | |
| 81 | void SessionImpl::begin() |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | |
| 86 | void SessionImpl::commit() |
| 87 | { |
| 88 | } |
| 89 | |
| 90 | |
| 91 | void SessionImpl::rollback() |
| 92 | { |
| 93 | } |
| 94 | |
| 95 | |
| 96 | bool SessionImpl::canTransact() const |
| 97 | { |
| 98 | return false; |
| 99 | } |
| 100 | |
| 101 | |
| 102 | bool SessionImpl::isTransaction() const |
| 103 | { |
| 104 | return false; |
| 105 | } |
| 106 | |
| 107 | |
| 108 | void SessionImpl::setTransactionIsolation(Poco::UInt32) |
| 109 | { |
| 110 | } |
| 111 | |
| 112 | |
| 113 | Poco::UInt32 SessionImpl::getTransactionIsolation() const |
| 114 | { |
| 115 | return 0; |
| 116 | } |
| 117 | |
| 118 | |
| 119 | bool SessionImpl::hasTransactionIsolation(Poco::UInt32) const |
| 120 | { |
| 121 | return false; |
| 122 | } |
| 123 | |
| 124 | |
| 125 | bool SessionImpl::isTransactionIsolation(Poco::UInt32) const |
| 126 | { |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | |
| 131 | const std::string& SessionImpl::connectorName() const |
| 132 | { |
| 133 | return Connector::KEY; |
| 134 | } |
| 135 | |
| 136 | |
| 137 | bool SessionImpl::getConnected(const std::string& name) const |
| 138 | { |
| 139 | return _connected; |
| 140 | } |
| 141 | |
| 142 | |
| 143 | void SessionImpl::setConnected(const std::string& name, bool value) |
| 144 | { |
| 145 | _connected = value; |
| 146 | } |
| 147 | |
| 148 | |
| 149 | void SessionImpl::setF(const std::string& name, bool value) |
| 150 | { |
| 151 | _f = value; |
| 152 | } |
| 153 | |
| 154 | |
| 155 | bool SessionImpl::getF(const std::string& name) const |
| 156 | { |
| 157 | return _f; |
| 158 | } |
| 159 | |
| 160 | |
| 161 | void SessionImpl::setP(const std::string& name, const Poco::Any& value) |
| 162 | { |
| 163 | _p = value; |
| 164 | } |
| 165 | |
| 166 | |
| 167 | Poco::Any SessionImpl::getP(const std::string& name) const |
| 168 | { |
| 169 | return _p; |
| 170 | } |
| 171 | |
| 172 | |
| 173 | } } } // namespace Poco::SQL::Test |
| 174 | |