Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0

into sanja.is.com.ua:/home/bell/mysql/bk/work-error-5.0
This commit is contained in:
bell@sanja.is.com.ua 2004-10-20 16:11:16 +03:00
commit 42d6d6765a
90 changed files with 1924 additions and 1610 deletions

View file

@ -12,7 +12,7 @@
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ Foundation, Inc., 59 Temple Placeo Suite 330, Boston, MA 02111-1307 USA */
/* Definefile for error messagenumbers */ /* Definefile for error messagenumbers */
@ -386,4 +386,23 @@
#define ER_ILLEGAL_VALUE_FOR_TYPE 1367 #define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_VIEW_NONUPD_CHECK 1368 #define ER_VIEW_NONUPD_CHECK 1368
#define ER_VIEW_CHECK_FAILED 1369 #define ER_VIEW_CHECK_FAILED 1369
#define ER_ERROR_MESSAGES 370 #define ER_RELAY_LOG_FAIL 1370
#define ER_PASSWD_LENGTH 1371
#define ER_UNKNOWN_TARGET_BINLOG 1372
#define ER_IO_ERR_LOG_INDEX_READ 1373
#define ER_BINLOG_PURGE_PROHIBITED 1374
#define ER_FSEEK_FAIL 1375
#define ER_BINLOG_PURGE_FATAL_ERR 1376
#define ER_LOG_IN_USE 1377
#define ER_LOG_PURGE_UNKNOWN_ERR 1378
#define ER_RELAY_LOG_INIT 1379
#define ER_NO_BINARY_LOGGING 1380
#define ER_RESERVED_SYNTAX 1381
#define ER_WSAS_FAILED 1382
#define ER_DIFF_GROUPS_PROC 1383
#define ER_NO_GROUP_FOR_PROC 1384
#define ER_ORDER_WITH_PROC 1385
#define ER_LOGING_PROHIBIT_CHANGING_OF 1386
#define ER_NO_FILE_MAPPING 1387
#define ER_WRONG_MAGIC 1388
#define ER_ERROR_MESSAGES 389

View file

@ -162,9 +162,9 @@ master-bin.000001 # Query 1 # use `mysqltest2`; drop database mysqltest2
master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64 master-bin.000001 # Query 1 # SET ONE_SHOT CHARACTER_SET_CLIENT=8,COLLATION_CONNECTION=31,COLLATION_DATABASE=9,COLLATION_SERVER=64
master-bin.000001 # Query 1 # drop database mysqltest3 master-bin.000001 # Query 1 # drop database mysqltest3
set global character_set_server=latin2; set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
set global character_set_server=latin2; set global character_set_server=latin2;
ERROR HY000: Binary logging and replication forbid changing the global server character set or collation ERROR HY000: Binary logging and replication forbid changing the global server character set, collation
set one_shot @@character_set_server=latin5; set one_shot @@character_set_server=latin5;
set @@max_join_size=1000; set @@max_join_size=1000;
select @@character_set_server; select @@character_set_server;
@ -181,7 +181,7 @@ select @@character_set_server;
@@character_set_server @@character_set_server
latin5 latin5
set one_shot max_join_size=10; set one_shot max_join_size=10;
ERROR HY000: The SET ONE_SHOT syntax is reserved for purposes internal to the MySQL server ERROR HY000: The 'SET ONE_SHOT' syntax is reserved for purposes internal to the MySQL server
set character_set_client=9999999; set character_set_client=9999999;
ERROR 42000: Unknown character set: '9999999' ERROR 42000: Unknown character set: '9999999'
set collation_server=9999998; set collation_server=9999998;

View file

@ -1,7 +1,7 @@
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
drop table if exists t1, t2, t3, t4; drop table if exists t1, t2, t3, t4;
start slave; start slave;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log ERROR HY000: File '/home/bell/mysql/bk/work-error-5.0/mysql-test/var/slave-data/master.info' not found (Errcode: 13)
start slave; start slave;
ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log ERROR HY000: Could not initialize master info structure; more error messages can be found in the MySQL error log
change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root'; change master to master_host='127.0.0.1',master_port=MASTER_PORT, master_user='root';

View file

@ -73,5 +73,5 @@ t
2001-09-09 03:46:40 2001-09-09 03:46:40
1000000000 1000000000
set global time_zone='MET'; set global time_zone='MET';
ERROR HY000: Binary logging and replication forbid changing of the global server time zone ERROR HY000: Binary logging and replication forbid changing the global server time zone
drop table t1, t2; drop table t1, t2;

View file

@ -30,7 +30,7 @@ db1_secret
select * from db1_secret.t1; select * from db1_secret.t1;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
ERROR 42000: Unknown database 'db1_secret' ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist ERROR 42000: PROCEDURE db1_secret.dummy does not exist
call db1_secret.stamp(3); call db1_secret.stamp(3);
@ -40,7 +40,7 @@ db1_secret
select * from db1_secret.t1; select * from db1_secret.t1;
ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret' ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
ERROR 42000: Unknown database 'db1_secret' ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist ERROR 42000: PROCEDURE db1_secret.dummy does not exist
select * from t1; select * from t1;

View file

@ -1746,10 +1746,20 @@ drop table if exists t3|
create procedure bug4904() create procedure bug4904()
begin begin
declare continue handler for sqlstate 'HY000' begin end; declare continue handler for sqlstate 'HY000' begin end;
create table t2 as select * from t; create table t2 as select * from t3;
end|
call bug4904()|
ERROR 42S02: Table 'test.t3' doesn't exist
drop procedure bug4904|
create table t3 (s1 char character set latin1, s2 char character set latin2)|
create procedure bug4904 ()
begin
declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
end| end|
call bug4904()| call bug4904()|
drop procedure bug4904| drop procedure bug4904|
drop table t3|
create procedure bug336(out y int) create procedure bug336(out y int)
begin begin
declare x int; declare x int;

View file

@ -49,7 +49,7 @@ flush privileges;
#show tables; #show tables;
connect (con1,localhost,test,gambling2,mysql); connect (con1,localhost,test,gambling2,mysql);
set password=""; set password="";
--error 1105 --error 1371
set password='gambling3'; set password='gambling3';
set password=old_password('gambling3'); set password=old_password('gambling3');
show tables; show tables;

View file

@ -112,10 +112,10 @@ sync_slave_with_master;
# Check that we can't change global.collation_server # Check that we can't change global.collation_server
error 1105; error 1386;
set global character_set_server=latin2; set global character_set_server=latin2;
connection master; connection master;
error 1105; error 1386;
set global character_set_server=latin2; set global character_set_server=latin2;
# Check that SET ONE_SHOT is really one shot # Check that SET ONE_SHOT is really one shot
@ -129,7 +129,7 @@ select @@character_set_server;
select @@character_set_server; select @@character_set_server;
# ONE_SHOT on not charset/collation stuff is not allowed # ONE_SHOT on not charset/collation stuff is not allowed
error 1105; error 1381;
set one_shot max_join_size=10; set one_shot max_join_size=10;
# Test of wrong character set numbers; # Test of wrong character set numbers;

View file

@ -23,7 +23,7 @@ drop table if exists t1, t2, t3, t4;
# START SLAVE will fail because it can't read the file (mode 000) # START SLAVE will fail because it can't read the file (mode 000)
# (system error 13) # (system error 13)
--error 1201 --error 1105
start slave; start slave;
system chmod 600 var/slave-data/master.info; system chmod 600 var/slave-data/master.info;
# It will fail again because the file is empty so the slave cannot get valuable # It will fail again because the file is empty so the slave cannot get valuable

View file

@ -76,7 +76,7 @@ select * from t2;
# replication # replication
# #
connection master; connection master;
--error 1105 --error 1386
set global time_zone='MET'; set global time_zone='MET';
# Clean up # Clean up

View file

@ -58,7 +58,7 @@ select db1_secret.db();
select * from db1_secret.t1; select * from db1_secret.t1;
# ...and not this # ...and not this
--error 1049 --error 1044
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
--error 1305 --error 1305
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;
@ -78,7 +78,7 @@ select db1_secret.db();
select * from db1_secret.t1; select * from db1_secret.t1;
# ...and not this # ...and not this
--error 1049 --error 1044
create procedure db1_secret.dummy() begin end; create procedure db1_secret.dummy() begin end;
--error 1305 --error 1305
drop procedure db1_secret.dummy; drop procedure db1_secret.dummy;

View file

@ -1870,12 +1870,27 @@ create procedure bug4904()
begin begin
declare continue handler for sqlstate 'HY000' begin end; declare continue handler for sqlstate 'HY000' begin end;
create table t2 as select * from t; create table t2 as select * from t3;
end|
-- error 1146
call bug4904()|
drop procedure bug4904|
create table t3 (s1 char character set latin1, s2 char character set latin2)|
create procedure bug4904 ()
begin
declare continue handler for sqlstate 'HY000' begin end;
select s1 from t3 union select s2 from t3;
end| end|
call bug4904()| call bug4904()|
drop procedure bug4904| drop procedure bug4904|
drop table t3|
# #
# BUG#336 # BUG#336

View file

@ -4821,7 +4821,7 @@ ha_innobase::external_lock(
Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB Implements the SHOW INNODB STATUS command. Sends the output of the InnoDB
Monitor to the client. */ Monitor to the client. */
int bool
innodb_show_status( innodb_show_status(
/*===============*/ /*===============*/
THD* thd) /* in: the MySQL query thread of the caller */ THD* thd) /* in: the MySQL query thread of the caller */
@ -4835,7 +4835,7 @@ innodb_show_status(
my_message(ER_NOT_SUPPORTED_YET, my_message(ER_NOT_SUPPORTED_YET,
"Cannot call SHOW INNODB STATUS because skip-innodb is defined", "Cannot call SHOW INNODB STATUS because skip-innodb is defined",
MYF(0)); MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
trx = check_trx_exists(thd); trx = check_trx_exists(thd);
@ -4864,7 +4864,7 @@ innodb_show_status(
if (!(str = my_malloc(flen + 1, MYF(0)))) if (!(str = my_malloc(flen + 1, MYF(0))))
{ {
mutex_exit_noninline(&srv_monitor_file_mutex); mutex_exit_noninline(&srv_monitor_file_mutex);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
rewind(srv_monitor_file); rewind(srv_monitor_file);
@ -4881,7 +4881,7 @@ innodb_show_status(
my_free(str, MYF(0)); my_free(str, MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
protocol->prepare_for_resend(); protocol->prepare_for_resend();
@ -4889,10 +4889,10 @@ innodb_show_status(
my_free(str, MYF(0)); my_free(str, MYF(0));
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
/**************************************************************************** /****************************************************************************

View file

@ -222,7 +222,7 @@ int innobase_savepoint(
my_off_t binlog_cache_pos); my_off_t binlog_cache_pos);
int innobase_close_connection(THD *thd); int innobase_close_connection(THD *thd);
int innobase_drop_database(char *path); int innobase_drop_database(char *path);
int innodb_show_status(THD* thd); bool innodb_show_status(THD* thd);
my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name, my_bool innobase_query_caching_of_table_permitted(THD* thd, char* full_name,
uint full_name_len); uint full_name_len);

View file

@ -1318,7 +1318,7 @@ bool Item::fix_fields(THD *thd,
// We do not check fields which are fixed during construction // We do not check fields which are fixed during construction
DBUG_ASSERT(fixed == 0 || basic_const_item()); DBUG_ASSERT(fixed == 0 || basic_const_item());
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
double Item_ref_null_helper::val() double Item_ref_null_helper::val()
@ -1486,9 +1486,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
} }
} }
if (!tmp) if (!tmp)
return -1; return TRUE;
if (!refer) if (!refer)
return 1; return TRUE;
if (tmp == not_found_field && refer == (Item **)not_found_item) if (tmp == not_found_field && refer == (Item **)not_found_item)
{ {
if (upward_lookup) if (upward_lookup)
@ -1502,7 +1502,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
// Call to report error // Call to report error
find_field_in_tables(thd, this, tables, ref, 1, 1); find_field_in_tables(thd, this, tables, ref, 1, 1);
} }
return -1; return TRUE;
} }
else if (refer != (Item **)not_found_item) else if (refer != (Item **)not_found_item)
{ {
@ -1510,7 +1510,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list"); "forward reference in item list");
return -1; return TRUE;
} }
Item_ref *rf; Item_ref *rf;
@ -1520,16 +1520,16 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(char *)field_name); (char *)field_name);
register_item_tree_changing(ref); register_item_tree_changing(ref);
if (!rf) if (!rf)
return 1; return TRUE;
/* /*
rf is Item_ref => never substitute other items (in this case) rf is Item_ref => never substitute other items (in this case)
during fix_fields() => we can use rf after fix_fields() during fix_fields() => we can use rf after fix_fields()
*/ */
if (rf->fix_fields(thd, tables, ref) || rf->check_cols(1)) if (rf->fix_fields(thd, tables, ref) || rf->check_cols(1))
return 1; return TRUE;
mark_as_dependent(thd, last, cursel, rf); mark_as_dependent(thd, last, cursel, rf);
return 0; return FALSE;
} }
else else
{ {
@ -1542,7 +1542,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(char *)cached_table->alias, (char *)cached_table->alias,
(char *)field_name); (char *)field_name);
if (!rf) if (!rf)
return 1; return TRUE;
/* /*
rf is Item_ref => never substitute other items (in this case) rf is Item_ref => never substitute other items (in this case)
during fix_fields() => we can use rf after fix_fields() during fix_fields() => we can use rf after fix_fields()
@ -1552,7 +1552,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
} }
} }
else if (!tmp) else if (!tmp)
return -1; return TRUE;
/* /*
if it is not expression from merged VIEW we will set this field. if it is not expression from merged VIEW we will set this field.
@ -1603,12 +1603,12 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
thd->host_or_ip, thd->host_or_ip,
field_name, field_name,
tab); tab);
return 1; return TRUE;
} }
} }
#endif #endif
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
void Item_field::cleanup() void Item_field::cleanup()
@ -2248,9 +2248,9 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
} }
if (!ref) if (!ref)
return 1; return TRUE;
else if (!tmp) else if (!tmp)
return -1; return TRUE;
else if (ref == (Item **)not_found_item && tmp == not_found_field) else if (ref == (Item **)not_found_item && tmp == not_found_field)
{ {
if (upward_lookup) if (upward_lookup)
@ -2268,7 +2268,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
REPORT_ALL_ERRORS); REPORT_ALL_ERRORS);
} }
ref= 0; ref= 0;
return 1; return TRUE;
} }
else if (tmp != not_found_field) else if (tmp != not_found_field)
{ {
@ -2277,10 +2277,10 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{ {
Item_field* fld; Item_field* fld;
if (!((*reference)= fld= new Item_field(tmp))) if (!((*reference)= fld= new Item_field(tmp)))
return 1; return TRUE;
mark_as_dependent(thd, last, thd->lex->current_select, fld); mark_as_dependent(thd, last, thd->lex->current_select, fld);
register_item_tree_changing(reference); register_item_tree_changing(reference);
return 0; return FALSE;
} }
/* /*
We can leave expression substituted from view for next PS/SP We can leave expression substituted from view for next PS/SP
@ -2300,7 +2300,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list"); "forward reference in item list");
return -1; return TRUE;
} }
mark_as_dependent(thd, last, thd->lex->current_select, mark_as_dependent(thd, last, thd->lex->current_select,
this); this);
@ -2308,14 +2308,14 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
} }
} }
else if (!ref) else if (!ref)
return 1; return TRUE;
else else
{ {
if (!(*ref)->fixed) if (!(*ref)->fixed)
{ {
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name, my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list"); "forward reference in item list");
return -1; return TRUE;
} }
ref= thd->lex->current_select->ref_pointer_array + counter; ref= thd->lex->current_select->ref_pointer_array + counter;
} }
@ -2338,7 +2338,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
((*ref)->with_sum_func? ((*ref)->with_sum_func?
"reference on group function": "reference on group function":
"forward reference in item list")); "forward reference in item list"));
return 1; return TRUE;
} }
max_length= (*ref)->max_length; max_length= (*ref)->max_length;
maybe_null= (*ref)->maybe_null; maybe_null= (*ref)->maybe_null;
@ -2348,8 +2348,8 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
fixed= 1; fixed= 1;
if (ref && (*ref)->check_cols(1)) if (ref && (*ref)->check_cols(1))
return 1; return TRUE;
return 0; return FALSE;
} }
@ -2455,17 +2455,17 @@ bool Item_default_value::fix_fields(THD *thd,
if (!arg) if (!arg)
{ {
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
if (arg->fix_fields(thd, table_list, &arg)) if (arg->fix_fields(thd, table_list, &arg))
return 1; return TRUE;
if (arg->type() == REF_ITEM) if (arg->type() == REF_ITEM)
{ {
Item_ref *ref= (Item_ref *)arg; Item_ref *ref= (Item_ref *)arg;
if (ref->ref[0]->type() != FIELD_ITEM) if (ref->ref[0]->type() != FIELD_ITEM)
{ {
return 1; return TRUE;
} }
arg= ref->ref[0]; arg= ref->ref[0];
} }
@ -2474,16 +2474,16 @@ bool Item_default_value::fix_fields(THD *thd,
{ {
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD), my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD),
MYF(0), field_arg->field->field_name); MYF(0), field_arg->field->field_name);
return 1; return TRUE;
} }
if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of()))) if (!(def_field= (Field*) sql_alloc(field_arg->field->size_of())))
return 1; return TRUE;
memcpy(def_field, field_arg->field, field_arg->field->size_of()); memcpy(def_field, field_arg->field, field_arg->field->size_of());
def_field->move_field(def_field->table->default_values - def_field->move_field(def_field->table->default_values -
def_field->table->record[0]); def_field->table->record[0]);
set_field(def_field); set_field(def_field);
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
void Item_default_value::print(String *str) void Item_default_value::print(String *str)
@ -2511,14 +2511,14 @@ bool Item_insert_value::fix_fields(THD *thd,
{ {
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (arg->fix_fields(thd, table_list, &arg)) if (arg->fix_fields(thd, table_list, &arg))
return 1; return TRUE;
if (arg->type() == REF_ITEM) if (arg->type() == REF_ITEM)
{ {
Item_ref *ref= (Item_ref *)arg; Item_ref *ref= (Item_ref *)arg;
if (ref->ref[0]->type() != FIELD_ITEM) if (ref->ref[0]->type() != FIELD_ITEM)
{ {
return 1; return TRUE;
} }
arg= ref->ref[0]; arg= ref->ref[0];
} }
@ -2527,7 +2527,7 @@ bool Item_insert_value::fix_fields(THD *thd,
{ {
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of()); Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
if (!def_field) if (!def_field)
return 1; return TRUE;
memcpy(def_field, field_arg->field, field_arg->field->size_of()); memcpy(def_field, field_arg->field, field_arg->field->size_of());
def_field->move_field(def_field->table->insert_values - def_field->move_field(def_field->table->insert_values -
def_field->table->record[0]); def_field->table->record[0]);
@ -2541,7 +2541,7 @@ bool Item_insert_value::fix_fields(THD *thd,
tmp_field->table, &my_charset_bin)); tmp_field->table, &my_charset_bin));
} }
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
void Item_insert_value::print(String *str) void Item_insert_value::print(String *str)

View file

@ -631,17 +631,17 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
{ {
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (fix_left(thd, tables, ref)) if (fix_left(thd, tables, ref))
return 1; return TRUE;
if (args[0]->maybe_null) if (args[0]->maybe_null)
maybe_null=1; maybe_null=1;
if (!args[1]->fixed && args[1]->fix_fields(thd, tables, args+1)) if (!args[1]->fixed && args[1]->fix_fields(thd, tables, args+1))
return 1; return TRUE;
Item_in_subselect * sub= (Item_in_subselect *)args[1]; Item_in_subselect * sub= (Item_in_subselect *)args[1];
if (args[0]->cols() != sub->engine->cols()) if (args[0]->cols() != sub->engine->cols())
{ {
my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols()); my_error(ER_OPERAND_COLUMNS, MYF(0), args[0]->cols());
return 1; return TRUE;
} }
if (args[1]->maybe_null) if (args[1]->maybe_null)
maybe_null=1; maybe_null=1;
@ -650,7 +650,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, struct st_table_list *tables,
not_null_tables_cache|= args[1]->not_null_tables(); not_null_tables_cache|= args[1]->not_null_tables();
const_item_cache&= args[1]->const_item(); const_item_cache&= args[1]->const_item();
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
@ -1964,7 +1964,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
and_tables_cache= ~(table_map) 0; and_tables_cache= ~(table_map) 0;
if (check_stack_overrun(thd, buff)) if (check_stack_overrun(thd, buff))
return 1; // Fatal error flag is set! return TRUE; // Fatal error flag is set!
while ((item=li++)) while ((item=li++))
{ {
table_map tmp_table_map; table_map tmp_table_map;
@ -1982,7 +1982,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if ((!item->fixed && if ((!item->fixed &&
item->fix_fields(thd, tables, li.ref())) || item->fix_fields(thd, tables, li.ref())) ||
(item= *li.ref())->check_cols(1)) (item= *li.ref())->check_cols(1))
return 1; /* purecov: inspected */ return TRUE; /* purecov: inspected */
used_tables_cache|= item->used_tables(); used_tables_cache|= item->used_tables();
tmp_table_map= item->not_null_tables(); tmp_table_map= item->not_null_tables();
not_null_tables_cache|= tmp_table_map; not_null_tables_cache|= tmp_table_map;
@ -1995,7 +1995,7 @@ Item_cond::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
thd->lex->current_select->cond_count+= list.elements; thd->lex->current_select->cond_count+= list.elements;
fix_length_and_dec(); fix_length_and_dec();
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
bool Item_cond::walk(Item_processor processor, byte *arg) bool Item_cond::walk(Item_processor processor, byte *arg)
@ -2306,12 +2306,12 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (Item_bool_func2::fix_fields(thd, tlist, ref) || if (Item_bool_func2::fix_fields(thd, tlist, ref) ||
escape_item->fix_fields(thd, tlist, &escape_item)) escape_item->fix_fields(thd, tlist, &escape_item))
return 1; return TRUE;
if (!escape_item->const_during_execution()) if (!escape_item->const_during_execution())
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE"); my_error(ER_WRONG_ARGUMENTS,MYF(0),"ESCAPE");
return 1; return TRUE;
} }
if (escape_item->const_item()) if (escape_item->const_item())
@ -2329,7 +2329,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
{ {
String* res2 = args[1]->val_str(&tmp_value2); String* res2 = args[1]->val_str(&tmp_value2);
if (!res2) if (!res2)
return 0; // Null argument return FALSE; // Null argument
const size_t len = res2->length(); const size_t len = res2->length();
const char* first = res2->ptr(); const char* first = res2->ptr();
@ -2362,7 +2362,7 @@ bool Item_func_like::fix_fields(THD *thd, TABLE_LIST *tlist, Item ** ref)
} }
} }
} }
return 0; return FALSE;
} }
#ifdef USE_REGEX #ifdef USE_REGEX
@ -2373,13 +2373,13 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1) || if (args[0]->fix_fields(thd, tables, args) || args[0]->check_cols(1) ||
args[1]->fix_fields(thd,tables, args + 1) || args[1]->check_cols(1)) args[1]->fix_fields(thd,tables, args + 1) || args[1]->check_cols(1))
return 1; /* purecov: inspected */ return TRUE; /* purecov: inspected */
with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func; with_sum_func=args[0]->with_sum_func || args[1]->with_sum_func;
max_length= 1; max_length= 1;
decimals= 0; decimals= 0;
if (agg_arg_collations(cmp_collation, args, 2)) if (agg_arg_collations(cmp_collation, args, 2))
return 1; return TRUE;
used_tables_cache=args[0]->used_tables() | args[1]->used_tables(); used_tables_cache=args[0]->used_tables() | args[1]->used_tables();
not_null_tables_cache= (args[0]->not_null_tables() | not_null_tables_cache= (args[0]->not_null_tables() |
@ -2393,7 +2393,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (args[1]->null_value) if (args[1]->null_value)
{ // Will always return NULL { // Will always return NULL
maybe_null=1; maybe_null=1;
return 0; return FALSE;
} }
int error; int error;
if ((error=regcomp(&preg,res->c_ptr(), if ((error=regcomp(&preg,res->c_ptr(),
@ -2404,7 +2404,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{ {
(void) regerror(error,&preg,buff,sizeof(buff)); (void) regerror(error,&preg,buff,sizeof(buff));
my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff); my_printf_error(ER_REGEXP_ERROR,ER(ER_REGEXP_ERROR),MYF(0),buff);
return 1; return TRUE;
} }
regex_compiled=regex_is_const=1; regex_compiled=regex_is_const=1;
maybe_null=args[0]->maybe_null; maybe_null=args[0]->maybe_null;
@ -2412,7 +2412,7 @@ Item_func_regex::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
else else
maybe_null=1; maybe_null=1;
fixed= 1; fixed= 1;
return 0; return FALSE;
} }

View file

@ -199,8 +199,8 @@ Item_func::Item_func(THD *thd, Item_func *item)
item. item.
RETURN VALUES RETURN VALUES
0 ok FALSE ok
1 Got error. Stored with my_error(). TRUE Got error. Stored with my_error().
*/ */
bool bool
@ -216,7 +216,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
const_item_cache=1; const_item_cache=1;
if (check_stack_overrun(thd, buff)) if (check_stack_overrun(thd, buff))
return 1; // Fatal error if flag is set! return TRUE; // Fatal error if flag is set!
if (arg_count) if (arg_count)
{ // Print purify happy { // Print purify happy
for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++) for (arg=args, arg_end=args+arg_count; arg != arg_end ; arg++)
@ -228,7 +228,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
*/ */
if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) || if ((!(*arg)->fixed && (*arg)->fix_fields(thd, tables, arg)) ||
(*arg)->check_cols(allowed_arg_cols)) (*arg)->check_cols(allowed_arg_cols))
return 1; /* purecov: inspected */ return TRUE; /* purecov: inspected */
item= *arg; item= *arg;
if (item->maybe_null) if (item->maybe_null)
maybe_null=1; maybe_null=1;
@ -240,10 +240,10 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
} }
} }
fix_length_and_dec(); fix_length_and_dec();
if (thd->net.last_errno) // An error inside fix_length_and_dec occured if (thd->net.report_error) // An error inside fix_length_and_dec occured
return 1; return TRUE;
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
bool Item_func::walk (Item_processor processor, byte *argument) bool Item_func::walk (Item_processor processor, byte *argument)
@ -1568,7 +1568,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
DBUG_ENTER("Item_udf_func::fix_fields"); DBUG_ENTER("Item_udf_func::fix_fields");
if (check_stack_overrun(thd, buff)) if (check_stack_overrun(thd, buff))
DBUG_RETURN(1); // Fatal error flag is set! DBUG_RETURN(TRUE); // Fatal error flag is set!
udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1); udf_func *tmp_udf=find_udf(u_d->name.str,(uint) u_d->name.length,1);
@ -1576,7 +1576,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
{ {
my_printf_error(ER_CANT_FIND_UDF,ER(ER_CANT_FIND_UDF),MYF(0),u_d->name.str, my_printf_error(ER_CANT_FIND_UDF,ER(ER_CANT_FIND_UDF),MYF(0),u_d->name.str,
errno); errno);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
u_d=tmp_udf; u_d=tmp_udf;
args=arguments; args=arguments;
@ -1593,7 +1593,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
{ {
free_udf(u_d); free_udf(u_d);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
uint i; uint i;
Item **arg,**arg_end; Item **arg,**arg_end;
@ -1606,7 +1606,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
// we can't assign 'item' before, because fix_fields() can change arg // we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg; Item *item= *arg;
if (item->check_cols(1)) if (item->check_cols(1))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
/* /*
TODO: We should think about this. It is not always TODO: We should think about this. It is not always
right way just to set an UDF result to return my_charset_bin right way just to set an UDF result to return my_charset_bin
@ -1639,7 +1639,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
sizeof(long)))) sizeof(long))))
{ {
free_udf(u_d); free_udf(u_d);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
func->fix_length_and_dec(); func->fix_length_and_dec();
@ -1698,7 +1698,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0), my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
u_d->name.str, thd->net.last_error); u_d->name.str, thd->net.last_error);
free_udf(u_d); free_udf(u_d);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
func->max_length=min(initid.max_length,MAX_BLOB_WIDTH); func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
func->maybe_null=initid.maybe_null; func->maybe_null=initid.maybe_null;
@ -1710,9 +1710,9 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
{ {
my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0), my_printf_error(ER_CANT_INITIALIZE_UDF,ER(ER_CANT_INITIALIZE_UDF),MYF(0),
u_d->name.str, ER(ER_UNKNOWN_ERROR)); u_d->name.str, ER(ER_UNKNOWN_ERROR));
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -2322,7 +2322,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
/* fix_fields will call Item_func_set_user_var::fix_length_and_dec */ /* fix_fields will call Item_func_set_user_var::fix_length_and_dec */
if (Item_func::fix_fields(thd, tables, ref) || if (Item_func::fix_fields(thd, tables, ref) ||
!(entry= get_variable(&thd->user_vars, name, 1))) !(entry= get_variable(&thd->user_vars, name, 1)))
return 1; return TRUE;
/* /*
Remember the last query which updated it, this way a query can later know Remember the last query which updated it, this way a query can later know
if this variable is a constant item in the query (it is if update_query_id if this variable is a constant item in the query (it is if update_query_id
@ -2331,7 +2331,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
entry->update_query_id= thd->query_id; entry->update_query_id= thd->query_id;
entry->collation.set(args[0]->collation); entry->collation.set(args[0]->collation);
cached_result_type= args[0]->result_type(); cached_result_type= args[0]->result_type();
return 0; return FALSE;
} }
@ -2490,7 +2490,7 @@ String *user_var_entry::val_str(my_bool *null_value, String *str,
will be catched by thd->net.report_error check in sql_set_variables(). will be catched by thd->net.report_error check in sql_set_variables().
RETURN RETURN
0 - OK. FALSE OK.
*/ */
bool bool
@ -2520,7 +2520,7 @@ Item_func_set_user_var::check()
DBUG_ASSERT(0); DBUG_ASSERT(0);
break; break;
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -2968,7 +2968,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
!args[0]->const_during_execution()) !args[0]->const_during_execution())
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),"AGAINST"); my_error(ER_WRONG_ARGUMENTS,MYF(0),"AGAINST");
return 1; return TRUE;
} }
const_item_cache=0; const_item_cache=0;
@ -2991,7 +2991,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
if (key == NO_SUCH_KEY && !(flags & FT_BOOL)) if (key == NO_SUCH_KEY && !(flags & FT_BOOL))
{ {
my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH"); my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
return 1; return TRUE;
} }
table=((Item_field *)item)->field->table; table=((Item_field *)item)->field->table;
table->fulltext_searched=1; table->fulltext_searched=1;
@ -3202,7 +3202,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
{ {
if (!var->is_struct()) if (!var->is_struct())
{ {
net_printf(thd, ER_VARIABLE_IS_NOT_STRUCT, base_name->str); my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), base_name->str);
return 0; return 0;
} }
} }

View file

@ -62,7 +62,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++) for (arg= items, arg_end= items+arg_count; arg != arg_end ; arg++)
{ {
if ((*arg)->fix_fields(thd, tabl, arg)) if ((*arg)->fix_fields(thd, tabl, arg))
return 1; return TRUE;
// we can't assign 'item' before, because fix_fields() can change arg // we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg; Item *item= *arg;
used_tables_cache |= item->used_tables(); used_tables_cache |= item->used_tables();
@ -81,7 +81,7 @@ bool Item_row::fix_fields(THD *thd, TABLE_LIST *tabl, Item **ref)
with_sum_func= with_sum_func || item->with_sum_func; with_sum_func= with_sum_func || item->with_sum_func;
} }
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
void Item_row::split_sum_func(Item **ref_pointer_array, List<Item> &fields) void Item_row::split_sum_func(Item **ref_pointer_array, List<Item> &fields)

View file

