Here my code snippet:
query.next();
qDebug()<<query.lastError();
qlonglong res=query.value(0).toLongLong();
qDebug()<<query.lastError();
and the corresponding log I have:
Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away")
Warning: QSqlQuery::value: not positioned on a valid record
Debug: QSqlError(2006, "QMYSQL: Unable to execute query", "MySQL server has gone away")
Normally my program works just fine (it works on a server and accepts connections from clients), but every morning when I tried to connect it, I'm getting messages above.
What can be the problem with MySQL server?
Thanks.