MySQL 8.0.40
Source Code Documentation
item_gtid_func.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 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/* This file defines all string functions */
25#ifndef ITEM_GTID_INCLUDED
26#define ITEM_GTID_INCLUDED
27
28#include "item_func.h"
29#include "item_strfunc.h"
30#include "sql/parse_location.h" // POS
31#include "sql_string.h"
32
33class Item;
34class THD;
35struct Parse_context;
36
37/**
38 This class is used for implementing the new wait_for_executed_gtid_set
39 function and the functions related to them. This new function is independent
40 of the slave threads.
41*/
44
46
47 public:
49 : Item_int_func(pos, a) {
50 null_on_null = false;
51 }
53 : Item_int_func(pos, a, b) {
54 null_on_null = false;
55 }
56
57 bool itemize(Parse_context *pc, Item **res) override;
58 longlong val_int() override;
59 const char *func_name() const override {
60 return "wait_for_executed_gtid_set";
61 }
62 bool resolve_type(THD *thd) override {
63 if (param_type_is_default(thd, 0, 1)) return true;
64 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
65 set_nullable(true);
66 return false;
67 }
68};
69
72
75
76 public:
77 Item_master_gtid_set_wait(const POS &pos, Item *a);
78 Item_master_gtid_set_wait(const POS &pos, Item *a, Item *b);
79 Item_master_gtid_set_wait(const POS &pos, Item *a, Item *b, Item *c);
80
81 bool itemize(Parse_context *pc, Item **res) override;
82 longlong val_int() override;
83 const char *func_name() const override {
84 return "wait_until_sql_thread_after_gtids";
85 }
86 bool resolve_type(THD *thd) override {
87 if (param_type_is_default(thd, 0, 1)) return true;
88 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
89 if (param_type_is_default(thd, 2, 3)) return true;
90 set_nullable(true);
91 return false;
92 }
93};
94
98
99 public:
100 Item_func_gtid_subset(const POS &pos, Item *a, Item *b)
101 : Item_int_func(pos, a, b) {}
102 longlong val_int() override;
103 const char *func_name() const override { return "gtid_subset"; }
104 bool resolve_type(THD *thd) override {
105 if (param_type_is_default(thd, 0, ~0U)) return true;
106 return false;
107 }
108 bool is_bool_func() const override { return true; }
109};
110
113
114 public:
116 : Item_str_ascii_func(pos, a, b) {}
117 bool resolve_type(THD *) override;
118 const char *func_name() const override { return "gtid_subtract"; }
119 String *val_str_ascii(String *) override;
120};
121
122#endif /* ITEM_GTID_INCLUDED */
Definition: item_gtid_func.h:95
bool is_bool_func() const override
Definition: item_gtid_func.h:108
longlong val_int() override
Return 1 if both arguments are Gtid_sets and the first is a subset of the second.
Definition: item_gtid_func.cc:253
String buf1
Definition: item_gtid_func.h:96
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_gtid_func.h:104
Item_func_gtid_subset(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:100
const char * func_name() const override
Definition: item_gtid_func.h:103
String buf2
Definition: item_gtid_func.h:97
Definition: item_gtid_func.h:111
const char * func_name() const override
Definition: item_gtid_func.h:118
Item_func_gtid_subtract(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:115
String buf1
Definition: item_gtid_func.h:112
String * val_str_ascii(String *) override
Definition: item_gtid_func.cc:306
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_gtid_func.cc:288
String buf2
Definition: item_gtid_func.h:112
bool param_type_is_default(THD *thd, uint start, uint end, uint step, enum_field_types def)
For arguments of this Item_func ("args" array), in range [start, start+step, start+2*step,...
Definition: item_func.cc:519
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:164
Definition: item_func.h:935
Definition: item_gtid_func.h:70
longlong val_int() override
Definition: item_gtid_func.cc:153
Item_int_func super
Definition: item_gtid_func.h:71
String gtid_value
Definition: item_gtid_func.h:73
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_gtid_func.cc:145
String channel_value
Definition: item_gtid_func.h:74
Item_master_gtid_set_wait(const POS &pos, Item *a)
Definition: item_gtid_func.cc:122
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_gtid_func.h:86
const char * func_name() const override
Definition: item_gtid_func.h:83
Definition: item_strfunc.h:144
This class is used for implementing the new wait_for_executed_gtid_set function and the functions rel...
Definition: item_gtid_func.h:42
Item_int_func super
Definition: item_gtid_func.h:43
const char * func_name() const override
Definition: item_gtid_func.h:59
Item_wait_for_executed_gtid_set(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:52
longlong val_int() override
Wait until the given gtid_set is found in the executed gtid_set independent of the slave threads.
Definition: item_gtid_func.cc:53
bool resolve_type(THD *thd) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_gtid_func.h:62
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_gtid_func.cc:36
String value
Definition: item_gtid_func.h:45
Item_wait_for_executed_gtid_set(const POS &pos, Item *a)
Definition: item_gtid_func.h:48
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:853
void set_nullable(bool nullable)
Definition: item.h:3472
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:168
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:34
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:59
long long int longlong
Definition: my_inttypes.h:55
Our own string classes, used pervasively throughout the executor.
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:121
Bison "location" class.
Definition: parse_location.h:43
Definition: dtoa.cc:594