Cppgres
Build Postgres extensions in C++
Loading...
Searching...
No Matches
cppgres::tuple_descriptor Struct Reference

Tuple descriptor operator. More...

#include <record.hpp>

Public Member Functions

 tuple_descriptor (int nattrs, memory_context ctx=memory_context())
 Create a tuple descriptor for a given number of attributes.
 
 tuple_descriptor (TupleDesc tupdesc, bool blessed=true)
 Create a tuple descriptor for a given TupleDesc
 
 tuple_descriptor (tuple_descriptor &other)
 Copy constructor.
 
 tuple_descriptor (tuple_descriptor &&other)
 Move constructor.
 
tuple_descriptoroperator= (const tuple_descriptor &other)
 Copy assignment.
 
int attributes () const
 Number of attributes.
 
::FormData_pg_attribute & operator[] (int n) const
 Get a reference to Form_pg_attribute
 
type get_type (int n) const
 
void set_type (int n, const type &type)
 Set attribute type.
 
std::string_view get_name (int n)
 
void set_name (int n, const name &name)
 Set attribute name.
 
 operator TupleDesc ()
 returns a pointer to TupleDesc
 
bool equal_types (const tuple_descriptor &other)
 Determines whether two tuple descriptors have equal row types.
 
bool operator== (const tuple_descriptor &other)
 Compare two TupleDesc structures for logical equality.
 
bool is_blessed () const
 Returns true if the tuple descriptor is blessed.
 
 operator TupleDesc () const
 

Detailed Description

Tuple descriptor operator.

Allows to create new or manipulate existing tuple descriptors

Constructor & Destructor Documentation

◆ tuple_descriptor() [1/3]

cppgres::tuple_descriptor::tuple_descriptor ( int  nattrs,
memory_context  ctx = memory_context() 
)
inline

Create a tuple descriptor for a given number of attributes.

Parameters
nattrsnumber of attributes
ctxmemory context, current transaction context by default

◆ tuple_descriptor() [2/3]

cppgres::tuple_descriptor::tuple_descriptor ( TupleDesc  tupdesc,
bool  blessed = true 
)
inline

Create a tuple descriptor for a given TupleDesc

Parameters
tupdescexisting attribute
blessedtrue if already blessed (default)

◆ tuple_descriptor() [3/3]

cppgres::tuple_descriptor::tuple_descriptor ( tuple_descriptor other)
inline

Copy constructor.

Creates a copy instance of the tuple descriptor in the current memory contet

Member Function Documentation

◆ equal_types()

bool cppgres::tuple_descriptor::equal_types ( const tuple_descriptor other)
inline

Determines whether two tuple descriptors have equal row types.

This is used to check whether two record types are compatible, whether function return row types are the same, and other similar situations.

◆ operator TupleDesc()

cppgres::tuple_descriptor::operator TupleDesc ( )
inline

returns a pointer to TupleDesc

At this point, it'll be prepared and blessed.

◆ operator=()

tuple_descriptor & cppgres::tuple_descriptor::operator= ( const tuple_descriptor other)
inline

Copy assignment.

Creates a copy instance of the tuple descriptor in the current memory contet

◆ operator==()

bool cppgres::tuple_descriptor::operator== ( const tuple_descriptor other)
inline

Compare two TupleDesc structures for logical equality.

Note
This includes checking attribute names.

◆ operator[]()

::FormData_pg_attribute & cppgres::tuple_descriptor::operator[] ( int  n) const
inline

Get a reference to Form_pg_attribute

Exceptions
std::out_of_rangewhen attribute index is out of range

◆ set_name()

void cppgres::tuple_descriptor::set_name ( int  n,
const name name 
)
inline

Set attribute name.

Parameters
nZero-based attribute index
namenew attribute name
Exceptions
std::out_of_rangewhen attribute index is out of range

◆ set_type()

void cppgres::tuple_descriptor::set_type ( int  n,
const type type 
)
inline

Set attribute type.

Parameters
nZero-based attribute index
typenew attribute type
Exceptions
std::out_of_rangewhen attribute index is out of range

The documentation for this struct was generated from the following file: