summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorserg@serg.mylan <>2005-01-24 19:41:42 +0100
committerserg@serg.mylan <>2005-01-24 19:41:42 +0100
commitc76405a7ee4f7ceb928c6d09d9704f028d6dde6b (patch)
tree0c73a61f5c88d003eae464001af7656745e9ba4e /sql
parent24468e48f32fb7f5d4e76047acb2e892ffd3825f (diff)
parent1ca9d6497b7c3c276387470fce52e6b1cadc4f67 (diff)
downloadmariadb-git-c76405a7ee4f7ceb928c6d09d9704f028d6dde6b.tar.gz
merged
Diffstat (limited to 'sql')
-rw-r--r--sql/item_create.cc13
-rw-r--r--sql/item_strfunc.cc3
-rw-r--r--sql/item_timefunc.cc23
-rw-r--r--sql/log.cc4
-rw-r--r--sql/set_var.cc4
-rw-r--r--sql/slave.cc11
-rw-r--r--sql/sql_acl.cc12
-rw-r--r--sql/sql_acl.h2
-rw-r--r--sql/sql_analyse.cc59
-rw-r--r--sql/sql_base.cc15
-rw-r--r--sql/sql_cache.cc10
-rw-r--r--sql/sql_db.cc22
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_parse.cc28
-rw-r--r--sql/sql_table.cc4
-rw-r--r--sql/sql_update.cc5
-rw-r--r--sql/table.cc4
-rw-r--r--sql/tztime.cc2
18 files changed, 118 insertions, 106 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc
index cec6de3eede..8a5aeb6c9b7 100644
--- a/sql/item_create.cc
+++ b/sql/item_create.cc
@@ -358,22 +358,19 @@ Item *create_func_sin(Item* a)
Item *create_func_sha(Item* a)
{
- return new Item_func_sha(a);
+ return new Item_func_sha(a);
}
-
+
Item *create_func_space(Item *a)
{
CHARSET_INFO *cs= current_thd->variables.collation_connection;
Item *sp;
-
+
if (cs->mbminlen > 1)
{
+ uint dummy_errors;
sp= new Item_string("",0,cs);
- if (sp)
- {
- uint dummy_errors;
- sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
- }
+ sp->str_value.copy(" ", 1, &my_charset_latin1, cs, &dummy_errors);
}
else
{
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 5d018b22055..f9843692b7b 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2519,6 +2519,9 @@ String* Item_func_export_set::val_str(String* str)
case 3:
sep_buf.set(",", 1, default_charset());
sep = &sep_buf;
+ break;
+ default:
+ DBUG_ASSERT(0); // cannot happen
}
null_value=0;
diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc
index 0c1cd3cbad3..32813454fef 100644
--- a/sql/item_timefunc.cc
+++ b/sql/item_timefunc.cc
@@ -2131,20 +2131,25 @@ void Item_char_typecast::print(String *str)
String *Item_char_typecast::val_str(String *str)
{
DBUG_ASSERT(fixed == 1);
- String *res, *res1;
+ String *res;
uint32 length;
- if (!charset_conversion && !(res= args[0]->val_str(str)))
+#if 0
+ if (!charset_conversion)
{
- null_value= 1;
- return 0;
+ if (!(res= args[0]->val_str(str)))
+ {
+ null_value= 1;
+ return 0;
+ }
}
else
+#endif
{
// Convert character set if differ
uint dummy_errors;
- if (!(res1= args[0]->val_str(&tmp_value)) ||
- str->copy(res1->ptr(), res1->length(), res1->charset(),
+ if (!(res= args[0]->val_str(&tmp_value)) ||
+ str->copy(res->ptr(), res->length(), res->charset(),
cast_cs, &dummy_errors))
{
null_value= 1;
@@ -2154,13 +2159,13 @@ String *Item_char_typecast::val_str(String *str)
}
res->set_charset(cast_cs);
-
+
/*
Cut the tail if cast with length
and the result is longer than cast length, e.g.
CAST('string' AS CHAR(1))
*/
- if (cast_length >= 0 &&
+ if (cast_length >= 0 &&
(res->length() > (length= (uint32) res->charpos(cast_length))))
{ // Safe even if const arg
if (!res->alloced_length())
@@ -2169,7 +2174,7 @@ String *Item_char_typecast::val_str(String *str)
res= &str_value;
}
res->length((uint) length);
- }
+ }
null_value= 0;
return res;
}
diff --git a/sql/log.cc b/sql/log.cc
index d57a6b49762..6c97581d144 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -2257,9 +2257,9 @@ void print_buffer_to_nt_eventlog(enum loglevel level, char *buff,
DBUG_ENTER("print_buffer_to_nt_eventlog");
buffptr= buff;
- if (length > (uint)(buffLen-4))
+ if (length > (uint)(buffLen-5))
{
- char *newBuff= new char[length + 4];
+ char *newBuff= new char[length + 5];
strcpy(newBuff, buff);
buffptr= newBuff;
}
diff --git a/sql/set_var.cc b/sql/set_var.cc
index c5c37a86c61..e18f28dc133 100644
--- a/sql/set_var.cc
+++ b/sql/set_var.cc
@@ -3033,8 +3033,8 @@ int set_var_password::check(THD *thd)
if (!user->host.str)
user->host.str= (char*) thd->host_or_ip;
/* Returns 1 as the function sends error to client */
- return check_change_password(thd, user->host.str, user->user.str, password) ?
- 1 : 0;
+ return check_change_password(thd, user->host.str, user->user.str,
+ password, strlen(password)) ? 1 : 0;
#else
return 0;
#endif
diff --git a/sql/slave.cc b/sql/slave.cc
index 5332dbf9c5b..0c5ebe0744a 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -2610,18 +2610,19 @@ int st_relay_log_info::wait_for_pos(THD* thd, String* log_name,
init_abort_pos_wait= abort_pos_wait;
/*
- We'll need to
+ We'll need to
handle all possible log names comparisons (e.g. 999 vs 1000).
- We use ulong for string->number conversion ; this is no
+ We use ulong for string->number conversion ; this is no
stronger limitation than in find_uniq_filename in sql/log.cc
*/
ulong log_name_extension;
char log_name_tmp[FN_REFLEN]; //make a char[] from String
- char *end= strmake(log_name_tmp, log_name->ptr(), min(log_name->length(),
- FN_REFLEN-1));
+
+ strmake(log_name_tmp, log_name->ptr(), min(log_name->length(), FN_REFLEN-1));
+
char *p= fn_ext(log_name_tmp);
char *p_end;
- if (!*p || log_pos<0)
+ if (!*p || log_pos<0)
{
error= -2; //means improper arguments
goto err;
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index bcad0e627f4..f9d95b2cde5 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -1240,6 +1240,10 @@ bool acl_check_host(const char *host, const char *ip)
thd THD
host hostname for the user
user user name
+ new_password new password
+
+ NOTE:
+ new_password cannot be NULL
RETURN VALUE
0 OK
@@ -1247,7 +1251,7 @@ bool acl_check_host(const char *host, const char *ip)
*/
bool check_change_password(THD *thd, const char *host, const char *user,
- char *new_password)
+ char *new_password, uint new_password_len)
{
if (!initialized)
{
@@ -1296,12 +1300,13 @@ bool check_change_password(THD *thd, const char *host, const char *user,
bool change_password(THD *thd, const char *host, const char *user,
char *new_password)
{
+ uint new_password_len= strlen(new_password);
DBUG_ENTER("change_password");
DBUG_PRINT("enter",("host: '%s' user: '%s' new_password: '%s'",
host,user,new_password));
DBUG_ASSERT(host != 0); // Ensured by parent
- if (check_change_password(thd, host, user, new_password))
+ if (check_change_password(thd, host, user, new_password, new_password_len))
DBUG_RETURN(1);
VOID(pthread_mutex_lock(&acl_cache->lock));
@@ -1313,7 +1318,6 @@ bool change_password(THD *thd, const char *host, const char *user,
DBUG_RETURN(1);
}
/* update loaded acl entry: */
- uint new_password_len= new_password ? strlen(new_password) : 0;
set_user_salt(acl_user, new_password, new_password_len);
if (update_user_table(thd,
@@ -3241,7 +3245,7 @@ end:
SYNOPSIS
grant_reload()
- thd Thread handler
+ thd Thread handler (can be NULL)
NOTES
Locked tables are checked by acl_init and doesn't have to be checked here
diff --git a/sql/sql_acl.h b/sql/sql_acl.h
index b129ffcdcf8..3a9df84a35d 100644
--- a/sql/sql_acl.h
+++ b/sql/sql_acl.h
@@ -176,7 +176,7 @@ int acl_getroot(THD *thd, USER_RESOURCES *mqh, const char *passwd,
int acl_getroot_no_password(THD *thd);
bool acl_check_host(const char *host, const char *ip);
bool check_change_password(THD *thd, const char *host, const char *user,
- char *password);
+ char *password, uint password_len);
bool change_password(THD *thd, const char *host, const char *user,
char *password);
bool mysql_grant(THD *thd, const char *db, List <LEX_USER> &user_list,
diff --git a/sql/sql_analyse.cc b/sql/sql_analyse.cc
index 6a9a9e51231..ce58c585061 100644
--- a/sql/sql_analyse.cc
+++ b/sql/sql_analyse.cc
@@ -70,6 +70,9 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
field_info **f_info;
DBUG_ENTER("proc_analyse_init");
+ if (!pc)
+ DBUG_RETURN(0);
+
if (!(param = param->next))
{
pc->max_tree_elements = MAX_TREE_ELEMENTS;
@@ -81,33 +84,30 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val_real() < 0)
{
- delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
- DBUG_RETURN(0);
+ goto err;
}
pc->max_tree_elements = (uint) (*param->item)->val_int();
param = param->next;
if (param->next) // no third parameter possible
{
my_error(ER_WRONG_PARAMCOUNT_TO_PROCEDURE, MYF(0), proc_name);
- DBUG_RETURN(0);
+ goto err;
}
// second parameter
if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val_real() < 0)
{
- delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
- DBUG_RETURN(0);
+ goto err;
}
pc->max_treemem = (uint) (*param->item)->val_int();
}
else if ((*param->item)->type() != Item::INT_ITEM ||
(*param->item)->val_real() < 0)
{
- delete pc;
my_error(ER_WRONG_PARAMETERS_TO_PROCEDURE, MYF(0), proc_name);
- DBUG_RETURN(0);
+ goto err;
}
// if only one parameter was given, it will be the value of max_tree_elements
else
@@ -116,34 +116,39 @@ proc_analyse_init(THD *thd, ORDER *param, select_result *result,
pc->max_treemem = MAX_TREEMEM;
}
- if (!pc || !(pc->f_info = (field_info**)
- sql_alloc(sizeof(field_info*)*field_list.elements)))
- DBUG_RETURN(0);
+ if (!(pc->f_info=
+ (field_info**)sql_alloc(sizeof(field_info*)*field_list.elements)))
+ goto err;
pc->f_end = pc->f_info + field_list.elements;
pc->fields = field_list;
- List_iterator_fast<Item> it(pc->fields);
- f_info = pc->f_info;
-
- Item *item;
- while ((item = it++))
{
- if (item->result_type() == INT_RESULT)
+ List_iterator_fast<Item> it(pc->fields);
+ f_info = pc->f_info;
+
+ Item *item;
+ while ((item = it++))
{
- // Check if fieldtype is ulonglong
- if (item->type() == Item::FIELD_ITEM &&
- ((Item_field*) item)->field->type() == FIELD_TYPE_LONGLONG &&
- ((Field_longlong*) ((Item_field*) item)->field)->unsigned_flag)
- *f_info++ = new field_ulonglong(item, pc);
- else
- *f_info++ = new field_longlong(item, pc);
+ if (item->result_type() == INT_RESULT)
+ {
+ // Check if fieldtype is ulonglong
+ if (item->type() == Item::FIELD_ITEM &&
+ ((Item_field*) item)->field->type() == FIELD_TYPE_LONGLONG &&
+ ((Field_longlong*) ((Item_field*) item)->field)->unsigned_flag)
+ *f_info++ = new field_ulonglong(item, pc);
+ else
+ *f_info++ = new field_longlong(item, pc);
+ }
+ if (item->result_type() == REAL_RESULT)
+ *f_info++ = new field_real(item, pc);
+ if (item->result_type() == STRING_RESULT)
+ *f_info++ = new field_str(item, pc);
}
- if (item->result_type() == REAL_RESULT)
- *f_info++ = new field_real(item, pc);
- if (item->result_type() == STRING_RESULT)
- *f_info++ = new field_str(item, pc);
}
DBUG_RETURN(pc);
+err:
+ delete pc;
+ DBUG_RETURN(0);
}
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index fc41643e8d4..3fb2fac5b27 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -261,13 +261,19 @@ void free_io_cache(TABLE *table)
DBUG_VOID_RETURN;
}
- /* Close all tables which aren't in use by any thread */
+/*
+ Close all tables which aren't in use by any thread
+
+ THD can be NULL, but then if_wait_for_refresh must be FALSE
+ and tables must be NULL.
+*/
bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
TABLE_LIST *tables)
{
bool result=0;
DBUG_ENTER("close_cached_tables");
+ DBUG_ASSERT(thd || (!if_wait_for_refresh && !tables));
VOID(pthread_mutex_lock(&LOCK_open));
if (!tables)
@@ -343,7 +349,6 @@ bool close_cached_tables(THD *thd, bool if_wait_for_refresh,
VOID(pthread_mutex_unlock(&LOCK_open));
if (if_wait_for_refresh)
{
- THD *thd=current_thd;
pthread_mutex_lock(&thd->mysys_var->mutex);
thd->mysys_var->current_mutex= 0;
thd->mysys_var->current_cond= 0;
@@ -2401,11 +2406,7 @@ find_field_in_tables(THD *thd, Item_ident *item, TABLE_LIST *tables,
strxnmov(buff,sizeof(buff)-1,db,".",table_name,NullS);
table_name=buff;
}
- if (report_error == REPORT_ALL_ERRORS ||
- report_error == REPORT_EXCEPT_NON_UNIQUE)
- my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, thd->where);
- else
- return (Field*) not_found_field;
+ my_error(ER_UNKNOWN_TABLE, MYF(0), table_name, thd->where);
}
else
if (report_error == REPORT_ALL_ERRORS ||
diff --git a/sql/sql_cache.cc b/sql/sql_cache.cc
index f4345f8ce28..c08d3eae0e1 100644
--- a/sql/sql_cache.cc
+++ b/sql/sql_cache.cc
@@ -1164,12 +1164,12 @@ void Query_cache::invalidate(THD *thd, TABLE_LIST *tables_used,
DBUG_ASSERT(!using_transactions || tables_used->table!=0);
if (tables_used->derived)
continue;
- if (using_transactions &&
- (tables_used->table->file->table_cache_type() ==
+ if (using_transactions &&
+ (tables_used->table->file->table_cache_type() ==
HA_CACHE_TBL_TRANSACT))
- /*
+ /*
Tables_used->table can't be 0 in transaction.
- Only 'drop' invalidate not opened table, but 'drop'
+ Only 'drop' invalidate not opened table, but 'drop'
force transaction finish.
*/
thd->add_changed_table(tables_used->table);
@@ -1217,7 +1217,7 @@ void Query_cache::invalidate(CHANGED_TABLE_LIST *tables_used)
*/
void Query_cache::invalidate_locked_for_write(TABLE_LIST *tables_used)
{
- DBUG_ENTER("Query_cache::invalidate (changed table list)");
+ DBUG_ENTER("Query_cache::invalidate_locked_for_write");
if (query_cache_size > 0 && tables_used)
{
STRUCT_LOCK(&structure_guard_mutex);
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 26929ebc432..cbd4f9049d3 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -227,7 +227,7 @@ void del_dbopt(const char *path)
}
-/*
+/*
Create database options file:
DESCRIPTION
@@ -246,10 +246,10 @@ static bool write_db_opt(THD *thd, const char *path, HA_CREATE_INFO *create)
if (!create->default_table_charset)
create->default_table_charset= thd->variables.collation_server;
-
+
if (put_dbopt(path, create))
return 1;
-
+
if ((file=my_create(path, CREATE_MODE,O_RDWR | O_TRUNC,MYF(MY_WME))) >= 0)
{
ulong length;
@@ -531,21 +531,21 @@ bool mysql_alter_db(THD *thd, const char *db, HA_CREATE_INFO *create_info)
if ((error=write_db_opt(thd, path, create_info)))
goto exit;
- /*
+ /*
Change options if current database is being altered
TODO: Delete this code
*/
if (thd->db && !strcmp(thd->db,db))
{
- thd->db_charset= (create_info && create_info->default_table_charset) ?
- create_info->default_table_charset :
+ thd->db_charset= create_info->default_table_charset ?
+ create_info->default_table_charset :
thd->variables.collation_server;
thd->variables.collation_database= thd->db_charset;
}
if (mysql_bin_log.is_open())
{
- Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
+ Query_log_event qinfo(thd, thd->query, thd->query_length, 0,
/* suppress_use */ TRUE);
/*
@@ -627,12 +627,12 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
pthread_mutex_lock(&LOCK_open);
remove_db_from_cache(db);
pthread_mutex_unlock(&LOCK_open);
-
+
error= -1;
if ((deleted= mysql_rm_known_files(thd, dirp, db, path, 0)) >= 0)
{
ha_drop_database(path);
- query_cache_invalidate1(db);
+ query_cache_invalidate1(db);
error = 0;
}
}
@@ -643,7 +643,7 @@ bool mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
my_casedn_str(files_charset_info, tmp_db);
db= tmp_db;
}
- if (!silent && deleted>=0 && thd)
+ if (!silent && deleted>=0)
{
const char *query;
ulong query_length;
@@ -693,7 +693,7 @@ exit:
have 'if (data_buf) free(data_buf)' data_buf is !=0 so this makes a
DOUBLE free().
Side effects of this double free() are, randomly (depends on the machine),
- when the slave is replicating a DROP DATABASE:
+ when the slave is replicating a DROP DATABASE:
- garbage characters in the error message:
"Error 'Can't drop database 'test2'; database doesn't exist' on query
'h4zI©'"
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 2f6e74225fd..43e82ff57c9 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -1603,9 +1603,6 @@ void st_select_lex::print_limit(THD *thd, String *str)
return;
}
- if (!thd)
- thd= current_thd;
-
if (explicit_limit)
{
str->append(" limit ", 7);
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 9f912ff37c5..4bd6acce499 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -897,14 +897,16 @@ static int check_connection(THD *thd)
char *user= end;
char *passwd= strend(user)+1;
char *db= passwd;
- char db_buff[NAME_LEN+1]; // buffer to store db in utf8
+ char db_buff[NAME_LEN+1]; // buffer to store db in utf8
char user_buff[USERNAME_LENGTH+1]; // buffer to store user in utf8
- /*
+ uint dummy_errors;
+
+ /*
Old clients send null-terminated string as password; new clients send
the size (1 byte) + string (not null-terminated). Hence in case of empty
password both send '\0'.
*/
- uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
+ uint passwd_len= thd->client_capabilities & CLIENT_SECURE_CONNECTION ?
*passwd++ : strlen(passwd);
db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
db + passwd_len + 1 : 0;
@@ -912,7 +914,6 @@ static int check_connection(THD *thd)
/* Since 4.1 all database names are stored in utf8 */
if (db)
{
- uint dummy_errors;
db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
system_charset_info,
db, strlen(db),
@@ -920,14 +921,10 @@ static int check_connection(THD *thd)
db= db_buff;
}
- if (user)
- {
- uint dummy_errors;
- user_buff[copy_and_convert(user_buff, sizeof(user_buff)-1,
- system_charset_info, user, strlen(user),
- thd->charset(), &dummy_errors)]= '\0';
- user= user_buff;
- }
+ user_buff[copy_and_convert(user_buff, sizeof(user_buff)-1,
+ system_charset_info, user, strlen(user),
+ thd->charset(), &dummy_errors)]= '\0';
+ user= user_buff;
if (thd->user)
x_free(thd->user);
@@ -3349,12 +3346,12 @@ unsent_create_error:
/*
If in a slave thread :
ALTER DATABASE DB may not be preceded by USE DB.
- For that reason, maybe db_ok() in sql/slave.cc did not check the
+ For that reason, maybe db_ok() in sql/slave.cc did not check the
do_db/ignore_db. And as this query involves no tables, tables_ok()
above was not called. So we have to check rules again here.
*/
#ifdef HAVE_REPLICATION
- if (thd->slave_thread &&
+ if (thd->slave_thread &&
(!db_ok(db, replicate_do_db, replicate_ignore_db) ||
!db_ok_with_wild_table(db)))
{
@@ -3467,8 +3464,7 @@ unsent_create_error:
case SQLCOM_GRANT:
{
if (check_access(thd, lex->grant | lex->grant_tot_col | GRANT_ACL,
- ((first_table && first_table->db) ?
- first_table->db : select_lex->db),
+ first_table ? first_table->db : select_lex->db,
first_table ? &first_table->grant.privilege : 0,
first_table ? 0 : 1, 0))
goto error;
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 5f8e6cf1f5a..9b2fb4a9c6a 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1977,10 +1977,10 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
for (table= tables; table; table= table->next_local)
{
char table_name[NAME_LEN*2+2];
- char* db = (table->db) ? table->db : thd->db;
+ char* db = table->db;
bool fatal_error=0;
- strxmov(table_name,db ? db : "",".",table->table_name,NullS);
+ strxmov(table_name, db, ".", table->table_name, NullS);
thd->open_options|= extra_open_options;
table->lock_type= lock_type;
/* open only one table from local list of command */
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d2220cd67c3..f9ad513ea6a 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -120,7 +120,7 @@ int mysql_update(THD *thd,
bool used_key_is_modified, transactional_table, log_delayed;
int res;
int error=0;
- uint used_index;
+ uint used_index= MAX_KEY;
#ifndef NO_EMBEDDED_ACCESS_CHECKS
uint want_privilege;
#endif
@@ -134,7 +134,6 @@ int mysql_update(THD *thd,
SELECT_LEX *select_lex= &thd->lex->select_lex;
DBUG_ENTER("mysql_update");
- LINT_INIT(used_index);
LINT_INIT(timestamp_query_id);
if (open_tables(thd, table_list, &table_count))
@@ -273,7 +272,7 @@ int mysql_update(THD *thd,
matching rows before updating the table!
*/
table->file->extra(HA_EXTRA_RETRIEVE_ALL_COLS);
- if ( (used_index != MAX_KEY) && old_used_keys.is_set(used_index))
+ if (used_index < MAX_KEY && old_used_keys.is_set(used_index))
{
table->key_read=1;
table->file->extra(HA_EXTRA_KEYREAD);
diff --git a/sql/table.cc b/sql/table.cc
index a030da95db4..82ad32341c0 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -342,12 +342,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
VOID(my_seek(file,pos,MY_SEEK_SET,MYF(0)));
if (my_read(file,(byte*) head,288,MYF(MY_NABP)))
goto err;
+#ifdef HAVE_CRYPTED_FRM
if (crypted)
{
crypted->decode((char*) head+256,288-256);
if (sint2korr(head+284) != 0) // Should be 0
goto err; // Wrong password
}
+#endif
share->fields= uint2korr(head+258);
pos= uint2korr(head+260); /* Length of all screens */
@@ -375,12 +377,14 @@ int openfrm(THD *thd, const char *name, const char *alias, uint db_stat,
pos+ (uint) (n_length+int_length+com_length));
if (read_string(file,(gptr*) &disk_buff,read_length))
goto err; /* purecov: inspected */
+#ifdef HAVE_CRYPTED_FRM
if (crypted)
{
crypted->decode((char*) disk_buff,read_length);
delete crypted;
crypted=0;
}
+#endif
strpos= disk_buff+pos;
share->intervals= (TYPELIB*) (field_ptr+share->fields+1);
diff --git a/sql/tztime.cc b/sql/tztime.cc
index b9b9e4821c4..4b769aed40c 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -1861,7 +1861,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
{
ttid= (uint)table->field[1]->val_int();
- if (ttid > TZ_MAX_TYPES)
+ if (ttid >= TZ_MAX_TYPES)
{
sql_print_error("Error while loading time zone description from "
"mysql.time_zone_transition_type table: too big "