This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-12-26
Channels
- # beginners (74)
- # cider (3)
- # cljsrn (1)
- # clojure (182)
- # clojure-dev (4)
- # clojure-europe (1)
- # clojure-spec (5)
- # clojure-uk (58)
- # clojurescript (44)
- # core-async (5)
- # core-logic (10)
- # cursive (6)
- # datomic (13)
- # duct (1)
- # fulcro (2)
- # graalvm (4)
- # leiningen (1)
- # off-topic (7)
- # overtone (6)
- # random (3)
- # re-frame (17)
- # reitit (2)
- # shadow-cljs (6)
- # spacemacs (4)
- # sql (12)
- # tools-deps (3)
@fabrao Yes, :timeout
is an option and execute!
takes a hash map of options as the third argument.
execute!
will create a PreparedStatement
from the Connection
object using the prepare
function and will pass the options hash map into prepare
-- which will call .setQueryTimeout
on the newly-created PreparedStatement
.
Per https://cljdoc.org/d/seancorfield/next.jdbc/1.0.12/doc/all-the-options#prepared-statements "Any function that creates a PreparedStatement
will accept the following options:" (goes on to describe :timeout
).
I assume the part that wasn't clear to you was that execute!
will create a PreparedStatement
?
That's mentioned at the top of https://cljdoc.org/d/seancorfield/next.jdbc/1.0.12/doc/getting-started/prepared-statements "Under the hood, whenever you ask next.jdbc to execute some SQL it creates a java.sql.PreparedStatement, adds in the parameters you provide, and then calls .execute on it."
If you have suggestions for improving the documentation to make that sort of thing clearer, I'd be happy to hear them -- feel free to create an issue https://github.com/seancorfield/next-jdbc/issues or if you want to propose specific changes to the docs via a pull request https://github.com/seancorfield/next-jdbc/pulls that would be great too.
@fabrao I've just made these changes to the documentation: https://github.com/seancorfield/next-jdbc/commit/79d2772e14e341fbb85fecee21ea61809d715e90 -- hopefully that clarifies things?
@seancorfield that was not clear to me if I have to use option as direct map in execute! or do something with jdbc/prepare
and use .setQueryTimeout
. But now it´s clean. Many thanks