Skip to content

Commit 04cdd2e

Browse files
committed
Simplify date-add
1 parent 90522cb commit 04cdd2e

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/metabase/driver/firebird.clj

+3-6
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,10 @@
163163
(defmethod sql.qp/date [:firebird :quarter-of-year] [_ _ expr] (hx/+ (hx// (hx/- (hsql/call :extract :MONTH expr) 1) 3) 1))
164164
(defmethod sql.qp/date [:firebird :year] [_ _ expr] (hsql/call :extract :YEAR expr))
165165

166-
(defmethod driver/date-add :firebird [_ dt unit amount]
166+
(defmethod driver/date-add :firebird [driver dt amount unit]
167167
(if (= unit :quarter)
168-
(recur _ dt :month (hx/* amount 3))
169-
(hsql/call :dateadd (hsql/raw (name unit)) amount (hx/cast :timestamp (hx/literal :now)))))
170-
171-
(defn- date-add [unit & exprs]
172-
(apply hsql/call :dateadd (hsql/raw (name unit)) exprs))
168+
(recur driver dt (hx/* amount 3) :month)
169+
(hsql/call :dateadd (hsql/raw (name unit)) amount dt)))
173170

174171
(defmethod sql.qp/current-datetime-fn :firebird [_]
175172
(hx/cast :timestamp (hx/literal :now)))

0 commit comments

Comments
 (0)