Hello.
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:
php sqlconsole.php < test.sql
the test file has the following line of code with no returns afterwards:
select * from country limit 8;
The console itself works fine however when I run the code above I get:
SQLConsole> select * from country limit 8; -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> -> ->
I was able to solve this problem in my java version by adding the following to main:
boolean isKeyboardInput = System.in.available() == 0;
I put this as the first line in the main method so that I would know if input will be from keyboard or redirected file.
I haven't been able to find an equivalent solution for php.
Can anyone help me out?