Commit 0ba6cb48 authored by unknown's avatar unknown

Added missing return statement


sql/sql_delete.cc:
  Added missing return
sql/sql_lex.cc:
  Comment fixes
sql/sql_parse.cc:
  Comment fixes
parent 97eddaaf
...@@ -254,9 +254,9 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order, ...@@ -254,9 +254,9 @@ int mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, SQL_LIST *order,
*/ */
int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
{ {
TABLE_LIST *delete_table_list= TABLE_LIST *delete_table_list= ((TABLE_LIST*) thd->lex->
(TABLE_LIST*)thd->lex->select_lex.table_list.first; select_lex.table_list.first);
DBUG_ENTER(" mysql_prepare_delete"); DBUG_ENTER("mysql_prepare_delete");
if (setup_conds(thd, delete_table_list, conds) || if (setup_conds(thd, delete_table_list, conds) ||
setup_ftfuncs(&thd->lex->select_lex)) setup_ftfuncs(&thd->lex->select_lex))
...@@ -267,6 +267,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds) ...@@ -267,6 +267,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list, Item **conds)
my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name); my_error(ER_UPDATE_TABLE_USED, MYF(0), table_list->real_name);
DBUG_RETURN(-1); DBUG_RETURN(-1);
} }
DBUG_RETURN(0);
} }
......
...@@ -1636,17 +1636,21 @@ void st_select_lex::print_limit(THD *thd, String *str) ...@@ -1636,17 +1636,21 @@ void st_select_lex::print_limit(THD *thd, String *str)
/* /*
Unlink first table from global table list and first must outer select list Unlink first table from global table list and first table from outer select
(lex->select_lex) list (lex->select_lex)
SYNOPSIS SYNOPSIS
unlink_first_table() unlink_first_table()
tables - global table list tables Global table list
global_first - save first global table passed using this parameter global_first Save first global table here
local_first - save first local table passed using this parameter local_first Save first local table here
NORES
global_first & local_first are used to save result for link_first_table_back
RETURN RETURN
global list without first table global list without first table
*/ */
TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables,
TABLE_LIST **global_first, TABLE_LIST **global_first,
...@@ -1655,16 +1659,15 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, ...@@ -1655,16 +1659,15 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables,
*global_first= tables; *global_first= tables;
*local_first= (TABLE_LIST*)select_lex.table_list.first; *local_first= (TABLE_LIST*)select_lex.table_list.first;
/* /*
exclude from global table list Exclude from global table list
*/ */
tables= tables->next; tables= tables->next;
/* /*
and from local list if it is not the same and from local list if it is not the same
*/ */
if (&select_lex != all_selects_list) select_lex.table_list.first= ((&select_lex != all_selects_list) ?
select_lex.table_list.first= (gptr)(*local_first)->next; (gptr) (*local_first)->next :
else (gptr) tables);
select_lex.table_list.first= (gptr)tables;
(*global_first)->next= 0; (*global_first)->next= 0;
return tables; return tables;
} }
...@@ -1675,9 +1678,9 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables, ...@@ -1675,9 +1678,9 @@ TABLE_LIST *st_lex::unlink_first_table(TABLE_LIST *tables,
SYNOPSIS SYNOPSIS
link_first_table_back() link_first_table_back()
tables - global table list tables Global table list
global_first - save first global table global_first Saved first global table
local_first - save first local table local_first Saved first local table
RETURN RETURN
global list global list
......
...@@ -2136,8 +2136,7 @@ mysql_execute_command(THD *thd) ...@@ -2136,8 +2136,7 @@ mysql_execute_command(THD *thd)
if (grant_option) if (grant_option)
{ {
/* Check that the first table has CREATE privilege */ /* Check that the first table has CREATE privilege */
bool error= check_grant(thd, CREATE_ACL, tables, 0, 1, 0); if (check_grant(thd, CREATE_ACL, tables, 0, 1, 0))
if (error)
goto error; goto error;
} }
if (strlen(tables->real_name) > NAME_LEN) if (strlen(tables->real_name) > NAME_LEN)
...@@ -2638,14 +2637,14 @@ mysql_execute_command(THD *thd) ...@@ -2638,14 +2637,14 @@ mysql_execute_command(THD *thd)
{ {
TABLE_LIST *aux_tables= TABLE_LIST *aux_tables=
(TABLE_LIST *)thd->lex->auxilliary_table_list.first; (TABLE_LIST *)thd->lex->auxilliary_table_list.first;
TABLE_LIST *target_tbl; TABLE_LIST *target_tbl;
uint table_count; uint table_count;
multi_delete *result; multi_delete *result;
if ((res= multi_delete_precheck(thd, tables, &table_count))) if ((res= multi_delete_precheck(thd, tables, &table_count)))
break; break;
// condition will be TRUE on SP re esexcuting /* condition will be TRUE on SP re-excuting */
if (select_lex->item_list.elements != 0) if (select_lex->item_list.elements != 0)
select_lex->item_list.empty(); select_lex->item_list.empty();
if (add_item_to_list(thd, new Item_null())) if (add_item_to_list(thd, new Item_null()))
...@@ -3387,18 +3386,18 @@ mysql_execute_command(THD *thd) ...@@ -3387,18 +3386,18 @@ mysql_execute_command(THD *thd)
0 - OK 0 - OK
1 - access denied, error is sent to client 1 - access denied, error is sent to client
*/ */
int check_one_table_access(THD *thd, ulong privilege,
TABLE_LIST *tables) int check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *tables)
{ {
if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0)) if (check_access(thd, privilege, tables->db, &tables->grant.privilege,0,0))
return 1; return 1;
// Show only 1 table for check_grant /* Show only 1 table for check_grant */
if (grant_option && check_grant(thd, privilege, tables, 0, 1, 0)) if (grant_option && check_grant(thd, privilege, tables, 0, 1, 0))
return 1; return 1;
// check rights on tables of subselect (if exists) /* Check rights on tables of subselect (if exists) */
TABLE_LIST *subselects_tables; TABLE_LIST *subselects_tables;
if ((subselects_tables= tables->next)) if ((subselects_tables= tables->next))
{ {
...@@ -3851,6 +3850,7 @@ void mysql_init_multi_delete(LEX *lex) ...@@ -3851,6 +3850,7 @@ void mysql_init_multi_delete(LEX *lex)
When you modify mysql_parse(), you may need to mofify When you modify mysql_parse(), you may need to mofify
mysql_test_parse_for_slave() in this same file. mysql_test_parse_for_slave() in this same file.
*/ */
void mysql_parse(THD *thd, char *inBuf, uint length) void mysql_parse(THD *thd, char *inBuf, uint length)
{ {
DBUG_ENTER("mysql_parse"); DBUG_ENTER("mysql_parse");
...@@ -4928,14 +4928,15 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop) ...@@ -4928,14 +4928,15 @@ int mysql_drop_index(THD *thd, TABLE_LIST *table_list, List<Alter_drop> &drop)
SYNOPSIS SYNOPSIS
multi_update_precheck() multi_update_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 Error (message is sent to user)
-1 - error (message is not sent to user) -1 Error (message is not sent to user)
*/ */
int multi_update_precheck(THD *thd, TABLE_LIST *tables) int multi_update_precheck(THD *thd, TABLE_LIST *tables)
{ {
DBUG_ENTER("multi_update_precheck"); DBUG_ENTER("multi_update_precheck");
...@@ -5016,14 +5017,14 @@ int multi_update_precheck(THD *thd, TABLE_LIST *tables) ...@@ -5016,14 +5017,14 @@ int multi_update_precheck(THD *thd, TABLE_LIST *tables)
SYNOPSIS SYNOPSIS
multi_delete_precheck() multi_delete_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
table_count - pointer to table counter table_count Pointer to table counter
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 error (message is sent to user)
-1 - error (message is not sent to user) -1 error (message is not sent to user)
*/ */
int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count) int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
{ {
...@@ -5083,14 +5084,15 @@ int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count) ...@@ -5083,14 +5084,15 @@ int multi_delete_precheck(THD *thd, TABLE_LIST *tables, uint *table_count)
SYNOPSIS SYNOPSIS
multi_delete_precheck() multi_delete_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 Error (message is sent to user)
-1 - error (message is not sent to user) -1 Error (message is not sent to user)
*/ */
int insert_select_precheck(THD *thd, TABLE_LIST *tables) int insert_select_precheck(THD *thd, TABLE_LIST *tables)
{ {
DBUG_ENTER("insert_select_precheck"); DBUG_ENTER("insert_select_precheck");
...@@ -5109,14 +5111,15 @@ int insert_select_precheck(THD *thd, TABLE_LIST *tables) ...@@ -5109,14 +5111,15 @@ int insert_select_precheck(THD *thd, TABLE_LIST *tables)
SYNOPSIS SYNOPSIS
update_precheck() update_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 Error (message is sent to user)
-1 - error (message is not sent to user) -1 Error (message is not sent to user)
*/ */
int update_precheck(THD *thd, TABLE_LIST *tables) int update_precheck(THD *thd, TABLE_LIST *tables)
{ {
DBUG_ENTER("update_precheck"); DBUG_ENTER("update_precheck");
...@@ -5135,20 +5138,21 @@ int update_precheck(THD *thd, TABLE_LIST *tables) ...@@ -5135,20 +5138,21 @@ int update_precheck(THD *thd, TABLE_LIST *tables)
SYNOPSIS SYNOPSIS
delete_precheck() delete_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 error (message is sent to user)
-1 - error (message is not sent to user) -1 error (message is not sent to user)
*/ */
int delete_precheck(THD *thd, TABLE_LIST *tables) int delete_precheck(THD *thd, TABLE_LIST *tables)
{ {
DBUG_ENTER("delete_precheck"); DBUG_ENTER("delete_precheck");
if (check_one_table_access(thd, DELETE_ACL, tables)) if (check_one_table_access(thd, DELETE_ACL, tables))
DBUG_RETURN(1); DBUG_RETURN(1);
// Set privilege for the WHERE clause /* Set privilege for the WHERE clause */
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
DBUG_RETURN(0); DBUG_RETURN(0);
} }
...@@ -5159,14 +5163,15 @@ int delete_precheck(THD *thd, TABLE_LIST *tables) ...@@ -5159,14 +5163,15 @@ int delete_precheck(THD *thd, TABLE_LIST *tables)
SYNOPSIS SYNOPSIS
insert_precheck() insert_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 error (message is sent to user)
-1 - error (message is not sent to user) -1 error (message is not sent to user)
*/ */
int insert_precheck(THD *thd, TABLE_LIST *tables, bool update) int insert_precheck(THD *thd, TABLE_LIST *tables, bool update)
{ {
LEX *lex= thd->lex; LEX *lex= thd->lex;
...@@ -5192,15 +5197,16 @@ int insert_precheck(THD *thd, TABLE_LIST *tables, bool update) ...@@ -5192,15 +5197,16 @@ int insert_precheck(THD *thd, TABLE_LIST *tables, bool update)
SYNOPSIS SYNOPSIS
create_table_precheck() create_table_precheck()
thd - thread handler thd Thread handler
tables - global table list tables Global table list
create_table - table which will be created create_table Table which will be created
RETURN VALUE RETURN VALUE
0 - OK 0 OK
1 - error (message is sent to user) 1 Error (message is sent to user)
-1 - error (message is not sent to user) -1 Error (message is not sent to user)
*/ */
int create_table_precheck(THD *thd, TABLE_LIST *tables, int create_table_precheck(THD *thd, TABLE_LIST *tables,
TABLE_LIST *create_table) TABLE_LIST *create_table)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment