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
5ec1adee
Commit
5ec1adee
authored
Jan 05, 2004
by
jani@rhols221.adsl.netsonic.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed Bug#2205.
parent
7bb74b65
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
2 deletions
+28
-2
client/mysql.cc
client/mysql.cc
+28
-2
No files found.
client/mysql.cc
View file @
5ec1adee
...
@@ -2436,8 +2436,9 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
...
@@ -2436,8 +2436,9 @@ com_delimiter(String *buffer __attribute__((unused)), char *line)
static
int
static
int
com_use
(
String
*
buffer
__attribute__
((
unused
)),
char
*
line
)
com_use
(
String
*
buffer
__attribute__
((
unused
)),
char
*
line
)
{
{
char
*
tmp
;
char
*
tmp
,
buff
[
FN_REFLEN
+
1
];
char
buff
[
256
];
MYSQL_RES
*
res
;
MYSQL_ROW
row
;
bzero
(
buff
,
sizeof
(
buff
));
bzero
(
buff
,
sizeof
(
buff
));
strmov
(
buff
,
line
);
strmov
(
buff
,
line
);
...
@@ -2447,6 +2448,31 @@ com_use(String *buffer __attribute__((unused)), char *line)
...
@@ -2447,6 +2448,31 @@ com_use(String *buffer __attribute__((unused)), char *line)
put_info
(
"USE must be followed by a database name"
,
INFO_ERROR
);
put_info
(
"USE must be followed by a database name"
,
INFO_ERROR
);
return
0
;
return
0
;
}
}
/*
We need to recheck the current database, because it may change
under our feet, for example if DROP DATABASE or RENAME DATABASE
(latter one not yet available by the time the comment was written)
*/
current_db
=
0
;
// Let's reset current_db, assume it's gone
/*
We don't care about in case of an error below because current_db
was just set to 0.
*/
if
(
!
mysql_query
(
&
mysql
,
"SELECT DATABASE()"
)
&&
(
res
=
mysql_use_result
(
&
mysql
)))
{
row
=
mysql_fetch_row
(
res
);
if
(
row
[
0
]
&&
(
!
current_db
||
cmp_database
(
charset_info
,
current_db
,
row
[
0
])))
{
my_free
(
current_db
,
MYF
(
MY_ALLOW_ZERO_PTR
));
current_db
=
my_strdup
(
row
[
0
],
MYF
(
MY_WME
));
}
(
void
)
mysql_fetch_row
(
res
);
// Read eof
mysql_free_result
(
res
);
}
if
(
!
current_db
||
cmp_database
(
charset_info
,
current_db
,
tmp
))
if
(
!
current_db
||
cmp_database
(
charset_info
,
current_db
,
tmp
))
{
{
if
(
one_database
)
if
(
one_database
)
...
...
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