We dynamically generate a sql file which contains one big insert query. This file will be run periodically from a PHP app with the following command:
mysql --force -u foo -pbar demo < demo-file.sql
There was no output from the command except when an error happened as the content of the file was only one insert command. Now we decided to change the file that it will contain multiple insert queries instead of one big query. Since then the output of the command is
0
0
0
Our PHP app fails because it assumes now that there is an error happening because the output is not empty. So my question is, can I write an sql file that there is no output generated with multiple queries? I try not to touch the PHP app.
I know there are better designs but the code is historically grown :-)
[UPDATE 1]
Basically the app does
$response = shell_exec('mysql --force -u foo -pbar demo < demo-file.sql');
if (empty($response)) {
echo 'OK';
} else {
echo 'error: '.$response;
}
[UPDATE 2] The sql file contains something like
insert into;
select sleep(0);
insert into;
select sleep(0);
insert into;
select sleep(0);
Those zeros come from the sleep lines. Get rid of them, you don't need them.
Also, for performance sake, if you are using a schema that supports transactions, you should add:
START TRANSACTION
INSERT...
INSERT...
INSERT...
...
COMMIT