query_script_echo

echo: display a line of text as result set.

SYNOPSIS

echo 'Starting';
echo Will now drop all tables called %name%;
foreach ($table, $schema: table like %name%)
  echo DROP TABLE :${schema}.:${table};

DESCRIPTION

echo is a QueryScript statement which writes (echoes) back its argument text as a message.

echo takes any number and type of arguments and treats them all as a string. Expanded variables are evaluated (thus, the output replaces them with contained values). Local variables (unexpanded) or user defined variables are untouched.

echo is useful in showing progress messages, as well as testing dangerous operations beforehand (echoing the dangerous statement, to be reviewed by a human, before actually executing it).

EXAMPLES

Static text:

echo 'Starting';

+------------+
| echo       |
+------------+
| 'Starting' |
+------------+

Static text, no need to quote:

echo Will now drop all tables called %name%;

+----------------------------------------+
| echo                                   |
+----------------------------------------+
| Will now drop all tables called %name% |
+----------------------------------------+

Dynamic text, via expanded variables. Test DROP TABLE iteration before actually invoking it.

foreach ($table, $schema: table like %name%)
  echo DROP TABLE :${schema}.:${table};

+-----------------------------------------+
| echo                                    |
+-----------------------------------------+
| DROP TABLE common_schema._named_scripts |
+-----------------------------------------+

+---------------------------------+
| echo                            |
+---------------------------------+
| DROP TABLE mysql.time_zone_name |
+---------------------------------+

SEE ALSO

report, Statements

AUTHOR

Shlomi Noach
 
common_schema documentation