#include <stddef.h>
#include <stdint.h>
#include "field_types.h"
Go to the source code of this file.
◆ enum_calc_field_size_status
| Enumerator |
|---|
| CALC_FIELD_SIZE_OK | |
| CALC_FIELD_SIZE_TRUNCATED | |
| CALC_FIELD_SIZE_INVALID_TYPE | |
◆ 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
◆ calc_field_size_checked()
| enum enum_calc_field_size_status calc_field_size_checked |
( |
unsigned char |
col, |
|
|
const unsigned char * |
master_data, |
|
|
unsigned int |
metadata, |
|
|
size_t |
available, |
|
|
uint32_t * |
field_size |
|
) |
| |
This helper function calculates the size in bytes of a particular field in a row type event, after checking that all bytes read from master_data fit in the available input.
- Parameters
-
| col | Field type code |
| master_data | The field data |
| metadata | The field metadata |
| available | Number of bytes available from master_data |
| field_size | The size in bytes of the field, on success |
- Return values
-
| CALC_FIELD_SIZE_OK | The field size was calculated successfully. |
| CALC_FIELD_SIZE_TRUNCATED | The field length prefix or value exceeds the available input. |
| CALC_FIELD_SIZE_INVALID_TYPE | The field type or metadata is invalid. |
◆ 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.