| 1 | // |
|---|---|
| 2 | // TestStatementImpl.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 "TestStatementImpl.h" |
| 12 | #include "SessionImpl.h" |
| 13 | |
| 14 | |
| 15 | namespace Poco { |
| 16 | namespace SQL { |
| 17 | namespace Test { |
| 18 | |
| 19 | |
| 20 | TestStatementImpl::TestStatementImpl(SessionImpl& rSession): |
| 21 | Poco::SQL::StatementImpl(rSession), |
| 22 | _compiled(false) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | |
| 27 | TestStatementImpl::~TestStatementImpl() |
| 28 | { |
| 29 | } |
| 30 | |
| 31 | |
| 32 | void TestStatementImpl::compileImpl() |
| 33 | { |
| 34 | // prepare binding |
| 35 | _ptrBinder = new Binder; |
| 36 | _ptrExtractor = new Extractor; |
| 37 | _ptrPreparation = new Preparator; |
| 38 | _compiled = true; |
| 39 | } |
| 40 | |
| 41 | |
| 42 | bool TestStatementImpl::canBind() const |
| 43 | { |
| 44 | return false; |
| 45 | } |
| 46 | |
| 47 | |
| 48 | void TestStatementImpl::bindImpl() |
| 49 | { |
| 50 | // bind |
| 51 | typedef Poco::SQL::AbstractBindingVec Bindings; |
| 52 | Bindings& binds = bindings(); |
| 53 | if (binds.empty()) |
| 54 | return; |
| 55 | |
| 56 | Bindings::iterator it = binds.begin(); |
| 57 | Bindings::iterator itEnd = binds.end(); |
| 58 | std::size_t pos = 0; |
| 59 | for (; it != itEnd && (*it)->canBind(); ++it) |
| 60 | { |
| 61 | (*it)->bind(pos); |
| 62 | pos += (*it)->numOfColumnsHandled(); |
| 63 | } |
| 64 | } |
| 65 | |
| 66 | |
| 67 | std::size_t TestStatementImpl::columnsReturned() const |
| 68 | { |
| 69 | return 0; |
| 70 | } |
| 71 | |
| 72 | |
| 73 | const MetaColumn& TestStatementImpl::metaColumn(std::size_t pos, std::size_t /*rsPos*/) const |
| 74 | { |
| 75 | static MetaColumn c(pos, "", MetaColumn::FDT_BOOL, 0); |
| 76 | return c; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | bool TestStatementImpl::hasNext() |
| 81 | { |
| 82 | return false; |
| 83 | } |
| 84 | |
| 85 | |
| 86 | std::size_t TestStatementImpl::next() |
| 87 | { |
| 88 | Poco::SQL::AbstractExtractionVec::iterator it = extractions().begin(); |
| 89 | Poco::SQL::AbstractExtractionVec::iterator itEnd = extractions().end(); |
| 90 | std::size_t pos = 0; |
| 91 | for (; it != itEnd; ++it) |
| 92 | { |
| 93 | (*it)->extract(pos); |
| 94 | pos += (*it)->numOfColumnsHandled(); |
| 95 | } |
| 96 | |
| 97 | return 1u; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | } } } // namespace Poco::SQL::Test |
| 102 |