Merge lp:~posulliv/maria/query-rewrite into lp:maria/5.3

Proposed by Padraig O'Sullivan
Status: Needs review
Proposed branch: lp:~posulliv/maria/query-rewrite
Merge into: lp:maria/5.3
Diff against target: 534 lines (+411/-5)
11 files modified
include/mysql/plugin.h (+4/-3)
include/mysql/plugin_query_rewrite.h (+57/-0)
plugin/rewrite_lower/CMakeLists.txt (+17/-0)
plugin/rewrite_lower/Makefile.am (+32/-0)
plugin/rewrite_lower/plug.in (+4/-0)
plugin/rewrite_lower/rewrite_lower.cc (+84/-0)
sql/Makefile.am (+2/-0)
sql/sql_parse.cc (+3/-0)
sql/sql_plugin.cc (+6/-2)
sql/sql_query_rewrite.cc (+166/-0)
sql/sql_query_rewrite.h (+36/-0)
To merge this branch: bzr merge lp:~posulliv/maria/query-rewrite
Reviewer Review Type Date Requested Status
Sergei Golubchik Pending
Review via email: mp+38565@code.launchpad.net

This proposal supersedes a proposal from 2010-10-14.

Description of the change

This branch contains a new plugin point for query rewriting that I'd like to have considered. It allows someone to develop a plugin which can modify the text of a query before it is parsed.

A very simple explanation of my use-case is to transform a query with joins into a query on virtual tables that contains no joins. I need this transformation to be transparent to the user who can submit their original queries as before.

I picked this point for the plugin as its much easier for me to parse the query myself than to work with the parse tree produced by Maria. As Sergei mentioned on the MySQL internals list, a better plugin point may be after the query is parsed. I am open to working on this if someone can provide me with some help? Basically, what is the simplest structure I can pass to a plugin that represents the parse tree? Also, how can I obtain documentation or examples of how to modify the parse tree?

One possibility I was thinking of is to keep the current plugin points I have and also add another method to the rewriting interface which takes the parse tree as a parameter.

Thanks a lot,
Padraig

To post a comment you must log in.
Revision history for this message
Michael Widenius (monty) wrote : Posted in a previous version of this proposal

Hi!

>>>>> "Padraig" == Padraig O'Sullivan <email address hidden> writes:

Padraig> Padraig O'Sullivan has proposed merging lp:~posulliv/maria/query-rewrite into lp:maria.
Padraig> Requested reviews:
Padraig> Maria-captains (maria-captains)

Padraig> This branch contains a new plugin point for query rewriting that I'd like to have considered. It allows someone to develop a plugin which can modify the text of a query before it is parsed.

Padraig> A very simple explanation of my use-case is to transform a query with joins into a query on virtual tables that contains no joins. I need this transformation to be transparent to the user who can submit their original queries as before.

Padraig> I picked this point for the plugin as its much easier for me to parse the query myself than to work with the parse tree produced by Maria. As Sergei mentioned on the MySQL internals list, a better plugin point may be after the query is parsed. I am open to working on this if someone can provide me with some help? Basically, what is the simplest structure I can pass to a plugin that represents the parse tree? Also, how can I obtain documentation or examples of how to modify the parse tree?

Padraig> One possibility I was thinking of is to keep the current plugin points I have and also add another method to the rewriting interface which takes the parse tree as a parameter.

Igor, could you give some directions to Padraig how to solve his
problem in the nicest possible way?

Regards,
Monty

Unmerged revisions

2820. By Padraig O'Sullivan

Added another plugin point for query rewrite which allows the parse tree to be rewritten.

2819. By Padraig O'Sullivan

