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
48b61d61
Commit
48b61d61
authored
20 years ago
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Plain Diff
Merge heikki@build.mysql.com:/home/bk/mysql-4.0
into hundin.mysql.fi:/home/heikki/mysql-4.0
parents
77aa9abf
f1ab1b12
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
4 deletions
+34
-4
client/mysql.cc
client/mysql.cc
+7
-4
sql/field.cc
sql/field.cc
+27
-0
No files found.
client/mysql.cc
View file @
48b61d61
...
@@ -2351,13 +2351,16 @@ com_status(String *buffer __attribute__((unused)),
...
@@ -2351,13 +2351,16 @@ com_status(String *buffer __attribute__((unused)),
MYSQL_RES
*
result
;
MYSQL_RES
*
result
;
LINT_INIT
(
result
);
LINT_INIT
(
result
);
tee_fprintf
(
stdout
,
"
\n
Connection id:
\t\t
%lu
\n
"
,
mysql_thread_id
(
&
mysql
));
tee_fprintf
(
stdout
,
"
\n
Connection id:
\t\t
%lu
\n
"
,
mysql_thread_id
(
&
mysql
));
if
(
!
mysql_query
(
&
mysql
,
"select DATABASE(),
USER()
"
)
&&
if
(
!
mysql_query
(
&
mysql
,
"select DATABASE(),
USER() limit 1
"
)
&&
(
result
=
mysql_use_result
(
&
mysql
)))
(
result
=
mysql_use_result
(
&
mysql
)))
{
{
MYSQL_ROW
cur
=
mysql_fetch_row
(
result
);
MYSQL_ROW
cur
=
mysql_fetch_row
(
result
);
if
(
cur
)
{
tee_fprintf
(
stdout
,
"Current database:
\t
%s
\n
"
,
cur
[
0
]
?
cur
[
0
]
:
""
);
tee_fprintf
(
stdout
,
"Current database:
\t
%s
\n
"
,
cur
[
0
]
?
cur
[
0
]
:
""
);
tee_fprintf
(
stdout
,
"Current user:
\t\t
%s
\n
"
,
cur
[
1
]);
tee_fprintf
(
stdout
,
"Current user:
\t\t
%s
\n
"
,
cur
[
1
]);
(
void
)
mysql_fetch_row
(
result
);
// Read eof
}
mysql_free_result
(
result
);
}
}
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
if
(
mysql
.
net
.
vio
&&
mysql
.
net
.
vio
->
ssl_arg
&&
if
(
mysql
.
net
.
vio
&&
mysql
.
net
.
vio
->
ssl_arg
&&
...
...
This diff is collapsed.
Click to expand it.
sql/field.cc
View file @
48b61d61
...
@@ -2332,6 +2332,33 @@ String *Field_double::val_str(String *val_buffer,
...
@@ -2332,6 +2332,33 @@ String *Field_double::val_str(String *val_buffer,
if
(
dec
>=
NOT_FIXED_DEC
)
if
(
dec
>=
NOT_FIXED_DEC
)
{
{
/*
Let's try to pretty print a floating point number. Here we use
'%-*.*g' conversion string:
'-' stands for left-padding with spaces, if such padding will take
place
'*' is a placeholder for the first argument, field_length, and
signifies minimal width of result string. If result is less than
field length it will be space-padded. Note, however, that we'll not
pass spaces to Field_string::store(const char *, ...), due to
strcend in the next line.
'.*' is a placeholder for DBL_DIG and defines maximum number of
significant digits in the result string. DBL_DIG is a hardware
specific C define for maximum number of decimal digits of a floating
point number, such that rounding to hardware floating point
representation and back to decimal will not lead to loss of
precision. I.e if DBL_DIG is 15, number 123456789111315 can be
represented as double without precision loss. As one can judge from
this description, chosing DBL_DIG here is questionable, especially
because it introduces a system dependency.
'g' means that conversion will use [-]ddd.ddd (conventional) style,
and fall back to [-]d.ddde[+|i]ddd (scientific) style if there is no
enough space for all digits.
Maximum length of result string (not counting spaces) is (I guess)
DBL_DIG + 8, where 8 is 1 for sign, 1 for decimal point, 1 for
exponent sign, 1 for exponent, and 4 for exponent value.
XXX: why do we use space-padding and trim spaces in the next line?
*/
sprintf
(
to
,
"%-*.*g"
,(
int
)
field_length
,
DBL_DIG
,
nr
);
sprintf
(
to
,
"%-*.*g"
,(
int
)
field_length
,
DBL_DIG
,
nr
);
to
=
strcend
(
to
,
' '
);
to
=
strcend
(
to
,
' '
);
}
}
...
...
This diff is collapsed.
Click to expand it.
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