@ -66,7 +66,7 @@ void Item_subselect::init(st_select_lex *select_lex,
parsing_place= unit->item->parsing_place; parsing_place= unit->item->parsing_place;
unit->item->engine= 0; unit->item->engine= 0;
unit->item= this; unit->item= this;
engine->change_item(this, result); engine->change_result(this, result);
} }
else else
{ {
@ -133,13 +133,13 @@ Item_subselect::select_transformer(JOIN *join)
bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref) bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
{ {
char const *save_where= thd_param->where; char const *save_where= thd_param->where;
int res; bool res;
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
engine->set_thd((thd= thd_param)); engine->set_thd((thd= thd_param));
if (check_stack_overrun(thd, (gptr)&res)) if (check_stack_overrun(thd, (gptr)&res))
return 1; return TRUE;
res= engine->prepare(); res= engine->prepare();
@ -168,7 +168,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (substype() == SINGLEROW_SUBS && (*ref)->with_sum_func) if (substype() == SINGLEROW_SUBS && (*ref)->with_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0)); my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0));
return 1; return TRUE;
} }
return ret; return ret;
} }
@ -176,7 +176,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (engine->cols() > max_columns) if (engine->cols() > max_columns)
{ {
my_error(ER_OPERAND_COLUMNS, MYF(0), 1); my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
return 1; return TRUE;
} }
fix_length_and_dec(); fix_length_and_dec();
} }
@ -1493,12 +1493,12 @@ void subselect_indexsubquery_engine::print(String *str)
res new select_result object res new select_result object
RETURN RETURN
0 OK FALSE OK
-1 error TRUE error
*/ */
int subselect_single_select_engine::change_item(Item_subselect *si, bool subselect_single_select_engine::change_result(Item_subselect *si,
select_subselect *res) select_subselect *res)
{ {
item= si; item= si;
result= res; result= res;
@ -1515,12 +1515,12 @@ int subselect_single_select_engine::change_item(Item_subselect *si,
res new select_result object res new select_result object
RETURN RETURN
0 OK FALSE OK
-1 error TRUE error
*/ */
int subselect_union_engine::change_item(Item_subselect *si, bool subselect_union_engine::change_result(Item_subselect *si,
select_subselect *res) select_subselect *res)
{ {
item= si; item= si;
int rc= unit->change_result(res, result); int rc= unit->change_result(res, result);
@ -1538,12 +1538,13 @@ int subselect_union_engine::change_item(Item_subselect *si,
res new select_result object res new select_result object
RETURN RETURN
-1 error FALSE OK
TRUE error
*/ */
int subselect_uniquesubquery_engine::change_item(Item_subselect *si, bool subselect_uniquesubquery_engine::change_result(Item_subselect *si,
select_subselect *res) select_subselect *res)
{ {
DBUG_ASSERT(0); DBUG_ASSERT(0);
return -1; return TRUE;
} }

View file

@ -290,7 +290,7 @@ public:
virtual table_map upper_select_const_tables()= 0; virtual table_map upper_select_const_tables()= 0;
static table_map calc_const_tables(TABLE_LIST *); static table_map calc_const_tables(TABLE_LIST *);
virtual void print(String *str)= 0; virtual void print(String *str)= 0;
virtual int change_item(Item_subselect *si, select_subselect *result)= 0; virtual bool change_result(Item_subselect *si, select_subselect *result)= 0;
}; };
@ -314,7 +314,7 @@ public:
void exclude(); void exclude();
table_map upper_select_const_tables(); table_map upper_select_const_tables();
void print (String *str); void print (String *str);
int change_item(Item_subselect *si, select_subselect *result); bool change_result(Item_subselect *si, select_subselect *result);
}; };
@ -334,7 +334,7 @@ public:
void exclude(); void exclude();
table_map upper_select_const_tables(); table_map upper_select_const_tables();
void print (String *str); void print (String *str);
int change_item(Item_subselect *si, select_subselect *result); bool change_result(Item_subselect *si, select_subselect *result);
}; };
@ -363,7 +363,7 @@ public:
void exclude(); void exclude();
table_map upper_select_const_tables() { return 0; } table_map upper_select_const_tables() { return 0; }
void print (String *str); void print (String *str);
int change_item(Item_subselect *si, select_subselect *result); bool change_result(Item_subselect *si, select_subselect *result);
}; };

View file

@ -216,12 +216,12 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (save_args_for_prepared_statement(thd)) if (save_args_for_prepared_statement(thd))
return 1; return TRUE;
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1; return TRUE;
} }
thd->allow_sum_func=0; // No included group funcs thd->allow_sum_func=0; // No included group funcs
decimals=0; decimals=0;
@ -229,7 +229,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
for (uint i=0 ; i < arg_count ; i++) for (uint i=0 ; i < arg_count ; i++)
{ {
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1; return TRUE;
if (decimals < args[i]->decimals) if (decimals < args[i]->decimals)
decimals=args[i]->decimals; decimals=args[i]->decimals;
maybe_null |= args[i]->maybe_null; maybe_null |= args[i]->maybe_null;
@ -240,7 +240,7 @@ Item_sum_num::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
fix_length_and_dec(); fix_length_and_dec();
thd->allow_sum_func=1; // Allow group functions thd->allow_sum_func=1; // Allow group functions
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
@ -250,13 +250,13 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (save_args_for_prepared_statement(thd)) if (save_args_for_prepared_statement(thd))
return 1; return TRUE;
Item *item= args[0]; Item *item= args[0];
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1; return TRUE;
} }
thd->allow_sum_func=0; // No included group funcs thd->allow_sum_func=0; // No included group funcs
@ -264,7 +264,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
if (!item->fixed && if (!item->fixed &&
item->fix_fields(thd, tables, args) || item->fix_fields(thd, tables, args) ||
(item= args[0])->check_cols(1)) (item= args[0])->check_cols(1))
return 1; return TRUE;
hybrid_type= item->result_type(); hybrid_type= item->result_type();
if (hybrid_type == INT_RESULT) if (hybrid_type == INT_RESULT)
@ -295,7 +295,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
else else
hybrid_field_type= Item::field_type(); hybrid_field_type= Item::field_type();
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
@ -2061,12 +2061,12 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
if (save_args_for_prepared_statement(thd)) if (save_args_for_prepared_statement(thd))
return 1; return TRUE;
if (!thd->allow_sum_func) if (!thd->allow_sum_func)
{ {
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0)); my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1; return TRUE;
} }
thd->allow_sum_func= 0; thd->allow_sum_func= 0;
@ -2080,7 +2080,7 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
for (i=0 ; i < arg_count ; i++) for (i=0 ; i < arg_count ; i++)
{ {
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1)) if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1; return TRUE;
if (i < arg_count_field) if (i < arg_count_field)
maybe_null|= args[i]->maybe_null; maybe_null|= args[i]->maybe_null;
} }
@ -2090,10 +2090,10 @@ Item_func_group_concat::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
max_length= group_concat_max_len; max_length= group_concat_max_len;
thd->allow_sum_func= 1; thd->allow_sum_func= 1;
if (!(tmp_table_param= new TMP_TABLE_PARAM)) if (!(tmp_table_param= new TMP_TABLE_PARAM))
return 1; return TRUE;
tables_list= tables; tables_list= tables;
fixed= 1; fixed= 1;
return 0; return FALSE;
} }

View file

@ -1671,7 +1671,7 @@ Item_func_convert_tz::fix_fields(THD *thd_arg, TABLE_LIST *tables_arg, Item **re
{ {
String str; String str;
if (Item_date_func::fix_fields(thd_arg, tables_arg, ref)) if (Item_date_func::fix_fields(thd_arg, tables_arg, ref))
return 1; return TRUE;
tz_tables= thd_arg->lex->time_zone_tables_used; tz_tables= thd_arg->lex->time_zone_tables_used;
@ -1681,7 +1681,7 @@ Item_func_convert_tz::fix_fields(THD *thd_arg, TABLE_LIST *tables_arg, Item **re
if (args[2]->const_item()) if (args[2]->const_item())
to_tz= my_tz_find(args[2]->val_str(&str), tz_tables); to_tz= my_tz_find(args[2]->val_str(&str), tz_tables);
return 0; return FALSE;
} }

View file

@ -50,7 +50,7 @@ public:
{ {
DBUG_ASSERT(fixed == 0); DBUG_ASSERT(fixed == 0);
fixed= 1; fixed= 1;
return 0; return FALSE;
} }
Item *copy_or_same(THD* thd) Item *copy_or_same(THD* thd)
{ {

View file

@ -2587,7 +2587,7 @@ Slave: load data infile on table '%s' at log position %s in log \
my_afree(load_data_query); my_afree(load_data_query);
if (thd->query_error) if (thd->query_error)
{ {
/* this err/sql_errno code is copy-paste from send_error() */ /* this err/sql_errno code is copy-paste from net_send_error() */
const char *err; const char *err;
int sql_errno; int sql_errno;
if ((err=thd->net.last_error)[0]) if ((err=thd->net.last_error)[0])

View file

@ -418,17 +418,17 @@ bool check_one_table_access(THD *thd, ulong privilege,
bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table); bool check_some_access(THD *thd, ulong want_access, TABLE_LIST *table);
bool check_merge_table_access(THD *thd, char *db, bool check_merge_table_access(THD *thd, char *db,
TABLE_LIST *table_list); TABLE_LIST *table_list);
int multi_update_precheck(THD *thd, TABLE_LIST *tables); bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count); bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
int mysql_multi_update_prepare(THD *thd); bool mysql_multi_update_prepare(THD *thd);
int mysql_multi_delete_prepare(THD *thd); bool mysql_multi_delete_prepare(THD *thd);
int mysql_insert_select_prepare(THD *thd); bool mysql_insert_select_prepare(THD *thd);
int insert_select_precheck(THD *thd, TABLE_LIST *tables); bool insert_select_precheck(THD *thd, TABLE_LIST *tables);
int update_precheck(THD *thd, TABLE_LIST *tables); bool update_precheck(THD *thd, TABLE_LIST *tables);
int delete_precheck(THD *thd, TABLE_LIST *tables); bool delete_precheck(THD *thd, TABLE_LIST *tables);
int insert_precheck(THD *thd, TABLE_LIST *tables, bool update); bool insert_precheck(THD *thd, TABLE_LIST *tables, bool update);
int create_table_precheck(THD *thd, TABLE_LIST *tables, bool create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table); TABLE_LIST *create_table);
Item *negate_expression(THD *thd, Item *expr); Item *negate_expression(THD *thd, Item *expr);
#include "sql_class.h" #include "sql_class.h"
#include "opt_range.h" #include "opt_range.h"
@ -475,12 +475,12 @@ struct Query_cache_query_flags
#define prepare_execute(A) ((A)->command == COM_EXECUTE) #define prepare_execute(A) ((A)->command == COM_EXECUTE)
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent); bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create); bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent); bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags); void mysql_binlog_send(THD* thd, char* log_ident, my_off_t pos, ushort flags);
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary); my_bool drop_temporary);
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists, int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
bool drop_temporary, bool drop_view, bool log_query); bool drop_temporary, bool drop_view, bool log_query);
int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables, int mysql_rm_table_part2_with_lock(THD *thd, TABLE_LIST *tables,
@ -507,7 +507,7 @@ extern "C" pthread_handler_decl(handle_one_connection,arg);
extern "C" pthread_handler_decl(handle_bootstrap,arg); extern "C" pthread_handler_decl(handle_bootstrap,arg);
void end_thread(THD *thd,bool put_in_cache); void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache(); void flush_thread_cache();
int mysql_execute_command(THD *thd); bool mysql_execute_command(THD *thd);
bool do_command(THD *thd); bool do_command(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd, bool dispatch_command(enum enum_server_command command, THD *thd,
char* packet, uint packet_length); char* packet, uint packet_length);
@ -526,22 +526,22 @@ bool check_table_access(THD *thd, ulong want_access, TABLE_LIST *tables,
bool no_errors); bool no_errors);
bool check_global_access(THD *thd, ulong want_access); bool check_global_access(THD *thd, ulong want_access);
int mysql_backup_table(THD* thd, TABLE_LIST* table_list); bool mysql_backup_table(THD* thd, TABLE_LIST* table_list);
int mysql_restore_table(THD* thd, TABLE_LIST* table_list); bool mysql_restore_table(THD* thd, TABLE_LIST* table_list);
int mysql_checksum_table(THD* thd, TABLE_LIST* table_list, bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_check_table(THD* thd, TABLE_LIST* table_list, bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_repair_table(THD* thd, TABLE_LIST* table_list, bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_analyze_table(THD* thd, TABLE_LIST* table_list, bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list, bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt); HA_CHECK_OPT* check_opt);
int mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list, bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
LEX_STRING *key_cache_name); LEX_STRING *key_cache_name);
int mysql_preload_keys(THD* thd, TABLE_LIST* table_list); bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache, int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache,
KEY_CACHE *dst_cache); KEY_CACHE *dst_cache);
@ -554,20 +554,20 @@ int setup_group(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, List<Item> &all_fields, ORDER *order, List<Item> &fields, List<Item> &all_fields, ORDER *order,
bool *hidden_group_fields); bool *hidden_group_fields);
int handle_select(THD *thd, LEX *lex, select_result *result); bool handle_select(THD *thd, LEX *lex, select_result *result);
int mysql_select(THD *thd, Item ***rref_pointer_array, bool mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &list, TABLE_LIST *tables, uint wild_num, List<Item> &list,
COND *conds, uint og_num, ORDER *order, ORDER *group, COND *conds, uint og_num, ORDER *order, ORDER *group,
Item *having, ORDER *proc_param, ulong select_type, Item *having, ORDER *proc_param, ulong select_type,
select_result *result, SELECT_LEX_UNIT *unit, select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex); SELECT_LEX *select_lex);
void free_underlaid_joins(THD *thd, SELECT_LEX *select); void free_underlaid_joins(THD *thd, SELECT_LEX *select);
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit,
select_result *result); select_result *result);
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type, int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
select_result *result); select_result *result);
int mysql_union(THD *thd, LEX *lex, select_result *result, bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit); SELECT_LEX_UNIT *unit);
int mysql_handle_derived(LEX *lex); int mysql_handle_derived(LEX *lex);
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type, Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
Item ***copy_func, Field **from_field, Item ***copy_func, Field **from_field,
@ -577,61 +577,61 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
List<Key> &keys, uint &db_options, List<Key> &keys, uint &db_options,
handler *file, KEY *&key_info_buffer, handler *file, KEY *&key_info_buffer,
uint &key_count, int select_field_count); uint &key_count, int select_field_count);
int mysql_create_table(THD *thd,const char *db, const char *table_name, bool mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys, List<create_field> &fields, List<Key> &keys,
bool tmp_table, uint select_field_count); bool tmp_table, uint select_field_count);
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info, TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
TABLE_LIST *create_table, TABLE_LIST *create_table,
List<create_field> *extra_fields, List<create_field> *extra_fields,
List<Key> *keys, List<Key> *keys,
List<Item> *items, List<Item> *items,
MYSQL_LOCK **lock); MYSQL_LOCK **lock);
int mysql_alter_table(THD *thd, char *new_db, char *new_name, bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<create_field> &fields, List<create_field> &fields,
List<Key> &keys, List<Key> &keys,
uint order_num, ORDER *order, uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok=1); ALTER_INFO *alter_info, bool do_send_ok=1);
int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok); bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
int mysql_create_like_table(THD *thd, TABLE_LIST *table, bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
Table_ident *src_table); Table_ident *src_table);
bool mysql_rename_table(enum db_type base, bool mysql_rename_table(enum db_type base,
const char *old_db, const char *old_db,
const char * old_name, const char * old_name,
const char *new_db, const char *new_db,
const char * new_name); const char * new_name);
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys); bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
int mysql_drop_index(THD *thd, TABLE_LIST *table_list, bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info); ALTER_INFO *alter_info);
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list, int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
Item **conds, uint order_num, ORDER *order); Item **conds, uint order_num, ORDER *order);
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields, bool mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds, List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit, uint order_num, ORDER *order, ha_rows limit,
enum enum_duplicates handle_duplicates); enum enum_duplicates handle_duplicates);
int mysql_multi_update(THD *thd, TABLE_LIST *table_list, bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
List<Item> *fields, List<Item> *values, List<Item> *fields, List<Item> *values,
COND *conds, ulong options, COND *conds, ulong options,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex); SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table, bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
List<Item> &fields, List_item *values, List<Item> &fields, List_item *values,
List<Item> &update_fields, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates duplic); List<Item> &update_values, enum_duplicates duplic);
int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields, bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields, List<List_item> &values, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates flag); List<Item> &update_values, enum_duplicates flag);
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry); int check_that_all_fields_are_given_values(THD *thd, TABLE *entry);
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds); bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order, bool mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
ha_rows rows, ulong options); ha_rows rows, ulong options);
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok); bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create); bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create);
TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update); TABLE *open_ltable(THD *thd, TABLE_LIST *table_list, thr_lock_type update);
TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem, TABLE *open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
bool *refresh); bool *refresh);
@ -683,45 +683,45 @@ void free_des_key_file();
#endif /* HAVE_OPENSSL */ #endif /* HAVE_OPENSSL */
/* sql_do.cc */ /* sql_do.cc */
int mysql_do(THD *thd, List<Item> &values); bool mysql_do(THD *thd, List<Item> &values);
/* sql_show.cc */ /* sql_show.cc */
int mysqld_show_dbs(THD *thd,const char *wild); bool mysqld_show_dbs(THD *thd,const char *wild);
int mysqld_show_open_tables(THD *thd,const char *wild); bool mysqld_show_open_tables(THD *thd,const char *wild);
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 verbose); bool verbose);
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);
int mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild, bool mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
bool verbose); bool verbose);
int mysqld_show_keys(THD *thd, TABLE_LIST *table); bool mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd); bool mysqld_show_logs(THD *thd);
void append_identifier(THD *thd, String *packet, const char *name, void append_identifier(THD *thd, String *packet, const char *name,
uint length); uint length);
void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild); void mysqld_list_fields(THD *thd,TABLE_LIST *table, const char *wild);
int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1); int mysqld_dump_create_info(THD *thd, TABLE *table, int fd = -1);
int mysqld_show_create(THD *thd, TABLE_LIST *table_list); bool mysqld_show_create(THD *thd, TABLE_LIST *table_list);
int mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create); bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
void mysqld_list_processes(THD *thd,const char *user,bool verbose); void mysqld_list_processes(THD *thd,const char *user,bool verbose);
int mysqld_show_status(THD *thd); int mysqld_show_status(THD *thd);
int mysqld_show_variables(THD *thd,const char *wild); int mysqld_show_variables(THD *thd,const char *wild);
int mysqld_show(THD *thd, const char *wild, show_var_st *variables, bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
enum enum_var_type value_type, enum enum_var_type value_type,
pthread_mutex_t *mutex, pthread_mutex_t *mutex,
struct system_status_var *status_var); struct system_status_var *status_var);
int mysql_find_files(THD *thd,List<char> *files, const char *db, int mysql_find_files(THD *thd,List<char> *files, const char *db,
const char *path, const char *wild, bool dir); const char *path, const char *wild, bool dir);
int mysqld_show_charsets(THD *thd,const char *wild); bool mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(THD *thd,const char *wild); bool mysqld_show_collations(THD *thd,const char *wild);
int mysqld_show_storage_engines(THD *thd); bool mysqld_show_storage_engines(THD *thd);
int mysqld_show_privileges(THD *thd); bool mysqld_show_privileges(THD *thd);
int mysqld_show_column_types(THD *thd); bool mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text); bool mysqld_help (THD *thd, const char *text);
void calc_sum_of_all_status(STATUS_VAR *to); void calc_sum_of_all_status(STATUS_VAR *to);
/* sql_prepare.cc */ /* sql_prepare.cc */
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
LEX_STRING *name=NULL); LEX_STRING *name=NULL);
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length); void mysql_stmt_execute(THD *thd, char *packet, uint packet_length);
void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name); void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name);
void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length); void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length);
@ -736,15 +736,15 @@ MYSQL_ERROR *push_warning(THD *thd, MYSQL_ERROR::enum_warning_level level, uint
void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level, void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
uint code, const char *format, ...); uint code, const char *format, ...);
void mysql_reset_errors(THD *thd); void mysql_reset_errors(THD *thd);
my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show); bool mysqld_show_warnings(THD *thd, ulong levels_to_show);
/* sql_handler.cc */ /* sql_handler.cc */
int mysql_ha_open(THD *thd, TABLE_LIST *tables); bool mysql_ha_open(THD *thd, TABLE_LIST *tables);
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool mysql_ha_close(THD *thd, TABLE_LIST *tables,
bool dont_send_ok=0, bool dont_lock=0, bool no_alias=0); bool dont_send_ok=0, bool dont_lock=0, bool no_alias=0);
int mysql_ha_close_list(THD *thd, TABLE_LIST *tables, bool flushed=0); int mysql_ha_close_list(THD *thd, TABLE_LIST *tables, bool flushed=0);
int mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *, bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows); List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
/* sql_base.cc */ /* sql_base.cc */
void set_item_name(Item *item,char *pos,uint length); void set_item_name(Item *item,char *pos,uint length);
@ -779,16 +779,16 @@ bool insert_fields(THD *thd,TABLE_LIST *tables,
bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds); bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds);
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields, int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
List<Item> *sum_func_list, uint wild_num); List<Item> *sum_func_list, uint wild_num);
int setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables, bool setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
List<Item> &item, bool set_query_id, List<Item> &item, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func); List<Item> *sum_func_list, bool allow_sum_func);
int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds); int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
int setup_ftfuncs(SELECT_LEX* select); int setup_ftfuncs(SELECT_LEX* select);
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order); int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
void wait_for_refresh(THD *thd); void wait_for_refresh(THD *thd);
int open_tables(THD *thd, TABLE_LIST *tables, uint *counter); int open_tables(THD *thd, TABLE_LIST *tables, uint *counter);
int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables); int simple_open_n_lock_tables(THD *thd,TABLE_LIST *tables);
int open_and_lock_tables(THD *thd,TABLE_LIST *tables); bool open_and_lock_tables(THD *thd,TABLE_LIST *tables);
int lock_tables(THD *thd, TABLE_LIST *tables, uint counter); int lock_tables(THD *thd, TABLE_LIST *tables, uint counter);
TABLE *open_temporary_table(THD *thd, const char *path, const char *db, TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
const char *table_name, bool link_in_list); const char *table_name, bool link_in_list);
@ -838,9 +838,9 @@ inline TABLE_LIST *find_table_in_local_list(TABLE_LIST *table,
bool eval_const_cond(COND *cond); bool eval_const_cond(COND *cond);
/* sql_load.cc */ /* sql_load.cc */
int mysql_load(THD *thd,sql_exchange *ex, TABLE_LIST *table_list, bool mysql_load(THD *thd,sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates, List<Item> &fields, enum enum_duplicates handle_duplicates,
bool local_file,thr_lock_type lock_type); bool local_file,thr_lock_type lock_type);
int write_record(THD *thd, TABLE *table, COPY_INFO *info); int write_record(THD *thd, TABLE *table, COPY_INFO *info);
/* sql_manager.cc */ /* sql_manager.cc */

View file

@ -1145,7 +1145,7 @@ static void server_init(void)
WSADATA WsaData; WSADATA WsaData;
if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData)) if (SOCKET_ERROR == WSAStartup (0x0101, &WsaData))
{ {
my_message(0,"WSAStartup Failed\n",MYF(0)); my_error(ER_WSAS_FAILED, MYF(0));
unireg_abort(1); unireg_abort(1);
} }
} }
@ -1298,8 +1298,9 @@ void yyerror(const char *s)
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */ /* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0) if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR); s=ER(ER_SYNTAX_ERROR);
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "", my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
thd->lex->yylineno); (yytext ? (char*) yytext : ""),
thd->lex->yylineno);
} }
@ -1330,7 +1331,7 @@ void close_connection(THD *thd, uint errcode, bool lock)
if ((vio=thd->net.vio) != 0) if ((vio=thd->net.vio) != 0)
{ {
if (errcode) if (errcode)
send_error(thd, errcode, ER(errcode)); /* purecov: inspected */ net_send_error(thd, errcode, ER(errcode)); /* purecov: inspected */
vio_close(vio); /* vio is freed in delete thd */ vio_close(vio); /* vio is freed in delete thd */
} }
if (lock) if (lock)
@ -2091,6 +2092,11 @@ extern "C" int my_message_sql(uint error, const char *str,
THD *thd; THD *thd;
DBUG_ENTER("my_message_sql"); DBUG_ENTER("my_message_sql");
DBUG_PRINT("error", ("error: %u message: '%s'", error, str)); DBUG_PRINT("error", ("error: %u message: '%s'", error, str));
/*
Put here following assertion when situation with EE_* error codes
will be fixed
DBUG_ASSERT(error != 0);
*/
if ((thd= current_thd)) if ((thd= current_thd))
{ {
if (thd->spcont && if (thd->spcont &&
@ -2098,6 +2104,9 @@ extern "C" int my_message_sql(uint error, const char *str,
{ {
DBUG_RETURN(0); DBUG_RETURN(0);
} }
thd->query_error= 1; // needed to catch query errors during replication
/* /*
thd->lex->current_select == 0 if lex structure is not inited thd->lex->current_select == 0 if lex structure is not inited
(not query command (COM_QUERY)) (not query command (COM_QUERY))
@ -2112,6 +2121,9 @@ extern "C" int my_message_sql(uint error, const char *str,
{ {
NET *net= &thd->net; NET *net= &thd->net;
net->report_error= 1; net->report_error= 1;
#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(net);
#endif
if (!net->last_error[0]) // Return only first message if (!net->last_error[0]) // Return only first message
{ {
strmake(net->last_error, str, sizeof(net->last_error)-1); strmake(net->last_error, str, sizeof(net->last_error)-1);
@ -3381,10 +3393,10 @@ static void create_new_thread(THD *thd)
("Can't create thread to handle request (error %d)", ("Can't create thread to handle request (error %d)",
error)); error));
thread_count--; thread_count--;
thd->killed= THD::KILL_CONNECTION; // Safety thd->killed= THD::KILL_CONNECTION; // Safety
(void) pthread_mutex_unlock(&LOCK_thread_count); (void) pthread_mutex_unlock(&LOCK_thread_count);
statistic_increment(aborted_connects,&LOCK_status); statistic_increment(aborted_connects,&LOCK_status);
net_printf(thd,ER_CANT_CREATE_THREAD,error); net_printf_error(thd, ER_CANT_CREATE_THREAD, error);
(void) pthread_mutex_lock(&LOCK_thread_count); (void) pthread_mutex_lock(&LOCK_thread_count);
close_connection(thd,0,0); close_connection(thd,0,0);
delete thd; delete thd;

View file

@ -53,14 +53,14 @@ bool Protocol_prep::net_store_data(const char *from, uint length)
/* Send a error string to client */ /* Send a error string to client */
void send_error(THD *thd, uint sql_errno, const char *err) void net_send_error(THD *thd, uint sql_errno, const char *err)
{ {
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
uint length; uint length;
char buff[MYSQL_ERRMSG_SIZE+2], *pos; char buff[MYSQL_ERRMSG_SIZE+2], *pos;
#endif #endif
NET *net= &thd->net; NET *net= &thd->net;
DBUG_ENTER("send_error"); DBUG_ENTER("net_send_error");
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno, DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
err ? err : net->last_error[0] ? err ? err : net->last_error[0] ?
net->last_error : "NULL")); net->last_error : "NULL"));
@ -70,9 +70,6 @@ void send_error(THD *thd, uint sql_errno, const char *err)
{ {
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
#ifndef EMBEDDED_LIBRARY /* TODO query cache in embedded library*/
query_cache_abort(net);
#endif
thd->query_error= 1; // needed to catch query errors during replication thd->query_error= 1; // needed to catch query errors during replication
if (!err) if (!err)
{ {
@ -172,7 +169,7 @@ void send_warning(THD *thd, uint sql_errno, const char *err)
*/ */
void void
net_printf(THD *thd, uint errcode, ...) net_printf_error(THD *thd, uint errcode, ...)
{ {
va_list args; va_list args;
uint length,offset; uint length,offset;
@ -185,7 +182,7 @@ net_printf(THD *thd, uint errcode, ...)
#endif #endif
NET *net= &thd->net; NET *net= &thd->net;
DBUG_ENTER("net_printf"); DBUG_ENTER("net_printf_error");
DBUG_PRINT("enter",("message: %u",errcode)); DBUG_PRINT("enter",("message: %u",errcode));
if (thd->spcont && thd->spcont->find_handler(errcode, if (thd->spcont && thd->spcont->find_handler(errcode,
@ -199,8 +196,8 @@ net_printf(THD *thd, uint errcode, ...)
#endif #endif
va_start(args,errcode); va_start(args,errcode);
/* /*
The following is needed to make net_printf() work with 0 argument for The following is needed to make net_printf_error() work with 0 argument
errorcode and use the argument after that as the format string. This for errorcode and use the argument after that as the format string. This
is useful for rare errors that are not worth the hassle to put in is useful for rare errors that are not worth the hassle to put in
errmsg.sys, but at the same time, the message is not fixed text errmsg.sys, but at the same time, the message is not fixed text
*/ */
@ -614,7 +611,7 @@ bool Protocol::send_fields(List<Item> *list, int flags)
DBUG_RETURN(prepare_for_send(list)); DBUG_RETURN(prepare_for_send(list));
err: err:
send_error(thd,ER_OUT_OF_RESOURCES); /* purecov: inspected */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }

View file

@ -172,7 +172,8 @@ public:
}; };
void send_warning(THD *thd, uint sql_errno, const char *err=0); void send_warning(THD *thd, uint sql_errno, const char *err=0);
void net_printf(THD *thd,uint sql_errno, ...); void net_printf_error(THD *thd, uint sql_errno, ...);
void net_send_error(THD *thd, uint sql_errno=0, const char *err=0);
void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L, void send_ok(THD *thd, ha_rows affected_rows=0L, ulonglong id=0L,
const char *info=0); const char *info=0);
void send_eof(THD *thd, bool no_flush=0); void send_eof(THD *thd, bool no_flush=0);

View file

@ -85,7 +85,7 @@ bool Protocol_cursor::send_fields(List<Item> *list, int flags)
DBUG_RETURN(FALSE); DBUG_RETURN(FALSE);
err: err:
send_error(thd, ER_OUT_OF_RESOURCES); /* purecov: inspected */ my_error(ER_OUT_OF_RESOURCES, MYF(0)); /* purecov: inspected */
DBUG_RETURN(TRUE); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }

View file

@ -196,7 +196,6 @@ err:
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave", my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
MYF(0)); MYF(0));
err2: err2:
send_error(thd);
return 1; return 1;
} }
@ -440,7 +439,7 @@ static Slave_log_event* find_slave_event(IO_CACHE* log,
This function is broken now. See comment for translate_master(). This function is broken now. See comment for translate_master().
*/ */
int show_new_master(THD* thd) bool show_new_master(THD* thd)
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
DBUG_ENTER("show_new_master"); DBUG_ENTER("show_new_master");
@ -454,7 +453,7 @@ int show_new_master(THD* thd)
if (errmsg[0]) if (errmsg[0])
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
"SHOW NEW MASTER", errmsg); "SHOW NEW MASTER", errmsg);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
else else
{ {
@ -463,14 +462,14 @@ int show_new_master(THD* thd)
MYSQL_TYPE_LONGLONG)); MYSQL_TYPE_LONGLONG));
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(lex_mi->log_file_name, &my_charset_bin); protocol->store(lex_mi->log_file_name, &my_charset_bin);
protocol->store((ulonglong) lex_mi->pos); protocol->store((ulonglong) lex_mi->pos);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
} }
@ -633,7 +632,7 @@ err:
} }
int show_slave_hosts(THD* thd) bool show_slave_hosts(THD* thd)
{ {
List<Item> field_list; List<Item> field_list;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
@ -655,7 +654,7 @@ int show_slave_hosts(THD* thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
pthread_mutex_lock(&LOCK_slave_list); pthread_mutex_lock(&LOCK_slave_list);
@ -676,12 +675,12 @@ int show_slave_hosts(THD* thd)
if (protocol->write()) if (protocol->write())
{ {
pthread_mutex_unlock(&LOCK_slave_list); pthread_mutex_unlock(&LOCK_slave_list);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
pthread_mutex_unlock(&LOCK_slave_list); pthread_mutex_unlock(&LOCK_slave_list);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -762,7 +761,7 @@ static int fetch_db_tables(THD *thd, MYSQL *mysql, const char *db,
- No active transaction (flush_relay_log_info would not work in this case) - No active transaction (flush_relay_log_info would not work in this case)
*/ */
int load_master_data(THD* thd) bool load_master_data(THD* thd)
{ {
MYSQL mysql; MYSQL mysql;
MYSQL_RES* master_status_res = 0; MYSQL_RES* master_status_res = 0;
@ -784,16 +783,15 @@ int load_master_data(THD* thd)
(error=terminate_slave_threads(active_mi,restart_thread_mask, (error=terminate_slave_threads(active_mi,restart_thread_mask,
1 /*skip lock*/))) 1 /*skip lock*/)))
{ {
send_error(thd,error); my_error(error, MYF(0));
unlock_slave_threads(active_mi); unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi); pthread_mutex_unlock(&LOCK_active_mi);
return 1; return TRUE;
} }
if (connect_to_master(thd, &mysql, active_mi)) if (connect_to_master(thd, &mysql, active_mi))
{ {
net_printf(thd, error= ER_CONNECT_TO_MASTER, my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql));
mysql_error(&mysql));
goto err; goto err;
} }
@ -805,8 +803,7 @@ int load_master_data(THD* thd)
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) || if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mysql_store_result(&mysql))) !(db_res = mysql_store_result(&mysql)))
{ {
net_printf(thd, error = ER_QUERY_ON_MASTER, my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
mysql_error(&mysql));
goto err; goto err;
} }
@ -819,7 +816,7 @@ int load_master_data(THD* thd)
if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*)))) if (!(table_res = (MYSQL_RES**)thd->alloc(num_dbs * sizeof(MYSQL_RES*))))
{ {
net_printf(thd, error = ER_OUTOFMEMORY); my_error(error = ER_OUTOFMEMORY, MYF(0));
goto err; goto err;
} }
@ -833,8 +830,7 @@ int load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) || mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mysql_store_result(&mysql))) !(master_status_res = mysql_store_result(&mysql)))
{ {
net_printf(thd, error = ER_QUERY_ON_MASTER, my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
mysql_error(&mysql));
goto err; goto err;
} }
@ -879,7 +875,6 @@ int load_master_data(THD* thd)
if (mysql_create_db(thd, db, &create_info, 1)) if (mysql_create_db(thd, db, &create_info, 1))
{ {
send_error(thd, 0, 0);
cleanup_mysql_results(db_res, cur_table_res - 1, table_res); cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
goto err; goto err;
} }
@ -888,8 +883,7 @@ int load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW TABLES", 11) || mysql_real_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mysql_store_result(&mysql))) !(*cur_table_res = mysql_store_result(&mysql)))
{ {
net_printf(thd, error = ER_QUERY_ON_MASTER, my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
mysql_error(&mysql));
cleanup_mysql_results(db_res, cur_table_res - 1, table_res); cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
goto err; goto err;
} }
@ -927,7 +921,7 @@ int load_master_data(THD* thd)
if (init_master_info(active_mi, master_info_file, relay_log_info_file, if (init_master_info(active_mi, master_info_file, relay_log_info_file,
0)) 0))
send_error(thd, ER_MASTER_INFO); my_error(ER_MASTER_INFO, MYF(0));
strmake(active_mi->master_log_name, row[0], strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name)); sizeof(active_mi->master_log_name));
active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error); active_mi->master_log_pos= my_strtoll10(row[1], (char**) 0, &error);
@ -946,8 +940,7 @@ int load_master_data(THD* thd)
if (mysql_real_query(&mysql, "UNLOCK TABLES", 13)) if (mysql_real_query(&mysql, "UNLOCK TABLES", 13))
{ {
net_printf(thd, error = ER_QUERY_ON_MASTER, my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
mysql_error(&mysql));
goto err; goto err;
} }
} }
@ -956,10 +949,10 @@ int load_master_data(THD* thd)
0 /* not only reset, but also reinit */, 0 /* not only reset, but also reinit */,
&errmsg)) &errmsg))
{ {
send_error(thd, 0, "Failed purging old relay logs"); my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
unlock_slave_threads(active_mi); unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi); pthread_mutex_unlock(&LOCK_active_mi);
return 1; return TRUE;
} }
pthread_mutex_lock(&active_mi->rli.data_lock); pthread_mutex_lock(&active_mi->rli.data_lock);
active_mi->rli.group_master_log_pos = active_mi->master_log_pos; active_mi->rli.group_master_log_pos = active_mi->master_log_pos;

