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


sql/ha_innodb.cc:
  Auto merged
sql/item.cc:
  Auto merged
sql/item_cmpfunc.cc:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_row.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_select.h:
  Auto merged
This commit is contained in:
unknown 2004-10-22 09:51:20 +03:00
commit 93678f6bd9
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
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 */
@ -386,4 +386,23 @@
#define ER_ILLEGAL_VALUE_FOR_TYPE 1367
#define ER_VIEW_NONUPD_CHECK 1368
#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 # drop database mysqltest3
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;
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 @@max_join_size=1000;
select @@character_set_server;
@ -181,7 +181,7 @@ select @@character_set_server;
@@character_set_server
latin5
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;
ERROR 42000: Unknown character set: '9999999'
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;
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;
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';

View file

@ -73,5 +73,5 @@ t
2001-09-09 03:46:40
1000000000
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;

View file

@ -30,7 +30,7 @@ db1_secret
select * from db1_secret.t1;
ERROR 42000: Access denied for user 'user1'@'localhost' to database 'db1_secret'
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;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
call db1_secret.stamp(3);
@ -40,7 +40,7 @@ db1_secret
select * from db1_secret.t1;
ERROR 42000: Access denied for user ''@'localhost' to database 'db1_secret'
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;
ERROR 42000: PROCEDURE db1_secret.dummy does not exist
select * from t1;

View file

@ -1746,10 +1746,20 @@ drop table if exists t3|
create procedure bug4904()
begin
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|
call bug4904()|
drop procedure bug4904|
drop table t3|
create procedure bug336(out y int)
begin
declare x int;

View file

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

View file

@ -112,10 +112,10 @@ sync_slave_with_master;
# Check that we can't change global.collation_server
error 1105;
error 1386;
set global character_set_server=latin2;
connection master;
error 1105;
error 1386;
set global character_set_server=latin2;
# Check that SET ONE_SHOT is really one shot
@ -129,7 +129,7 @@ select @@character_set_server;
select @@character_set_server;
# ONE_SHOT on not charset/collation stuff is not allowed
error 1105;
error 1381;
set one_shot max_join_size=10;
# 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)
# (system error 13)
--error 1201
--error 1105
start slave;
system chmod 600 var/slave-data/master.info;
# 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
#
connection master;
--error 1105
--error 1386
set global time_zone='MET';
# Clean up

View file

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

View file

@ -1870,12 +1870,27 @@ create procedure bug4904()
begin
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|
call bug4904()|
drop procedure bug4904|
drop table t3|
#
# BUG#336

View file

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

View file

@ -222,7 +222,7 @@ int innobase_savepoint(
my_off_t binlog_cache_pos);
int innobase_close_connection(THD *thd);
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,
uint full_name_len);

View file

