When I closed MySql server, how can I understand that mysql server is gone away from my Qt program?
Edit:
Here my trial:
When I close MySql, I get these results, and I can't catch that MySql is closed.
My Code Snippet is
QSqlQuery query(db);
query.exec("SELECT * From RequestIds");
qDebug()<<query.lastError();
qDebug()<<db.lastError()<<QTime::currentTime();
qDebug()<<db.isOpen();
qDebug()<<db.isValid();
and output is:
QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away")
QSqlError(-1, "", "") QTime("14:22:58")
true
true
I don't understand why db.isOpen() returns true.