MySQL 8.0.40
Source Code Documentation
binary_log_funcs.h File Reference
#include <stdint.h>
#include "field_types.h"

Go to the source code of this file.

Functions

unsigned int my_time_binary_length (unsigned int dec)
 Calculate binary size of packed numeric time representation. More...
 
unsigned int my_datetime_binary_length (unsigned int dec)
 Calculate binary size of packed datetime representation. More...
 
unsigned int my_timestamp_binary_length (unsigned int dec)
 Calculate on-disk size of a timestamp value. More...
 
uint32_t calc_field_size (unsigned char col, const unsigned char *master_data, unsigned int metadata)
 This helper function calculates the size in bytes of a particular field in a row type event as defined by the field_ptr and metadata_ptr arguments. More...
 
unsigned int max_display_length_for_field (enum_field_types sql_type, unsigned int metadata)
 Compute the maximum display length of a field. More...
 
int decimal_binary_size (int precision, int scale)
 Returns the size of array to hold a binary representation of a decimal. More...
 

Function Documentation

◆ calc_field_size()

uint32_t calc_field_size ( unsigned char  col,
const unsigned char *  master_data,
unsigned int  metadata 
)

This helper function calculates the size in bytes of a particular field in a row type event as defined by the field_ptr and metadata_ptr arguments.

Parameters
colField type code
master_dataThe field data
metadataThe field metadata
Note
We need the actual field data because the string field size is not part of the meta data. :(
Returns
The size in bytes of a particular field

◆ decimal_binary_size()

int decimal_binary_size ( int  precision,
int  scale 
)

Returns the size of array to hold a binary representation of a decimal.

Parameters
precisionnumber of significant digits in a particular radix R where R is either 2 or 10.
scaleto what position to round.
Returns
size in bytes

◆ max_display_length_for_field()

unsigned int max_display_length_for_field ( enum_field_types  sql_type,
unsigned int  metadata 
)

Compute the maximum display length of a field.

Parameters
sql_typeType of the field
metadataThe metadata from the master for the field.
Returns
Maximum length of the field in bytes.

◆ my_datetime_binary_length()

unsigned int my_datetime_binary_length ( unsigned int  dec)

Calculate binary size of packed datetime representation.

Parameters
decPrecision.

The same formula is used to find the binary size of the packed numeric time in libbinlogevents/src/value.cpp calc_field_size(). If any modification is done here the same needs to be done in the aforementioned method in libbinlogevents also.

◆ my_time_binary_length()

unsigned int my_time_binary_length ( unsigned int  dec)

Calculate binary size of packed numeric time representation.

Parameters
decPrecision. The same formula is used to find the binary size of the packed numeric time in libbinlogevents/src/value.cpp calc_field_size(). If any modification is done here the same needs to be done in the aforementioned method in libbinlogevents also.

◆ my_timestamp_binary_length()

unsigned int my_timestamp_binary_length ( unsigned int  dec)

Calculate on-disk size of a timestamp value.

Parameters
decPrecision.

The same formula is used to find the binary size of the packed numeric time in libbinlogevents/src/value.cpp calc_field_size(). If any modification is done here the same needs to be done in the aforementioned method in libbinlogevents also.