MySQL 8.0.39
Source Code Documentation
binary_log_funcs.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2014, 2024, Oracle and/or its affiliates.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License, version 2.0,
6 as published by the Free Software Foundation.
7
8 This program is designed to work with certain software (including
9 but not limited to OpenSSL) that is licensed under separate terms,
10 as designated in a particular file or component or in included license
11 documentation. The authors of MySQL hereby grant you an additional
12 permission to link the program and your derivative works with the
13 separately licensed software that they have either included with
14 the program or referenced in the documentation.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License, version 2.0, for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program; if not, write to the Free Software
23 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
24
25/*
26 * Functions exported from this package.
27 */
28
29#ifndef BINARY_LOG_FUNCS_INCLUDED
30#define BINARY_LOG_FUNCS_INCLUDED
31
32#include <stdint.h>
33#include "field_types.h" // enum_field_types
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39unsigned int my_time_binary_length(unsigned int dec);
40unsigned int my_datetime_binary_length(unsigned int dec);
41unsigned int my_timestamp_binary_length(unsigned int dec);
42
43/**
44 This helper function calculates the size in bytes of a particular field in a
45 row type event as defined by the field_ptr and metadata_ptr arguments.
46
47 @param col Field type code
48 @param master_data The field data
49 @param metadata The field metadata
50
51 @note We need the actual field data because the string field size is not
52 part of the meta data. :(
53
54 @return The size in bytes of a particular field
55*/
56uint32_t calc_field_size(unsigned char col, const unsigned char *master_data,
57 unsigned int metadata);
58
59/**
60 Compute the maximum display length of a field.
61
62 @param sql_type Type of the field
63 @param metadata The metadata from the master for the field.
64 @return Maximum length of the field in bytes.
65 */
67 unsigned int metadata);
68
69/**
70 Returns the size of array to hold a binary representation of a decimal
71 @param precision number of significant digits in a particular radix R
72 where R is either 2 or 10.
73 @param scale to what position to round.
74 @return size in bytes
75*/
76int decimal_binary_size(int precision, int scale);
77
78#ifdef __cplusplus
79}
80#endif // __cplusplus
81
82#endif /* BINARY_LOG_FUNCS_INCLUDED */
unsigned int my_time_binary_length(unsigned int dec)
Calculate binary size of packed numeric time representation.
Definition: binary_log_funcs.cpp:56
unsigned int max_display_length_for_field(enum_field_types sql_type, unsigned int metadata)
Compute the maximum display length of a field.
Definition: binary_log_funcs.cpp:97
unsigned int my_timestamp_binary_length(unsigned int dec)
Calculate on-disk size of a timestamp value.
Definition: binary_log_funcs.cpp:85
int decimal_binary_size(int precision, int scale)
Returns the size of array to hold a binary representation of a decimal.
Definition: binary_log_funcs.cpp:202
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 define...
Definition: binary_log_funcs.cpp:212
unsigned int my_datetime_binary_length(unsigned int dec)
Calculate binary size of packed datetime representation.
Definition: binary_log_funcs.cpp:70
This file contains the field type.
enum_field_types
Column types for MySQL.
Definition: field_types.h:53
static const std::string dec("DECRYPTION")