summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc54
1 files changed, 49 insertions, 5 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 5967a4a452a..807fcd3ba12 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1352,7 +1352,7 @@ void lex_unlock_plugins(LEX *lex)
/* release used plugins */
if (lex->plugins.elements) /* No function call and no mutex if no plugins. */
{
- plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
+ plugin_unlock_list(0, (plugin_ref*)lex->plugins.buffer,
lex->plugins.elements);
}
reset_dynamic(&lex->plugins);
@@ -6054,8 +6054,10 @@ int st_select_lex_unit::save_union_explain_part2(Explain_query *output)
bool LEX::is_partition_management() const
{
return (sql_command == SQLCOM_ALTER_TABLE &&
- (alter_info.partition_flags == ALTER_PARTITION_ADD ||
- alter_info.partition_flags == ALTER_PARTITION_REORGANIZE));
+ (alter_info.partition_flags & (ALTER_PARTITION_ADD |
+ ALTER_PARTITION_CONVERT_IN |
+ ALTER_PARTITION_CONVERT_OUT |
+ ALTER_PARTITION_REORGANIZE)));
}
@@ -7140,6 +7142,27 @@ bool LEX::sp_declare_cursor(THD *thd, const LEX_CSTRING *name,
uint offp;
sp_instr_cpush *i;
+ /* In some cases param_ctx can be NULL. e.g.: FOR rec IN (SELECT...) */
+ if (param_ctx)
+ {
+ for (uint prm= 0; prm < param_ctx->context_var_count(); prm++)
+ {
+ const sp_variable *param= param_ctx->get_context_variable(prm);
+ if (param->mode != sp_variable::MODE_IN)
+ {
+ /*
+ PL/SQL supports the IN keyword in cursor parameters.
+ We also support this for compatibility. Note, OUT/INOUT parameters
+ will unlikely be ever supported. So "YET" may sound confusing here.
+ But it should be better than using a generic error. Adding a dedicated
+ error message for this small issue is not desirable.
+ */
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "OUT/INOUT cursor parameter");
+ return true;
+ }
+ }
+ }
+
if (spcont->find_cursor(name, &offp, true))
{
my_error(ER_SP_DUP_CURS, MYF(0), name->str);
@@ -9698,6 +9721,7 @@ bool Lex_ident_sys_st::to_size_number(ulonglong *to) const
}
+#ifdef WITH_PARTITION_STORAGE_ENGINE
bool LEX::part_values_current(THD *thd)
{
partition_element *elem= part_info->curr_part_elem;
@@ -9705,7 +9729,7 @@ bool LEX::part_values_current(THD *thd)
{
if (unlikely(part_info->part_type != VERSIONING_PARTITION))
{
- my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
+ part_type_error(thd, NULL, "SYSTEM_TIME", part_info);
return true;
}
}
@@ -9732,7 +9756,7 @@ bool LEX::part_values_history(THD *thd)
{
if (unlikely(part_info->part_type != VERSIONING_PARTITION))
{
- my_error(ER_PARTITION_WRONG_TYPE, MYF(0), "SYSTEM_TIME");
+ part_type_error(thd, NULL, "SYSTEM_TIME", part_info);
return true;
}
}
@@ -9753,6 +9777,7 @@ bool LEX::part_values_history(THD *thd)
elem->type= partition_element::HISTORY;
return false;
}
+#endif /* WITH_PARTITION_STORAGE_ENGINE */
bool LEX::last_field_generated_always_as_row_start_or_end(Lex_ident *p,
@@ -11327,6 +11352,25 @@ bool LEX::stmt_alter_table_exchange_partition(Table_ident *table)
}
+bool LEX::stmt_alter_table(Table_ident *table)
+{
+ DBUG_ASSERT(sql_command == SQLCOM_ALTER_TABLE);
+ first_select_lex()->db= table->db;
+ if (first_select_lex()->db.str == NULL &&
+ copy_db_to(&first_select_lex()->db))
+ return true;
+ if (unlikely(check_table_name(table->table.str, table->table.length,
+ false)) ||
+ (table->db.str && unlikely(check_db_name((LEX_STRING*) &table->db))))
+ {
+ my_error(ER_WRONG_TABLE_NAME, MYF(0), table->table.str);
+ return true;
+ }
+ name= table->table;
+ return false;
+}
+
+
void LEX::stmt_purge_to(const LEX_CSTRING &to)
{
type= 0;