For reason of avoiding creating a new thread. Could that line of code "connect(this, SIGNAL(senddata(const QString &)), server, SIGNAL(getdata(const QString &)));" cause the problem, which was described above?
here is the code, what I have in the server-class:
qDebug() << "name: " + name << "staus: " + status << "pass: " + pass;
bool ok;
{
db.setHostName(this->dbAddress);
db.setPort(this->dbPort);
db.setDatabaseName(this->dbName);
db.setUserName(this->AdminName);
db.setPassword(this->AdminPass);
ok = db.open();
if(ok)
{
QSqlQuery query
("INSERT INTO people(name, status, pass) VALUES('" + name
+ "', '" + status + "', '" + pass + "')", db);
query.exec();
query.clear();
}
db.close();
}
qDebug() << "name: " + name << "staus: " + status << "pass: " + pass;
bool ok;
{
QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "db");
db.setHostName(this->dbAddress);
db.setPort(this->dbPort);
db.setDatabaseName(this->dbName);
db.setUserName(this->AdminName);
db.setPassword(this->AdminPass);
ok = db.open();
if(ok)
{
QSqlQuery query("INSERT INTO people(name, status, pass) VALUES('" + name + "', '"
+ status + "', '" + pass + "')", db);
query.exec();
query.clear();
}
db.close();
}
QSqlDatabase::removeDatabase("db");
To copy to clipboard, switch view to plain text mode
Output is:
"name: user" "staus: user" "pass: 12dea96fec20593566ab75692c9949596833adc9"
In my humble opinion, if I got only line with names, passes and statuses, it doesn't. But still I've got every time two new lines in the database table... Where can be a problem?
Bookmarks