MySQL  8.0.17
Source Code Documentation
rules_table_service::Cursor Class Reference

Writable cursor that allows reading and updating of rows in a persistent table. More...

#include <service_rules_table.h>

Public Types

typedef int column_id
 

Public Member Functions

 Cursor (THD *thd)
 Creates a cursor to an already-opened table. More...
 
 Cursor ()
 Creates a past-the-end cursor. More...
 
 Cursor (const Cursor &)=default
 
column_id pattern_column () const
 
column_id pattern_database_column () const
 
column_id replacement_column () const
 
column_id enabled_column () const
 
column_id message_column () const
 
column_id pattern_digest_column () const
 
column_id normalized_pattern_column () const
 
bool table_is_malformed ()
 True if the table does not contain columns named 'pattern', 'replacement', 'enabled' and 'message'. More...
 
const char * fetch_string (int fieldno)
 Fetches the value of the column with the given number as a C string. More...
 
bool operator== (const Cursor &other)
 Equality operator. More...
 
bool operator!= (const Cursor &other)
 Inequality operator. More...
 
Cursoroperator++ ()
 Advances this Cursor. More...
 
void make_writeable ()
 Prepares the write buffer for updating the current row. More...
 
void set (int colno, const char *str, size_t length)
 Sets the value of column colno to a string value. More...
 
int write ()
 Writes the row in the write buffer to the table at the current row. More...
 
bool had_serious_read_error () const
 True if there was an unexpected error while reading, e.g. other than EOF. More...
 
 ~Cursor ()
 Closes the table scan if initiated and commits the transaction. More...
 

Static Public Attributes

static const column_id ILLEGAL_COLUMN_ID = -1
 

Private Member Functions

int field_index (const char *field_name)
 
int read ()
 

Private Attributes

int m_pattern_column
 
int m_pattern_database_column
 
int m_replacement_column
 
int m_enabled_column
 
int m_message_column
 
int m_pattern_digest_column
 
int m_normalized_pattern_column
 
THDm_thd
 
TABLE_LISTm_table_list
 
bool m_is_finished
 
bool m_table_is_malformed
 
int m_last_read_status
 

Detailed Description

Writable cursor that allows reading and updating of rows in a persistent table.

Member Typedef Documentation

◆ column_id

Constructor & Destructor Documentation

◆ Cursor() [1/3]

rules_table_service::Cursor::Cursor ( THD thd)
explicit

Creates a cursor to an already-opened table.

The constructor is kept explicit because of implicit conversions from void*.

◆ Cursor() [2/3]

rules_table_service::Cursor::Cursor ( )
inline

Creates a past-the-end cursor.

◆ Cursor() [3/3]

rules_table_service::Cursor::Cursor ( const Cursor )
default

◆ ~Cursor()

rules_table_service::Cursor::~Cursor ( )

Closes the table scan if initiated and commits the transaction.

Member Function Documentation

◆ enabled_column()

column_id rules_table_service::Cursor::enabled_column ( ) const
inline

◆ fetch_string()

const char * rules_table_service::Cursor::fetch_string ( int  fieldno)

Fetches the value of the column with the given number as a C string.

This interface is meant for crossing dynamic library boundaries, hence the use of C-style const char*. The function casts a column value to a C string and returns a copy, allocated in the callee's DL. The pointer must be freed using free_string().

Parameters
fieldnoOne of PATTERN_COLUMN, REPLACEMENT_COLUMN, ENABLED_COLUMN or MESSAGE_COLUMN.

◆ field_index()

int rules_table_service::Cursor::field_index ( const char *  field_name)
private

◆ had_serious_read_error()

bool rules_table_service::Cursor::had_serious_read_error ( ) const

True if there was an unexpected error while reading, e.g. other than EOF.

◆ make_writeable()

void rules_table_service::Cursor::make_writeable ( )

Prepares the write buffer for updating the current row.

◆ message_column()

column_id rules_table_service::Cursor::message_column ( ) const
inline

◆ normalized_pattern_column()

column_id rules_table_service::Cursor::normalized_pattern_column ( ) const
inline

◆ operator!=()

bool rules_table_service::Cursor::operator!= ( const Cursor other)
inline

Inequality operator.

All cursors are considered different except past-the-end cursors.

◆ operator++()

Cursor& rules_table_service::Cursor::operator++ ( )
inline

Advances this Cursor.

Read errors are kept, and had_serious_read_error() will tell if there was an unexpected error (e.g. not EOF) while reading.

◆ operator==()

bool rules_table_service::Cursor::operator== ( const Cursor other)
inline

Equality operator.

The only cursors that are equal are past-the-end cursors.

◆ pattern_column()

column_id rules_table_service::Cursor::pattern_column ( ) const
inline

◆ pattern_database_column()

column_id rules_table_service::Cursor::pattern_database_column ( ) const
inline

◆ pattern_digest_column()

column_id rules_table_service::Cursor::pattern_digest_column ( ) const
inline

◆ read()

int rules_table_service::Cursor::read ( )
private

◆ replacement_column()

column_id rules_table_service::Cursor::replacement_column ( ) const
inline

◆ set()

void rules_table_service::Cursor::set ( int  colno,
const char *  str,
size_t  length 
)

Sets the value of column colno to a string value.

Parameters
colnoThe column number.
strThe string.
lengthThe string's length.

◆ table_is_malformed()

bool rules_table_service::Cursor::table_is_malformed ( )
inline

True if the table does not contain columns named 'pattern', 'replacement', 'enabled' and 'message'.

In this case the cursor is equal to any past-the-end Cursor.

◆ write()

int rules_table_service::Cursor::write ( )

Writes the row in the write buffer to the table at the current row.

Member Data Documentation

◆ ILLEGAL_COLUMN_ID

const column_id rules_table_service::Cursor::ILLEGAL_COLUMN_ID = -1
static

◆ m_enabled_column

int rules_table_service::Cursor::m_enabled_column
private

◆ m_is_finished

bool rules_table_service::Cursor::m_is_finished
private

◆ m_last_read_status

int rules_table_service::Cursor::m_last_read_status
private

◆ m_message_column

int rules_table_service::Cursor::m_message_column
private

◆ m_normalized_pattern_column

int rules_table_service::Cursor::m_normalized_pattern_column
private

◆ m_pattern_column

int rules_table_service::Cursor::m_pattern_column
private

◆ m_pattern_database_column

int rules_table_service::Cursor::m_pattern_database_column
private

◆ m_pattern_digest_column

int rules_table_service::Cursor::m_pattern_digest_column
private

◆ m_replacement_column

int rules_table_service::Cursor::m_replacement_column
private

◆ m_table_is_malformed

bool rules_table_service::Cursor::m_table_is_malformed
private

◆ m_table_list

TABLE_LIST* rules_table_service::Cursor::m_table_list
private

◆ m_thd

THD* rules_table_service::Cursor::m_thd
private

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