This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-06-22
Channels
- # ai (1)
- # announcements (4)
- # babashka (23)
- # beginners (27)
- # biff (17)
- # calva (5)
- # clerk (6)
- # clj-commons (27)
- # clj-kondo (35)
- # clojars (12)
- # clojure (27)
- # clojure-denver (3)
- # clojure-europe (71)
- # clojure-norway (7)
- # clojure-spec (5)
- # clojure-uk (2)
- # clojurescript (45)
- # data-science (9)
- # datomic (4)
- # dev-tooling (2)
- # devcards (1)
- # hoplon (2)
- # hyperfiddle (36)
- # introduce-yourself (3)
- # malli (11)
- # missionary (2)
- # off-topic (63)
- # polylith (5)
- # rdf (2)
- # reagent (12)
- # schema (1)
- # shadow-cljs (11)
- # sql (6)
- # tools-deps (23)
- # xtdb (6)
Is there a particular significance to a batch update returning an empty vector? It's silently failing, it seems, but I don't know if the empty vector is telling me something I should be aware of.
Which database/driver? Which Clojure library? How are you invoking it? What does the update look like?
SQL Server (driver is com.microsoft.sqlserver/mssql-jdbc
version 12.3.0.jre17-preview
. When I invoke the query using execute-batch!
from next-jdbc, it gives me the empty vector, with no exceptions. But if I just use execute!
it does throw. I've discovered that there's stuff wrong with my query that I'm in the process of fixing but I was surprised that execute-batch!
doesn't throw as well.
and, to clarify my bad terminology usage, it's a batch insert, not an update :face_in_clouds:
I'm a little surprised you just get an empty array, rather than an exception... but the underlying executeBatch()
method is a funny beast and behavior varies across databases. In theory, if one or more statements fail in the batch you should get error indicators in the array in place of update counts, but it isn't entirely clear what should happen if all statements fail, and only certain cases are called out to throw exceptions...
...and not all DB drivers follow the JDBC spec to the letter anyway 😞
Ah, well. At least it's a JDBC quirk then. I can live with that. Thanks.