Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
0298ebb5
Commit
0298ebb5
authored
Jun 03, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/home/my/mysql-4.1
parents
74f3014c
9979feb3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
7 deletions
+19
-7
BUILD/Makefile.am
BUILD/Makefile.am
+1
-0
mysql-test/r/ctype_utf8.result
mysql-test/r/ctype_utf8.result
+3
-0
mysql-test/t/ctype_utf8.test
mysql-test/t/ctype_utf8.test
+7
-0
sql/field.cc
sql/field.cc
+8
-7
No files found.
BUILD/Makefile.am
View file @
0298ebb5
...
...
@@ -19,6 +19,7 @@
EXTRA_DIST
=
FINISH.sh
\
SETUP.sh
\
check-cpu
\
compile-alpha
\
compile-alpha-ccc
\
compile-alpha-cxx
\
...
...
mysql-test/r/ctype_utf8.result
View file @
0298ebb5
...
...
@@ -888,3 +888,6 @@ NULL
select ifnull(NULL, _utf8'string');
ifnull(NULL, _utf8'string')
string
create table t1 (a varchar(255)) default character set utf8;
insert into t1 values (1.0);
drop table t1;
mysql-test/t/ctype_utf8.test
View file @
0298ebb5
...
...
@@ -724,3 +724,10 @@ select ifnull(a,'') from t1;
drop
table
t1
;
select
repeat
(
_utf8
'+'
,
3
)
as
h
union
select
NULL
;
select
ifnull
(
NULL
,
_utf8
'string'
);
#
# Bug#10714: Inserting double value into utf8 column crashes server
#
create
table
t1
(
a
varchar
(
255
))
default
character
set
utf8
;
insert
into
t1
values
(
1.0
);
drop
table
t1
;
sql/field.cc
View file @
0298ebb5
...
...
@@ -4981,31 +4981,32 @@ int Field_str::store(double nr)
char
buff
[
DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE
];
uint
length
;
bool
use_scientific_notation
=
TRUE
;
uint
char_length
=
field_length
/
charset
()
->
mbmaxlen
;
/*
Check fabs(nr) against longest value that can be stored in field,
which depends on whether the value is < 1 or not, and negative or not
*/
double
anr
=
fabs
(
nr
);
int
neg
=
(
nr
<
0.0
)
?
1
:
0
;
if
(
field_length
>
4
&&
field
_length
<
32
&&
(
anr
<
1.0
?
anr
>
1
/
(
log_10
[
max
(
0
,
field
_length
-
neg
-
2
)])
/* -2 for "0." */
:
anr
<
log_10
[
field
_length
-
neg
]
-
1
))
if
(
char_length
>
4
&&
char
_length
<
32
&&
(
anr
<
1.0
?
anr
>
1
/
(
log_10
[
max
(
0
,
char
_length
-
neg
-
2
)])
/* -2 for "0." */
:
anr
<
log_10
[
char
_length
-
neg
]
-
1
))
use_scientific_notation
=
FALSE
;
length
=
(
uint
)
my_sprintf
(
buff
,
(
buff
,
"%-.*g"
,
(
use_scientific_notation
?
max
(
0
,
(
int
)
field
_length
-
neg
-
5
)
:
field
_length
),
max
(
0
,
(
int
)
char
_length
-
neg
-
5
)
:
char
_length
),
nr
));
/*
+1 below is because "precision" in %g above means the
max. number of significant digits, not the output width.
Thus the width can be larger than number of significant digits by 1
(for decimal point)
the test for
field
_length < 5 is for extreme cases,
the test for
char
_length < 5 is for extreme cases,
like inserting 500.0 in char(1)
*/
DBUG_ASSERT
(
field_length
<
5
||
length
<=
field
_length
+
1
);
DBUG_ASSERT
(
char_length
<
5
||
length
<=
char
_length
+
1
);
return
store
((
const
char
*
)
buff
,
length
,
charset
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment