If I read your question correctly, I believe that you need to rely on your MySQL server to implement the requested request timeout. What for? dbQuery sends a client request to the server on which you want the server to execute the request and timeout.
Proposed Solution:
Include a query execution prompt in the query that you send to your MySQL database.
nb. The returned query data may be too large for you, but this is another problem.
MySql example:
The hint MAX_EXECUTION_TIME is only allowed for SELECT statements . It sets a limit of N (timeout value in milliseconds) on how long the SQL query is allowed to execute before the server completes it.
MAX_EXECUTION_TIME(N)
Example with a timeout of 1 second (1000 milliseconds):
SELECT * FROM t1 INNER JOIN t2 WHERE ...
The hint MAX_EXECUTION_TIME (N) sets the timeout for executing the instruction for N milliseconds. If this option is absent or N is 0, the execution timeout set by the max_execution_time system variable is applied.
The hint MAX_EXECUTION_TIME is applicable as follows:
For statements with multiple SELECT keywords, such as unions or statements with subqueries, MAX_EXECUTION_TIME applies to the entire statement and should appear after the first SELECT strong>.
It applies to read-only SELECT statements . Statements that are not read-only are those that invoke a stored function that modifies data as a side effect.
It does not apply to SELECT statements in stored programs and is ignored.
I hope the above approach helps you in the right direction.
Technophobe01
source share