MySQL 8.0.40
Source Code Documentation
plugin_query_rewrite.h
Go to the documentation of this file.
1#ifndef PLUGIN_QUERY_REWRITE_INCLUDED
2#define PLUGIN_QUERY_REWRITE_INCLUDED
3
4/* Copyright (c) 2015, 2024, Oracle and/or its affiliates.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License, version 2.0,
8 as published by the Free Software Foundation.
9
10 This program is designed to work with certain software (including
11 but not limited to OpenSSL) that is licensed under separate terms,
12 as designated in a particular file or component or in included license
13 documentation. The authors of MySQL hereby grant you an additional
14 permission to link the program and your derivative works with the
15 separately licensed software that they have either included with
16 the program or referenced in the documentation.
17
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License, version 2.0, for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
26
27#include "plugin.h"
28
29/**
30 @file include/mysql/plugin_query_rewrite.h
31 API for the query rewrite plugin types (MYSQL_REWRITE_PRE_PARSE_PLUGIN and
32 MYSQL_REWRITE_POST_PARSE_PLUGIN).
33*/
34
35/// Must be set by a plugin if the query is rewritten.
36#define FLAG_REWRITE_PLUGIN_QUERY_REWRITTEN 1
37
38/// Is set by the server if the query is prepared statement.
39#define FLAG_REWRITE_PLUGIN_IS_PREPARED_STATEMENT 2
40
41/// Structure that is passed during each step of a rewriting.
43 /**
44 Indicate the status of the current rewrite.
45 @see FLAG_REWRITE_PLUGIN_QUERY_REWRITTEN
46 @see FLAG_REWRITE_PLUGIN_IS_PREPARED_STATEMENT
47 */
48 int flags;
49
50 /// The current session.
52
53 /// Pointer left to the plugin to store any necessary info as needed.
54 void *data;
56
61};
62
63/// Structure that is passed during each step of a rewriting.
65 /**
66 Indicate the status of the current rewrite.
67 @see FLAG_REWRITE_PLUGIN_QUERY_REWRITTEN
68 @see FLAG_REWRITE_PLUGIN_IS_PREPARED_STATEMENT
69 */
70 int flags;
71
72 /// The current session.
74
75 /// Pointer left to the plugin to store any necessary info as needed.
76 void *data;
77
78 /// The query potentially to be rewritten.
79 const char *query;
80
81 /// Length of query potentially to be rewritten.
83
84 /// The rewritten query, if applicable.
85 const char *rewritten_query;
86
87 /// Length of the rewritten query, if applicable.
90
95};
96
97#endif /* PLUGIN_QUERY_REWRITE_INCLUDED */
#define MYSQL_THD
Definition: backup_page_tracker.h:38
struct Mysql_rewrite_pre_parse_param Mysql_rewrite_pre_parse_param
Structure that is passed during each step of a rewriting.
struct Mysql_rewrite_post_parse_param Mysql_rewrite_post_parse_param
Structure that is passed during each step of a rewriting.
Structure that is passed during each step of a rewriting.
Definition: plugin_query_rewrite.h:42
int flags
Indicate the status of the current rewrite.
Definition: plugin_query_rewrite.h:48
void * data
Pointer left to the plugin to store any necessary info as needed.
Definition: plugin_query_rewrite.h:54
MYSQL_THD thd
The current session.
Definition: plugin_query_rewrite.h:51
Structure that is passed during each step of a rewriting.
Definition: plugin_query_rewrite.h:64
size_t rewritten_query_length
Length of the rewritten query, if applicable.
Definition: plugin_query_rewrite.h:88
int flags
Indicate the status of the current rewrite.
Definition: plugin_query_rewrite.h:70
const char * query
The query potentially to be rewritten.
Definition: plugin_query_rewrite.h:79
void * data
Pointer left to the plugin to store any necessary info as needed.
Definition: plugin_query_rewrite.h:76
const char * rewritten_query
The rewritten query, if applicable.
Definition: plugin_query_rewrite.h:85
MYSQL_THD thd
The current session.
Definition: plugin_query_rewrite.h:73
size_t query_length
Length of query potentially to be rewritten.
Definition: plugin_query_rewrite.h:82
Definition: plugin_query_rewrite.h:57
int interface_version
Definition: plugin_query_rewrite.h:58
int needs_statement_digest
Definition: plugin_query_rewrite.h:59
int(* rewrite)(Mysql_rewrite_post_parse_param *param)
Definition: plugin_query_rewrite.h:60
Definition: plugin_query_rewrite.h:91
int(* deinit)(Mysql_rewrite_pre_parse_param *param)
Definition: plugin_query_rewrite.h:94
int interface_version
Definition: plugin_query_rewrite.h:92
int(* rewrite)(Mysql_rewrite_pre_parse_param *param)
Definition: plugin_query_rewrite.h:93