MySQL 8.0.32
Source Code Documentation
item_gtid_func.h
Go to the documentation of this file.
1/* Copyright (c) 2000, 2022, 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 also distributed 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 included with MySQL.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License, version 2.0, for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22
23/* This file defines all string functions */
24#ifndef ITEM_GTID_INCLUDED
25#define ITEM_GTID_INCLUDED
26
27#include "item_func.h"
28#include "item_strfunc.h"
29#include "sql/parse_location.h" // POS
30#include "sql_string.h"
31
32class Item;
33class THD;
34struct Parse_context;
35
36/**
37 This class is used for implementing the new wait_for_executed_gtid_set
38 function and the functions related to them. This new function is independent
39 of the slave threads.
40*/
43
45
46 public:
48 : Item_int_func(pos, a) {
49 null_on_null = false;
50 }
52 : Item_int_func(pos, a, b) {
53 null_on_null = false;
54 }
55
56 bool itemize(Parse_context *pc, Item **res) override;
57 longlong val_int() override;
58 const char *func_name() const override {
59 return "wait_for_executed_gtid_set";
60 }
61 bool resolve_type(THD *thd) override {
62 if (param_type_is_default(thd, 0, 1)) return true;
63 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
64 set_nullable(true);
65 return false;
66 }
67};
68
71
74
75 public:
76 Item_master_gtid_set_wait(const POS &pos, Item *a);
77 Item_master_gtid_set_wait(const POS &pos, Item *a, Item *b);
78 Item_master_gtid_set_wait(const POS &pos, Item *a, Item *b, Item *c);
79
80 bool itemize(Parse_context *pc, Item **res) override;
81 longlong val_int() override;
82 const char *func_name() const override {
83 return "wait_until_sql_thread_after_gtids";
84 }
85 bool resolve_type(THD *thd) override {
86 if (param_type_is_default(thd, 0, 1)) return true;
87 if (param_type_is_default(thd, 1, 2, MYSQL_TYPE_DOUBLE)) return true;
88 if (param_type_is_default(thd, 2, 3)) return true;
89 set_nullable(true);
90 return false;
91 }
92};
93
97
98 public:
99 Item_func_gtid_subset(const POS &pos, Item *a, Item *b)
100 : Item_int_func(pos, a, b) {}
101 longlong val_int() override;
102 const char *func_name() const override { return "gtid_subset"; }
103 bool resolve_type(THD *thd) override {
104 if (param_type_is_default(thd, 0, ~0U)) return true;
105 return false;
106 }
107 bool is_bool_func() const override { return true; }
108};
109
112
113 public:
115 : Item_str_ascii_func(pos, a, b) {}
116 bool resolve_type(THD *) override;
117 const char *func_name() const override { return "gtid_subtract"; }
118 String *val_str_ascii(String *) override;
119};
120
121#endif /* ITEM_GTID_INCLUDED */
Definition: item_gtid_func.h:94
bool is_bool_func() const override
Definition: item_gtid_func.h:107
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:252
String buf1
Definition: item_gtid_func.h:95
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:103
Item_func_gtid_subset(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:99
const char * func_name() const override
Definition: item_gtid_func.h:102
String buf2
Definition: item_gtid_func.h:96
Definition: item_gtid_func.h:110
const char * func_name() const override
Definition: item_gtid_func.h:117
Item_func_gtid_subtract(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:114
String buf1
Definition: item_gtid_func.h:111
String * val_str_ascii(String *) override
Definition: item_gtid_func.cc:305
bool resolve_type(THD *) override
Resolve type-related information for this item, such as result field type, maximum size,...
Definition: item_gtid_func.cc:287
String buf2
Definition: item_gtid_func.h:111
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:516
bool null_on_null
Affects how to determine that NULL argument implies a NULL function return.
Definition: item_func.h:157
Definition: item_func.h:928
Definition: item_gtid_func.h:69
longlong val_int() override
Definition: item_gtid_func.cc:152
Item_int_func super
Definition: item_gtid_func.h:70
String gtid_value
Definition: item_gtid_func.h:72
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_gtid_func.cc:144
String channel_value
Definition: item_gtid_func.h:73
Item_master_gtid_set_wait(const POS &pos, Item *a)
Definition: item_gtid_func.cc:121
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:85
const char * func_name() const override
Definition: item_gtid_func.h:82
Definition: item_strfunc.h:143
This class is used for implementing the new wait_for_executed_gtid_set function and the functions rel...
Definition: item_gtid_func.h:41
Item_int_func super
Definition: item_gtid_func.h:42
const char * func_name() const override
Definition: item_gtid_func.h:58
Item_wait_for_executed_gtid_set(const POS &pos, Item *a, Item *b)
Definition: item_gtid_func.h:51
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:51
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:61
bool itemize(Parse_context *pc, Item **res) override
The same as contextualize() but with additional parameter.
Definition: item_gtid_func.cc:34
String value
Definition: item_gtid_func.h:44
Item_wait_for_executed_gtid_set(const POS &pos, Item *a)
Definition: item_gtid_func.h:47
Base class that is used to represent any kind of expression in a relational query.
Definition: item.h:850
void set_nullable(bool nullable)
Definition: item.h:3400
Using this class is fraught with peril, and you need to be very careful when doing so.
Definition: sql_string.h:166
For each client connection we create a separate thread with THD serving as a thread/connection descri...
Definition: sql_lexer_thd.h:33
@ MYSQL_TYPE_DOUBLE
Definition: field_types.h:58
long long int longlong
Definition: my_inttypes.h:54
Our own string classes, used pervasively throughout the executor.
Environment data for the contextualization phase.
Definition: parse_tree_node_base.h:120
Bison "location" class.
Definition: parse_location.h:42
Definition: dtoa.cc:594