View file

@ -24,11 +24,11 @@ int update_slave_list(MYSQL* mysql, MASTER_INFO* mi);
extern HASH slave_list; extern HASH slave_list;
int load_master_data(THD* thd); bool load_master_data(THD* thd);
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi); int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi);
int show_new_master(THD* thd); bool show_new_master(THD* thd);
int show_slave_hosts(THD* thd); bool show_slave_hosts(THD* thd);
int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg); int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg);
void init_slave_list(); void init_slave_list();
void end_slave_list(); void end_slave_list();

View file

@ -1520,8 +1520,8 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
{ {
if (var_type != OPT_DEFAULT) if (var_type != OPT_DEFAULT)
{ {
net_printf(thd, ER_INCORRECT_GLOBAL_LOCAL_VAR, my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL"); name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
return 0; return 0;
} }
/* As there was no local variable, return the global value */ /* As there was no local variable, return the global value */
@ -1564,7 +1564,7 @@ Item *sys_var::item(THD *thd, enum_var_type var_type, LEX_STRING *base)
return tmp; return tmp;
} }
default: default:
net_printf(thd, ER_VAR_CANT_BE_READ, name); my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
} }
return 0; return 0;
} }
@ -1950,8 +1950,8 @@ bool sys_var_character_set_server::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() || (mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running)) active_mi->slave_running || active_mi->rli.slave_running))
{ {
my_printf_error(0, "Binary logging and replication forbid changing \ my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
the global server character set or collation", MYF(0)); "character set, collation");
return 1; return 1;
} }
return sys_var_character_set::check(thd,var); return sys_var_character_set::check(thd,var);
@ -2057,8 +2057,8 @@ bool sys_var_collation_server::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() || (mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running)) active_mi->slave_running || active_mi->rli.slave_running))
{ {
my_printf_error(0, "Binary logging and replication forbid changing \ my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
the global server character set or collation", MYF(0)); "character set, collation");
return 1; return 1;
} }
return sys_var_collation::check(thd,var); return sys_var_collation::check(thd,var);
@ -2407,8 +2407,7 @@ bool sys_var_thd_time_zone::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() || (mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running)) active_mi->slave_running || active_mi->rli.slave_running))
{ {
my_printf_error(0, "Binary logging and replication forbid changing " my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0), "time zone");
"of the global server time zone", MYF(0));
return 1; return 1;
} }
#endif #endif
@ -2686,9 +2685,6 @@ void set_var_free()
length Length of variable. zero means that we should use strlen() length Length of variable. zero means that we should use strlen()
on the variable on the variable
NOTE
We have to use net_printf() as this is called during the parsing stage
RETURN VALUES RETURN VALUES
pointer pointer to variable definitions pointer pointer to variable definitions
0 Unknown variable (error message is given) 0 Unknown variable (error message is given)
@ -2701,7 +2697,7 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length : length ? length :
strlen(str)); strlen(str));
if (!var) if (!var)
net_printf(current_thd, ER_UNKNOWN_SYSTEM_VARIABLE, (char*) str); my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
return var; return var;
} }

View file

@ -398,3 +398,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -389,3 +389,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -398,3 +398,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -391,3 +391,22 @@ character-set=latin7
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -399,3 +399,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=greek
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -391,3 +391,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -390,3 +390,22 @@ character-set=ujis
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=euckr
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -388,3 +388,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -388,3 +388,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -391,3 +391,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -388,3 +388,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -391,3 +391,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -391,3 +391,22 @@ character-set=koi8r
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION ÄÌÑ ÎÅÏÂÎÏ×ÌÑÅÍÏÇÏ VIEW '%-.64s.%-.64s'" "CHECK OPTION ÄÌÑ ÎÅÏÂÎÏ×ÌÑÅÍÏÇÏ VIEW '%-.64s.%-.64s'"
"ÐÒÏ×ÅÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÐÒÏ×ÁÌÉÌÁÓØ" "ÐÒÏ×ÅÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÐÒÏ×ÁÌÉÌÁÓØ"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -379,3 +379,22 @@ character-set=cp1250
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -394,3 +394,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -390,3 +390,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -386,3 +386,22 @@ character-set=latin1
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.64s.%-.64s'" "CHECK OPTION on non-updatable view '%-.64s.%-.64s'"
"CHECK OPTION failed '%-.64s.%-.64s'" "CHECK OPTION failed '%-.64s.%-.64s'"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -392,3 +392,22 @@ character-set=koi8u
"Illegal %s '%-.64s' value found during parsing", "Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÝÏ ÎÅ ÍÏÖÅ ÂÕÔÉ ÏÎÏ×ÌÅÎÎÉÍ" "CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÝÏ ÎÅ ÍÏÖÅ ÂÕÔÉ ÏÎÏ×ÌÅÎÎÉÍ"
"ÐÅÒÅצÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÎÅ ÐÒÏÊÛÌÁ" "ÐÅÒÅצÒËÁ CHECK OPTION ÄÌÑ VIEW '%-.64s.%-.64s' ÎÅ ÐÒÏÊÛÌÁ"
"Failed purging old relay logs: %s"
"Password hash should be a %d-digit hexadecimal number"
"Target log not found in binlog index"
"I/O error reading log index file"
"Server configuration does not permit binlog purge"
"Failed on fseek()"
"Fatal error during log purge"
"A purgeable log is in use, will not purge"
"Unknown error during log purge"
"Failed initializing relay log position: %s"
"You are not using binary logging"
"The '%-.64s' syntax is reserved for purposes internal to the MySQL server"
"WSAStartup Failed"
"Can't handle procedures with differents groups yet"
"Select must have a group with this procedure"
"Can't use ORDER clause with this procedure"
"Binary logging and replication forbid changing the global server %s"
"Can't map file: %-.64s, errno: %d"
"Wrong magic in %-.64s"

View file

@ -1489,7 +1489,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
packet_len= my_net_read(net); // read create table statement packet_len= my_net_read(net); // read create table statement
if (packet_len == packet_error) if (packet_len == packet_error)
{ {
send_error(thd, ER_MASTER_NET_READ); my_error(ER_MASTER_NET_READ, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (net->read_pos[0] == 255) // error from master if (net->read_pos[0] == 255) // error from master
@ -1498,7 +1498,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
err_msg= (char*) net->read_pos + ((mysql->server_capabilities & err_msg= (char*) net->read_pos + ((mysql->server_capabilities &
CLIENT_PROTOCOL_41) ? CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3); 3+SQLSTATE_LENGTH+1 : 3);
net_printf(thd, ER_MASTER, err_msg); my_error(ER_MASTER, MYF(0), err_msg);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->command = COM_TABLE_DUMP; thd->command = COM_TABLE_DUMP;
@ -1507,7 +1507,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
if (!(query = thd->strmake((char*) net->read_pos, packet_len))) if (!(query = thd->strmake((char*) net->read_pos, packet_len)))
{ {
sql_print_error("create_table_from_dump: out of memory"); sql_print_error("create_table_from_dump: out of memory");
net_printf(thd, ER_GET_ERRNO, "Out of memory"); my_error(ER_GET_ERRNO, MYF(0), "Out of memory");
DBUG_RETURN(1); DBUG_RETURN(1);
} }
thd->query= query; thd->query= query;
@ -1521,7 +1521,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
/* Drop the table if 'overwrite' is true */ /* Drop the table if 'overwrite' is true */
if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */ if (overwrite && mysql_rm_table(thd,&tables,1,0)) /* drop if exists */
{ {
send_error(thd);
sql_print_error("create_table_from_dump: failed to drop the table"); sql_print_error("create_table_from_dump: failed to drop the table");
goto err; goto err;
} }
@ -1544,7 +1543,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
tables.lock_type = TL_WRITE; tables.lock_type = TL_WRITE;
if (!open_ltable(thd, &tables, TL_WRITE)) if (!open_ltable(thd, &tables, TL_WRITE))
{ {
send_error(thd,0,0); // Send error from open_ltable
sql_print_error("create_table_from_dump: could not open created table"); sql_print_error("create_table_from_dump: could not open created table");
goto err; goto err;
} }
@ -1554,7 +1552,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
/* Copy the data file */ /* Copy the data file */
if (file->net_read_dump(net)) if (file->net_read_dump(net))
{ {
net_printf(thd, ER_MASTER_NET_READ); my_error(ER_MASTER_NET_READ, MYF(0));
sql_print_error("create_table_from_dump: failed in\ sql_print_error("create_table_from_dump: failed in\
handler::net_read_dump()"); handler::net_read_dump()");
goto err; goto err;
@ -1574,7 +1572,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
error=file->repair(thd,&check_opt) != 0; error=file->repair(thd,&check_opt) != 0;
thd->net.vio = save_vio; thd->net.vio = save_vio;
if (error) if (error)
net_printf(thd, ER_INDEX_REBUILD,tables.table->real_name); my_error(ER_INDEX_REBUILD, MYF(0), tables.table->real_name);
err: err:
close_thread_tables(thd); close_thread_tables(thd);
@ -1597,12 +1595,11 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
{ {
if (!(mysql = mysql_init(NULL))) if (!(mysql = mysql_init(NULL)))
{ {
send_error(thd); // EOM
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (connect_to_master(thd, mysql, mi)) if (connect_to_master(thd, mysql, mi))
{ {
net_printf(thd, ER_CONNECT_TO_MASTER, mysql_error(mysql)); my_error(ER_CONNECT_TO_MASTER, MYF(0), mysql_error(mysql));
mysql_close(mysql); mysql_close(mysql);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1626,7 +1623,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if (!called_connected) if (!called_connected)
mysql_close(mysql); mysql_close(mysql);
if (errmsg && thd->vio_ok()) if (errmsg && thd->vio_ok())
send_error(thd, error, errmsg); my_message(error, errmsg, MYF(0));
DBUG_RETURN(test(error)); // Return 1 on error DBUG_RETURN(test(error)); // Return 1 on error
} }
@ -2263,7 +2260,7 @@ void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a)
} }
} }
int show_master_info(THD* thd, MASTER_INFO* mi) bool show_master_info(THD* thd, MASTER_INFO* mi)
{ {
// TODO: fix this for multi-master // TODO: fix this for multi-master
List<Item> field_list; List<Item> field_list;
@ -2327,7 +2324,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if (mi->host[0]) if (mi->host[0])
{ {
@ -2426,10 +2423,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
pthread_mutex_unlock(&mi->data_lock); pthread_mutex_unlock(&mi->data_lock);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length())) if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }

View file

@ -474,8 +474,8 @@ int fetch_master_table(THD* thd, const char* db_name, const char* table_name,
void table_rule_ent_hash_to_str(String* s, HASH* h); void table_rule_ent_hash_to_str(String* s, HASH* h);
void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a); void table_rule_ent_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a);
int show_master_info(THD* thd, MASTER_INFO* mi); bool show_master_info(THD* thd, MASTER_INFO* mi);
int show_binlog_info(THD* thd); bool show_binlog_info(THD* thd);
/* See if the query uses any tables that should not be replicated */ /* See if the query uses any tables that should not be replicated */
int tables_ok(THD* thd, TABLE_LIST* tables); int tables_ok(THD* thd, TABLE_LIST* tables);

View file

@ -1013,7 +1013,7 @@ sp_cache_functions(THD *thd, LEX *lex)
{ {
delete newlex; delete newlex;
thd->lex= oldlex; thd->lex= oldlex;
net_printf(thd, ER_SP_DOES_NOT_EXIST, "FUNCTION", ls->str); my_error(ER_SP_DOES_NOT_EXIST, MYF(0), "FUNCTION", ls->str);
ret= 1; ret= 1;
break; break;
} }

View file

@ -494,16 +494,17 @@ sp_head::execute(THD *thd)
case SP_HANDLER_CONTINUE: case SP_HANDLER_CONTINUE:
ctx->save_variables(hf); ctx->save_variables(hf);
ctx->push_hstack(ip); ctx->push_hstack(ip);
// Fall through // Fall through
default: default:
ip= hip; ip= hip;
ret= 0; ret= 0;
ctx->clear_handler(); ctx->clear_handler();
ctx->in_handler= TRUE; ctx->in_handler= TRUE;
thd->clear_error();
continue; continue;
} }
} }
} while (ret == 0 && !thd->killed && !thd->query_error); } while (ret == 0 && !thd->killed);
cleanup_items(thd->current_arena->free_list); cleanup_items(thd->current_arena->free_list);
thd->current_arena= old_arena; thd->current_arena= old_arena;
@ -512,7 +513,7 @@ sp_head::execute(THD *thd)
DBUG_PRINT("info", ("ret=%d killed=%d query_error=%d", DBUG_PRINT("info", ("ret=%d killed=%d query_error=%d",
ret, thd->killed, thd->query_error)); ret, thd->killed, thd->query_error));
if (thd->killed || thd->query_error) if (thd->killed)
ret= -1; ret= -1;
/* If the DB has changed, the pointer has changed too, but the /* If the DB has changed, the pointer has changed too, but the
original thd->db will then have been freed */ original thd->db will then have been freed */
@ -622,8 +623,8 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (args->elements != params) if (args->elements != params)
{ {
net_printf(thd, ER_SP_WRONG_NO_OF_ARGS, "PROCEDURE", m_name.str, my_error(ER_SP_WRONG_NO_OF_ARGS, MYF(0),
params, args->elements); "PROCEDURE", m_name.str, params, args->elements);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -694,13 +695,7 @@ sp_head::execute_procedure(THD *thd, List<Item> *args)
if (! ret) if (! ret)
ret= execute(thd); ret= execute(thd);
// Don't copy back OUT values if we got an error if (!ret && csize > 0)
if (ret)
{
if (thd->net.report_error)
send_error(thd, 0, NullS);
}
else if (csize > 0)
{ {
List_iterator_fast<Item> li(*args); List_iterator_fast<Item> li(*args);
Item *it; Item *it;
@ -898,7 +893,7 @@ sp_head::check_backpatch(THD *thd)
{ {
if (bp->lab->type == SP_LAB_REF) if (bp->lab->type == SP_LAB_REF)
{ {
net_printf(thd, ER_SP_LILABEL_MISMATCH, "GOTO", bp->lab->name); my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "GOTO", bp->lab->name);
return -1; return -1;
} }
} }

View file

@ -148,7 +148,7 @@ sp_cursor::pre_open(THD *thd)
{ {
if (m_isopen) if (m_isopen)
{ {
send_error(thd, ER_SP_CURSOR_ALREADY_OPEN); my_error(ER_SP_CURSOR_ALREADY_OPEN, MYF(0));
return NULL; return NULL;
} }
@ -182,7 +182,7 @@ sp_cursor::close(THD *thd)
{ {
if (! m_isopen) if (! m_isopen)
{ {
send_error(thd, ER_SP_CURSOR_NOT_OPEN); my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0));
return -1; return -1;
} }
destroy(); destroy();
@ -212,12 +212,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
if (! m_isopen) if (! m_isopen)
{ {
send_error(thd, ER_SP_CURSOR_NOT_OPEN); my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0));
return -1; return -1;
} }
if (m_current_row == NULL) if (m_current_row == NULL)
{ {
send_error(thd, ER_SP_FETCH_NO_DATA); my_error(ER_SP_FETCH_NO_DATA, MYF(0));
return -1; return -1;
} }
@ -229,7 +229,7 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
if (fldcount >= m_prot->get_field_count()) if (fldcount >= m_prot->get_field_count())
{ {
send_error(thd, ER_SP_WRONG_NO_OF_FETCH_ARGS); my_error(ER_SP_WRONG_NO_OF_FETCH_ARGS, MYF(0));
return -1; return -1;
} }
s= row[fldcount]; s= row[fldcount];
@ -255,7 +255,7 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
} }
if (fldcount < m_prot->get_field_count()) if (fldcount < m_prot->get_field_count())
{ {
send_error(thd, ER_SP_WRONG_NO_OF_FETCH_ARGS); my_error(ER_SP_WRONG_NO_OF_FETCH_ARGS, MYF(0));
return -1; return -1;
} }
m_current_row= m_current_row->next; m_current_row= m_current_row->next;

View file

@ -1225,8 +1225,7 @@ bool check_change_password(THD *thd, const char *host, const char *user,
{ {
if (!initialized) if (!initialized)
{ {
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT, my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
"--skip-grant-tables");
return(1); return(1);
} }
if (!thd->slave_thread && if (!thd->slave_thread &&
@ -1238,16 +1237,14 @@ bool check_change_password(THD *thd, const char *host, const char *user,
} }
if (!thd->slave_thread && !thd->user[0]) if (!thd->slave_thread && !thd->user[0])
{ {
send_error(thd, ER_PASSWORD_ANONYMOUS_USER); my_error(ER_PASSWORD_ANONYMOUS_USER, MYF(0));
return(1); return(1);
} }
uint len=strlen(new_password); uint len=strlen(new_password);
if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH && if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323) len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{ {
net_printf(thd, 0, my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
"Password hash should be a %d-digit hexadecimal number",
SCRAMBLED_PASSWORD_CHAR_LENGTH);
return -1; return -1;
} }
return(0); return(0);
@ -1285,7 +1282,7 @@ bool change_password(THD *thd, const char *host, const char *user,
if (!(acl_user= find_acl_user(host, user))) if (!(acl_user= find_acl_user(host, user)))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); VOID(pthread_mutex_unlock(&acl_cache->lock));
send_error(thd, ER_PASSWORD_NO_MATCH); my_error(ER_PASSWORD_NO_MATCH, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
/* update loaded acl entry: */ /* update loaded acl entry: */
@ -1298,7 +1295,6 @@ bool change_password(THD *thd, const char *host, const char *user,
new_password, new_password_len)) new_password, new_password_len))
{ {
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */ VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(thd,0); /* purecov: deadcode */
DBUG_RETURN(1); /* purecov: deadcode */ DBUG_RETURN(1); /* purecov: deadcode */
} }
@ -2290,11 +2286,11 @@ table_error:
revoke_grant Set to 1 if this is a REVOKE command revoke_grant Set to 1 if this is a REVOKE command
RETURN RETURN
0 ok FALSE ok
1 error TRUE error
*/ */
int mysql_table_grant(THD *thd, TABLE_LIST *table_list, bool mysql_table_grant(THD *thd, TABLE_LIST *table_list,
List <LEX_USER> &user_list, List <LEX_USER> &user_list,
List <LEX_COLUMN> &columns, ulong rights, List <LEX_COLUMN> &columns, ulong rights,
bool revoke_grant) bool revoke_grant)
@ -2311,12 +2307,12 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ {
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-grant-tables"); /* purecov: inspected */ "--skip-grant-tables"); /* purecov: inspected */
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }
if (rights & ~TABLE_ACLS) if (rights & ~TABLE_ACLS)
{ {
my_error(ER_ILLEGAL_GRANT_FOR_TABLE,MYF(0)); my_error(ER_ILLEGAL_GRANT_FOR_TABLE,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (columns.elements && !revoke_grant) if (columns.elements && !revoke_grant)
@ -2325,8 +2321,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
List_iterator <LEX_COLUMN> column_iter(columns); List_iterator <LEX_COLUMN> column_iter(columns);
int res; int res;
if ((res= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
while ((column = column_iter++)) while ((column = column_iter++))
{ {
@ -2338,7 +2334,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ {
my_error(ER_BAD_FIELD_ERROR, MYF(0), my_error(ER_BAD_FIELD_ERROR, MYF(0),
column->column.c_ptr(), table_list->alias); column->column.c_ptr(), table_list->alias);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
column_priv|= column->rights; column_priv|= column->rights;
} }
@ -2353,7 +2349,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
if (access(buf,F_OK)) if (access(buf,F_OK))
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias); my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, table_list->alias);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
@ -2386,19 +2382,19 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
*/ */
tables[0].updating= tables[1].updating= tables[2].updating= 1; tables[0].updating= tables[1].updating= tables[2].updating= 1;
if (!tables_ok(0, tables)) if (!tables_ok(0, tables))
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
#endif #endif
if (simple_open_n_lock_tables(thd,tables)) if (simple_open_n_lock_tables(thd,tables))
{ // Should never happen { // Should never happen
close_thread_tables(thd); /* purecov: deadcode */ close_thread_tables(thd); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(TRUE); /* purecov: deadcode */
} }
if (!revoke_grant) if (!revoke_grant)
create_new_users= test_if_create_new_users(thd); create_new_users= test_if_create_new_users(thd);
int result=0; bool result= FALSE;
rw_wrlock(&LOCK_grant); rw_wrlock(&LOCK_grant);
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC); MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
my_pthread_setspecific_ptr(THR_MALLOC,&memex); my_pthread_setspecific_ptr(THR_MALLOC,&memex);
@ -2411,7 +2407,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
Str->user.length > USERNAME_LENGTH) Str->user.length > USERNAME_LENGTH)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1; result= TRUE;
continue; continue;
} }
/* Create user if needed */ /* Create user if needed */
@ -2421,7 +2417,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
pthread_mutex_unlock(&acl_cache->lock); pthread_mutex_unlock(&acl_cache->lock);
if (error) if (error)
{ {
result= -1; // Remember error result= TRUE; // Remember error
continue; // Add next user continue; // Add next user
} }
@ -2441,7 +2437,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
{ {
my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0), my_error(ER_NONEXISTING_TABLE_GRANT, MYF(0),
Str->user.str, Str->host.str, table_list->real_name); Str->user.str, Str->host.str, table_list->real_name);
result= -1; result= TRUE;
continue; continue;
} }
grant_table = new GRANT_TABLE (Str->host.str, db_name, grant_table = new GRANT_TABLE (Str->host.str, db_name,
@ -2450,7 +2446,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
column_priv); column_priv);
if (!grant_table) // end of memory if (!grant_table) // end of memory
{ {
result= -1; /* purecov: deadcode */ result= TRUE; /* purecov: deadcode */
continue; /* purecov: deadcode */ continue; /* purecov: deadcode */
} }
my_hash_insert(&column_priv_hash,(byte*) grant_table); my_hash_insert(&column_priv_hash,(byte*) grant_table);
@ -2494,7 +2490,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
db_name, real_name, db_name, real_name,
rights, column_priv, revoke_grant)) rights, column_priv, revoke_grant))
{ // Crashend table ?? { // Crashend table ??
result= -1; /* purecov: deadcode */ result= TRUE; /* purecov: deadcode */
} }
else if (tables[2].table) else if (tables[2].table)
{ {
@ -2503,7 +2499,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
db_name, real_name, db_name, real_name,
rights, revoke_grant))) rights, revoke_grant)))
{ {
result= -1; result= TRUE;
} }
} }
} }
@ -2517,8 +2513,8 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
} }
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list, bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
ulong rights, bool revoke_grant) ulong rights, bool revoke_grant)
{ {
List_iterator <LEX_USER> str_list (list); List_iterator <LEX_USER> str_list (list);
LEX_USER *Str; LEX_USER *Str;
@ -2530,7 +2526,7 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
{ {
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0),
"--skip-grant-tables"); /* purecov: tested */ "--skip-grant-tables"); /* purecov: tested */
DBUG_RETURN(-1); /* purecov: tested */ DBUG_RETURN(TRUE); /* purecov: tested */
} }
if (lower_case_table_names && db) if (lower_case_table_names && db)
@ -2561,14 +2557,14 @@ int mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
*/ */
tables[0].updating= tables[1].updating= 1; tables[0].updating= tables[1].updating= 1;
if (!tables_ok(0, tables)) if (!tables_ok(0, tables))
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
#endif #endif
if (simple_open_n_lock_tables(thd,tables)) if (simple_open_n_lock_tables(thd,tables))
{ // This should never happen { // This should never happen
close_thread_tables(thd); /* purecov: deadcode */ close_thread_tables(thd); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */ DBUG_RETURN(TRUE); /* purecov: deadcode */
} }
if (!revoke_grant) if (!revoke_grant)
@ -2880,11 +2876,11 @@ err:
command= "create view"; command= "create view";
else if (want_access & SHOW_VIEW_ACL) else if (want_access & SHOW_VIEW_ACL)
command= "show create view"; command= "show create view";
net_printf(thd,ER_TABLEACCESS_DENIED_ERROR, my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
command, command,
thd->priv_user, thd->priv_user,
thd->host_or_ip, thd->host_or_ip,
table ? table->real_name : "unknown"); table ? table->real_name : "unknown");
} }
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -3146,7 +3142,7 @@ static uint command_lengths[]=
Send to client grant-like strings depicting user@host privileges Send to client grant-like strings depicting user@host privileges
*/ */
int mysql_show_grants(THD *thd,LEX_USER *lex_user) bool mysql_show_grants(THD *thd,LEX_USER *lex_user)
{ {
ulong want_access; ulong want_access;
uint counter,index; uint counter,index;
@ -3161,7 +3157,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!initialized) if (!initialized)
{ {
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables"); my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!lex_user->host.str) if (!lex_user->host.str)
@ -3173,7 +3169,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
lex_user->user.length > USERNAME_LENGTH) lex_user->user.length > USERNAME_LENGTH)
{ {
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0)); my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
for (counter=0 ; counter < acl_users.elements ; counter++) for (counter=0 ; counter < acl_users.elements ; counter++)
@ -3192,7 +3188,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
{ {
my_error(ER_NONEXISTING_GRANT, MYF(0), my_error(ER_NONEXISTING_GRANT, MYF(0),
lex_user->user.str, lex_user->host.str); lex_user->user.str, lex_user->host.str);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
Item_string *field=new Item_string("",0,&my_charset_latin1); Item_string *field=new Item_string("",0,&my_charset_latin1);
@ -3204,7 +3200,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
field_list.push_back(field); field_list.push_back(field);
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
rw_wrlock(&LOCK_grant); rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
@ -3526,7 +3522,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
if (!initialized) if (!initialized)
{ {
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT, "--skip-grant-tables"); my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
@ -3595,7 +3591,7 @@ ACL_USER *check_acl_user(LEX_USER *user_name,
} }
int mysql_drop_user(THD *thd, List <LEX_USER> &list) bool mysql_drop_user(THD *thd, List <LEX_USER> &list)
{ {
uint counter, acl_userd; uint counter, acl_userd;
int result; int result;
@ -3606,7 +3602,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
DBUG_ENTER("mysql_drop_user"); DBUG_ENTER("mysql_drop_user");
if ((result= open_grant_tables(thd, tables))) if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result == 1 ? 0 : 1); DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant); rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));
@ -3694,7 +3690,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
record[0]))) record[0])))
{ {
tables[0].table->file->print_error(error, MYF(0)); tables[0].table->file->print_error(error, MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
delete_dynamic_element(&acl_users, acl_userd); delete_dynamic_element(&acl_users, acl_userd);
} }
@ -3708,7 +3704,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
DBUG_RETURN(result); DBUG_RETURN(result);
} }
int mysql_revoke_all(THD *thd, List <LEX_USER> &list) bool mysql_revoke_all(THD *thd, List <LEX_USER> &list)
{ {
uint counter; uint counter;
int result; int result;
@ -3717,7 +3713,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
DBUG_ENTER("mysql_revoke_all"); DBUG_ENTER("mysql_revoke_all");
if ((result= open_grant_tables(thd, tables))) if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result == 1 ? 0 : 1); DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant); rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock)); VOID(pthread_mutex_lock(&acl_cache->lock));

View file

@ -158,11 +158,11 @@ bool check_change_password(THD *thd, const char *host, const char *user,
char *password); char *password);
bool change_password(THD *thd, const char *host, const char *user, bool change_password(THD *thd, const char *host, const char *user,
char *password); char *password);
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list, bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
ulong rights, bool revoke); ulong rights, bool revoke);
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list, bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights, List <LEX_COLUMN> &column_list, ulong rights,
bool revoke); bool revoke);
my_bool grant_init(THD *thd); my_bool grant_init(THD *thd);
void grant_free(void); void grant_free(void);
void grant_reload(THD *thd); void grant_reload(THD *thd);
@ -179,11 +179,11 @@ ulong get_table_grant(THD *thd, TABLE_LIST *table);
ulong get_column_grant(THD *thd, GRANT_INFO *grant, ulong get_column_grant(THD *thd, GRANT_INFO *grant,
const char *db_name, const char *table_name, const char *db_name, const char *table_name,
const char *field_name); const char *field_name);
int mysql_show_grants(THD *thd, LEX_USER *user); bool mysql_show_grants(THD *thd, LEX_USER *user);
void get_privilege_desc(char *to, uint max_length, ulong access); void get_privilege_desc(char *to, uint max_length, ulong access);
void get_mqh(const char *user, const char *host, USER_CONN *uc); void get_mqh(const char *user, const char *host, USER_CONN *uc);
int mysql_drop_user(THD *thd, List <LEX_USER> &list); bool mysql_drop_user(THD *thd, List <LEX_USER> &list);
int mysql_revoke_all(THD *thd, List <LEX_USER> &list); bool mysql_revoke_all(THD *thd, List <LEX_USER> &list);
void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant, void fill_effective_table_privileges(THD *thd, GRANT_INFO *grant,
const char *db, const char *table); const char *db, const char *table);

View file

