mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
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
This commit is contained in:
@ -284,7 +284,7 @@ Q_EXIT,
|
|||||||
|
|
||||||
Q_UNKNOWN, /* Unknown command. */
|
Q_UNKNOWN, /* Unknown command. */
|
||||||
Q_COMMENT, /* Comments, ignored. */
|
Q_COMMENT, /* Comments, ignored. */
|
||||||
Q_COMMENT_WITH_COMMAND,
|
Q_COMMENT_WITH_COMMAND
|
||||||
};
|
};
|
||||||
|
|
||||||
/* this should really be called command */
|
/* this should really be called command */
|
||||||
|
@ -4,11 +4,11 @@ DROP DATABASE IF EXISTS `test_$1`;
|
|||||||
CREATE TABLE T1 (a int);
|
CREATE TABLE T1 (a int);
|
||||||
INSERT INTO T1 VALUES (1);
|
INSERT INTO T1 VALUES (1);
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
SHOW TABLES LIKE "t1";
|
SHOW TABLES LIKE "t1";
|
||||||
Tables_in_test (t1) table_type
|
Tables_in_test (t1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
SHOW CREATE TABLE T1;
|
SHOW CREATE TABLE T1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
T1 CREATE TABLE `T1` (
|
T1 CREATE TABLE `T1` (
|
||||||
@ -16,37 +16,37 @@ T1 CREATE TABLE `T1` (
|
|||||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
) ENGINE=MyISAM DEFAULT CHARSET=latin1
|
||||||
RENAME TABLE T1 TO T2;
|
RENAME TABLE T1 TO T2;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
T2 BASE TABLE
|
T2
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
RENAME TABLE T2 TO t3;
|
RENAME TABLE T2 TO t3;
|
||||||
SHOW TABLES LIKE "T3";
|
SHOW TABLES LIKE "T3";
|
||||||
Tables_in_test (T3) table_type
|
Tables_in_test (T3)
|
||||||
t3 BASE TABLE
|
t3
|
||||||
RENAME TABLE T3 TO T1;
|
RENAME TABLE T3 TO T1;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
ALTER TABLE T1 add b int;
|
ALTER TABLE T1 add b int;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
ALTER TABLE T1 RENAME T2;
|
ALTER TABLE T1 RENAME T2;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
T2 BASE TABLE
|
T2
|
||||||
LOCK TABLE T2 WRITE;
|
LOCK TABLE T2 WRITE;
|
||||||
ALTER TABLE T2 drop b;
|
ALTER TABLE T2 drop b;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
T2 BASE TABLE
|
T2
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
RENAME TABLE T2 TO T1;
|
RENAME TABLE T2 TO T1;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
SELECT * from T1;
|
SELECT * from T1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -59,11 +59,11 @@ DROP DATABASE `test_$1`;
|
|||||||
CREATE TABLE T1 (a int) engine=innodb;
|
CREATE TABLE T1 (a int) engine=innodb;
|
||||||
INSERT INTO T1 VALUES (1);
|
INSERT INTO T1 VALUES (1);
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
SHOW TABLES LIKE "t1";
|
SHOW TABLES LIKE "t1";
|
||||||
Tables_in_test (t1) table_type
|
Tables_in_test (t1)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
SHOW CREATE TABLE T1;
|
SHOW CREATE TABLE T1;
|
||||||
Table Create Table
|
Table Create Table
|
||||||
T1 CREATE TABLE `T1` (
|
T1 CREATE TABLE `T1` (
|
||||||
@ -71,37 +71,37 @@ T1 CREATE TABLE `T1` (
|
|||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
) ENGINE=InnoDB DEFAULT CHARSET=latin1
|
||||||
RENAME TABLE T1 TO T2;
|
RENAME TABLE T1 TO T2;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
t2 BASE TABLE
|
t2
|
||||||
SELECT * FROM t2;
|
SELECT * FROM t2;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
RENAME TABLE T2 TO t3;
|
RENAME TABLE T2 TO t3;
|
||||||
SHOW TABLES LIKE "T3";
|
SHOW TABLES LIKE "T3";
|
||||||
Tables_in_test (T3) table_type
|
Tables_in_test (T3)
|
||||||
t3 BASE TABLE
|
t3
|
||||||
RENAME TABLE T3 TO T1;
|
RENAME TABLE T3 TO T1;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
t1 BASE TABLE
|
t1
|
||||||
ALTER TABLE T1 add b int;
|
ALTER TABLE T1 add b int;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
t1 BASE TABLE
|
t1
|
||||||
ALTER TABLE T1 RENAME T2;
|
ALTER TABLE T1 RENAME T2;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
t2 BASE TABLE
|
t2
|
||||||
LOCK TABLE T2 WRITE;
|
LOCK TABLE T2 WRITE;
|
||||||
ALTER TABLE T2 drop b;
|
ALTER TABLE T2 drop b;
|
||||||
SHOW TABLES LIKE "T2";
|
SHOW TABLES LIKE "T2";
|
||||||
Tables_in_test (T2) table_type
|
Tables_in_test (T2)
|
||||||
t2 BASE TABLE
|
t2
|
||||||
UNLOCK TABLES;
|
UNLOCK TABLES;
|
||||||
RENAME TABLE T2 TO T1;
|
RENAME TABLE T2 TO T1;
|
||||||
SHOW TABLES LIKE "T1";
|
SHOW TABLES LIKE "T1";
|
||||||
Tables_in_test (T1) table_type
|
Tables_in_test (T1)
|
||||||
t1 BASE TABLE
|
t1
|
||||||
SELECT * from T1;
|
SELECT * from T1;
|
||||||
a
|
a
|
||||||
1
|
1
|
||||||
@ -124,10 +124,10 @@ drop table T1;
|
|||||||
create table T1 (A int);
|
create table T1 (A int);
|
||||||
alter table T1 add index (A);
|
alter table T1 add index (A);
|
||||||
show tables like 'T1%';
|
show tables like 'T1%';
|
||||||
Tables_in_test (T1%) table_type
|
Tables_in_test (T1%)
|
||||||
T1 BASE TABLE
|
T1
|
||||||
alter table t1 add index (A);
|
alter table t1 add index (A);
|
||||||
show tables like 't1%';
|
show tables like 't1%';
|
||||||
Tables_in_test (t1%) table_type
|
Tables_in_test (t1%)
|
||||||
t1 BASE TABLE
|
t1
|
||||||
drop table t1;
|
drop table t1;
|
||||||
|
@ -582,6 +582,7 @@ TABLE_LIST *find_table_in_list(TABLE_LIST *table,
|
|||||||
if ((!strcmp(table->db, db_name) &&
|
if ((!strcmp(table->db, db_name) &&
|
||||||
!strcmp(table->real_name, table_name)) ||
|
!strcmp(table->real_name, table_name)) ||
|
||||||
(table->view &&
|
(table->view &&
|
||||||
|
table->table->table_cache_key && // it is not temporary table
|
||||||
!my_strcasecmp(table_alias_charset,
|
!my_strcasecmp(table_alias_charset,
|
||||||
table->table->table_cache_key, db_name) &&
|
table->table->table_cache_key, db_name) &&
|
||||||
!my_strcasecmp(table_alias_charset,
|
!my_strcasecmp(table_alias_charset,
|
||||||
@ -626,6 +627,9 @@ TABLE_LIST* unique_table(TABLE_LIST *table, TABLE_LIST *table_list)
|
|||||||
TABLE_LIST *res;
|
TABLE_LIST *res;
|
||||||
const char *d_name= table->db, *t_name= table->real_name;
|
const char *d_name= table->db, *t_name= table->real_name;
|
||||||
char d_name_buff[MAX_ALIAS_NAME], t_name_buff[MAX_ALIAS_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)
|
if (table->view)
|
||||||
{
|
{
|
||||||
/* it is view and table opened */
|
/* 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;
|
d_name= table->table->table_cache_key;
|
||||||
t_name= table->table->table_name;
|
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));
|
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;
|
error=E_DEC_TRUNCATED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scale+from->intg <=0)
|
if (scale+from->intg <0)
|
||||||
{
|
{
|
||||||
decimal_make_zero(to);
|
decimal_make_zero(to);
|
||||||
return E_DEC_OK;
|
return E_DEC_OK;
|
||||||
@ -881,7 +881,7 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
|
|||||||
buf0=from->buf;
|
buf0=from->buf;
|
||||||
buf1=to->buf;
|
buf1=to->buf;
|
||||||
to->sign=from->sign;
|
to->sign=from->sign;
|
||||||
to->intg=min(from->intg, len*DIG_PER_DEC1);
|
to->intg=min(intg0, len)*DIG_PER_DEC1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (frac0 > frac1)
|
if (frac0 > frac1)
|
||||||
@ -921,8 +921,6 @@ int decimal_round(decimal *from, decimal *to, int scale, decimal_round_mode mode
|
|||||||
*buf1-=DIG_BASE;
|
*buf1-=DIG_BASE;
|
||||||
while (carry && --buf1 >= to->buf)
|
while (carry && --buf1 >= to->buf)
|
||||||
ADD(*buf1, *buf1, 0, carry);
|
ADD(*buf1, *buf1, 0, carry);
|
||||||
if (to->buf[0] > from->buf[0])
|
|
||||||
to->intg++;
|
|
||||||
if (unlikely(carry))
|
if (unlikely(carry))
|
||||||
{
|
{
|
||||||
/* shifting the number to create space for new digit */
|
/* 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[0]=buf1[-1];
|
||||||
}
|
}
|
||||||
*buf1=1;
|
*buf1=1;
|
||||||
|
to->intg++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (scale<0) scale=0;
|
if (scale<0) scale=0;
|
||||||
@ -2058,6 +2057,7 @@ main()
|
|||||||
test_ro("15.17",1,HALF_UP);
|
test_ro("15.17",1,HALF_UP);
|
||||||
test_ro("15.4",-1,HALF_UP);
|
test_ro("15.4",-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.1",0,HALF_EVEN);
|
||||||
test_ro("15.5",0,HALF_EVEN);
|
test_ro("15.5",0,HALF_EVEN);
|
||||||
test_ro("14.5",0,HALF_EVEN);
|
test_ro("14.5",0,HALF_EVEN);
|
||||||
|
Reference in New Issue
Block a user