Commit 10e868bb authored by unknown's avatar unknown

Merge mysql.com:/home/timka/mysql/src/5.0-virgin

into mysql.com:/home/timka/mysql/src/5.0-1972


sql/sql_base.cc:
  Auto merged
parents 975f1c16 e5fd013f
......@@ -284,7 +284,7 @@ Q_EXIT,
Q_UNKNOWN, /* Unknown command. */
Q_COMMENT, /* Comments, ignored. */
Q_COMMENT_WITH_COMMAND,
Q_COMMENT_WITH_COMMAND
};
/* this should really be called command */
......
......@@ -4,11 +4,11 @@ DROP DATABASE IF EXISTS `test_$1`;
CREATE TABLE T1 (a int);
INSERT INTO T1 VALUES (1);
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
T1 BASE TABLE
Tables_in_test (T1)
T1
SHOW TABLES LIKE "t1";
Tables_in_test (t1) table_type
T1 BASE TABLE
Tables_in_test (t1)
T1
SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
......@@ -16,37 +16,37 @@ T1 CREATE TABLE `T1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
T2 BASE TABLE
Tables_in_test (T2)
T2
SELECT * FROM t2;
a
1
RENAME TABLE T2 TO t3;
SHOW TABLES LIKE "T3";
Tables_in_test (T3) table_type
t3 BASE TABLE
Tables_in_test (T3)
t3
RENAME TABLE T3 TO T1;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
T1 BASE TABLE
Tables_in_test (T1)
T1
ALTER TABLE T1 add b int;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
T1 BASE TABLE
Tables_in_test (T1)
T1
ALTER TABLE T1 RENAME T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
T2 BASE TABLE
Tables_in_test (T2)
T2
LOCK TABLE T2 WRITE;
ALTER TABLE T2 drop b;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
T2 BASE TABLE
Tables_in_test (T2)
T2
UNLOCK TABLES;
RENAME TABLE T2 TO T1;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
T1 BASE TABLE
Tables_in_test (T1)
T1
SELECT * from T1;
a
1
......@@ -59,11 +59,11 @@ DROP DATABASE `test_$1`;
CREATE TABLE T1 (a int) engine=innodb;
INSERT INTO T1 VALUES (1);
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
T1 BASE TABLE
Tables_in_test (T1)
T1
SHOW TABLES LIKE "t1";
Tables_in_test (t1) table_type
T1 BASE TABLE
Tables_in_test (t1)
T1
SHOW CREATE TABLE T1;
Table Create Table
T1 CREATE TABLE `T1` (
......@@ -71,37 +71,37 @@ T1 CREATE TABLE `T1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
RENAME TABLE T1 TO T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
t2 BASE TABLE
Tables_in_test (T2)
t2
SELECT * FROM t2;
a
1
RENAME TABLE T2 TO t3;
SHOW TABLES LIKE "T3";
Tables_in_test (T3) table_type
t3 BASE TABLE
Tables_in_test (T3)
t3
RENAME TABLE T3 TO T1;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
t1 BASE TABLE
Tables_in_test (T1)
t1
ALTER TABLE T1 add b int;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
t1 BASE TABLE
Tables_in_test (T1)
t1
ALTER TABLE T1 RENAME T2;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
t2 BASE TABLE
Tables_in_test (T2)
t2
LOCK TABLE T2 WRITE;
ALTER TABLE T2 drop b;
SHOW TABLES LIKE "T2";
Tables_in_test (T2) table_type
t2 BASE TABLE
Tables_in_test (T2)
t2
UNLOCK TABLES;
RENAME TABLE T2 TO T1;
SHOW TABLES LIKE "T1";
Tables_in_test (T1) table_type
t1 BASE TABLE
Tables_in_test (T1)
t1
SELECT * from T1;
a
1
......@@ -124,10 +124,10 @@ drop table T1;
create table T1 (A int);
alter table T1 add index (A);
show tables like 'T1%';
Tables_in_test (T1%) table_type
T1 BASE TABLE
Tables_in_test (T1%)
T1
alter table t1 add index (A);
show tables like 't1%';
Tables_in_test (t1%) table_type
t1 BASE TABLE
Tables_in_test (t1%)
t1
drop table t1;
......@@ -582,6 +582,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
if ((!strcmp(table->db, db_name) &&
!strcmp(table->real_name, table_name)) ||
(table->view &&
table->table->table_cache_key && // it is not temporary table
!my_strcasecmp(table_alias_charset,
table->table->table_cache_key, db_name) &&
!my_strcasecmp(table_alias_charset,
......@@ -626,6 +627,9 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
TABLE_LIST *res;
const char *d_name= table->db, *t_name= table->real_name;
char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_NAME];
/* temporary table is always unique */
if (table->table && table->table->tmp_table != NO_TMP_TABLE)
return 0;
if (table->view)
{
/* it is view and table opened */
......@@ -643,11 +647,6 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
d_name= table->table->table_cache_key;
t_name= table->table->table_name;
}
if (d_name == 0)
{
/* it's temporary table => always unique */
return 0;
}
}
DBUG_PRINT("info", ("real table: %s.%s", d_name, t_name));
......
......@@ -867,7 +867,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
error=E_DEC_TRUNCATED;
}
if (scale+from->intg <=0)
if (scale+from->intg <0)
{
decimal_make_zero(to);
return E_DEC_OK;
......@@ -881,7 +881,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
buf0=from->buf;
buf1=to->buf;
to->sign=from->sign;
to->intg=min(from->intg, len*DIG_PER_DEC1);
to->intg=min(intg0, len)*DIG_PER_DEC1;
}
if (frac0 > frac1)
......@@ -921,8 +921,6 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
*buf1-=DIG_BASE;
while (carry && --buf1 >= to->buf)
ADD(*buf1, *buf1, 0, carry);
if (to->buf[0] > from->buf[0])
to->intg++;
if (unlikely(carry))
{
/* shifting the number to create space for new digit */
......@@ -937,6 +935,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
buf1[0]=buf1[-1];
}
*buf1=1;
to->intg++;
}
}
if (scale<0) scale=0;
......@@ -2058,6 +2057,7 @@ main()
test_ro("15.17",1,HALF_UP);
test_ro("15.4",-1,HALF_UP);
test_ro("-15.4",-1,HALF_UP);
test_ro("5.4",-1,HALF_UP);
test_ro("15.1",0,HALF_EVEN);
test_ro("15.5",0,HALF_EVEN);
test_ro("14.5",0,HALF_EVEN);
......
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