@ -1815,21 +1815,20 @@ int simple_open_n_lock_tables(THD *thd, TABLE_LIST *tables)
tables - list of tables for open&locking tables - list of tables for open&locking
RETURN RETURN
0 - ok FALSE - ok
-1 - error TRUE - error
1 - error reported to user
NOTE NOTE
The lock will automaticly be freed by close_thread_tables() 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"); DBUG_ENTER("open_and_lock_tables");
uint counter; uint counter;
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter) if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter)
|| mysql_handle_derived(thd->lex)) || mysql_handle_derived(thd->lex))
DBUG_RETURN(thd->net.report_error ? -1 : 1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
/* /*
Let us propagate pointers to open tables from global table list Let us propagate pointers to open tables from global table list
to table lists in particular selects if needed. to table lists in particular selects if needed.
@ -1850,7 +1849,7 @@ int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
} }
} }
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -2609,9 +2608,9 @@ int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
** Check that all given fields exists and fill struct with current data ** Check that all given fields exists and fill struct with current data
****************************************************************************/ ****************************************************************************/
int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, bool set_query_id, List<Item> &fields, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func) List<Item> *sum_func_list, bool allow_sum_func)
{ {
reg2 Item *item; reg2 Item *item;
List_iterator<Item> it(fields); List_iterator<Item> it(fields);
@ -2629,7 +2628,7 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
(item= *(it.ref()))->check_cols(1)) (item= *(it.ref()))->check_cols(1))
{ {
select_lex->no_wrap_view_item= 0; select_lex->no_wrap_view_item= 0;
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }
if (ref) if (ref)
*(ref++)= item; *(ref++)= item;
@ -2958,7 +2957,6 @@ insert_fields(THD *thd, TABLE_LIST *tables, const char *db_name,
my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name); my_error(ER_BAD_TABLE_ERROR, MYF(0), table_name);
err: err:
send_error(thd);
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View file

@ -762,7 +762,7 @@ select_result::select_result()
void select_result::send_error(uint errcode,const char *err) void select_result::send_error(uint errcode,const char *err)
{ {
::send_error(thd, errcode, err); my_message(errcode, err, MYF(0));
} }
@ -865,7 +865,7 @@ bool select_send::send_eof()
void select_to_file::send_error(uint errcode,const char *err) void select_to_file::send_error(uint errcode,const char *err)
{ {
::send_error(thd,errcode,err); my_message(errcode, err, MYF(0));
if (file > 0) if (file > 0)
{ {
(void) end_io_cache(&cache); (void) end_io_cache(&cache);

View file

@ -1112,6 +1112,7 @@ public:
net.last_error[0]= 0; net.last_error[0]= 0;
net.last_errno= 0; net.last_errno= 0;
net.report_error= 0; net.report_error= 0;
query_error= 0;
} }
inline bool vio_ok() const { return net.vio != 0; } inline bool vio_ok() const { return net.vio != 0; }
#else #else
@ -1195,8 +1196,6 @@ public:
class JOIN; class JOIN;
void send_error(THD *thd, uint sql_errno=0, const char *err=0);
class select_result :public Sql_alloc { class select_result :public Sql_alloc {
protected: protected:
THD *thd; THD *thd;

View file

@ -379,13 +379,13 @@ bool load_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
In this case the entry should not be logged. In this case the entry should not be logged.
RETURN VALUES RETURN VALUES
0 ok FALSE ok
-1 Error TRUE Error
*/ */
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info, bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent) bool silent)
{ {
char path[FN_REFLEN+16]; char path[FN_REFLEN+16];
long result= 1; long result= 1;
@ -489,7 +489,7 @@ exit2:
/* db-name is already validated when we come here */ /* db-name is already validated when we come here */
int mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info) bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
{ {
char path[FN_REFLEN+16]; char path[FN_REFLEN+16];
long result=1; long result=1;
@ -532,7 +532,7 @@ exit:
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
exit2: exit2:
VOID(pthread_mutex_unlock(&LOCK_mysql_create_db)); VOID(pthread_mutex_unlock(&LOCK_mysql_create_db));
DBUG_RETURN(error ? -1 : 0); /* -1 to delegate send_error() */ DBUG_RETURN(error);
} }
@ -548,11 +548,11 @@ exit2:
silent Don't generate errors silent Don't generate errors
RETURN RETURN
0 ok (Database dropped) FALSE ok (Database dropped)
-1 Error generated ERROR Error
*/ */
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent) bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
{ {
long deleted=0; long deleted=0;
int error= 0; int error= 0;
@ -985,12 +985,12 @@ bool mysql_change_db(THD *thd, const char *name)
if (!dbname || !(db_length= strlen(dbname))) if (!dbname || !(db_length= strlen(dbname)))
{ {
x_free(dbname); /* purecov: inspected */ x_free(dbname); /* purecov: inspected */
send_error(thd,ER_NO_DB_ERROR); /* purecov: inspected */ my_error(ER_NO_DB_ERROR, MYF(0)); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(1); /* purecov: inspected */
} }
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
net_printf(thd, ER_WRONG_DB_NAME, dbname); my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
x_free(dbname); x_free(dbname);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1003,10 +1003,10 @@ bool mysql_change_db(THD *thd, const char *name)
thd->master_access); thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{ {
net_printf(thd,ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->priv_user, thd->priv_user,
thd->priv_host, thd->priv_host,
dbname); dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user, thd->priv_user,
thd->priv_host, thd->priv_host,
@ -1021,7 +1021,7 @@ bool mysql_change_db(THD *thd, const char *name)
path[length-1]=0; // remove ending '\' path[length-1]=0; // remove ending '\'
if (access(path,F_OK)) if (access(path,F_OK))
{ {
net_printf(thd,ER_BAD_DB_ERROR,dbname); my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
my_free(dbname,MYF(0)); my_free(dbname,MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }

View file

@ -29,8 +29,8 @@
#include "sp_head.h" #include "sp_head.h"
#include "sql_trigger.h" #include "sql_trigger.h"
int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
ha_rows limit, ulong options) SQL_LIST *order, ha_rows limit, ulong options)
{ {
int error; int error;
TABLE *table; TABLE *table;
@ -41,22 +41,22 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
ha_rows deleted; ha_rows deleted;
DBUG_ENTER("mysql_delete"); DBUG_ENTER("mysql_delete");
if ((error= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(error); DBUG_RETURN(TRUE);
table= table_list->table; table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
thd->proc_info="init"; thd->proc_info="init";
table->map=1; table->map=1;
if ((error= mysql_prepare_delete(thd, table_list, &conds))) if (mysql_prepare_delete(thd, table_list, &conds))
DBUG_RETURN(error); DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item()); const_cond= (!conds || conds->const_item());
safe_update=test(thd->options & OPTION_SAFE_UPDATES); safe_update=test(thd->options & OPTION_SAFE_UPDATES);
if (safe_update && const_cond) if (safe_update && const_cond)
{ {
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
if (thd->lex->duplicates == DUP_IGNORE) if (thd->lex->duplicates == DUP_IGNORE)
@ -85,7 +85,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
table->quick_keys.clear_all(); // Can't use 'only index' table->quick_keys.clear_all(); // Can't use 'only index'
select=make_select(table,0,0,conds,&error); select=make_select(table,0,0,conds,&error);
if (error) if (error)
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if ((select && select->check_quick(thd, safe_update, limit)) || !limit) if ((select && select->check_quick(thd, safe_update, limit)) || !limit)
{ {
delete select; delete select;
@ -103,8 +103,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE); my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
if (options & OPTION_QUICK) if (options & OPTION_QUICK)
@ -135,7 +135,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(-1); // This will force out message DBUG_RETURN(TRUE);
} }
/* /*
Filesort has already found and selected the rows we want to delete, Filesort has already found and selected the rows we want to delete,
@ -150,7 +150,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{ {
delete select; delete select;
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(-1); // This will force out message DBUG_RETURN(TRUE);
} }
init_read_record(&info,thd,table,select,1,1); init_read_record(&info,thd,table,select,1,1);
deleted=0L; deleted=0L;
@ -253,15 +253,13 @@ cleanup:
thd->lock=0; thd->lock=0;
} }
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0 || thd->net.report_error) if (error < 0)
send_error(thd,thd->killed_errno());
else
{ {
thd->row_count_func= deleted; thd->row_count_func= deleted;
send_ok(thd,deleted); send_ok(thd,deleted);
DBUG_PRINT("info",("%d records deleted",deleted)); DBUG_PRINT("info",("%d records deleted",deleted));
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -275,11 +273,10 @@ cleanup:
conds - conditions conds - conditions
RETURN VALUE RETURN VALUE
0 - OK FALSE OK
1 - error (message is sent to user) TRUE error
-1 - error (message is not sent to user)
*/ */
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) bool mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
{ {
SELECT_LEX *select_lex= &thd->lex->select_lex; SELECT_LEX *select_lex= &thd->lex->select_lex;
DBUG_ENTER("mysql_prepare_delete"); DBUG_ENTER("mysql_prepare_delete");
@ -287,19 +284,19 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
if (setup_tables(thd, table_list, conds) || if (setup_tables(thd, table_list, conds) ||
setup_conds(thd, table_list, conds) || setup_conds(thd, table_list, conds) ||
setup_ftfuncs(select_lex)) setup_ftfuncs(select_lex))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if (!table_list->updatable || check_key_in_view(thd, table_list)) if (!table_list->updatable || check_key_in_view(thd, table_list))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE"); my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "DELETE");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (unique_table(table_list, table_list->next_independent())) if (unique_table(table_list, table_list->next_independent()))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
select_lex->fix_prepare_information(thd, conds); select_lex->fix_prepare_information(thd, conds);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -323,16 +320,15 @@ extern "C" int refpos_order_cmp(void* arg, const void *a,const void *b)
thd thread handler thd thread handler
RETURN RETURN
0 OK FALSE OK
-1 Error TRUE Error
*/ */
int mysql_multi_delete_prepare(THD *thd) bool mysql_multi_delete_prepare(THD *thd)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxilliary_table_list.first; TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxilliary_table_list.first;
TABLE_LIST *target_tbl; TABLE_LIST *target_tbl;
int res= 0;
DBUG_ENTER("mysql_multi_delete_prepare"); DBUG_ENTER("mysql_multi_delete_prepare");
/* /*
@ -342,7 +338,7 @@ int mysql_multi_delete_prepare(THD *thd)
lex->query_tables also point on local list of DELETE SELECT_LEX lex->query_tables also point on local list of DELETE SELECT_LEX
*/ */
if (setup_tables(thd, lex->query_tables, &lex->select_lex.where)) if (setup_tables(thd, lex->query_tables, &lex->select_lex.where))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
/* Fix tables-to-be-deleted-from list to point at opened tables */ /* Fix tables-to-be-deleted-from list to point at opened tables */
for (target_tbl= (TABLE_LIST*) aux_tables; for (target_tbl= (TABLE_LIST*) aux_tables;
@ -355,7 +351,7 @@ int mysql_multi_delete_prepare(THD *thd)
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), target_tbl->real_name, my_error(ER_NON_UPDATABLE_TABLE, MYF(0), target_tbl->real_name,
"DELETE"); "DELETE");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
Check are deleted table used somewhere inside subqueries. Check are deleted table used somewhere inside subqueries.
@ -373,12 +369,11 @@ int mysql_multi_delete_prepare(THD *thd)
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), my_error(ER_UPDATE_TABLE_USED, MYF(0),
target_tbl->correspondent_table->real_name); target_tbl->correspondent_table->real_name);
res= -1; DBUG_RETURN(TRUE);
break;
} }
} }
} }
DBUG_RETURN(res); DBUG_RETURN(FALSE);
} }
@ -522,7 +517,7 @@ void multi_delete::send_error(uint errcode,const char *err)
DBUG_ENTER("multi_delete::send_error"); DBUG_ENTER("multi_delete::send_error");
/* First send error what ever it is ... */ /* First send error what ever it is ... */
::send_error(thd,errcode,err); my_message(errcode, err, MYF(0));
/* If nothing deleted return */ /* If nothing deleted return */
if (!deleted) if (!deleted)
@ -668,9 +663,7 @@ bool multi_delete::send_eof()
if (ha_autocommit_or_rollback(thd,local_error > 0)) if (ha_autocommit_or_rollback(thd,local_error > 0))
local_error=1; local_error=1;
if (local_error) if (!local_error)
::send_error(thd);
else
{ {
thd->row_count_func= deleted; thd->row_count_func= deleted;
::send_ok(thd, deleted); ::send_ok(thd, deleted);
@ -695,12 +688,12 @@ bool multi_delete::send_eof()
- If we want to have a name lock on the table on exit without errors. - If we want to have a name lock on the table on exit without errors.
*/ */
int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok) bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{ {
HA_CREATE_INFO create_info; HA_CREATE_INFO create_info;
char path[FN_REFLEN]; char path[FN_REFLEN];
TABLE **table_ptr; TABLE **table_ptr;
int error; bool error;
DBUG_ENTER("mysql_truncate"); DBUG_ENTER("mysql_truncate");
bzero((char*) &create_info,sizeof(create_info)); bzero((char*) &create_info,sizeof(create_info));
@ -738,7 +731,7 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db, my_error(ER_NO_SUCH_TABLE, MYF(0), table_list->db,
table_list->real_name); table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!ha_supports_generate(table_type)) if (!ha_supports_generate(table_type))
{ {
@ -748,11 +741,11 @@ int mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok)
HA_POS_ERROR, 0)); HA_POS_ERROR, 0));
} }
if (lock_and_wait_for_table_name(thd, table_list)) if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
*fn_ext(path)=0; // Remove the .frm extension *fn_ext(path)=0; // Remove the .frm extension
error= ha_create_table(path,&create_info,1) ? -1 : 0; error= ha_create_table(path,&create_info,1);
query_cache_invalidate3(thd, table_list, 0); query_cache_invalidate3(thd, table_list, 0);
end: end:
@ -779,5 +772,5 @@ end:
unlock_table_name(thd, table_list); unlock_table_name(thd, table_list);
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
} }
DBUG_RETURN(error ? -1 : 0); DBUG_RETURN(error);
} }

View file

@ -20,16 +20,16 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_acl.h" #include "sql_acl.h"
int mysql_do(THD *thd, List<Item> &values) bool mysql_do(THD *thd, List<Item> &values)
{ {
List_iterator<Item> li(values); List_iterator<Item> li(values);
Item *value; Item *value;
DBUG_ENTER("mysql_do"); DBUG_ENTER("mysql_do");
if (setup_fields(thd, 0, 0, values, 0, 0, 0)) if (setup_fields(thd, 0, 0, values, 0, 0, 0))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
while ((value = li++)) while ((value = li++))
value->val_int(); value->val_int();
thd->clear_error(); // DO always is OK thd->clear_error(); // DO always is OK
send_ok(thd); send_ok(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }

View file

@ -184,14 +184,14 @@ void push_warning_printf(THD *thd, MYSQL_ERROR::enum_warning_level level,
Takes into account the current LIMIT Takes into account the current LIMIT
RETURN VALUES RETURN VALUES
0 ok FALSE ok
1 Error sending data to client TRUE Error sending data to client
*/ */
static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"}; static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"};
static int warning_level_length[]= { 4, 7, 5, 1 }; static int warning_level_length[]= { 4, 7, 5, 1 };
my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show) bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
{ {
List<Item> field_list; List<Item> field_list;
DBUG_ENTER("mysqld_show_warnings"); DBUG_ENTER("mysqld_show_warnings");
@ -202,7 +202,7 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
if (thd->protocol->send_fields(&field_list, if (thd->protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
MYSQL_ERROR *err; MYSQL_ERROR *err;
SELECT_LEX *sel= &thd->lex->select_lex; SELECT_LEX *sel= &thd->lex->select_lex;
@ -226,10 +226,10 @@ my_bool mysqld_show_warnings(THD *thd, ulong levels_to_show)
protocol->store((uint32) err->code); protocol->store((uint32) err->code);
protocol->store(err->msg, strlen(err->msg), system_charset_info); protocol->store(err->msg, strlen(err->msg), system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(TRUE);
if (!--limit) if (!--limit)
break; break;
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }

View file

@ -47,7 +47,7 @@ static TABLE **find_table_ptr_by_name(THD *thd,const char *db,
bool is_alias, bool dont_lock, bool is_alias, bool dont_lock,
bool *was_flushed); bool *was_flushed);
int mysql_ha_open(THD *thd, TABLE_LIST *tables) bool mysql_ha_open(THD *thd, TABLE_LIST *tables)
{ {
HANDLER_TABLES_HACK(thd); HANDLER_TABLES_HACK(thd);
uint counter; uint counter;
@ -58,18 +58,18 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
HANDLER_TABLES_HACK(thd); HANDLER_TABLES_HACK(thd);
if (err) if (err)
return -1; return TRUE;
// there can be only one table in *tables // there can be only one table in *tables
if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER)) if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{ {
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias); my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias);
mysql_ha_close(thd, tables,1); mysql_ha_close(thd, tables,1);
return -1; return TRUE;
} }
send_ok(thd); send_ok(thd);
return 0; return FALSE;
} }
@ -98,11 +98,11 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
is suppressed. is suppressed.
RETURN RETURN
0 ok FALSE OK
-1 error TRUE Error
*/ */
int mysql_ha_close(THD *thd, TABLE_LIST *tables, bool mysql_ha_close(THD *thd, TABLE_LIST *tables,
bool dont_send_ok, bool dont_lock, bool no_alias) bool dont_send_ok, bool dont_lock, bool no_alias)
{ {
TABLE **table_ptr; TABLE **table_ptr;
@ -127,11 +127,11 @@ int mysql_ha_close(THD *thd, TABLE_LIST *tables,
{ {
my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0), my_printf_error(ER_UNKNOWN_TABLE, ER(ER_UNKNOWN_TABLE), MYF(0),
tables->alias, "HANDLER"); tables->alias, "HANDLER");
return -1; return TRUE;
} }
if (!dont_send_ok) if (!dont_send_ok)
send_ok(thd); send_ok(thd);
return 0; return FALSE;
} }
@ -201,11 +201,11 @@ static enum enum_ha_read_modes rkey_to_rnext[]=
{ RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV }; { RNEXT_SAME, RNEXT, RPREV, RNEXT, RPREV, RNEXT, RPREV, RPREV };
int mysql_ha_read(THD *thd, TABLE_LIST *tables, bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
enum enum_ha_read_modes mode, char *keyname, enum enum_ha_read_modes mode, char *keyname,
List<Item> *key_expr, List<Item> *key_expr,
enum ha_rkey_function ha_rkey_mode, Item *cond, enum ha_rkey_function ha_rkey_mode, Item *cond,
ha_rows select_limit,ha_rows offset_limit) ha_rows select_limit,ha_rows offset_limit)
{ {
int err, keyno=-1; int err, keyno=-1;
bool was_flushed; bool was_flushed;
@ -216,12 +216,12 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
{ {
my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0), my_printf_error(ER_UNKNOWN_TABLE,ER(ER_UNKNOWN_TABLE),MYF(0),
tables->alias,"HANDLER"); tables->alias,"HANDLER");
return -1; return TRUE;
} }
tables->table=table; tables->table=table;
if (cond && (cond->fix_fields(thd, tables, &cond) || cond->check_cols(1))) if (cond && (cond->fix_fields(thd, tables, &cond) || cond->check_cols(1)))
return -1; return TRUE;
/* InnoDB needs to know that this table handle is used in the HANDLER */ /* InnoDB needs to know that this table handle is used in the HANDLER */
@ -233,7 +233,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
{ {
my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0), my_printf_error(ER_KEY_DOES_NOT_EXITS,ER(ER_KEY_DOES_NOT_EXITS),MYF(0),
keyname,tables->alias); keyname,tables->alias);
return -1; return TRUE;
} }
table->file->ha_index_or_rnd_end(); table->file->ha_index_or_rnd_end();
table->file->ha_index_init(keyno); table->file->ha_index_init(keyno);
@ -333,10 +333,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
key_len+=key_part->store_length; key_len+=key_part->store_length;
} }
if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len)))) if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len))))
{
send_error(thd,ER_OUTOFMEMORY);
goto err; goto err;
}
key_copy(key, table->record[0], table->key_info + keyno, key_len); key_copy(key, table->record[0], table->key_info + keyno, key_len);
err=table->file->index_read(table->record[0], err=table->file->index_read(table->record[0],
key,key_len,ha_rkey_mode); key,key_len,ha_rkey_mode);
@ -344,7 +341,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
break; break;
} }
default: default:
send_error(thd,ER_ILLEGAL_HA); my_error(ER_ILLEGAL_HA, MYF(0));
goto err; goto err;
} }
@ -384,11 +381,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
ok: ok:
mysql_unlock_tables(thd,lock); mysql_unlock_tables(thd,lock);
send_eof(thd); send_eof(thd);
return 0; return FALSE;
err: err:
mysql_unlock_tables(thd,lock); mysql_unlock_tables(thd,lock);
err0: err0:
return -1; return TRUE;
} }

View file

@ -276,7 +276,7 @@ int get_topics_for_keyword(THD *thd, TABLE *topics, TABLE *relations,
(iindex_relations= find_type((char*) primary_key_name, (iindex_relations= find_type((char*) primary_key_name,
&relations->keynames, 1+2)-1)<0) &relations->keynames, 1+2)-1)<0)
{ {
send_error(thd,ER_CORRUPT_HELP_DB); my_error(ER_CORRUPT_HELP_DB, 0);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
rtopic_id= find_fields[help_relation_help_topic_id].field; rtopic_id= find_fields[help_relation_help_topic_id].field;
@ -607,12 +607,11 @@ SQL_SELECT *prepare_select_for_name(THD *thd, const char *mask, uint mlen,
thd Thread handler thd Thread handler
RETURN VALUES RETURN VALUES
0 Success FALSE Success
1 Error and send_error already commited TRUE Error and send_error already commited
-1 error && send_error should be issued (normal case)
*/ */
int mysqld_help(THD *thd, const char *mask) bool mysqld_help(THD *thd, const char *mask)
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
SQL_SELECT *select; SQL_SELECT *select;
@ -640,8 +639,8 @@ int mysqld_help(THD *thd, const char *mask)
uint mlen= strlen(mask); uint mlen= strlen(mask);
MEM_ROOT *mem_root= &thd->mem_root; MEM_ROOT *mem_root= &thd->mem_root;
if ((res= open_and_lock_tables(thd, tables))) if (open_and_lock_tables(thd, tables))
goto end; goto error;
/* /*
Init tables and fields to be usable from items Init tables and fields to be usable from items
@ -650,10 +649,7 @@ int mysqld_help(THD *thd, const char *mask)
setup_tables(thd, tables, 0); setup_tables(thd, tables, 0);
memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields)); memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields));
if (init_fields(thd, tables, used_fields, array_elements(used_fields))) if (init_fields(thd, tables, used_fields, array_elements(used_fields)))
{ goto error;
res= -1;
goto end;
}
size_t i; size_t i;
for (i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++) for (i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++)
tables[i].table->file->init_table_handle_for_HANDLER(); tables[i].table->file->init_table_handle_for_HANDLER();
@ -661,12 +657,8 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select= if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[0].table, prepare_select_for_name(thd,mask,mlen,tables,tables[0].table,
used_fields[help_topic_name].field,&error))) used_fields[help_topic_name].field,&error)))
{ goto error;
res= -1;
goto end;
}
res= 1;
count_topics= search_topics(thd,tables[0].table,used_fields, count_topics= search_topics(thd,tables[0].table,used_fields,
select,&topics_list, select,&topics_list,
&name, &description, &example); &name, &description, &example);
@ -678,10 +670,8 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select= if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[3].table, prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
used_fields[help_keyword_name].field,&error))) used_fields[help_keyword_name].field,&error)))
{ goto error;
res= -1;
goto end;
}
count_topics=search_keyword(thd,tables[3].table,used_fields,select,&key_id); count_topics=search_keyword(thd,tables[3].table,used_fields,select,&key_id);
delete select; delete select;
count_topics= (count_topics != 1) ? 0 : count_topics= (count_topics != 1) ? 0 :
@ -697,10 +687,7 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select= if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table, prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error))) used_fields[help_category_name].field,&error)))
{ goto error;
res= -1;
goto end;
}
count_categories= search_categories(thd, tables[1].table, used_fields, count_categories= search_categories(thd, tables[1].table, used_fields,
select, select,
@ -709,13 +696,13 @@ int mysqld_help(THD *thd, const char *mask)
if (!count_categories) if (!count_categories)
{ {
if (send_header_2(protocol,FALSE)) if (send_header_2(protocol,FALSE))
goto end; goto error;
} }
else if (count_categories > 1) else if (count_categories > 1)
{ {
if (send_header_2(protocol,FALSE) || if (send_header_2(protocol,FALSE) ||
send_variant_2_list(mem_root,protocol,&categories_list,"Y",0)) send_variant_2_list(mem_root,protocol,&categories_list,"Y",0))
goto end; goto error;
} }
else else
{ {
@ -728,20 +715,14 @@ int mysqld_help(THD *thd, const char *mask)
new Item_int((int32)category_id)); new Item_int((int32)category_id));
if (!(select= prepare_simple_select(thd,cond_topic_by_cat, if (!(select= prepare_simple_select(thd,cond_topic_by_cat,
tables,tables[0].table,&error))) tables,tables[0].table,&error)))
{ goto error;
res= -1;
goto end;
}
get_all_items_for_category(thd,tables[0].table, get_all_items_for_category(thd,tables[0].table,
used_fields[help_topic_name].field, used_fields[help_topic_name].field,
select,&topics_list); select,&topics_list);
delete select; delete select;
if (!(select= prepare_simple_select(thd,cond_cat_by_cat,tables, if (!(select= prepare_simple_select(thd,cond_cat_by_cat,tables,
tables[1].table,&error))) tables[1].table,&error)))
{ goto error;
res= -1;
goto end;
}
get_all_items_for_category(thd,tables[1].table, get_all_items_for_category(thd,tables[1].table,
used_fields[help_category_name].field, used_fields[help_category_name].field,
select,&subcategories_list); select,&subcategories_list);
@ -750,39 +731,36 @@ int mysqld_help(THD *thd, const char *mask)
if (send_header_2(protocol, true) || if (send_header_2(protocol, true) ||
send_variant_2_list(mem_root,protocol,&topics_list, "N",cat) || send_variant_2_list(mem_root,protocol,&topics_list, "N",cat) ||
send_variant_2_list(mem_root,protocol,&subcategories_list,"Y",cat)) send_variant_2_list(mem_root,protocol,&subcategories_list,"Y",cat))
goto end; goto error;
} }
} }
else if (count_topics == 1) else if (count_topics == 1)
{ {
if (send_answer_1(protocol,&name,&description,&example)) if (send_answer_1(protocol,&name,&description,&example))
goto end; goto error;
} }
else else
{ {
/* First send header and functions */ /* First send header and functions */
if (send_header_2(protocol, FALSE) || if (send_header_2(protocol, FALSE) ||
send_variant_2_list(mem_root,protocol, &topics_list, "N", 0)) send_variant_2_list(mem_root,protocol, &topics_list, "N", 0))
goto end; goto error;
if (!(select= if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table, prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error))) used_fields[help_category_name].field,&error)))
{ goto error;
res= -1;
goto end;
}
search_categories(thd, tables[1].table, used_fields, search_categories(thd, tables[1].table, used_fields,
select,&categories_list, 0); select,&categories_list, 0);
delete select; delete select;
/* Then send categories */ /* Then send categories */
if (send_variant_2_list(mem_root,protocol, &categories_list, "Y", 0)) if (send_variant_2_list(mem_root,protocol, &categories_list, "Y", 0))
goto end; goto error;
} }
res= 0;
send_eof(thd); send_eof(thd);
end: end:
DBUG_RETURN(res); DBUG_RETURN(FALSE);
error:
DBUG_RETURN(TRUE);
} }

View file

@ -115,12 +115,12 @@ check_insert_fields(THD *thd, TABLE_LIST *table_list, List<Item> &fields,
} }
int mysql_insert(THD *thd,TABLE_LIST *table_list, bool mysql_insert(THD *thd,TABLE_LIST *table_list,
List<Item> &fields, List<Item> &fields,
List<List_item> &values_list, List<List_item> &values_list,
List<Item> &update_fields, List<Item> &update_fields,
List<Item> &update_values, List<Item> &update_values,
enum_duplicates duplic) enum_duplicates duplic)
{ {
int error, res; int error, res;
/* /*
@ -174,7 +174,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED, my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED,
ER(ER_DELAYED_INSERT_TABLE_LOCKED), ER(ER_DELAYED_INSERT_TABLE_LOCKED),
MYF(0), table_list->real_name); MYF(0), table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
if ((table= delayed_get_table(thd,table_list)) && !thd->is_fatal_error) if ((table= delayed_get_table(thd,table_list)) && !thd->is_fatal_error)
@ -200,7 +200,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
#endif /* EMBEDDED_LIBRARY */ #endif /* EMBEDDED_LIBRARY */
res= open_and_lock_tables(thd, table_list); res= open_and_lock_tables(thd, table_list);
if (res || thd->is_fatal_error) if (res || thd->is_fatal_error)
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
table= table_list->table; table= table_list->table;
thd->proc_info="init"; thd->proc_info="init";
@ -298,6 +298,15 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
info.records++; info.records++;
continue; continue;
} }
/*
Field::store methods can't send errors
TODO: set thd->abort_on_warning if values_list.elements == 1
and check that all items return warning in case of problem with
storing field.
*/
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
error=1; error=1;
break; break;
} }
@ -315,6 +324,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
info.records++; info.records++;
continue; continue;
} }
/* Field::store methods can't send errors */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
error=1; error=1;
break; break;
} }
@ -465,7 +477,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0; table->insert_values=0;
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(0); DBUG_RETURN(FALSE);
abort: abort:
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
@ -475,7 +487,7 @@ abort:
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0; table->insert_values=0;
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
@ -609,11 +621,11 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list,
table_list Global/local table list table_list Global/local table list
RETURN VALUE RETURN VALUE
0 OK FALSE OK
-1 error (message is not sent to user) TRUE error
*/ */
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table, bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
List<Item> &fields, List_item *values, List<Item> &fields, List_item *values,
List<Item> &update_fields, List<Item> &update_values, List<Item> &update_fields, List<Item> &update_values,
enum_duplicates duplic) enum_duplicates duplic)
@ -621,7 +633,7 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
bool insert_into_view= (table_list->view != 0); bool insert_into_view= (table_list->view != 0);
/* TODO: use this condition for 'WITH CHECK OPTION' */ /* TODO: use this condition for 'WITH CHECK OPTION' */
Item *unused_conds= 0; Item *unused_conds= 0;
int res; bool res;
DBUG_ENTER("mysql_prepare_insert"); DBUG_ENTER("mysql_prepare_insert");
if (mysql_prepare_insert_check_table(thd, table_list, fields, &unused_conds)) if (mysql_prepare_insert_check_table(thd, table_list, fields, &unused_conds))
@ -636,15 +648,15 @@ int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
thd->lex->select_lex.no_wrap_view_item= 0, thd->lex->select_lex.no_wrap_view_item= 0,
res) || res) ||
setup_fields(thd, 0, table_list, update_values, 0, 0, 0)))) setup_fields(thd, 0, table_list, update_values, 0, 0, 0))))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if (unique_table(table_list, table_list->next_independent())) if (unique_table(table_list, table_list->next_independent()))
{ {
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
thd->lex->select_lex.first_execution= 0; thd->lex->select_lex.first_execution= 0;
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -737,7 +749,12 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
store_record(table,insert_values); store_record(table,insert_values);
restore_record(table,record[1]); restore_record(table,record[1]);
if (fill_record(*info->update_fields, *info->update_values, 0)) if (fill_record(*info->update_fields, *info->update_values, 0))
{
/* Field::store methods can't send errors */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
goto err; goto err;
}
/* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */ /* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */
if (info->view && if (info->view &&
@ -1018,7 +1035,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
delete tmp; delete tmp;
thd->fatal_error(); thd->fatal_error();
pthread_mutex_unlock(&LOCK_delayed_create); pthread_mutex_unlock(&LOCK_delayed_create);
net_printf(thd,ER_CANT_CREATE_THREAD,error); my_error(ER_CANT_CREATE_THREAD, MYF(0), error);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
@ -1648,11 +1665,11 @@ bool delayed_insert::handle_inserts(void)
thd thread handler thd thread handler
RETURN RETURN
0 OK FALSE OK
-1 Error TRUE Error
*/ */
int mysql_insert_select_prepare(THD *thd) bool mysql_insert_select_prepare(THD *thd)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
DBUG_ENTER("mysql_insert_select_prepare"); DBUG_ENTER("mysql_insert_select_prepare");
@ -1664,8 +1681,8 @@ int mysql_insert_select_prepare(THD *thd)
if (mysql_prepare_insert_check_table(thd, lex->query_tables, if (mysql_prepare_insert_check_table(thd, lex->query_tables,
lex->field_list, lex->field_list,
&lex->select_lex.where)) &lex->select_lex.where))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -1768,8 +1785,7 @@ void select_insert::send_error(uint errcode,const char *err)
{ {
DBUG_ENTER("select_insert::send_error"); DBUG_ENTER("select_insert::send_error");
/* TODO error should be sent at the query processing end */ my_message(errcode, err, MYF(0));
::send_error(thd,errcode,err);
if (!table) if (!table)
{ {
@ -1845,8 +1861,6 @@ bool select_insert::send_eof()
if (error) if (error)
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
//TODO error should be sent at the query processing end
::send_error(thd);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
char buff[160]; char buff[160];

View file

@ -340,8 +340,8 @@ protected:
TABLE *table; /* temporary table using for appending UNION results */ TABLE *table; /* temporary table using for appending UNION results */
select_result *result; select_result *result;
int res;
ulong found_rows_for_union; ulong found_rows_for_union;
bool res;
bool prepared, // prepare phase already performed for UNION (unit) bool prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit) optimized, // optimize phase already performed for UNION (unit)
executed, // already executed executed, // already executed
@ -400,9 +400,9 @@ public:
void exclude_tree(); void exclude_tree();
/* UNION methods */ /* UNION methods */
int prepare(THD *thd, select_result *result, ulong additional_options); bool prepare(THD *thd, select_result *result, ulong additional_options);
int exec(); bool exec();
int cleanup(); bool cleanup();
inline void unclean() { cleaned= 0; } inline void unclean() { cleaned= 0; }
void reinit_exec_mechanism(); void reinit_exec_mechanism();
@ -410,7 +410,7 @@ public:
void print(String *str); void print(String *str);
ulong init_prepare_fake_select_lex(THD *thd); ulong init_prepare_fake_select_lex(THD *thd);
int change_result(select_subselect *result, select_subselect *old_result); bool change_result(select_subselect *result, select_subselect *old_result);
void set_limit(st_select_lex *values, st_select_lex *sl); void set_limit(st_select_lex *values, st_select_lex *sl);
friend void mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly); friend void mysql_init_query(THD *thd, uchar *buf, uint length, bool lexonly);

View file

@ -78,7 +78,7 @@ static int read_sep_field(THD *thd,COPY_INFO &info,TABLE *table,
List<Item> &fields, READ_INFO &read_info, List<Item> &fields, READ_INFO &read_info,
String &enclosed, ulong skip_lines); String &enclosed, ulong skip_lines);
int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, bool mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates, List<Item> &fields, enum enum_duplicates handle_duplicates,
bool read_file_from_client,thr_lock_type lock_type) bool read_file_from_client,thr_lock_type lock_type)
{ {
@ -112,16 +112,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{ {
my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS), my_message(ER_WRONG_FIELD_TERMINATORS,ER(ER_WRONG_FIELD_TERMINATORS),
MYF(0)); MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
table_list->lock_type= lock_type; table_list->lock_type= lock_type;
if ((res= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
/* TODO: add key check when we will support VIEWs in LOAD */ /* TODO: add key check when we will support VIEWs in LOAD */
if (!table_list->updatable) if (!table_list->updatable)
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD"); my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
table= table_list->table; table= table_list->table;
transactional_table= table->file->has_transactions(); transactional_table= table->file->has_transactions();
@ -140,14 +140,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
Item *unused_conds= 0; Item *unused_conds= 0;
if (setup_tables(thd, table_list, &unused_conds) || if (setup_tables(thd, table_list, &unused_conds) ||
setup_fields(thd, 0, table_list, fields, 1, 0, 0)) setup_fields(thd, 0, table_list, fields, 1, 0, 0))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if (thd->dupp_field) if (thd->dupp_field)
{ {
my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name); my_error(ER_FIELD_SPECIFIED_TWICE, MYF(0), thd->dupp_field->field_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (check_that_all_fields_are_given_values(thd, table)) if (check_that_all_fields_are_given_values(thd, table))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
uint tot_length=0; uint tot_length=0;
@ -173,7 +173,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{ {
my_message(ER_BLOBS_AND_NO_TERMINATED,ER(ER_BLOBS_AND_NO_TERMINATED), my_message(ER_BLOBS_AND_NO_TERMINATED,ER(ER_BLOBS_AND_NO_TERMINATED),
MYF(0)); MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* We can't give an error in the middle when using LOCAL files */ /* We can't give an error in the middle when using LOCAL files */
@ -206,7 +206,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
#if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__) #if !defined(__WIN__) && !defined(OS2) && ! defined(__NETWARE__)
MY_STAT stat_info; MY_STAT stat_info;
if (!my_stat(name,&stat_info,MYF(MY_WME))) if (!my_stat(name,&stat_info,MYF(MY_WME)))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
// if we are not in slave thread, the file must be: // if we are not in slave thread, the file must be:
if (!thd->slave_thread && if (!thd->slave_thread &&
@ -218,14 +218,14 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
(stat_info.st_mode & S_IFIFO) == S_IFIFO))) (stat_info.st_mode & S_IFIFO) == S_IFIFO)))
{ {
my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name); my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO) if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
is_fifo = 1; is_fifo = 1;
#endif #endif
} }
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0) if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
COPY_INFO info; COPY_INFO info;
@ -240,7 +240,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{ {
if (file >= 0) if (file >= 0)
my_close(file,MYF(0)); // no files in net reading my_close(file,MYF(0)); // no files in net reading
DBUG_RETURN(-1); // Can't allocate buffers DBUG_RETURN(TRUE); // Can't allocate buffers
} }
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY

View file

@ -47,13 +47,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
0L))) 0L)))
{ {
error=errno; error=errno;
my_printf_error(0,"Can't map file: %s, errno: %d",MYF(0), my_error(ER_NO_FILE_MAPPING,MYF(0), (my_string) name, error);
(my_string) name,error);
} }
} }
if (map && memcmp(map,magic,magic_length)) if (map && memcmp(map,magic,magic_length))
{ {
my_printf_error(0,"Wrong magic in %s",MYF(0),name); my_error(ER_WRONG_MAGIC, MYF(0), name);
VOID(munmap(map,size)); VOID(munmap(map,size));
map=0; map=0;
} }
@ -112,8 +111,7 @@ mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
{ {
map->use_count++; map->use_count++;
if (!map->map) if (!map->map)
my_printf_error(0,"Can't map file: %s, error: %d",MYF(0),path, my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
map->error);
} }
VOID(pthread_mutex_unlock(&LOCK_mapped_file)); VOID(pthread_mutex_unlock(&LOCK_mapped_file));
return map; return map;

