@curiouslearn execute!
expects a vector containing a string (and any parameter values it needs). You are passing just a single string instead of a vector.
You might find this section of the docs helpful: https://cljdoc.org/d/seancorfield/next.jdbc/1.1.588/doc/getting-started#support-from-specs
Thank you, thank you, thank you. I knew I was doing something stupid, especially since this worked yesterday. Thank you so much.
It would give you a better error message by using Spec to check the arguments to execute!
etc.
(specifically, that part of the Getting Started guide deals with exactly the situation you had in your code above 🙂 )
Thank you. I am very new to Clojure and have not yet had the time to learn how to use specs
. Will look into that. On that note, would you recommend learning and using spec
or one of the other alternatives such as prismatic/schema
or metosin/malli
. Thank you, again.
clojure.spec
is built into the core Clojure ecosystem and supported by the core team.
I talk about how we use Spec at work in this blog post https://corfield.org/blog/2019/09/13/using-spec/
Thank you. I will read these.
Spec is awesome 🙂 There's a #clojure-spec channel if you find you need to dig deeper.
Thank you. Will look into it. I remember seeing a recent blog post on it on Hacker news (about how to use it).
A quick question. When I exectue the command DROP DATABASE IF EXISTS mydbname
I get the following response: [#:next.jdbc{:update-count 0}]
I checked that this is the case even when the database exists and it drops it? I would have expected :update-count to be 1.
That's down to SQL/JDBC treating that as updating no rows. Which is weird, I know, but there are lots of weird things in SQL/JDBC 🙂
Ha ha! Okay, thanks.
@curiouslearn The banking on Clojure project I am building is using next.jdbc specs as well as specs for unit testing. It may give you some ideas https://practicalli.github.io/clojure-webapps/projects/banking-on-clojure/
Thank you @jr0cket. Look forward to reading this and learning how to use specs.