@seancorfield Oh wow. I was searching for this all day. Guess I was searching for postgres specific doc. Thanks a lot 🙂
I'm just grateful to all the PostgreSQL users who keep submitting pull requests 🙂 That whole section was submitted by the community. I don't use PostgreSQL at all...
@seancorfield it selects the foo
and bar
column from the joined table
which are a uuid and string in this case
select foo, bar from ...
would give you the plain hash map then?
When you have (foo, bar)
I think you're telling PG to produce a compound object.
thanks, that makes sense, without the parens it returns maps
Is there a way to use named parameters with raw next.jdbc calls, or should i go to honey/hug sql for that?
I ended up writing a small function and macro for if I end up wanting this for real
(macroexpand-1 '(expand-named-parameters-compile-time
"INSERT INTO PERSON (id, name) VALUES (:id, :name)
ON CONFLICT (id)
DO
UPDATE
SET name = :name
RETURNING id, name"
{:name (:person/name person)
:id (:person/id person)}))
=>
(clojure.core/let
[G__4732 (:person/name person) G__4733 (:person/id person)]
["INSERT INTO PERSON (id, name) VALUES (?, ?)
ON CONFLICT (id)
DO
UPDATE
SET name = ?
RETURNING id, name"
G__4733
G__4732
G__4732])
INSERT INTO PERSON (id, name) VALUES (:id, :name)
ON CONFLICT (id)
DO
UPDATE
SET name = :name
RETURNING id, name
I'm pretty rusty with SQL these days. Working on building a Tuple Space server implementation and considering the best way to handle the data including via SQL. If anyone could critique what I have so far and/or offer suggestions of alternatives https://gist.githubusercontent.com/mmower/289b56c1dc2811b5c26def554f2c8643/raw/a4333e1da2a7a40ca2fc8508c3a6bf6b432bd020/gistfile1.txt I'd welcome either. TIA.
@seancorfield thanks for all your work on next.jdbc and honeysql, I always enjoy coming back to Clojure/SQL stuff largely because it feels so sane!
Are there any examples on how to get windows authentication to work with next.jdbc and sql-server? Found some old examples here: https://stackoverflow.com/questions/6330688/connecting-to-microsoft-sql-server-using-clojure/6331367
Not yet David. Giving it another shot tomorrow
I'd probably be inclined to just use ?
three times here and pass the ID, the name, and the name again.
But I also might use HoneySQL for this which accepts named parameters and transforms them behind the scenes (you pass a hash map to the formatter and it expands to the regular ["SQL" param1 param2 param3]
format.
(I don't use HugSQL but I can see that being a good option too)
I managed it by using the latest mssql driver, and by setting the jdbcUrl key for db.
https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15
You also need to store their auth dll somewhere on your java path
For the driver. Hope it helps!