Commit 62a26cf8 authored by monty@mashka.mysql.fi's avatar monty@mashka.mysql.fi

Update after last merge. Fixes some wrong test results.

parent 0f394576
......@@ -3389,19 +3389,6 @@ static my_bool read_prepare_result(MYSQL *mysql, MYSQL_STMT *stmt)
metadata information by reading from server
*/
/* QQ The follwing function will be removed after next merge */
static char *my_strdup_with_length(const byte *from, uint length, myf MyFlags)
{
gptr ptr;
if ((ptr=my_malloc(length+1,MyFlags)) != 0)
{
memcpy((byte*) ptr, (byte*) from,(size_t) length);
((char*) ptr)[length]=0;
}
return((char*) ptr);
}
MYSQL_STMT *STDCALL
mysql_prepare(MYSQL *mysql, const char *query, ulong length)
......
......@@ -71,20 +71,20 @@ slave-bin.002
show binlog events in 'slave-bin.001' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.001 4 Start 2 4 Server ver: VERSION, Binlog ver: 3
slave-bin.001 79 Query 1 79 use test; create table t1(n int not null auto_increment primary key)
slave-bin.001 79 Query 1 79 use `test`; create table t1(n int not null auto_increment primary key)
slave-bin.001 172 Intvar 1 200 INSERT_ID=1
slave-bin.001 200 Query 1 200 use test; insert into t1 values (NULL)
slave-bin.001 263 Query 1 263 use test; drop table t1
slave-bin.001 311 Query 1 311 use test; create table t1 (word char(20) not null)
slave-bin.001 200 Query 1 200 use `test`; insert into t1 values (NULL)
slave-bin.001 263 Query 1 263 use `test`; drop table t1
slave-bin.001 311 Query 1 311 use `test`; create table t1 (word char(20) not null)
slave-bin.001 386 Create_file 1 386 db=test;table=t1;file_id=1;block_len=81
slave-bin.001 565 Exec_load 1 556 ;file_id=1
slave-bin.001 588 Query 1 579 use test; drop table t1
slave-bin.001 588 Query 1 579 use `test`; drop table t1
slave-bin.001 636 Rotate 2 636 slave-bin.002;pos=4
show binlog events in 'slave-bin.002' from 4;
Log_name Pos Event_type Server_id Orig_log_pos Info
slave-bin.002 57 Query 1 4 use `test`; create table t1 (n int)
slave-bin.002 115 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.002 175 Query 1 122 use `test`; drop table t1
slave-bin.002 4 Query 1 4 use `test`; create table t1 (n int)
slave-bin.002 62 Query 1 62 use `test`; insert into t1 values (1)
slave-bin.002 122 Query 1 122 use `test`; drop table t1
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.002 170 slave-relay-bin.002 957 master-bin.002 Yes Yes 0 0 170 961
......
......@@ -9,7 +9,7 @@ File Position Binlog_do_db Binlog_ignore_db
master-bin.001 79
show slave status;
Master_Host Master_User Master_Port Connect_retry Master_Log_File Read_Master_Log_Pos Relay_Log_File Relay_Log_Pos Relay_Master_Log_File Slave_IO_Running Slave_SQL_Running Replicate_do_db Replicate_ignore_db Last_errno Last_error Skip_counter Exec_master_log_pos Relay_log_space
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 124
127.0.0.1 root MASTER_PORT 1 master-bin.001 79 slave-relay-bin.002 120 master-bin.001 Yes Yes 0 0 79 128
change master to master_log_pos=73;
slave stop;
change master to master_log_pos=73;
......
......@@ -145,7 +145,7 @@ void Item_func_sha::fix_length_and_dec()
String *Item_func_aes_encrypt::val_str(String *str)
{
char key_buff[80];
String tmp_key_value(key_buff, sizeof(key_buff));
String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info);
String *sptr= args[0]->val_str(str); // String to encrypt
String *key= args[1]->val_str(&tmp_key_value); // key
int aes_length;
......@@ -180,7 +180,8 @@ void Item_func_aes_encrypt::fix_length_and_dec()
String *Item_func_aes_decrypt::val_str(String *str)
{
char key_buff[80];
String tmp_key_value(key_buff, sizeof(key_buff)), *sptr, *key;
String tmp_key_value(key_buff, sizeof(key_buff), system_charset_info);
String *sptr, *key;
DBUG_ENTER("Item_func_aes_decrypt::val_str");
sptr= args[0]->val_str(str); // String to decrypt
......
......@@ -1526,7 +1526,7 @@ void Append_block_log_event::pack_info(String* packet)
length= (uint) my_sprintf(buf,
(buf, ";file_id=%u;block_len=%u", file_id,
block_len));
net_store_data(packet, buf, length);
net_store_data(packet, buf, (int32) length);
}
......@@ -1571,7 +1571,7 @@ void Delete_file_log_event::pack_info(String* packet)
char buf[64];
uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
net_store_data(packet, buf, length);
net_store_data(packet, buf, (int32) length);
}
#endif
......@@ -1618,7 +1618,7 @@ void Execute_load_log_event::pack_info(String* packet)
char buf[64];
uint length;
length= (uint) my_sprintf(buf, (buf, ";file_id=%u", (uint) file_id));
net_store_data(packet, buf, length);
net_store_data(packet, buf, (int32) length);
}
#endif
......@@ -1659,7 +1659,9 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
mysql_log.write(thd,COM_QUERY,"%s",thd->query);
DBUG_PRINT("query",("%s",thd->query));
mysql_parse(thd, thd->query, q_len);
if ((expected_error != (actual_error = thd->net.last_errno)) &&
DBUG_PRINT("info",("expected_error: %d last_errno: %d",
expected_error, thd->net.last_errno));
if ((expected_error != (actual_error= thd->net.last_errno)) &&
expected_error &&
!ignored_error_code(actual_error) &&
!ignored_error_code(expected_error))
......@@ -1675,6 +1677,7 @@ int Query_log_event::exec_event(struct st_relay_log_info* rli)
else if (expected_error == actual_error ||
ignored_error_code(actual_error))
{
DBUG_PRINT("info",("error ignored"));
thd->query_error = 0;
*rli->last_slave_error = 0;
rli->last_slave_errno = 0;
......
......@@ -31,6 +31,7 @@ void send_error(THD *thd, uint sql_errno, const char *err)
net->last_error : "NULL"));
query_cache_abort(net);
thd->query_error= 1; // needed to catch query errors during replication
if (!err)
{
if (sql_errno)
......@@ -132,6 +133,7 @@ net_printf(THD *thd, uint errcode, ...)
DBUG_ENTER("net_printf");
DBUG_PRINT("enter",("message: %u",errcode));
thd->query_error= 1; // needed to catch query errors during replication
query_cache_abort(net); // Safety
va_start(args,errcode);
/*
......
......@@ -644,7 +644,7 @@ static void acl_update_user(const char *user, const char *host,
{
if (!acl_user->host.hostname && !host[0] ||
acl_user->host.hostname &&
!my_strcasecmp(host,acl_user->host.hostname))
!my_strcasecmp(system_charset_info, host, acl_user->host.hostname))
{
acl_user->access=privileges;
if (mqh->bits & 1)
......@@ -733,7 +733,8 @@ static void acl_update_db(const char *user, const char *host, const char *db,
!strcmp(user,acl_db->user))
{
if (!acl_db->host.hostname && !host[0] ||
acl_db->host.hostname && !my_strcasecmp(host,acl_db->host.hostname))
acl_db->host.hostname &&
!my_strcasecmp(system_charset_info, host, acl_db->host.hostname))
{
if (!acl_db->db && !db[0] ||
acl_db->db && !strcmp(db,acl_db->db))
......@@ -1010,7 +1011,7 @@ bool check_change_password(THD *thd, const char *host, const char *user)
}
if (!thd->slave_thread &&
(strcmp(thd->user,user) ||
my_strcasecmp(system_charset_info, host,thd->host_or_ip)))
my_strcasecmp(system_charset_info, host, thd->host_or_ip)))
{
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
return(1);
......@@ -1662,7 +1663,6 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
char helping [NAME_LEN*2+USERNAME_LENGTH+3];
uint len;
GRANT_TABLE *grant_table,*found=0;
safe_mutex_assert_owner(&LOCK_grant);
len = (uint) (strmov(strmov(strmov(helping,user)+1,db)+1,tname)-helping)+ 1;
for (grant_table=(GRANT_TABLE*) hash_search(&hash_tables,(byte*) helping,
......@@ -1672,7 +1672,8 @@ static GRANT_TABLE *table_hash_search(const char *host,const char* ip,
{
if (exact)
{
if ((host && !my_strcasecmp(host,grant_table->host)) ||
if ((host &&
!my_strcasecmp(system_charset_info, host, grant_table->host)) ||
(ip && !strcmp(ip,grant_table->host)))
return grant_table;
}
......@@ -1872,7 +1873,6 @@ static int replace_table_table(THD *thd, GRANT_TABLE *grant_table,
int error=0;
ulong store_table_rights, store_col_rights;
DBUG_ENTER("replace_table_table");
safe_mutex_assert_owner(&LOCK_grant);
strxmov(grantor, thd->user, "@", thd->host_or_ip, NullS);
......@@ -2734,7 +2734,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
if (!(host=acl_user->host.hostname))
host="%";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(lex_user->host.str,host))
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
break;
}
if (counter == acl_users.elements)
......@@ -2881,7 +2881,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(lex_user->host.str,host))
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
want_access=acl_db->access;
if (want_access)
......@@ -2940,7 +2940,7 @@ int mysql_show_grants(THD *thd,LEX_USER *lex_user)
host="";
if (!strcmp(lex_user->user.str,user) &&
!my_strcasecmp(lex_user->host.str,host))
!my_strcasecmp(system_charset_info, lex_user->host.str, host))
{
want_access=grant_table->privs;
if ((want_access | grant_table->cols) != 0)
......
......@@ -1082,7 +1082,7 @@ bool st_select_lex_unit::create_total_list_n_last_return(THD *thd, st_lex *lex,
for (cursor= **result; cursor; cursor= cursor->next)
if (!strcmp(cursor->db, aux->db) &&
!strcmp(cursor->real_name, aux->real_name) &&
!strcmp(cursor->name, aux->name))
!strcmp(cursor->alias, aux->alias))
break;
if (!cursor)
{
......
......@@ -1460,7 +1460,7 @@ mysql_execute_command(THD *thd)
if (check_global_access(thd, REPL_SLAVE_ACL))
goto error;
#ifndef WORKING_NEW_MASTER
net_printf(&thd->net, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER");
net_printf(thd, ER_NOT_SUPPORTED_YET, "SHOW NEW MASTER");
res= 1;
#else
res = show_new_master(thd);
......
......@@ -351,9 +351,10 @@ static int check_prepare_fields(THD *thd,TABLE *table, List<Item> &fields,
}
TABLE_LIST table_list;
bzero((char*) &table_list,sizeof(table_list));
table_list.name=table->table_name;
table_list.table=table;
table_list.grant=table->grant;
table_list.db= table->table_cache_key;
table_list.real_name= table_list.alias= table->table_name;
table_list.table= table;
table_list.grant= table->grant;
thd->dupp_field=0;
if (setup_tables(&table_list) ||
......
......@@ -418,13 +418,28 @@ ulong convert_month_to_period(ulong month)
}
/*****************************************************************************
** convert a timestamp string to a TIME value.
** At least the following formats are recogniced (based on number of digits)
** YYMMDD, YYYYMMDD, YYMMDDHHMMSS, YYYYMMDDHHMMSS
** YY-MM-DD, YYYY-MM-DD, YY-MM-DD HH.MM.SS
** Returns the type of string
*****************************************************************************/
/*
Convert a timestamp string to a TIME value.
SYNOPSIS
str_to_TIME()
str String to parse
length Length of string
l_time Date is stored here
fuzzy_date 1 if we should allow dates where one part is zero
DESCRIPTION
At least the following formats are recogniced (based on number of digits)
YYMMDD, YYYYMMDD, YYMMDDHHMMSS, YYYYMMDDHHMMSS
YY-MM-DD, YYYY-MM-DD, YY-MM-DD HH.MM.SS
YYYYMMDDTHHMMSS where T is a the character T (ISO8601)
Also dates where all parts are zero are allowed
RETURN VALUES
TIMESTAMP_NONE String wasn't a timestamp
TIMESTAMP_DATE DATE string (YY MM and DD parts ok)
TIMESTAMP_FULL Full timestamp
*/
timestamp_type
str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
......@@ -441,9 +456,9 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
if (str == end)
DBUG_RETURN(TIMESTAMP_NONE);
/*
** calculate first number of digits.
** If length= 8 or >= 14 then year is of format YYYY.
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
calculate first number of digits.
If length= 8 or >= 14 then year is of format YYYY.
(YYYY-MM-DD, YYYYMMDD, YYYYYMMDDHHMMSS)
*/
for (pos=str; pos != end && my_isdigit(system_charset_info,*pos) ; pos++) ;
digits= (uint) (pos-str);
......@@ -453,7 +468,8 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
for (i=0 ; i < 6 && str != end && my_isdigit(system_charset_info,*str) ; i++)
{
uint tmp_value=(uint) (uchar) (*str++ - '0');
while (str != end && my_isdigit(system_charset_info,str[0]) && field_length--)
while (str != end && my_isdigit(system_charset_info,str[0]) &&
field_length--)
{
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
str++;
......@@ -483,7 +499,8 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
str++;
uint tmp_value=(uint) (uchar) (*str - '0');
field_length=3;
while (str++ != end && my_isdigit(system_charset_info,str[0]) && field_length--)
while (str++ != end && my_isdigit(system_charset_info,str[0]) &&
field_length--)
tmp_value=tmp_value*10 + (uint) (uchar) (*str - '0');
date[6]=tmp_value;
not_zero_date|= tmp_value;
......@@ -505,7 +522,7 @@ str_to_TIME(const char *str, uint length, TIME *l_time,bool fuzzy_date)
{
for (; str != end ; str++)
{
if (!isspace(*str))
if (!my_isspace(system_charset_info, *str))
{
not_zero_date= 1; // Give warning
break;
......
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