#include <stdint.h>
#include "field_types.h"
Go to the source code of this file.
◆ 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
-
col | Field type code |
master_data | The field data |
metadata | The 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
-
precision | number of significant digits in a particular radix R where R is either 2 or 10. |
scale | to 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_type | Type of the field |
metadata | The 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
-
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
-
dec | Precision. 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
-
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.