[Lazarus] Getting MySQL process output
Michael Van Canneyt
michael at freepascal.org
Sat Dec 5 18:08:32 CET 2015
On Sat, 5 Dec 2015, Aradeonas wrote:
>> Simple Loop:
> - Read from program output
> - interpret the output and
> - write to program input. That's all the "general" advice we can give.
>
> Yea sure I do this and I have no problem with simple CMD programs.
> Problem is programs like MySQL that can be run from one line command and
> need reading and writing. When you run this command : '"C:\Program Files
> (x86)\MySQL\MySQL Server 5.5\bin\mysql.exe" -u root -p'; You will get
> nothing in the output, it is locked and you even cant call
> NumByteAvailable but interesting is if you remove -WG param you can see
> Enter password: it will write in CMD that opens with program it self
> from Lazarus.
What is the -WG param ? I could not find it in the documentation.
I also don't understand why you don't specify the password on the command-line, then you would not have these problems.
If you are afraid that it will be visible in the task list, just set the MYSQL_PWD and USER environment variables in TProcess.
All in all, I suspect you would probably be better off using the mysql library.
The mysql command is just a front-end to that.
Michael.
More information about the Lazarus
mailing list