File diff suppressed because it is too large Load diff

View file

@ -122,16 +122,13 @@ inline bool is_param_null(const uchar *pos, ulong param_no)
enum { STMT_QUERY_LOG_LENGTH= 8192 }; enum { STMT_QUERY_LOG_LENGTH= 8192 };
enum enum_send_error { DONT_SEND_ERROR= 0, SEND_ERROR };
/* /*
Seek prepared statement in statement map by id: returns zero if statement Seek prepared statement in statement map by id: returns zero if statement
was not found, pointer otherwise. was not found, pointer otherwise.
*/ */
static Prepared_statement * static Prepared_statement *
find_prepared_statement(THD *thd, ulong id, const char *where, find_prepared_statement(THD *thd, ulong id, const char *where)
enum enum_send_error se)
{ {
Statement *stmt= thd->stmt_map.find(id); Statement *stmt= thd->stmt_map.find(id);
@ -139,8 +136,6 @@ find_prepared_statement(THD *thd, ulong id, const char *where,
{ {
char llbuf[22]; char llbuf[22];
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where); my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where);
if (se == SEND_ERROR)
send_error(thd);
return 0; return 0;
} }
return (Prepared_statement *) stmt; return (Prepared_statement *) stmt;
@ -180,7 +175,7 @@ static bool send_prep_stmt(Prepared_statement *stmt,
thd->client_stmt_id= stmt->id; thd->client_stmt_id= stmt->id;
thd->client_param_count= stmt->param_count; thd->client_param_count= stmt->param_count;
thd->net.last_errno= 0; thd->clear_error();
return 0; return 0;
} }
@ -881,24 +876,23 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
tables global/local table list tables global/local table list
RETURN VALUE RETURN VALUE
0 ok FALSE OK
1 error, sent to the client TRUE error
-1 error, not sent to client
*/ */
static int mysql_test_insert(Prepared_statement *stmt, static bool mysql_test_insert(Prepared_statement *stmt,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<Item> &fields, List<Item> &fields,
List<List_item> &values_list, List<List_item> &values_list,
List<Item> &update_fields, List<Item> &update_fields,
List<Item> &update_values, List<Item> &update_values,
enum_duplicates duplic) enum_duplicates duplic)
{ {
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= stmt->lex; LEX *lex= stmt->lex;
List_iterator_fast<List_item> its(values_list); List_iterator_fast<List_item> its(values_list);
List_item *values; List_item *values;
int res; bool res;
my_bool update= (lex->value_list.elements ? UPDATE_ACL : 0); my_bool update= (lex->value_list.elements ? UPDATE_ACL : 0);
DBUG_ENTER("mysql_test_insert"); DBUG_ENTER("mysql_test_insert");
@ -909,9 +903,9 @@ static int mysql_test_insert(Prepared_statement *stmt,
open temporary memory pool for temporary data allocated by derived open temporary memory pool for temporary data allocated by derived
tables & preparation procedure tables & preparation procedure
*/ */
if ((res= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
{ {
DBUG_RETURN(res); DBUG_RETURN(TRUE);
} }
if ((values= its++)) if ((values= its++))
@ -958,14 +952,13 @@ error:
tables list of tables queries tables list of tables queries
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error
-1 error, not sent to client
*/ */
static int mysql_test_update(Prepared_statement *stmt, static bool mysql_test_update(Prepared_statement *stmt,
TABLE_LIST *table_list) TABLE_LIST *table_list)
{ {
int res; bool res;
THD *thd= stmt->thd; THD *thd= stmt->thd;
SELECT_LEX *select= &stmt->lex->select_lex; SELECT_LEX *select= &stmt->lex->select_lex;
DBUG_ENTER("mysql_test_update"); DBUG_ENTER("mysql_test_update");
@ -1010,28 +1003,27 @@ static int mysql_test_update(Prepared_statement *stmt,
tables list of tables queries tables list of tables queries
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error
-1 error, not sent to client
*/ */
static int mysql_test_delete(Prepared_statement *stmt, static int mysql_test_delete(Prepared_statement *stmt,
TABLE_LIST *table_list) TABLE_LIST *table_list)
{ {
int res;
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= stmt->lex; LEX *lex= stmt->lex;
DBUG_ENTER("mysql_test_delete"); DBUG_ENTER("mysql_test_delete");
if ((res= delete_precheck(thd, table_list))) if (delete_precheck(thd, table_list))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
if (!(res=open_and_lock_tables(thd, table_list))) if (!open_and_lock_tables(thd, table_list))
{ {
res= mysql_prepare_delete(thd, table_list, &lex->select_lex.where); mysql_prepare_delete(thd, table_list, &lex->select_lex.where);
lex->unit.cleanup(); lex->unit.cleanup();
DBUG_RETURN(FALSE)
} }
/* TODO: here we should send types of placeholders to the client. */ /* TODO: here we should send types of placeholders to the client. */
DBUG_RETURN(res); DBUG_RETURN(TRUE);
} }
@ -1046,9 +1038,8 @@ static int mysql_test_delete(Prepared_statement *stmt,
tables list of tables queries tables list of tables queries
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error, sent to client
-1 error, not sent to client
*/ */
static int mysql_test_select(Prepared_statement *stmt, static int mysql_test_select(Prepared_statement *stmt,
@ -1057,7 +1048,7 @@ static int mysql_test_select(Prepared_statement *stmt,
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= stmt->lex; LEX *lex= stmt->lex;
SELECT_LEX_UNIT *unit= &lex->unit; SELECT_LEX_UNIT *unit= &lex->unit;
int result; bool result;
DBUG_ENTER("mysql_test_select"); DBUG_ENTER("mysql_test_select");
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -1065,26 +1056,21 @@ static int mysql_test_select(Prepared_statement *stmt,
if (tables) if (tables)
{ {
if (check_table_access(thd, privilege, tables,0)) if (check_table_access(thd, privilege, tables,0))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
else if (check_access(thd, privilege, any_db,0,0,0)) else if (check_access(thd, privilege, any_db,0,0,0))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
#endif #endif
if ((result= open_and_lock_tables(thd, tables))) if ((result= open_and_lock_tables(thd, tables)))
{
result= 1; // Error sent
send_error(thd);
goto err; goto err;
} result= TRUE;
result= 1;
thd->used_tables= 0; // Updated by setup_fields thd->used_tables= 0; // Updated by setup_fields
// JOIN::prepare calls // JOIN::prepare calls
if (unit->prepare(thd, 0, 0)) if (unit->prepare(thd, 0, 0))
{ {
send_error(thd);
goto err_prep; goto err_prep;
} }
if (!text_protocol) if (!text_protocol)
@ -1106,7 +1092,7 @@ static int mysql_test_select(Prepared_statement *stmt,
goto err_prep; goto err_prep;
} }
} }
result= 0; // ok result= FALSE; // ok
err_prep: err_prep:
unit->cleanup(); unit->cleanup();
@ -1125,30 +1111,27 @@ err:
values list of expressions values list of expressions
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error, sent to client
-1 error, not sent to client
*/ */
static int mysql_test_do_fields(Prepared_statement *stmt, static bool mysql_test_do_fields(Prepared_statement *stmt,
TABLE_LIST *tables, TABLE_LIST *tables,
List<Item> *values) List<Item> *values)
{ {
DBUG_ENTER("mysql_test_do_fields"); DBUG_ENTER("mysql_test_do_fields");
THD *thd= stmt->thd; THD *thd= stmt->thd;
int res= 0; bool res;
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0))) if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
if (tables && (res= open_and_lock_tables(thd, tables))) if (tables && open_and_lock_tables(thd, tables))
{ {
DBUG_RETURN(res); DBUG_RETURN(TRUE);
} }
res= setup_fields(thd, 0, 0, *values, 0, 0, 0); res= setup_fields(thd, 0, 0, *values, 0, 0, 0);
stmt->lex->unit.cleanup(); stmt->lex->unit.cleanup();
if (res) DBUG_RETURN(res);
DBUG_RETURN(-1);
DBUG_RETURN(0);
} }
@ -1162,22 +1145,21 @@ static int mysql_test_do_fields(Prepared_statement *stmt,
values list of expressions values list of expressions
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error
-1 error, not sent to client
*/ */
static int mysql_test_set_fields(Prepared_statement *stmt, static bool mysql_test_set_fields(Prepared_statement *stmt,
TABLE_LIST *tables, TABLE_LIST *tables,
List<set_var_base> *var_list) List<set_var_base> *var_list)
{ {
DBUG_ENTER("mysql_test_set_fields"); DBUG_ENTER("mysql_test_set_fields");
List_iterator_fast<set_var_base> it(*var_list); List_iterator_fast<set_var_base> it(*var_list);
THD *thd= stmt->thd; THD *thd= stmt->thd;
set_var_base *var; set_var_base *var;
int res= 0; bool res= 0;
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0))) if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
if (tables && (res= open_and_lock_tables(thd, tables))) if (tables && (res= open_and_lock_tables(thd, tables)))
goto error; goto error;
@ -1186,7 +1168,7 @@ static int mysql_test_set_fields(Prepared_statement *stmt,
if (var->light_check(thd)) if (var->light_check(thd))
{ {
stmt->lex->unit.cleanup(); stmt->lex->unit.cleanup();
res= -1; res= TRUE;
goto error; goto error;
} }
} }
@ -1206,18 +1188,17 @@ error:
specific_prepare - function of command specific prepare specific_prepare - function of command specific prepare
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error
-1 error, not sent to client
*/ */
static int select_like_statement_test(Prepared_statement *stmt, static bool select_like_statement_test(Prepared_statement *stmt,
TABLE_LIST *tables, TABLE_LIST *tables,
int (*specific_prepare)(THD *thd)) bool (*specific_prepare)(THD *thd))
{ {
DBUG_ENTER("select_like_statement_test"); DBUG_ENTER("select_like_statement_test");
THD *thd= stmt->thd; THD *thd= stmt->thd;
LEX *lex= stmt->lex; LEX *lex= stmt->lex;
int res= 0; bool res= 0;
if (tables && (res= open_and_lock_tables(thd, tables))) if (tables && (res= open_and_lock_tables(thd, tables)))
goto end; goto end;
@ -1230,7 +1211,7 @@ static int select_like_statement_test(Prepared_statement *stmt,
// JOIN::prepare calls // JOIN::prepare calls
if (lex->unit.prepare(thd, 0, 0)) if (lex->unit.prepare(thd, 0, 0))
{ {
res= thd->net.report_error ? -1 : 1; res= TRUE;
} }
end: end:
lex->unit.cleanup(); lex->unit.cleanup();
@ -1287,16 +1268,15 @@ static int mysql_test_create_table(Prepared_statement *stmt)
tables list of tables queries tables list of tables queries
RETURN VALUE RETURN VALUE
0 success FALSE success
1 error, sent to client TRUE error
-1 error, not sent to client
*/ */
static int mysql_test_multiupdate(Prepared_statement *stmt,
static bool mysql_test_multiupdate(Prepared_statement *stmt,
TABLE_LIST *tables) TABLE_LIST *tables)
{ {
int res; if (multi_update_precheck(stmt->thd, tables))
if ((res= multi_update_precheck(stmt->thd, tables))) return TRUE;
return res;
return select_like_statement_test(stmt, tables, &mysql_multi_update_prepare); return select_like_statement_test(stmt, tables, &mysql_multi_update_prepare);
} }
@ -1477,8 +1457,6 @@ static int send_prepare_results(Prepared_statement *stmt, bool text_protocol)
if (res == 0) if (res == 0)
DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0)); DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0));
error: error:
if (res < 0)
send_error(thd,thd->killed_errno());
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -1500,10 +1478,7 @@ static bool init_param_array(Prepared_statement *stmt)
alloc_root(&stmt->thd->mem_root, alloc_root(&stmt->thd->mem_root,
sizeof(Item_param*) * stmt->param_count); sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array) if (!stmt->param_array)
{
send_error(stmt->thd, ER_OUT_OF_RESOURCES);
return 1; return 1;
}
for (to= stmt->param_array; for (to= stmt->param_array;
to < stmt->param_array + stmt->param_count; to < stmt->param_array + stmt->param_count;
++to) ++to)
@ -1527,10 +1502,10 @@ static bool init_param_array(Prepared_statement *stmt)
name NULL or statement name. For unnamed statements binary PS name NULL or statement name. For unnamed statements binary PS
protocol is used, for named statements text protocol is protocol is used, for named statements text protocol is
used. used.
RETURN RETURN
0 OK, statement prepared successfully FALSE OK, statement prepared successfully
other Error TRUE Error
NOTES NOTES
This function parses the query and sends the total number of parameters This function parses the query and sends the total number of parameters
and resultset metadata information back to client (if any), without and resultset metadata information back to client (if any), without
@ -1544,21 +1519,18 @@ static bool init_param_array(Prepared_statement *stmt)
*/ */
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
LEX_STRING *name) LEX_STRING *name)
{ {
LEX *lex; LEX *lex;
Prepared_statement *stmt= new Prepared_statement(thd); Prepared_statement *stmt= new Prepared_statement(thd);
int error; bool error;
DBUG_ENTER("mysql_stmt_prepare"); DBUG_ENTER("mysql_stmt_prepare");
DBUG_PRINT("prep_query", ("%s", packet)); DBUG_PRINT("prep_query", ("%s", packet));
if (stmt == 0) if (stmt == 0)
{ DBUG_RETURN(TRUE);
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1);
}
if (name) if (name)
{ {
@ -1567,16 +1539,14 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
name->length))) name->length)))
{ {
delete stmt; delete stmt;
send_error(thd, ER_OUT_OF_RESOURCES); DBUG_RETURN(TRUE);
DBUG_RETURN(1);
} }
} }
if (thd->stmt_map.insert(stmt)) if (thd->stmt_map.insert(stmt))
{ {
delete stmt; delete stmt;
send_error(thd, ER_OUT_OF_RESOURCES); DBUG_RETURN(TRUE);
DBUG_RETURN(1);
} }
thd->set_n_backup_statement(stmt, &thd->stmt_backup); thd->set_n_backup_statement(stmt, &thd->stmt_backup);
@ -1588,8 +1558,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
thd->restore_backup_item_arena(stmt, &thd->stmt_backup); thd->restore_backup_item_arena(stmt, &thd->stmt_backup);
/* Statement map deletes statement on erase */ /* Statement map deletes statement on erase */
thd->stmt_map.erase(stmt); thd->stmt_map.erase(stmt);
send_error(thd, ER_OUT_OF_RESOURCES); DBUG_RETURN(TRUE);
DBUG_RETURN(1);
} }
mysql_log.write(thd, COM_PREPARE, "%s", packet); mysql_log.write(thd, COM_PREPARE, "%s", packet);
@ -1768,8 +1737,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
packet+= 9; /* stmt_id + 5 bytes of flags */ packet+= 9; /* stmt_id + 5 bytes of flags */
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute", if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
SEND_ERROR)))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
DBUG_PRINT("exec_query:", ("%s", stmt->query)); DBUG_PRINT("exec_query:", ("%s", stmt->query));
@ -1777,7 +1745,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
/* Check if we got an error when sending long data */ /* Check if we got an error when sending long data */
if (stmt->state == Item_arena::ERROR) if (stmt->state == Item_arena::ERROR)
{ {
send_error(thd, stmt->last_errno, stmt->last_error); my_message(stmt->last_errno, stmt->last_error, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -1795,10 +1763,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{ {
if (!stmt->cursor && if (!stmt->cursor &&
!(stmt->cursor= new (&stmt->mem_root) Cursor())) !(stmt->cursor= new (&stmt->mem_root) Cursor()))
{
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
}
/* If lex->result is set, mysql_execute_command will use it */ /* If lex->result is set, mysql_execute_command will use it */
stmt->lex->result= &stmt->cursor->result; stmt->lex->result= &stmt->cursor->result;
} }
@ -1866,7 +1831,6 @@ set_params_data_err:
reset_stmt_params(stmt); reset_stmt_params(stmt);
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute");
err: err:
send_error(thd);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -1892,14 +1856,12 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
{ {
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_name->length, my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_name->length,
stmt_name->str, "EXECUTE"); stmt_name->str, "EXECUTE");
send_error(thd);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
if (stmt->param_count != thd->lex->prepared_stmt_params.elements) if (stmt->param_count != thd->lex->prepared_stmt_params.elements)
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
send_error(thd);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -1910,7 +1872,6 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
&expanded_query)) &expanded_query))
{ {
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
send_error(thd);
} }
execute_stmt(thd, stmt, &expanded_query); execute_stmt(thd, stmt, &expanded_query);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -1994,7 +1955,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
!stmt->cursor->is_open()) !stmt->cursor->is_open())
{ {
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch"); my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch");
send_error(thd);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -2018,9 +1978,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
thd->set_statement(&thd->stmt_backup); thd->set_statement(&thd->stmt_backup);
thd->set_item_arena(&thd->stmt_backup); thd->set_item_arena(&thd->stmt_backup);
if (error && error != -4)
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -2050,8 +2007,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
DBUG_ENTER("mysql_stmt_reset"); DBUG_ENTER("mysql_stmt_reset");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset", if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
SEND_ERROR)))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
stmt->state= Item_arena::PREPARED; stmt->state= Item_arena::PREPARED;
@ -2081,8 +2037,7 @@ void mysql_stmt_free(THD *thd, char *packet)
DBUG_ENTER("mysql_stmt_free"); DBUG_ENTER("mysql_stmt_free");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close", if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close")))
DONT_SEND_ERROR)))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
/* Statement map deletes statement on erase */ /* Statement map deletes statement on erase */
@ -2132,8 +2087,8 @@ void mysql_stmt_get_longdata(THD *thd, char *packet, ulong packet_length)
stmt_id= uint4korr(packet); stmt_id= uint4korr(packet);
packet+= 4; packet+= 4;
if (!(stmt=find_prepared_statement(thd, stmt_id, "mysql_stmt_send_long_data", if (!(stmt=find_prepared_statement(thd, stmt_id,
DONT_SEND_ERROR))) "mysql_stmt_send_long_data")))
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
param_number= uint2korr(packet); param_number= uint2korr(packet);

View file

@ -278,41 +278,39 @@ bool log_in_use(const char* log_name)
return result; return result;
} }
int purge_error_message(THD* thd, int res) bool purge_error_message(THD* thd, int res)
{ {
const char *errmsg= 0; uint errmsg= 0;
switch (res) { switch (res) {
case 0: break; case 0: break;
case LOG_INFO_EOF: errmsg= "Target log not found in binlog index"; break; case LOG_INFO_EOF: errmsg= ER_UNKNOWN_TARGET_BINLOG; break;
case LOG_INFO_IO: errmsg= "I/O error reading log index file"; break; case LOG_INFO_IO: errmsg= ER_IO_ERR_LOG_INDEX_READ; break;
case LOG_INFO_INVALID: case LOG_INFO_INVALID:errmsg= ER_BINLOG_PURGE_PROHIBITED; break;
errmsg= "Server configuration does not permit binlog purge"; break; case LOG_INFO_SEEK: errmsg= ER_FSEEK_FAIL; break;
case LOG_INFO_SEEK: errmsg= "Failed on fseek()"; break; case LOG_INFO_MEM: errmsg= ER_OUT_OF_RESOURCES; break;
case LOG_INFO_MEM: errmsg= "Out of memory"; break; case LOG_INFO_FATAL: errmsg= ER_BINLOG_PURGE_FATAL_ERR; break;
case LOG_INFO_FATAL: errmsg= "Fatal error during purge"; break; case LOG_INFO_IN_USE: errmsg= ER_LOG_IN_USE; break;
case LOG_INFO_IN_USE: errmsg= "A purgeable log is in use, will not purge"; default: errmsg= ER_LOG_PURGE_UNKNOWN_ERR; break;
break;
default: errmsg= "Unknown error during purge"; break;
} }
if (errmsg) if (errmsg)
{ {
send_error(thd, 0, errmsg); my_error(errmsg, MYF(0));
return 1; return TRUE;
} }
send_ok(thd); send_ok(thd);
return 0; return FALSE;
} }
int purge_master_logs(THD* thd, const char* to_log) bool purge_master_logs(THD* thd, const char* to_log)
{ {
char search_file_name[FN_REFLEN]; char search_file_name[FN_REFLEN];
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
send_ok(current_thd); send_ok(current_thd);
return 0; return FALSE;
} }
mysql_bin_log.make_log_name(search_file_name, to_log); mysql_bin_log.make_log_name(search_file_name, to_log);
@ -322,10 +320,10 @@ int purge_master_logs(THD* thd, const char* to_log)
} }
int purge_master_logs_before_date(THD* thd, time_t purge_time) bool purge_master_logs_before_date(THD* thd, time_t purge_time)
{ {
int res = mysql_bin_log.purge_logs_before_date(purge_time); return purge_error_message(thd,
return purge_error_message(thd ,res); mysql_bin_log.purge_logs_before_date(purge_time));
} }
int test_for_non_eof_log_read_errors(int error, const char **errmsg) int test_for_non_eof_log_read_errors(int error, const char **errmsg)
@ -753,7 +751,7 @@ err:
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
if (file >= 0) if (file >= 0)
(void) my_close(file, MYF(MY_WME)); (void) my_close(file, MYF(MY_WME));
send_error(thd, my_errno, errmsg); my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
@ -869,7 +867,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (slave_errno) if (slave_errno)
{ {
if (net_report) if (net_report)
send_error(thd, slave_errno); my_error(slave_errno, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
else if (net_report) else if (net_report)
@ -919,7 +917,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
if (slave_errno) if (slave_errno)
{ {
if (net_report) if (net_report)
send_error(thd, slave_errno); my_error(slave_errno, MYF(0));
return 1; return 1;
} }
else if (net_report) else if (net_report)
@ -1054,7 +1052,7 @@ void kill_zombie_dump_threads(uint32 slave_server_id)
} }
int change_master(THD* thd, MASTER_INFO* mi) bool change_master(THD* thd, MASTER_INFO* mi)
{ {
int thread_mask; int thread_mask;
const char* errmsg= 0; const char* errmsg= 0;
@ -1065,9 +1063,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
init_thread_mask(&thread_mask,mi,0 /*not inverse*/); init_thread_mask(&thread_mask,mi,0 /*not inverse*/);
if (thread_mask) // We refuse if any slave thread is running if (thread_mask) // We refuse if any slave thread is running
{ {
net_printf(thd,ER_SLAVE_MUST_STOP); my_error(ER_SLAVE_MUST_STOP, MYF(0));
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
thd->proc_info = "Changing master"; thd->proc_info = "Changing master";
@ -1075,9 +1073,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
// TODO: see if needs re-write // TODO: see if needs re-write
if (init_master_info(mi, master_info_file, relay_log_info_file, 0)) if (init_master_info(mi, master_info_file, relay_log_info_file, 0))
{ {
send_error(thd, ER_MASTER_INFO); my_error(ER_MASTER_INFO, MYF(0));
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
/* /*
@ -1194,9 +1192,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
0 /* not only reset, but also reinit */, 0 /* not only reset, but also reinit */,
&errmsg)) &errmsg))
{ {
net_printf(thd, 0, "Failed purging old relay logs: %s",errmsg); my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
else else
@ -1210,9 +1208,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/, 0 /*no data lock*/,
&msg, 0)) &msg, 0))
{ {
net_printf(thd,0,"Failed initializing relay log position: %s",msg); my_error(ER_RELAY_LOG_INIT, MYF(0), msg);
unlock_slave_threads(mi); unlock_slave_threads(mi);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
mi->rli.group_master_log_pos = mi->master_log_pos; mi->rli.group_master_log_pos = mi->master_log_pos;
@ -1254,7 +1252,7 @@ int change_master(THD* thd, MASTER_INFO* mi)
unlock_slave_threads(mi); unlock_slave_threads(mi);
thd->proc_info = 0; thd->proc_info = 0;
send_ok(thd); send_ok(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
int reset_master(THD* thd) int reset_master(THD* thd)
@ -1285,7 +1283,7 @@ int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
} }
int show_binlog_events(THD* thd) bool show_binlog_events(THD* thd)
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
DBUG_ENTER("show_binlog_events"); DBUG_ENTER("show_binlog_events");
@ -1299,7 +1297,7 @@ int show_binlog_events(THD* thd)
Log_event::init_show_field_list(&field_list); Log_event::init_show_field_list(&field_list);
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
@ -1405,18 +1403,18 @@ err:
{ {
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0), my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
"SHOW BINLOG EVENTS", errmsg); "SHOW BINLOG EVENTS", errmsg);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
pthread_mutex_lock(&LOCK_thread_count); pthread_mutex_lock(&LOCK_thread_count);
thd->current_linfo = 0; thd->current_linfo = 0;
pthread_mutex_unlock(&LOCK_thread_count); pthread_mutex_unlock(&LOCK_thread_count);
DBUG_RETURN(0); DBUG_RETURN(TRUE);
} }
int show_binlog_info(THD* thd) bool show_binlog_info(THD* thd)
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
DBUG_ENTER("show_binlog_info"); DBUG_ENTER("show_binlog_info");
@ -1429,7 +1427,7 @@ int show_binlog_info(THD* thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
@ -1442,10 +1440,10 @@ int show_binlog_info(THD* thd)
protocol->store(&binlog_do_db); protocol->store(&binlog_do_db);
protocol->store(&binlog_ignore_db); protocol->store(&binlog_ignore_db);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -1457,11 +1455,11 @@ int show_binlog_info(THD* thd)
thd Thread specific variable thd Thread specific variable
RETURN VALUES RETURN VALUES
0 ok FALSE OK
1 error (Error message sent to client) TRUE error
*/ */
int show_binlogs(THD* thd) bool show_binlogs(THD* thd)
{ {
IO_CACHE *index_file; IO_CACHE *index_file;
char fname[FN_REFLEN]; char fname[FN_REFLEN];
@ -1472,15 +1470,14 @@ int show_binlogs(THD* thd)
if (!mysql_bin_log.is_open()) if (!mysql_bin_log.is_open())
{ {
//TODO: Replace with ER() error message my_error(ER_NO_BINARY_LOGGING, MYF(0));
send_error(thd, 0, "You are not using binary logging");
return 1; return 1;
} }
field_list.push_back(new Item_empty_string("Log_name", 255)); field_list.push_back(new Item_empty_string("Log_name", 255));
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
mysql_bin_log.lock_index(); mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file(); index_file=mysql_bin_log.get_index_file();
@ -1498,11 +1495,11 @@ int show_binlogs(THD* thd)
} }
mysql_bin_log.unlock_index(); mysql_bin_log.unlock_index();
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
mysql_bin_log.unlock_index(); mysql_bin_log.unlock_index();
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }

View file

@ -27,17 +27,17 @@ File open_binlog(IO_CACHE *log, const char *log_file_name,
int start_slave(THD* thd, MASTER_INFO* mi, bool net_report); int start_slave(THD* thd, MASTER_INFO* mi, bool net_report);
int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report); int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
int change_master(THD* thd, MASTER_INFO* mi); bool change_master(THD* thd, MASTER_INFO* mi);
int show_binlog_events(THD* thd); bool show_binlog_events(THD* thd);
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1, int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2); const char* log_file_name2, ulonglong log_pos2);
int reset_slave(THD *thd, MASTER_INFO* mi); int reset_slave(THD *thd, MASTER_INFO* mi);
int reset_master(THD* thd); int reset_master(THD* thd);
int purge_master_logs(THD* thd, const char* to_log); bool purge_master_logs(THD* thd, const char* to_log);
int purge_master_logs_before_date(THD* thd, time_t purge_time); bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool log_in_use(const char* log_name); bool log_in_use(const char* log_name);
void adjust_linfo_offsets(my_off_t purge_offset); void adjust_linfo_offsets(my_off_t purge_offset);
int show_binlogs(THD* thd); bool show_binlogs(THD* thd);
extern int init_master_info(MASTER_INFO* mi); extern int init_master_info(MASTER_INFO* mi);
void kill_zombie_dump_threads(uint32 slave_server_id); void kill_zombie_dump_threads(uint32 slave_server_id);
int check_binlog_magic(IO_CACHE* log, const char** errmsg); int check_binlog_magic(IO_CACHE* log, const char** errmsg);

