uPg input-output.
Namespace containing classes and functions for defining datatype input-output and specifying mapping between C++ and PostgreSQL types.
Namespaces | |
namespace | traits |
uPg input-output traits. | |
Typedefs | |
template<PredefinedOids TypeOid> | |
using | PredefinedOid = std::integral_constant<PredefinedOids, TypeOid> |
template<BufferCategory Category> | |
using | BufferCategoryConstant = std::integral_constant<BufferCategory, Category> |
using | TypeBufferCategory = std::unordered_map<Oid, BufferCategory> |
Enumerations | |
enum class | PredefinedOids { kInvalid = kInvalidOid , kBoolean = 16 , kBytea = 17 , kChar = 18 , kName = 19 , kInt8 = 20 , kInt2 = 21 , kInt2Vector = 22 , kInt4 = 23 , kRegproc = 24 , kText = 25 , kOid = 26 , kTid = 27 , kXid = 28 , kCid = 29 , kOidVector = 30 , kJson = 114 , kJsonArray = 199 , kXml = 142 , kPgNodeTree = 194 , kPgDdlCommand = 32 , kPoint = 600 , kLseg = 601 , kPath = 602 , kBox = 603 , kPolygon = 604 , kLine = 628 , kLineArray = 629 , kFloat4 = 700 , kFloat8 = 701 , kAbstime = 702 , kReltime = 703 , kTinterval = 704 , kUnknown = 705 , kCircle = 718 , kCircleArray = 719 , kCash = 790 , kMacaddr = 829 , kMacaddrArray = 1040 , kMacaddr8 = 774 , kMacaddr8Array = 775 , kInet = 869 , kInetArray = 1041 , kCidr = 650 , kCidrArray = 651 , kBooleanArray = 1000 , kByteaArray = 1001 , kCharArray = 1002 , kNameArray = 1003 , kInt2Array = 1005 , kInt4Array = 1007 , kTextArray = 1009 , kTidArray = 1010 , kXidArray = 1011 , kCidArray = 1012 , kBphcarArray = 1014 , kVarcharArray = 1015 , kInt8Array = 1016 , kPointArray = 1017 , kLsegArray = 1018 , kPathArray = 1019 , kBoxArray = 1020 , kFloat4Array = 1021 , kFloat8Array = 1022 , kPolygonArray = 1027 , kOidArray = 1028 , kAclItem = 1033 , kCstringArray = 1263 , kBpchar = 1042 , kVarchar = 1043 , kDate = 1082 , kTime = 1083 , kDateArray = 1182 , kTimeArray = 1183 , kTimestamp = 1114 , kTimestampArray = 1115 , kTimestamptz = 1184 , kTimestamptzArray = 1185 , kInterval = 1186 , kIntervalArray = 1187 , kNumericArray = 1231 , kTimetz = 1266 , kBit = 1560 , kBitArray = 1561 , kVarbit = 1562 , kVarbitArray = 1563 , kNumeric = 1700 , kRefcursor = 1790 , kRegprocedure = 2202 , kRegoper = 2203 , kRegoperator = 2204 , kRegclass = 2205 , kRegtype = 2206 , kRegrole = 4096 , kRegtypearray = 2211 , kUuid = 2950 , kUuidArray = 2951 , kLsn = 3220 , kLsnArray = 3221 , kTsvector = 3614 , kGtsvector = 3642 , kTsquery = 3615 , kRegconfig = 3734 , kRegdictionary = 3769 , kJsonb = 3802 , kJsonbArray = 3807 , kRecord = 2249 , kRecordArray = 2287 , kCstring = 2275 , kAny = 2276 , kAnyArray = 2277 , kVoid = 2278 , kTrigger = 2279 , kEvttrigger = 3838 , kLanguageHandler = 2280 , kInternal = 2281 , kOpaque = 2282 , kAnyElement = 2283 , kAnyNonArray = 2776 , kAnyEnum = 3500 , kFdwHandler = 3115 , kAnyRange = 3831 , kInt4Range = 3904 , kInt4RangeArray = 3905 , kNumRange = 3906 , kNumRangeArray = 3907 , kTimestampRange = 3908 , kTimestampRangeArray = 3909 , kTimestamptzRange = 3910 , kTimestamptzRangeArray = 3911 , kDateRange = 3912 , kDateRangeArray = 3913 , kInt8Range = 3926 , kInt8RangeArray = 3927 } |
enum class | BufferCategory { kKeepCategory = -1 , kNoParser = 0 , kVoid , kPlainBuffer , kArrayBuffer , kCompositeBuffer , kRangeBuffer } |
Functions | |
template<typename T > | |
constexpr bool | IsTypeMappedToSystemArray () |
template<typename Container > | |
detail::ContainerSplitter< Container > | SplitContainer (const Container &container, std::size_t chunk_elements) |
template<typename Container > | |
detail::ContainerByColumnsSplitter< Container > | SplitContainerByColumns (const Container &container, std::size_t chunk_elements) |
template<typename T > | |
void | ReadBuffer (const FieldBuffer &buffer, T &&value) |
Read a value from input buffer. | |
template<typename T > | |
void | ReadBuffer (const FieldBuffer &buffer, T &&value, const TypeBufferCategory &categories) |
template<typename T > | |
traits::IO< T >::FormatterType | BufferWriter (const T &value) |
template<typename T , typename Buffer > | |
void | WriteBuffer (const UserTypes &types, Buffer &buffer, const T &value) |
template<typename T > | |
std::size_t | ReadRawBinary (FieldBuffer buffer, T &value, const TypeBufferCategory &categories) |
template<typename T , typename Buffer > | |
void | WriteRawBinary (const UserTypes &types, Buffer &buffer, const T &value, Oid replace_oid=kInvalidOid) |
const std::string & | ToString (BufferCategory) |
BufferCategory | GetTypeBufferCategory (const TypeBufferCategory &, Oid) |
bool | HasParser (PredefinedOids) |
Find out if a parser for a predefined Postgres type was registered. | |
bool | MappedToSameType (PredefinedOids, PredefinedOids) |
Find out if predefined Postgres types are mapped to the same cpp type. | |
PredefinedOids | GetArrayElementOid (PredefinedOids) |
Get array element oid for a predefined type. | |
BufferCategory | GetBufferCategory (PredefinedOids) |
Get the buffer category for a predefined type. | |
bool | HasParser (DBTypeName) |
template<typename T > | |
constexpr bool | IsTypeMappedToSystem () |
void | LogRegisteredTypes () |
Variables | |
constexpr int | kPgBinaryDataFormat = 1 |
constexpr Integer | kPgNullBufferSize = -1 |
Fields that are null are denoted by specifying their length == -1. | |
using storages::postgres::io::BufferCategoryConstant = std::integral_constant<BufferCategory, Category> |
Definition at line 38 of file traits.hpp.
using storages::postgres::io::PredefinedOid = std::integral_constant<PredefinedOids, TypeOid> |
Definition at line 309 of file pg_types.hpp.
using storages::postgres::io::TypeBufferCategory = std::unordered_map<Oid, BufferCategory> |
Definition at line 40 of file traits.hpp.
|
strong |
Category of buffer contents.
Applied to binary parsers and deduced from field's data type.
Definition at line 23 of file traits.hpp.
|
strong |
Oids are predefined for postgres fundamental types Constants can be found here https://github.com/postgres/postgres/blob/master/src/include/catalog/pg_type.dat Oid values can also be retrieved from PostgreSQL instance by running query
Definition at line 171 of file pg_types.hpp.
traits::IO< T >::FormatterType storages::postgres::io::BufferWriter | ( | const T & | value | ) |
Definition at line 112 of file buffer_io.hpp.
|
constexpr |
Definition at line 121 of file type_mapping.hpp.
|
constexpr |
Definition at line 420 of file array_types.hpp.
void storages::postgres::io::ReadBuffer | ( | const FieldBuffer & | buffer, |
T && | value ) |
Read a value from input buffer.
Definition at line 69 of file buffer_io.hpp.
void storages::postgres::io::ReadBuffer | ( | const FieldBuffer & | buffer, |
T && | value, | ||
const TypeBufferCategory & | categories ) |
Definition at line 90 of file buffer_io.hpp.
std::size_t storages::postgres::io::ReadRawBinary | ( | FieldBuffer | buffer, |
T & | value, | ||
const TypeBufferCategory & | categories ) |
Definition at line 64 of file field_buffer.hpp.
detail::ContainerSplitter< Container > storages::postgres::io::SplitContainer | ( | const Container & | container, |
std::size_t | chunk_elements ) |
Definition at line 637 of file array_types.hpp.
detail::ContainerByColumnsSplitter< Container > storages::postgres::io::SplitContainerByColumns | ( | const Container & | container, |
std::size_t | chunk_elements ) |
Definition at line 643 of file array_types.hpp.
void storages::postgres::io::WriteBuffer | ( | const UserTypes & | types, |
Buffer & | buffer, | ||
const T & | value ) |
Definition at line 121 of file buffer_io.hpp.
void storages::postgres::io::WriteRawBinary | ( | const UserTypes & | types, |
Buffer & | buffer, | ||
const T & | value, | ||
Oid | replace_oid = kInvalidOid ) |
Definition at line 83 of file field_buffer.hpp.
|
inlineconstexpr |
Definition at line 49 of file traits.hpp.
|
inlineconstexpr |
Fields that are null are denoted by specifying their length == -1.
Definition at line 52 of file traits.hpp.