http://code.openark.org/blog/mysql/mysql-foreach
Code:
foreach(collection_to_iterate_over, queries_to_execute_per_iteration_step);
call foreach('table in sakila', 'ALTER TABLE ${schema}.${table} ENGINE=InnoDB ROW_FORMAT=COMPACT');
call $('schema like shard_%', 'CREATE TABLE ${schema}.messages (id INT)');
call $('2000:2009', 'INSERT IGNORE INTO report (report_year) VALUES (${1})');
foreach(collection_to_iterate_over, queries_to_execute_per_iteration_step);
call foreach('table in sakila', 'ALTER TABLE ${schema}.${table} ENGINE=InnoDB ROW_FORMAT=COMPACT');
call $('schema like shard_%', 'CREATE TABLE ${schema}.messages (id INT)');
call $('2000:2009', 'INSERT IGNORE INTO report (report_year) VALUES (${1})');
:)]