View file

@ -195,9 +195,9 @@ static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab);
This handles SELECT with and without UNION 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; register SELECT_LEX *select_lex = &lex->select_lex;
DBUG_ENTER("handle_select"); DBUG_ENTER("handle_select");
@ -224,14 +224,14 @@ int handle_select(THD *thd, LEX *lex, select_result *result)
/* Don't set res if it's -1 as we may want this later */ /* Don't set res if it's -1 as we may want this later */
DBUG_PRINT("info",("res: %d report_error: %d", res, DBUG_PRINT("info",("res: %d report_error: %d", res,
thd->net.report_error)); thd->net.report_error));
if (thd->net.report_error) res|= thd->net.report_error;
res= 1;
if (unlikely(res)) if (unlikely(res))
{ {
if (res > 0) /*
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(); result->abort();
res= 1; // Error sent to client
} }
DBUG_RETURN(res); DBUG_RETURN(res);
} }
@ -396,21 +396,20 @@ JOIN::prepare(Item ***rref_pointer_array,
{ {
if (!test_if_subpart(procedure->group,group_list)) if (!test_if_subpart(procedure->group,group_list))
{ /* purecov: inspected */ { /* purecov: inspected */
my_message(0,"Can't handle procedures with differents groups yet", my_error(ER_DIFF_GROUPS_PROC, MYF(0)); /* purecov: inspected */
MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
} }
#ifdef NOT_NEEDED #ifdef NOT_NEEDED
else if (!group_list && procedure->flags & PROC_GROUP) 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; goto err;
} }
#endif #endif
if (order && (procedure->flags & PROC_NO_SORT)) if (order && (procedure->flags & PROC_NO_SORT))
{ /* purecov: inspected */ { /* purecov: inspected */
my_message(0,"Can't use order with this procedure",MYF(0)); /* purecov: inspected */ my_error(ER_ORDER_WITH_PROC, MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */ goto err; /* purecov: inspected */
} }
} }
@ -1891,7 +1890,7 @@ Cursor::~Cursor()
/*********************************************************************/ /*********************************************************************/
int bool
mysql_select(THD *thd, Item ***rref_pointer_array, mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &fields, TABLE_LIST *tables, uint wild_num, List<Item> &fields,
COND *conds, uint og_num, ORDER *order, ORDER *group, COND *conds, uint og_num, ORDER *order, ORDER *group,
@ -1899,7 +1898,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
select_result *result, SELECT_LEX_UNIT *unit, select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex) SELECT_LEX *select_lex)
{ {
int err; bool err;
bool free_join= 1; bool free_join= 1;
DBUG_ENTER("mysql_select"); DBUG_ENTER("mysql_select");
@ -1907,7 +1906,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (select_lex->join != 0) if (select_lex->join != 0)
{ {
join= select_lex->join; 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 || if (select_lex->linkage != DERIVED_TABLE_TYPE ||
(select_options & SELECT_DESCRIBE)) (select_options & SELECT_DESCRIBE))
{ {
@ -1916,7 +1918,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
//here is EXPLAIN of subselect or derived table //here is EXPLAIN of subselect or derived table
if (join->change_result(result)) if (join->change_result(result))
{ {
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
else else
@ -1935,7 +1937,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
else else
{ {
if (!(join= new JOIN(thd, fields, select_options, result))) if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
thd->proc_info="init"; thd->proc_info="init";
thd->used_tables=0; // Updated by setup_fields thd->used_tables=0; // Updated by setup_fields
if (join->prepare(rref_pointer_array, tables, wild_num, if (join->prepare(rref_pointer_array, tables, wild_num,
@ -1983,10 +1985,8 @@ err:
{ {
thd->proc_info="end"; thd->proc_info="end";
err= join->cleanup(); err= join->cleanup();
if (thd->net.report_error)
err= -1;
delete join; delete join;
DBUG_RETURN(err); DBUG_RETURN(err || thd->net.report_error);
} }
DBUG_RETURN(join->error); DBUG_RETURN(join->error);
} }
@ -11665,10 +11665,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"); DBUG_ENTER("mysql_explain_union");
int res= 0; bool res= 0;
SELECT_LEX *first= unit->first_select(); SELECT_LEX *first= unit->first_select();
for (SELECT_LEX *sl= first; for (SELECT_LEX *sl= first;
@ -11719,9 +11719,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
first->options | thd->options | SELECT_DESCRIBE, first->options | thd->options | SELECT_DESCRIBE,
result, unit, first); result, unit, first);
} }
if (res > 0 || thd->net.report_error) DBUG_RETURN(res || thd->net.report_error);
res= -1; // mysql_explain_select do not report error
DBUG_RETURN(res);
} }
@ -11932,17 +11930,17 @@ void st_select_lex::print(THD *thd, String *str)
res new select_result object res new select_result object
RETURN RETURN
0 - OK FALSE - OK
-1 - error TRUE - error
*/ */
int JOIN::change_result(select_result *res) bool JOIN::change_result(select_result *res)
{ {
DBUG_ENTER("JOIN::change_result"); DBUG_ENTER("JOIN::change_result");
result= res; result= res;
if (!procedure && result->prepare(fields_list, select_lex->master_unit())) if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
{ {
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }

View file

@ -330,7 +330,7 @@ class JOIN :public Sql_alloc
return (do_send_rows && tmp_table_param.sum_func_count != 0 && return (do_send_rows && tmp_table_param.sum_func_count != 0 &&
!group_list); !group_list);
} }
int change_result(select_result *result); bool change_result(select_result *result);
}; };

View file

@ -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 A database is a directory in the mysql_data_home directory
*/ */
int bool
mysqld_show_dbs(THD *thd,const char *wild) mysqld_show_dbs(THD *thd,const char *wild)
{ {
Item_string *field=new Item_string("",0,thd->charset()); 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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) 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)) if (mysql_find_files(thd,&files,NullS,mysql_data_home,wild,1))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
List_iterator_fast<char> it(files); List_iterator_fast<char> it(files);
while ((file_name=it++)) while ((file_name=it++))
@ -84,11 +84,11 @@ mysqld_show_dbs(THD *thd,const char *wild)
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(file_name, system_charset_info); protocol->store(file_name, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
send_eof(thd); 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 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<Item> field_list; List<Item> field_list;
OPEN_TABLE_LIST *open_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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) 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) 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) 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); protocol->store_tiny((longlong) open_list->locked);
if (protocol->write()) if (protocol->write())
{ {
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
send_eof(thd); 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 ** 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) bool show_type)
{ {
Item_string *field=new Item_string("",0,thd->charset()); 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) if (show_type)
field_list.push_back(new Item_empty_string("Table_type", 10)); field_list.push_back(new Item_empty_string("Table_type", 10));
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) ||
DBUG_RETURN(1); mysql_find_files(thd,&files,db,path,wild,0))
if (mysql_find_files(thd,&files,db,path,wild,0)) DBUG_RETURN(TRUE);
DBUG_RETURN(-1);
List_iterator_fast<char> it(files); List_iterator_fast<char> it(files);
while ((file_name=it++)) while ((file_name=it++))
{ {
@ -190,17 +189,17 @@ int mysqld_show_tables(THD *thd, const char *db, const char *wild,
} }
} }
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
/*************************************************************************** /***************************************************************************
** List all table types supported ** List all table types supported
***************************************************************************/ ***************************************************************************/
int mysqld_show_storage_engines(THD *thd) bool mysqld_show_storage_engines(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
@ -212,7 +211,7 @@ int mysqld_show_storage_engines(THD *thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
const char *default_type_name= const char *default_type_name=
ha_get_storage_engine((enum db_type)thd->variables.table_type); 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(option_name, system_charset_info);
protocol->store(types->comment, system_charset_info); protocol->store(types->comment, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -275,7 +274,7 @@ static struct show_privileges_st sys_privileges[]=
{NullS, NullS, NullS} {NullS, NullS, NullS}
}; };
int mysqld_show_privileges(THD *thd) bool mysqld_show_privileges(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
@ -287,7 +286,7 @@ int mysqld_show_privileges(THD *thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
show_privileges_st *privilege= sys_privileges; show_privileges_st *privilege= sys_privileges;
for (privilege= sys_privileges; privilege->privilege ; privilege++) 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->context, system_charset_info);
protocol->store(privilege->comment, system_charset_info); protocol->store(privilege->comment, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); 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"}, "A very small integer"},
}; };
int mysqld_show_column_types(THD *thd) bool mysqld_show_column_types(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
@ -363,7 +362,7 @@ int mysqld_show_column_types(THD *thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
/* TODO: Change the loop to not use 'i' */ /* TODO: Change the loop to not use 'i' */
for (uint i=0; i < sizeof(sys_column_types)/sizeof(sys_column_types[0]); 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].default_value, system_charset_info);
protocol->store(sys_column_types[i].comment, system_charset_info); protocol->store(sys_column_types[i].comment, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -486,7 +485,7 @@ mysql_find_files(THD *thd,List<char> *files, const char *db,const char *path,
Extended version of mysqld_show_tables 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; Item *item;
List<char> files; List<char> files;
@ -496,7 +495,7 @@ int mysqld_extend_show_tables(THD *thd,const char *db,const char *wild)
TABLE *table; TABLE *table;
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
TIME time; TIME time;
int res; bool res;
DBUG_ENTER("mysqld_extend_show_tables"); DBUG_ENTER("mysqld_extend_show_tables");
(void) sprintf(path,"%s/%s",mysql_data_home,db); (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)); field_list.push_back(item=new Item_empty_string("Comment",80));
item->maybe_null=1; item->maybe_null=1;
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF) ||
DBUG_RETURN(1); mysql_find_files(thd,&files,db,path,wild,0))
DBUG_RETURN(TRUE);
if (mysql_find_files(thd,&files,db,path,wild,0))
DBUG_RETURN(-1);
List_iterator_fast<char> it(files); List_iterator_fast<char> it(files);
while ((file_name=it++)) 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++) for (uint i=2 ; i < field_list.elements ; i++)
protocol->store_null(); protocol->store_null();
// Send error to Comment field if possible // Send error to Comment field
if (res < 0) if (res)
{ {
protocol->store(thd->net.last_error, system_charset_info); protocol->store(thd->net.last_error, system_charset_info);
thd->clear_error(); thd->clear_error();
} }
else
DBUG_RETURN(1);
} }
else if (table_list.view) 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); close_thread_tables(thd, 0);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
send_eof(thd); 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 ** List all columns in a table_list->real_name
***************************************************************************/ ***************************************************************************/
int bool
mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild, mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
bool verbose) bool verbose)
{ {
@ -707,11 +702,9 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
table_list->real_name)); table_list->real_name));
table_list->lock_type= TL_UNLOCK; 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) DBUG_RETURN(TRUE);
send_error(thd);
DBUG_RETURN(1);
} }
table= table_list->table; table= table_list->table;
file=table->file; 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 // Send first number of fields and records
if (protocol->send_records_num(&field_list, (ulonglong)file->records) || if (protocol->send_records_num(&field_list, (ulonglong)file->records) ||
protocol->send_fields(&field_list, Protocol::SEND_EOF)) protocol->send_fields(&field_list, Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
restore_record(table,default_values); // Get empty record restore_record(table,default_values); // Get empty record
Field **ptr,*field; Field **ptr,*field;
@ -844,16 +837,16 @@ mysqld_show_fields(THD *thd, TABLE_LIST *table_list,const char *wild,
system_charset_info); system_charset_info);
} }
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
int bool
mysqld_show_create(THD *thd, TABLE_LIST *table_list) mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{ {
TABLE *table; TABLE *table;
@ -866,18 +859,16 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
table_list->real_name)); table_list->real_name));
/* Only one table for now, but VIEW can involve several tables */ /* 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) DBUG_RETURN(TRUE);
send_error(thd);
DBUG_RETURN(1);
} }
/* TODO: add environment variables show when it become possible */ /* TODO: add environment variables show when it become possible */
if (thd->lex->only_view && !table_list->view) if (thd->lex->only_view && !table_list->view)
{ {
my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, my_error(ER_WRONG_OBJECT, MYF(0), table_list->db,
table_list->real_name, "VIEW"); table_list->real_name, "VIEW");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
table= table_list->table; table= table_list->table;
@ -885,7 +876,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if ((table_list->view ? if ((table_list->view ?
view_store_create_info(thd, table_list, &buffer) : view_store_create_info(thd, table_list, &buffer) :
store_create_info(thd, table, &buffer))) store_create_info(thd, table, &buffer)))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
List<Item> field_list; List<Item> field_list;
if (table_list->view) if (table_list->view)
@ -904,31 +895,31 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
buffer.length(0); buffer.length(0);
if (table_list->view) if (table_list->view)
{ {
protocol->store(table_list->view_name.str, system_charset_info); protocol->store(table_list->view_name.str, system_charset_info);
if (view_store_create_info(thd, table_list, &buffer)) if (view_store_create_info(thd, table_list, &buffer))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
else else
{ {
protocol->store(table->table_name, system_charset_info); protocol->store(table->table_name, system_charset_info);
if (store_create_info(thd, table, &buffer)) if (store_create_info(thd, table, &buffer))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(TRUE);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
int mysqld_show_create_db(THD *thd, char *dbname, bool mysqld_show_create_db(THD *thd, char *dbname,
HA_CREATE_INFO *create_info) HA_CREATE_INFO *create_info)
{ {
int length; int length;
char path[FN_REFLEN]; char path[FN_REFLEN];
@ -945,8 +936,8 @@ int mysqld_show_create_db(THD *thd, char *dbname,
if (check_db_name(dbname)) if (check_db_name(dbname))
{ {
net_printf(thd,ER_WRONG_DB_NAME, dbname); my_error(ER_WRONG_DB_NAME, MYF(0), dbname);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -957,11 +948,11 @@ int mysqld_show_create_db(THD *thd, char *dbname,
thd->master_access); thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname))) if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{ {
net_printf(thd,ER_DBACCESS_DENIED_ERROR, my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->priv_user, thd->host_or_ip, dbname); thd->priv_user, thd->host_or_ip, dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR), mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user, thd->host_or_ip, dbname); thd->priv_user, thd->host_or_ip, dbname);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
#endif #endif
@ -975,8 +966,8 @@ int mysqld_show_create_db(THD *thd, char *dbname,
} }
if (access(path,F_OK)) if (access(path,F_OK))
{ {
net_printf(thd,ER_BAD_DB_ERROR,dbname); my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
if (found_libchar) if (found_libchar)
path[length-1]= FN_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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(dbname, strlen(dbname), system_charset_info); 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()); protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); DBUG_RETURN(TRUE);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
int bool
mysqld_show_logs(THD *thd) mysqld_show_logs(THD *thd)
{ {
List<Item> field_list; List<Item> field_list;
@ -1032,19 +1023,19 @@ mysqld_show_logs(THD *thd)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
#ifdef HAVE_BERKELEY_DB #ifdef HAVE_BERKELEY_DB
if ((have_berkeley_db == SHOW_OPTION_YES) && berkeley_show_logs(protocol)) if ((have_berkeley_db == SHOW_OPTION_YES) && berkeley_show_logs(protocol))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
#endif #endif
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
int bool
mysqld_show_keys(THD *thd, TABLE_LIST *table_list) mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
{ {
TABLE *table; TABLE *table;
@ -1055,8 +1046,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
if (!(table = open_ltable(thd, table_list, TL_UNLOCK))) if (!(table = open_ltable(thd, table_list, TL_UNLOCK)))
{ {
send_error(thd); DBUG_RETURN(TRUE);
DBUG_RETURN(1);
} }
List<Item> field_list; List<Item> field_list;
@ -1082,7 +1072,7 @@ mysqld_show_keys(THD *thd, TABLE_LIST *table_list)
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
KEY *key_info=table->key_info; KEY *key_info=table->key_info;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME); 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 else
protocol->store("", 0, system_charset_info); protocol->store("", 0, system_charset_info);
if (protocol->write()) if (protocol->write())
DBUG_RETURN(1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }
} }
send_eof(thd); 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)); DBUG_PRINT("enter",("table: %s",table_list->real_name));
table_list->lock_type= TL_UNLOCK; 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_VOID_RETURN; DBUG_VOID_RETURN;
}
table= table_list->table; table= table_list->table;
List<Item> field_list; List<Item> field_list;
@ -1805,7 +1791,7 @@ static bool write_collation(Protocol *protocol, CHARSET_INFO *cs)
return protocol->write(); return protocol->write();
} }
int mysqld_show_collations(THD *thd, const char *wild) bool mysqld_show_collations(THD *thd, const char *wild)
{ {
char buff[8192]; char buff[8192];
String packet2(buff,sizeof(buff),thd->charset()); String packet2(buff,sizeof(buff),thd->charset());
@ -1813,7 +1799,7 @@ int mysqld_show_collations(THD *thd, const char *wild)
CHARSET_INFO **cs; CHARSET_INFO **cs;
Protocol *protocol= thd->protocol; 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("Collation",30));
field_list.push_back(new Item_empty_string("Charset",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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ ) 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); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
static bool write_charset(Protocol *protocol, CHARSET_INFO *cs) 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(); return protocol->write();
} }
int mysqld_show_charsets(THD *thd, const char *wild) bool mysqld_show_charsets(THD *thd, const char *wild)
{ {
char buff[8192]; char buff[8192];
String packet2(buff,sizeof(buff),thd->charset()); 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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ ) for ( cs= all_charsets ; cs < all_charsets+255 ; cs++ )
{ {
@ -1891,18 +1877,18 @@ int mysqld_show_charsets(THD *thd, const char *wild)
goto err; goto err;
} }
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
int mysqld_show(THD *thd, const char *wild, show_var_st *variables, bool mysqld_show(THD *thd, const char *wild, show_var_st *variables,
enum enum_var_type value_type, enum enum_var_type value_type,
pthread_mutex_t *mutex, pthread_mutex_t *mutex,
struct system_status_var *status_var) struct system_status_var *status_var)
{ {
char buff[1024]; char buff[1024];
List<Item> field_list; List<Item> 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)); field_list.push_back(new Item_empty_string("Value",256));
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) 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.str= 0; // For sys_var->value_ptr()
null_lex_str.length= 0; 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); pthread_mutex_unlock(mutex);
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
pthread_mutex_unlock(mutex); pthread_mutex_unlock(mutex);
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }

View file

@ -57,15 +57,15 @@ static int copy_data_between_tables(TABLE *from,TABLE *to,
Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set. Wait if global_read_lock (FLUSH TABLES WITH READ LOCK) is set.
RETURN RETURN
0 ok. In this case ok packet is sent to user FALSE OK. In this case ok packet is sent to user
-1 Error (Error message given but not sent to user) TRUE Error
*/ */
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary) my_bool drop_temporary)
{ {
int error= 0; bool error= FALSE;
DBUG_ENTER("mysql_rm_table"); DBUG_ENTER("mysql_rm_table");
/* mark for close and remove all cached entries */ /* mark for close and remove all cached entries */
@ -80,7 +80,7 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
{ {
my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0), my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE,MYF(0),
tables->real_name); tables->real_name);
error= 1; error= TRUE;
goto err; goto err;
} }
while (global_read_lock && ! thd->killed) while (global_read_lock && ! thd->killed)
@ -100,9 +100,9 @@ int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
pthread_mutex_unlock(&thd->mysys_var->mutex); pthread_mutex_unlock(&thd->mysys_var->mutex);
if (error) if (error)
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
send_ok(thd); send_ok(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
@ -1101,22 +1101,22 @@ int mysql_prepare_table(THD *thd, HA_CREATE_INFO *create_info,
and must be zero for standard create of table. and must be zero for standard create of table.
RETURN VALUES RETURN VALUES
0 ok FALSE OK
-1 error TRUE error
*/ */
int mysql_create_table(THD *thd,const char *db, const char *table_name, bool mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
List<create_field> &fields, List<create_field> &fields,
List<Key> &keys,bool tmp_table, List<Key> &keys,bool tmp_table,
uint select_field_count) uint select_field_count)
{ {
char path[FN_REFLEN]; char path[FN_REFLEN];
const char *alias; const char *alias;
int error= -1;
uint db_options, key_count; uint db_options, key_count;
KEY *key_info_buffer; KEY *key_info_buffer;
handler *file; handler *file;
bool error= TRUE;
enum db_type new_db_type; enum db_type new_db_type;
DBUG_ENTER("mysql_create_table"); DBUG_ENTER("mysql_create_table");
@ -1124,7 +1124,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (!fields.elements) if (!fields.elements)
{ {
my_error(ER_TABLE_MUST_HAVE_COLUMNS,MYF(0)); my_error(ER_TABLE_MUST_HAVE_COLUMNS,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if ((new_db_type= ha_checktype(create_info->db_type)) != if ((new_db_type= ha_checktype(create_info->db_type)) !=
create_info->db_type) create_info->db_type)
@ -1154,7 +1154,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
(file->table_flags() & HA_NO_TEMP_TABLES)) (file->table_flags() & HA_NO_TEMP_TABLES))
{ {
my_error(ER_ILLEGAL_HA,MYF(0),table_name); my_error(ER_ILLEGAL_HA,MYF(0),table_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
#endif #endif
@ -1179,7 +1179,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
keys, tmp_table, db_options, file, keys, tmp_table, db_options, file,
key_info_buffer, &key_count, key_info_buffer, &key_count,
select_field_count)) select_field_count))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
/* Check if table exists */ /* Check if table exists */
if (create_info->options & HA_LEX_CREATE_TMP_TABLE) if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
@ -1202,10 +1202,10 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{ {
create_info->table_existed= 1; // Mark that table existed create_info->table_existed= 1; // Mark that table existed
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias); my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (wait_if_global_read_lock(thd, 0, 1)) if (wait_if_global_read_lock(thd, 0, 1))
DBUG_RETURN(error); DBUG_RETURN(error);
@ -1217,7 +1217,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS) if (create_info->options & HA_LEX_CREATE_IF_NOT_EXISTS)
{ {
create_info->table_existed= 1; // Mark that table existed create_info->table_existed= 1; // Mark that table existed
error= 0; error= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
@ -1246,7 +1246,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
if (create_if_not_exists) if (create_if_not_exists)
{ {
create_info->table_existed= 1; // Mark that table existed create_info->table_existed= 1; // Mark that table existed
error= 0; error= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),table_name);
@ -1285,7 +1285,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_LEX_CREATE_TMP_TABLE)); HA_LEX_CREATE_TMP_TABLE));
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
error=0; error= FALSE;
end: end:
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
start_waiting_global_read_lock(thd); start_waiting_global_read_lock(thd);
@ -1547,7 +1547,7 @@ static int send_check_errmsg(THD *thd, TABLE_LIST* table,
protocol->store((char*) operator_name, system_charset_info); protocol->store((char*) operator_name, system_charset_info);
protocol->store("error", 5, system_charset_info); protocol->store("error", 5, system_charset_info);
protocol->store(errmsg, system_charset_info); protocol->store(errmsg, system_charset_info);
thd->net.last_error[0]=0; thd->clear_error();
if (protocol->write()) if (protocol->write())
return -1; return -1;
return 1; return 1;
@ -1722,16 +1722,16 @@ end:
} }
static int mysql_admin_table(THD* thd, TABLE_LIST* tables, static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt, HA_CHECK_OPT* check_opt,
const char *operator_name, const char *operator_name,
thr_lock_type lock_type, thr_lock_type lock_type,
bool open_for_modify, bool open_for_modify,
uint extra_open_options, uint extra_open_options,
int (*prepare_func)(THD *, TABLE_LIST *, int (*prepare_func)(THD *, TABLE_LIST *,
HA_CHECK_OPT *), HA_CHECK_OPT *),
int (handler::*operator_func) int (handler::*operator_func)
(THD *, HA_CHECK_OPT *)) (THD *, HA_CHECK_OPT *))
{ {
TABLE_LIST *table; TABLE_LIST *table;
List<Item> field_list; List<Item> field_list;
@ -1749,7 +1749,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
item->maybe_null = 1; item->maybe_null = 1;
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
mysql_ha_close(thd, tables, /*dont_send_ok*/ 1, /*dont_lock*/ 1); mysql_ha_close(thd, tables, /*dont_send_ok*/ 1, /*dont_lock*/ 1);
for (table= tables; table; table= table->next_local) for (table= tables; table; table= table->next_local)
@ -1761,9 +1761,6 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
thd->open_options|= extra_open_options; thd->open_options|= extra_open_options;
table->table = open_ltable(thd, table, lock_type); table->table = open_ltable(thd, table, lock_type);
#ifdef EMBEDDED_LIBRARY
thd->net.last_errno= 0; // these errors shouldn't get client
#endif
thd->open_options&= ~extra_open_options; thd->open_options&= ~extra_open_options;
if (prepare_func) if (prepare_func)
@ -1785,7 +1782,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (!(err_msg=thd->net.last_error)) if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE); err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
protocol->store(err_msg, system_charset_info); protocol->store(err_msg, system_charset_info);
thd->net.last_error[0]=0; thd->clear_error();
if (protocol->write()) if (protocol->write())
goto err; goto err;
continue; continue;
@ -1829,9 +1826,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
} }
int result_code = (table->table->file->*operator_func)(thd, check_opt); int result_code = (table->table->file->*operator_func)(thd, check_opt);
#ifdef EMBEDDED_LIBRARY thd->clear_error(); // these errors shouldn't get client
thd->net.last_errno= 0; // these errors shouldn't get client
#endif
protocol->prepare_for_resend(); protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info); protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info); protocol->store(operator_name, system_charset_info);
@ -1932,16 +1927,16 @@ send_result_message:
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
close_thread_tables(thd); // Shouldn't be needed close_thread_tables(thd); // Shouldn't be needed
if (table) if (table)
table->table=0; table->table=0;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
int mysql_backup_table(THD* thd, TABLE_LIST* table_list) bool mysql_backup_table(THD* thd, TABLE_LIST* table_list)
{ {
DBUG_ENTER("mysql_backup_table"); DBUG_ENTER("mysql_backup_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0, DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
@ -1950,7 +1945,7 @@ int mysql_backup_table(THD* thd, TABLE_LIST* table_list)
} }
int mysql_restore_table(THD* thd, TABLE_LIST* table_list) bool mysql_restore_table(THD* thd, TABLE_LIST* table_list)
{ {
DBUG_ENTER("mysql_restore_table"); DBUG_ENTER("mysql_restore_table");
DBUG_RETURN(mysql_admin_table(thd, table_list, 0, DBUG_RETURN(mysql_admin_table(thd, table_list, 0,
@ -1960,7 +1955,7 @@ int mysql_restore_table(THD* thd, TABLE_LIST* table_list)
} }
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) bool mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_repair_table"); DBUG_ENTER("mysql_repair_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
@ -1970,7 +1965,7 @@ int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
} }
int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) bool mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
DBUG_ENTER("mysql_optimize_table"); DBUG_ENTER("mysql_optimize_table");
DBUG_RETURN(mysql_admin_table(thd, tables, check_opt, DBUG_RETURN(mysql_admin_table(thd, tables, check_opt,
@ -1988,11 +1983,11 @@ int mysql_optimize_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
tables Table list (one table only) tables Table list (one table only)
RETURN VALUES RETURN VALUES
0 ok FALSE ok
-1 error TRUE error
*/ */
int mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables, bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
LEX_STRING *key_cache_name) LEX_STRING *key_cache_name)
{ {
HA_CHECK_OPT check_opt; HA_CHECK_OPT check_opt;
@ -2005,7 +2000,7 @@ int mysql_assign_to_keycache(THD* thd, TABLE_LIST* tables,
{ {
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str); my_error(ER_UNKNOWN_KEY_CACHE, MYF(0), key_cache_name->str);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
pthread_mutex_unlock(&LOCK_global_system_variables); pthread_mutex_unlock(&LOCK_global_system_variables);
check_opt.key_cache= key_cache; check_opt.key_cache= key_cache;
@ -2063,11 +2058,11 @@ int reassign_keycache_tables(THD *thd, KEY_CACHE *src_cache,
tables Table list (one table only) tables Table list (one table only)
RETURN VALUES RETURN VALUES
0 ok FALSE ok
-1 error TRUE error
*/ */
int mysql_preload_keys(THD* thd, TABLE_LIST* tables) bool mysql_preload_keys(THD* thd, TABLE_LIST* tables)
{ {
DBUG_ENTER("mysql_preload_keys"); DBUG_ENTER("mysql_preload_keys");
DBUG_RETURN(mysql_admin_table(thd, tables, 0, DBUG_RETURN(mysql_admin_table(thd, tables, 0,
@ -2087,13 +2082,13 @@ int mysql_preload_keys(THD* thd, TABLE_LIST* tables)
table_ident Src table_ident table_ident Src table_ident
RETURN VALUES RETURN VALUES
0 ok FALSE OK
-1 error TRUE error
*/ */
int mysql_create_like_table(THD* thd, TABLE_LIST* table, bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
Table_ident *table_ident) Table_ident *table_ident)
{ {
TABLE **tmp_table; TABLE **tmp_table;
char src_path[FN_REFLEN], dst_path[FN_REFLEN]; char src_path[FN_REFLEN], dst_path[FN_REFLEN];
@ -2101,7 +2096,8 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
char *table_name= table->real_name; char *table_name= table->real_name;
char *src_db= thd->db; char *src_db= thd->db;
char *src_table= table_ident->table.str; char *src_table= table_ident->table.str;
int err, res= -1; int err;
bool res= TRUE;
TABLE_LIST src_tables_list; TABLE_LIST src_tables_list;
DBUG_ENTER("mysql_create_like_table"); DBUG_ENTER("mysql_create_like_table");
@ -2114,7 +2110,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
table_ident->db.str && check_db_name((src_db= table_ident->db.str))) table_ident->db.str && check_db_name((src_db= table_ident->db.str)))
{ {
my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table); my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
bzero((gptr)&src_tables_list, sizeof(src_tables_list)); bzero((gptr)&src_tables_list, sizeof(src_tables_list));
@ -2201,7 +2197,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_LEX_CREATE_TMP_TABLE)); HA_LEX_CREATE_TMP_TABLE));
mysql_bin_log.write(&qinfo); mysql_bin_log.write(&qinfo);
} }
res= 0; res= FALSE;
goto err; goto err;
table_exists: table_exists:
@ -2212,7 +2208,7 @@ table_exists:
ER(ER_TABLE_EXISTS_ERROR), table_name); ER(ER_TABLE_EXISTS_ERROR), table_name);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR,warn_buff); ER_TABLE_EXISTS_ERROR,warn_buff);
res= 0; res= FALSE;
} }
else else
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name); my_error(ER_TABLE_EXISTS_ERROR, MYF(0), table_name);
@ -2225,7 +2221,7 @@ err:
} }
int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt) bool mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
{ {
#ifdef OS2 #ifdef OS2
thr_lock_type lock_type = TL_WRITE; thr_lock_type lock_type = TL_WRITE;
@ -2240,7 +2236,7 @@ int mysql_analyze_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
} }
int mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt) bool mysql_check_table(THD* thd, TABLE_LIST* tables,HA_CHECK_OPT* check_opt)
{ {
#ifdef OS2 #ifdef OS2
thr_lock_type lock_type = TL_WRITE; thr_lock_type lock_type = TL_WRITE;
@ -2528,13 +2524,13 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
Alter table Alter table
*/ */
int mysql_alter_table(THD *thd,char *new_db, char *new_name, bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_CREATE_INFO *create_info, HA_CREATE_INFO *create_info,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<create_field> &fields, List<Key> &keys, List<create_field> &fields, List<Key> &keys,
uint order_num, ORDER *order, uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok) ALTER_INFO *alter_info, bool do_send_ok)
{ {
TABLE *table,*new_table; TABLE *table,*new_table;
int error; int error;
@ -2563,7 +2559,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list, DBUG_RETURN(mysql_discard_or_import_tablespace(thd,table_list,
alter_info->tablespace_op)); alter_info->tablespace_op));
if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ))) if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ)))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
/* Check that we are not trying to rename to an existing table */ /* Check that we are not trying to rename to an existing table */
if (new_name) if (new_name)
@ -2595,7 +2591,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (find_temporary_table(thd,new_db,new_name_buff)) if (find_temporary_table(thd,new_db,new_name_buff))
{ {
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff); my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
else else
@ -2605,7 +2601,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
/* Table will be closed in do_command() */ /* Table will be closed in do_command() */
my_error(ER_TABLE_EXISTS_ERROR,MYF(0), new_alias); my_error(ER_TABLE_EXISTS_ERROR,MYF(0), new_alias);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
@ -2788,7 +2784,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (def->sql_type == FIELD_TYPE_BLOB) if (def->sql_type == FIELD_TYPE_BLOB)
{ {
my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change); my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
def->def=alter->def; // Use new default def->def=alter->def; // Use new default
alter_it.remove(); alter_it.remove();
@ -2802,7 +2798,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (def->change && ! def->field) if (def->change && ! def->field)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->change,table_name); my_error(ER_BAD_FIELD_ERROR,MYF(0),def->change,table_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!def->after) if (!def->after)
create_list.push_back(def); create_list.push_back(def);
@ -2820,7 +2816,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!find) if (!find)
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->after,table_name); my_error(ER_BAD_FIELD_ERROR,MYF(0),def->after,table_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
find_it.after(def); // Put element after this find_it.after(def); // Put element after this
} }
@ -2829,12 +2825,12 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{ {
my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name, my_error(ER_BAD_FIELD_ERROR,MYF(0),alter_info->alter_list.head()->name,
table_name); table_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!create_list.elements) if (!create_list.elements)
{ {
my_error(ER_CANT_REMOVE_ALL_FIELDS,MYF(0)); my_error(ER_CANT_REMOVE_ALL_FIELDS,MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
@ -2923,7 +2919,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
!my_strcasecmp(system_charset_info,key->name,primary_key_name)) !my_strcasecmp(system_charset_info,key->name,primary_key_name))
{ {
my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name); my_error(ER_WRONG_NAME_FOR_INDEX, MYF(0), key->name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
@ -3261,10 +3257,10 @@ end_temporary:
if (do_send_ok) if (do_send_ok)
send_ok(thd,copied+deleted,0L,tmp_name); send_ok(thd,copied+deleted,0L,tmp_name);
thd->some_tables_deleted=0; thd->some_tables_deleted=0;
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
@ -3433,8 +3429,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
RETURN RETURN
Like mysql_alter_table(). Like mysql_alter_table().
*/ */
int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
bool do_send_ok) bool do_send_ok)
{ {
DBUG_ENTER("mysql_recreate_table"); DBUG_ENTER("mysql_recreate_table");
LEX *lex= thd->lex; LEX *lex= thd->lex;
@ -3455,7 +3451,7 @@ int mysql_recreate_table(THD *thd, TABLE_LIST *table_list,
} }
int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt) bool mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
{ {
TABLE_LIST *table; TABLE_LIST *table;
List<Item> field_list; List<Item> field_list;
@ -3469,7 +3465,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
item->maybe_null= 1; item->maybe_null= 1;
if (protocol->send_fields(&field_list, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
for (table= tables; table; table= table->next_local) for (table= tables; table; table= table->next_local)
{ {
@ -3488,7 +3484,7 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
{ {
/* Table didn't exist */ /* Table didn't exist */
protocol->store_null(); protocol->store_null();
thd->net.last_error[0]=0; thd->clear_error();
} }
else else
{ {
@ -3550,11 +3546,11 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
} }
send_eof(thd); send_eof(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
close_thread_tables(thd); // Shouldn't be needed close_thread_tables(thd); // Shouldn't be needed
if (table) if (table)
table->table=0; table->table=0;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }

View file

@ -38,12 +38,13 @@ static File_option triggers_file_parameters[]=
methods. methods.
RETURN VALUE RETURN VALUE
0 - Success, non-0 in case of error. FALSE Success
TRUE error
*/ */
int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
{ {
TABLE *table; TABLE *table;
int result= 0; bool result= 0;
DBUG_ENTER("mysql_create_or_drop_trigger"); DBUG_ENTER("mysql_create_or_drop_trigger");
@ -53,7 +54,7 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
*/ */
if (open_and_lock_tables(thd, tables)) if (open_and_lock_tables(thd, tables))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
/* /*
TODO: We should check if user has TRIGGER privilege for table here. TODO: We should check if user has TRIGGER privilege for table here.
@ -61,7 +62,7 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
we don't have proper privilege checking for triggers in place yet. we don't have proper privilege checking for triggers in place yet.
*/ */
if (check_global_access(thd, SUPER_ACL)) if (check_global_access(thd, SUPER_ACL))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
table= tables->table; table= tables->table;
@ -74,7 +75,7 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (tables->view || table->tmp_table != NO_TMP_TABLE) if (tables->view || table->tmp_table != NO_TMP_TABLE)
{ {
my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias); my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!table->triggers) if (!table->triggers)
@ -82,11 +83,11 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (!create) if (!create)
{ {
my_error(ER_TRG_DOES_NOT_EXIST, MYF(0)); my_error(ER_TRG_DOES_NOT_EXIST, MYF(0));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!(table->triggers= new (&table->mem_root) Table_triggers_list())) if (!(table->triggers= new (&table->mem_root) Table_triggers_list()))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
@ -96,12 +97,12 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
global read lock is held without helding LOCK_open). global read lock is held without helding LOCK_open).
*/ */
if (wait_if_global_read_lock(thd, 0, 0)) if (wait_if_global_read_lock(thd, 0, 0))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
if ((create ? table->triggers->create_trigger(thd, tables): result= (create ?
table->triggers->drop_trigger(thd, tables))) table->triggers->create_trigger(thd, tables):
result= -1; table->triggers->drop_trigger(thd, tables));
/* It is sensible to invalidate table in any case */ /* It is sensible to invalidate table in any case */
close_cached_table(thd, table); close_cached_table(thd, table);

View file

@ -369,7 +369,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (!initialized) if (!initialized)
{ {
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES)); my_error(ER_OUT_OF_RESOURCES, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
@ -380,19 +380,19 @@ int mysql_create_function(THD *thd,udf_func *udf)
*/ */
if (strchr(udf->dl, '/')) if (strchr(udf->dl, '/'))
{ {
send_error(thd, ER_UDF_NO_PATHS,ER(ER_UDF_NO_PATHS)); my_error(ER_UDF_NO_PATHS, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
if (udf->name.length > NAME_LEN) if (udf->name.length > NAME_LEN)
{ {
net_printf(thd, ER_TOO_LONG_IDENT,udf->name); my_error(ER_TOO_LONG_IDENT, MYF(0), udf->name);
DBUG_RETURN(1); DBUG_RETURN(1);
} }
rw_wrlock(&THR_LOCK_udf); rw_wrlock(&THR_LOCK_udf);
if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length))) if ((hash_search(&udf_hash,(byte*) udf->name.str, udf->name.length)))
{ {
net_printf(thd, ER_UDF_EXISTS, udf->name); my_error(ER_UDF_EXISTS, MYF(0), udf->name);
goto err; goto err;
} }
if (!(dl = find_udf_dl(udf->dl))) if (!(dl = find_udf_dl(udf->dl)))
@ -401,7 +401,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
{ {
DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)", DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
udf->dl,errno,dlerror())); udf->dl,errno,dlerror()));
net_printf(thd, ER_CANT_OPEN_LIBRARY, udf->dl, errno, dlerror()); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), udf->dl, errno, dlerror());
goto err; goto err;
} }
new_dl=1; new_dl=1;
@ -411,16 +411,13 @@ int mysql_create_function(THD *thd,udf_func *udf)
if (udf->func == NULL) if (udf->func == NULL)
{ {
net_printf(thd, ER_CANT_FIND_DL_ENTRY, udf->name); my_error(ER_CANT_FIND_DL_ENTRY, MYF(0), udf->name);
goto err; goto err;
} }
udf->name.str=strdup_root(&mem,udf->name.str); udf->name.str=strdup_root(&mem,udf->name.str);
udf->dl=strdup_root(&mem,udf->dl); udf->dl=strdup_root(&mem,udf->dl);
if (!(u_d=add_udf(&udf->name,udf->returns,udf->dl,udf->type))) if (!(u_d=add_udf(&udf->name,udf->returns,udf->dl,udf->type)))
{
send_error(thd,0); // End of memory
goto err; goto err;
}
u_d->dlhandle = dl; u_d->dlhandle = dl;
u_d->func=udf->func; u_d->func=udf->func;
u_d->func_init=udf->func_init; u_d->func_init=udf->func_init;
@ -448,7 +445,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
close_thread_tables(thd); close_thread_tables(thd);
if (error) if (error)
{ {
net_printf(thd, ER_ERROR_ON_WRITE, "func@mysql",error); my_error(ER_ERROR_ON_WRITE, MYF(0), "func@mysql", error);
del_udf(u_d); del_udf(u_d);
goto err; goto err;
} }
@ -471,14 +468,14 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_ENTER("mysql_drop_function"); DBUG_ENTER("mysql_drop_function");
if (!initialized) if (!initialized)
{ {
send_error(thd, ER_OUT_OF_RESOURCES, ER(ER_OUT_OF_RESOURCES)); my_error(ER_OUT_OF_RESOURCES, MYF(0));
DBUG_RETURN(1); DBUG_RETURN(1);
} }
rw_wrlock(&THR_LOCK_udf); rw_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str, if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
(uint) udf_name->length))) (uint) udf_name->length)))
{ {
net_printf(thd, ER_FUNCTION_NOT_DEFINED, udf_name->str); my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
goto err; goto err;
} }
del_udf(udf); del_udf(udf);

