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
9aeb8297
Commit
9aeb8297
authored
Feb 19, 2007
by
msvensson@pilot.blaudden
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.blaudden:/home/msvensson/mysql/mysql-5.0-maint
into pilot.blaudden:/home/msvensson/mysql/mysql-5.1-new-maint
parents
16bce5b8
b540ae53
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
4 deletions
+67
-4
client/mysqltest.c
client/mysqltest.c
+47
-1
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+4
-1
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+16
-2
No files found.
client/mysqltest.c
View file @
9aeb8297
...
...
@@ -275,7 +275,7 @@ enum enum_commands {
Q_DISABLE_PARSING
,
Q_ENABLE_PARSING
,
Q_REPLACE_REGEX
,
Q_REMOVE_FILE
,
Q_FILE_EXIST
,
Q_WRITE_FILE
,
Q_COPY_FILE
,
Q_PERL
,
Q_DIE
,
Q_EXIT
,
Q_CHMOD_FILE
,
Q_APPEND_FILE
,
Q_CHMOD_FILE
,
Q_APPEND_FILE
,
Q_CAT_FILE
,
Q_UNKNOWN
,
/* Unknown command. */
Q_COMMENT
,
/* Comments, ignored. */
...
...
@@ -360,6 +360,7 @@ const char *command_names[]=
"exit"
,
"chmod"
,
"append_file"
,
"cat_file"
,
0
};
...
...
@@ -2179,6 +2180,50 @@ void do_append_file(struct st_command *command)
}
/*
SYNOPSIS
do_cat_file
command called command
DESCRIPTION
cat_file <file_name>;
Print the given file to result log
*/
void
do_cat_file
(
struct
st_command
*
command
)
{
int
fd
;
uint
len
;
byte
buff
[
512
];
static
DYNAMIC_STRING
ds_filename
;
const
struct
command_arg
cat_file_args
[]
=
{
"filename"
,
ARG_STRING
,
TRUE
,
&
ds_filename
,
"File to read from"
};
DBUG_ENTER
(
"do_cat_file"
);
check_command_args
(
command
,
command
->
first_argument
,
cat_file_args
,
sizeof
(
cat_file_args
)
/
sizeof
(
struct
command_arg
),
' '
);
DBUG_PRINT
(
"info"
,
(
"Reading from, file: %s"
,
ds_filename
.
str
));
if
((
fd
=
my_open
(
ds_filename
.
str
,
O_RDONLY
,
MYF
(
0
)))
<
0
)
die
(
"Failed to open file %s"
,
ds_filename
.
str
);
while
((
len
=
my_read
(
fd
,
&
buff
,
sizeof
(
buff
),
MYF
(
0
)))
>
0
)
{
dynstr_append_mem
(
&
ds_res
,
buff
,
len
);
}
my_close
(
fd
,
MYF
(
0
));
dynstr_free
(
&
ds_filename
);
DBUG_VOID_RETURN
;
}
/*
SYNOPSIS
do_perl
...
...
@@ -5956,6 +6001,7 @@ int main(int argc, char **argv)
case
Q_FILE_EXIST
:
do_file_exist
(
command
);
break
;
case
Q_WRITE_FILE
:
do_write_file
(
command
);
break
;
case
Q_APPEND_FILE
:
do_append_file
(
command
);
break
;
case
Q_CAT_FILE
:
do_cat_file
(
command
);
break
;
case
Q_COPY_FILE
:
do_copy_file
(
command
);
break
;
case
Q_CHMOD_FILE
:
do_chmod_file
(
command
);
break
;
case
Q_PERL
:
do_perl
(
command
);
break
;
...
...
mysql-test/r/mysqltest.result
View file @
9aeb8297
...
...
@@ -210,7 +210,6 @@ source database
"MySQL: The world's most popular ;open source database"
echo message echo message
mysqltest: At line 1: Empty variable
mysqltest: At line 1: command "false" failed
mysqltest: At line 1: Missing argument in exec
MySQL
...
...
@@ -518,6 +517,10 @@ drop table t1;
mysqltest: At line 1: Missing required argument 'filename' to command 'remove_file'
mysqltest: At line 1: Missing required argument 'filename' to command 'write_file'
mysqltest: At line 1: End of file encountered before 'EOF' delimiter was found
Some data
for cat_file command
of mysqltest
mysqltest: At line 1: Failed to open file non_existing_file
mysqltest: At line 1: Missing required argument 'filename' to command 'file_exists'
mysqltest: At line 1: Missing required argument 'from_file' to command 'copy_file'
mysqltest: At line 1: Missing required argument 'to_file' to command 'copy_file'
...
...
mysql-test/t/mysqltest.test
View file @
9aeb8297
...
...
@@ -555,8 +555,8 @@ echo ;
# Illegal use of echo
--
error
1
--
exec
echo
"echo
\$
;"
|
$MYSQL_TEST
2
>&
1
#
--error 1
#
--exec echo "echo \$;" | $MYSQL_TEST 2>&1
# ----------------------------------------------------------------------------
...
...
@@ -1557,6 +1557,20 @@ append_file $MYSQLTEST_VARDIR/tmp/test_file1.tmp;
Appended
text
on
nonexisting
file
EOF
# ----------------------------------------------------------------------------
# test for cat_file
# ----------------------------------------------------------------------------
--
write_file
$MYSQLTEST_VARDIR
/
tmp
/
test_file1
.
tmp
Some
data
for
cat_file
command
of
mysqltest
EOF
cat_file
$MYSQLTEST_VARDIR
/
tmp
/
test_file1
.
tmp
;
--
error
1
--
exec
echo
"cat_file non_existing_file;"
|
$MYSQL_TEST
2
>&
1
# ----------------------------------------------------------------------------
# test for file_exist
# ----------------------------------------------------------------------------
...
...
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