php - No output for multiple queries in mysql -


we dynamically generate sql file contains 1 big insert query. file run periodically php app following command:

mysql --force  -u foo -pbar demo < demo-file.sql 

there no output command except when error happened content of file 1 insert command. decided change file contain multiple insert queries instead of 1 big query. since output of command is

0 0 0 

our php app fails because assumes there error happening because output not empty. question is, can write sql file there no output generated multiple queries? try not touch php app.

i know there better designs code historically grown :-)

[update 1]

basically 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] sql file contains like

insert into; select sleep(0); insert into; select sleep(0); insert into; select sleep(0); 

those zeros come sleep lines. rid of them, don't need them.

also, performance sake, if using schema supports transactions, should add:

start transaction insert... insert... insert... ... commit 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -