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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c734cca6
Commit
c734cca6
authored
Sep 10, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.r18.ru:/usr/home/ram/work/4.1
parents
479c3766
b7f06b94
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
109 additions
and
2 deletions
+109
-2
client/mysqltest.c
client/mysqltest.c
+65
-0
mysql-test/mysql-test-run.sh
mysql-test/mysql-test-run.sh
+8
-0
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
+5
-0
No files found.
client/mysqltest.c
View file @
c734cca6
...
...
@@ -204,6 +204,7 @@ Q_WAIT_FOR_SLAVE_TO_STOP,
Q_REQUIRE_VERSION
,
Q_ENABLE_WARNINGS
,
Q_DISABLE_WARNINGS
,
Q_ENABLE_INFO
,
Q_DISABLE_INFO
,
Q_EXEC
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
Q_COMMENT_WITH_COMMAND
...
...
@@ -267,6 +268,7 @@ const char *command_names[]=
"disable_warnings"
,
"enable_info"
,
"disable_info"
,
"exec"
,
0
};
...
...
@@ -840,6 +842,66 @@ int do_source(struct st_query* q)
return
open_file
(
name
);
}
/*
Execute given command.
SYNOPSIS
do_exec()
q called command
DESCRIPTION
If one uses --exec command [args] command in .test file
we will execute the command and record its output.
RETURN VALUES
0 ok
1 error
*/
int
do_exec
(
struct
st_query
*
q
)
{
int
error
=
0
;
DYNAMIC_STRING
*
ds
;
DYNAMIC_STRING
ds_tmp
;
char
buf
[
1024
];
FILE
*
res_file
;
char
*
cmd
=
q
->
first_argument
;
while
(
*
cmd
&&
my_isspace
(
charset_info
,
*
cmd
))
cmd
++
;
if
(
!*
cmd
)
die
(
"Missing argument in exec
\n
"
);
if
(
q
->
record_file
[
0
])
{
init_dynamic_string
(
&
ds_tmp
,
""
,
16384
,
65536
);
ds
=
&
ds_tmp
;
}
else
ds
=
&
ds_res
;
if
(
!
(
res_file
=
popen
(
cmd
,
"r"
))
&&
q
->
abort_on_error
)
die
(
"popen() failed
\n
"
);
while
(
fgets
(
buf
,
sizeof
(
buf
),
res_file
))
dynstr_append
(
ds
,
buf
);
pclose
(
res_file
);
if
(
record
)
{
if
(
!
q
->
record_file
[
0
]
&&
!
result_file
)
die
(
"At line %u: Missing result file"
,
start_lineno
);
if
(
!
result_file
)
str_to_file
(
q
->
record_file
,
ds
->
str
,
ds
->
length
);
}
else
if
(
q
->
record_file
[
0
])
{
error
=
check_result
(
ds
,
q
->
record_file
,
q
->
require_file
);
}
if
(
ds
==
&
ds_tmp
)
dynstr_free
(
&
ds_tmp
);
return
error
;
}
int
var_query_set
(
VAR
*
v
,
const
char
*
p
,
const
char
**
p_end
)
{
char
*
end
=
(
char
*
)((
p_end
&&
*
p_end
)
?
*
p_end
:
p
+
strlen
(
p
));
...
...
@@ -2584,6 +2646,9 @@ int main(int argc, char **argv)
case
Q_PING
:
(
void
)
mysql_ping
(
&
cur_con
->
mysql
);
break
;
case
Q_EXEC
:
(
void
)
do_exec
(
q
);
break
;
default:
processed
=
0
;
break
;
}
}
...
...
mysql-test/mysql-test-run.sh
View file @
c734cca6
...
...
@@ -431,6 +431,11 @@ if [ x$SOURCE_DIST = x1 ] ; then
else
MYSQL_TEST
=
"
$BASEDIR
/client/mysqltest"
fi
if
[
-f
"
$BASEDIR
/client/.libs/mysqldump"
]
;
then
MYSQL_DUMP
=
"
$BASEDIR
/client/.libs/mysqldump --no-defaults -uroot --socket=
$MASTER_MYSOCK
"
else
MYSQL_DUMP
=
"
$BASEDIR
/client/mysqldump --no-defaults -uroot --socket=
$MASTER_MYSOCK
"
fi
if
[
-n
"
$STRACE_CLIENT
"
]
;
then
MYSQL_TEST
=
"strace -o
$MYSQL_TEST_DIR
/var/log/mysqltest.strace
$MYSQL_TEST
"
fi
...
...
@@ -452,6 +457,7 @@ else
MYSQLD
=
"
$VALGRIND
$BASEDIR
/bin/mysqld"
fi
MYSQL_TEST
=
"
$BASEDIR
/bin/mysqltest"
MYSQL_DUMP
=
"
$BASEDIR
/bin/mysqldump --no-defaults -uroot --socket=
$MASTER_MYSOCK
"
MYSQLADMIN
=
"
$BASEDIR
/bin/mysqladmin"
WAIT_PID
=
"
$BASEDIR
/bin/mysql_waitpid"
MYSQL_MANAGER
=
"
$BASEDIR
/bin/mysqlmanager"
...
...
@@ -469,6 +475,8 @@ else
fi
fi
export
MYSQL_DUMP
if
[
-z
"
$MASTER_MYSQLD
"
]
then
MASTER_MYSQLD
=
$MYSQLD
...
...
mysql-test/r/create.result
View file @
c734cca6
...
...
@@ -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
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 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 @
c734cca6
...
...
@@ -260,3 +260,19 @@ select * from 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 @
c734cca6
...
...
@@ -1454,8 +1454,8 @@ String *Item_func_database::val_str(String *str)
THD
*
thd
=
current_thd
;
if
(
!
thd
->
db
)
{
str
->
length
(
0
)
;
str
->
set_charset
(
system_charset_info
)
;
null_value
=
1
;
return
0
;
}
else
str
->
copy
((
const
char
*
)
thd
->
db
,(
uint
)
strlen
(
thd
->
db
),
system_charset_info
);
...
...
sql/sql_db.cc
View file @
c734cca6
...
...
@@ -391,6 +391,11 @@ int mysql_rm_db(THD *thd,char *db,bool if_exists, bool silent)
exit:
start_waiting_global_read_lock
(
thd
);
if
(
thd
->
db
&&
!
strcmp
(
thd
->
db
,
db
))
{
x_free
(
thd
->
db
);
thd
->
db
=
0
;
}
exit2:
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