From 066c90563a9fd6151461a5d54d879079acffe279 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 20 Oct 2004 04:04:37 +0300 Subject: errors without code removed net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed (WL#2133) include/mysqld_error.h: new errors added. mysql-test/r/rpl_charset.result: new error mysql-test/r/rpl_timezone.result: new error mysql-test/r/sp-security.result: more clean error message mysql-test/r/sp.result: now error state intercepted correctly mysql-test/t/connect.test: new error message mysql-test/t/rpl_charset.test: new error message mysql-test/t/rpl_timezone.test: new error mysql-test/t/sp-security.test: more correct error handling mysql-test/t/sp.test: now error state intercepted correctly sql/ha_innodb.cc: -1/1 (sent/unsent) error reporting removed sql/ha_innodb.h: -1/1 (sent/unsent) error reporting removed sql/item.cc: only boolean values should be returned by fix_fields() sql/item_cmpfunc.cc: only boolean values should be returned by fix_fields() sql/item_func.cc: only boolean values should be returned by fix_fields() net_printf/send_error calls replaced by my_error family functions sql/item_row.cc: only boolean values should be returned by fix_fields() sql/item_subselect.cc: only boolean values should be returned by fix_fields() -1/1 (sent/unsent) error reporting removed sql/item_subselect.h: -1/1 (sent/unsent) error reporting removed sql/item_sum.cc: only boolean values should be returned by fix_fields() sql/item_timefunc.cc: only boolean values should be returned by fix_fields() sql/item_uniq.h: only boolean values should be returned by fix_fields() sql/mysql_priv.h: -1/1 (sent/unsent) error reporting removed sql/mysqld.cc: net_printf/send_error calls replaced by my_error family functions changes in my_message_sql to support error handling correctly sql/protocol.cc: net_printf/send_error calls replaced by my_error family functions sql/protocol_cursor.cc: net_printf/send_error calls replaced by my_error family functions sql/repl_failsafe.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/repl_failsafe.h: -1/1 (sent/unsent) error reporting removed sql/set_var.cc: net_printf/send_error calls replaced by my_error family functions sql/share/czech/errmsg.txt: new error messages sql/share/danish/errmsg.txt: new error messages sql/share/dutch/errmsg.txt: new error messages sql/share/english/errmsg.txt: new error messages sql/share/estonian/errmsg.txt: new error messages sql/share/french/errmsg.txt: new error messages sql/share/german/errmsg.txt: new error messages sql/share/greek/errmsg.txt: new error messages sql/share/hungarian/errmsg.txt: new error messages sql/share/italian/errmsg.txt: new error messages sql/share/japanese/errmsg.txt: new error messages sql/share/korean/errmsg.txt: new error messages sql/share/norwegian-ny/errmsg.txt: new error messages sql/share/norwegian/errmsg.txt: new error messages sql/share/polish/errmsg.txt: new error messages sql/share/portuguese/errmsg.txt: new error messages sql/share/romanian/errmsg.txt: new error messages sql/share/russian/errmsg.txt: new error messages sql/share/serbian/errmsg.txt: new error messages sql/share/slovak/errmsg.txt: new error messages sql/share/spanish/errmsg.txt: new error messages sql/share/swedish/errmsg.txt: new error messages sql/share/ukrainian/errmsg.txt: new error messages sql/slave.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/slave.h: -1/1 (sent/unsent) error reporting removed sql/sp.cc: net_printf/send_error calls replaced by my_error family functions sql/sp_head.cc: new eror handling support net_printf/send_error calls replaced by my_error family functions sql/sp_rcontext.cc: net_printf/send_error calls replaced by my_error family functions sql/sql_acl.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/sql_acl.h: -1/1 (sent/unsent) error reporting removed sql/sql_base.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_class.cc: net_printf/send_error calls replaced by my_error family functions sql/sql_class.h: my_messhage_sql now set/reset query_error flag sql/sql_db.cc: -1/1 (sent/unsent) error reporting removed sql/sql_delete.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_do.cc: -1/1 (sent/unsent) error reporting removed sql/sql_error.cc: -1/1 (sent/unsent) error reporting removed sql/sql_handler.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_help.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/sql_insert.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_lex.h: -1/1 (sent/unsent) error reporting removed sql/sql_load.cc: -1/1 (sent/unsent) error reporting removed sql/sql_map.cc: errors without code removed sql/sql_parse.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed from mysql_execute_command sql/sql_prepare.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/sql_repl.cc: error messages fixed net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/sql_repl.h: -1/1 (sent/unsent) error reporting removed sql/sql_select.cc: -1/1 (sent/unsent) error reporting removed sql/sql_select.h: -1/1 (sent/unsent) error reporting removed sql/sql_show.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_table.cc: net_printf/send_error calls replaced by my_error family functions -1/1 (sent/unsent) error reporting removed sql/sql_trigger.cc: -1/1 (sent/unsent) error reporting removed sql/sql_udf.cc: net_printf/send_error calls replaced by my_error family functions sql/sql_union.cc: -1/1 (sent/unsent) error reporting removed sql/sql_update.cc: -1/1 (sent/unsent) error reporting removed net_printf/send_error calls replaced by my_error family functions sql/sql_view.cc: -1/1 (sent/unsent) error reporting removed sql/sql_view.h: -1/1 (sent/unsent) error reporting removed sql/sql_yacc.yy: net_printf/send_error calls replaced by my_error family functions --- sql/sql_show.cc | 200 ++++++++++++++++++++++++++------------------------------ 1 file changed, 93 insertions(+), 107 deletions(-) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 14bef9d2236..b9c2a5d8e18 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -48,7 +48,7 @@ view_store_create_info(THD *thd, TABLE_LIST *table, String *packet); A database is a directory in the mysql_data_home directory */ -int +bool mysqld_show_dbs(THD *thd,const char *wild) { Item_string *field=new Item_string("",0,thd->charset()); @@ -68,9 +68,9 @@ mysqld_show_dbs(THD *thd,const char *wild) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); if (mysql_find_files(thd,&files,NullS,mysql_data_home,wild,1)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); List_iterator_fast it(files); while ((file_name=it++)) @@ -84,11 +84,11 @@ mysqld_show_dbs(THD *thd,const char *wild) protocol->prepare_for_resend(); protocol->store(file_name, system_charset_info); if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -96,7 +96,7 @@ mysqld_show_dbs(THD *thd,const char *wild) List all open tables in a database ***************************************************************************/ -int mysqld_show_open_tables(THD *thd,const char *wild) +bool mysqld_show_open_tables(THD *thd,const char *wild) { List field_list; OPEN_TABLE_LIST *open_list; @@ -110,10 +110,10 @@ int mysqld_show_open_tables(THD *thd,const char *wild) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); if (!(open_list=list_open_tables(thd,wild)) && thd->is_fatal_error) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); for (; open_list ; open_list=open_list->next) { @@ -124,11 +124,11 @@ int mysqld_show_open_tables(THD *thd,const char *wild) protocol->store_tiny((longlong) open_list->locked); if (protocol->write()) { - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -137,7 +137,7 @@ int mysqld_show_open_tables(THD *thd,const char *wild) ** A table is a .frm file in the current databasedir ***************************************************************************/ -int mysqld_show_tables(THD *thd, const char *db, const char *wild, +bool mysqld_show_tables(THD *thd, const char *db, const char *wild, bool show_type) { Item_string *field=new Item_string("",0,thd->charset()); @@ -162,10 +162,9 @@ int mysqld_show_tables(THD *thd, const char *db, const char *wild, if (show_type) field_list.push_back(new Item_empty_string("table_type", 10)); if (protocol->send_fields(&field_list, - Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); - if (mysql_find_files(thd,&files,db,path,wild,0)) - DBUG_RETURN(-1); + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) || + mysql_find_files(thd,&files,db,path,wild,0)) + DBUG_RETURN(TRUE); List_iterator_fast it(files); while ((file_name=it++)) { @@ -190,17 +189,17 @@ int mysqld_show_tables(THD *thd, const char *db, const char *wild, } } if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } /*************************************************************************** ** List all table types supported ***************************************************************************/ -int mysqld_show_storage_engines(THD *thd) +bool mysqld_show_storage_engines(THD *thd) { List field_list; Protocol *protocol= thd->protocol; @@ -212,7 +211,7 @@ int mysqld_show_storage_engines(THD *thd) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); const char *default_type_name= ha_get_storage_engine((enum db_type)thd->variables.table_type); @@ -230,10 +229,10 @@ int mysqld_show_storage_engines(THD *thd) protocol->store(option_name, system_charset_info); protocol->store(types->comment, system_charset_info); if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -275,7 +274,7 @@ static struct show_privileges_st sys_privileges[]= {NullS, NullS, NullS} }; -int mysqld_show_privileges(THD *thd) +bool mysqld_show_privileges(THD *thd) { List field_list; Protocol *protocol= thd->protocol; @@ -287,7 +286,7 @@ int mysqld_show_privileges(THD *thd) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); show_privileges_st *privilege= sys_privileges; for (privilege= sys_privileges; privilege->privilege ; privilege++) @@ -297,10 +296,10 @@ int mysqld_show_privileges(THD *thd) protocol->store(privilege->context, system_charset_info); protocol->store(privilege->comment, system_charset_info); if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -340,7 +339,7 @@ static struct show_column_type_st sys_column_types[]= "A very small integer"}, }; -int mysqld_show_column_types(THD *thd) +bool mysqld_show_column_types(THD *thd) { List field_list; Protocol *protocol= thd->protocol; @@ -363,7 +362,7 @@ int mysqld_show_column_types(THD *thd) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); /* TODO: Change the loop to not use 'i' */ for (uint i=0; i < sizeof(sys_column_types)/sizeof(sys_column_types[0]); i++) @@ -384,10 +383,10 @@ int mysqld_show_column_types(THD *thd) protocol->store(sys_column_types[i].default_value, system_charset_info); protocol->store(sys_column_types[i].comment, system_charset_info); if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -486,7 +485,7 @@ mysql_find_files(THD *thd,List *files, const char *db,const char *path, Extended version of mysqld_show_tables ***************************************************************************/ -int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) +bool mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) { Item *item; List files; @@ -496,7 +495,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) TABLE *table; Protocol *protocol= thd->protocol; TIME time; - int res; + bool res; DBUG_ENTER("mysqld_extend_show_tables"); (void) sprintf(path,"%s/%s",mysql_data_home,db); @@ -537,11 +536,9 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) field_list.push_back(item=new Item_empty_string("Comment",80)); item->maybe_null=1; if (protocol->send_fields(&field_list, - Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); - - if (mysql_find_files(thd,&files,db,path,wild,0)) - DBUG_RETURN(-1); + Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) || + mysql_find_files(thd,&files,db,path,wild,0)) + DBUG_RETURN(TRUE); List_iterator_fast it(files); while ((file_name=it++)) { @@ -558,14 +555,12 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) { for (uint i=2 ; i < field_list.elements ; i++) protocol->store_null(); - // Send error to Comment field if possible - if (res < 0) + // Send error to Comment field + if (res) { protocol->store(thd->net.last_error, system_charset_info); thd->clear_error(); } - else - DBUG_RETURN(1); } else if (table_list.view) { @@ -680,10 +675,10 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) } close_thread_tables(thd, 0); if (protocol->write()) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -691,7 +686,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild) ** List all columns in a table_list->real_name ***************************************************************************/ -int +bool mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, bool verbose) { @@ -707,11 +702,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, table_list->real_name)); table_list->lock_type= TL_UNLOCK; - if ((res= open_and_lock_tables(thd, table_list))) + if (open_and_lock_tables(thd, table_list)) { - if (res < 0) - send_error(thd); - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } table= table_list->table; file=table->file; @@ -737,7 +730,7 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, // Send first number of fields and records if (protocol->send_records_num(&field_list, (ulonglong)file->records) || protocol->send_fields(&field_list, Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); restore_record(table,default_values); // Get empty record Field **ptr,*field; @@ -844,16 +837,16 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, system_charset_info); } if (protocol->write()) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } } } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } -int +bool mysqld_show_create(THD *thd, TABLE_LIST *table_list) { TABLE *table; @@ -866,18 +859,16 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) table_list->real_name)); /* Only one table for now, but VIEW can involve several tables */ - if ((res= open_and_lock_tables(thd, table_list))) + if (open_and_lock_tables(thd, table_list)) { - if (res < 0) - send_error(thd); - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } /* TODO: add environment variables show when it become possible */ if (thd->lex->only_view && !table_list->view) { my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, table_list->real_name, "VIEW"); - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } table= table_list->table; @@ -885,7 +876,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) if ((table_list->view ? view_store_create_info(thd, table_list, &buffer) : store_create_info(thd, table, &buffer))) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); List field_list; if (table_list->view) @@ -904,31 +895,31 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); protocol->prepare_for_resend(); buffer.length(0); if (table_list->view) { protocol->store(table_list->view_name.str, system_charset_info); if (view_store_create_info(thd, table_list, &buffer)) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } else { protocol->store(table->table_name, system_charset_info); if (store_create_info(thd, table, &buffer)) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); } protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); if (protocol->write()) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } -int mysqld_show_create_db(THD *thd, char *dbname, - HA_CREATE_INFO *create_info) +bool mysqld_show_create_db(THD *thd, char *dbname, + HA_CREATE_INFO *create_info) { int length; char path[FN_REFLEN]; @@ -945,8 +936,8 @@ int mysqld_show_create_db(THD *thd, char *dbname, if (check_db_name(dbname)) { - net_printf(thd,ER_WRONG_DB_NAME, dbname); - DBUG_RETURN(1); + my_error(ER_WRONG_DB_NAME, MYF(0), dbname); + DBUG_RETURN(TRUE); } #ifndef NO_EMBEDDED_ACCESS_CHECKS @@ -957,11 +948,11 @@ int mysqld_show_create_db(THD *thd, char *dbname, thd->master_access); if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) { - net_printf(thd,ER_DBACCESS_DENIED_ERROR, - thd->priv_user, thd->host_or_ip, dbname); + my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), + thd->priv_user, thd->host_or_ip, dbname); mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), thd->priv_user, thd->host_or_ip, dbname); - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } #endif @@ -975,8 +966,8 @@ int mysqld_show_create_db(THD *thd, char *dbname, } if (access(path,F_OK)) { - net_printf(thd,ER_BAD_DB_ERROR,dbname); - DBUG_RETURN(1); + my_error(ER_BAD_DB_ERROR, MYF(0), dbname); + DBUG_RETURN(TRUE); } if (found_libchar) path[length-1]= FN_LIBCHAR; @@ -989,7 +980,7 @@ int mysqld_show_create_db(THD *thd, char *dbname, if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); protocol->prepare_for_resend(); protocol->store(dbname, strlen(dbname), system_charset_info); @@ -1014,12 +1005,12 @@ int mysqld_show_create_db(THD *thd, char *dbname, protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); if (protocol->write()) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } -int +bool mysqld_show_logs(THD *thd) { List field_list; @@ -1032,19 +1023,19 @@ mysqld_show_logs(THD *thd) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); #ifdef HAVE_BERKELEY_DB if ((have_berkeley_db == SHOW_OPTION_YES) && berkeley_show_logs(protocol)) - DBUG_RETURN(-1); + DBUG_RETURN(TRUE); #endif send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } -int +bool mysqld_show_keys(THD *thd, TABLE_LIST *table_list) { TABLE *table; @@ -1055,8 +1046,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list) if (!(table = open_ltable(thd, table_list, TL_UNLOCK))) { - send_error(thd); - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } List field_list; @@ -1082,7 +1072,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); KEY *key_info=table->key_info; table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME); @@ -1133,11 +1123,11 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list) else protocol->store("", 0, system_charset_info); if (protocol->write()) - DBUG_RETURN(1); /* purecov: inspected */ + DBUG_RETURN(TRUE); /* purecov: inspected */ } } send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); } @@ -1155,12 +1145,8 @@ mysqld_list_fields(THD *thd, TABLE_LIST *table_list, const char *wild) DBUG_PRINT("enter",("table: %s",table_list->real_name)); table_list->lock_type= TL_UNLOCK; - if ((res= open_and_lock_tables(thd, table_list))) - { - if (res < 0) - send_error(thd); + if (open_and_lock_tables(thd, table_list)) DBUG_VOID_RETURN; - } table= table_list->table; List field_list; @@ -1805,7 +1791,7 @@ static bool write_collation(Protocol *protocol, CHARSET_INFO *cs) return protocol->write(); } -int mysqld_show_collations(THD *thd, const char *wild) +bool mysqld_show_collations(THD *thd, const char *wild) { char buff[8192]; String packet2(buff,sizeof(buff),thd->charset()); @@ -1813,7 +1799,7 @@ int mysqld_show_collations(THD *thd, const char *wild) CHARSET_INFO **cs; Protocol *protocol= thd->protocol; - DBUG_ENTER("mysqld_show_charsets"); + DBUG_ENTER(" mysqld_show_collations"); field_list.push_back(new Item_empty_string("Collation",30)); field_list.push_back(new Item_empty_string("Charset",30)); @@ -1824,7 +1810,7 @@ int mysqld_show_collations(THD *thd, const char *wild) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ ) { @@ -1845,10 +1831,10 @@ int mysqld_show_collations(THD *thd, const char *wild) } } } - send_eof(thd); - DBUG_RETURN(0); + send_eof(thd); + DBUG_RETURN(FALSE); err: - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } static bool write_charset(Protocol *protocol, CHARSET_INFO *cs) @@ -1861,7 +1847,7 @@ static bool write_charset(Protocol *protocol, CHARSET_INFO *cs) return protocol->write(); } -int mysqld_show_charsets(THD *thd, const char *wild) +bool mysqld_show_charsets(THD *thd, const char *wild) { char buff[8192]; String packet2(buff,sizeof(buff),thd->charset()); @@ -1878,7 +1864,7 @@ int mysqld_show_charsets(THD *thd, const char *wild) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); + DBUG_RETURN(TRUE); for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ ) { @@ -1891,18 +1877,18 @@ int mysqld_show_charsets(THD *thd, const char *wild) goto err; } } - send_eof(thd); - DBUG_RETURN(0); + send_eof(thd); + DBUG_RETURN(FALSE); err: - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } -int mysqld_show(THD *thd, const char *wild, show_var_st *variables, - enum enum_var_type value_type, - pthread_mutex_t *mutex, - struct system_status_var *status_var) +bool mysqld_show(THD *thd, const char *wild, show_var_st *variables, + enum enum_var_type value_type, + pthread_mutex_t *mutex, + struct system_status_var *status_var) { char buff[1024]; List field_list; @@ -1914,7 +1900,7 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, field_list.push_back(new Item_empty_string("Value",256)); if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(1); /* purecov: inspected */ + DBUG_RETURN(TRUE); /* purecov: inspected */ null_lex_str.str= 0; // For sys_var->value_ptr() null_lex_str.length= 0; @@ -2206,11 +2192,11 @@ int mysqld_show(THD *thd, const char *wild, show_var_st *variables, } pthread_mutex_unlock(mutex); send_eof(thd); - DBUG_RETURN(0); + DBUG_RETURN(FALSE); err: pthread_mutex_unlock(mutex); - DBUG_RETURN(1); + DBUG_RETURN(TRUE); } -- cgit v1.2.1 From 9e921615a1c3147961dc4a8314ebb0e455ea105b Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 12 Nov 2004 14:34:00 +0200 Subject: post-review fixes mysql-test/r/rpl_rotate_logs.result: removed host dependence in error messages mysql-test/t/rpl_rotate_logs.test: removed host dependence in error messages mysys/my_error.c: comment about using my_error family functions sql/filesort.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/ha_innodb.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/handler.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item_cmpfunc.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item_func.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item_strfunc.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item_subselect.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/item_sum.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/lock.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/log.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/mysql_priv.h: error check moved to fill_record sql/mysqld.cc: fixed error messages sql/parse_file.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/protocol.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/protocol_cursor.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/repl_failsafe.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/set_var.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/slave.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sp.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sp_head.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sp_rcontext.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_acl.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_analyse.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_base.cc: changing my_error on my_message and my_printf_error where if they are prefered error check moved to fill_record sql/sql_class.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_class.h: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_db.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_delete.cc: changing my_error on my_message and my_printf_error where if they are prefered error check moved to fill_record sql/sql_handler.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_help.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_insert.cc: changing my_error on my_message and my_printf_error where if they are prefered error check moved to fill_record sql/sql_lex.cc: layout fixed sql/sql_load.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_map.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_parse.cc: error check moved to fill_record changing my_error on my_message and my_printf_error where if they are prefered sql/sql_prepare.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_rename.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_repl.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_select.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_show.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_table.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_trigger.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_udf.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_union.cc: error check moved to fill_record sql/sql_update.cc: error check moved to fill_record sql/sql_view.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/sql_yacc.yy: changing my_error on my_message and my_printf_error where if they are prefered sql/table.cc: changing my_error on my_message and my_printf_error where if they are prefered sql/unireg.cc: changing my_error on my_message and my_printf_error where if they are prefered --- sql/sql_show.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sql/sql_show.cc') diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 17e1a77645a..f8243e8568e 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -866,8 +866,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) /* TODO: add environment variables show when it become possible */ if (thd->lex->only_view && !table_list->view) { - my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, - table_list->real_name, "VIEW"); + my_printf_error(ER_WRONG_OBJECT, ER(ER_WRONG_OBJECT), MYF(0), + table_list->db, table_list->real_name, "VIEW"); DBUG_RETURN(TRUE); } @@ -936,7 +936,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname, if (check_db_name(dbname)) { - my_error(ER_WRONG_DB_NAME, MYF(0), dbname); + my_printf_error(ER_WRONG_DB_NAME, ER(ER_WRONG_DB_NAME), MYF(0), dbname); DBUG_RETURN(TRUE); } @@ -948,8 +948,9 @@ bool mysqld_show_create_db(THD *thd, char *dbname, thd->master_access); if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) { - my_error(ER_DBACCESS_DENIED_ERROR, MYF(0), - thd->priv_user, thd->host_or_ip, dbname); + my_printf_error(ER_DBACCESS_DENIED_ERROR, + ER(ER_DBACCESS_DENIED_ERROR), MYF(0), + thd->priv_user, thd->host_or_ip, dbname); mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), thd->priv_user, thd->host_or_ip, dbname); DBUG_RETURN(TRUE); @@ -966,7 +967,7 @@ bool mysqld_show_create_db(THD *thd, char *dbname, } if (access(path,F_OK)) { - my_error(ER_BAD_DB_ERROR, MYF(0), dbname); + my_printf_error(ER_BAD_DB_ERROR, ER(ER_BAD_DB_ERROR), MYF(0), dbname); DBUG_RETURN(TRUE); } if (found_libchar) -- cgit v1.2.1