@ -1322,7 +1322,7 @@ bool Item::fix_fields(THD *thd,
// We do not check fields which are fixed during construction
DBUG_ASSERT(fixed == 0 || basic_const_item());
fixed= 1;
return 0;
return FALSE;
}
double Item_ref_null_helper::val()
@ -1490,9 +1490,9 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
}
if (!tmp)
return -1;
return TRUE;
if (!refer)
return 1;
return TRUE;
if (tmp == not_found_field && refer == (Item **)not_found_item)
{
if (upward_lookup)
@ -1506,7 +1506,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
// Call to report error
find_field_in_tables(thd, this, tables, ref, 1, 1);
}
return -1;
return TRUE;
}
else if (refer != (Item **)not_found_item)
{
@ -1514,7 +1514,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list");
return -1;
return TRUE;
}
Item_ref *rf;
@ -1524,16 +1524,16 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(char *)field_name);
register_item_tree_changing(ref);
if (!rf)
return 1;
return TRUE;
/*
rf is Item_ref => never substitute other items (in this case)
during fix_fields() => we can use rf after fix_fields()
*/
if (rf->fix_fields(thd, tables, ref) || rf->check_cols(1))
return 1;
return TRUE;
mark_as_dependent(thd, last, cursel, rf);
return 0;
return FALSE;
}
else
{
@ -1546,7 +1546,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
(char *)cached_table->alias,
(char *)field_name);
if (!rf)
return 1;
return TRUE;
/*
rf is Item_ref => never substitute other items (in this case)
during fix_fields() => we can use rf after fix_fields()
@ -1556,7 +1556,7 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
}
else if (!tmp)
return -1;
return TRUE;
/*
if it is not expression from merged VIEW we will set this field.
@ -1607,12 +1607,12 @@ bool Item_field::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
thd->host_or_ip,
field_name,
tab);
return 1;
return TRUE;
}
}
#endif
fixed= 1;
return 0;
return FALSE;
}
void Item_field::cleanup()
@ -2368,9 +2368,9 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
}
if (!ref)
return 1;
return TRUE;
else if (!tmp)
return -1;
return TRUE;
else if (ref == (Item **)not_found_item && tmp == not_found_field)
{
if (upward_lookup)
@ -2388,7 +2388,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
REPORT_ALL_ERRORS);
}
ref= 0;
return 1;
return TRUE;
}
else if (tmp != not_found_field)
{
@ -2397,10 +2397,10 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{
Item_field* fld;
if (!((*reference)= fld= new Item_field(tmp)))
return 1;
return TRUE;
mark_as_dependent(thd, last, thd->lex->current_select, fld);
register_item_tree_changing(reference);
return 0;
return FALSE;
}
/*
We can leave expression substituted from view for next PS/SP
@ -2420,7 +2420,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list");
return -1;
return TRUE;
}
mark_as_dependent(thd, last, thd->lex->current_select,
this);
@ -2428,14 +2428,14 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
}
}
else if (!ref)
return 1;
return TRUE;
else
{
if (!(*ref)->fixed)
{
my_error(ER_ILLEGAL_REFERENCE, MYF(0), name,
"forward reference in item list");
return -1;
return TRUE;
}
ref= thd->lex->current_select->ref_pointer_array + counter;
}
@ -2458,7 +2458,7 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
((*ref)->with_sum_func?
"reference on group function":
"forward reference in item list"));
return 1;
return TRUE;
}
max_length= (*ref)->max_length;
maybe_null= (*ref)->maybe_null;
@ -2468,8 +2468,8 @@ bool Item_ref::fix_fields(THD *thd, TABLE_LIST *tables, Item **reference)
fixed= 1;
if (ref && (*ref)->check_cols(1))
return 1;
return 0;
return TRUE;
return FALSE;
}
@ -2575,17 +2575,17 @@ bool Item_default_value::fix_fields(THD *thd,
if (!arg)
{
fixed= 1;
return 0;
return FALSE;
}
if (arg->fix_fields(thd, table_list, &arg))
return 1;
return TRUE;
if (arg->type() == REF_ITEM)
{
Item_ref *ref= (Item_ref *)arg;
if (ref->ref[0]->type() != FIELD_ITEM)
{
return 1;
return TRUE;
}
arg= ref->ref[0];
}
@ -2594,16 +2594,16 @@ bool Item_default_value::fix_fields(THD *thd,
{
my_printf_error(ER_NO_DEFAULT_FOR_FIELD, ER(ER_NO_DEFAULT_FOR_FIELD),
MYF(0), field_arg->field->field_name);
return 1;
return TRUE;
}
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());
def_field->move_field(def_field->table->default_values -
def_field->table->record[0]);
set_field(def_field);
fixed= 1;
return 0;
return FALSE;
}
void Item_default_value::print(String *str)
@ -2631,14 +2631,14 @@ bool Item_insert_value::fix_fields(THD *thd,
{
DBUG_ASSERT(fixed == 0);
if (arg->fix_fields(thd, table_list, &arg))
return 1;
return TRUE;
if (arg->type() == REF_ITEM)
{
Item_ref *ref= (Item_ref *)arg;
if (ref->ref[0]->type() != FIELD_ITEM)
{
return 1;
return TRUE;
}
arg= ref->ref[0];
}
@ -2647,7 +2647,7 @@ bool Item_insert_value::fix_fields(THD *thd,
{
Field *def_field= (Field*) sql_alloc(field_arg->field->size_of());
if (!def_field)
return 1;
return TRUE;
memcpy(def_field, field_arg->field, field_arg->field->size_of());
def_field->move_field(def_field->table->insert_values -
def_field->table->record[0]);
@ -2661,7 +2661,7 @@ bool Item_insert_value::fix_fields(THD *thd,
tmp_field->table, &my_charset_bin));
}
fixed= 1;
return 0;
return FALSE;
}
void Item_insert_value::print(String *str)

View file

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

View file

@ -199,8 +199,8 @@ Item_func::Item_func(THD *thd, Item_func *item)
item.
RETURN VALUES
0 ok
1 Got error. Stored with my_error().
FALSE ok
TRUE Got error. Stored with my_error().
*/
bool
@ -216,7 +216,7 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
const_item_cache=1;
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)
{ // Print purify happy
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)) ||
(*arg)->check_cols(allowed_arg_cols))
return 1; /* purecov: inspected */
return TRUE; /* purecov: inspected */
item= *arg;
if (item->maybe_null)
maybe_null=1;
@ -240,10 +240,10 @@ Item_func::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
}
}
fix_length_and_dec();
if (thd->net.last_errno) // An error inside fix_length_and_dec occured
return 1;
if (thd->net.report_error) // An error inside fix_length_and_dec occured
return TRUE;
fixed= 1;
return 0;
return FALSE;
}
bool Item_func::walk (Item_processor processor, byte *argument)
@ -1607,7 +1607,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
DBUG_ENTER("Item_udf_func::fix_fields");
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);
@ -1615,7 +1615,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,
errno);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
u_d=tmp_udf;
args=arguments;
@ -1632,7 +1632,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
{
free_udf(u_d);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
uint i;
Item **arg,**arg_end;
@ -1645,7 +1645,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
Item *item= *arg;
if (item->check_cols(1))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
/*
TODO: We should think about this. It is not always
right way just to set an UDF result to return my_charset_bin
@ -1678,7 +1678,7 @@ udf_handler::fix_fields(THD *thd, TABLE_LIST *tables, Item_result_field *func,
sizeof(long))))
{
free_udf(u_d);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
}
func->fix_length_and_dec();
@ -1737,7 +1737,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),
u_d->name.str, thd->net.last_error);
free_udf(u_d);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
func->max_length=min(initid.max_length,MAX_BLOB_WIDTH);
func->maybe_null=initid.maybe_null;
@ -1749,9 +1749,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),
u_d->name.str, ER(ER_UNKNOWN_ERROR));
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
@ -2361,7 +2361,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 */
if (Item_func::fix_fields(thd, tables, ref) ||
!(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
if this variable is a constant item in the query (it is if update_query_id
@ -2370,7 +2370,7 @@ bool Item_func_set_user_var::fix_fields(THD *thd, TABLE_LIST *tables,
entry->update_query_id= thd->query_id;
entry->collation.set(args[0]->collation);
cached_result_type= args[0]->result_type();
return 0;
return FALSE;
}
@ -2529,7 +2529,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().
RETURN
0 - OK.
FALSE OK.
*/
bool
@ -2559,7 +2559,7 @@ Item_func_set_user_var::check()
DBUG_ASSERT(0);
break;
}
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
@ -3007,7 +3007,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
!args[0]->const_during_execution())
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),"AGAINST");
return 1;
return TRUE;
}
const_item_cache=0;
@ -3030,7 +3030,7 @@ bool Item_func_match::fix_fields(THD *thd, TABLE_LIST *tlist, Item **ref)
if (key == NO_SUCH_KEY && !(flags & FT_BOOL))
{
my_error(ER_WRONG_ARGUMENTS,MYF(0),"MATCH");
return 1;
return TRUE;
}
table=((Item_field *)item)->field->table;
table->fulltext_searched=1;
@ -3241,7 +3241,7 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
{
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;
}
}

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++)
{
if ((*arg)->fix_fields(thd, tabl, arg))
return 1;
return TRUE;
// we can't assign 'item' before, because fix_fields() can change arg
Item *item= *arg;
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;
}
fixed= 1;
return 0;
return FALSE;
}
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;
unit->item->engine= 0;
unit->item= this;
engine->change_item(this, result);
engine->change_result(this, result);
}
else
{
@ -133,13 +133,13 @@ Item_subselect::select_transformer(JOIN *join)
bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
{
char const *save_where= thd_param->where;
int res;
bool res;
DBUG_ASSERT(fixed == 0);
engine->set_thd((thd= thd_param));
if (check_stack_overrun(thd, (gptr)&res))
return 1;
return TRUE;
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)
{
my_error(ER_INVALID_GROUP_FUNC_USE, MYF(0));
return 1;
return TRUE;
}
return ret;
}
@ -176,7 +176,7 @@ bool Item_subselect::fix_fields(THD *thd_param, TABLE_LIST *tables, Item **ref)
if (engine->cols() > max_columns)
{
my_error(ER_OPERAND_COLUMNS, MYF(0), 1);
return 1;
return TRUE;
}
fix_length_and_dec();
}
@ -1493,12 +1493,12 @@ void subselect_indexsubquery_engine::print(String *str)
res new select_result object
RETURN
0 OK
-1 error
FALSE OK
TRUE error
*/
int subselect_single_select_engine::change_item(Item_subselect *si,
select_subselect *res)
bool subselect_single_select_engine::change_result(Item_subselect *si,
select_subselect *res)
{
item= si;
result= res;
@ -1515,12 +1515,12 @@ int subselect_single_select_engine::change_item(Item_subselect *si,
res new select_result object
RETURN
0 OK
-1 error
FALSE OK
TRUE error
*/
int subselect_union_engine::change_item(Item_subselect *si,
select_subselect *res)
bool subselect_union_engine::change_result(Item_subselect *si,
select_subselect *res)
{
item= si;
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
RETURN
-1 error
FALSE OK
TRUE error
*/
int subselect_uniquesubquery_engine::change_item(Item_subselect *si,
select_subselect *res)
bool subselect_uniquesubquery_engine::change_result(Item_subselect *si,
select_subselect *res)
{
DBUG_ASSERT(0);
return -1;
return TRUE;
}

View file

@ -290,7 +290,7 @@ public:
virtual table_map upper_select_const_tables()= 0;
static table_map calc_const_tables(TABLE_LIST *);
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();
table_map upper_select_const_tables();
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();
table_map upper_select_const_tables();
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();
table_map upper_select_const_tables() { return 0; }
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);
if (save_args_for_prepared_statement(thd))
return 1;
return TRUE;
if (!thd->allow_sum_func)
{
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1;
return TRUE;
}
thd->allow_sum_func=0; // No included group funcs
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++)
{
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1;
return TRUE;
if (decimals < args[i]->decimals)
decimals=args[i]->decimals;
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();
thd->allow_sum_func=1; // Allow group functions
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);
if (save_args_for_prepared_statement(thd))
return 1;
return TRUE;
Item *item= args[0];
if (!thd->allow_sum_func)
{
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1;
return TRUE;
}
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 &&
item->fix_fields(thd, tables, args) ||
(item= args[0])->check_cols(1))
return 1;
return TRUE;
hybrid_type= item->result_type();
if (hybrid_type == INT_RESULT)
@ -295,7 +295,7 @@ Item_sum_hybrid::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
else
hybrid_field_type= Item::field_type();
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);
if (save_args_for_prepared_statement(thd))
return 1;
return TRUE;
if (!thd->allow_sum_func)
{
my_error(ER_INVALID_GROUP_FUNC_USE,MYF(0));
return 1;
return TRUE;
}
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++)
{
if (args[i]->fix_fields(thd, tables, args + i) || args[i]->check_cols(1))
return 1;
return TRUE;
if (i < arg_count_field)
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;
thd->allow_sum_func= 1;
if (!(tmp_table_param= new TMP_TABLE_PARAM))
return 1;
return TRUE;
tables_list= tables;
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;
if (Item_date_func::fix_fields(thd_arg, tables_arg, ref))
return 1;
return TRUE;
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())
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);
fixed= 1;
return 0;
return FALSE;
}
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);
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;
int sql_errno;
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_merge_table_access(THD *thd, char *db,
TABLE_LIST *table_list);
int multi_update_precheck(THD *thd, TABLE_LIST *tables);
int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
int mysql_multi_update_prepare(THD *thd);
int mysql_multi_delete_prepare(THD *thd);
int mysql_insert_select_prepare(THD *thd);
int insert_select_precheck(THD *thd, TABLE_LIST *tables);
int update_precheck(THD *thd, TABLE_LIST *tables);
int delete_precheck(THD *thd, TABLE_LIST *tables);
int insert_precheck(THD *thd, TABLE_LIST *tables, bool update);
int create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table);
bool multi_update_precheck(THD *thd, TABLE_LIST *tables);
bool multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count);
bool mysql_multi_update_prepare(THD *thd);
bool mysql_multi_delete_prepare(THD *thd);
bool mysql_insert_select_prepare(THD *thd);
bool insert_select_precheck(THD *thd, TABLE_LIST *tables);
bool update_precheck(THD *thd, TABLE_LIST *tables);
bool delete_precheck(THD *thd, TABLE_LIST *tables);
bool insert_precheck(THD *thd, TABLE_LIST *tables, bool update);
bool create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table);
Item *negate_expression(THD *thd, Item *expr);
#include "sql_class.h"
#include "opt_range.h"
@ -475,12 +475,12 @@ struct Query_cache_query_flags
#define prepare_execute(A) ((A)->command == COM_EXECUTE)
int 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);
int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent);
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create, bool silent);
bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create);
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);
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary);
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary);
int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
bool drop_temporary, bool drop_view, bool log_query);
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);
void end_thread(THD *thd,bool put_in_cache);
void flush_thread_cache();
int mysql_execute_command(THD *thd);
bool mysql_execute_command(THD *thd);
bool do_command(THD *thd);
bool dispatch_command(enum enum_server_command command, THD *thd,
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 check_global_access(THD *thd, ulong want_access);
int mysql_backup_table(THD* thd, TABLE_LIST* table_list);
int mysql_restore_table(THD* thd, TABLE_LIST* table_list);
bool mysql_backup_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,
HA_CHECK_OPT* check_opt);
int mysql_check_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_repair_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
int mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
LEX_STRING *key_cache_name);
int mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
bool mysql_checksum_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_check_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_repair_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_analyze_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_optimize_table(THD* thd, TABLE_LIST* table_list,
HA_CHECK_OPT* check_opt);
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list,
LEX_STRING *key_cache_name);
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list);
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_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,
bool *hidden_group_fields);
int handle_select(THD *thd, LEX *lex, select_result *result);
int mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &list,
COND *conds, uint og_num, ORDER *order, ORDER *group,
Item *having, ORDER *proc_param, ulong select_type,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex);
bool handle_select(THD *thd, LEX *lex, select_result *result);
bool mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &list,
COND *conds, uint og_num, ORDER *order, ORDER *group,
Item *having, ORDER *proc_param, ulong select_type,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex);
void free_underlaid_joins(THD *thd, SELECT_LEX *select);
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);
int mysql_explain_select(THD *thd, SELECT_LEX *sl, char const *type,
select_result *result);
int mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit);
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit);
int mysql_handle_derived(LEX *lex);
Field *create_tmp_field(THD *thd, TABLE *table,Item *item, Item::Type type,
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,
handler *file, KEY *&key_info_buffer,
uint &key_count, int select_field_count);
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys,
bool tmp_table, uint select_field_count);
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields, List<Key> &keys,
bool tmp_table, uint select_field_count);
TABLE *create_table_from_items(THD *thd, HA_CREATE_INFO *create_info,
TABLE_LIST *create_table,
List<create_field> *extra_fields,
List<Key> *keys,
List<Item> *items,
MYSQL_LOCK **lock);
int mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
List<create_field> &fields,
List<Key> &keys,
uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok=1);
int mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
int mysql_create_like_table(THD *thd, TABLE_LIST *table,
HA_CREATE_INFO *create_info,
Table_ident *src_table);
MYSQL_LOCK **lock);
bool mysql_alter_table(THD *thd, char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
List<create_field> &fields,
List<Key> &keys,
uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok=1);
bool mysql_recreate_table(THD *thd, TABLE_LIST *table_list, bool do_send_ok);
bool mysql_create_like_table(THD *thd, TABLE_LIST *table,
HA_CREATE_INFO *create_info,
Table_ident *src_table);
bool mysql_rename_table(enum db_type base,
const char *old_db,
const char * old_name,
const char *new_db,
const char * new_name);
int mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
int mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info);
bool mysql_create_index(THD *thd, TABLE_LIST *table_list, List<Key> &keys);
bool mysql_drop_index(THD *thd, TABLE_LIST *table_list,
ALTER_INFO *alter_info);
int mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
Item **conds, uint order_num, ORDER *order);
int mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit,
enum enum_duplicates handle_duplicates);
int mysql_multi_update(THD *thd, TABLE_LIST *table_list,
List<Item> *fields, List<Item> *values,
COND *conds, ulong options,
enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
int mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
List<Item> &fields, List_item *values,
List<Item> &update_fields,
List<Item> &update_values, enum_duplicates duplic);
int mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates flag);
bool mysql_update(THD *thd,TABLE_LIST *tables,List<Item> &fields,
List<Item> &values,COND *conds,
uint order_num, ORDER *order, ha_rows limit,
enum enum_duplicates handle_duplicates);
bool mysql_multi_update(THD *thd, TABLE_LIST *table_list,
List<Item> *fields, List<Item> *values,
COND *conds, ulong options,
enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex);
bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list, TABLE *table,
List<Item> &fields, List_item *values,
List<Item> &update_fields,
List<Item> &update_values, enum_duplicates duplic);
bool mysql_insert(THD *thd,TABLE_LIST *table,List<Item> &fields,
List<List_item> &values, List<Item> &update_fields,
List<Item> &update_values, enum_duplicates flag);
int check_that_all_fields_are_given_values(THD *thd, TABLE *entry);
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
int mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
ha_rows rows, ulong options);
int 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_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds);
bool mysql_delete(THD *thd, TABLE_LIST *table, COND *conds, SQL_LIST *order,
ha_rows rows, ulong options);
bool mysql_truncate(THD *thd, TABLE_LIST *table_list, bool dont_send_ok);
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_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT* mem,
bool *refresh);
@ -683,45 +683,45 @@ void free_des_key_file();
#endif /* HAVE_OPENSSL */
/* sql_do.cc */
int mysql_do(THD *thd, List<Item> &values);
bool mysql_do(THD *thd, List<Item> &values);
/* sql_show.cc */
int mysqld_show_dbs(THD *thd,const char *wild);
int mysqld_show_open_tables(THD *thd,const char *wild);
int mysqld_show_tables(THD *thd, const char *db, const char *wild,
bool verbose);
int 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 verbose);
int mysqld_show_keys(THD *thd, TABLE_LIST *table);
int mysqld_show_logs(THD *thd);
bool mysqld_show_dbs(THD *thd,const char *wild);
bool mysqld_show_open_tables(THD *thd,const char *wild);
bool mysqld_show_tables(THD *thd, const char *db, const char *wild,
bool verbose);
bool mysqld_extend_show_tables(THD *thd,const char *db,const char *wild);
bool mysqld_show_fields(THD *thd,TABLE_LIST *table, const char *wild,
bool verbose);
bool mysqld_show_keys(THD *thd, TABLE_LIST *table);
bool mysqld_show_logs(THD *thd);
void append_identifier(THD *thd, String *packet, const char *name,
uint length);
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_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(THD *thd, TABLE_LIST *table_list);
bool mysqld_show_create_db(THD *thd, char *dbname, HA_CREATE_INFO *create);
void mysqld_list_processes(THD *thd,const char *user,bool verbose);
int mysqld_show_status(THD *thd);
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,
pthread_mutex_t *mutex,
struct system_status_var *status_var);
int mysql_find_files(THD *thd,List<char> *files, const char *db,
const char *path, const char *wild, bool dir);
int mysqld_show_charsets(THD *thd,const char *wild);
int mysqld_show_collations(THD *thd,const char *wild);
int mysqld_show_storage_engines(THD *thd);
int mysqld_show_privileges(THD *thd);
int mysqld_show_column_types(THD *thd);
int mysqld_help (THD *thd, const char *text);
bool mysqld_show_charsets(THD *thd,const char *wild);
bool mysqld_show_collations(THD *thd,const char *wild);
bool mysqld_show_storage_engines(THD *thd);
bool mysqld_show_privileges(THD *thd);
bool mysqld_show_column_types(THD *thd);
bool mysqld_help (THD *thd, const char *text);
void calc_sum_of_all_status(STATUS_VAR *to);
/* sql_prepare.cc */
int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
LEX_STRING *name=NULL);
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
LEX_STRING *name=NULL);
void mysql_stmt_execute(THD *thd, char *packet, uint packet_length);
void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name);
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,
uint code, const char *format, ...);
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 */
int mysql_ha_open(THD *thd, TABLE_LIST *tables);
int mysql_ha_close(THD *thd, TABLE_LIST *tables,
bool dont_send_ok=0, bool dont_lock=0, bool no_alias=0);
bool mysql_ha_open(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);
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 *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
bool mysql_ha_read(THD *, TABLE_LIST *,enum enum_ha_read_modes,char *,
List<Item> *,enum ha_rkey_function,Item *,ha_rows,ha_rows);
/* sql_base.cc */
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);
int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
List<Item> *sum_func_list, uint wild_num);
int setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
List<Item> &item, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func);
bool setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,
List<Item> &item, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func);
int setup_conds(THD *thd,TABLE_LIST *tables,COND **conds);
int setup_ftfuncs(SELECT_LEX* select);
int init_ftfuncs(THD *thd, SELECT_LEX* select, bool no_order);
void wait_for_refresh(THD *thd);
int open_tables(THD *thd, TABLE_LIST *tables, uint *counter);
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);
TABLE *open_temporary_table(THD *thd, const char *path, const char *db,
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);
/* sql_load.cc */
int mysql_load(THD *thd,sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates,
bool local_file,thr_lock_type lock_type);
bool mysql_load(THD *thd,sql_exchange *ex, TABLE_LIST *table_list,
List<Item> &fields, enum enum_duplicates handle_duplicates,
bool local_file,thr_lock_type lock_type);
int write_record(THD *thd, TABLE *table, COPY_INFO *info);
/* sql_manager.cc */

View file

