Skip to content

Commit

Permalink
Check if the DB is connected in retrieve-by-sql & execute-sql right b…
Browse files Browse the repository at this point in the history
…efore it's required.
  • Loading branch information
fukamachi committed Jun 18, 2024
1 parent 80991a6 commit 1c870f6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/core/db.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,8 @@ Note that DBI:PREPARE-CACHED is added CL-DBI v0.9.5.")
t))))

(defgeneric execute-sql (sql &optional binds)
(:method :before (sql &optional binds)
(declare (ignore sql binds))
(check-connected))
(:method ((sql string) &optional binds)
(check-connected)
(with-trace-sql
(with-prepared-query query (*connection* sql :use-prepare-cached *use-prepare-cached*)
(setf query (execute-with-retry query binds))
Expand Down Expand Up @@ -192,10 +190,8 @@ Note that DBI:PREPARE-CACHED is added CL-DBI v0.9.5.")
(dbi:fetch-all query :format :values)))))

(defgeneric retrieve-by-sql (sql &key binds format lispify)
(:method :before (sql &rest args)
(declare (ignore sql args))
(check-connected))
(:method ((sql string) &key binds format (lispify nil lispify-specified))
(check-connected)
(with-prepared-query query (*connection* sql :use-prepare-cached *use-prepare-cached*)
(let* ((query (with-trace-sql
(execute-with-retry query binds)))
Expand Down

0 comments on commit 1c870f6

Please sign in to comment.