MySQL 8.4.3
Source Code Documentation
xid_t Struct Reference

struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991. More...

#include <xa.h>

Public Member Functions

 xid_t ()
 
long get_format_id () const
 
void set_format_id (long v)
 
long get_gtrid_length () const
 
void set_gtrid_length (long v)
 
long get_bqual_length () const
 
void set_bqual_length (long v)
 
const char * get_data () const
 
void set_data (const void *v, long l)
 
void reset ()
 
void set (long f, const char *g, long gl, const char *b, long bl)
 
my_xid get_my_xid () const
 
ucharkey ()
 
const ucharkey () const
 
uint key_length () const
 
char * serialize (char *buf) const
 The method fills XID in a buffer in format of GTRID,BQUAL,FORMATID where GTRID, BQUAL are represented as hex strings. More...
 
char * xid_to_str (char *buf) const
 Get printable XID value. More...
 
bool eq (const xid_t *xid) const
 Check if equal to another xid. More...
 
bool is_null () const
 
xid_toperator= (mysql::binlog::event::XA_prepare_event::MY_XID const &rhs)
 Instantiates this object with the contents of the parameter of type XA_prepare_event::MY_XID. More...
 
bool operator== (struct xid_t const &rhs) const
 Compares for equality two instances of xid_t. More...
 
bool operator!= (struct xid_t const &rhs) const
 Compares for inequality two instances of xid_t. More...
 
bool operator< (struct xid_t const &rhs) const
 Compares for lower-than-inequality two instances of xid_t. More...
 

Static Public Attributes

static const uint ser_buf_size = 8 + 2 * XIDDATASIZE + 4 * sizeof(long) + 1
 

Private Member Functions

void set (const xid_t *xid)
 
void set (my_xid xid)
 
void null ()
 

Private Attributes

long formatID
 -1 means that the XID is null More...
 
long gtrid_length
 value from 1 through 64 More...
 
long bqual_length
 value from 1 through 64 More...
 
char data [XIDDATASIZE]
 distributed trx identifier. More...
 

Friends

class XID_STATE
 
std::ostream & operator<< (std::ostream &out, struct xid_t const &in)
 Writes the parameter's in string representation to the out stream parameter object. More...
 

Detailed Description

struct xid_t is binary compatible with the XID structure as in the X/Open CAE Specification, Distributed Transaction Processing: The XA Specification, X/Open Company Ltd., 1991.

http://www.opengroup.org/bookstore/catalog/c193.htm

See also
MYSQL_XID in mysql/plugin.h

Constructor & Destructor Documentation

◆ xid_t()

xid_t::xid_t ( )
inline

Member Function Documentation

◆ eq()

bool xid_t::eq ( const xid_t xid) const
inline

Check if equal to another xid.

Parameters
[in]xidthe id of another X/Open XA transaction
Returns
true iff formats, gtrid_length, bqual_length and the content of gtrid_length+bqual_length bytes is exactly the same

◆ get_bqual_length()

long xid_t::get_bqual_length ( ) const
inline

◆ get_data()

const char * xid_t::get_data ( ) const
inline

◆ get_format_id()

long xid_t::get_format_id ( ) const
inline

◆ get_gtrid_length()

long xid_t::get_gtrid_length ( ) const
inline

◆ get_my_xid()

my_xid xid_t::get_my_xid ( ) const

◆ is_null()

bool xid_t::is_null ( ) const
inline

◆ key() [1/2]

uchar * xid_t::key ( )
inline

◆ key() [2/2]

const uchar * xid_t::key ( ) const
inline

◆ key_length()

uint xid_t::key_length ( ) const
inline

◆ null()

void xid_t::null ( )
inlineprivate

◆ operator!=()

bool xid_t::operator!= ( struct xid_t const &  rhs) const

Compares for inequality two instances of xid_t.

Parameters
rhsThe instance to compare this object with.
Returns
true if both instance are different, false otherwise.

◆ operator<()

bool xid_t::operator< ( struct xid_t const &  rhs) const

Compares for lower-than-inequality two instances of xid_t.

The lesser-than relation between two given XIDs, x1 and x2, is as follows:

x1 < x2 if any of the following is true:

  • x1[FORMAT_ID] < x2[FORMAT_ID]
  • x1[strlen(GTRID)] < x2[strlen(GTRID)]
  • x1[strlen(BQUAL)] < x2[strlen(BQUAL)]
  • std::strncmp(x1[DATA], x2[DATA]) < 0
Parameters
rhsThe instance to compare this object with.
Returns
true if this instance is lesser than the parameter, false otherwise.

◆ operator=()

xid_t & xid_t::operator= ( mysql::binlog::event::XA_prepare_event::MY_XID const &  rhs)

Instantiates this object with the contents of the parameter of type XA_prepare_event::MY_XID.

The XA_prepare_event::MY_XID is a mirror class of xid_t so the instantiation is a direct instantiation relation of each class member variables.

Parameters
rhsThe XA_prepare_event::MY_XID to instantiate from
Returns
This object reference.

◆ operator==()

bool xid_t::operator== ( struct xid_t const &  rhs) const

Compares for equality two instances of xid_t.

Parameters
rhsThe instance to compare this object with.
Returns
true if both instance are equal, false otherwise.

◆ reset()

void xid_t::reset ( void  )
inline

◆ serialize()

char * xid_t::serialize ( char *  buf) const
inline

The method fills XID in a buffer in format of GTRID,BQUAL,FORMATID where GTRID, BQUAL are represented as hex strings.

Parameters
bufa pointer to buffer
Returns
the value of the first argument

◆ set() [1/3]

void xid_t::set ( const xid_t xid)
inlineprivate

◆ set() [2/3]

void xid_t::set ( long  f,
const char *  g,
long  gl,
const char *  b,
long  bl 
)
inline

◆ set() [3/3]

void xid_t::set ( my_xid  xid)
private

◆ set_bqual_length()

void xid_t::set_bqual_length ( long  v)
inline

◆ set_data()

void xid_t::set_data ( const void *  v,
long  l 
)
inline

◆ set_format_id()

void xid_t::set_format_id ( long  v)
inline

◆ set_gtrid_length()

void xid_t::set_gtrid_length ( long  v)
inline

◆ xid_to_str()

char * XID::xid_to_str ( char *  buf) const

Get printable XID value.

Parameters
bufpointer to the buffer where printable XID value has to be stored
Returns
pointer to the buffer passed in the first argument

Friends And Related Function Documentation

◆ operator<<

std::ostream & operator<< ( std::ostream &  out,
struct xid_t const &  in 
)
friend

Writes the parameter's in string representation to the out stream parameter object.

Parameters
outThe stream to write the XID representation to
inThe XID for which the string representation should be written
Returns
The reference for the stream passed on as parameter.

◆ XID_STATE

friend class XID_STATE
friend

Member Data Documentation

◆ bqual_length

long xid_t::bqual_length
private

value from 1 through 64

◆ data

char xid_t::data[XIDDATASIZE]
private

distributed trx identifier.

not \0-terminated.

◆ formatID

long xid_t::formatID
private

-1 means that the XID is null

◆ gtrid_length

long xid_t::gtrid_length
private

value from 1 through 64

◆ ser_buf_size

const uint xid_t::ser_buf_size = 8 + 2 * XIDDATASIZE + 4 * sizeof(long) + 1
static

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