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
30
34namespace fbcpp
35{
39 enum class DescriptorOriginalType : unsigned
40 {
44 NULL_TYPE = SQL_NULL,
45
49 TEXT = SQL_TEXT,
50
54 VARYING = SQL_VARYING,
55
59 SHORT = SQL_SHORT,
60
64 LONG = SQL_LONG,
65
69 FLOAT = SQL_FLOAT,
70
74 DOUBLE = SQL_DOUBLE,
75
79 TIMESTAMP = SQL_TIMESTAMP,
80
84 BLOB = SQL_BLOB,
85
89 TIME = SQL_TYPE_TIME,
90
94 DATE = SQL_TYPE_DATE,
95
99 INT64 = SQL_INT64,
100
104 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
105
109 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
110
114 TIME_TZ = SQL_TIME_TZ,
115
119 TIME_TZ_EX = SQL_TIME_TZ_EX,
120
124 INT128 = SQL_INT128,
125
129 DEC16 = SQL_DEC16,
130
134 DEC34 = SQL_DEC34,
135
139 BOOLEAN = SQL_BOOLEAN,
140 };
141
145 enum class DescriptorAdjustedType : unsigned
146 {
150 NULL_TYPE = SQL_NULL,
151
155 STRING = SQL_VARYING,
156
160 INT16 = SQL_SHORT,
161
165 INT32 = SQL_LONG,
166
170 FLOAT = SQL_FLOAT,
171
175 DOUBLE = SQL_DOUBLE,
176
180 TIMESTAMP = SQL_TIMESTAMP,
181
185 BLOB = SQL_BLOB,
186
190 TIME = SQL_TYPE_TIME,
191
195 DATE = SQL_TYPE_DATE,
196
200 INT64 = SQL_INT64,
201
205 TIMESTAMP_TZ = SQL_TIMESTAMP_TZ,
206
210 TIMESTAMP_TZ_EX = SQL_TIMESTAMP_TZ_EX,
211
215 TIME_TZ = SQL_TIME_TZ,
216
220 TIME_TZ_EX = SQL_TIME_TZ_EX,
221
225 INT128 = SQL_INT128,
226
230 DECFLOAT16 = SQL_DEC16,
231
235 DECFLOAT34 = SQL_DEC34,
236
240 BOOLEAN = SQL_BOOLEAN,
241 };
242
246 struct Descriptor final
247 {
252
257
261 int scale;
262
266 unsigned length;
267
271 unsigned offset;
272
276 unsigned nullOffset;
277
282 // FIXME: more things
283 };
284} // namespace fbcpp
285
286
287#endif // FBCPP_DESCRIPTOR_H
fb-cpp namespace.
Definition Attachment.h:42
DescriptorAdjustedType
Descriptor adjusted type.
Definition Descriptor.h:146
@ 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:40
@ 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:247
int scale
Decimal scale for numeric types; zero for non-numeric types.
Definition Descriptor.h:261
DescriptorAdjustedType adjustedType
Adjusted type after normalization for easier handling.
Definition Descriptor.h:256
unsigned nullOffset
Byte offset of the null indicator within the message buffer.
Definition Descriptor.h:276
bool isNullable
Indicates whether the column or parameter can contain null values.
Definition Descriptor.h:281
DescriptorOriginalType originalType
Original SQL type as reported by Firebird.
Definition Descriptor.h:251
unsigned offset
Byte offset of this field within the message buffer.
Definition Descriptor.h:271
unsigned length
Length in bytes of the column or parameter data.
Definition Descriptor.h:266