Simple version of query rewrite hook where query text is passed to rewrite hook. Also added a simple plugin which does nothing interesting except convert the query to lower case.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'include/mysql/plugin.h'
2--- include/mysql/plugin.h 2010-06-01 19:52:20 +0000
3+++ include/mysql/plugin.h 2010-10-15 16:31:17 +0000
4@@ -71,9 +71,10 @@
5 #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */
6 #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */
7 #define MYSQL_AUDIT_PLUGIN 5 /* The Audit plugin type */
8-#define MYSQL_REPLICATION_PLUGIN 6 /* The replication plugin type */
9-#define MYSQL_AUTHENTICATION_PLUGIN 7 /* The authentication plugin type */
10-#define MYSQL_MAX_PLUGIN_TYPE_NUM 8 /* The number of plugin types */
11+#define MYSQL_QUERY_REWRITE_PLUGIN 6 /* The query rewrite plugin type */
12+#define MYSQL_REPLICATION_PLUGIN 7 /* The replication plugin type */
13+#define MYSQL_AUTHENTICATION_PLUGIN 8 /* The authentication plugin type */
14+#define MYSQL_MAX_PLUGIN_TYPE_NUM 9 /* The number of plugin types */
15
16 /* We use the following strings to define licenses for plugins */
17 #define PLUGIN_LICENSE_PROPRIETARY 0
18
19=== added file 'include/mysql/plugin_query_rewrite.h'
20--- include/mysql/plugin_query_rewrite.h 1970-01-01 00:00:00 +0000
21+++ include/mysql/plugin_query_rewrite.h 2010-10-15 16:31:17 +0000
22@@ -0,0 +1,57 @@
23+/* Copyright (C) 2010 Akiban Technologies
24+
25+ This program is free software; you can redistribute it and/or modify
26+ it under the terms of the GNU General Public License as published by
27+ the Free Software Foundation; version 2 of the License.
28+
29+ This program is distributed in the hope that it will be useful,
30+ but WITHOUT ANY WARRANTY; without even the implied warranty of
31+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
32+ GNU General Public License for more details.
33+
34+ You should have received a copy of the GNU General Public License
35+ along with this program; if not, write to the Free Software
36+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
37+
38+#ifndef _my_query_rewrite_h
39+#define _my_query_rewrite_h
40+
41+#include <stdint.h>
42+
43+/*************************************************************************
44+ API for query rewrite plugin. (MYSQL_QUERY_REWRITE_PLUGIN)
45+*/
46+
47+#include "plugin.h"
48+
49+#define MYSQL_QUERY_REWRITE_INTERFACE_VERSION 0x0200
50+
51+typedef struct st_lex LEX;
52+
53+/*************************************************************************
54+ Here we define the descriptor structure, that is referred from
55+ st_mysql_plugin.
56+
57+ rewrite_query() is invoked before a query is parsed allowing a plugin
58+ the opporunity to rewrite the query string passed as a parameter
59+ to the function
60+
61+ free_rewritten_query() is invoked only if a plugin rewrote the text of a query.
62+ It frees any memory a plugin allocated for the rewritten query.
63+
64+ rewrite_parse_tree() is invoked after a query is parsed by MySQL. It
65+ gives a rewriting plugin the opportunity to modify the parse tree
66+ generated by MySQL. This allows a plugin developer to rewrite a query
67+ without having to worry about parsing a query.
68+*/
69+
70+struct st_mysql_query_rewrite
71+{
72+ int interface_version;
73+ char* (*rewrite_query)(const char* schema, size_t schema_len, const char* query, size_t orig_query_len, size_t* rewritten_query_len);
74+ void (*free_rewritten_query)(char* query);
75+ void (*rewrite_parse_tree)(MYSQL_THD thd, LEX* parse_tree);
76+};
77+
78+
79+#endif /* _my_query_rewrite_h */
80
81=== added directory 'plugin/rewrite_lower'
82=== added file 'plugin/rewrite_lower/CMakeLists.txt'
83--- plugin/rewrite_lower/CMakeLists.txt 1970-01-01 00:00:00 +0000
84+++ plugin/rewrite_lower/CMakeLists.txt 2010-10-15 16:31:17 +0000
85@@ -0,0 +1,17 @@
86+# Copyright (c) 2010, Padraig O'Sullivan. All rights reserved.
87+#
88+# This program is free software; you can redistribute it and/or modify
89+# it under the terms of the GNU General Public License as published by
90+# the Free Software Foundation; version 2 of the License.
91+#
92+# This program is distributed in the hope that it will be useful,
93+# but WITHOUT ANY WARRANTY; without even the implied warranty of
94+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
95+# GNU General Public License for more details.
96+#
97+# You should have received a copy of the GNU General Public License
98+# along with this program; if not, write to the Free Software
99+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
100+
101+MYSQL_ADD_PLUGIN(rewrite_lower rewrite_lower.cc
102+ MODULE_ONLY MODULE_OUTPUT_NAME "rewrite_lower")
103
104=== added file 'plugin/rewrite_lower/Makefile.am'
105--- plugin/rewrite_lower/Makefile.am 1970-01-01 00:00:00 +0000
106+++ plugin/rewrite_lower/Makefile.am 2010-10-15 16:31:17 +0000
107@@ -0,0 +1,32 @@
108+# Copyright (C) 2010 Padraig O'Sullivan
109+#
110+# This program is free software; you can redistribute it and/or modify
111+# it under the terms of the GNU General Public License as published by
112+# the Free Software Foundation; version 2 of the License.
113+#
114+# This program is distributed in the hope that it will be useful,
115+# but WITHOUT ANY WARRANTY; without even the implied warranty of
116+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
117+# GNU General Public License for more details.
118+#
119+# You should have received a copy of the GNU General Public License
120+# along with this program; if not, write to the Free Software
121+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
122+
123+## Makefile.am for query rewrite plugin that converts a query to lower case
124+
125+pkgplugindir = $(pkglibdir)/plugin
126+INCLUDES = -I$(top_srcdir)/include \
127+ -I$(top_srcdir)/sql \
128+ -I$(top_srcdir)/regex \
129+ -I$(srcdir)
130+
131+#noinst_HEADERS = rewrite_lower.h
132+
133+pkgplugin_LTLIBRARIES = rewrite_lower.la
134+rewrite_lower_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices -lstdc++
135+rewrite_lower_la_CXXFLAGS= $(AM_CXXFLAGS) -DMYSQL_DYNAMIC_PLUGIN
136+rewrite_lower_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN
137+rewrite_lower_la_SOURCES = rewrite_lower.cc
138+
139+EXTRA_DIST= plugin.in CMakeLists.txt
140
141=== added file 'plugin/rewrite_lower/plug.in'
142--- plugin/rewrite_lower/plug.in 1970-01-01 00:00:00 +0000
143+++ plugin/rewrite_lower/plug.in 2010-10-15 16:31:17 +0000
144@@ -0,0 +1,4 @@
145+MYSQL_PLUGIN(rewrite_lower,[Convert query to lower-case Query Rewriting Plugin],
146+ [Example query rewriting plugin.])
147+MYSQL_PLUGIN_DYNAMIC(rewrite_lower, [rewrite_lower.la])
148+MYSQL_PLUGIN_STATIC(rewrite_lower, [librewritelower.a])
149
150=== added file 'plugin/rewrite_lower/rewrite_lower.cc'
151--- plugin/rewrite_lower/rewrite_lower.cc 1970-01-01 00:00:00 +0000
152+++ plugin/rewrite_lower/rewrite_lower.cc 2010-10-15 16:31:17 +0000
153@@ -0,0 +1,84 @@
154+/* Copyright (C) 2010 Padraig O'Sullivan
155+
156+ This program is free software; you can redistribute it and/or modify
157+ it under the terms of the GNU General Public License as published by
158+ the Free Software Foundation; version 2 of the License.
159+
160+ This program is distributed in the hope that it will be useful,
161+ but WITHOUT ANY WARRANTY; without even the implied warranty of
162+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
163+ GNU General Public License for more details.
164+
165+ You should have received a copy of the GNU General Public License
166+ along with this program; if not, write to the Free Software
167+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
168+
169+#include <ctype.h>
170+#include <string.h>
171+
172+#include <mysql/plugin.h>
173+#include <mysql/plugin_query_rewrite.h>
174+
175+using namespace std;
176+
177+static char* rewrite_lower(const char*,
178+ size_t,
179+ const char* query,
180+ size_t original_query_len,
181+ size_t* rewritten_query_len)
182+{
183+ char* rewritten_query= new char[original_query_len];
184+ memcpy(rewritten_query, query, original_query_len);
185+ while (*rewritten_query++ = tolower(*rewritten_query));
186+ *rewritten_query_len= original_query_len;
187+ return (rewritten_query - (original_query_len + 1));
188+}
189+
190+
191+static void free_rewritten_query(char* query)
192+{
193+ delete [] query;
194+}
195+
196+
197+static void null_parse_rewrite(MYSQL_THD, LEX*)
198+{
199+}
200+
201+
202+static int rewrite_lower_plugin_init(void *)
203+{
204+ return 0;
205+}
206+
207+static int rewrite_lower_plugin_deinit(void *)
208+{
209+ return 0;
210+}
211+
212+static struct st_mysql_query_rewrite rewrite_lower_descriptor= {
213+ MYSQL_QUERY_REWRITE_INTERFACE_VERSION, /* interface version */
214+ rewrite_lower, /* rewrite function */
215+ free_rewritten_query, /* free allocated memory for rewritten query */
216+ null_parse_rewrite /* rewrite the parse tree (do nothing) */
217+};
218+
219+/*
220+ Plugin library descriptor
221+*/
222+mysql_declare_plugin(rewrite_lower)
223+{
224+ MYSQL_QUERY_REWRITE_PLUGIN,
225+ &rewrite_lower_descriptor,
226+ "rewrite_lower",
227+ "Padraig O'Sullivan",
228+ "Simple example query rewriting plugin",
229+ PLUGIN_LICENSE_GPL,
230+ rewrite_lower_plugin_init, /* Plugin Init */
231+ rewrite_lower_plugin_deinit, /* Plugin Deinit */
232+ 0x0100 /* 1.0 */,
233+ NULL, /* status variables */
234+ NULL, /* system variables */
235+ NULL /* config options */
236+}
237+mysql_declare_plugin_end;
238
239=== modified file 'sql/Makefile.am'
240--- sql/Makefile.am 2010-07-10 10:37:30 +0000
241+++ sql/Makefile.am 2010-10-15 16:31:17 +0000
242@@ -56,6 +56,7 @@
243 sql_map.h sql_string.h unireg.h \
244 sql_error.h field.h handler.h mysqld_suffix.h \
245 sql_profile.h \
246+ sql_query_rewrite.h \
247 ha_ndbcluster.h ha_ndbcluster_cond.h \
248 ha_ndbcluster_binlog.h ha_ndbcluster_tables.h \
249 ha_partition.h rpl_constants.h \
250@@ -99,6 +100,7 @@
251 sql_join_cache.cc \
252 sql_base.cc table.cc sql_select.cc sql_insert.cc \
253 sql_profile.cc \
254+ sql_query_rewrite.cc \
255 sql_prepare.cc sql_error.cc sql_locale.cc \
256 sql_update.cc sql_delete.cc uniques.cc sql_do.cc \
257 procedure.cc sql_test.cc \
258
259=== modified file 'sql/sql_parse.cc'
260--- sql/sql_parse.cc 2010-06-26 10:05:41 +0000
261+++ sql/sql_parse.cc 2010-10-15 16:31:17 +0000
262@@ -27,6 +27,7 @@
263 #include "sp_cache.h"
264 #include "events.h"
265 #include "sql_trigger.h"
266+#include "sql_query_rewrite.h"
267
268 #ifdef WITH_MARIA_STORAGE_ENGINE
269 #include "../storage/maria/ha_maria.h"
270@@ -1171,6 +1172,7 @@
271 /* 'b' stands for 'buffer' parameter', special for 'my_snprintf' */
272 const char* end_of_stmt= NULL;
273
274+ mysql_rewrite_raw_query(thd);
275 general_log_write(thd, command, thd->query(), thd->query_length());
276 DBUG_PRINT("query",("%-.4096s",thd->query()));
277
278@@ -6003,6 +6005,7 @@
279 {
280 if (! thd->is_error())
281 {
282+ mysql_rewrite_parse_tree(thd);
283 /*
284 Binlog logs a string starting from thd->query and having length
285 thd->query_length; so we set thd->query_length correctly (to not
286
287=== modified file 'sql/sql_plugin.cc'
288--- sql/sql_plugin.cc 2010-06-01 19:52:20 +0000
289+++ sql/sql_plugin.cc 2010-10-15 16:31:17 +0000
290@@ -49,6 +49,7 @@
291 { C_STRING_WITH_LEN("DAEMON") },
292 { C_STRING_WITH_LEN("INFORMATION SCHEMA") },
293 { C_STRING_WITH_LEN("AUDIT") },
294+ { C_STRING_WITH_LEN("QUERY REWRITE") },
295 { C_STRING_WITH_LEN("REPLICATION") },
296 { C_STRING_WITH_LEN("AUTHENTICATION") }
297 };
298@@ -56,6 +57,9 @@
299 extern int initialize_schema_table(st_plugin_int *plugin);
300 extern int finalize_schema_table(st_plugin_int *plugin);
301
302+extern int initialize_query_rewrite_plugin(st_plugin_int *plugin);
303+extern int finalize_query_rewrite_plugin(st_plugin_int *plugin);
304+
305 /*
306 The number of elements in both plugin_type_initialize and
307 plugin_type_deinitialize should equal to the number of plugins
308@@ -63,12 +67,12 @@
309 */
310 plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
311 {
312- 0,ha_initialize_handlerton,0,0,initialize_schema_table, 0, 0, 0
313+ 0,ha_initialize_handlerton,0,0,initialize_schema_table, 0, initialize_query_rewrite_plugin, 0, 0
314 };
315
316 plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]=
317 {
318- 0,ha_finalize_handlerton,0,0,finalize_schema_table, 0, 0, 0
319+ 0,ha_finalize_handlerton,0,0,finalize_schema_table, 0, finalize_query_rewrite_plugin, 0, 0
320 };
321
322 #ifdef HAVE_DLOPEN
323
324=== added file 'sql/sql_query_rewrite.cc'
325--- sql/sql_query_rewrite.cc 1970-01-01 00:00:00 +0000
326+++ sql/sql_query_rewrite.cc 2010-10-15 16:31:17 +0000
327@@ -0,0 +1,166 @@
328+/* Copyright (c) 2010, Padraig O'Sullivan. All rights reserved.
329+
330+ This program is free software; you can redistribute it and/or modify
331+ it under the terms of the GNU General Public License as published by
332+ the Free Software Foundation; version 2 of the License.
333+
334+ This program is distributed in the hope that it will be useful,
335+ but WITHOUT ANY WARRANTY; without even the implied warranty of
336+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
337+ GNU General Public License for more details.
338+
339+ You should have received a copy of the GNU General Public License
340+ along with this program; if not, write to the Free Software Foundation,
341+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
342+
343+#include "mysql_priv.h"
344+#include "sql_query_rewrite.h"
345+
346+extern int initialize_query_rewrite_plugin(st_plugin_int *plugin);
347+extern int finalize_query_rewrite_plugin(st_plugin_int *plugin);
348+
349+#ifndef EMBEDDED_LIBRARY
350+
351+/**
352+ Rewrites a query by invoking the plugin's query_rewrite method.
353+
354+ @param[in] thd
355+ @param[in] plugin
356+ @param[in] arg
357+
358+ @retval FALSE always
359+*/
360+static my_bool query_text_rewrite(THD *thd,
361+ plugin_ref plugin,
362+ void *)
363+{
364+ st_mysql_query_rewrite *data= plugin_data(plugin, struct st_mysql_query_rewrite *);
365+
366+ /* rewrite the query */
367+ if (data)
368+ {
369+ size_t rewritten_query_len= 0;
370+ char *rewritten_query= data->rewrite_query(thd->db, thd->db_length, thd->query(), thd->query_length(), &rewritten_query_len);
371+ if (rewritten_query != NULL && rewritten_query_len > 0)
372+ {
373+ alloc_query(thd, rewritten_query, rewritten_query_len);
374+ data->free_rewritten_query(rewritten_query);
375+ }
376+ }
377+
378+ return 0;
379+}
380+
381+
382+/**
383+ Rewrites a query by invoking the plugin's query_rewrite method.
384+
385+ @param[in] thd
386+ @param[in] plugin
387+ @param[in] arg
388+
389+ @retval FALSE always
390+*/
391+static my_bool parse_tree_rewrite(THD *thd,
392+ plugin_ref plugin,
393+ void *)
394+{
395+ st_mysql_query_rewrite *data= plugin_data(plugin, struct st_mysql_query_rewrite *);
396+
397+ /* rewrite the parse tree */
398+ if (data)
399+ {
400+ data->rewrite_parse_tree(thd, thd->lex);
401+ }
402+
403+ return 0;
404+}
405+
406+void mysql_rewrite_raw_query(THD *thd)
407+{
408+ plugin_foreach(thd,
409+ query_text_rewrite,
410+ MYSQL_QUERY_REWRITE_PLUGIN,
411+ NULL);
412+}
413+
414+
415+void mysql_rewrite_parse_tree(THD *thd)
416+{
417+ plugin_foreach(thd,
418+ parse_tree_rewrite,
419+ MYSQL_QUERY_REWRITE_PLUGIN,
420+ NULL);
421+}
422+
423+
424+/**
425+ Initialize a query rewrite plug-in
426+
427+ @param[in] plugin
428+
429+ @retval FALSE OK
430+ @retval TRUE There was an error.
431+*/
432+int initialize_query_rewrite_plugin(st_plugin_int *plugin)
433+{
434+ if (plugin->plugin->init && plugin->plugin->init(NULL))
435+ {
436+ sql_print_error("Plugin '%s' init function returned error.",
437+ plugin->name.str);
438+ return 1;
439+ }
440+
441+ /* Make the interface info more easily accessible */
442+ plugin->data= plugin->plugin->info;
443+
444+ return 0;
445+}
446+
447+
448+/**
449+ Finalize a query rewrite plug-in
450+
451+ @param[in] plugin
452+
453+ @retval FALSE OK
454+ @retval TRUE There was an error.
455+*/
456+int finalize_query_rewrite_plugin(st_plugin_int *plugin)
457+{
458+ if (plugin->plugin->deinit && plugin->plugin->deinit(NULL))
459+ {
460+ DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.",
461+ plugin->name.str));
462+ DBUG_EXECUTE("finalize_query_rewrite_plugin", return 1; );
463+ }
464+
465+ plugin->data= NULL;
466+ return 0;
467+}
468+
469+#else /* EMBEDDED_LIBRARY */
470+
471+
472+void mysql_rewrite_raw_query(THD *thd)
473+{
474+}
475+
476+
477+void mysql_rewrite_parse_tree(THD *thd)
478+{
479+}
480+
481+
482+int initialize_query_rewrite_plugin(st_plugin_int *plugin)
483+{
484+ return 1;
485+}
486+
487+
488+int finalize_query_rewrite_plugin(st_plugin_int *plugin)
489+{
490+ return 1;
491+}
492+
493+#endif /* EMBEDDED_LIBRARY */
494
495=== added file 'sql/sql_query_rewrite.h'
496--- sql/sql_query_rewrite.h 1970-01-01 00:00:00 +0000
497+++ sql/sql_query_rewrite.h 2010-10-15 16:31:17 +0000
498@@ -0,0 +1,36 @@
499+/* Copyright (c) 2010, Padraig O'Sullivan. All rights reserved.
500+
501+ This program is free software; you can redistribute it and/or modify
502+ it under the terms of the GNU General Public License as published by
503+ the Free Software Foundation; version 2 of the License.
504+
505+ This program is distributed in the hope that it will be useful,
506+ but WITHOUT ANY WARRANTY; without even the implied warranty of
507+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
508+ GNU General Public License for more details.
509+
510+ You should have received a copy of the GNU General Public License
511+ along with this program; if not, write to the Free Software Foundation,
512+ 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
513+
514+#ifndef SQL_QUERY_REWRITE_INCLUDED
515+#define SQL_QUERY_REWRITE_INCLUDED
516+
517+#include <mysql/plugin_query_rewrite.h>
518+
519+class THD;
520+
521+/**
522+ Call query rewrite plugins on the raw query text
523+ @param[in] thd thread with the query to be rewritten
524+ */
525+void mysql_rewrite_raw_query(THD *thd);
526+
527+
528+/**
529+ Call query rewrite plugins on the parse tree
530+ @param[in] thd thread with the parse tree to be rewritten
531+ */
532+void mysql_rewrite_parse_tree(THD *thd);
533+
534+#endif /* SQL_QUERY_REWRITE_INCLUDED */

Subscribers

People subscribed via source and target branches