fb-cpp 0.0.2
A modern C++ wrapper for the Firebird database API
Loading...
Searching...
No Matches
StatementOptions.h
1/*
2 * MIT License
3 *
4 * Copyright (c) 2026 Adriano dos Santos Fernandes
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a copy
7 * of this software and associated documentation files (the "Software"), to deal
8 * in the Software without restriction, including without limitation the rights
9 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 * copies of the Software, and to permit persons to whom the Software is
11 * furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in all
14 * copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22 * SOFTWARE.
23 */
24
25#ifndef FBCPP_STATEMENT_OPTIONS_H
26#define FBCPP_STATEMENT_OPTIONS_H
27
28#include "fb-api.h"
29#include <optional>
30#include <string>
31
35namespace fbcpp
36{
40 enum class CursorType
41 {
46
51 };
52
56 class StatementOptions final
57 {
58 public:
63 {
64 return prefetchLegacyPlan;
65 }
66
73 {
74 prefetchLegacyPlan = value;
75 return *this;
76 }
77
81 bool getPrefetchPlan() const
82 {
83 return prefetchPlan;
84 }
85
92 {
93 prefetchPlan = value;
94 return *this;
95 }
96
100 const std::optional<std::string>& getCursorName() const
101 {
102 return cursorName;
103 }
104
110 StatementOptions& setCursorName(const std::string& value)
111 {
112 cursorName = value;
113 return *this;
114 }
115
120 {
121 return cursorType;
122 }
123
130 {
131 cursorType = value;
132 return *this;
133 }
134
138 unsigned getDialect() const
139 {
140 return dialect;
141 }
142
149 {
150 dialect = value;
151 return *this;
152 }
153
154 private:
155 bool prefetchLegacyPlan = false;
156 bool prefetchPlan = false;
157 std::optional<std::string> cursorName;
159 unsigned dialect = SQL_DIALECT_CURRENT;
160 };
161} // namespace fbcpp
162
163#endif // FBCPP_STATEMENT_OPTIONS_H
Represents options used when preparing a Statement.
const std::optional< std::string > & getCursorName() const
Returns the cursor name to be set for the statement.
unsigned getDialect() const
Returns the SQL dialect used when preparing the statement.
StatementOptions & setDialect(unsigned value)
Sets the SQL dialect used when preparing the statement.
StatementOptions & setCursorType(CursorType value)
Sets the cursor type used when opening a result set.
StatementOptions & setPrefetchLegacyPlan(bool value)
Enables or disables prefetching of the legacy textual plan at prepare time.
bool getPrefetchPlan() const
Reports whether the structured plan should be prefetched during prepare.
StatementOptions & setCursorName(const std::string &value)
Sets the cursor name for the statement.
StatementOptions & setPrefetchPlan(bool value)
Enables or disables prefetching of the structured plan at prepare time.
bool getPrefetchLegacyPlan() const
Reports whether the legacy textual plan should be prefetched during prepare.
CursorType getCursorType() const
Returns the cursor type to be used when opening a result set.
fb-cpp namespace.
Definition Attachment.h:45
CursorType
Selects the cursor type for a SELECT statement.
@ FORWARD_ONLY
Forward-only traversal (default, more efficient for streaming).
@ SCROLLABLE
Allows bidirectional traversal and absolute/relative positioning.