1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

Merge bk@192.168.21.1:mysql-5.1-opt

into  mysql.com:/d2/hf/mrg/mysql-5.1-opt


client/mysqldump.c:
  Auto merged
mysql-test/r/rpl_packet.result:
  Auto merged
mysql-test/r/sp.result:
  Auto merged
mysql-test/t/rpl_packet.test:
  Auto merged
sql/field.cc:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/mysqld.cc:
  Auto merged
sql/sp.cc:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sp_head.h:
  Auto merged
sql/sql_partition.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
sql/sql_show.cc:
  Auto merged
sql/sql_table.cc:
  Auto merged
sql/share/errmsg.txt:
  Auto merged
sql/sql_yacc.yy:
  Auto merged
sql/table.cc:
  Auto merged
storage/innobase/handler/ha_innodb.cc:
  Auto merged
mysql-test/r/create.result:
  SCCS merged
mysql-test/t/create.test:
  merging
mysql-test/t/disabled.def:
  merging
sql/events.cc:
  merging
sql/sql_parse.cc:
  SCCS merged
This commit is contained in:
unknown
2007-04-07 14:59:53 +05:00
50 changed files with 2643 additions and 2028 deletions

View File

@ -3975,11 +3975,6 @@ create_sp_error:
}
case SQLCOM_SHOW_CREATE_PROC:
{
if (lex->spname->m_name.length > NAME_LEN)
{
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
goto error;
}
if (sp_show_create_procedure(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */
my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
@ -3990,11 +3985,6 @@ create_sp_error:
}
case SQLCOM_SHOW_CREATE_FUNC:
{
if (lex->spname->m_name.length > NAME_LEN)
{
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
goto error;
}
if (sp_show_create_function(thd, lex->spname) != SP_OK)
{ /* We don't distinguish between errors for now */
my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
@ -4023,11 +4013,6 @@ create_sp_error:
{
sp_head *sp;
if (lex->spname->m_name.length > NAME_LEN)
{
my_error(ER_TOO_LONG_IDENT, MYF(0), lex->spname->m_name.str);
goto error;
}
if (lex->sql_command == SQLCOM_SHOW_PROC_CODE)
sp= sp_find_routine(thd, TYPE_ENUM_PROCEDURE, lex->spname,
&thd->sp_proc_cache, FALSE);
@ -4452,6 +4437,8 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
thd Thread handler
privilege requested privilege
all_tables global table list of query
no_errors FALSE/TRUE - report/don't report error to
the client (using my_error() call).
RETURN
0 - OK
@ -4459,7 +4446,7 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
*/
bool check_single_table_access(THD *thd, ulong privilege,
TABLE_LIST *all_tables)
TABLE_LIST *all_tables, bool no_errors)
{
Security_context * backup_ctx= thd->security_ctx;
@ -4475,12 +4462,12 @@ bool check_single_table_access(THD *thd, ulong privilege,
db_name= all_tables->db;
if (check_access(thd, privilege, db_name,
&all_tables->grant.privilege, 0, 0,
&all_tables->grant.privilege, 0, no_errors,
test(all_tables->schema_table)))
goto deny;
/* Show only 1 table for check_grant */
if (grant_option && check_grant(thd, privilege, all_tables, 0, 1, 0))
if (grant_option && check_grant(thd, privilege, all_tables, 0, 1, no_errors))
goto deny;
thd->security_ctx= backup_ctx;
@ -4508,7 +4495,7 @@ deny:
bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
{
if (check_single_table_access (thd,privilege,all_tables))
if (check_single_table_access (thd,privilege,all_tables, FALSE))
return 1;
/* Check rights on tables of subselects and implictly opened tables */
@ -4521,7 +4508,7 @@ bool check_one_table_access(THD *thd, ulong privilege, TABLE_LIST *all_tables)
*/
if (view && subselects_tables->belong_to_view == view)
{
if (check_single_table_access (thd, privilege, subselects_tables))
if (check_single_table_access (thd, privilege, subselects_tables, FALSE))
return 1;
subselects_tables= subselects_tables->next_global;
}
@ -5311,7 +5298,7 @@ bool mysql_test_parse_for_slave(THD *thd, char *inBuf, uint length)
** Return 0 if ok
******************************************************************************/
bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
bool add_field_to_list(THD *thd, LEX_STRING *field_name, enum_field_types type,
char *length, char *decimals,
uint type_modifier,
Item *default_value, Item *on_update_value,
@ -5324,14 +5311,15 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
LEX *lex= thd->lex;
DBUG_ENTER("add_field_to_list");
if (strlen(field_name) > NAME_LEN)
if (check_string_char_length(field_name, "", NAME_CHAR_LEN,
system_charset_info, 1))
{
my_error(ER_TOO_LONG_IDENT, MYF(0), field_name); /* purecov: inspected */
my_error(ER_TOO_LONG_IDENT, MYF(0), field_name->str); /* purecov: inspected */
DBUG_RETURN(1); /* purecov: inspected */
}
if (type_modifier & PRI_KEY_FLAG)
{
lex->col_list.push_back(new key_part_spec(field_name,0));
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
lex->key_list.push_back(new Key(Key::PRIMARY, NullS,
&default_key_create_info,
0, lex->col_list));
@ -5339,7 +5327,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
}
if (type_modifier & (UNIQUE_FLAG | UNIQUE_KEY_FLAG))
{
lex->col_list.push_back(new key_part_spec(field_name,0));
lex->col_list.push_back(new key_part_spec(field_name->str, 0));
lex->key_list.push_back(new Key(Key::UNIQUE, NullS,
&default_key_create_info, 0,
lex->col_list));
@ -5359,7 +5347,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
!(((Item_func*)default_value)->functype() == Item_func::NOW_FUNC &&
type == MYSQL_TYPE_TIMESTAMP))
{
my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str);
DBUG_RETURN(1);
}
else if (default_value->type() == Item::NULL_ITEM)
@ -5368,20 +5356,20 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
if ((type_modifier & (NOT_NULL_FLAG | AUTO_INCREMENT_FLAG)) ==
NOT_NULL_FLAG)
{
my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str);
DBUG_RETURN(1);
}
}
else if (type_modifier & AUTO_INCREMENT_FLAG)
{
my_error(ER_INVALID_DEFAULT, MYF(0), field_name);
my_error(ER_INVALID_DEFAULT, MYF(0), field_name->str);
DBUG_RETURN(1);
}
}
if (on_update_value && type != MYSQL_TYPE_TIMESTAMP)
{
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name);
my_error(ER_INVALID_ON_UPDATE, MYF(0), field_name->str);
DBUG_RETURN(1);
}
@ -5397,7 +5385,7 @@ bool add_field_to_list(THD *thd, char *field_name, enum_field_types type,
}
if (!(new_field= new create_field()) ||
new_field->init(thd, field_name, type, length, decimals, type_modifier,
new_field->init(thd, field_name->str, type, length, decimals, type_modifier,
default_value, on_update_value, comment, change,
interval_list, cs, uint_geom_type))
DBUG_RETURN(1);
@ -6949,26 +6937,62 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user)
/*
Check that length of a string does not exceed some limit.
Check that byte length of a string does not exceed some limit.
SYNOPSIS
check_string_length()
str string to be checked
err_msg error message to be displayed if the string is too long
max_length max length
check_string_byte_length()
str string to be checked
err_msg error message to be displayed if the string is too long
max_byte_length max length in bytes
RETURN
FALSE the passed string is not longer than max_length
TRUE the passed string is longer than max_length
NOTE
The function is not used in existing code but can be useful later?
*/
bool check_string_length(LEX_STRING *str, const char *err_msg,
uint max_length)
bool check_string_byte_length(LEX_STRING *str, const char *err_msg,
uint max_byte_length)
{
if (str->length <= max_length)
if (str->length <= max_byte_length)
return FALSE;
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_length);
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_byte_length);
return TRUE;
}
/*
Check that char length of a string does not exceed some limit.
SYNOPSIS
check_string_char_length()
str string to be checked
err_msg error message to be displayed if the string is too long
max_char_length max length in symbols
cs string charset
RETURN
FALSE the passed string is not longer than max_char_length
TRUE the passed string is longer than max_char_length
*/
bool check_string_char_length(LEX_STRING *str, const char *err_msg,
uint max_char_length, CHARSET_INFO *cs,
bool no_error)
{
int well_formed_error;
uint res= cs->cset->well_formed_len(cs, str->str, str->str + str->length,
max_char_length, &well_formed_error);
if (!well_formed_error && str->length == res)
return FALSE;
if (!no_error)
my_error(ER_WRONG_STRING_LENGTH, MYF(0), str->str, err_msg, max_char_length);
return TRUE;
}