terpal-sql icon indicating copy to clipboard operation
terpal-sql copied to clipboard

Adding timeout to queries

Open borgarlie opened this issue 11 months ago • 3 comments

Hi,

We are currently trying out Terpal, and are wondering if there is a way to add timeout to queries?

E.g. kotlinquery supports a queryTimeout when generating sessions.

fun sessionOf(
    url: String,
    user: String,
    password: String,
    returnGeneratedKey: Boolean = false,
    strict: Boolean = false,
    queryTimeout: Int? = null
): Session

This is very useful, as we don't want to use the default database timeout for all our queries.

I have looked around briefly, but couldn't find anything obvious in Terpal so far.

Thanks!

borgarlie avatar Jan 06 '25 15:01 borgarlie

Makes sense to have this configureable on a per-query basis. Let me figure out where to add it.

(P.S. For faster replies, ping me on the Terpal channel on the Kotlin Slack)

deusaquilus avatar Feb 16 '25 05:02 deusaquilus

I'm interested in this as well...

cies avatar Jun 14 '25 10:06 cies

Have a look at the latest release where you can pass a JdbcExecutionOptions to the runOn functions. This has a sessionTimeout, fetchSize, and queryTimeout. It also has custom prepare-lambdas that it will call on Connection/PreparedStatement/ResultSet if you want even more fine-grained control.

deusaquilus avatar Jun 20 '25 22:06 deusaquilus