sql

All things SQL and JDBC...
seancorfield 2020-10-04T00:06:46.051200Z

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

seancorfield 2020-10-04T00:07:45.052100Z

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

Test This 2020-10-04T00:07:58.052600Z

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

seancorfield 2020-10-04T00:08:14.053Z

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

seancorfield 2020-10-04T00:10:12.054800Z

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

Test This 2020-10-04T00:11:40.055600Z

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.

seancorfield 2020-10-04T00:13:27.056100Z

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

seancorfield 2020-10-04T00:14:20.056600Z

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

Test This 2020-10-04T00:19:48.057Z

Thank you. I will read these.

seancorfield 2020-10-04T00:22:03.057500Z

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

Test This 2020-10-04T00:26:09.058300Z

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

Test This 2020-10-04T00:29:57.060400Z

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.

seancorfield 2020-10-04T00:31:39.061500Z

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 This 2020-10-04T00:35:19.062500Z

Ha ha! Okay, thanks.

practicalli-john 2020-10-04T08:49:12.064400Z

@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 This 2020-10-04T15:35:02.064800Z

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