25#ifndef FBCPP_REQUEST_MESSAGE_FORMAT_H
26#define FBCPP_REQUEST_MESSAGE_FORMAT_H
29#include "fb-cpp-export.h"
32#include "../Descriptor.h"
33#include "../Exception.h"
39#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
40#include <boost/multiprecision/cpp_int.hpp>
69 return addField(DescriptorAdjustedType::BOOLEAN, 1u, 1u, 0, 0, 0, isNullable);
77 return addField(DescriptorAdjustedType::INT16, 2u, 2u, 0, 0, 0, isNullable);
85 return addField(DescriptorAdjustedType::INT16, 2u, 2u, scale, 0, 0, isNullable);
93 return addField(DescriptorAdjustedType::INT32, 4u, 4u, 0, 0, 0, isNullable);
101 return addField(DescriptorAdjustedType::INT32, 4u, 4u, scale, 0, 0, isNullable);
109 return addField(DescriptorAdjustedType::INT64, 8u, 8u, 0, 0, 0, isNullable);
117 return addField(DescriptorAdjustedType::INT64, 8u, 8u, scale, 0, 0, isNullable);
125 return addField(DescriptorAdjustedType::INT128, 16u, 8u, scale, 0, 0, isNullable);
128#if FB_CPP_USE_BOOST_MULTIPRECISION != 0
134 return addField(DescriptorAdjustedType::INT128, 16u, 8u, scale, 0, 0, isNullable);
143 return addField(DescriptorAdjustedType::FLOAT, 4u, 4u, 0, 0, 0, isNullable);
151 return addField(DescriptorAdjustedType::DOUBLE, 8u, 8u, 0, 0, 0, isNullable);
159 return addField(DescriptorAdjustedType::DECFLOAT16, 8u, 8u, 0, 0, 0, isNullable);
167 return addField(DescriptorAdjustedType::DECFLOAT34, 16u, 8u, 0, 0, 0, isNullable);
175 return addField(DescriptorAdjustedType::DATE, 4u, 4u, 0, 0, 0, isNullable);
183 return addField(DescriptorAdjustedType::TIME, 4u, 4u, 0, 0, 0, isNullable);
191 return addField(DescriptorAdjustedType::TIMESTAMP, 8u, 4u, 0, 0, 0, isNullable);
199 return addField(DescriptorAdjustedType::TIME_TZ, 6u, 4u, 0, 0, 0, isNullable);
207 return addField(DescriptorAdjustedType::TIMESTAMP_TZ, 10u, 4u, 0, 0, 0, isNullable);
215 return addField(DescriptorAdjustedType::BLOB, 8u, 4u, 0, 0, 0, isNullable);
224 if (length == 0u || length > 65535u -
sizeof(std::uint16_t))
227 return addField(DescriptorAdjustedType::STRING, length +
sizeof(std::uint16_t),
sizeof(std::uint16_t), 0,
228 charSetId.value_or(0u), 0, isNullable);
237 return static_cast<unsigned>(descriptors.size());
263 if (index >= blrFieldIndexes.size())
264 throw std::out_of_range(
"index out of range");
266 return blrFieldIndexes[index];
273 std::vector<std::byte> buildBlrMessageClause(
unsigned messageNumber)
const;
277 int scale,
unsigned charSetId,
int subType,
bool isNullable);
279 static void appendByte(std::vector<std::byte>& blr, std::uint8_t value)
281 blr.push_back(
static_cast<std::byte
>(value));
284 static void appendWord(std::vector<std::byte>& blr, std::uint16_t value)
286 blr.push_back(
static_cast<std::byte
>(value & 0xffu));
287 blr.push_back(
static_cast<std::byte
>((value >> 8) & 0xffu));
290 void appendBlrDataType(std::vector<std::byte>& blr,
const Descriptor& descriptor)
const;
293 std::vector<Descriptor> descriptors;
294 std::vector<unsigned> blrFieldIndexes;
295 unsigned nullableCount = 0;
Base exception class for all fb-cpp exceptions.
fb-cpp request namespace.
DescriptorAdjustedType
Descriptor adjusted type.