1 | // |
2 | // TestStatementImpl.h |
3 | // |
4 | // Definition of the TestStatementImpl class. |
5 | // |
6 | // Copyright (c) 2006, Applied Informatics Software Engineering GmbH. |
7 | // and Contributors. |
8 | // |
9 | // SPDX-License-Identifier: BSL-1.0 |
10 | // |
11 | |
12 | |
13 | #ifndef SQL_Test_TestStatementImpl_INCLUDED |
14 | #define SQL_Test_TestStatementImpl_INCLUDED |
15 | |
16 | |
17 | #include "Poco/SQL/StatementImpl.h" |
18 | #include "Poco/SQL/MetaColumn.h" |
19 | #include "Poco/SharedPtr.h" |
20 | #include "Binder.h" |
21 | #include "Extractor.h" |
22 | #include "Preparator.h" |
23 | |
24 | |
25 | namespace Poco { |
26 | namespace SQL { |
27 | namespace Test { |
28 | |
29 | |
30 | class SessionImpl; |
31 | |
32 | |
33 | class TestStatementImpl: public Poco::SQL::StatementImpl |
34 | /// A no-op implementation of TestStatementImpl for testing. |
35 | { |
36 | public: |
37 | TestStatementImpl(SessionImpl& rSession); |
38 | /// Creates the TestStatementImpl. |
39 | |
40 | ~TestStatementImpl(); |
41 | /// Destroys the TestStatementImpl. |
42 | |
43 | protected: |
44 | std::size_t columnsReturned() const; |
45 | /// Returns number of columns returned by query. |
46 | |
47 | int affectedRowCount() const; |
48 | /// Returns the number of affected rows. |
49 | /// Used to find out the number of rows affected by insert or update. |
50 | |
51 | const MetaColumn& metaColumn(std::size_t pos, std::size_t rsPos) const; |
52 | /// Returns column meta data. |
53 | |
54 | bool hasNext(); |
55 | /// Returns true if a call to next() will return data. |
56 | |
57 | std::size_t next(); |
58 | /// Retrieves the next row or set of rows from the resultset. |
59 | /// Will throw, if the resultset is empty. |
60 | |
61 | bool canBind() const; |
62 | /// Returns true if a valid statement is set and we can bind. |
63 | |
64 | bool canCompile() const; |
65 | /// Returns true if statement was not compiled. |
66 | |
67 | void compileImpl(); |
68 | /// Compiles the statement, doesn't bind yet |
69 | |
70 | void bindImpl(); |
71 | /// Binds parameters |
72 | |
73 | AbstractExtraction::ExtractorPtr extractor(); |
74 | /// Returns the concrete extractor used by the statement. |
75 | |
76 | AbstractBinding::BinderPtr binder(); |
77 | /// Returns the concrete binder used by the statement. |
78 | |
79 | private: |
80 | Poco::SharedPtr<Binder> _ptrBinder; |
81 | Poco::SharedPtr<Extractor> ; |
82 | Poco::SharedPtr<Preparator> _ptrPreparation; |
83 | bool _compiled; |
84 | }; |
85 | |
86 | |
87 | // |
88 | // inlines |
89 | // |
90 | inline AbstractExtraction::ExtractorPtr TestStatementImpl::() |
91 | { |
92 | return _ptrExtractor; |
93 | } |
94 | |
95 | |
96 | inline AbstractBinding::BinderPtr TestStatementImpl::binder() |
97 | { |
98 | return _ptrBinder; |
99 | } |
100 | |
101 | |
102 | inline int TestStatementImpl::affectedRowCount() const |
103 | { |
104 | return 0; |
105 | } |
106 | |
107 | |
108 | inline bool TestStatementImpl::canCompile() const |
109 | { |
110 | return !_compiled; |
111 | } |
112 | |
113 | |
114 | } } } // namespace Poco::SQL::Test |
115 | |
116 | |
117 | #endif // Data_Test_TestStatementImpl_INCLUDED |
118 | |