@ -1145,7 +1145,7 @@ static void server_init(void)
WSADATA 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);
}
}
@ -1298,8 +1298,9 @@ void yyerror(const char *s)
/* "parse error" changed into "syntax error" between bison 1.75 and 1.875 */
if (strcmp(s,"parse error") == 0 || strcmp(s,"syntax error") == 0)
s=ER(ER_SYNTAX_ERROR);
net_printf(thd,ER_PARSE_ERROR, s, yytext ? (char*) yytext : "",
thd->lex->yylineno);
my_printf_error(ER_PARSE_ERROR, ER(ER_PARSE_ERROR), MYF(0), s,
(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 (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 */
}
if (lock)
@ -2091,6 +2092,11 @@ extern "C" int my_message_sql(uint error, const char *str,
THD *thd;
DBUG_ENTER("my_message_sql");
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->spcont &&
@ -2098,6 +2104,9 @@ extern "C" int my_message_sql(uint error, const char *str,
{
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
(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->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
{
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)",
error));
thread_count--;
thd->killed= THD::KILL_CONNECTION; // Safety
thd->killed= THD::KILL_CONNECTION; // Safety
(void) pthread_mutex_unlock(&LOCK_thread_count);
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);
close_connection(thd,0,0);
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 */
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
uint length;
char buff[MYSQL_ERRMSG_SIZE+2], *pos;
#endif
NET *net= &thd->net;
DBUG_ENTER("send_error");
DBUG_ENTER("net_send_error");
DBUG_PRINT("enter",("sql_errno: %d err: %s", sql_errno,
err ? err : net->last_error[0] ?
net->last_error : "NULL"));
@ -70,9 +70,6 @@ void send_error(THD *thd, uint sql_errno, const char *err)
{
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
if (!err)
{
@ -172,7 +169,7 @@ void send_warning(THD *thd, uint sql_errno, const char *err)
*/
void
net_printf(THD *thd, uint errcode, ...)
net_printf_error(THD *thd, uint errcode, ...)
{
va_list args;
uint length,offset;
@ -185,7 +182,7 @@ net_printf(THD *thd, uint errcode, ...)
#endif
NET *net= &thd->net;
DBUG_ENTER("net_printf");
DBUG_ENTER("net_printf_error");
DBUG_PRINT("enter",("message: %u",errcode));
if (thd->spcont && thd->spcont->find_handler(errcode,
@ -199,8 +196,8 @@ net_printf(THD *thd, uint errcode, ...)
#endif
va_start(args,errcode);
/*
The following is needed to make net_printf() work with 0 argument for
errorcode and use the argument after that as the format string. This
The following is needed to make net_printf_error() work with 0 argument
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
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));
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 */
}

View file

@ -172,7 +172,8 @@ public:
};
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,
const char *info=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);
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 */
}

View file

@ -196,7 +196,6 @@ err:
my_message(ER_UNKNOWN_ERROR, "Wrong parameters to function register_slave",
MYF(0));
err2:
send_error(thd);
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().
*/
int show_new_master(THD* thd)
bool show_new_master(THD* thd)
{
Protocol *protocol= thd->protocol;
DBUG_ENTER("show_new_master");
@ -454,7 +453,7 @@ int show_new_master(THD* thd)
if (errmsg[0])
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
"SHOW NEW MASTER", errmsg);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
else
{
@ -463,14 +462,14 @@ int show_new_master(THD* thd)
MYSQL_TYPE_LONGLONG));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
protocol->prepare_for_resend();
protocol->store(lex_mi->log_file_name, &my_charset_bin);
protocol->store((ulonglong) lex_mi->pos);
if (protocol->write())
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
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;
Protocol *protocol= thd->protocol;
@ -655,7 +654,7 @@ int show_slave_hosts(THD* thd)
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
pthread_mutex_lock(&LOCK_slave_list);
@ -676,12 +675,12 @@ int show_slave_hosts(THD* thd)
if (protocol->write())
{
pthread_mutex_unlock(&LOCK_slave_list);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
}
pthread_mutex_unlock(&LOCK_slave_list);
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)
*/
int load_master_data(THD* thd)
bool load_master_data(THD* thd)
{
MYSQL mysql;
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,
1 /*skip lock*/)))
{
send_error(thd,error);
my_error(error, MYF(0));
unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi);
return 1;
return TRUE;
}
if (connect_to_master(thd, &mysql, active_mi))
{
net_printf(thd, error= ER_CONNECT_TO_MASTER,
mysql_error(&mysql));
my_error(error= ER_CONNECT_TO_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@ -805,8 +803,7 @@ int load_master_data(THD* thd)
if (mysql_real_query(&mysql, "SHOW DATABASES", 14) ||
!(db_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mysql_error(&mysql));
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@ -819,7 +816,7 @@ int load_master_data(THD* thd)
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;
}
@ -833,8 +830,7 @@ int load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW MASTER STATUS",18) ||
!(master_status_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mysql_error(&mysql));
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
@ -879,7 +875,6 @@ int load_master_data(THD* thd)
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);
goto err;
}
@ -888,8 +883,7 @@ int load_master_data(THD* thd)
mysql_real_query(&mysql, "SHOW TABLES", 11) ||
!(*cur_table_res = mysql_store_result(&mysql)))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mysql_error(&mysql));
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
cleanup_mysql_results(db_res, cur_table_res - 1, table_res);
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,
0))
send_error(thd, ER_MASTER_INFO);
my_error(ER_MASTER_INFO, MYF(0));
strmake(active_mi->master_log_name, row[0],
sizeof(active_mi->master_log_name));
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))
{
net_printf(thd, error = ER_QUERY_ON_MASTER,
mysql_error(&mysql));
my_error(error = ER_QUERY_ON_MASTER, MYF(0), mysql_error(&mysql));
goto err;
}
}
@ -956,10 +949,10 @@ int load_master_data(THD* thd)
0 /* not only reset, but also reinit */,
&errmsg))
{
send_error(thd, 0, "Failed purging old relay logs");
my_error(ER_RELAY_LOG_FAIL, MYF(0), errmsg);
unlock_slave_threads(active_mi);
pthread_mutex_unlock(&LOCK_active_mi);
return 1;
return TRUE;
}
pthread_mutex_lock(&active_mi->rli.data_lock);
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;
int load_master_data(THD* thd);
bool load_master_data(THD* thd);
int connect_to_master(THD *thd, MYSQL* mysql, MASTER_INFO* mi);
int show_new_master(THD* thd);
int show_slave_hosts(THD* thd);
bool show_new_master(THD* thd);
bool show_slave_hosts(THD* thd);
int translate_master(THD* thd, LEX_MASTER_INFO* mi, char* errmsg);
void init_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)
{
net_printf(thd, ER_INCORRECT_GLOBAL_LOCAL_VAR,
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
my_error(ER_INCORRECT_GLOBAL_LOCAL_VAR, MYF(0),
name, var_type == OPT_GLOBAL ? "SESSION" : "GLOBAL");
return 0;
}
/* 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;
}
default:
net_printf(thd, ER_VAR_CANT_BE_READ, name);
my_error(ER_VAR_CANT_BE_READ, MYF(0), name);
}
return 0;
}
@ -1950,8 +1950,8 @@ bool sys_var_character_set_server::check(THD *thd, set_var *var)
(mysql_bin_log.is_open() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
my_printf_error(0, "Binary logging and replication forbid changing \
the global server character set or collation", MYF(0));
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
"character set, collation");
return 1;
}
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() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
my_printf_error(0, "Binary logging and replication forbid changing \
the global server character set or collation", MYF(0));
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0),
"character set, collation");
return 1;
}
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() ||
active_mi->slave_running || active_mi->rli.slave_running))
{
my_printf_error(0, "Binary logging and replication forbid changing "
"of the global server time zone", MYF(0));
my_error(ER_LOGING_PROHIBIT_CHANGING_OF, MYF(0), "time zone");
return 1;
}
#endif
@ -2686,9 +2685,6 @@ void set_var_free()
length Length of variable. zero means that we should use strlen()
on the variable
NOTE
We have to use net_printf() as this is called during the parsing stage
RETURN VALUES
pointer pointer to variable definitions
0 Unknown variable (error message is given)
@ -2701,7 +2697,7 @@ sys_var *find_sys_var(const char *str, uint length)
length ? length :
strlen(str));
if (!var)
net_printf(current_thd, ER_UNKNOWN_SYSTEM_VARIABLE, (char*) str);
my_error(ER_UNKNOWN_SYSTEM_VARIABLE, MYF(0), (char*) str);
return var;
}

View file

@ -398,3 +398,22 @@ character-set=latin2
"Illegal %s '%-.64s' value found during parsing",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"CHECK OPTION on non-updatable view '%-.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",
"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
if (packet_len == packet_error)
{
send_error(thd, ER_MASTER_NET_READ);
my_error(ER_MASTER_NET_READ, MYF(0));
DBUG_RETURN(1);
}
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 &
CLIENT_PROTOCOL_41) ?
3+SQLSTATE_LENGTH+1 : 3);
net_printf(thd, ER_MASTER, err_msg);
my_error(ER_MASTER, MYF(0), err_msg);
DBUG_RETURN(1);
}
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)))
{
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);
}
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 */
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");
goto err;
}
@ -1544,7 +1543,6 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
tables.lock_type = 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");
goto err;
}
@ -1554,7 +1552,7 @@ static int create_table_from_dump(THD* thd, MYSQL *mysql, const char* db,
/* Copy the data file */
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\
handler::net_read_dump()");
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;
thd->net.vio = save_vio;
if (error)
net_printf(thd, ER_INDEX_REBUILD,tables.table->real_name);
my_error(ER_INDEX_REBUILD, MYF(0), tables.table->real_name);
err:
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)))
{
send_error(thd); // EOM
DBUG_RETURN(1);
}
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);
DBUG_RETURN(1);
}
@ -1626,7 +1623,7 @@ int fetch_master_table(THD *thd, const char *db_name, const char *table_name,
if (!called_connected)
mysql_close(mysql);
if (errmsg && thd->vio_ok())
send_error(thd, error, errmsg);
my_message(error, errmsg, MYF(0));
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
List<Item> field_list;
@ -2327,7 +2324,7 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
if (mi->host[0])
{
@ -2426,10 +2423,10 @@ int show_master_info(THD* thd, MASTER_INFO* mi)
pthread_mutex_unlock(&mi->data_lock);
if (my_net_write(&thd->net, (char*)thd->packet.ptr(), packet->length()))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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_dynamic_array_to_str(String* s, DYNAMIC_ARRAY* a);
int show_master_info(THD* thd, MASTER_INFO* mi);
int show_binlog_info(THD* thd);
bool show_master_info(THD* thd, MASTER_INFO* mi);
bool show_binlog_info(THD* thd);
/* See if the query uses any tables that should not be replicated */
int tables_ok(THD* thd, TABLE_LIST* tables);

View file

@ -1013,7 +1013,7 @@ sp_cache_functions(THD *thd, LEX *lex)
{
delete newlex;
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;
break;
}

View file

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

View file

@ -148,7 +148,7 @@ sp_cursor::pre_open(THD *thd)
{
if (m_isopen)
{
send_error(thd, ER_SP_CURSOR_ALREADY_OPEN);
my_error(ER_SP_CURSOR_ALREADY_OPEN, MYF(0));
return NULL;
}
@ -182,7 +182,7 @@ sp_cursor::close(THD *thd)
{
if (! m_isopen)
{
send_error(thd, ER_SP_CURSOR_NOT_OPEN);
my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0));
return -1;
}
destroy();
@ -212,12 +212,12 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
if (! m_isopen)
{
send_error(thd, ER_SP_CURSOR_NOT_OPEN);
my_error(ER_SP_CURSOR_NOT_OPEN, MYF(0));
return -1;
}
if (m_current_row == NULL)
{
send_error(thd, ER_SP_FETCH_NO_DATA);
my_error(ER_SP_FETCH_NO_DATA, MYF(0));
return -1;
}
@ -229,7 +229,7 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
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;
}
s= row[fldcount];
@ -255,7 +255,7 @@ sp_cursor::fetch(THD *thd, List<struct sp_pvar> *vars)
}
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;
}
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)
{
net_printf(thd,ER_OPTION_PREVENTS_STATEMENT,
"--skip-grant-tables");
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
return(1);
}
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])
{
send_error(thd, ER_PASSWORD_ANONYMOUS_USER);
my_error(ER_PASSWORD_ANONYMOUS_USER, MYF(0));
return(1);
}
uint len=strlen(new_password);
if (len && len != SCRAMBLED_PASSWORD_CHAR_LENGTH &&
len != SCRAMBLED_PASSWORD_CHAR_LENGTH_323)
{
net_printf(thd, 0,
"Password hash should be a %d-digit hexadecimal number",
SCRAMBLED_PASSWORD_CHAR_LENGTH);
my_error(ER_PASSWD_LENGTH, MYF(0), SCRAMBLED_PASSWORD_CHAR_LENGTH);
return -1;
}
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)))
{
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);
}
/* update loaded acl entry: */
@ -1298,7 +1295,6 @@ bool change_password(THD *thd, const char *host, const char *user,
new_password, new_password_len))
{
VOID(pthread_mutex_unlock(&acl_cache->lock)); /* purecov: deadcode */
send_error(thd,0); /* purecov: deadcode */
DBUG_RETURN(1); /* purecov: deadcode */
}
@ -2290,11 +2286,11 @@ table_error:
revoke_grant Set to 1 if this is a REVOKE command
RETURN
0 ok
1 error
FALSE ok
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_COLUMN> &columns, ulong rights,
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),
"--skip-grant-tables"); /* purecov: inspected */
DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(TRUE); /* purecov: inspected */
}
if (rights & ~TABLE_ACLS)
{
my_error(ER_ILLEGAL_GRANT_FOR_TABLE,MYF(0));
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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);
int res;
if ((res= open_and_lock_tables(thd, table_list)))
DBUG_RETURN(res);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
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),
column->column.c_ptr(), table_list->alias);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
column_priv|= column->rights;
}
@ -2353,7 +2349,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
if (access(buf,F_OK))
{
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;
if (!tables_ok(0, tables))
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
#endif
if (simple_open_n_lock_tables(thd,tables))
{ // Should never happen
close_thread_tables(thd); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */
DBUG_RETURN(TRUE); /* purecov: deadcode */
}
if (!revoke_grant)
create_new_users= test_if_create_new_users(thd);
int result=0;
bool result= FALSE;
rw_wrlock(&LOCK_grant);
MEM_ROOT *old_root=my_pthread_getspecific_ptr(MEM_ROOT*,THR_MALLOC);
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)
{
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
result= -1;
result= TRUE;
continue;
}
/* Create user if needed */
@ -2421,7 +2417,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
pthread_mutex_unlock(&acl_cache->lock);
if (error)
{
result= -1; // Remember error
result= TRUE; // Remember error
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),
Str->user.str, Str->host.str, table_list->real_name);
result= -1;
result= TRUE;
continue;
}
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);
if (!grant_table) // end of memory
{
result= -1; /* purecov: deadcode */
result= TRUE; /* purecov: deadcode */
continue; /* purecov: deadcode */
}
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,
rights, column_priv, revoke_grant))
{ // Crashend table ??
result= -1; /* purecov: deadcode */
result= TRUE; /* purecov: deadcode */
}
else if (tables[2].table)
{
@ -2503,7 +2499,7 @@ int mysql_table_grant(THD *thd, TABLE_LIST *table_list,
db_name, real_name,
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,
ulong rights, bool revoke_grant)
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &list,
ulong rights, bool revoke_grant)
{
List_iterator <LEX_USER> str_list (list);
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),
"--skip-grant-tables"); /* purecov: tested */
DBUG_RETURN(-1); /* purecov: tested */
DBUG_RETURN(TRUE); /* purecov: tested */
}
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;
if (!tables_ok(0, tables))
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
#endif
if (simple_open_n_lock_tables(thd,tables))
{ // This should never happen
close_thread_tables(thd); /* purecov: deadcode */
DBUG_RETURN(-1); /* purecov: deadcode */
DBUG_RETURN(TRUE); /* purecov: deadcode */
}
if (!revoke_grant)
@ -2880,11 +2876,11 @@ err:
command= "create view";
else if (want_access & SHOW_VIEW_ACL)
command= "show create view";
net_printf(thd,ER_TABLEACCESS_DENIED_ERROR,
command,
thd->priv_user,
thd->host_or_ip,
table ? table->real_name : "unknown");
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0),
command,
thd->priv_user,
thd->host_or_ip,
table ? table->real_name : "unknown");
}
DBUG_RETURN(1);
}
@ -3146,7 +3142,7 @@ static uint command_lengths[]=
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;
uint counter,index;
@ -3161,7 +3157,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!initialized)
{
my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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)
{
my_error(ER_GRANT_WRONG_HOST_OR_USER,MYF(0));
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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),
lex_user->user.str, lex_user->host.str);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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);
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
@ -3526,7 +3522,7 @@ int open_grant_tables(THD *thd, TABLE_LIST *tables)
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);
}
@ -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;
int result;
@ -3606,7 +3602,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
DBUG_ENTER("mysql_drop_user");
if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result == 1 ? 0 : 1);
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
VOID(pthread_mutex_lock(&acl_cache->lock));
@ -3694,7 +3690,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
record[0])))
{
tables[0].table->file->print_error(error, MYF(0));
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
delete_dynamic_element(&acl_users, acl_userd);
}
@ -3708,7 +3704,7 @@ int mysql_drop_user(THD *thd, List <LEX_USER> &list)
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;
int result;
@ -3717,7 +3713,7 @@ int mysql_revoke_all(THD *thd, List <LEX_USER> &list)
DBUG_ENTER("mysql_revoke_all");
if ((result= open_grant_tables(thd, tables)))
DBUG_RETURN(result == 1 ? 0 : 1);
DBUG_RETURN(result != 1);
rw_wrlock(&LOCK_grant);
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);
bool change_password(THD *thd, const char *host, const char *user,
char *password);
int mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
ulong rights, bool revoke);
int mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights,
bool revoke);
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
ulong rights, bool revoke);
bool mysql_table_grant(THD *thd, TABLE_LIST *table, List <LEX_USER> &user_list,
List <LEX_COLUMN> &column_list, ulong rights,
bool revoke);
my_bool grant_init(THD *thd);
void grant_free(void);
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,
const char *db_name, const char *table_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_mqh(const char *user, const char *host, USER_CONN *uc);
int mysql_drop_user(THD *thd, List <LEX_USER> &list);
int mysql_revoke_all(THD *thd, List <LEX_USER> &list);
bool mysql_drop_user(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,
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
RETURN
0 - ok
-1 - error
1 - error reported to user
FALSE - ok
TRUE - error
NOTE
The lock will automaticly be freed by close_thread_tables()
*/
int open_and_lock_tables(THD *thd, TABLE_LIST *tables)
bool open_and_lock_tables(THD *thd, TABLE_LIST *tables)
{
DBUG_ENTER("open_and_lock_tables");
uint counter;
if (open_tables(thd, tables, &counter) || lock_tables(thd, tables, counter)
|| 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
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
****************************************************************************/
int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func)
bool setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
List<Item> &fields, bool set_query_id,
List<Item> *sum_func_list, bool allow_sum_func)
{
reg2 Item *item;
List_iterator<Item> it(fields);
@ -2629,7 +2628,7 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables,
(item= *(it.ref()))->check_cols(1))
{
select_lex->no_wrap_view_item= 0;
DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(TRUE); /* purecov: inspected */
}
if (ref)
*(ref++)= item;
@ -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);
err:
send_error(thd);
DBUG_RETURN(1);
}

