Öffnen einer mysql console und start source
-
Hi,
In Python unter Linux kann ich folgendes tun:
process = Popen('mysql -u%s -p%s' % ('ich', 'meinPass'), stdout=PIPE, stdin=PIPE, shell=True) output = process.communicate('source /home/script.sql')[0]
Damit öffnen ich eine Mysql-Konsole und führe ein Skript aus. Kennt jemand eine Möglichkeit, dass selbe in C++ zu tun? Ich habe die Hoffnung, dass das irgendwie mit QProcess funktionieren könnte.
Dank und Gruss,
flambert
-
o.k. ich habs:
QProcess *console = new QProcess(); QString query=QString("bash -c \"mysql -uich -pmeinPasswort < %1\"").arg(fileName); console->start(query); console->waitForFinished();