Commit 6c8ae9d6 authored by unknown's avatar unknown
Browse files

Merge bk-internal.mysql.com:/home/bk/mysql-5.0

into mysql.com:/home/my/mysql-5.0


BUILD/SETUP.sh:
  Auto merged
mysql-test/r/ps_6bdb.result:
  Auto merged
sql/item.h:
  Auto merged
sql/item_func.cc:
  Auto merged
sql/item_func.h:
  Auto merged
sql/log_event.cc:
  Auto merged
sql/my_decimal.cc:
  Auto merged
sql/my_decimal.h:
  Auto merged
sql/mysql_priv.h:
  Auto merged
sql/sp_head.cc:
  Auto merged
sql/sql_base.cc:
  Auto merged
sql/sql_class.cc:
  Auto merged
sql/sql_select.cc:
  Auto merged
parents 0bc02450 64cc538b
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -17,7 +17,9 @@
#ifndef _decimal_h
#define _decimal_h

typedef enum {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR} decimal_round_mode;
typedef enum
{TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR}
  decimal_round_mode;
typedef int32 decimal_digit;

typedef struct st_decimal {
@@ -26,11 +28,10 @@ typedef struct st_decimal {
  decimal_digit *buf;
} decimal;

int internal_str2dec(const char *from, decimal *to, char **end, my_bool fixed);
int decimal2string(decimal *from, char *to, int *to_len,
                   int fixed_precision, int fixed_decimals,
                   char filler);
int string2decimal(char *from, decimal *to, char **end);
int string2decimal_fixed(char *from, decimal *to, char **end);
int decimal2ulonglong(decimal *from, ulonglong *to);
int ulonglong2decimal(ulonglong from, decimal *to);
int decimal2longlong(decimal *from, longlong *to);
@@ -51,10 +52,14 @@ int decimal_cmp(decimal *from1, decimal *from2);
int decimal_mul(decimal *from1, decimal *from2, decimal *to);
int decimal_div(decimal *from1, decimal *from2, decimal *to, int scale_incr);
int decimal_mod(decimal *from1, decimal *from2, decimal *to);
int decimal_round(decimal *from, decimal *to, int new_scale, decimal_round_mode mode);
int decimal_round(decimal *from, decimal *to, int new_scale,
                  decimal_round_mode mode);
int decimal_is_zero(decimal *from);
void max_decimal(int precision, int frac, decimal *to);

#define string2decimal(A,B,C) internal_str2dec((A), (B), (C), 0)
#define string2decimal_fixed(A,B,C) internal_str2dec((A), (B), (C), 1)

/* set a decimal to zero */

#define decimal_make_zero(dec)        do {                \
+20 −0
Original line number Diff line number Diff line
@@ -90,6 +90,26 @@ id avg(rating)
1	3.0000
2	NULL
3	2.0000
select sql_small_result t2.id, avg(rating) from t2 group by t2.id;
id	avg(rating)
1	3.0000
2	NULL
3	2.0000
select sql_big_result t2.id, avg(rating) from t2 group by t2.id;
id	avg(rating)
1	3.0000
2	NULL
3	2.0000
select sql_small_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
id	avg(rating+0.0e0)
1	3
2	NULL
3	2
select sql_big_result t2.id, avg(rating+0.0e0) from t2 group by t2.id;
id	avg(rating+0.0e0)
1	3
2	NULL
3	2
drop table t1,t2;
create table t1 (a smallint(6) primary key, c char(10), b text);
INSERT INTO t1 VALUES (1,'1','1');
+6 −0
Original line number Diff line number Diff line
@@ -30,6 +30,12 @@ Y-N-N-Y-N Y,N,N,Y,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,N,
select elt(2,1),field(NULL,"a","b","c");
elt(2,1)	field(NULL,"a","b","c")
NULL	0
select field("b","a",NULL),field(1,0,NULL)+0,field(1.0,0.0,NULL)+0.0,field(1.0e1,0.0e1,NULL)+0.0e1;
field("b","a",NULL)	field(1,0,NULL)+0	field(1.0,0.0,NULL)+0.0	field(1.0e1,0.0e1,NULL)+0.0e1
0	0	0.0	0
select field(NULL,"a",NULL),field(NULL,0,NULL)+0,field(NULL,0.0,NULL)+0.0,field(NULL,0.0e1,NULL)+0.0e1;
field(NULL,"a",NULL)	field(NULL,0,NULL)+0	field(NULL,0.0,NULL)+0.0	field(NULL,0.0e1,NULL)+0.0e1
0	0	0.0	0
select find_in_set("","a,b,c"),find_in_set("","a,b,c,"),find_in_set("",",a,b,c");
find_in_set("","a,b,c")	find_in_set("","a,b,c,")	find_in_set("",",a,b,c")
0	4	1
+23 −0
Original line number Diff line number Diff line
@@ -169,8 +169,19 @@ Warnings:
Warning	1264	Out of range value adjusted for column 'a' at row 1
Note	1265	Data truncated for column 'a' at row 2
Warning	1264	Out of range value adjusted for column 'a' at row 3
insert into t1 values ("1e+4294967296"),("1e-4294967296");
Warnings:
Warning	1264	Out of range value adjusted for column 'a' at row 1
Note	1265	Data truncated for column 'a' at row 2
insert into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809");
Warnings:
Warning	1264	Out of range value adjusted for column 'a' at row 1
Warning	1366	Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2
Note	1265	Data truncated for column 'a' at row 3
Warning	1366	Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note	1265	Data truncated for column 'a' at row 1
Note	1265	Data truncated for column 'a' at row 3
select * from t1;
a
@@ -195,6 +206,12 @@ a
99999999.99
0.00
-99999999.99
99999999.99
0.00
99999999.99
0.00
0.00
0.00
123.40
12340.00
1.23
@@ -229,6 +246,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning	1264	Out of range value adjusted for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note	1265	Data truncated for column 'a' at row 1
Note	1265	Data truncated for column 'a' at row 3
select * from t1;
a
@@ -287,6 +305,7 @@ Note 1265 Data truncated for column 'a' at row 2
Warning	1264	Out of range value adjusted for column 'a' at row 3
insert into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0");
Warnings:
Note	1265	Data truncated for column 'a' at row 1
Note	1265	Data truncated for column 'a' at row 3
select * from t1;
a
@@ -338,6 +357,7 @@ Warning 1264 Out of range value adjusted for column 'a' at row 3
insert into t1 values (123.4e0),(123.4e+2),(123.4e-2),(123e1),(123e+0);
Warnings:
Note	1265	Data truncated for column 'a' at row 3
insert into t1 values (MID("987",1,2)),("987 "),("987.6e+2 ");
select * from t1;
a
0.00
@@ -366,6 +386,9 @@ a
1.23
1230.00
123.00
98.00
987.00
98760.00
drop  table t1;
create table t1 (a decimal);
insert into t1 values (-99999999999999),(-1),('+1'),('01'),('+00000000000001'),('+12345678901'),(99999999999999);
+1 −1
Original line number Diff line number Diff line
@@ -696,7 +696,7 @@ end while; select v1, v2, v3 * 0.000000000001, v4 * 0.000000000001; end;//
call p1()//
#
v1	v2	v3 * 0.000000000001	v4 * 0.000000000001
1.000000100000	1.999999900000	1.000000100000000000	1.999999900000000000
1.000000100000	1.999999900000	1.000000100000	1.999999900000
drop procedure p1;
drop table if exists t1;
Warnings:
Loading