View file

@ -762,7 +762,7 @@ select_result::select_result()
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)
{
::send_error(thd,errcode,err);
my_message(errcode, err, MYF(0));
if (file > 0)
{
(void) end_io_cache(&cache);

View file

@ -1112,6 +1112,7 @@ public:
net.last_error[0]= 0;
net.last_errno= 0;
net.report_error= 0;
query_error= 0;
}
inline bool vio_ok() const { return net.vio != 0; }
#else
@ -1195,8 +1196,6 @@ public:
class JOIN;
void send_error(THD *thd, uint sql_errno=0, const char *err=0);
class select_result :public Sql_alloc {
protected:
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.
RETURN VALUES
0 ok
-1 Error
FALSE ok
TRUE Error
*/
int mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent)
bool mysql_create_db(THD *thd, char *db, HA_CREATE_INFO *create_info,
bool silent)
{
char path[FN_REFLEN+16];
long result= 1;
@ -489,7 +489,7 @@ exit2:
/* 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];
long result=1;
@ -532,7 +532,7 @@ exit:
start_waiting_global_read_lock(thd);
exit2:
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
RETURN
0 ok (Database dropped)
-1 Error generated
FALSE ok (Database dropped)
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;
int error= 0;
@ -985,12 +985,12 @@ bool mysql_change_db(THD *thd, const char *name)
if (!dbname || !(db_length= strlen(dbname)))
{
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 */
}
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);
DBUG_RETURN(1);
}
@ -1003,10 +1003,10 @@ bool mysql_change_db(THD *thd, const char *name)
thd->master_access);
if (!(db_access & DB_ACLS) && (!grant_option || check_grant_db(thd,dbname)))
{
net_printf(thd,ER_DBACCESS_DENIED_ERROR,
thd->priv_user,
thd->priv_host,
dbname);
my_error(ER_DBACCESS_DENIED_ERROR, MYF(0),
thd->priv_user,
thd->priv_host,
dbname);
mysql_log.write(thd,COM_INIT_DB,ER(ER_DBACCESS_DENIED_ERROR),
thd->priv_user,
thd->priv_host,
@ -1021,7 +1021,7 @@ bool mysql_change_db(THD *thd, const char *name)
path[length-1]=0; // remove ending '\'
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));
DBUG_RETURN(1);
}

View file

