Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
diff --git a/sql/select_handler.cc b/sql/select_handler.cc
index 99bd2c0cf7f..08d08d12423 100644
--- a/sql/select_handler.cc
+++ b/sql/select_handler.cc
@@ -64,10 +64,9 @@ TABLE *select_handler::create_tmp_table(THD *thd)
List<Item> types;
TMP_TABLE_PARAM tmp_table_param;
- if (select_lex &&
- select_lex->master_unit()->join_union_item_types(thd, types, 1))
- DBUG_RETURN(NULL);
- else if (lex_unit && lex_unit->join_union_item_types(thd, types, 1))
+ SELECT_LEX_UNIT *u= select_lex? select_lex->master_unit() : lex_unit;
+
+ if (u->join_union_item_types(thd, types, 1))
DBUG_RETURN(NULL);
tmp_table_param.init();
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index a991c1b79ed..c56704e0e7a 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -5568,7 +5568,7 @@ void st_select_lex::set_explain_type(bool on_the_fly)
bool uses_cte= false;
for (JOIN_TAB *tab= first_linear_tab(join, WITHOUT_BUSH_ROOTS,
WITH_CONST_TABLES);
- tab;
+ tab;
tab= next_linear_tab(join, tab, WITHOUT_BUSH_ROOTS))
{
/*
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 83c81978c01..6c4ef7eb358 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -2222,7 +2222,7 @@ bool st_select_lex_unit::optimize()
}
-bool st_select_lex_unit::exec()
+bool st_select_lex_unit::exec()
{
DBUG_ENTER("st_select_lex_unit::exec");
if (executed && !uncacheable && !describe)
diff --git a/storage/federatedx/federatedx_pushdown.cc b/storage/federatedx/federatedx_pushdown.cc
index fa8f12f6a6e..8870aef889d 100644
--- a/storage/federatedx/federatedx_pushdown.cc
+++ b/storage/federatedx/federatedx_pushdown.cc
@@ -73,6 +73,17 @@ static std::pair<handlerton *, TABLE *> get_handlerton(SELECT_LEX *sel_lex)
}
+/*
+ Check that all tables in the lex_unit use the same storage engine.
+
+ @return
+ the storage engine's handlerton and an example table.
+
+ @todo
+ Why does this need to be so generic? We know we need
+ tables with hton == federatedx_hton, why not only look for
+ those tables?
+*/
static std::pair<handlerton *, TABLE *>
get_handlerton_for_unit(SELECT_LEX_UNIT *lex_unit)
{
@@ -248,7 +259,7 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(
THD *thd, SELECT_LEX *select_lex, TABLE *tbl)
: select_handler(thd, federatedx_hton, select_lex),
share(NULL), txn(NULL), iop(NULL), stored_result(NULL), query_table(tbl),
- query(query_buff, sizeof(query_buff), thd->charset())
+ query(thd->charset())
{
query.length(0);
select_lex->print(thd, &query,
@@ -257,11 +268,12 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(
QT_PARSABLE));
}
+
ha_federatedx_select_handler::ha_federatedx_select_handler(
THD *thd, SELECT_LEX_UNIT *lex_unit, TABLE *tbl)
: select_handler(thd, federatedx_hton, lex_unit), share(NULL), txn(NULL),
iop(NULL), stored_result(NULL), query_table(tbl),
- query(query_buff, sizeof(query_buff), thd->charset())
+ query(thd->charset())
{
query.length(0);
lex_unit->print(&query,
@@ -270,6 +282,7 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(
QT_PARSABLE));
}
+
ha_federatedx_select_handler::~ha_federatedx_select_handler() {}
int ha_federatedx_select_handler::init_scan()
diff --git a/storage/federatedx/federatedx_pushdown.h b/storage/federatedx/federatedx_pushdown.h
index a05759a4e4f..c3991266f4c 100644
--- a/storage/federatedx/federatedx_pushdown.h
+++ b/storage/federatedx/federatedx_pushdown.h
@@ -54,8 +54,7 @@ class ha_federatedx_select_handler: public select_handler
federatedx_io **iop;
FEDERATEDX_IO_RESULT *stored_result;
TABLE *query_table;
- char query_buff[4096];
- String query;
+ StringBuffer<512> query;
public:
ha_federatedx_select_handler(THD *thd_arg, SELECT_LEX *sel_lex,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment