MySQL  8.0.16
Source Code Documentation
rpl_utility.cc File Reference
#include "sql/rpl_utility.h"
#include <string.h>
#include <iterator>
#include <new>
#include <utility>
#include "binary_log_funcs.h"
#include "lex_string.h"
#include "my_byteorder.h"
#include "my_dbug.h"
#include "my_loglevel.h"
#include "my_sys.h"
#include "mysql/components/services/log_builtins.h"
#include "mysql/service_mysql_alloc.h"
#include "sql/thr_malloc.h"
#include <algorithm>
#include "binlog_event.h"
#include "m_ctype.h"
#include "m_string.h"
#include "my_base.h"
#include "my_bitmap.h"
#include "mysql/psi/psi_memory.h"
#include "mysqld_error.h"
#include "sql/create_field.h"
#include "sql/dd/dd.h"
#include "sql/dd/dictionary.h"
#include "sql/derror.h"
#include "sql/field.h"
#include "sql/log.h"
#include "sql/log_event.h"
#include "sql/my_decimal.h"
#include "sql/mysqld.h"
#include "sql/psi_memory_key.h"
#include "sql/rpl_rli.h"
#include "sql/rpl_slave.h"
#include "sql/sql_class.h"
#include "sql/sql_const.h"
#include "sql/sql_list.h"
#include "sql/sql_plugin_ref.h"
#include "sql/sql_tmp_table.h"
#include "sql_show.h"
#include "sql_string.h"
#include "template_utils.h"
#include "typelib.h"

Macros

#define HASH_ROWS_POS_SEARCH_INVALID   -1
 

Functions

static int compare (size_t a, size_t b)
 Function to compare two size_t integers for their relative order. More...
 
static int compare_lengths (Field *field, enum_field_types source_type, uint16 metadata)
 
static bool is_conversion_ok (int order)
 Check the order variable and print errors if the order is not acceptable according to the current settings. More...
 
bool timestamp_cross_check (enum_field_types type1, enum_field_types type2)
 Check if the types are criss cross means type1 is MYSQL_TYPE_TIMESTAMP and type2 as MYSQL_TYPE_TIMESTAMP2 or vice versa. More...
 
bool datetime_cross_check (enum_field_types type1, enum_field_types type2)
 Check if the types are criss cross means type1 is MYSQL_TYPE_DATETIME and type2 as MYSQL_TYPE_DATETIME or vice versa. More...
 
bool time_cross_check (enum_field_types type1, enum_field_types type2)
 Check if the types are criss cross means type1 is MYSQL_TYPE_TIME and type2 as MYSQL_TYPE_TIME2 or vice versa. More...
 
static bool can_convert_field_to (Field *field, enum_field_types source_type, uint16 metadata, Relay_log_info *rli, uint16 mflags, int *order_var)
 Can a type potentially be converted to another type? More...
 

Variables

PSI_memory_key key_memory_table_def_memory
 

Macro Definition Documentation

◆ HASH_ROWS_POS_SEARCH_INVALID

#define HASH_ROWS_POS_SEARCH_INVALID   -1

Function Documentation

◆ can_convert_field_to()

static bool can_convert_field_to ( Field field,
enum_field_types  source_type,
uint16  metadata,
Relay_log_info rli,
uint16  mflags,
int *  order_var 
)
static

Can a type potentially be converted to another type?

This function check if the types are convertible and what conversion is required.

If conversion is not possible, and error is printed.

If conversion is possible:

  • *order will be set to -1 if source type is smaller than target type and a non-lossy conversion can be required. This includes the case where the field types are different but types could actually be converted in either direction.
  • *order will be set to 0 if no conversion is required.
  • *order will be set to 1 if the source type is strictly larger than the target type and that conversion is potentially lossy.
Parameters
[in]fieldTarget field
[in]source_typeSource field type
[in]metadataSource field metadata
[in]rliRelay log info (for error reporting)
[in]mflagsFlags from the table map event
[out]order_varOrder between source field and target field
Returns
true if conversion is possible according to the current settings, false if conversion is not possible according to the current setting.

◆ compare()

static int compare ( size_t  a,
size_t  b 
)
static

Function to compare two size_t integers for their relative order.

Used below.

◆ compare_lengths()

static int compare_lengths ( Field field,
enum_field_types  source_type,
uint16  metadata 
)
static

◆ datetime_cross_check()

bool datetime_cross_check ( enum_field_types  type1,
enum_field_types  type2 
)
inline

Check if the types are criss cross means type1 is MYSQL_TYPE_DATETIME and type2 as MYSQL_TYPE_DATETIME or vice versa.

◆ is_conversion_ok()

static bool is_conversion_ok ( int  order)
static

Check the order variable and print errors if the order is not acceptable according to the current settings.

Parameters
orderThe computed order of the conversion needed.

◆ time_cross_check()

bool time_cross_check ( enum_field_types  type1,
enum_field_types  type2 
)
inline

Check if the types are criss cross means type1 is MYSQL_TYPE_TIME and type2 as MYSQL_TYPE_TIME2 or vice versa.

◆ timestamp_cross_check()

bool timestamp_cross_check ( enum_field_types  type1,
enum_field_types  type2 
)
inline

Check if the types are criss cross means type1 is MYSQL_TYPE_TIMESTAMP and type2 as MYSQL_TYPE_TIMESTAMP2 or vice versa.

Variable Documentation

◆ key_memory_table_def_memory

PSI_memory_key key_memory_table_def_memory