@ -29,8 +29,8 @@
#include "sp_head.h"
#include "sql_trigger.h"
int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
ha_rows limit, ulong options)
bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
SQL_LIST *order, ha_rows limit, ulong options)
{
int error;
TABLE *table;
@ -41,22 +41,22 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
ha_rows deleted;
DBUG_ENTER("mysql_delete");
if ((error= open_and_lock_tables(thd, table_list)))
DBUG_RETURN(error);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
table= table_list->table;
table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK);
thd->proc_info="init";
table->map=1;
if ((error= mysql_prepare_delete(thd, table_list, &conds)))
DBUG_RETURN(error);
if (mysql_prepare_delete(thd, table_list, &conds))
DBUG_RETURN(TRUE);
const_cond= (!conds || conds->const_item());
safe_update=test(thd->options & OPTION_SAFE_UPDATES);
if (safe_update && const_cond)
{
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0));
DBUG_RETURN(TRUE);
}
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'
select=make_select(table,0,0,conds,&error);
if (error)
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
if ((select && select->check_quick(thd, safe_update, limit)) || !limit)
{
delete select;
@ -103,8 +103,8 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{
delete select;
free_underlaid_joins(thd, &thd->lex->select_lex);
send_error(thd,ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE);
DBUG_RETURN(1);
my_error(ER_UPDATE_WITHOUT_KEY_IN_SAFE_MODE, MYF(0));
DBUG_RETURN(TRUE);
}
}
if (options & OPTION_QUICK)
@ -135,7 +135,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{
delete select;
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,
@ -150,7 +150,7 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
{
delete select;
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);
deleted=0L;
@ -253,15 +253,13 @@ cleanup:
thd->lock=0;
}
free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0 || thd->net.report_error)
send_error(thd,thd->killed_errno());
else
if (error < 0)
{
thd->row_count_func= deleted;
send_ok(thd,deleted);
DBUG_PRINT("info",("%d records deleted",deleted));
}
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
@ -275,11 +273,10 @@ cleanup:
conds - conditions
RETURN VALUE
0 - OK
1 - error (message is sent to user)
-1 - error (message is not sent to user)
FALSE OK
TRUE error
*/
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;
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) ||
setup_conds(thd, table_list, conds) ||
setup_ftfuncs(select_lex))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
if (!table_list->updatable || check_key_in_view(thd, table_list))
{
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()))
{
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);
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
RETURN
0 OK
-1 Error
FALSE OK
TRUE Error
*/
int mysql_multi_delete_prepare(THD *thd)
bool mysql_multi_delete_prepare(THD *thd)
{
LEX *lex= thd->lex;
TABLE_LIST *aux_tables= (TABLE_LIST *)lex->auxilliary_table_list.first;
TABLE_LIST *target_tbl;
int res= 0;
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
*/
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 */
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,
"DELETE");
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
/*
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),
target_tbl->correspondent_table->real_name);
res= -1;
break;
DBUG_RETURN(TRUE);
}
}
}
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");
/* First send error what ever it is ... */
::send_error(thd,errcode,err);
my_message(errcode, err, MYF(0));
/* If nothing deleted return */
if (!deleted)
@ -668,9 +663,7 @@ bool multi_delete::send_eof()
if (ha_autocommit_or_rollback(thd,local_error > 0))
local_error=1;
if (local_error)
::send_error(thd);
else
if (!local_error)
{
thd->row_count_func= 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.
*/
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;
char path[FN_REFLEN];
TABLE **table_ptr;
int error;
bool error;
DBUG_ENTER("mysql_truncate");
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,
table_list->real_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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));
}
if (lock_and_wait_for_table_name(thd, table_list))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
*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);
end:
@ -779,5 +772,5 @@ end:
unlock_table_name(thd, table_list);
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 "sql_acl.h"
int mysql_do(THD *thd, List<Item> &values)
bool mysql_do(THD *thd, List<Item> &values)
{
List_iterator<Item> li(values);
Item *value;
DBUG_ENTER("mysql_do");
if (setup_fields(thd, 0, 0, values, 0, 0, 0))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
while ((value = li++))
value->val_int();
thd->clear_error(); // DO always is OK
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
RETURN VALUES
0 ok
1 Error sending data to client
FALSE ok
TRUE Error sending data to client
*/
static const char *warning_level_names[]= {"Note", "Warning", "Error", "?"};
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;
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,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
MYSQL_ERROR *err;
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(err->msg, strlen(err->msg), system_charset_info);
if (protocol->write())
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
if (!--limit)
break;
}
send_eof(thd);
DBUG_RETURN(0);
send_eof(thd);
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 *was_flushed);
int mysql_ha_open(THD *thd, TABLE_LIST *tables)
bool mysql_ha_open(THD *thd, TABLE_LIST *tables)
{
HANDLER_TABLES_HACK(thd);
uint counter;
@ -58,18 +58,18 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
HANDLER_TABLES_HACK(thd);
if (err)
return -1;
return TRUE;
// there can be only one table in *tables
if (!(tables->table->file->table_flags() & HA_CAN_SQL_HANDLER))
{
my_printf_error(ER_ILLEGAL_HA,ER(ER_ILLEGAL_HA),MYF(0), tables->alias);
mysql_ha_close(thd, tables,1);
return -1;
return TRUE;
}
send_ok(thd);
return 0;
return FALSE;
}
@ -98,11 +98,11 @@ int mysql_ha_open(THD *thd, TABLE_LIST *tables)
is suppressed.
RETURN
0 ok
-1 error
FALSE OK
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)
{
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),
tables->alias, "HANDLER");
return -1;
return TRUE;
}
if (!dont_send_ok)
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 };
int mysql_ha_read(THD *thd, TABLE_LIST *tables,
enum enum_ha_read_modes mode, char *keyname,
List<Item> *key_expr,
enum ha_rkey_function ha_rkey_mode, Item *cond,
ha_rows select_limit,ha_rows offset_limit)
bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
enum enum_ha_read_modes mode, char *keyname,
List<Item> *key_expr,
enum ha_rkey_function ha_rkey_mode, Item *cond,
ha_rows select_limit,ha_rows offset_limit)
{
int err, keyno=-1;
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),
tables->alias,"HANDLER");
return -1;
return TRUE;
}
tables->table=table;
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 */
@ -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),
keyname,tables->alias);
return -1;
return TRUE;
}
table->file->ha_index_or_rnd_end();
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;
}
if (!(key= (byte*) thd->calloc(ALIGN_SIZE(key_len))))
{
send_error(thd,ER_OUTOFMEMORY);
goto err;
}
key_copy(key, table->record[0], table->key_info + keyno, key_len);
err=table->file->index_read(table->record[0],
key,key_len,ha_rkey_mode);
@ -344,7 +341,7 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
break;
}
default:
send_error(thd,ER_ILLEGAL_HA);
my_error(ER_ILLEGAL_HA, MYF(0));
goto err;
}
@ -384,11 +381,11 @@ int mysql_ha_read(THD *thd, TABLE_LIST *tables,
ok:
mysql_unlock_tables(thd,lock);
send_eof(thd);
return 0;
return FALSE;
err:
mysql_unlock_tables(thd,lock);
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,
&relations->keynames, 1+2)-1)<0)
{
send_error(thd,ER_CORRUPT_HELP_DB);
my_error(ER_CORRUPT_HELP_DB, 0);
DBUG_RETURN(-1);
}
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
RETURN VALUES
0 Success
1 Error and send_error already commited
-1 error && send_error should be issued (normal case)
FALSE Success
TRUE Error and send_error already commited
*/
int mysqld_help(THD *thd, const char *mask)
bool mysqld_help(THD *thd, const char *mask)
{
Protocol *protocol= thd->protocol;
SQL_SELECT *select;
@ -640,8 +639,8 @@ int mysqld_help(THD *thd, const char *mask)
uint mlen= strlen(mask);
MEM_ROOT *mem_root= &thd->mem_root;
if ((res= open_and_lock_tables(thd, tables)))
goto end;
if (open_and_lock_tables(thd, tables))
goto error;
/*
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);
memcpy((char*) used_fields, (char*) init_used_fields, sizeof(used_fields));
if (init_fields(thd, tables, used_fields, array_elements(used_fields)))
{
res= -1;
goto end;
}
goto error;
size_t i;
for (i=0; i<sizeof(tables)/sizeof(TABLE_LIST); i++)
tables[i].table->file->init_table_handle_for_HANDLER();
@ -661,12 +657,8 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[0].table,
used_fields[help_topic_name].field,&error)))
{
res= -1;
goto end;
}
goto error;
res= 1;
count_topics= search_topics(thd,tables[0].table,used_fields,
select,&topics_list,
&name, &description, &example);
@ -678,10 +670,8 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[3].table,
used_fields[help_keyword_name].field,&error)))
{
res= -1;
goto end;
}
goto error;
count_topics=search_keyword(thd,tables[3].table,used_fields,select,&key_id);
delete select;
count_topics= (count_topics != 1) ? 0 :
@ -697,10 +687,7 @@ int mysqld_help(THD *thd, const char *mask)
if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error)))
{
res= -1;
goto end;
}
goto error;
count_categories= search_categories(thd, tables[1].table, used_fields,
select,
@ -709,13 +696,13 @@ int mysqld_help(THD *thd, const char *mask)
if (!count_categories)
{
if (send_header_2(protocol,FALSE))
goto end;
goto error;
}
else if (count_categories > 1)
{
if (send_header_2(protocol,FALSE) ||
send_variant_2_list(mem_root,protocol,&categories_list,"Y",0))
goto end;
goto error;
}
else
{
@ -728,20 +715,14 @@ int mysqld_help(THD *thd, const char *mask)
new Item_int((int32)category_id));
if (!(select= prepare_simple_select(thd,cond_topic_by_cat,
tables,tables[0].table,&error)))
{
res= -1;
goto end;
}
goto error;
get_all_items_for_category(thd,tables[0].table,
used_fields[help_topic_name].field,
select,&topics_list);
delete select;
if (!(select= prepare_simple_select(thd,cond_cat_by_cat,tables,
tables[1].table,&error)))
{
res= -1;
goto end;
}
goto error;
get_all_items_for_category(thd,tables[1].table,
used_fields[help_category_name].field,
select,&subcategories_list);
@ -750,39 +731,36 @@ int mysqld_help(THD *thd, const char *mask)
if (send_header_2(protocol, true) ||
send_variant_2_list(mem_root,protocol,&topics_list, "N",cat) ||
send_variant_2_list(mem_root,protocol,&subcategories_list,"Y",cat))
goto end;
goto error;
}
}
else if (count_topics == 1)
{
if (send_answer_1(protocol,&name,&description,&example))
goto end;
goto error;
}
else
{
/* First send header and functions */
if (send_header_2(protocol, FALSE) ||
send_variant_2_list(mem_root,protocol, &topics_list, "N", 0))
goto end;
goto error;
if (!(select=
prepare_select_for_name(thd,mask,mlen,tables,tables[1].table,
used_fields[help_category_name].field,&error)))
{
res= -1;
goto end;
}
goto error;
search_categories(thd, tables[1].table, used_fields,
select,&categories_list, 0);
delete select;
/* Then send categories */
if (send_variant_2_list(mem_root,protocol, &categories_list, "Y", 0))
goto end;
goto error;
}
res= 0;
send_eof(thd);
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,
List<Item> &fields,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
enum_duplicates duplic)
bool mysql_insert(THD *thd,TABLE_LIST *table_list,
List<Item> &fields,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
enum_duplicates duplic)
{
int error, res;
/*
@ -174,7 +174,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
my_printf_error(ER_DELAYED_INSERT_TABLE_LOCKED,
ER(ER_DELAYED_INSERT_TABLE_LOCKED),
MYF(0), table_list->real_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
}
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 */
res= open_and_lock_tables(thd, table_list);
if (res || thd->is_fatal_error)
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
table= table_list->table;
thd->proc_info="init";
@ -298,6 +298,15 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
info.records++;
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;
break;
}
@ -315,6 +324,9 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
info.records++;
continue;
}
/* Field::store methods can't send errors */
if (!thd->net.report_error)
my_error(ER_UNKNOWN_ERROR, MYF(0));
error=1;
break;
}
@ -465,7 +477,7 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list,
free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=0;
thd->abort_on_warning= 0;
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
abort:
#ifndef EMBEDDED_LIBRARY
@ -475,7 +487,7 @@ abort:
free_underlaid_joins(thd, &thd->lex->select_lex);
table->insert_values=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
RETURN VALUE
0 OK
-1 error (message is not sent to user)
FALSE OK
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> &update_fields, List<Item> &update_values,
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);
/* TODO: use this condition for 'WITH CHECK OPTION' */
Item *unused_conds= 0;
int res;
bool res;
DBUG_ENTER("mysql_prepare_insert");
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,
res) ||
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()))
{
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;
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);
restore_record(table,record[1]);
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;
}
/* CHECK OPTION for VIEW ... ON DUPLICATE KEY UPDATE ... */
if (info->view &&
@ -1018,7 +1035,7 @@ static TABLE *delayed_get_table(THD *thd,TABLE_LIST *table_list)
delete tmp;
thd->fatal_error();
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);
}
@ -1648,11 +1665,11 @@ bool delayed_insert::handle_inserts(void)
thd thread handler
RETURN
0 OK
-1 Error
FALSE OK
TRUE Error
*/
int mysql_insert_select_prepare(THD *thd)
bool mysql_insert_select_prepare(THD *thd)
{
LEX *lex= thd->lex;
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,
lex->field_list,
&lex->select_lex.where))
DBUG_RETURN(-1);
DBUG_RETURN(0);
DBUG_RETURN(TRUE);
DBUG_RETURN(FALSE);
}
@ -1768,8 +1785,7 @@ void select_insert::send_error(uint errcode,const char *err)
{
DBUG_ENTER("select_insert::send_error");
/* TODO error should be sent at the query processing end */
::send_error(thd,errcode,err);
my_message(errcode, err, MYF(0));
if (!table)
{
@ -1845,8 +1861,6 @@ bool select_insert::send_eof()
if (error)
{
table->file->print_error(error,MYF(0));
//TODO error should be sent at the query processing end
::send_error(thd);
DBUG_RETURN(1);
}
char buff[160];

View file

@ -340,8 +340,8 @@ protected:
TABLE *table; /* temporary table using for appending UNION results */
select_result *result;
int res;
ulong found_rows_for_union;
bool res;
bool prepared, // prepare phase already performed for UNION (unit)
optimized, // optimize phase already performed for UNION (unit)
executed, // already executed
@ -400,9 +400,9 @@ public:
void exclude_tree();
/* UNION methods */
int prepare(THD *thd, select_result *result, ulong additional_options);
int exec();
int cleanup();
bool prepare(THD *thd, select_result *result, ulong additional_options);
bool exec();
bool cleanup();
inline void unclean() { cleaned= 0; }
void reinit_exec_mechanism();
@ -410,7 +410,7 @@ public:
void print(String *str);
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);
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,
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,
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),
MYF(0));
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
table_list->lock_type= lock_type;
if ((res= open_and_lock_tables(thd, table_list)))
DBUG_RETURN(res);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
/* TODO: add key check when we will support VIEWs in LOAD */
if (!table_list->updatable)
{
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "LOAD");
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
table= table_list->table;
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;
if (setup_tables(thd, table_list, &unused_conds) ||
setup_fields(thd, 0, table_list, fields, 1, 0, 0))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
if (thd->dupp_field)
{
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))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
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),
MYF(0));
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
/* 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__)
MY_STAT stat_info;
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 (!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)))
{
my_error(ER_TEXTFILE_NOT_READABLE,MYF(0),name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if ((stat_info.st_mode & S_IFIFO) == S_IFIFO)
is_fifo = 1;
#endif
}
if ((file=my_open(name,O_RDONLY,MYF(MY_WME))) < 0)
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
COPY_INFO info;
@ -240,7 +240,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
{
if (file >= 0)
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

View file

@ -47,13 +47,12 @@ mapped_files::mapped_files(const my_string filename,byte *magic,uint magic_lengt
0L)))
{
error=errno;
my_printf_error(0,"Can't map file: %s, errno: %d",MYF(0),
(my_string) name,error);
my_error(ER_NO_FILE_MAPPING,MYF(0), (my_string) name, error);
}
}
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));
map=0;
}
@ -112,8 +111,7 @@ mapped_files *map_file(const my_string name,byte *magic,uint magic_length)
{
map->use_count++;
if (!map->map)
my_printf_error(0,"Can't map file: %s, error: %d",MYF(0),path,
map->error);
my_error(ER_NO_FILE_MAPPING, MYF(0), path, map->error);
}
VOID(pthread_mutex_unlock(&LOCK_mapped_file));
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 enum_send_error { DONT_SEND_ERROR= 0, SEND_ERROR };
/*
Seek prepared statement in statement map by id: returns zero if statement
was not found, pointer otherwise.
*/
static Prepared_statement *
find_prepared_statement(THD *thd, ulong id, const char *where,
enum enum_send_error se)
find_prepared_statement(THD *thd, ulong id, const char *where)
{
Statement *stmt= thd->stmt_map.find(id);
@ -139,8 +136,6 @@ find_prepared_statement(THD *thd, ulong id, const char *where,
{
char llbuf[22];
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), 22, llstr(id, llbuf), where);
if (se == SEND_ERROR)
send_error(thd);
return 0;
}
return (Prepared_statement *) stmt;
@ -180,7 +175,7 @@ static bool send_prep_stmt(Prepared_statement *stmt,
thd->client_stmt_id= stmt->id;
thd->client_param_count= stmt->param_count;
thd->net.last_errno= 0;
thd->clear_error();
return 0;
}
@ -881,24 +876,23 @@ static bool insert_params_from_vars_with_log(Prepared_statement *stmt,
tables global/local table list
RETURN VALUE
0 ok
1 error, sent to the client
-1 error, not sent to client
FALSE OK
TRUE error
*/
static int mysql_test_insert(Prepared_statement *stmt,
TABLE_LIST *table_list,
List<Item> &fields,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
enum_duplicates duplic)
static bool mysql_test_insert(Prepared_statement *stmt,
TABLE_LIST *table_list,
List<Item> &fields,
List<List_item> &values_list,
List<Item> &update_fields,
List<Item> &update_values,
enum_duplicates duplic)
{
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
List_iterator_fast<List_item> its(values_list);
List_item *values;
int res;
bool res;
my_bool update= (lex->value_list.elements ? UPDATE_ACL : 0);
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
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++))
@ -958,14 +952,13 @@ error:
tables list of tables queries
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error
*/
static int mysql_test_update(Prepared_statement *stmt,
TABLE_LIST *table_list)
static bool mysql_test_update(Prepared_statement *stmt,
TABLE_LIST *table_list)
{
int res;
bool res;
THD *thd= stmt->thd;
SELECT_LEX *select= &stmt->lex->select_lex;
DBUG_ENTER("mysql_test_update");
@ -1010,28 +1003,27 @@ static int mysql_test_update(Prepared_statement *stmt,
tables list of tables queries
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error
*/
static int mysql_test_delete(Prepared_statement *stmt,
TABLE_LIST *table_list)
{
int res;
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
DBUG_ENTER("mysql_test_delete");
if ((res= delete_precheck(thd, table_list)))
DBUG_RETURN(res);
if (delete_precheck(thd, table_list))
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();
DBUG_RETURN(FALSE)
}
/* 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
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error, sent to client
*/
static int mysql_test_select(Prepared_statement *stmt,
@ -1057,7 +1048,7 @@ static int mysql_test_select(Prepared_statement *stmt,
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
SELECT_LEX_UNIT *unit= &lex->unit;
int result;
bool result;
DBUG_ENTER("mysql_test_select");
#ifndef NO_EMBEDDED_ACCESS_CHECKS
@ -1065,26 +1056,21 @@ static int mysql_test_select(Prepared_statement *stmt,
if (tables)
{
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))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
#endif
if ((result= open_and_lock_tables(thd, tables)))
{
result= 1; // Error sent
send_error(thd);
goto err;
}
result= 1;
result= TRUE;
thd->used_tables= 0; // Updated by setup_fields
// JOIN::prepare calls
if (unit->prepare(thd, 0, 0))
{
send_error(thd);
goto err_prep;
}
if (!text_protocol)
@ -1106,7 +1092,7 @@ static int mysql_test_select(Prepared_statement *stmt,
goto err_prep;
}
}
result= 0; // ok
result= FALSE; // ok
err_prep:
unit->cleanup();
@ -1125,30 +1111,27 @@ err:
values list of expressions
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error, sent to client
*/
static int mysql_test_do_fields(Prepared_statement *stmt,
static bool mysql_test_do_fields(Prepared_statement *stmt,
TABLE_LIST *tables,
List<Item> *values)
{
DBUG_ENTER("mysql_test_do_fields");
THD *thd= stmt->thd;
int res= 0;
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
DBUG_RETURN(res);
bool res;
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
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);
stmt->lex->unit.cleanup();
if (res)
DBUG_RETURN(-1);
DBUG_RETURN(0);
DBUG_RETURN(res);
}
@ -1162,22 +1145,21 @@ static int mysql_test_do_fields(Prepared_statement *stmt,
values list of expressions
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error
*/
static int mysql_test_set_fields(Prepared_statement *stmt,
TABLE_LIST *tables,
List<set_var_base> *var_list)
static bool mysql_test_set_fields(Prepared_statement *stmt,
TABLE_LIST *tables,
List<set_var_base> *var_list)
{
DBUG_ENTER("mysql_test_set_fields");
List_iterator_fast<set_var_base> it(*var_list);
THD *thd= stmt->thd;
set_var_base *var;
int res= 0;
bool res= 0;
if (tables && (res= check_table_access(thd, SELECT_ACL, tables, 0)))
DBUG_RETURN(res);
if (tables && check_table_access(thd, SELECT_ACL, tables, 0))
DBUG_RETURN(TRUE);
if (tables && (res= open_and_lock_tables(thd, tables)))
goto error;
@ -1186,7 +1168,7 @@ static int mysql_test_set_fields(Prepared_statement *stmt,
if (var->light_check(thd))
{
stmt->lex->unit.cleanup();
res= -1;
res= TRUE;
goto error;
}
}
@ -1206,18 +1188,17 @@ error:
specific_prepare - function of command specific prepare
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error
*/
static int select_like_statement_test(Prepared_statement *stmt,
TABLE_LIST *tables,
int (*specific_prepare)(THD *thd))
static bool select_like_statement_test(Prepared_statement *stmt,
TABLE_LIST *tables,
bool (*specific_prepare)(THD *thd))
{
DBUG_ENTER("select_like_statement_test");
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
int res= 0;
bool res= 0;
if (tables && (res= open_and_lock_tables(thd, tables)))
goto end;
@ -1230,7 +1211,7 @@ static int select_like_statement_test(Prepared_statement *stmt,
// JOIN::prepare calls
if (lex->unit.prepare(thd, 0, 0))
{
res= thd->net.report_error ? -1 : 1;
res= TRUE;
}
end:
lex->unit.cleanup();
@ -1287,16 +1268,15 @@ static int mysql_test_create_table(Prepared_statement *stmt)
tables list of tables queries
RETURN VALUE
0 success
1 error, sent to client
-1 error, not sent to client
FALSE success
TRUE error
*/
static int mysql_test_multiupdate(Prepared_statement *stmt,
static bool mysql_test_multiupdate(Prepared_statement *stmt,
TABLE_LIST *tables)
{
int res;
if ((res= multi_update_precheck(stmt->thd, tables)))
return res;
if (multi_update_precheck(stmt->thd, tables))
return TRUE;
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)
DBUG_RETURN(text_protocol? 0 : send_prep_stmt(stmt, 0));
error:
if (res < 0)
send_error(thd,thd->killed_errno());
DBUG_RETURN(1);
}
@ -1500,10 +1478,7 @@ static bool init_param_array(Prepared_statement *stmt)
alloc_root(&stmt->thd->mem_root,
sizeof(Item_param*) * stmt->param_count);
if (!stmt->param_array)
{
send_error(stmt->thd, ER_OUT_OF_RESOURCES);
return 1;
}
for (to= stmt->param_array;
to < stmt->param_array + stmt->param_count;
++to)
@ -1527,10 +1502,10 @@ static bool init_param_array(Prepared_statement *stmt)
name NULL or statement name. For unnamed statements binary PS
protocol is used, for named statements text protocol is
used.
RETURN
0 OK, statement prepared successfully
other Error
RETURN
FALSE OK, statement prepared successfully
TRUE Error
NOTES
This function parses the query and sends the total number of parameters
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,
LEX_STRING *name)
bool mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
LEX_STRING *name)
{
LEX *lex;
Prepared_statement *stmt= new Prepared_statement(thd);
int error;
bool error;
DBUG_ENTER("mysql_stmt_prepare");
DBUG_PRINT("prep_query", ("%s", packet));
if (stmt == 0)
{
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1);
}
DBUG_RETURN(TRUE);
if (name)
{
@ -1567,16 +1539,14 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
name->length)))
{
delete stmt;
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
}
if (thd->stmt_map.insert(stmt))
{
delete stmt;
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
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);
/* Statement map deletes statement on erase */
thd->stmt_map.erase(stmt);
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
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 */
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute",
SEND_ERROR)))
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_execute")))
DBUG_VOID_RETURN;
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 */
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;
}
@ -1795,10 +1763,7 @@ void mysql_stmt_execute(THD *thd, char *packet, uint packet_length)
{
if (!stmt->cursor &&
!(stmt->cursor= new (&stmt->mem_root) Cursor()))
{
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_VOID_RETURN;
}
/* If lex->result is set, mysql_execute_command will use it */
stmt->lex->result= &stmt->cursor->result;
}
@ -1866,7 +1831,6 @@ set_params_data_err:
reset_stmt_params(stmt);
my_error(ER_WRONG_ARGUMENTS, MYF(0), "mysql_stmt_execute");
err:
send_error(thd);
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,
stmt_name->str, "EXECUTE");
send_error(thd);
DBUG_VOID_RETURN;
}
if (stmt->param_count != thd->lex->prepared_stmt_params.elements)
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
send_error(thd);
DBUG_VOID_RETURN;
}
@ -1910,7 +1872,6 @@ void mysql_sql_stmt_execute(THD *thd, LEX_STRING *stmt_name)
&expanded_query))
{
my_error(ER_WRONG_ARGUMENTS, MYF(0), "EXECUTE");
send_error(thd);
}
execute_stmt(thd, stmt, &expanded_query);
DBUG_VOID_RETURN;
@ -1994,7 +1955,6 @@ void mysql_stmt_fetch(THD *thd, char *packet, uint packet_length)
!stmt->cursor->is_open())
{
my_error(ER_UNKNOWN_STMT_HANDLER, MYF(0), stmt_id, "fetch");
send_error(thd);
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_item_arena(&thd->stmt_backup);
if (error && error != -4)
send_error(thd, ER_OUT_OF_RESOURCES);
DBUG_VOID_RETURN;
}
@ -2050,8 +2007,7 @@ void mysql_stmt_reset(THD *thd, char *packet)
DBUG_ENTER("mysql_stmt_reset");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset",
SEND_ERROR)))
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_reset")))
DBUG_VOID_RETURN;
stmt->state= Item_arena::PREPARED;
@ -2081,8 +2037,7 @@ void mysql_stmt_free(THD *thd, char *packet)
DBUG_ENTER("mysql_stmt_free");
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close",
DONT_SEND_ERROR)))
if (!(stmt= find_prepared_statement(thd, stmt_id, "mysql_stmt_close")))
DBUG_VOID_RETURN;
/* 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);
packet+= 4;
if (!(stmt=find_prepared_statement(thd, stmt_id, "mysql_stmt_send_long_data",
DONT_SEND_ERROR)))
if (!(stmt=find_prepared_statement(thd, stmt_id,
"mysql_stmt_send_long_data")))
DBUG_VOID_RETURN;
param_number= uint2korr(packet);

View file

@ -278,41 +278,39 @@ bool log_in_use(const char* log_name)
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) {
case 0: break;
case LOG_INFO_EOF: errmsg= "Target log not found in binlog index"; break;
case LOG_INFO_IO: errmsg= "I/O error reading log index file"; break;
case LOG_INFO_INVALID:
errmsg= "Server configuration does not permit binlog purge"; break;
case LOG_INFO_SEEK: errmsg= "Failed on fseek()"; break;
case LOG_INFO_MEM: errmsg= "Out of memory"; break;
case LOG_INFO_FATAL: errmsg= "Fatal error during purge"; break;
case LOG_INFO_IN_USE: errmsg= "A purgeable log is in use, will not purge";
break;
default: errmsg= "Unknown error during purge"; break;
case LOG_INFO_EOF: errmsg= ER_UNKNOWN_TARGET_BINLOG; break;
case LOG_INFO_IO: errmsg= ER_IO_ERR_LOG_INDEX_READ; break;
case LOG_INFO_INVALID:errmsg= ER_BINLOG_PURGE_PROHIBITED; break;
case LOG_INFO_SEEK: errmsg= ER_FSEEK_FAIL; break;
case LOG_INFO_MEM: errmsg= ER_OUT_OF_RESOURCES; break;
case LOG_INFO_FATAL: errmsg= ER_BINLOG_PURGE_FATAL_ERR; break;
case LOG_INFO_IN_USE: errmsg= ER_LOG_IN_USE; break;
default: errmsg= ER_LOG_PURGE_UNKNOWN_ERR; break;
}
if (errmsg)
{
send_error(thd, 0, errmsg);
return 1;
my_error(errmsg, MYF(0));
return TRUE;
}
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];
if (!mysql_bin_log.is_open())
{
send_ok(current_thd);
return 0;
return FALSE;
}
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 ,res);
return purge_error_message(thd,
mysql_bin_log.purge_logs_before_date(purge_time));
}
int test_for_non_eof_log_read_errors(int error, const char **errmsg)
@ -753,7 +751,7 @@ err:
pthread_mutex_unlock(&LOCK_thread_count);
if (file >= 0)
(void) my_close(file, MYF(MY_WME));
send_error(thd, my_errno, errmsg);
my_message(my_errno, errmsg, MYF(0));
DBUG_VOID_RETURN;
}
@ -869,7 +867,7 @@ int start_slave(THD* thd , MASTER_INFO* mi, bool net_report)
if (slave_errno)
{
if (net_report)
send_error(thd, slave_errno);
my_error(slave_errno, MYF(0));
DBUG_RETURN(1);
}
else if (net_report)
@ -919,7 +917,7 @@ int stop_slave(THD* thd, MASTER_INFO* mi, bool net_report )
if (slave_errno)
{
if (net_report)
send_error(thd, slave_errno);
my_error(slave_errno, MYF(0));
return 1;
}
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;
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*/);
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);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
thd->proc_info = "Changing master";
@ -1075,9 +1073,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
// TODO: see if needs re-write
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);
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 */,
&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);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
}
else
@ -1210,9 +1208,9 @@ int change_master(THD* thd, MASTER_INFO* mi)
0 /*no data lock*/,
&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);
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
}
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);
thd->proc_info = 0;
send_ok(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
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;
DBUG_ENTER("show_binlog_events");
@ -1299,7 +1297,7 @@ int show_binlog_events(THD* thd)
Log_event::init_show_field_list(&field_list);
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
if (mysql_bin_log.is_open())
{
@ -1405,18 +1403,18 @@ err:
{
my_error(ER_ERROR_WHEN_EXECUTING_COMMAND, MYF(0),
"SHOW BINLOG EVENTS", errmsg);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
send_eof(thd);
pthread_mutex_lock(&LOCK_thread_count);
thd->current_linfo = 0;
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;
DBUG_ENTER("show_binlog_info");
@ -1429,7 +1427,7 @@ int show_binlog_info(THD* thd)
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
protocol->prepare_for_resend();
if (mysql_bin_log.is_open())
@ -1442,10 +1440,10 @@ int show_binlog_info(THD* thd)
protocol->store(&binlog_do_db);
protocol->store(&binlog_ignore_db);
if (protocol->write())
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
send_eof(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
@ -1457,11 +1455,11 @@ int show_binlog_info(THD* thd)
thd Thread specific variable
RETURN VALUES
0 ok
1 error (Error message sent to client)
FALSE OK
TRUE error
*/
int show_binlogs(THD* thd)
bool show_binlogs(THD* thd)
{
IO_CACHE *index_file;
char fname[FN_REFLEN];
@ -1472,15 +1470,14 @@ int show_binlogs(THD* thd)
if (!mysql_bin_log.is_open())
{
//TODO: Replace with ER() error message
send_error(thd, 0, "You are not using binary logging");
my_error(ER_NO_BINARY_LOGGING, MYF(0));
return 1;
}
field_list.push_back(new Item_empty_string("Log_name", 255));
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
mysql_bin_log.lock_index();
index_file=mysql_bin_log.get_index_file();
@ -1498,11 +1495,11 @@ int show_binlogs(THD* thd)
}
mysql_bin_log.unlock_index();
send_eof(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
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 stop_slave(THD* thd, MASTER_INFO* mi, bool net_report);
int change_master(THD* thd, MASTER_INFO* mi);
int show_binlog_events(THD* thd);
bool change_master(THD* thd, MASTER_INFO* mi);
bool show_binlog_events(THD* thd);
int cmp_master_pos(const char* log_file_name1, ulonglong log_pos1,
const char* log_file_name2, ulonglong log_pos2);
int reset_slave(THD *thd, MASTER_INFO* mi);
int reset_master(THD* thd);
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(THD* thd, const char* to_log);
bool purge_master_logs_before_date(THD* thd, time_t purge_time);
bool log_in_use(const char* log_name);
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);
void kill_zombie_dump_threads(uint32 slave_server_id);
int check_binlog_magic(IO_CACHE* log, const char** errmsg);

View file

@ -203,9 +203,9 @@ static void add_group_and_distinct_keys(JOIN *join, JOIN_TAB *join_tab);
This handles SELECT with and without UNION
*/
int handle_select(THD *thd, LEX *lex, select_result *result)
bool handle_select(THD *thd, LEX *lex, select_result *result)
{
int res;
bool res;
register SELECT_LEX *select_lex = &lex->select_lex;
DBUG_ENTER("handle_select");
@ -232,14 +232,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 */
DBUG_PRINT("info",("res: %d report_error: %d", res,
thd->net.report_error));
if (thd->net.report_error)
res= 1;
res|= thd->net.report_error;
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();
res= 1; // Error sent to client
}
DBUG_RETURN(res);
}
@ -404,21 +404,20 @@ JOIN::prepare(Item ***rref_pointer_array,
{
if (!test_if_subpart(procedure->group,group_list))
{ /* purecov: inspected */
my_message(0,"Can't handle procedures with differents groups yet",
MYF(0)); /* purecov: inspected */
my_error(ER_DIFF_GROUPS_PROC, MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */
}
}
#ifdef NOT_NEEDED
else if (!group_list && procedure->flags & PROC_GROUP)
{
my_message(0,"Select must have a group with this procedure",MYF(0));
my_message(ER_NO_GROUP_FOR_PROC, MYF(0));
goto err;
}
#endif
if (order && (procedure->flags & PROC_NO_SORT))
{ /* purecov: inspected */
my_message(0,"Can't use order with this procedure",MYF(0)); /* purecov: inspected */
my_error(ER_ORDER_WITH_PROC, MYF(0)); /* purecov: inspected */
goto err; /* purecov: inspected */
}
}
@ -1957,7 +1956,7 @@ Cursor::~Cursor()
/*********************************************************************/
int
bool
mysql_select(THD *thd, Item ***rref_pointer_array,
TABLE_LIST *tables, uint wild_num, List<Item> &fields,
COND *conds, uint og_num, ORDER *order, ORDER *group,
@ -1965,7 +1964,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
select_result *result, SELECT_LEX_UNIT *unit,
SELECT_LEX *select_lex)
{
int err;
bool err;
bool free_join= 1;
DBUG_ENTER("mysql_select");
@ -1973,7 +1972,10 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
if (select_lex->join != 0)
{
join= select_lex->join;
// is it single SELECT in derived table, called in derived table creation
/*
is it single SELECT in derived table, called in derived table
creation
*/
if (select_lex->linkage != DERIVED_TABLE_TYPE ||
(select_options & SELECT_DESCRIBE))
{
@ -1982,7 +1984,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
//here is EXPLAIN of subselect or derived table
if (join->change_result(result))
{
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
}
else
@ -2001,7 +2003,7 @@ mysql_select(THD *thd, Item ***rref_pointer_array,
else
{
if (!(join= new JOIN(thd, fields, select_options, result)))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
thd->proc_info="init";
thd->used_tables=0; // Updated by setup_fields
if (join->prepare(rref_pointer_array, tables, wild_num,
@ -2049,10 +2051,8 @@ err:
{
thd->proc_info="end";
err= join->cleanup();
if (thd->net.report_error)
err= -1;
delete join;
DBUG_RETURN(err);
DBUG_RETURN(err || thd->net.report_error);
}
DBUG_RETURN(join->error);
}
@ -12597,10 +12597,10 @@ static void select_describe(JOIN *join, bool need_tmp_table, bool need_order,
}
int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
bool mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
{
DBUG_ENTER("mysql_explain_union");
int res= 0;
bool res= 0;
SELECT_LEX *first= unit->first_select();
for (SELECT_LEX *sl= first;
@ -12651,9 +12651,7 @@ int mysql_explain_union(THD *thd, SELECT_LEX_UNIT *unit, select_result *result)
first->options | thd->options | SELECT_DESCRIBE,
result, unit, first);
}
if (res > 0 || thd->net.report_error)
res= -1; // mysql_explain_select do not report error
DBUG_RETURN(res);
DBUG_RETURN(res || thd->net.report_error);
}
@ -12864,17 +12862,17 @@ void st_select_lex::print(THD *thd, String *str)
res new select_result object
RETURN
0 - OK
-1 - error
FALSE - OK
TRUE - error
*/
int JOIN::change_result(select_result *res)
bool JOIN::change_result(select_result *res)
{
DBUG_ENTER("JOIN::change_result");
result= res;
if (!procedure && result->prepare(fields_list, select_lex->master_unit()))
{
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}

View file

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

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.
RETURN
0 ok. In this case ok packet is sent to user
-1 Error (Error message given but not sent to user)
FALSE OK. In this case ok packet is sent to user
TRUE Error
*/
int mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary)
bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
my_bool drop_temporary)
{
int error= 0;
bool error= FALSE;
DBUG_ENTER("mysql_rm_table");
/* 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),
tables->real_name);
error= 1;
error= TRUE;
goto err;
}
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);
if (error)
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
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.
RETURN VALUES
0 ok
-1 error
FALSE OK
TRUE error
*/
int mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields,
List<Key> &keys,bool tmp_table,
uint select_field_count)
bool mysql_create_table(THD *thd,const char *db, const char *table_name,
HA_CREATE_INFO *create_info,
List<create_field> &fields,
List<Key> &keys,bool tmp_table,
uint select_field_count)
{
char path[FN_REFLEN];
const char *alias;
int error= -1;
uint db_options, key_count;
KEY *key_info_buffer;
handler *file;
bool error= TRUE;
enum db_type new_db_type;
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)
{
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)) !=
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))
{
my_error(ER_ILLEGAL_HA,MYF(0),table_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
#endif
@ -1179,7 +1179,7 @@ int mysql_create_table(THD *thd,const char *db, const char *table_name,
keys, tmp_table, db_options, file,
key_info_buffer, &key_count,
select_field_count))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
/* Check if table exists */
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)
{
create_info->table_existed= 1; // Mark that table existed
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
my_error(ER_TABLE_EXISTS_ERROR, MYF(0), alias);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if (wait_if_global_read_lock(thd, 0, 1))
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)
{
create_info->table_existed= 1; // Mark that table existed
error= 0;
error= FALSE;
}
else
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)
{
create_info->table_existed= 1; // Mark that table existed
error= 0;
error= FALSE;
}
else
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));
mysql_bin_log.write(&qinfo);
}
error=0;
error= FALSE;
end:
VOID(pthread_mutex_unlock(&LOCK_open));
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("error", 5, system_charset_info);
protocol->store(errmsg, system_charset_info);
thd->net.last_error[0]=0;
thd->clear_error();
if (protocol->write())
return -1;
return 1;
@ -1722,16 +1722,16 @@ end:
}
static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt,
const char *operator_name,
thr_lock_type lock_type,
bool open_for_modify,
uint extra_open_options,
int (*prepare_func)(THD *, TABLE_LIST *,
HA_CHECK_OPT *),
int (handler::*operator_func)
(THD *, HA_CHECK_OPT *))
static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
HA_CHECK_OPT* check_opt,
const char *operator_name,
thr_lock_type lock_type,
bool open_for_modify,
uint extra_open_options,
int (*prepare_func)(THD *, TABLE_LIST *,
HA_CHECK_OPT *),
int (handler::*operator_func)
(THD *, HA_CHECK_OPT *))
{
TABLE_LIST *table;
List<Item> field_list;
@ -1749,7 +1749,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
item->maybe_null = 1;
if (protocol->send_fields(&field_list,
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);
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;
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;
if (prepare_func)
@ -1785,7 +1782,7 @@ static int mysql_admin_table(THD* thd, TABLE_LIST* tables,
if (!(err_msg=thd->net.last_error))
err_msg=ER(ER_CHECK_NO_SUCH_TABLE);
protocol->store(err_msg, system_charset_info);
thd->net.last_error[0]=0;
thd->clear_error();
if (protocol->write())
goto err;
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);
#ifdef EMBEDDED_LIBRARY
thd->net.last_errno= 0; // these errors shouldn't get client
#endif
thd->clear_error(); // these errors shouldn't get client
protocol->prepare_for_resend();
protocol->store(table_name, system_charset_info);
protocol->store(operator_name, system_charset_info);
@ -1932,16 +1927,16 @@ send_result_message:
}
send_eof(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
close_thread_tables(thd); // Shouldn't be needed
if (table)
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_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_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_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_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)
RETURN VALUES
0 ok
-1 error
FALSE ok
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)
{
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);
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);
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)
RETURN VALUES
0 ok
-1 error
FALSE ok
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_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
RETURN VALUES
0 ok
-1 error
FALSE OK
TRUE error
*/
int mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_CREATE_INFO *create_info,
Table_ident *table_ident)
bool mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_CREATE_INFO *create_info,
Table_ident *table_ident)
{
TABLE **tmp_table;
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 *src_db= thd->db;
char *src_table= table_ident->table.str;
int err, res= -1;
int err;
bool res= TRUE;
TABLE_LIST src_tables_list;
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)))
{
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));
@ -2201,7 +2197,7 @@ int mysql_create_like_table(THD* thd, TABLE_LIST* table,
HA_LEX_CREATE_TMP_TABLE));
mysql_bin_log.write(&qinfo);
}
res= 0;
res= FALSE;
goto err;
table_exists:
@ -2212,7 +2208,7 @@ table_exists:
ER(ER_TABLE_EXISTS_ERROR), table_name);
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_TABLE_EXISTS_ERROR,warn_buff);
res= 0;
res= FALSE;
}
else
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
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
thr_lock_type lock_type = TL_WRITE;
@ -2528,13 +2524,13 @@ int mysql_drop_indexes(THD *thd, TABLE_LIST *table_list,
Alter table
*/
int mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
List<create_field> &fields, List<Key> &keys,
uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok)
bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
HA_CREATE_INFO *create_info,
TABLE_LIST *table_list,
List<create_field> &fields, List<Key> &keys,
uint order_num, ORDER *order,
enum enum_duplicates handle_duplicates,
ALTER_INFO *alter_info, bool do_send_ok)
{
TABLE *table,*new_table;
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,
alter_info->tablespace_op));
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 */
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))
{
my_error(ER_TABLE_EXISTS_ERROR,MYF(0),new_name_buff);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
}
else
@ -2605,7 +2601,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
{
/* Table will be closed in do_command() */
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)
{
my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
def->def=alter->def; // Use new default
alter_it.remove();
@ -2802,7 +2798,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (def->change && ! def->field)
{
my_error(ER_BAD_FIELD_ERROR,MYF(0),def->change,table_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if (!def->after)
create_list.push_back(def);
@ -2820,7 +2816,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (!find)
{
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
}
@ -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,
table_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if (!create_list.elements)
{
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_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)
send_ok(thd,copied+deleted,0L,tmp_name);
thd->some_tables_deleted=0;
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
@ -3433,8 +3429,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,
RETURN
Like mysql_alter_table().
*/
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)
{
DBUG_ENTER("mysql_recreate_table");
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;
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;
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
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 */
protocol->store_null();
thd->net.last_error[0]=0;
thd->clear_error();
}
else
{
@ -3550,11 +3546,11 @@ int mysql_checksum_table(THD *thd, TABLE_LIST *tables, HA_CHECK_OPT *check_opt)
}
send_eof(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
close_thread_tables(thd); // Shouldn't be needed
if (table)
table->table=0;
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}

View file

@ -38,12 +38,13 @@ static File_option triggers_file_parameters[]=
methods.
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;
int result= 0;
bool result= 0;
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))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
/*
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.
*/
if (check_global_access(thd, SUPER_ACL))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
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)
{
my_error(ER_TRG_ON_VIEW_OR_TEMP_TABLE, MYF(0), tables->alias);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if (!table->triggers)
@ -82,11 +83,11 @@ int mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create)
if (!create)
{
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()))
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).
*/
if (wait_if_global_read_lock(thd, 0, 0))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
VOID(pthread_mutex_lock(&LOCK_open));
if ((create ? table->triggers->create_trigger(thd, tables):
table->triggers->drop_trigger(thd, tables)))
result= -1;
result= (create ?
table->triggers->create_trigger(thd, tables):
table->triggers->drop_trigger(thd, tables));
/* It is sensible to invalidate table in any case */
close_cached_table(thd, table);

