Fork me on GitHub
#sql
<
2020-10-04
>
seancorfield00:10:46

@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.

Test This00:10:58

Thank you, thank you, thank you. I knew I was doing something stupid, especially since this worked yesterday. Thank you so much.

seancorfield00:10:14

It would give you a better error message by using Spec to check the arguments to execute! etc.

seancorfield00:10:12

(specifically, that part of the Getting Started guide deals with exactly the situation you had in your code above 🙂 )

Test This00:10:40

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.

seancorfield00:10:27

clojure.spec is built into the core Clojure ecosystem and supported by the core team.

seancorfield00:10:20

I talk about how we use Spec at work in this blog post https://corfield.org/blog/2019/09/13/using-spec/

Test This00:10:48

Thank you. I will read these.

seancorfield00:10:03

Spec is awesome 🙂 There's a #clojure-spec channel if you find you need to dig deeper.

Test This00:10:09

Thank you. Will look into it. I remember seeing a recent blog post on it on Hacker news (about how to use it).

Test This00:10:57

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.

seancorfield00:10:39

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 🙂

Test This00:10:19

Ha ha! Okay, thanks.

practicalli-johnny08:10:12

@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/

Test This15:10:02

Thank you @U05254DQM. Look forward to reading this and learning how to use specs.