eval: evaluate statement by dynamically invoking result set
test. eval select text_col ...; eval is a META statement, which
executes a given statement, gets its text output - assumed to be
SQL, and invokes this resulting SQL. That is, eval is given a
statement as argument. eval expects a SELECT statement which
produces a single text column, and the text in that columns is
expected to be valid SQL statements. The eval statement invokes
the eval() routine, and therefore produces the same
result/output. Many views in common_schema produce SQL
statements as columns. Consider processlist_grantees,
redundant_keys, sql_alter_table, sql_foreign_keys, sql_grants
and more. It is possible, then, to eval directly on columns of
these views: eval SELECT sql_revoke FROM sql_grants WHERE
user='gromit'; common_schema also offers programmatic
alternatives to eval. For example, instead of evaluating queries
on INFORMATION_SCHEMA.TABLES, one can use the foreach statement.
Drop foreign keys from the sakila database: eval SELECT d