fb-cpp 0.0.2
A modern C++ wrapper for the Firebird database API
Loading...
Searching...
No Matches
Descriptor.h
1/*
2 * MIT License
3 *
4 * Copyright (c) 2025 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_DESCRIPTOR_H
26#define FBCPP_DESCRIPTOR_H
27
28#include "fb-api.h"
29#include <string>
30
31
32namespace fbcpp::impl
33{
37 inline constexpr unsigned CHARSET_OCTETS = 1u;
38} // namespace fbcpp::impl
39
43namespace fbcpp
44{
45
49 enum class DescriptorOriginalType : unsigned
50 {
54 NULL_TYPE = SQL_NULL,
55
59 TEXT = SQL_TEXT,
60
64 VARYING = SQL_VARYING,
65
69 SHORT = SQL_SHORT,
70
74 LONG = SQL_LONG,
75
79 FLOAT = SQL_FLOAT,
80
84 DOUBLE = SQL_DOUBLE,
85
89 TIMESTAMP = SQL_TIMESTAMP,
90
94 BLOB = SQL_BLOB,
95
99 ARRAY = SQL_ARRAY,
100
104 TIME = SQL_TYPE_TIME,
105
109 DATE = SQL_TYPE_DATE,
110
114 INT64 = SQL_INT64,
115
119 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
120
124 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
125
129 TIME_TZ = SQL_TIME_TZ,
130
134 TIME_TZ_EX = SQL_TIME_TZ_EX,
135
139 INT128 = SQL_INT128,
140
144 DEC16 = SQL_DEC16,
145
149 DEC34 = SQL_DEC34,
150
154 BOOLEAN = SQL_BOOLEAN,
155 };
156
160 enum class DescriptorAdjustedType : unsigned
161 {
165 NULL_TYPE = SQL_NULL,
166
170 STRING = SQL_VARYING,
171
175 INT16 = SQL_SHORT,
176
180 INT32 = SQL_LONG,
181
185 FLOAT = SQL_FLOAT,
186
190 DOUBLE = SQL_DOUBLE,
191
195 TIMESTAMP = SQL_TIMESTAMP,
196
200 BLOB = SQL_BLOB,
201
205 ARRAY = SQL_ARRAY,
206
210 TIME = SQL_TYPE_TIME,
211
215 DATE = SQL_TYPE_DATE,
216
220 INT64 = SQL_INT64,
221
225 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
226
230 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
231
235 TIME_TZ = SQL_TIME_TZ,
236
240 TIME_TZ_EX = SQL_TIME_TZ_EX,
241
245 INT128 = SQL_INT128,
246
250 DECFLOAT16 = SQL_DEC16,
251
255 DECFLOAT34 = SQL_DEC34,
256
260 BOOLEAN = SQL_BOOLEAN,
261 };
262
266 struct Descriptor final
267 {
272
277
281 int scale;
282
286 unsigned length;
287
291 unsigned offset;
292
296 unsigned nullOffset;
297
302
306 std::string name;
307
311 std::string relation;
312
316 std::string alias;
317
321 std::string owner;
322
326 unsigned charSetId;
327
332 };
333} // namespace fbcpp
334
335
336#endif // FBCPP_DESCRIPTOR_H
fb-cpp namespace.
Definition Array.h:43
DescriptorAdjustedType
Descriptor adjusted type.
Definition Descriptor.h:161
@ DECFLOAT34
34-digit decimal floating point.
@ DECFLOAT16
16-digit decimal floating point.
@ INT16
16-bit signed integer.
@ STRING
String type (variable-length).
@ INT32
32-bit signed integer.
DescriptorOriginalType
Descriptor original type.
Definition Descriptor.h:50
@ BLOB
Binary large object.
@ DEC16
16-digit decimal floating point.
@ TIME
Time of day without time zone.
@ INT64
64-bit signed integer.
@ TIME_TZ
Time of day with time zone.
@ TIMESTAMP_TZ_EX
Extended timestamp with time zone.
@ TEXT
Fixed-length text.
@ DEC34
34-digit decimal floating point.
@ TIMESTAMP
Timestamp without time zone.
@ SHORT
16-bit signed integer.
@ NULL_TYPE
Null type indicator.
@ TIMESTAMP_TZ
Timestamp with time zone.
@ LONG
32-bit signed integer.
@ INT128
128-bit signed integer.
@ VARYING
Variable-length text.
@ TIME_TZ_EX
Extended time of day with time zone.
@ ARRAY
Array value represented by an array identifier.
@ FLOAT
Single-precision floating point.
@ DOUBLE
Double-precision floating point.
Describes a parameter or column.
Definition Descriptor.h:267
int scale
Decimal scale for numeric types; zero for non-numeric types.
Definition Descriptor.h:281
unsigned charSetId
Character set ID for string and BLOB columns.
Definition Descriptor.h:326
DescriptorAdjustedType adjustedType
Adjusted type after normalization for easier handling.
Definition Descriptor.h:276
int subType
Sub-type (BLOB sub-type or numeric sub-type).
Definition Descriptor.h:331
std::string relation
Table or relation this column belongs to (empty for expressions).
Definition Descriptor.h:311
unsigned nullOffset
Byte offset of the null indicator within the message buffer.
Definition Descriptor.h:296
std::string owner
Owner of the relation (empty for expressions).
Definition Descriptor.h:321
bool isNullable
Indicates whether the column or parameter can contain null values.
Definition Descriptor.h:301
std::string name
Column or parameter name.
Definition Descriptor.h:306
DescriptorOriginalType originalType
Original SQL type as reported by Firebird.
Definition Descriptor.h:271
unsigned offset
Byte offset of this field within the message buffer.
Definition Descriptor.h:291
std::string alias
Column alias as it appears in the query's SELECT list.
Definition Descriptor.h:316
unsigned length
Length in bytes of the column or parameter data.
Definition Descriptor.h:286