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
35namespace fbcpp
36{
40 enum class DescriptorOriginalType : unsigned
41 {
45 NULL_TYPE = SQL_NULL,
46
50 TEXT = SQL_TEXT,
51
55 VARYING = SQL_VARYING,
56
60 SHORT = SQL_SHORT,
61
65 LONG = SQL_LONG,
66
70 FLOAT = SQL_FLOAT,
71
75 DOUBLE = SQL_DOUBLE,
76
80 TIMESTAMP = SQL_TIMESTAMP,
81
85 BLOB = SQL_BLOB,
86
90 TIME = SQL_TYPE_TIME,
91
95 DATE = SQL_TYPE_DATE,
96
100 INT64 = SQL_INT64,
101
105 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
106
110 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
111
115 TIME_TZ = SQL_TIME_TZ,
116
120 TIME_TZ_EX = SQL_TIME_TZ_EX,
121
125 INT128 = SQL_INT128,
126
130 DEC16 = SQL_DEC16,
131
135 DEC34 = SQL_DEC34,
136
140 BOOLEAN = SQL_BOOLEAN,
141 };
142
146 enum class DescriptorAdjustedType : unsigned
147 {
151 NULL_TYPE = SQL_NULL,
152
156 STRING = SQL_VARYING,
157
161 INT16 = SQL_SHORT,
162
166 INT32 = SQL_LONG,
167
171 FLOAT = SQL_FLOAT,
172
176 DOUBLE = SQL_DOUBLE,
177
181 TIMESTAMP = SQL_TIMESTAMP,
182
186 BLOB = SQL_BLOB,
187
191 TIME = SQL_TYPE_TIME,
192
196 DATE = SQL_TYPE_DATE,
197
201 INT64 = SQL_INT64,
202
206 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
207
211 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
212
216 TIME_TZ = SQL_TIME_TZ,
217
221 TIME_TZ_EX = SQL_TIME_TZ_EX,
222
226 INT128 = SQL_INT128,
227
231 DECFLOAT16 = SQL_DEC16,
232
236 DECFLOAT34 = SQL_DEC34,
237
241 BOOLEAN = SQL_BOOLEAN,
242 };
243
247 struct Descriptor final
248 {
253
258
262 int scale;
263
267 unsigned length;
268
272 unsigned offset;
273
277 unsigned nullOffset;
278
283
287 std::string name;
288
292 std::string relation;
293
297 std::string alias;
298
302 std::string owner;
303
307 unsigned charSetId;
308
313 };
314} // namespace fbcpp
315
316
317#endif // FBCPP_DESCRIPTOR_H
fb-cpp namespace.
Definition Attachment.h:42
DescriptorAdjustedType
Descriptor adjusted type.
Definition Descriptor.h:147
@ 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:41
@ 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.
@ FLOAT
Single-precision floating point.
@ DOUBLE
Double-precision floating point.
Describes a parameter or column.
Definition Descriptor.h:248
int scale
Decimal scale for numeric types; zero for non-numeric types.
Definition Descriptor.h:262
unsigned charSetId
Character set ID for string and BLOB columns.
Definition Descriptor.h:307
DescriptorAdjustedType adjustedType
Adjusted type after normalization for easier handling.
Definition Descriptor.h:257
int subType
Sub-type (BLOB sub-type or numeric sub-type).
Definition Descriptor.h:312
std::string relation
Table or relation this column belongs to (empty for expressions).
Definition Descriptor.h:292
unsigned nullOffset
Byte offset of the null indicator within the message buffer.
Definition Descriptor.h:277
std::string owner
Owner of the relation (empty for expressions).
Definition Descriptor.h:302
bool isNullable
Indicates whether the column or parameter can contain null values.
Definition Descriptor.h:282
std::string name
Column or parameter name.
Definition Descriptor.h:287
DescriptorOriginalType originalType
Original SQL type as reported by Firebird.
Definition Descriptor.h:252
unsigned offset
Byte offset of this field within the message buffer.
Definition Descriptor.h:272
std::string alias
Column alias as it appears in the query's SELECT list.
Definition Descriptor.h:297
unsigned length
Length in bytes of the column or parameter data.
Definition Descriptor.h:267