MySQL 8.3.0
Source Code Documentation
binary_log_funcs.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2014, 2023, 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 also distributed 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 included with MySQL.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License, version 2.0, for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24/*
25 * Functions exported from this package.
26 */
27
28#ifndef MYSQL_BINLOG_EVENT_EXPORT_BINARY_LOG_FUNCS_H
29#define MYSQL_BINLOG_EVENT_EXPORT_BINARY_LOG_FUNCS_H
30
31#include <stdint.h>
32#include "field_types.h" // enum_field_types
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
38unsigned int my_time_binary_length(unsigned int dec);
39unsigned int my_datetime_binary_length(unsigned int dec);
40unsigned int my_timestamp_binary_length(unsigned int dec);
41
42/**
43 This helper function calculates the size in bytes of a particular field in a
44 row type event as defined by the field_ptr and metadata_ptr arguments.
45
46 @param col Field type code
47 @param master_data The field data
48 @param metadata The field metadata
49
50 @note We need the actual field data because the string field size is not
51 part of the meta data. :(
52
53 @return The size in bytes of a particular field
54*/
55uint32_t calc_field_size(unsigned char col, const unsigned char *master_data,
56 unsigned int metadata);
57
58/**
59 Compute the maximum display length of a field.
60
61 @param sql_type Type of the field
62 @param metadata The metadata from the master for the field.
63 @return Maximum length of the field in bytes.
64 */
66 unsigned int metadata);
67
68/**
69 Returns the size of array to hold a binary representation of a decimal
70 @param precision number of significant digits in a particular radix R
71 where R is either 2 or 10.
72 @param scale to what position to round.
73 @return size in bytes
74*/
75int decimal_binary_size(int precision, int scale);
76
77#ifdef __cplusplus
78}
79#endif // __cplusplus
80
81#endif // MYSQL_BINLOG_EVENT_EXPORT_BINARY_LOG_FUNCS_H
unsigned int my_time_binary_length(unsigned int dec)
Calculate binary size of packed numeric time representation.
Definition: binary_log_funcs.cpp:55
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:96
unsigned int my_timestamp_binary_length(unsigned int dec)
Calculate on-disk size of a timestamp value.
Definition: binary_log_funcs.cpp:84
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:201
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:211
unsigned int my_datetime_binary_length(unsigned int dec)
Calculate binary size of packed datetime representation.
Definition: binary_log_funcs.cpp:69
This file contains the field type.
enum_field_types
Column types for MySQL Note: Keep include/mysql/components/services/bits/stored_program_bits....
Definition: field_types.h:54
static const std::string dec("DECRYPTION")