View file

@ -369,7 +369,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
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);
}
@ -380,19 +380,19 @@ int mysql_create_function(THD *thd,udf_func *udf)
*/
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);
}
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);
}
rw_wrlock(&THR_LOCK_udf);
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;
}
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)",
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;
}
new_dl=1;
@ -411,16 +411,13 @@ int mysql_create_function(THD *thd,udf_func *udf)
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;
}
udf->name.str=strdup_root(&mem,udf->name.str);
udf->dl=strdup_root(&mem,udf->dl);
if (!(u_d=add_udf(&udf->name,udf->returns,udf->dl,udf->type)))
{
send_error(thd,0); // End of memory
goto err;
}
u_d->dlhandle = dl;
u_d->func=udf->func;
u_d->func_init=udf->func_init;
@ -448,7 +445,7 @@ int mysql_create_function(THD *thd,udf_func *udf)
close_thread_tables(thd);
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);
goto err;
}
@ -471,14 +468,14 @@ int mysql_drop_function(THD *thd,const LEX_STRING *udf_name)
DBUG_ENTER("mysql_drop_function");
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);
}
rw_wrlock(&THR_LOCK_udf);
if (!(udf=(udf_func*) hash_search(&udf_hash,(byte*) udf_name->str,
(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;
}
del_udf(udf);

View file

@ -24,21 +24,20 @@
#include "mysql_priv.h"
#include "sql_select.h"
int mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit)
bool mysql_union(THD *thd, LEX *lex, select_result *result,
SELECT_LEX_UNIT *unit)
{
DBUG_ENTER("mysql_union");
int res, res_cln;
bool res;
if (!(res= unit->prepare(thd, result, SELECT_NO_UNLOCK)))
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);
res_cln= 0;
}
else
res_cln= unit->cleanup();
DBUG_RETURN(res?res:res_cln);
res|= unit->cleanup();
DBUG_RETURN(res);
}
@ -104,8 +103,7 @@ bool select_union::flush()
int error;
if ((error=table->file->extra(HA_EXTRA_NO_CACHE)))
{
table->file->print_error(error,MYF(0));
::send_error(thd);
table->file->print_error(error, MYF(0));
return 1;
}
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,
ulong additional_options)
bool st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
ulong additional_options)
{
SELECT_LEX *lex_select_save= thd_arg->lex->current_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 &&
result->prepare(sl->join->fields_list, this))
{
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
sl->join->select_options|= SELECT_DESCRIBE;
sl->join->reinit();
}
}
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
prepared= 1;
res= 0;
res= FALSE;
thd_arg->lex->current_select= sl= first_select= first_select_in_union();
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,
(ORDER*) NULL,
sl, this);
if (res || thd_arg->is_fatal_error)
if ((res= (res || thd_arg->is_fatal_error)))
goto err;
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++))
{
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)
thd->restore_backup_item_arena(arena, &backup);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
}
if (arena)
@ -323,7 +321,7 @@ int st_select_lex_unit::prepare(THD *thd_arg, select_result *sel_result,
result)))
{
fake_select_lex->table_list.empty();
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
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;
DBUG_RETURN(res || thd_arg->is_fatal_error ? 1 : 0);
DBUG_RETURN(res || thd_arg->is_fatal_error);
err:
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 *select_cursor=first_select_in_union();
@ -361,7 +359,7 @@ int st_select_lex_unit::exec()
DBUG_ENTER("st_select_lex_unit::exec");
if (executed && !uncacheable && !describe)
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
executed= 1;
if (uncacheable || !item || !item->assigned() || describe)
@ -376,7 +374,7 @@ int st_select_lex_unit::exec()
}
/* re-enabling indexes for next subselect iteration */
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())
{
@ -431,7 +429,7 @@ int st_select_lex_unit::exec()
if (sl == union_distinct)
{
if (table->file->disable_indexes(HA_KEY_SWITCH_ALL))
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
table->no_keyread=1;
}
res= sl->join->error;
@ -439,7 +437,7 @@ int st_select_lex_unit::exec()
if (!res && union_result->flush())
{
thd->lex->current_select= lex_select_save;
DBUG_RETURN(1);
DBUG_RETURN(TRUE);
}
}
if (res)
@ -465,7 +463,7 @@ int st_select_lex_unit::exec()
optimized= 1;
/* Send result to 'result' */
res= -1;
res= TRUE;
{
List<Item_func_match> empty_list;
empty_list.empty();
@ -484,7 +482,7 @@ int st_select_lex_unit::exec()
fake_select_lex->options, result)))
{
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;
JOIN *join;
@ -536,7 +534,7 @@ int st_select_lex_unit::cleanup()
if (cleaned)
{
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
}
cleaned= 1;
@ -610,19 +608,19 @@ void st_select_lex_unit::reinit_exec_mechanism()
old_result old select_result object
RETURN
0 - OK
-1 - error
FALSE - OK
TRUE - error
*/
int st_select_lex_unit::change_result(select_subselect *result,
select_subselect *old_result)
bool st_select_lex_unit::change_result(select_subselect *result,
select_subselect *old_result)
{
int res= 0;
bool res= FALSE;
for (SELECT_LEX *sl= first_select_in_union(); sl; sl= sl->next_select())
{
if (sl->join && sl->join->result == old_result)
if ((res= sl->join->change_result(result)))
return (res);
if (sl->join->change_result(result))
return TRUE;
}
if (fake_select_lex && fake_select_lex->join)
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,
TABLE_LIST *table_list,
List<Item> &fields,
List<Item> &values,
COND *conds,
uint order_num, ORDER *order,
ha_rows limit,
enum enum_duplicates handle_duplicates)
bool mysql_update(THD *thd,
TABLE_LIST *table_list,
List<Item> &fields,
List<Item> &values,
COND *conds,
uint order_num, ORDER *order,
ha_rows limit,
enum enum_duplicates handle_duplicates)
{
bool using_limit= limit != HA_POS_ERROR;
bool safe_update= thd->options & OPTION_SAFE_UPDATES;
bool used_key_is_modified, transactional_table, log_delayed;
bool ignore_err= (thd->lex->duplicates == DUP_IGNORE);
bool res;
int error=0;
int res;
uint used_index;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
@ -117,8 +117,8 @@ int mysql_update(THD *thd,
LINT_INIT(used_index);
LINT_INIT(timestamp_query_id);
if ((error= open_and_lock_tables(thd, table_list)))
DBUG_RETURN(error);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
thd->proc_info="init";
table= table_list->table;
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);
thd->lex->select_lex.no_wrap_view_item= 0;
if (res)
DBUG_RETURN(-1); /* purecov: inspected */
DBUG_RETURN(TRUE); /* purecov: inspected */
}
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))
{
my_error(ER_NON_UPDATABLE_TABLE, MYF(0), table_list->alias, "UPDATE");
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
if (table->timestamp_field)
{
@ -184,7 +184,7 @@ int mysql_update(THD *thd,
if (setup_fields(thd, 0, table_list, values, 0, 0, 0))
{
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
@ -197,10 +197,10 @@ int mysql_update(THD *thd,
free_underlaid_joins(thd, &thd->lex->select_lex);
if (error)
{
DBUG_RETURN(-1); // Error in where
DBUG_RETURN(TRUE); // Error in where
}
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 (table->quick_keys.is_clear_all())
@ -363,7 +363,15 @@ int mysql_update(THD *thd,
{
store_record(table,record[1]);
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 */
}
found++;
if (table->triggers)
@ -456,9 +464,7 @@ int mysql_update(THD *thd,
}
free_underlaid_joins(thd, &thd->lex->select_lex);
if (error >= 0)
send_error(thd,thd->killed_errno()); /* purecov: inspected */
else
if (error < 0)
{
char buff[80];
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->abort_on_warning= 0;
free_io_cache(table);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
delete select;
@ -483,7 +489,7 @@ err:
table->file->extra(HA_EXTRA_NO_KEYREAD);
}
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
RETURN
0 OK
-1 Error
FALSE OK
TRUE Error
*/
int mysql_multi_update_prepare(THD *thd)
bool mysql_multi_update_prepare(THD *thd)
{
LEX *lex= thd->lex;
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),
thd->lex->select_lex.no_wrap_view_item= 0,
res))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
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))
{
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
{
@ -650,36 +656,36 @@ int mysql_multi_update_prepare(THD *thd)
(tables_for_update & tl->table->map))
{
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,
TABLE_LIST *table_list,
List<Item> *fields,
List<Item> *values,
COND *conds,
ulong options,
enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
bool mysql_multi_update(THD *thd,
TABLE_LIST *table_list,
List<Item> *fields,
List<Item> *values,
COND *conds,
ulong options,
enum enum_duplicates handle_duplicates,
SELECT_LEX_UNIT *unit, SELECT_LEX *select_lex)
{
int res;
bool res;
multi_update *result;
DBUG_ENTER("mysql_multi_update");
if ((res= open_and_lock_tables(thd, table_list)))
DBUG_RETURN(res);
if (open_and_lock_tables(thd, table_list))
DBUG_RETURN(TRUE);
if ((res= mysql_multi_update_prepare(thd)))
DBUG_RETURN(res);
if (!(result= new multi_update(thd, table_list, fields, values,
handle_duplicates)))
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
thd->no_trans_update= 0;
thd->abort_on_warning= test(thd->variables.sql_mode &
@ -696,7 +702,7 @@ int mysql_multi_update(THD *thd,
result, unit, select_lex);
delete result;
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;
store_record(table,record[1]);
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);
}
found++;
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)
{
/* First send error what ever it is ... */
::send_error(thd,errcode,err);
my_error(errcode, MYF(0), err);
/* If nothing updated return */
if (!updated)
@ -1278,7 +1292,6 @@ bool multi_update::send_eof()
/* Safety: If we haven't got an error before (should not happen) */
my_message(ER_UNKNOWN_ERROR, "An error occured in multi-table update",
MYF(0));
::send_error(thd);
return 1;
}

View file

@ -41,13 +41,12 @@ TYPELIB updatable_views_with_limit_typelib=
mode - VIEW_CREATE_NEW, VIEW_ALTER, VIEW_CREATE_OR_REPLACE
RETURN VALUE
0 OK
-1 Error
1 Error and error message given
FALSE OK
TRUE Error
*/
int mysql_create_view(THD *thd,
enum_view_create_mode mode)
bool mysql_create_view(THD *thd,
enum_view_create_mode mode)
{
LEX *lex= thd->lex;
bool link_to_local;
@ -57,7 +56,7 @@ int mysql_create_view(THD *thd,
TABLE_LIST *tbl;
SELECT_LEX *select_lex= &lex->select_lex, *sl;
SELECT_LEX_UNIT *unit= &lex->unit;
int res= 0;
bool res= FALSE;
DBUG_ENTER("mysql_create_view");
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 ?
"INTO" :
"PROCEDURE"));
res= -1;
res= TRUE;
goto err;
}
if (lex->derived_tables ||
@ -75,7 +74,7 @@ int mysql_create_view(THD *thd,
my_error((lex->derived_tables ?
ER_VIEW_SELECT_DERIVED :
ER_VIEW_SELECT_VARIABLE), MYF(0));
res= -1;
res= TRUE;
goto err;
}
@ -101,7 +100,7 @@ int mysql_create_view(THD *thd,
(check_access(thd, DELETE_ACL, view->db, &view->grant.privilege,
0, 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 (tbl= sl->get_table_list(); tbl; tbl= tbl->next_local)
@ -119,7 +118,7 @@ int mysql_create_view(THD *thd,
thd->priv_user,
thd->host_or_ip,
tbl->real_name);
DBUG_RETURN(-1);
DBUG_RETURN(TRUE);
}
/*
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) ||
grant_option && check_grant(thd, SELECT_ACL, tbl, 0, 1, 0))
{
res= 1;
res= TRUE;
goto err;
}
}
@ -177,8 +176,8 @@ int mysql_create_view(THD *thd,
}
#endif
if ((res= open_and_lock_tables(thd, tables)))
DBUG_RETURN(res);
if (open_and_lock_tables(thd, tables))
DBUG_RETURN(TRUE);
/*
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)
{
my_error(ER_VIEW_SELECT_TMPTABLE, MYF(0), tbl->alias);
res= -1;
res= TRUE;
goto err;
}
@ -200,7 +199,7 @@ int mysql_create_view(THD *thd,
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);
res= -1;
res= TRUE;
goto err;
}
@ -220,7 +219,7 @@ int mysql_create_view(THD *thd,
some errors from prepare are reported to user, if is not then
it will be checked after err: label
*/
res= 1;
res= TRUE;
goto err;
}
@ -255,7 +254,7 @@ int mysql_create_view(THD *thd,
if (strcmp(item->name, check->name) == 0)
{
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,
item->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))
{
res= -1;
res= TRUE;
goto err;
}
VOID(pthread_mutex_lock(&LOCK_open));
@ -321,9 +320,7 @@ err:
thd->proc_info= "end";
lex->link_first_table_back(view, link_to_local);
unit->cleanup();
if (thd->net.report_error)
res= -1;
DBUG_RETURN(res);
DBUG_RETURN(res || thd->net.report_error);
}
@ -824,12 +821,11 @@ err:
drop_mode - cascade/check
RETURN VALUE
0 OK
-1 Error
1 Error and error message given
FALSE OK
TRUE Error
*/
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");
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));
}
send_ok(thd);
DBUG_RETURN(0);
DBUG_RETURN(FALSE);
err:
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
*/
int mysql_create_view(THD *thd,
enum_view_create_mode mode);
bool mysql_create_view(THD *thd,
enum_view_create_mode mode);
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);

View file

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