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
43c16599
Commit
43c16599
authored
Mar 20, 2009
by
Tatiana A. Nurnberg
Browse files
Options
Browse Files
Download
Plain Diff
auto-merge
parents
df1a9f6c
dc1e9bfb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
12 deletions
+23
-12
client/mysql.cc
client/mysql.cc
+23
-12
No files found.
client/mysql.cc
View file @
43c16599
...
...
@@ -49,7 +49,7 @@ const char *VER= "14.14";
#define MAX_COLUMN_LENGTH 1024
/* Buffer to hold 'version' and 'version_comment' */
#define MAX_SERVER_VERSION_LENGTH 128
static
char
*
server_version
=
NULL
;
/* Array of options to pass to libemysqld */
#define MAX_SERVER_ARGS 64
...
...
@@ -1236,6 +1236,7 @@ sig_handler mysql_end(int sig)
glob_buffer
.
free
();
old_buffer
.
free
();
processed_prompt
.
free
();
my_free
(
server_version
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
opt_password
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
opt_mysql_unix_port
,
MYF
(
MY_ALLOW_ZERO_PTR
));
my_free
(
histfile
,
MYF
(
MY_ALLOW_ZERO_PTR
));
...
...
@@ -4365,16 +4366,11 @@ select_limit, max_join_size);
static
const
char
*
server_version_string
(
MYSQL
*
con
)
{
static
char
buf
[
MAX_SERVER_VERSION_LENGTH
]
=
""
;
/* Only one thread calls this, so no synchronization is needed */
if
(
buf
[
0
]
==
'\0'
)
if
(
server_version
==
NULL
)
{
char
*
bufp
=
buf
;
MYSQL_RES
*
result
;
bufp
=
strnmov
(
buf
,
mysql_get_server_info
(
con
),
sizeof
buf
);
/* "limit 1" is protection against SQL_SELECT_LIMIT=0 */
if
(
!
mysql_query
(
con
,
"select @@version_comment limit 1"
)
&&
(
result
=
mysql_use_result
(
con
)))
...
...
@@ -4382,17 +4378,32 @@ server_version_string(MYSQL *con)
MYSQL_ROW
cur
=
mysql_fetch_row
(
result
);
if
(
cur
&&
cur
[
0
])
{
bufp
=
strxnmov
(
bufp
,
sizeof
buf
-
(
bufp
-
buf
),
" "
,
cur
[
0
],
NullS
);
/* version, space, comment, \0 */
size_t
len
=
strlen
(
mysql_get_server_info
(
con
))
+
strlen
(
cur
[
0
])
+
2
;
if
((
server_version
=
(
char
*
)
my_malloc
(
len
,
MYF
(
MY_WME
))))
{
char
*
bufp
;
bufp
=
strmov
(
server_version
,
mysql_get_server_info
(
con
));
bufp
=
strmov
(
bufp
,
" "
);
(
void
)
strmov
(
bufp
,
cur
[
0
]);
}
}
mysql_free_result
(
result
);
}
/* str*nmov doesn't guarantee NUL-termination */
if
(
bufp
==
buf
+
sizeof
buf
)
buf
[
sizeof
buf
-
1
]
=
'\0'
;
/*
If for some reason we didn't get a version_comment, we'll
keep things simple.
*/
if
(
server_version
==
NULL
)
{
server_version
=
strdup
(
mysql_get_server_info
(
con
));
}
}
return
buf
;
return
server_version
?
server_version
:
""
;
}
static
int
...
...
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