mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-5.0 mysql-test/r/view.result: Auto merged sql/item.cc: Auto merged sql/item.h: Auto merged sql/sp_head.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_prepare.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.h: Auto merged
This commit is contained in:
@ -225,25 +225,18 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
|
||||
thd->net.report_error));
|
||||
if (thd->net.report_error)
|
||||
res= 1;
|
||||
if (res > 0)
|
||||
if (unlikely(res))
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
result->send_error(0, NullS);
|
||||
if (res > 0)
|
||||
result->send_error(0, NullS);
|
||||
result->abort();
|
||||
}
|
||||
else
|
||||
else if (res > 0)
|
||||
send_error(thd, 0, NullS);
|
||||
res= 1; // Error sent to client
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
if (result)
|
||||
{
|
||||
result->abort();
|
||||
}
|
||||
res= 1;
|
||||
}
|
||||
if (result != lex->result)
|
||||
delete result;
|
||||
DBUG_RETURN(res);
|
||||
@ -348,9 +341,7 @@ JOIN::prepare(Item ***rref_pointer_array,
|
||||
if ((subselect= select_lex->master_unit()->item))
|
||||
{
|
||||
Item_subselect::trans_res res;
|
||||
if ((res= ((!thd->lex->view_prepare_mode) ?
|
||||
subselect->select_transformer(this) :
|
||||
subselect->no_select_transform())) !=
|
||||
if ((res= subselect->select_transformer(this)) !=
|
||||
Item_subselect::RES_OK)
|
||||
{
|
||||
select_lex->fix_prepare_information(thd, &conds);
|
||||
@ -552,6 +543,7 @@ JOIN::optimize()
|
||||
if (cond_value == Item::COND_FALSE ||
|
||||
(!unit->select_limit_cnt && !(select_options & OPTION_FOUND_ROWS)))
|
||||
{ /* Impossible cond */
|
||||
DBUG_PRINT("info", ("Impossible WHERE"));
|
||||
zero_result_cause= "Impossible WHERE";
|
||||
error= 0;
|
||||
DBUG_RETURN(0);
|
||||
@ -569,20 +561,24 @@ JOIN::optimize()
|
||||
{
|
||||
if (res > 1)
|
||||
{
|
||||
DBUG_PRINT("error",("Error from opt_sum_query"));
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
if (res < 0)
|
||||
{
|
||||
DBUG_PRINT("info",("No matching min/max row"));
|
||||
zero_result_cause= "No matching min/max row";
|
||||
error=0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
DBUG_PRINT("info",("Select tables optimized away"));
|
||||
zero_result_cause= "Select tables optimized away";
|
||||
tables_list= 0; // All tables resolved
|
||||
}
|
||||
}
|
||||
if (!tables_list)
|
||||
{
|
||||
DBUG_PRINT("info",("No tables"));
|
||||
error= 0;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
@ -11570,7 +11566,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
|
||||
SYNOPSIS
|
||||
print_join()
|
||||
thd thread handler
|
||||
str string where table should bbe printed
|
||||
str string where table should be printed
|
||||
tables list of tables in join
|
||||
*/
|
||||
|
||||
@ -11626,30 +11622,31 @@ void st_table_list::print(THD *thd, String *str)
|
||||
print_join(thd, str, &nested_join->join_list);
|
||||
str->append(')');
|
||||
}
|
||||
else if (view_name.str)
|
||||
{
|
||||
append_identifier(thd, str, view_db.str, view_db.length);
|
||||
str->append('.');
|
||||
append_identifier(thd, str, view_name.str, view_name.length);
|
||||
if (my_strcasecmp(table_alias_charset, view_name.str, alias))
|
||||
{
|
||||
str->append(' ');
|
||||
append_identifier(thd, str, alias, strlen(alias));
|
||||
}
|
||||
}
|
||||
else if (derived)
|
||||
{
|
||||
str->append('(');
|
||||
derived->print(str);
|
||||
str->append(") ", 2);
|
||||
append_identifier(thd, str, alias, strlen(alias));
|
||||
}
|
||||
else
|
||||
{
|
||||
append_identifier(thd, str, db, db_length);
|
||||
str->append('.');
|
||||
append_identifier(thd, str, real_name, real_name_length);
|
||||
if (my_strcasecmp(table_alias_charset, real_name, alias))
|
||||
const char *cmp_name; // Name to compare with alias
|
||||
if (view_name.str)
|
||||
{
|
||||
append_identifier(thd, str, view_db.str, view_db.length);
|
||||
str->append('.');
|
||||
append_identifier(thd, str, view_name.str, view_name.length);
|
||||
cmp_name= view_name.str;
|
||||
}
|
||||
else if (derived)
|
||||
{
|
||||
str->append('(');
|
||||
derived->print(str);
|
||||
str->append(')');
|
||||
cmp_name= ""; // Force printing of alias
|
||||
}
|
||||
else
|
||||
{
|
||||
append_identifier(thd, str, db, db_length);
|
||||
str->append('.');
|
||||
append_identifier(thd, str, real_name, real_name_length);
|
||||
cmp_name= real_name;
|
||||
}
|
||||
if (my_strcasecmp(table_alias_charset, cmp_name, alias))
|
||||
{
|
||||
str->append(' ');
|
||||
append_identifier(thd, str, alias, strlen(alias));
|
||||
@ -11665,7 +11662,7 @@ void st_select_lex::print(THD *thd, String *str)
|
||||
|
||||
str->append("select ", 7);
|
||||
|
||||
//options
|
||||
/* First add options */
|
||||
if (options & SELECT_STRAIGHT_JOIN)
|
||||
str->append("straight_join ", 14);
|
||||
if ((thd->lex->lock_option == TL_READ_HIGH_PRIORITY) &&
|
||||
|
Reference in New Issue
Block a user