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
fed5a68e
Commit
fed5a68e
authored
Feb 14, 2006
by
msvensson@neptunus.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge neptunus.(none):/home/msvensson/mysql/bug17280/my50-bug17280
into neptunus.(none):/home/msvensson/mysql/mysql-5.0
parents
8b35d14e
4217699e
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
15 deletions
+45
-15
client/mysqltest.c
client/mysqltest.c
+15
-13
mysql-test/r/mysqltest.result
mysql-test/r/mysqltest.result
+17
-2
mysql-test/t/mysqltest.test
mysql-test/t/mysqltest.test
+13
-0
No files found.
client/mysqltest.c
View file @
fed5a68e
...
@@ -1384,38 +1384,40 @@ int do_system(struct st_query *q)
...
@@ -1384,38 +1384,40 @@ int do_system(struct st_query *q)
/*
/*
Print the content between echo and <delimiter> to result file.
Print the content between echo and <delimiter> to result file.
If content is a variable, the variable value will be retrieved
Evaluate all variables in the string before printing, allow
for variable names to be escaped using \
SYNOPSIS
SYNOPSIS
do_echo()
do_echo()
q called command
q called command
DESCRIPTION
DESCRIPTION
Usage 1:
echo text
echo text
Print the text after echo until end of command to result file
Print the text after echo until end of command to result file
Usage 2:
echo $<var_name>
echo $<var_name>
Print the content of the variable <var_name> to result file
Print the content of the variable <var_name> to result file
echo Some text $<var_name>
Print "Some text" plus the content of the variable <var_name> to
result file
echo Some text \$<var_name>
Print "Some text" plus $<var_name> to result file
*/
*/
int
do_echo
(
struct
st_query
*
q
)
int
do_echo
(
struct
st_query
*
command
)
{
{
char
*
p
=
q
->
first_argument
;
DYNAMIC_STRING
*
ds
,
ds_echo
;
DYNAMIC_STRING
*
ds
;
VAR
v
;
var_init
(
&
v
,
0
,
0
,
0
,
0
);
ds
=
&
ds_res
;
ds
=
&
ds_res
;
eval_expr
(
&
v
,
p
,
0
);
/* NULL terminated */
init_dynamic_string
(
&
ds_echo
,
""
,
256
,
256
);
if
(
v
.
str_val_len
)
do_eval
(
&
ds_echo
,
command
->
first_argument
);
dynstr_append_mem
(
ds
,
v
.
str_val
,
v
.
str_val_len
);
dynstr_append_mem
(
ds
,
ds_echo
.
str
,
ds_echo
.
length
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
dynstr_append_mem
(
ds
,
"
\n
"
,
1
);
var_free
(
&
v
);
dynstr_free
(
&
ds_echo
);
q
->
last_argument
=
q
->
end
;
command
->
last_argument
=
command
->
end
;
return
0
;
return
0
;
}
}
...
...
mysql-test/r/mysqltest.result
View file @
fed5a68e
...
@@ -201,8 +201,14 @@ source database
...
@@ -201,8 +201,14 @@ source database
- world''s most
- world''s most
-- popular open
-- popular open
# source database
# source database
'$message'
'# MySQL: The
"$message"
- world''s most
-- popular open
# source database'
"# MySQL: The
- world''s most
-- popular open
# source database"
hej
hej
hej
hej
hej
hej
...
@@ -222,6 +228,15 @@ mysqltest: At line 1: Missing arguments to let
...
@@ -222,6 +228,15 @@ mysqltest: At line 1: Missing arguments to let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Missing variable name in let
mysqltest: At line 1: Variable name in =hi does not start with '$'
mysqltest: At line 1: Variable name in =hi does not start with '$'
mysqltest: At line 1: Missing assignment operator in let
mysqltest: At line 1: Missing assignment operator in let
# Execute: --echo # <whatever> success: $success
# <whatever> success: 1
# Execute: echo # <whatever> success: $success ;
# <whatever> success: 1
# The next two variants work fine and expand the content of $success
# Execute: --echo $success
1
# Execute: echo $success ;
1
mysqltest: At line 1: Missing file name in source
mysqltest: At line 1: Missing file name in source
mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: At line 1: Could not open file ./non_existingFile
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
mysqltest: In included file "MYSQLTEST_VARDIR/tmp/recursive.sql": At line 1: Source directives are nesting too deep
...
...
mysql-test/t/mysqltest.test
View file @
fed5a68e
...
@@ -539,6 +539,19 @@ echo $novar1;
...
@@ -539,6 +539,19 @@ echo $novar1;
--
error
1
--
error
1
--
exec
echo
"let hi;"
|
$MYSQL_TEST
2
>&
1
--
exec
echo
"let hi;"
|
$MYSQL_TEST
2
>&
1
# More advanced test for bug#17280
let
$success
=
1
;
--
echo
# Execute: --echo # <whatever> success: \$success
--
echo
# <whatever> success: $success
--
echo
# Execute: echo # <whatever> success: \$success ;
echo
# <whatever> success: $success ;
--
echo
# The next two variants work fine and expand the content of \$success
--
echo
# Execute: --echo \$success
--
echo
$success
--
echo
# Execute: echo \$success ;
echo
$success
;
# ----------------------------------------------------------------------------
# ----------------------------------------------------------------------------
# Test to assign let from query
# Test to assign let from query
# let $<var_name>=`<query>`;
# let $<var_name>=`<query>`;
...
...
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