Documentation Home
The MySQL Test Framework, Version 1.0
Download this Manual
PDF (US Ltr) - 443.9Kb
PDF (A4) - 445.6Kb

The MySQL Test Framework, Version 1.0  /  mysqltest Language Reference  /  mysqltest Flow Control Constructs

6.4 mysqltest Flow Control Constructs

The syntax for if and while blocks looks like this:

if (expr)
  command list
while (expr)
  command list

An expression result is true if nonzero, false if zero. If the expression begins with !, the sense of the test is reversed.

There is no provision for else with if.

For a while loop, make sure that the loop includes some exit condition that eventually occurs. This can be done by writing expr so that it becomes false at some point.

The allowable syntax for expr is $var_name, !$var_name, a string or integer, or `query`.

The opening { must be separated from the preceding ) by whitespace (such as a space or a line break).

As of MySQL 4.1.23/5.0.42/5.1.18, variable references that occur within `query` are expanded before the query is sent to the server for execution.