summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BitKeeper/etc/logging_ok2
-rw-r--r--libmysql/libmysql.c6
-rw-r--r--mysql-test/r/alter_table.result8
-rw-r--r--mysql-test/r/func_math.result12
-rw-r--r--mysql-test/t/alter_table.test17
-rw-r--r--mysql-test/t/func_math.test11
-rw-r--r--sql/item_func.cc6
-rw-r--r--sql/sql_table.cc18
8 files changed, 68 insertions, 12 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index 777c590ce62..359cad878c2 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -5,6 +5,7 @@ bar@bar.mysql.r18.ru
bar@bar.udmsearch.izhnet.ru
bell@sanja.is.com.ua
bk@admin.bk
+gluh@gluh.mysql.r18.ru
greg@gcw.ath.cx
greg@mysql.com
guilhem@mysql.com
@@ -12,6 +13,7 @@ heikki@donna.mysql.fi
heikki@hundin.mysql.fi
jani@hynda.mysql.fi
jorge@linux.jorge.mysql.com
+konstantin@mysql.com
lenz@mysql.com
miguel@hegel.(none)
miguel@hegel.br
diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c
index c50193c5e2c..eff8c87ee3f 100644
--- a/libmysql/libmysql.c
+++ b/libmysql/libmysql.c
@@ -438,11 +438,7 @@ simple_command(MYSQL *mysql,enum enum_server_command command, const char *arg,
if (mysql->net.vio == 0)
{ /* Do reconnect if possible */
if (mysql_reconnect(mysql))
- {
- net->last_errno=CR_SERVER_GONE_ERROR;
- strmov(net->last_error,ER(net->last_errno));
goto end;
- }
}
if (mysql->status != MYSQL_STATUS_READY)
{
@@ -1610,6 +1606,8 @@ static my_bool mysql_reconnect(MYSQL *mysql)
{
/* Allov reconnect next time */
mysql->server_status&= ~SERVER_STATUS_IN_TRANS;
+ mysql->net.last_errno= CR_SERVER_GONE_ERROR;
+ strmov(mysql->net.last_error, ER(mysql->net.last_errno));
DBUG_RETURN(1);
}
mysql_init(&tmp_mysql);
diff --git a/mysql-test/r/alter_table.result b/mysql-test/r/alter_table.result
index dbdbb7f57a9..8b104225b9c 100644
--- a/mysql-test/r/alter_table.result
+++ b/mysql-test/r/alter_table.result
@@ -32,3 +32,11 @@ i
2
3
4
+name
+current
+name
+mysqltest
+name
+current
+name
+mysqltest
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result
index e2723311682..5e774fe9886 100644
--- a/mysql-test/r/func_math.result
+++ b/mysql-test/r/func_math.result
@@ -20,3 +20,15 @@ PI() sin(pi()/2) cos(pi()/2) abs(tan(pi())) cot(1) asin(1) acos(0) atan(1)
3.141593 1.000000 0.000000 0.000000 0.64209262 1.570796 1.570796 0.785398
degrees(pi()) radians(360)
180 6.2831853071796
+ACOS(1.0)
+0.000000
+ASIN(1.0)
+1.570796
+ACOS(0.2*5.0)
+0.000000
+ACOS(0.5*2.0)
+0.000000
+ASIN(0.8+0.2)
+1.570796
+ASIN(1.2-0.2)
+1.570796
diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test
index dbfbd4267d8..cfb4f958372 100644
--- a/mysql-test/t/alter_table.test
+++ b/mysql-test/t/alter_table.test
@@ -82,3 +82,20 @@ alter table t1 drop i,add i int unsigned not null auto_increment, drop primary k
select * from t1;
drop table t1;
+#
+# Bug #2628: 'alter table t1 rename mysqltest.t1' silently drops mysqltest.t1
+# if it exists
+#
+create table t1 (name char(15));
+insert into t1 (name) values ("current");
+create database mysqltest;
+create table mysqltest.t1 (name char(15));
+insert into mysqltest.t1 (name) values ("mysqltest");
+select * from t1;
+select * from mysqltest.t1;
+--error 1050
+alter table t1 rename mysqltest.t1;
+select * from t1;
+select * from mysqltest.t1;
+drop table t1;
+drop database mysqltest;
diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test
index 5299897d0f0..42ba8c73f69 100644
--- a/mysql-test/t/func_math.test
+++ b/mysql-test/t/func_math.test
@@ -13,3 +13,14 @@ select pow(10,log10(10)),power(2,4);
select rand(999999),rand();
select pi(),sin(pi()/2),cos(pi()/2),abs(tan(pi())),cot(1),asin(1),acos(0),atan(1);
select degrees(pi()),radians(360);
+
+#
+# Bug #2338 Trignometric arithmatic problems
+#
+
+SELECT ACOS(1.0);
+SELECT ASIN(1.0);
+SELECT ACOS(0.2*5.0);
+SELECT ACOS(0.5*2.0);
+SELECT ASIN(0.8+0.2);
+SELECT ASIN(1.2-0.2);
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 217768db2c5..037f7861630 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -456,7 +456,8 @@ double Item_func_pow::val()
double Item_func_acos::val()
{
- double value=args[0]->val();
+ // the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug)
+ volatile double value=args[0]->val();
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
return 0.0;
return fix_result(acos(value));
@@ -464,7 +465,8 @@ double Item_func_acos::val()
double Item_func_asin::val()
{
- double value=args[0]->val();
+ // the volatile's for BUG #2338 to calm optimizer down (because of gcc's bug)
+ volatile double value=args[0]->val();
if ((null_value=(args[0]->null_value || (value < -1.0 || value > 1.0))))
return 0.0;
return fix_result(asin(value));
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index f273821c5e0..04dfd8a1fbd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -1151,7 +1151,7 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
thd->proc_info="init";
table_name=table_list->real_name;
db=table_list->db;
- if (!new_db)
+ if (!new_db || !strcmp(new_db, db))
new_db=db;
if (!(table=open_ltable(thd,table_list,TL_WRITE_ALLOW_READ)))
@@ -1161,14 +1161,20 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
if (new_name)
{
strmov(new_name_buff,new_name);
- fn_same(new_name_buff,table_name,3);
if (lower_case_table_names)
casedn_str(new_name);
- if ((lower_case_table_names &&
- !my_strcasecmp(new_name_buff,table_name)) ||
- (!lower_case_table_names &&
+ if (new_db == db &&
+ (lower_case_table_names &&
+ !my_strcasecmp(new_name_buff,table_name) ||
+ !lower_case_table_names &&
!strcmp(new_name_buff,table_name)))
- new_name=table_name; // No. Make later check easier
+ {
+ /*
+ Source and destination table names are equal: make later check
+ easier.
+ */
+ new_name= table_name;
+ }
else
{
if (table->tmp_table)