I'm working on an sql console in php that uses a mysql driver. I am using the gnu readline library to handle user input, however I am having trouble running sql scripts, i.e:
Code: Select all
php sqlconsole.php < test.sql[text]select * from country limit 8;
[/text]
The console itself works fine however when I run the code above I get:
[text]SQLConsole> select * from country limit 8; -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->[/text]
I was able to solve this problem in my java version by adding the following to main:
Code: Select all
boolean isKeyboardInput = System.in.available() == 0;I haven't been able to find an equivalent solution for php.
Can anyone help me out?