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
8ef3cdc2
Commit
8ef3cdc2
authored
Aug 19, 2004
by
serg@serg.mylan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
take dec. point into account in store_double_in_string
parent
754fafd2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
sql/field.cc
sql/field.cc
+12
-6
No files found.
sql/field.cc
View file @
8ef3cdc2
...
@@ -3716,7 +3716,7 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
...
@@ -3716,7 +3716,7 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
{
{
bool
use_scientific_notation
=
TRUE
;
bool
use_scientific_notation
=
TRUE
;
char
buff
[
DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE
];
char
buff
[
DOUBLE_TO_STRING_CONVERSION_BUFFER_SIZE
];
int
length
;
u
int
length
;
if
(
field_length
<
32
&&
nr
>
1
)
if
(
field_length
<
32
&&
nr
>
1
)
{
{
if
(
field
->
ceiling
==
0
)
if
(
field
->
ceiling
==
0
)
...
@@ -3732,11 +3732,17 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
...
@@ -3732,11 +3732,17 @@ static void store_double_in_string_field(Field_str *field, uint32 field_length,
}
}
use_scientific_notation
=
(
field
->
ceiling
<
nr
);
use_scientific_notation
=
(
field
->
ceiling
<
nr
);
}
}
length
=
sprintf
(
buff
,
"%-.*g"
,
length
=
(
uint
)
sprintf
(
buff
,
"%-.*g"
,
use_scientific_notation
?
max
(
0
,
field_length
-
5
)
:
field_length
,
use_scientific_notation
?
max
(
0
,
field_length
-
5
)
:
field_length
,
nr
);
nr
);
DBUG_ASSERT
(
length
<=
field_length
);
/*
field
->
store
(
buff
,
(
uint
)
length
);
+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)
*/
DBUG_ASSERT
(
length
<=
field_length
+
1
);
field
->
store
(
buff
,
min
(
length
,
field_length
));
}
}
void
Field_string
::
store
(
double
nr
)
void
Field_string
::
store
(
double
nr
)
...
...
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