MySQL 9.0.0
Source Code Documentation
sdi_utils.h
Go to the documentation of this file.
1/* Copyright (c) 2014, 2024, Oracle and/or its affiliates.
2
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License, version 2.0,
5 as published by the Free Software Foundation.
6
7 This program is designed to work with certain software (including
8 but not limited to OpenSSL) that is licensed under separate terms,
9 as designated in a particular file or component or in included license
10 documentation. The authors of MySQL hereby grant you an additional
11 permission to link the program and your derivative works with the
12 separately licensed software that they have either included with
13 the program or referenced in the documentation.
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#ifndef SDI_UTILS_INCLUDED
25#define SDI_UTILS_INCLUDED
26
27#include <stddef.h>
28
29#include "my_inttypes.h"
30
31/**
32 This function retrieves serialized meta data from the data dictionary
33 for the given schema and table. The serialized meta data may be used
34 for various purposes, such as writing it to a file, shipping it to
35 other processes, etc.
36
37 @param[in] schema_name Name of the schema
38 @param[in] table_name Name of the table
39 @param[out] meta_data The serialized meta data of the table
40 @param[out] meta_data_length The size of the meta data blob
41
42 @retval false Success
43 @retval true Error, e.g. the table was not found in the data dictionary.
44 In this case, the values of 'meta_data_length' and
45 'meta_data' are not defined.
46*/
47
48bool create_serialized_meta_data(const char *schema_name,
49 const char *table_name, uchar **meta_data,
50 size_t *meta_data_length);
51
52/**
53 This function takes the submitted serialized meta data, de-serializes
54 and analyzes it, and merges it into the data dictionary.
55
56 @param[in] meta_data The serialized meta data
57 @param[in] meta_data_length The size of the meta data blob
58 @param[in] readonly Disallow conflict resolution affecting the
59 imported meta data
60
61 @retval false Success
62 @retval true Error, e.g. a conflict was detected while 'readonly' is
63 set to 'true'.
64*/
65
67 size_t meta_data_length, bool readonly);
68
69/**
70 This function takes the two submitted serialized meta data blobs,
71 and compares them.
72
73 @param[in] a_meta_data First serialized meta data blob
74 @param[in] a_meta_data_length Size of the first meta data blob
75 @param[in] b_meta_data Second serialized meta data blob
76 @param[in] b_meta_data_length Size of the second meta data blob
77
78 @retval false The two blobs are identical
79 @retval true The two blobs are different
80*/
81
82bool different_serialized_meta_data(const uchar *a_meta_data,
83 size_t a_meta_data_length,
84 const uchar *b_meta_data,
85 size_t b_meta_data_length);
86
87#endif /* SDI_UTILS_INCLUDED */
Some integer typedefs for easier portability.
unsigned char uchar
Definition: my_inttypes.h:52
static std::shared_ptr< MetaData > meta_data
Definition: metadata_factory.cc:33
const char * table_name
Definition: rules_table_service.cc:56
bool create_serialized_meta_data(const char *schema_name, const char *table_name, uchar **meta_data, size_t *meta_data_length)
This function retrieves serialized meta data from the data dictionary for the given schema and table.
Definition: sdi_utils.cc:33
bool import_serialized_meta_data(const uchar *meta_data, size_t meta_data_length, bool readonly)
This function takes the submitted serialized meta data, de-serializes and analyzes it,...
Definition: sdi_utils.cc:63
bool different_serialized_meta_data(const uchar *a_meta_data, size_t a_meta_data_length, const uchar *b_meta_data, size_t b_meta_data_length)
This function takes the two submitted serialized meta data blobs, and compares them.
Definition: sdi_utils.cc:73