Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert "added support for transaction retries to yesql"
This reverts commit c9d4e3f.
  • Loading branch information
ibarrick committed Sep 10, 2019
commit 832b35c66c2e8102a380222f3a9d20c7ad08752f
5 changes: 2 additions & 3 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
(defproject org.batch/yesql "0.7.0"
(defproject org.batch/yesql "0.6.6"
:description "A Clojure library for using SQL"
:url "https://github.com/krisajenkins/yesql"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]
[org.clojure/java.jdbc "0.7.6"]
[instaparse "1.4.1" :exclusions [org.clojure/clojure]]
[mysql/mysql-connector-java "5.1.44"]]
[instaparse "1.4.1" :exclusions [org.clojure/clojure]]]
:pedantic? :abort
:scm {:name "git"
:url "https://github.com/krisajenkins/yesql"}
Expand Down
23 changes: 4 additions & 19 deletions src/yesql/generate.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[yesql.types :refer [map->Query]]
[yesql.statement-parser :refer [tokenize]])
(:import [yesql.types Query])
(:import java.lang.IllegalArgumentException))
(import java.lang.IllegalArgumentException))

(def in-list-parameter?
"Check if a type triggers IN-list expansion."
Expand Down Expand Up @@ -138,24 +138,9 @@
((:before-delete query-options) args statement call-options)
(and (= execute-handler jdbc-fn) (= "update" (lower-case (first (split (trim statement) #" ")))) (:before-update query-options))
((:before-update query-options) args statement call-options))
(let [ret (jdbc/with-db-transaction [t connection]
(if (not= (:level t) 1)
(jdbc-fn connection
(rewrite-query-for-jdbc tokens args)
call-options)
(loop [i 0]
(Thread/sleep (* i 2 10))
(let [sym (try
(jdbc-fn connection
(rewrite-query-for-jdbc tokens args)
call-options)
(catch com.mysql.jdbc.exceptions.jdbc4.MySQLTransactionRollbackException e
(if (= i 10)
(throw e)
:exception-caught)))]
(if (= :exception-caught sym)
(recur (inc i))
sym)))))]
(let [ret (jdbc-fn connection
(rewrite-query-for-jdbc tokens args)
call-options)]
(cond (and (= insert-handler jdbc-fn) (:after-insert query-options))
((:after-insert query-options) ret args statement call-options)
(and (= execute-handler jdbc-fn) (= "delete" (lower-case (first (split (trim statement) #" ")))) (:after-delete query-options))
Expand Down