summaryrefslogtreecommitdiff
path: root/sql/sql_base.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2004-11-12 15:36:31 +0200
committerunknown <bell@sanja.is.com.ua>2004-11-12 15:36:31 +0200
commit067863e184e9a23034d410919d4c8075ee30bcee (patch)
treeab12f1be1300ed43430653785dd80f2a0e814d11 /sql/sql_base.cc
parent980a4188f384902b902f6b5bad2258e0e78df646 (diff)
parent9e921615a1c3147961dc4a8314ebb0e455ea105b (diff)
downloadmariadb-git-067863e184e9a23034d410919d4c8075ee30bcee.tar.gz
merge
include/mysqld_error.h: Auto merged libmysqld/lib_sql.cc: Auto merged mysql-test/r/rpl_charset.result: Auto merged mysql-test/r/sp.result: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/sp.test: Auto merged sql/filesort.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/handler.cc: Auto merged sql/item_cmpfunc.cc: Auto merged sql/item_func.cc: Auto merged sql/item_row.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/item_timefunc.cc: Auto merged sql/item_uniq.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysqld.cc: Auto merged sql/parse_file.cc: Auto merged sql/protocol.cc: Auto merged sql/protocol.h: Auto merged sql/protocol_cursor.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/repl_failsafe.h: Auto merged sql/set_var.cc: Auto merged sql/slave.cc: Auto merged sql/slave.h: Auto merged sql/sp.cc: Auto merged sql/sp_head.cc: Auto merged sql/sql_analyse.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_error.cc: Auto merged sql/sql_help.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_lex.cc: Auto merged sql/sql_lex.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_repl.h: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/share/czech/errmsg.txt: Auto merged sql/share/danish/errmsg.txt: Auto merged sql/share/dutch/errmsg.txt: Auto merged sql/share/english/errmsg.txt: Auto merged sql/share/estonian/errmsg.txt: Auto merged sql/share/french/errmsg.txt: Auto merged sql/share/german/errmsg.txt: Auto merged sql/share/greek/errmsg.txt: Auto merged sql/share/hungarian/errmsg.txt: Auto merged sql/share/italian/errmsg.txt: Auto merged sql/share/japanese/errmsg.txt: Auto merged sql/share/korean/errmsg.txt: Auto merged sql/share/norwegian-ny/errmsg.txt: Auto merged sql/share/norwegian/errmsg.txt: Auto merged sql/share/polish/errmsg.txt: Auto merged sql/share/portuguese/errmsg.txt: Auto merged sql/sql_udf.cc: Auto merged sql/sql_view.cc: Auto merged sql/table.cc: Auto merged sql/unireg.cc: Auto merged sql/share/romanian/errmsg.txt: Auto merged sql/share/russian/errmsg.txt: Auto merged sql/share/serbian/errmsg.txt: Auto merged sql/share/slovak/errmsg.txt: Auto merged sql/share/spanish/errmsg.txt: Auto merged sql/share/swedish/errmsg.txt: Auto merged sql/share/ukrainian/errmsg.txt: Auto merged
Diffstat (limited to 'sql/sql_base.cc')
-rw-r--r--sql/sql_base.cc96
1 files changed, 70 insertions, 26 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index eeb34f6b600..b32aa033209 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -1262,7 +1262,8 @@ bool reopen_tables(THD *thd,bool get_locks,bool in_refresh)
next=table->next;
if (!tables || (!db_stat && reopen_table(table,1)))
{
- my_error(ER_CANT_REOPEN_TABLE,MYF(0),table->table_name);
+ my_printf_error(ER_CANT_REOPEN_TABLE, ER(ER_CANT_REOPEN_TABLE),
+ MYF(0),table->table_name);
VOID(hash_delete(&open_cache,(byte*) table));
error=1;
}
@@ -1547,7 +1548,8 @@ static int open_unireg_entry(THD *thd, TABLE *entry, const char *db,
{
/* Give right error message */
thd->clear_error();
- my_error(ER_NOT_KEYFILE, MYF(0), name, my_errno);
+ my_printf_error(ER_NOT_KEYFILE, ER(ER_NOT_KEYFILE), MYF(0),
+ name, my_errno);
sql_print_error("Couldn't repair table: %s.%s",db,name);
if (entry->file)
closefrm(entry);
@@ -1612,7 +1614,8 @@ err:
{
TABLE_LIST * view= table_desc->belong_to_view;
thd->clear_error();
- my_error(ER_VIEW_INVALID, MYF(0), view->view_db.str, view->view_name.str);
+ my_printf_error(ER_VIEW_INVALID, ER(ER_VIEW_INVALID), MYF(0),
+ view->view_db.str, view->view_name.str);
}
DBUG_RETURN(1);
}
@@ -1853,15 +1856,14 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
tables - list of tables for open&locking
RETURN
- 0 - ok
- -1 - error
- 1 - error reported to user
+ FALSE - ok
+ TRUE - error
NOTE
The lock will automaticly be freed by close_thread_tables()
*/
-int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
+bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{
DBUG_ENTER("open_and_lock_tables");
uint counter;
@@ -1870,7 +1872,7 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
mysql_handle_derived(thd->lex, &mysql_derived_prepare) ||
(thd->fill_derived_tables() &&
mysql_handle_derived(thd->lex, &mysql_derived_filling)))
- DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */
+ DBUG_RETURN(TRUE); /* purecov: inspected */
relink_tables_for_multidelete(thd);
DBUG_RETURN(0);
}
@@ -2692,9 +2694,9 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
** Check that all given fields exists and fill struct with current data
****************************************************************************/
-int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
- List<Item> &fields, bool set_query_id,
- List<Item> *sum_func_list, bool allow_sum_func)
+bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
+ List<Item> &fields, bool set_query_id,
+ List<Item> *sum_func_list, bool allow_sum_func)
{
reg2 Item *item;
List_iterator<Item> it(fields);
@@ -2712,7 +2714,7 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
(item= *(it.ref()))->check_cols(1))
{
select_lex->no_wrap_view_item= 0;
- DBUG_RETURN(-1); /* purecov: inspected */
+ DBUG_RETURN(TRUE); /* purecov: inspected */
}
if (ref)
*(ref++)= item;
@@ -2820,8 +2822,9 @@ bool get_key_map_from_key_list(key_map *map, TABLE *table,
(pos= find_type(&table->keynames, name->ptr(), name->length(), 1)) <=
0)
{
- my_error(ER_KEY_COLUMN_DOES_NOT_EXITS, MYF(0), name->c_ptr(),
- table->real_name);
+ my_printf_error(ER_KEY_COLUMN_DOES_NOT_EXITS,
+ ER(ER_KEY_COLUMN_DOES_NOT_EXITS), MYF(0),
+ name->c_ptr(), table->real_name);
map->set_all();
return 1;
}
@@ -3037,9 +3040,10 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
DBUG_RETURN(0);
if (!table_name)
- my_error(ER_NO_TABLES_USED, MYF(0));
+ my_message(ER_NO_TABLES_USED, ER(ER_NO_TABLES_USED), MYF(0));
else
- my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name);
+ my_printf_error(ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR), MYF(0),
+ table_name);
err:
DBUG_RETURN(1);
@@ -3261,8 +3265,25 @@ err_no_arena:
** Returns : 1 if some field has wrong type
******************************************************************************/
-int
-fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
+
+/*
+ Fill fields with given items.
+
+ SYNOPSIS
+ fill_record()
+ thd thread handler
+ fields Item_fields list to be filled
+ values values to fill with
+ ignore_errors TRUE if we should ignore errors
+
+ RETURN
+ FALSE OK
+ TRUE error occured
+*/
+
+bool
+fill_record(THD * thd, List<Item> &fields, List<Item> &values,
+ bool ignore_errors)
{
List_iterator_fast<Item> f(fields),v(values);
Item *value;
@@ -3277,14 +3298,32 @@ fill_record(List<Item> &fields,List<Item> &values, bool ignore_errors)
if (rfield == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(rfield, 0) < 0) && !ignore_errors)
- DBUG_RETURN(1);
+ {
+ my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
+ DBUG_RETURN(TRUE);
+ }
}
- DBUG_RETURN(0);
+ DBUG_RETURN(thd->net.report_error);
}
-int
-fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
+/*
+ Fill field buffer with values from Field list
+
+ SYNOPSIS
+ fill_record()
+ thd thread handler
+ ptr pointer on pointer to record
+ values list of fields
+ ignore_errors TRUE if we should ignore errors
+
+ RETURN
+ FALSE OK
+ TRUE error occured
+*/
+
+bool
+fill_record(THD *thd, Field **ptr, List<Item> &values, bool ignore_errors)
{
List_iterator_fast<Item> v(values);
Item *value;
@@ -3298,9 +3337,12 @@ fill_record(Field **ptr,List<Item> &values, bool ignore_errors)
if (field == table->next_number_field)
table->auto_increment_field_not_null= TRUE;
if ((value->save_in_field(field, 0) < 0) && !ignore_errors)
- DBUG_RETURN(1);
+ {
+ my_message(ER_UNKNOWN_ERROR, ER(ER_UNKNOWN_ERROR), MYF(0));
+ DBUG_RETURN(TRUE);
+ }
}
- DBUG_RETURN(0);
+ DBUG_RETURN(thd->net.report_error);
}
@@ -3531,7 +3573,8 @@ open_new_frm(const char *path, const char *alias,
{
if (table_desc == 0 || table_desc->required_type == FRMTYPE_TABLE)
{
- my_error(ER_WRONG_OBJECT, MYF(0), db, table_name, "BASE TABLE");
+ my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0),
+ db, table_name, "BASE TABLE");
goto err;
}
if (mysql_make_view(parser, table_desc))
@@ -3540,7 +3583,8 @@ open_new_frm(const char *path, const char *alias,
else
{
/* only VIEWs are supported now */
- my_error(ER_FRM_UNKNOWN_TYPE, MYF(0), path, parser->type()->str);
+ my_printf_error(ER_FRM_UNKNOWN_TYPE, ER(ER_FRM_UNKNOWN_TYPE), MYF(0),
+ path, parser->type()->str);
goto err;
}
DBUG_RETURN(0);