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
44d6102f
Commit
44d6102f
authored
Sep 08, 2003
by
ram@mysql.r18.ru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for the bug #1209: SELECT DATABASE().
parent
1f19af41
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
2 deletions
+33
-2
mysql-test/r/create.result
mysql-test/r/create.result
+13
-0
mysql-test/t/create.test
mysql-test/t/create.test
+16
-0
sql/item_strfunc.cc
sql/item_strfunc.cc
+2
-2
sql/sql_db.cc
sql/sql_db.cc
+2
-0
No files found.
mysql-test/r/create.result
View file @
44d6102f
...
@@ -361,3 +361,16 @@ a b c d e f g h dd
...
@@ -361,3 +361,16 @@ a b c d e f g h dd
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
1 -7 7 2000-01-01 b 2000-01-01 00:00:00 05:04:03 yet another binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
2 -2 2 1825-12-14 a 2003-01-01 03:02:01 04:03:02 binary data 02:00:00
drop table t1, t2;
drop table t1, t2;
drop database if exists test_$1;
create database test_$1;
use test_$1;
select database();
database()
test_$1
drop database test_$1;
select database();
database()
NULL
select database();
database()
NULL
mysql-test/t/create.test
View file @
44d6102f
...
@@ -260,3 +260,19 @@ select * from t2;
...
@@ -260,3 +260,19 @@ select * from t2;
drop
table
t1
,
t2
;
drop
table
t1
,
t2
;
#
# Bug #1209
#
--
disable_warnings
drop
database
if
exists
test_
$
1
;
--
enable_warnings
create
database
test_
$
1
;
use
test_
$1
;
select
database
();
drop
database
test_
$
1
;
select
database
();
# Connect without a database
connect
(
user4
,
localhost
,
mysqltest_1
,,
*
NO
-
ONE
*
);
select
database
();
sql/item_strfunc.cc
View file @
44d6102f
...
@@ -1454,8 +1454,8 @@ String *Item_func_database::val_str(String *str)
...
@@ -1454,8 +1454,8 @@ String *Item_func_database::val_str(String *str)
THD
*
thd
=
current_thd
;
THD
*
thd
=
current_thd
;
if
(
!
thd
->
db
)
if
(
!
thd
->
db
)
{
{
str
->
length
(
0
)
;
null_value
=
1
;
str
->
set_charset
(
system_charset_info
)
;
return
0
;
}
}
else
else
str
->
copy
((
const
char
*
)
thd
->
db
,(
uint
)
strlen
(
thd
->
db
),
system_charset_info
);
str
->
copy
((
const
char
*
)
thd
->
db
,(
uint
)
strlen
(
thd
->
db
),
system_charset_info
);
...
...
sql/sql_db.cc
View file @
44d6102f
...
@@ -391,6 +391,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
...
@@ -391,6 +391,8 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit:
exit:
start_waiting_global_read_lock
(
thd
);
start_waiting_global_read_lock
(
thd
);
if
(
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db
))
thd
->
db
=
0
;
exit2:
exit2:
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
VOID
(
pthread_mutex_unlock
(
&
LOCK_mysql_create_db
));
...
...
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