diff options
author | unknown <bell@sanja.is.com.ua> | 2004-11-13 19:45:36 +0200 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-11-13 19:45:36 +0200 |
commit | ac0cd2d3acd756b6917b7ea57d20ad5ea88b1999 (patch) | |
tree | ef0605aeb29c8a09b24a3c1988d69549494a8fab /sql/sql_select.cc | |
parent | 7281d2e3ae7665f442dc07124b365b5fae190a24 (diff) | |
parent | 8d71bcec217bead7d832d6ea4dca437c5f134577 (diff) | |
download | mariadb-git-ac0cd2d3acd756b6917b7ea57d20ad5ea88b1999.tar.gz |
marge
sql/ha_innodb.cc:
Auto merged
sql/ha_innodb.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/log.cc:
Auto merged
sql/mysqld.cc:
Auto merged
sql/sql_acl.cc:
Auto merged
sql/sql_base.cc:
Auto merged
sql/sql_delete.cc:
Auto merged
sql/sql_lex.cc:
Auto merged
sql/share/french/errmsg.txt:
Auto merged
sql/share/greek/errmsg.txt:
Auto merged
sql/sql_lex.h:
Auto merged
sql/sql_select.cc:
Auto merged
sql/sql_table.cc:
Auto merged
sql/sql_view.cc:
Auto merged
sql/sql_yacc.yy:
Auto merged
sql/table.cc:
Auto merged
sql/share/portuguese/errmsg.txt:
Auto merged
sql/share/romanian/errmsg.txt:
Auto merged
sql/share/serbian/errmsg.txt:
Auto merged
sql/share/spanish/errmsg.txt:
Auto merged
sql/share/swedish/errmsg.txt:
Auto merged
sql/mysql_priv.h:
merge
sql/sql_parse.cc:
merge
sql/sql_show.cc:
merge
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r-- | sql/sql_select.cc | 82 |
1 files changed, 42 insertions, 40 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3c7f1032f51..977e8c5c9ca 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -205,9 +205,9 @@ static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab); This handles SELECT with and without UNION */ -int handle_select(THD *thd, LEX *lex, select_result *result) +bool handle_select(THD *thd, LEX *lex, select_result *result) { - int res; + bool res; register SELECT_LEX *select_lex = &lex->select_lex; DBUG_ENTER("handle_select"); @@ -232,11 +232,14 @@ int handle_select(THD *thd, LEX *lex, select_result *result) } DBUG_PRINT("info",("res: %d report_error: %d", res, thd->net.report_error)); - if (thd->net.report_error || res < 0) + res|= thd->net.report_error; + if (unlikely(res)) { - result->send_error(0, NullS); + /* + If we have real error reported erly then this will be ignored + */ + result->send_error(ER_UNKNOWN_ERROR, NullS); result->abort(); - res= 1; // Error sent to client } DBUG_RETURN(res); } @@ -374,7 +377,8 @@ JOIN::prepare(Item ***rref_pointer_array, } if (flag == 3) { - my_error(ER_MIX_OF_GROUP_FUNC_AND_FIELDS,MYF(0)); + my_message(ER_MIX_OF_GROUP_FUNC_AND_FIELDS, + ER(ER_MIX_OF_GROUP_FUNC_AND_FIELDS), MYF(0)); DBUG_RETURN(-1); } } @@ -401,21 +405,22 @@ JOIN::prepare(Item ***rref_pointer_array, { if (!test_if_subpart(procedure->group,group_list)) { /* purecov: inspected */ - my_message(0,"Can't handle procedures with differents groups yet", - MYF(0)); /* purecov: inspected */ + my_message(ER_DIFF_GROUPS_PROC, ER(ER_DIFF_GROUPS_PROC), + MYF(0)); /* purecov: inspected */ goto err; /* purecov: inspected */ } } #ifdef NOT_NEEDED else if (!group_list && procedure->flags & PROC_GROUP) { - my_message(0,"Select must have a group with this procedure",MYF(0)); + my_message(ER_NO_GROUP_FOR_PROC, MYF(0)); goto err; } #endif if (order && (procedure->flags & PROC_NO_SORT)) { /* purecov: inspected */ - my_message(0,"Can't use order with this procedure",MYF(0)); /* purecov: inspected */ + my_message(ER_ORDER_WITH_PROC, ER(ER_ORDER_WITH_PROC), + MYF(0)); /* purecov: inspected */ goto err; /* purecov: inspected */ } } @@ -1809,7 +1814,7 @@ Cursor::fetch(ulong num_rows) if (thd->killed) /* Aborted by user */ { - my_error(ER_SERVER_SHUTDOWN,MYF(0)); + my_message(ER_SERVER_SHUTDOWN, ER(ER_SERVER_SHUTDOWN), MYF(0)); return -1; } @@ -1884,7 +1889,7 @@ Cursor::fetch(ulong num_rows) thd->server_status&= ~SERVER_STATUS_LAST_ROW_SENT; } else - send_error(thd, ER_OUT_OF_RESOURCES); + my_message(ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES), MYF(0)); /* free cursor memory */ free_items(free_list); free_list= 0; @@ -1946,7 +1951,7 @@ Cursor::~Cursor() /*********************************************************************/ -int +bool mysql_select(THD *thd, Item ***rref_pointer_array, TABLE_LIST *tables, uint wild_num, List<Item> &fields, COND *conds, uint og_num, ORDER *order, ORDER *group, @@ -1954,7 +1959,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, select_result *result, SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex) { - int err; + bool err; bool free_join= 1; DBUG_ENTER("mysql_select"); @@ -1962,7 +1967,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array, if (select_lex->join != 0) { join= select_lex->join; - // is it single SELECT in derived table, called in derived table creation + /* + is it single SELECT in derived table, called in derived table + creation + */ if (select_lex->linkage != DERIVED_TABLE_TYPE || (select_options & SELECT_DESCRIBE)) { @@ -1971,7 +1979,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, //here is EXPLAIN of subselect or derived table if (join->change_result(result)) { - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } } else @@ -1990,7 +1998,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array, else { if (!(join= new JOIN(thd, fields, select_options, result))) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); thd->proc_info="init"; thd->used_tables=0; // Updated by setup_fields if (join->prepare(rref_pointer_array, tables, wild_num, @@ -2038,10 +2046,8 @@ err: { thd->proc_info="end"; err= join->cleanup(); - if (thd->net.report_error) - err= -1; delete join; - DBUG_RETURN(err); + DBUG_RETURN(err || thd->net.report_error); } DBUG_RETURN(join->error); } @@ -2200,7 +2206,7 @@ make_join_statistics(JOIN *join,TABLE_LIST *tables,COND *conds, if (s->dependent & s->table->map) { join->tables=0; // Don't use join->table - my_error(ER_WRONG_OUTER_JOIN,MYF(0)); + my_message(ER_WRONG_OUTER_JOIN, ER(ER_WRONG_OUTER_JOIN), MYF(0)); DBUG_RETURN(1); } s->key_dependent= s->dependent; @@ -5622,7 +5628,8 @@ bool error_if_full_join(JOIN *join) { if (tab->type == JT_ALL && (!tab->select || !tab->select->quick)) { - my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE,MYF(0)); + my_message(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, + ER(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE), MYF(0)); return(1); } } @@ -10726,7 +10733,7 @@ static int remove_dup_with_compare(THD *thd, TABLE *table, Field **first_field, } if (copy_blobs(first_field)) { - my_error(ER_OUTOFMEMORY,MYF(0)); + my_message(ER_OUTOFMEMORY, ER(ER_OUTOFMEMORY), MYF(0)); error=0; goto err; } @@ -11222,8 +11229,8 @@ find_order_in_list(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, uint count= (uint) order_item->val_int(); if (!count || count > fields.elements) { - my_printf_error(ER_BAD_FIELD_ERROR,ER(ER_BAD_FIELD_ERROR), - MYF(0), order_item->full_name(), thd->where); + my_error(ER_BAD_FIELD_ERROR, MYF(0), + order_item->full_name(), thd->where); return 1; } order->item= ref_pointer_array + count - 1; @@ -11373,8 +11380,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, (*order->item)->marker=1; /* Mark found */ if ((*order->item)->with_sum_func) { - my_printf_error(ER_WRONG_GROUP_FIELD, ER(ER_WRONG_GROUP_FIELD),MYF(0), - (*order->item)->full_name()); + my_error(ER_WRONG_GROUP_FIELD, MYF(0), (*order->item)->full_name()); return 1; } } @@ -11389,9 +11395,7 @@ setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, if (item->type() != Item::SUM_FUNC_ITEM && !item->marker && !item->const_item()) { - my_printf_error(ER_WRONG_FIELD_WITH_GROUP, - ER(ER_WRONG_FIELD_WITH_GROUP), - MYF(0),item->full_name()); + my_error(ER_WRONG_FIELD_WITH_GROUP, MYF(0), item->full_name()); return 1; } } @@ -12745,10 +12749,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order, } -int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) +bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) { DBUG_ENTER("mysql_explain_union"); - int res= 0; + bool res= 0; SELECT_LEX *first= unit->first_select(); for (SELECT_LEX *sl= first; @@ -12799,9 +12803,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result) first->options | thd->options | SELECT_DESCRIBE, result, unit, first); } - if (res > 0 || thd->net.report_error) - res= -1; // mysql_explain_select do not report error - DBUG_RETURN(res); + DBUG_RETURN(res || thd->net.report_error); } @@ -13020,17 +13022,17 @@ void st_select_lex::print(THD *thd, String *str) res new select_result object RETURN - 0 - OK - -1 - error + FALSE - OK + TRUE - error */ -int JOIN::change_result(select_result *res) +bool JOIN::change_result(select_result *res) { DBUG_ENTER("JOIN::change_result"); result= res; if (!procedure && result->prepare(fields_list, select_lex->master_unit())) { - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } |