summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-07-12 10:46:10 +1000
committerCarlo Zancanaro <carlo@clearboxsystems.com.au>2013-07-12 10:46:10 +1000
commit768006571aaa1b036974ba5dec648b531de49363 (patch)
tree1cef766469ef57be241eaf7c98c1ebe23050453f
parent570d86b1bfa4099a6af5c71a733f622fbf49f959 (diff)
Assert in jdbc interface to fail early rather than do the wrong thing
When converting dotted fields to maps there's one possible case where it can do the wrong thing. This should now throw an AssertionError rather than silently doing the wrong thing.
-rw-r--r--src/clojure_sql/jdbc.clj2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/clojure_sql/jdbc.clj b/src/clojure_sql/jdbc.clj
index 5b9de12..44ed55e 100644
--- a/src/clojure_sql/jdbc.clj
+++ b/src/clojure_sql/jdbc.clj
@@ -8,6 +8,8 @@
(let [dotted (name key)
keys (string/split dotted #"\.")
keywords (map keyword keys)]
+ (assert (nil? (get-in acc keywords nil))
+ "Error converting fields to maps: conflicting paths.")
(assoc-in acc keywords val)))
{} obj))