MySQL 8.4.2
Source Code Documentation
ddl::Sequence Struct Reference

Generate the next autoinc based on a snapshot of the session auto_increment_increment and auto_increment_offset variables. More...

#include <ddl0ddl.h>

Public Member Functions

 Sequence (THD *thd, ulonglong start_value, ulonglong max_value) noexcept
 Constructor. More...
 
 ~Sequence ()=default
 Destructor. More...
 
ulonglong operator++ (int) noexcept
 Postfix increment. More...
 
bool eof () const noexcept
 Check if the autoinc "sequence" is exhausted. More...
 
ddl::Sequenceoperator= (const ddl::Sequence &rhs) noexcept
 Assignment operator to copy the sequence values. More...
 
ulonglong last () const noexcept
 

Public Attributes

const ulonglong m_max_value {}
 Maximum column value if adding an AUTOINC column else 0. More...
 
ulong m_increment {}
 Value of auto_increment_increment. More...
 
ulong m_offset {}
 Value of auto_increment_offset. More...
 
ulonglong m_next_value {}
 Next value in the sequence. More...
 
bool m_eof {}
 true if no more values left in the sequence More...
 

Detailed Description

Generate the next autoinc based on a snapshot of the session auto_increment_increment and auto_increment_offset variables.

Assignment operator would be used during the inplace_alter_table() phase only

Constructor & Destructor Documentation

◆ Sequence()

ddl::Sequence::Sequence ( THD thd,
ulonglong  start_value,
ulonglong  max_value 
)
noexcept

Constructor.

Parameters
[in,out]thdThe session
[in]start_valueThe lower bound
[in]max_valueThe upper bound (inclusive)

◆ ~Sequence()

ddl::Sequence::~Sequence ( )
default

Destructor.

Member Function Documentation

◆ eof()

bool ddl::Sequence::eof ( ) const
inlinenoexcept

Check if the autoinc "sequence" is exhausted.

Returns
true if the sequence is exhausted

◆ last()

ulonglong ddl::Sequence::last ( ) const
inlinenoexcept
Returns
the next value in the sequence

◆ operator++()

ulonglong ddl::Sequence::operator++ ( int  )
noexcept

Postfix increment.

Returns
the value to insert

◆ operator=()

ddl::Sequence & ddl::Sequence::operator= ( const ddl::Sequence rhs)
inlinenoexcept

Assignment operator to copy the sequence values.

Parameters
[in]rhsSequence to copy from

Member Data Documentation

◆ m_eof

bool ddl::Sequence::m_eof {}

true if no more values left in the sequence

◆ m_increment

ulong ddl::Sequence::m_increment {}

Value of auto_increment_increment.

◆ m_max_value

const ulonglong ddl::Sequence::m_max_value {}

Maximum column value if adding an AUTOINC column else 0.

Once we reach the end of the sequence it will be set to ~0.

◆ m_next_value

ulonglong ddl::Sequence::m_next_value {}

Next value in the sequence.

◆ m_offset

ulong ddl::Sequence::m_offset {}

Value of auto_increment_offset.


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