1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-16316 Replace INT_ITEM references in the code behind ORDER, LIMIT, PROCEDURE clause

1. Adding new methods:
- Item::is_order_clause_position()
- Item_splocal::is_valid_limit_clause_variable_with_error()
- Type_handler::is_order_clause_position_type()
- is_limit_clause_valid_type()
and changing all tests related to the ORDER and LIMIT clauses
like "item->type()==INT_ITEM" to these new methods.

2. Adding a helper function prepare_param() in sql_analyse.cc
and replacing three pieces of duplicate code to prepare_param() calls.
Replacing the test "item->type()!=Item::INT_ITEM" to an equivalent
condition using item->basic_const_item() and type_handler()->result_type().
This commit is contained in:
Alexander Barkov
2018-05-29 13:28:48 +04:00
parent 637af78383
commit 840d46b04f
5 changed files with 67 additions and 41 deletions

View File

@ -1031,6 +1031,14 @@ public:
{
return false;
}
virtual bool is_order_clause_position_type() const
{
return false;
}
virtual bool is_limit_clause_valid_type() const
{
return false;
}
/**
Check whether a field type can be partially indexed by a key.
@param type field type
@ -1906,6 +1914,8 @@ class Type_handler_int_result: public Type_handler_numeric
public:
Item_result result_type() const { return INT_RESULT; }
Item_result cmp_type() const { return INT_RESULT; }
bool is_order_clause_position_type() const { return true; }
bool is_limit_clause_valid_type() const { return true; }
virtual ~Type_handler_int_result() {}
const Type_handler *type_handler_for_comparison() const;
bool subquery_type_allows_materialization(const Item *inner,