kea-custom-hooks
FeM custom hooks libraries for Kea DHCP
pqxx_compat.hpp
Go to the documentation of this file.
1
8#pragma once
9#include "kch_config.h"
10
11#if KCH_PQXX_MAJOR_VERSION < 7
12#include <cstdint>
13#include <pqxx/binarystring>
14#include <string_view>
15#include <vector>
16#else
17#include "util/bytea_utils.hpp"
18#include <pqxx/zview>
19#endif
20
21#if KCH_PQXX_MAJOR_VERSION < 7
22using bytestr_t = pqxx::binarystring;
23using zview_t = std::string_view;
24#define STMT_NAME_T const std::string
25#else
27using zview_t = pqxx::zview;
28#define STMT_NAME_T constexpr zview_t
29#endif
30
31#if KCH_PQXX_MAJOR_VERSION < 7
32namespace util
33{
41std::vector<std::uint8_t> to_bytea(const pqxx::binarystring& bstr);
48pqxx::binarystring to_binstr(const std::vector<std::uint8_t>& barr);
49} // namespace util
50#endif
Byte array conversion utilities.
std::basic_string< std::byte > byte_string
Definition: bytea_utils.hpp:17
std::vector< uint8_t > to_bytea(byte_string_view str)
Convert a byte string to a byte array.
Definition: bytea_utils.cpp:18
pqxx::binarystring to_binstr(const std::vector< std::uint8_t > &bytea)
Convert a byte array to a binary string.
Definition: pqxx_compat.cpp:8
std::string_view zview_t
Definition: pqxx_compat.hpp:23
pqxx::binarystring bytestr_t
Definition: pqxx_compat.hpp:22