View file

@ -24,21 +24,20 @@
#include "mysql_priv.h" #include "mysql_priv.h"
#include "sql_select.h" #include "sql_select.h"
int mysql_union(THD *thd, LEX *lex, select_result *result, bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit) SELECT_LEX_UNIT *unit)
{ {
DBUG_ENTER("mysql_union"); DBUG_ENTER("mysql_union");
int res, res_cln; bool res;
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK))) if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK)))
res= unit->exec(); res= unit->exec();
if (res == 0 && thd->cursor && thd->cursor->is_open()) if (!res && thd->cursor && thd->cursor->is_open())
{ {
thd->cursor->set_unit(unit); thd->cursor->set_unit(unit);
res_cln= 0;
} }
else else
res_cln= unit->cleanup(); res|= unit->cleanup();
DBUG_RETURN(res?res:res_cln); DBUG_RETURN(res);
} }
@ -104,8 +103,7 @@ bool select_union::flush()
int error; int error;
if ((error=table->file->extra(HA_EXTRA_NO_CACHE))) if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{ {
table->file->print_error(error,MYF(0)); table->file->print_error(error, MYF(0));
::send_error(thd);
return 1; return 1;
} }
return 0; return 0;
@ -147,8 +145,8 @@ st_select_lex_unit::init_prepare_fake_select_lex(THD *thd)
} }
int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result, bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
ulong additional_options) ulong additional_options)
{ {
SELECT_LEX *lex_select_save= thd_arg->lex->current_select; SELECT_LEX *lex_select_save= thd_arg->lex->current_select;
SELECT_LEX *sl, *first_select; SELECT_LEX *sl, *first_select;
@ -176,16 +174,16 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
if (!sl->join->procedure && if (!sl->join->procedure &&
result->prepare(sl->join->fields_list, this)) result->prepare(sl->join->fields_list, this))
{ {
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
sl->join->select_options|= SELECT_DESCRIBE; sl->join->select_options|= SELECT_DESCRIBE;
sl->join->reinit(); sl->join->reinit();
} }
} }
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
prepared= 1; prepared= 1;
res= 0; res= FALSE;
thd_arg->lex->current_select= sl= first_select= first_select_in_union(); thd_arg->lex->current_select= sl= first_select= first_select_in_union();
found_rows_for_union= first_select->options & OPTION_FOUND_ROWS; found_rows_for_union= first_select->options & OPTION_FOUND_ROWS;
@ -232,7 +230,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
sl->having, sl->having,
(ORDER*) NULL, (ORDER*) NULL,
sl, this); sl, this);
if (res || thd_arg->is_fatal_error) if ((res= (res || thd_arg->is_fatal_error)))
goto err; goto err;
if (sl == first_select) if (sl == first_select)
{ {
@ -262,7 +260,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
while ((type= tp++, item_tmp= it++)) while ((type= tp++, item_tmp= it++))
{ {
if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp)) if (((Item_type_holder*)type)->join_types(thd_arg, item_tmp))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
@ -305,7 +303,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
{ {
if (arena) if (arena)
thd->restore_backup_item_arena(arena, &backup); thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
if (arena) if (arena)
@ -323,7 +321,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
result))) result)))
{ {
fake_select_lex->table_list.empty(); fake_select_lex->table_list.empty();
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
fake_select_lex->item_list= item_list; fake_select_lex->item_list= item_list;
@ -345,15 +343,15 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
thd_arg->lex->current_select= lex_select_save; thd_arg->lex->current_select= lex_select_save;
DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0); DBUG_RETURN(res || thd_arg->is_fatal_error);
err: err:
thd_arg->lex->current_select= lex_select_save; thd_arg->lex->current_select= lex_select_save;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
int st_select_lex_unit::exec() bool st_select_lex_unit::exec()
{ {
SELECT_LEX *lex_select_save= thd->lex->current_select; SELECT_LEX *lex_select_save= thd->lex->current_select;
SELECT_LEX *select_cursor=first_select_in_union(); SELECT_LEX *select_cursor=first_select_in_union();
@ -361,7 +359,7 @@ int st_select_lex_unit::exec()
DBUG_ENTER("st_select_lex_unit::exec"); DBUG_ENTER("st_select_lex_unit::exec");
if (executed && !uncacheable && !describe) if (executed && !uncacheable && !describe)
DBUG_RETURN(0); DBUG_RETURN(FALSE);
executed= 1; executed= 1;
if (uncacheable || !item || !item->assigned() || describe) if (uncacheable || !item || !item->assigned() || describe)
@ -376,7 +374,7 @@ int st_select_lex_unit::exec()
} }
/* re-enabling indexes for next subselect iteration */ /* re-enabling indexes for next subselect iteration */
if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL)) if (union_distinct && table->file->enable_indexes(HA_KEY_SWITCH_ALL))
DBUG_ASSERT(1); DBUG_ASSERT(TRUE);
} }
for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select()) for (SELECT_LEX *sl= select_cursor; sl; sl= sl->next_select())
{ {
@ -431,7 +429,7 @@ int st_select_lex_unit::exec()
if (sl == union_distinct) if (sl == union_distinct)
{ {
if (table->file->disable_indexes(HA_KEY_SWITCH_ALL)) if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
table->no_keyread=1; table->no_keyread=1;
} }
res= sl->join->error; res= sl->join->error;
@ -439,7 +437,7 @@ int st_select_lex_unit::exec()
if (!res && union_result->flush()) if (!res && union_result->flush())
{ {
thd->lex->current_select= lex_select_save; thd->lex->current_select= lex_select_save;
DBUG_RETURN(1); DBUG_RETURN(TRUE);
} }
} }
if (res) if (res)
@ -465,7 +463,7 @@ int st_select_lex_unit::exec()
optimized= 1; optimized= 1;
/* Send result to 'result' */ /* Send result to 'result' */
res= -1; res= TRUE;
{ {
List<Item_func_match> empty_list; List<Item_func_match> empty_list;
empty_list.empty(); empty_list.empty();
@ -484,7 +482,7 @@ int st_select_lex_unit::exec()
fake_select_lex->options, result))) fake_select_lex->options, result)))
{ {
fake_select_lex->table_list.empty(); fake_select_lex->table_list.empty();
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
@ -528,7 +526,7 @@ int st_select_lex_unit::exec()
} }
int st_select_lex_unit::cleanup() bool st_select_lex_unit::cleanup()
{ {
int error= 0; int error= 0;
JOIN *join; JOIN *join;
@ -536,7 +534,7 @@ int st_select_lex_unit::cleanup()
if (cleaned) if (cleaned)
{ {
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
cleaned= 1; cleaned= 1;
@ -610,19 +608,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
old_result old select_result object old_result old select_result object
RETURN RETURN
0 - OK FALSE - OK
-1 - error TRUE - error
*/ */
int st_select_lex_unit::change_result(select_subselect *result, bool st_select_lex_unit::change_result(select_subselect *result,
select_subselect *old_result) select_subselect *old_result)
{ {
int res= 0; bool res= FALSE;
for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select()) for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
{ {
if (sl->join && sl->join->result == old_result) if (sl->join && sl->join->result == old_result)
if ((res= sl->join->change_result(result))) if (sl->join->change_result(result))
return (res); return TRUE;
} }
if (fake_select_lex && fake_select_lex->join) if (fake_select_lex && fake_select_lex->join)
res= fake_select_lex->join->change_result(result); res= fake_select_lex->join->change_result(result);

View file

@ -87,21 +87,21 @@ static bool check_fields(THD *thd, List<Item> &items)
} }
int mysql_update(THD *thd, bool mysql_update(THD *thd,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<Item> &fields, List<Item> &fields,
List<Item> &values, List<Item> &values,
COND *conds, COND *conds,
uint order_num, ORDER *order, uint order_num, ORDER *order,
ha_rows limit, ha_rows limit,
enum enum_duplicates handle_duplicates) enum enum_duplicates handle_duplicates)
{ {
bool using_limit= limit != HA_POS_ERROR; bool using_limit= limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES; bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed; bool used_key_is_modified, transactional_table, log_delayed;
bool ignore_err= (thd->lex->duplicates == DUP_IGNORE); bool ignore_err= (thd->lex->duplicates == DUP_IGNORE);
bool res;
int error=0; int error=0;
int res;
uint used_index; uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS #ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege; uint want_privilege;
@ -117,8 +117,8 @@ int mysql_update(THD *thd,
LINT_INIT(used_index); LINT_INIT(used_index);
LINT_INIT(timestamp_query_id); LINT_INIT(timestamp_query_id);
if ((error= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(error); DBUG_RETURN(TRUE);
thd->proc_info="init"; thd->proc_info="init";
table= table_list->table; table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK); table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
@ -156,16 +156,16 @@ int mysql_update(THD *thd,
res= setup_fields(thd, 0, table_list, fields, 1, 0, 0); res= setup_fields(thd, 0, table_list, fields, 1, 0, 0);
thd->lex->select_lex.no_wrap_view_item= 0; thd->lex->select_lex.no_wrap_view_item= 0;
if (res) if (res)
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }
if (table_list->view && check_fields(thd, fields)) if (table_list->view && check_fields(thd, fields))
{ {
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (!table_list->updatable || check_key_in_view(thd, table_list)) if (!table_list->updatable || check_key_in_view(thd, table_list))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE"); my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
if (table->timestamp_field) if (table->timestamp_field)
{ {
@ -184,7 +184,7 @@ int mysql_update(THD *thd,
if (setup_fields(thd, 0, table_list, values, 0, 0, 0)) if (setup_fields(thd, 0, table_list, values, 0, 0, 0))
{ {
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
DBUG_RETURN(-1); /* purecov: inspected */ DBUG_RETURN(TRUE); /* purecov: inspected */
} }
// Don't count on usage of 'only index' when calculating which key to use // Don't count on usage of 'only index' when calculating which key to use
@ -197,10 +197,10 @@ int mysql_update(THD *thd,
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error) if (error)
{ {
DBUG_RETURN(-1); // Error in where DBUG_RETURN(TRUE); // Error in where
} }
send_ok(thd); // No matching records send_ok(thd); // No matching records
DBUG_RETURN(0); DBUG_RETURN(FALSE);
} }
/* If running in safe sql mode, don't allow updates without keys */ /* If running in safe sql mode, don't allow updates without keys */
if (table->quick_keys.is_clear_all()) if (table->quick_keys.is_clear_all())
@ -363,7 +363,15 @@ int mysql_update(THD *thd,
{ {
store_record(table,record[1]); store_record(table,record[1]);
if (fill_record(fields,values, 0) || thd->net.report_error) if (fill_record(fields,values, 0) || thd->net.report_error)
{
/* Field::store methods can't send errors */
if (!thd->net.report_error)
{
/* TODO: convert last warning to error */
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
break; /* purecov: inspected */ break; /* purecov: inspected */
}
found++; found++;
if (table->triggers) if (table->triggers)
@ -456,9 +464,7 @@ int mysql_update(THD *thd,
} }
free_underlaid_joins(thd, &thd->lex->select_lex); free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0) if (error < 0)
send_error(thd,thd->killed_errno()); /* purecov: inspected */
else
{ {
char buff[80]; char buff[80];
sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated, sprintf(buff, ER(ER_UPDATE_INFO), (ulong) found, (ulong) updated,
@ -472,7 +478,7 @@ int mysql_update(THD *thd,
thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */ thd->count_cuted_fields= CHECK_FIELD_IGNORE; /* calc cuted fields */
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
free_io_cache(table); free_io_cache(table);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
delete select; delete select;
@ -483,7 +489,7 @@ err:
table->file->extra(HA_EXTRA_NO_KEYREAD); table->file->extra(HA_EXTRA_NO_KEYREAD);
} }
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
@ -555,11 +561,11 @@ int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
thd thread handler thd thread handler
RETURN RETURN
0 OK FALSE OK
-1 Error TRUE Error
*/ */
int mysql_multi_update_prepare(THD *thd) bool mysql_multi_update_prepare(THD *thd)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
TABLE_LIST *table_list= lex->query_tables; TABLE_LIST *table_list= lex->query_tables;
@ -597,7 +603,7 @@ int mysql_multi_update_prepare(THD *thd)
res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0), res= setup_fields(thd, 0, table_list, *fields, 1, 0, 0),
thd->lex->select_lex.no_wrap_view_item= 0, thd->lex->select_lex.no_wrap_view_item= 0,
res)) res))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
for (tl= table_list; tl ; tl= tl->next_local) for (tl= table_list; tl ; tl= tl->next_local)
{ {
@ -610,7 +616,7 @@ int mysql_multi_update_prepare(THD *thd)
if (update_view && check_fields(thd, *fields)) if (update_view && check_fields(thd, *fields))
{ {
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
{ {
@ -650,36 +656,36 @@ int mysql_multi_update_prepare(THD *thd)
(tables_for_update & tl->table->map)) (tables_for_update & tl->table->map))
{ {
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE"); my_error(ER_NON_UPDATABLE_TABLE, MYF(0), tl->alias, "UPDATE");
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
DBUG_RETURN (0); DBUG_RETURN(FALSE);
} }
int mysql_multi_update(THD *thd, bool mysql_multi_update(THD *thd,
TABLE_LIST *table_list, TABLE_LIST *table_list,
List<Item> *fields, List<Item> *fields,
List<Item> *values, List<Item> *values,
COND *conds, COND *conds,
ulong options, ulong options,
enum enum_duplicates handle_duplicates, enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex) SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
{ {
int res; bool res;
multi_update *result; multi_update *result;
DBUG_ENTER("mysql_multi_update"); DBUG_ENTER("mysql_multi_update");
if ((res= open_and_lock_tables(thd, table_list))) if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
if ((res= mysql_multi_update_prepare(thd))) if ((res= mysql_multi_update_prepare(thd)))
DBUG_RETURN(res); DBUG_RETURN(res);
if (!(result= new multi_update(thd, table_list, fields, values, if (!(result= new multi_update(thd, table_list, fields, values,
handle_duplicates))) handle_duplicates)))
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
thd->no_trans_update= 0; thd->no_trans_update= 0;
thd->abort_on_warning= test(thd->variables.sql_mode & thd->abort_on_warning= test(thd->variables.sql_mode &
@ -696,7 +702,7 @@ int mysql_multi_update(THD *thd,
result, unit, select_lex); result, unit, select_lex);
delete result; delete result;
thd->abort_on_warning= 0; thd->abort_on_warning= 0;
DBUG_RETURN(res); DBUG_RETURN(TRUE);
} }
@ -1023,7 +1029,15 @@ bool multi_update::send_data(List<Item> &not_used_values)
table->status|= STATUS_UPDATED; table->status|= STATUS_UPDATED;
store_record(table,record[1]); store_record(table,record[1]);
if (fill_record(*fields_for_table[offset], *values_for_table[offset], 0)) if (fill_record(*fields_for_table[offset], *values_for_table[offset], 0))
{
/* Field::store methods can't send errors */
if (!thd->net.report_error)
{
/* TODO: convert last warning to error */
my_error(ER_UNKNOWN_ERROR, MYF(0));
}
DBUG_RETURN(1); DBUG_RETURN(1);
}
found++; found++;
if (compare_record(table, thd->query_id)) if (compare_record(table, thd->query_id))
{ {
@ -1087,7 +1101,7 @@ bool multi_update::send_data(List<Item> &not_used_values)
void multi_update::send_error(uint errcode,const char *err) void multi_update::send_error(uint errcode,const char *err)
{ {
/* First send error what ever it is ... */ /* First send error what ever it is ... */
::send_error(thd,errcode,err); my_error(errcode, MYF(0), err);
/* If nothing updated return */ /* If nothing updated return */
if (!updated) if (!updated)
@ -1278,7 +1292,6 @@ bool multi_update::send_eof()
/* Safety: If we haven't got an error before (should not happen) */ /* Safety: If we haven't got an error before (should not happen) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update", my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0)); MYF(0));
::send_error(thd);
return 1; return 1;
} }

View file

@ -41,13 +41,12 @@ TYPELIB updatable_views_with_limit_typelib=
mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
RETURN VALUE RETURN VALUE
0 OK FALSE OK
-1 Error TRUE Error
1 Error and error message given
*/ */
int mysql_create_view(THD *thd, bool mysql_create_view(THD *thd,
enum_view_create_mode mode) enum_view_create_mode mode)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
bool link_to_local; bool link_to_local;
@ -57,7 +56,7 @@ int mysql_create_view(THD *thd,
TABLE_LIST *tbl; TABLE_LIST *tbl;
SELECT_LEX *select_lex= &lex->select_lex, *sl; SELECT_LEX *select_lex= &lex->select_lex, *sl;
SELECT_LEX_UNIT *unit= &lex->unit; SELECT_LEX_UNIT *unit= &lex->unit;
int res= 0; bool res= FALSE;
DBUG_ENTER("mysql_create_view"); DBUG_ENTER("mysql_create_view");
if (lex->proc_list.first || if (lex->proc_list.first ||
@ -66,7 +65,7 @@ int mysql_create_view(THD *thd,
my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), (lex->result ? my_error(ER_VIEW_SELECT_CLAUSE, MYF(0), (lex->result ?
"INTO" : "INTO" :
"PROCEDURE")); "PROCEDURE"));
res= -1; res= TRUE;
goto err; goto err;
} }
if (lex->derived_tables || if (lex->derived_tables ||
@ -75,7 +74,7 @@ int mysql_create_view(THD *thd,
my_error((lex->derived_tables ? my_error((lex->derived_tables ?
ER_VIEW_SELECT_DERIVED : ER_VIEW_SELECT_DERIVED :
ER_VIEW_SELECT_VARIABLE), MYF(0)); ER_VIEW_SELECT_VARIABLE), MYF(0));
res= -1; res= TRUE;
goto err; goto err;
} }
@ -101,7 +100,7 @@ int mysql_create_view(THD *thd,
(check_access(thd, DELETE_ACL, view->db, &view->grant.privilege, (check_access(thd, DELETE_ACL, view->db, &view->grant.privilege,
0, 0) || 0, 0) ||
grant_option && check_grant(thd, DELETE_ACL, view, 0, 1, 0)))) grant_option && check_grant(thd, DELETE_ACL, view, 0, 1, 0))))
DBUG_RETURN(1); DBUG_RETURN(TRUE);
for (sl= select_lex; sl; sl= sl->next_select()) for (sl= select_lex; sl; sl= sl->next_select())
{ {
for (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local) for (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local)
@ -119,7 +118,7 @@ int mysql_create_view(THD *thd,
thd->priv_user, thd->priv_user,
thd->host_or_ip, thd->host_or_ip,
tbl->real_name); tbl->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
/* /*
Mark this table as a table which will be checked after the prepare Mark this table as a table which will be checked after the prepare
@ -155,7 +154,7 @@ int mysql_create_view(THD *thd,
&tbl->grant.privilege, 0, 0) || &tbl->grant.privilege, 0, 0) ||
grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0)) grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))
{ {
res= 1; res= TRUE;
goto err; goto err;
} }
} }
@ -177,8 +176,8 @@ int mysql_create_view(THD *thd,
} }
#endif #endif
if ((res= open_and_lock_tables(thd, tables))) if (open_and_lock_tables(thd, tables))
DBUG_RETURN(res); DBUG_RETURN(TRUE);
/* /*
check that tables are not temporary and this VIEW do not used in query check that tables are not temporary and this VIEW do not used in query
@ -190,7 +189,7 @@ int mysql_create_view(THD *thd,
if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view) if (tbl->table->tmp_table != NO_TMP_TABLE && !tbl->view)
{ {
my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias); my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias);
res= -1; res= TRUE;
goto err; goto err;
} }
@ -200,7 +199,7 @@ int mysql_create_view(THD *thd,
strcmp(tbl->view_name.str, view->real_name) == 0) strcmp(tbl->view_name.str, view->real_name) == 0)
{ {
my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str); my_error(ER_NO_SUCH_TABLE, MYF(0), tbl->view_db.str, tbl->view_name.str);
res= -1; res= TRUE;
goto err; goto err;
} }
@ -220,7 +219,7 @@ int mysql_create_view(THD *thd,
some errors from prepare are reported to user, if is not then some errors from prepare are reported to user, if is not then
it will be checked after err: label it will be checked after err: label
*/ */
res= 1; res= TRUE;
goto err; goto err;
} }
@ -255,7 +254,7 @@ int mysql_create_view(THD *thd,
if (strcmp(item->name, check->name) == 0) if (strcmp(item->name, check->name) == 0)
{ {
my_error(ER_DUP_FIELDNAME, MYF(0), item->name); my_error(ER_DUP_FIELDNAME, MYF(0), item->name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
@ -294,7 +293,7 @@ int mysql_create_view(THD *thd,
thd->host_or_ip, thd->host_or_ip,
item->name, item->name,
view->real_name); view->real_name);
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }
} }
} }
@ -303,7 +302,7 @@ int mysql_create_view(THD *thd,
if (wait_if_global_read_lock(thd, 0, 0)) if (wait_if_global_read_lock(thd, 0, 0))
{ {
res= -1; res= TRUE;
goto err; goto err;
} }
VOID(pthread_mutex_lock(&LOCK_open)); VOID(pthread_mutex_lock(&LOCK_open));
@ -321,9 +320,7 @@ err:
thd->proc_info= "end"; thd->proc_info= "end";
lex->link_first_table_back(view, link_to_local); lex->link_first_table_back(view, link_to_local);
unit->cleanup(); unit->cleanup();
if (thd->net.report_error) DBUG_RETURN(res || thd->net.report_error);
res= -1;
DBUG_RETURN(res);
} }
@ -824,12 +821,11 @@ err:
drop_mode - cascade/check drop_mode - cascade/check
RETURN VALUE RETURN VALUE
0 OK FALSE OK
-1 Error TRUE Error
1 Error and error message given
*/ */
int mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode) bool mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
{ {
DBUG_ENTER("mysql_drop_view"); DBUG_ENTER("mysql_drop_view");
char path[FN_REFLEN]; char path[FN_REFLEN];
@ -865,11 +861,11 @@ int mysql_drop_view(THD *thd, TABLE_LIST *views, enum_drop_mode drop_mode)
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
} }
send_ok(thd); send_ok(thd);
DBUG_RETURN(0); DBUG_RETURN(FALSE);
err: err:
VOID(pthread_mutex_unlock(&LOCK_open)); VOID(pthread_mutex_unlock(&LOCK_open));
DBUG_RETURN(-1); DBUG_RETURN(TRUE);
} }

View file

@ -16,12 +16,12 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
int mysql_create_view(THD *thd, bool mysql_create_view(THD *thd,
enum_view_create_mode mode); enum_view_create_mode mode);
my_bool mysql_make_view(File_parser *parser, TABLE_LIST *table); my_bool mysql_make_view(File_parser *parser, TABLE_LIST *table);
int mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode); bool mysql_drop_view(THD *thd, TABLE_LIST *view, enum_drop_mode drop_mode);
bool check_key_in_view(THD *thd, TABLE_LIST * view); bool check_key_in_view(THD *thd, TABLE_LIST * view);

View file

@ -813,7 +813,7 @@ query:
if (!thd->bootstrap && if (!thd->bootstrap &&
(!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT))) (!(thd->lex->select_lex.options & OPTION_FOUND_COMMENT)))
{ {
send_error(thd,ER_EMPTY_QUERY); my_error(ER_EMPTY_QUERY, MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1149,7 +1149,7 @@ create:
if (lex->sphead) if (lex->sphead)
{ {
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "PROCEDURE"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "PROCEDURE");
YYABORT; YYABORT;
} }
/* Order is important here: new - reset - init */ /* Order is important here: new - reset - init */
@ -1222,7 +1222,7 @@ create:
if (lex->sphead) if (lex->sphead)
{ {
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "TRIGGER"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "TRIGGER");
YYABORT; YYABORT;
} }
@ -1303,7 +1303,7 @@ create_function_tail:
if (lex->sphead) if (lex->sphead)
{ {
net_printf(YYTHD, ER_SP_NO_RECURSIVE_CREATE, "FUNCTION"); my_error(ER_SP_NO_RECURSIVE_CREATE, MYF(0), "FUNCTION");
YYABORT; YYABORT;
} }
/* Order is important here: new - reset - init */ /* Order is important here: new - reset - init */
@ -1469,7 +1469,7 @@ sp_fdparam:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_PARAM, $1.str); my_error(ER_SP_DUP_PARAM, MYF(0), $1.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$1, (enum enum_field_types)$2, sp_param_in); spc->push_pvar(&$1, (enum enum_field_types)$2, sp_param_in);
@ -1495,7 +1495,7 @@ sp_pdparam:
if (spc->find_pvar(&$2, TRUE)) if (spc->find_pvar(&$2, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_PARAM, $2.str); my_error(ER_SP_DUP_PARAM, MYF(0), $2.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$2, (enum enum_field_types)$3, spc->push_pvar(&$2, (enum enum_field_types)$3,
@ -1529,12 +1529,12 @@ sp_decls:
better error handling this way.) */ better error handling this way.) */
if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs)) if (($2.vars || $2.conds) && ($1.curs || $1.hndlrs))
{ /* Variable or condition following cursor or handler */ { /* Variable or condition following cursor or handler */
send_error(YYTHD, ER_SP_VARCOND_AFTER_CURSHNDLR); my_error(ER_SP_VARCOND_AFTER_CURSHNDLR, MYF(0));
YYABORT; YYABORT;
} }
if ($2.curs && $1.hndlrs) if ($2.curs && $1.hndlrs)
{ /* Cursor following handler */ { /* Cursor following handler */
send_error(YYTHD, ER_SP_CURSOR_AFTER_HANDLER); my_error(ER_SP_CURSOR_AFTER_HANDLER, MYF(0));
YYABORT; YYABORT;
} }
$$.vars= $1.vars + $2.vars; $$.vars= $1.vars + $2.vars;
@ -1582,7 +1582,7 @@ sp_decl:
if (spc->find_cond(&$2, TRUE)) if (spc->find_cond(&$2, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_COND, $2.str); my_error(ER_SP_DUP_COND, MYF(0), $2.str);
YYABORT; YYABORT;
} }
YYTHD->lex->spcont->push_cond(&$2, $5); YYTHD->lex->spcont->push_cond(&$2, $5);
@ -1639,7 +1639,7 @@ sp_decl:
if (ctx->find_cursor(&$2, &offp, TRUE)) if (ctx->find_cursor(&$2, &offp, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_CURS, $2.str); my_error(ER_SP_DUP_CURS, MYF(0), $2.str);
delete $5; delete $5;
YYABORT; YYABORT;
} }
@ -1666,12 +1666,12 @@ sp_cursor_stmt:
if (lex->sql_command != SQLCOM_SELECT) if (lex->sql_command != SQLCOM_SELECT)
{ {
send_error(YYTHD, ER_SP_BAD_CURSOR_QUERY); my_error(ER_SP_BAD_CURSOR_QUERY, MYF(0));
YYABORT; YYABORT;
} }
if (lex->result) if (lex->result)
{ {
send_error(YYTHD, ER_SP_BAD_CURSOR_SELECT); my_error(ER_SP_BAD_CURSOR_SELECT, MYF(0));
YYABORT; YYABORT;
} }
lex->sp_lex_in_use= TRUE; lex->sp_lex_in_use= TRUE;
@ -1741,7 +1741,7 @@ sp_hcond:
$$= Lex->spcont->find_cond(&$1); $$= Lex->spcont->find_cond(&$1);
if ($$ == NULL) if ($$ == NULL)
{ {
net_printf(YYTHD, ER_SP_COND_MISMATCH, $1.str); my_error(ER_SP_COND_MISMATCH, MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -1770,7 +1770,7 @@ sp_decl_idents:
if (spc->find_pvar(&$1, TRUE)) if (spc->find_pvar(&$1, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_VAR, $1.str); my_error(ER_SP_DUP_VAR, MYF(0), $1.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$1, (enum_field_types)0, sp_param_in); spc->push_pvar(&$1, (enum_field_types)0, sp_param_in);
@ -1783,7 +1783,7 @@ sp_decl_idents:
if (spc->find_pvar(&$3, TRUE)) if (spc->find_pvar(&$3, TRUE))
{ {
net_printf(YYTHD, ER_SP_DUP_VAR, $3.str); my_error(ER_SP_DUP_VAR, MYF(0), $3.str);
YYABORT; YYABORT;
} }
spc->push_pvar(&$3, (enum_field_types)0, sp_param_in); spc->push_pvar(&$3, (enum_field_types)0, sp_param_in);
@ -1816,7 +1816,7 @@ sp_proc_stmt:
} }
if (lex->sql_command == SQLCOM_CHANGE_DB) if (lex->sql_command == SQLCOM_CHANGE_DB)
{ /* "USE db" doesn't work in a procedure */ { /* "USE db" doesn't work in a procedure */
send_error(YYTHD, ER_SP_NO_USE); my_error(ER_SP_NO_USE, MYF(0));
YYABORT; YYABORT;
} }
/* Don't add an instruction for empty SET statements. /* Don't add an instruction for empty SET statements.
@ -1835,7 +1835,7 @@ sp_proc_stmt:
*/ */
if (sp->m_type != TYPE_ENUM_PROCEDURE) if (sp->m_type != TYPE_ENUM_PROCEDURE)
{ {
send_error(YYTHD, ER_SP_BADSTATEMENT); my_error(ER_SP_BADSTATEMENT, MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1865,7 +1865,7 @@ sp_proc_stmt:
if (lex->sphead->m_type == TYPE_ENUM_PROCEDURE) if (lex->sphead->m_type == TYPE_ENUM_PROCEDURE)
{ {
send_error(YYTHD, ER_SP_BADRETURN); my_error(ER_SP_BADRETURN, MYF(0));
YYABORT; YYABORT;
} }
else else
@ -1874,7 +1874,7 @@ sp_proc_stmt:
if ($2->type() == Item::SUBSELECT_ITEM) if ($2->type() == Item::SUBSELECT_ITEM)
{ /* QQ For now, just disallow subselects as values */ { /* QQ For now, just disallow subselects as values */
send_error(lex->thd, ER_SP_BADSTATEMENT); my_error(ER_SP_BADSTATEMENT, MYF(0));
YYABORT; YYABORT;
} }
i= new sp_instr_freturn(lex->sphead->instructions(), i= new sp_instr_freturn(lex->sphead->instructions(),
@ -1937,7 +1937,7 @@ sp_proc_stmt:
if (! lab) if (! lab)
{ {
net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "LEAVE", $2.str); my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "LEAVE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -1967,7 +1967,7 @@ sp_proc_stmt:
if (! lab || lab->type != SP_LAB_ITER) if (! lab || lab->type != SP_LAB_ITER)
{ {
net_printf(YYTHD, ER_SP_LILABEL_MISMATCH, "ITERATE", $2.str); my_error(ER_SP_LILABEL_MISMATCH, MYF(0), "ITERATE", $2.str);
YYABORT; YYABORT;
} }
else else
@ -1995,7 +1995,7 @@ sp_proc_stmt:
if (lab) if (lab)
{ {
net_printf(YYTHD, ER_SP_LABEL_REDEFINE, $2.str); my_error(ER_SP_LABEL_REDEFINE, MYF(0), $2.str);
YYABORT; YYABORT;
} }
else else
@ -2019,7 +2019,7 @@ sp_proc_stmt:
if (sp->m_in_handler) if (sp->m_in_handler)
{ {
send_error(lex->thd, ER_SP_GOTO_IN_HNDLR); my_error(ER_SP_GOTO_IN_HNDLR, MYF(0));
YYABORT; YYABORT;
} }
lab= ctx->find_label($2.str); lab= ctx->find_label($2.str);
@ -2070,7 +2070,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
net_printf(YYTHD, ER_SP_CURSOR_MISMATCH, $2.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_copen(sp->instructions(), lex->spcont, offset); i= new sp_instr_copen(sp->instructions(), lex->spcont, offset);
@ -2085,7 +2085,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
net_printf(YYTHD, ER_SP_CURSOR_MISMATCH, $2.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset); i= new sp_instr_cfetch(sp->instructions(), lex->spcont, offset);
@ -2102,7 +2102,7 @@ sp_proc_stmt:
if (! lex->spcont->find_cursor(&$2, &offset)) if (! lex->spcont->find_cursor(&$2, &offset))
{ {
net_printf(YYTHD, ER_SP_CURSOR_MISMATCH, $2.str); my_error(ER_SP_CURSOR_MISMATCH, MYF(0), $2.str);
YYABORT; YYABORT;
} }
i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset); i= new sp_instr_cclose(sp->instructions(), lex->spcont, offset);
@ -2120,7 +2120,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$1))) if (!spc || !(spv = spc->find_pvar(&$1)))
{ {
net_printf(YYTHD, ER_SP_UNDECLARED_VAR, $1.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2142,7 +2142,7 @@ sp_fetch_list:
if (!spc || !(spv = spc->find_pvar(&$3))) if (!spc || !(spv = spc->find_pvar(&$3)))
{ {
net_printf(YYTHD, ER_SP_UNDECLARED_VAR, $3.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $3.str);
YYABORT; YYABORT;
} }
else else
@ -2266,7 +2266,7 @@ sp_labeled_control:
if (lab) if (lab)
{ {
net_printf(YYTHD, ER_SP_LABEL_REDEFINE, $1.str); my_error(ER_SP_LABEL_REDEFINE, MYF(0), $1.str);
YYABORT; YYABORT;
} }
else else
@ -2287,7 +2287,7 @@ sp_labeled_control:
if (!lab || if (!lab ||
my_strcasecmp(system_charset_info, $5.str, lab->name) != 0) my_strcasecmp(system_charset_info, $5.str, lab->name) != 0)
{ {
net_printf(YYTHD, ER_SP_LABEL_MISMATCH, $5.str); my_error(ER_SP_LABEL_MISMATCH, MYF(0), $5.str);
YYABORT; YYABORT;
} }
} }
@ -2545,9 +2545,9 @@ default_charset:
cinfo->default_table_charset && $4 && cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4)) !my_charset_same(cinfo->default_table_charset,$4))
{ {
net_printf(YYTHD, ER_CONFLICTING_DECLARATIONS, my_error(ER_CONFLICTING_DECLARATIONS, MYF(0),
"CHARACTER SET ", cinfo->default_table_charset->csname, "CHARACTER SET ", cinfo->default_table_charset->csname,
"CHARACTER SET ", $4->csname); "CHARACTER SET ", $4->csname);
YYABORT; YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
@ -2562,8 +2562,8 @@ default_collation:
cinfo->default_table_charset && $4 && cinfo->default_table_charset && $4 &&
!my_charset_same(cinfo->default_table_charset,$4)) !my_charset_same(cinfo->default_table_charset,$4))
{ {
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$4->name, cinfo->default_table_charset->csname); $4->name, cinfo->default_table_charset->csname);
YYABORT; YYABORT;
} }
Lex->create_info.default_table_charset= $4; Lex->create_info.default_table_charset= $4;
@ -2575,7 +2575,7 @@ storage_engines:
{ {
$$ = ha_resolve_by_name($1.str,$1.length); $$ = ha_resolve_by_name($1.str,$1.length);
if ($$ == DB_TYPE_UNKNOWN) { if ($$ == DB_TYPE_UNKNOWN) {
net_printf(YYTHD, ER_UNKNOWN_STORAGE_ENGINE, $1.str); my_error(ER_UNKNOWN_STORAGE_ENGINE, MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -2754,18 +2754,19 @@ type:
$$=FIELD_TYPE_TINY_BLOB; } $$=FIELD_TYPE_TINY_BLOB; }
| BLOB_SYM opt_len { Lex->charset=&my_charset_bin; | BLOB_SYM opt_len { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_BLOB; } $$=FIELD_TYPE_BLOB; }
| spatial_type { | spatial_type
{
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
Lex->charset=&my_charset_bin; Lex->charset=&my_charset_bin;
Lex->uint_geom_type= (uint)$1; Lex->uint_geom_type= (uint)$1;
$$=FIELD_TYPE_GEOMETRY; $$=FIELD_TYPE_GEOMETRY;
#else #else
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0)
sym_group_geom.name, sym_group_geom.name,
sym_group_geom.needed_define); sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
} }
| MEDIUMBLOB { Lex->charset=&my_charset_bin; | MEDIUMBLOB { Lex->charset=&my_charset_bin;
$$=FIELD_TYPE_MEDIUM_BLOB; } $$=FIELD_TYPE_MEDIUM_BLOB; }
| LONGBLOB { Lex->charset=&my_charset_bin; | LONGBLOB { Lex->charset=&my_charset_bin;
@ -2929,8 +2930,8 @@ attribute:
{ {
if (Lex->charset && !my_charset_same(Lex->charset,$2)) if (Lex->charset && !my_charset_same(Lex->charset,$2))
{ {
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$2->name,Lex->charset->csname); $2->name,Lex->charset->csname);
YYABORT; YYABORT;
} }
else else
@ -2955,7 +2956,7 @@ charset_name:
{ {
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0)))) if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -2973,7 +2974,7 @@ old_or_new_charset_name:
if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) && if (!($$=get_charset_by_csname($1.str,MY_CS_PRIMARY,MYF(0))) &&
!($$=get_old_charset_by_name($1.str))) !($$=get_old_charset_by_name($1.str)))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,$1.str); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), $1.str);
YYABORT; YYABORT;
} }
} }
@ -2989,7 +2990,7 @@ collation_name:
{ {
if (!($$=get_charset_by_name($1.str,MYF(0)))) if (!($$=get_charset_by_name($1.str,MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_COLLATION,$1.str); my_error(ER_UNKNOWN_COLLATION, MYF(0), $1.str);
YYABORT; YYABORT;
} }
}; };
@ -3013,9 +3014,10 @@ opt_binary:
| BYTE_SYM { Lex->charset=&my_charset_bin; } | BYTE_SYM { Lex->charset=&my_charset_bin; }
| UNICODE_SYM | UNICODE_SYM
{ {
if (!(Lex->charset=get_charset_by_csname("ucs2",MY_CS_PRIMARY,MYF(0)))) if (!(Lex->charset=get_charset_by_csname("ucs2",
MY_CS_PRIMARY,MYF(0))))
{ {
net_printf(YYTHD,ER_UNKNOWN_CHARACTER_SET,"ucs2"); my_error(ER_UNKNOWN_CHARACTER_SET, MYF(0), "ucs2");
YYABORT; YYABORT;
} }
} }
@ -3077,8 +3079,8 @@ key_type:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
}; };
@ -3110,8 +3112,8 @@ opt_unique_or_fulltext:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= Key::SPATIAL; $$= Key::SPATIAL;
#else #else
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
} }
@ -3338,7 +3340,7 @@ alter_list_item:
if (check_table_name($3->table.str,$3->table.length) || if (check_table_name($3->table.str,$3->table.length) ||
$3->db.str && check_db_name($3->db.str)) $3->db.str && check_db_name($3->db.str))
{ {
net_printf(lex->thd,ER_WRONG_TABLE_NAME,$3->table.str); my_error(ER_WRONG_TABLE_NAME, MYF(0), $3->table.str);
YYABORT; YYABORT;
} }
lex->alter_info.flags|= ALTER_RENAME; lex->alter_info.flags|= ALTER_RENAME;
@ -3353,8 +3355,8 @@ alter_list_item:
$5= $5 ? $5 : $4; $5= $5 ? $5 : $4;
if (!my_charset_same($4,$5)) if (!my_charset_same($4,$5))
{ {
net_printf(YYTHD,ER_COLLATION_CHARSET_MISMATCH, my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$5->name,$4->csname); $5->name, $4->csname);
YYABORT; YYABORT;
} }
LEX *lex= Lex; LEX *lex= Lex;
@ -3476,7 +3478,7 @@ slave_until:
!((lex->mi.log_file_name && lex->mi.pos) || !((lex->mi.log_file_name && lex->mi.pos) ||
(lex->mi.relay_log_name && lex->mi.relay_log_pos))) (lex->mi.relay_log_name && lex->mi.relay_log_pos)))
{ {
send_error(lex->thd, ER_BAD_SLAVE_UNTIL_COND); my_error(ER_BAD_SLAVE_UNTIL_COND, MYF(0));
YYABORT; YYABORT;
} }
@ -4189,9 +4191,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(void))($1.symbol->create_func))(); $$= ((Item*(*)(void))($1.symbol->create_func))();
@ -4200,9 +4202,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*))($1.symbol->create_func))($3); $$= ((Item*(*)(Item*))($1.symbol->create_func))($3);
@ -4211,9 +4213,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5); $$= ((Item*(*)(Item*,Item*))($1.symbol->create_func))($3,$5);
@ -4222,9 +4224,9 @@ simple_expr:
{ {
if (!$1.symbol->create_func) if (!$1.symbol->create_func)
{ {
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
$1.symbol->group->name, $1.symbol->group->name,
$1.symbol->group->needed_define); $1.symbol->group->needed_define);
YYABORT; YYABORT;
} }
$$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7); $$= ((Item*(*)(Item*,Item*,Item*))($1.symbol->create_func))($3,$5,$7);
@ -4327,8 +4329,8 @@ simple_expr:
#ifdef HAVE_SPATIAL #ifdef HAVE_SPATIAL
$$= $1; $$= $1;
#else #else
net_printf(Lex->thd, ER_FEATURE_DISABLED, my_error(ER_FEATURE_DISABLED, MYF(0),
sym_group_geom.name, sym_group_geom.needed_define); sym_group_geom.name, sym_group_geom.needed_define);
YYABORT; YYABORT;
#endif #endif
} }
@ -5184,12 +5186,12 @@ olap_opt:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ {
net_printf(lex->thd, ER_WRONG_USAGE, "WITH CUBE", my_error(ER_WRONG_USAGE, MYF(0), "WITH CUBE",
"global union parameters"); "global union parameters");
YYABORT; YYABORT;
} }
lex->current_select->olap= CUBE_TYPE; lex->current_select->olap= CUBE_TYPE;
net_printf(lex->thd, ER_NOT_SUPPORTED_YET, "CUBE"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "CUBE");
YYABORT; /* To be deleted in 5.1 */ YYABORT; /* To be deleted in 5.1 */
} }
| WITH ROLLUP_SYM | WITH ROLLUP_SYM
@ -5197,7 +5199,7 @@ olap_opt:
LEX *lex= Lex; LEX *lex= Lex;
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)
{ {
net_printf(lex->thd, ER_WRONG_USAGE, "WITH ROLLUP", my_error(ER_WRONG_USAGE, MYF(0), "WITH ROLLUP",
"global union parameters"); "global union parameters");
YYABORT; YYABORT;
} }
@ -5221,9 +5223,8 @@ order_clause:
lex->current_select->olap != lex->current_select->olap !=
UNSPECIFIED_OLAP_TYPE) UNSPECIFIED_OLAP_TYPE)
{ {
net_printf(lex->thd, ER_WRONG_USAGE, my_error(ER_WRONG_USAGE, MYF(0),
"CUBE/ROLLUP", "CUBE/ROLLUP", "ORDER BY");
"ORDER BY");
YYABORT; YYABORT;
} }
} order_list; } order_list;
@ -5321,9 +5322,7 @@ procedure_clause:
LEX *lex=Lex; LEX *lex=Lex;
if (&lex->select_lex != lex->current_select) if (&lex->select_lex != lex->current_select)
{ {
net_printf(lex->thd, ER_WRONG_USAGE, my_error(ER_WRONG_USAGE, MYF(0), "PROCEDURE", "subquery");
"PROCEDURE",
"subquery");
YYABORT; YYABORT;
} }
lex->proc_list.elements=0; lex->proc_list.elements=0;
@ -5387,7 +5386,7 @@ select_var_ident:
if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1))) if (!lex->spcont || !(t=lex->spcont->find_pvar(&$1)))
{ {
net_printf(YYTHD, ER_SP_UNDECLARED_VAR, $1.str); my_error(ER_SP_UNDECLARED_VAR, MYF(0), $1.str);
YYABORT; YYABORT;
} }
if (! lex->result) if (! lex->result)
@ -5482,7 +5481,7 @@ drop:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sphead) if (lex->sphead)
{ {
net_printf(YYTHD, ER_SP_NO_DROP_SP, "FUNCTION"); my_error(ER_SP_NO_DROP_SP, MYF(0), "FUNCTION");
YYABORT; YYABORT;
} }
lex->sql_command = SQLCOM_DROP_FUNCTION; lex->sql_command = SQLCOM_DROP_FUNCTION;
@ -5494,7 +5493,7 @@ drop:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->sphead) if (lex->sphead)
{ {
net_printf(YYTHD, ER_SP_NO_DROP_SP, "PROCEDURE"); my_error(ER_SP_NO_DROP_SP, MYF(0), "PROCEDURE");
YYABORT; YYABORT;
} }
lex->sql_command = SQLCOM_DROP_PROCEDURE; lex->sql_command = SQLCOM_DROP_PROCEDURE;
@ -5742,8 +5741,8 @@ update:
else if (lex->select_lex.get_table_list()->derived) else if (lex->select_lex.get_table_list()->derived)
{ {
/* it is single table update and it is update of derived table */ /* it is single table update and it is update of derived table */
net_printf(lex->thd, ER_NON_UPDATABLE_TABLE, my_error(ER_NON_UPDATABLE_TABLE, MYF(0),
lex->select_lex.get_table_list()->alias, "UPDATE"); lex->select_lex.get_table_list()->alias, "UPDATE");
YYABORT; YYABORT;
} }
} }
@ -6065,7 +6064,7 @@ show_engine_param:
Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS; Lex->sql_command = SQLCOM_SHOW_INNODB_STATUS;
break; break;
default: default:
net_printf(YYTHD, ER_NOT_SUPPORTED_YET, "STATUS"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "STATUS");
YYABORT; YYABORT;
} }
} }
@ -6076,7 +6075,7 @@ show_engine_param:
Lex->sql_command = SQLCOM_SHOW_LOGS; Lex->sql_command = SQLCOM_SHOW_LOGS;
break; break;
default: default:
net_printf(YYTHD, ER_NOT_SUPPORTED_YET, "LOGS"); my_error(ER_NOT_SUPPORTED_YET, MYF(0), "LOGS");
YYABORT; YYABORT;
} }
}; };
@ -6228,7 +6227,7 @@ purge_option:
{ {
if ($2->check_cols(1) || $2->fix_fields(Lex->thd, 0, &$2)) if ($2->check_cols(1) || $2->fix_fields(Lex->thd, 0, &$2))
{ {
net_printf(Lex->thd, ER_WRONG_ARGUMENTS, "PURGE LOGS BEFORE"); my_error(ER_WRONG_ARGUMENTS, MYF(0), "PURGE LOGS BEFORE");
YYABORT; YYABORT;
} }
Item *tmp= new Item_func_unix_timestamp($2); Item *tmp= new Item_func_unix_timestamp($2);
@ -6250,7 +6249,7 @@ kill:
LEX *lex=Lex; LEX *lex=Lex;
if ($3->fix_fields(lex->thd, 0, &$3) || $3->check_cols(1)) if ($3->fix_fields(lex->thd, 0, &$3) || $3->check_cols(1))
{ {
send_error(lex->thd, ER_SET_CONSTANTS_ONLY); my_error(ER_SET_CONSTANTS_ONLY, MYF(0));
YYABORT; YYABORT;
} }
lex->sql_command=SQLCOM_KILL; lex->sql_command=SQLCOM_KILL;
@ -6397,7 +6396,7 @@ param_marker:
(uchar *) thd->query)); (uchar *) thd->query));
if (!($$= item) || lex->param_list.push_back(item)) if (!($$= item) || lex->param_list.push_back(item))
{ {
send_error(thd, ER_OUT_OF_RESOURCES); my_error(ER_OUT_OF_RESOURCES, MYF(0));
YYABORT; YYABORT;
} }
} }
@ -6453,7 +6452,6 @@ NUM_literal:
$$= new Item_real($1.str, $1.length); $$= new Item_real($1.str, $1.length);
if (YYTHD->net.report_error) if (YYTHD->net.report_error)
{ {
send_error(YYTHD, 0, NullS);
YYABORT; YYABORT;
} }
} }
@ -6462,7 +6460,6 @@ NUM_literal:
$$ = new Item_float($1.str, $1.length); $$ = new Item_float($1.str, $1.length);
if (YYTHD->net.report_error) if (YYTHD->net.report_error)
{ {
send_error(YYTHD, 0, NullS);
YYABORT; YYABORT;
} }
} }
@ -6557,16 +6554,14 @@ simple_ident_q:
if (lex->trg_chistics.event == TRG_EVENT_INSERT && if (lex->trg_chistics.event == TRG_EVENT_INSERT &&
!new_row) !new_row)
{ {
net_printf(YYTHD, ER_TRG_NO_SUCH_ROW_IN_TRG, "OLD", my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "OLD", "on INSERT");
"on INSERT");
YYABORT; YYABORT;
} }
if (lex->trg_chistics.event == TRG_EVENT_DELETE && if (lex->trg_chistics.event == TRG_EVENT_DELETE &&
new_row) new_row)
{ {
net_printf(YYTHD, ER_TRG_NO_SUCH_ROW_IN_TRG, "NEW", my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0), "NEW", "on DELETE");
"on DELETE");
YYABORT; YYABORT;
} }
@ -6583,8 +6578,8 @@ simple_ident_q:
FIXME. Far from perfect solution. See comment for FIXME. Far from perfect solution. See comment for
"SET NEW.field_name:=..." for more info. "SET NEW.field_name:=..." for more info.
*/ */
net_printf(YYTHD, ER_BAD_FIELD_ERROR, $3.str, my_error(ER_BAD_FIELD_ERROR, MYF(0), $3.str,
new_row ? "NEW": "OLD"); new_row ? "NEW": "OLD");
YYABORT; YYABORT;
} }
@ -6671,8 +6666,8 @@ IDENT_sys:
$1.length); $1.length);
if (wlen < $1.length) if (wlen < $1.length)
{ {
net_printf(YYTHD, ER_INVALID_CHARACTER_STRING, cs->csname, my_error(ER_INVALID_CHARACTER_STRING, MYF(0), cs->csname,
$1.str + wlen); $1.str + wlen);
YYABORT; YYABORT;
} }
$$= $1; $$= $1;
@ -7051,7 +7046,7 @@ option_value:
*/ */
if (lex->query_tables) if (lex->query_tables)
{ {
send_error(YYTHD, ER_SP_SUBSELECT_NYI); my_error(ER_SP_SUBSELECT_NYI, MYF(0));
YYABORT; YYABORT;
} }
sp_instr_set_user_var *i= sp_instr_set_user_var *i=
@ -7074,7 +7069,7 @@ option_value:
sp_instr_set_trigger_field *i; sp_instr_set_trigger_field *i;
if (lex->query_tables) if (lex->query_tables)
{ {
send_error(YYTHD, ER_SP_SUBSELECT_NYI); my_error(ER_SP_SUBSELECT_NYI, MYF(0));
YYABORT; YYABORT;
} }
if ($3) if ($3)
@ -7103,7 +7098,7 @@ option_value:
Error message also should be improved. Error message also should be improved.
*/ */
net_printf(YYTHD, ER_BAD_FIELD_ERROR, $1.base_name, "NEW"); my_error(ER_BAD_FIELD_ERROR, MYF(0), $1.base_name, "NEW");
YYABORT; YYABORT;
} }
lex->sphead->add_instr(i); lex->sphead->add_instr(i);
@ -7169,7 +7164,8 @@ option_value:
$3= $3 ? $3 : $2; $3= $3 ? $3 : $2;
if (!my_charset_same($2,$3)) if (!my_charset_same($2,$3))
{ {
net_printf(thd,ER_COLLATION_CHARSET_MISMATCH,$3->name,$2->csname); my_error(ER_COLLATION_CHARSET_MISMATCH, MYF(0),
$3->name, $2->csname);
YYABORT; YYABORT;
} }
lex->var_list.push_back(new set_var_collation_client($3,$3,$3)); lex->var_list.push_back(new set_var_collation_client($3,$3,$3));
@ -7235,18 +7231,18 @@ internal_variable_name:
{ {
if ($1.str[0]=='O' || $1.str[0]=='o') if ($1.str[0]=='O' || $1.str[0]=='o')
{ {
net_printf(YYTHD, ER_TRG_CANT_CHANGE_ROW, "OLD", ""); my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "OLD", "");
YYABORT; YYABORT;
} }
if (lex->trg_chistics.event == TRG_EVENT_DELETE) if (lex->trg_chistics.event == TRG_EVENT_DELETE)
{ {
net_printf(YYTHD, ER_TRG_NO_SUCH_ROW_IN_TRG, "NEW", my_error(ER_TRG_NO_SUCH_ROW_IN_TRG, MYF(0),
"on DELETE"); "NEW", "on DELETE");
YYABORT; YYABORT;
} }
if (lex->trg_chistics.action_time == TRG_ACTION_AFTER) if (lex->trg_chistics.action_time == TRG_ACTION_AFTER)
{ {
net_printf(YYTHD, ER_TRG_CANT_CHANGE_ROW, "NEW", "after "); my_error(ER_TRG_CANT_CHANGE_ROW, MYF(0), "NEW", "after ");
YYABORT; YYABORT;
} }
/* This special combination will denote field of NEW row */ /* This special combination will denote field of NEW row */
@ -7259,7 +7255,7 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
net_printf(YYTHD, ER_VARIABLE_IS_NOT_STRUCT, $3.str); my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
$$.base_name= $1; $$.base_name= $1;
} }
@ -7270,7 +7266,7 @@ internal_variable_name:
if (!tmp) if (!tmp)
YYABORT; YYABORT;
if (!tmp->is_struct()) if (!tmp->is_struct())
net_printf(YYTHD, ER_VARIABLE_IS_NOT_STRUCT, $3.str); my_error(ER_VARIABLE_IS_NOT_STRUCT, MYF(0), $3.str);
$$.var= tmp; $$.var= tmp;
$$.base_name.str= (char*) "default"; $$.base_name.str= (char*) "default";
$$.base_name.length= 7; $$.base_name.length= 7;
@ -7515,7 +7511,7 @@ require_list_element:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->x509_subject) if (lex->x509_subject)
{ {
net_printf(lex->thd,ER_DUP_ARGUMENT, "SUBJECT"); my_error(ER_DUP_ARGUMENT, MYF(0), "SUBJECT");
YYABORT; YYABORT;
} }
lex->x509_subject=$2.str; lex->x509_subject=$2.str;
@ -7525,7 +7521,7 @@ require_list_element:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->x509_issuer) if (lex->x509_issuer)
{ {
net_printf(lex->thd,ER_DUP_ARGUMENT, "ISSUER"); my_error(ER_DUP_ARGUMENT, MYF(0), "ISSUER");
YYABORT; YYABORT;
} }
lex->x509_issuer=$2.str; lex->x509_issuer=$2.str;
@ -7535,7 +7531,7 @@ require_list_element:
LEX *lex=Lex; LEX *lex=Lex;
if (lex->ssl_cipher) if (lex->ssl_cipher)
{ {
net_printf(lex->thd,ER_DUP_ARGUMENT, "CIPHER"); my_error(ER_DUP_ARGUMENT, MYF(0), "CIPHER");
YYABORT; YYABORT;
} }
lex->ssl_cipher=$2.str; lex->ssl_cipher=$2.str;
@ -7551,7 +7547,7 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
send_error(lex->thd,ER_ILLEGAL_GRANT_FOR_TABLE); my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
YYABORT; YYABORT;
} }
} }
@ -7563,7 +7559,7 @@ opt_table:
lex->grant = DB_ACLS & ~GRANT_ACL; lex->grant = DB_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
send_error(lex->thd,ER_ILLEGAL_GRANT_FOR_TABLE); my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
YYABORT; YYABORT;
} }
} }
@ -7575,7 +7571,7 @@ opt_table:
lex->grant= GLOBAL_ACLS & ~GRANT_ACL; lex->grant= GLOBAL_ACLS & ~GRANT_ACL;
else if (lex->columns.elements) else if (lex->columns.elements)
{ {
send_error(lex->thd,ER_ILLEGAL_GRANT_FOR_TABLE); my_error(ER_ILLEGAL_GRANT_FOR_TABLE, MYF(0));
YYABORT; YYABORT;
} }
} }
@ -7760,7 +7756,7 @@ union_list:
if (lex->exchange) if (lex->exchange)
{ {
/* Only the last SELECT can have INTO...... */ /* Only the last SELECT can have INTO...... */
net_printf(lex->thd, ER_WRONG_USAGE, "UNION", "INTO"); my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
YYABORT; YYABORT;
} }
if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE) if (lex->current_select->linkage == GLOBAL_OPTIONS_TYPE)