QSqlquery exec timeout
Unsolved
General and Desktop
-
Hi,
I would ask you to know about possibile set timeout for exec query.
When I lost connection before exec prepared query, process is blocked and waits for connection. Is possible to set timeout for query.exec()?
I tried set QSqlDataBase::setConnectionsOptions("timeout=10") but it doesn't work.P.S:
I'm using PostgresSQL -
Hello!
You can try set it to auto reconnect:
QSqlDataBase::setConnectOptions("MYSQL_OPT_RECONNECT=TRUE");
.MYSQL_OPT_RECONNECT (argument type: bool *) Enable or disable automatic reconnection to the server if the connection is found to have been lost. Reconnect is off by default; this option provides a way to set reconnection behavior explicitly.
More information is available here: https://dev.mysql.com/doc/refman/8.0/en/mysql-options.html
Happy coding! -
Hello,
thanks, but I'm using PostgresSQL. -
Process still block, when I lost connection.