Skip to content

Commit

Permalink
Raise an error in make-cursor when it's not supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
fukamachi committed Jul 25, 2024
1 parent a559d7a commit fa47100
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/dbd/postgres.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,11 @@
(with-handling-pg-errors
(make-query conn sql)))

(defmethod make-cursor ((conn dbd-postgres-connection) sql &key (cursor-class 'dbi-cursor))
(make-instance cursor-class
:connection conn
:sql sql))

(defmethod execute-using-connection ((conn dbd-postgres-connection) (cursor dbi-cursor) params)
(assert (in-transaction conn))
(with-accessors ((sql cursor-sql)
Expand Down
8 changes: 4 additions & 4 deletions src/driver.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,10 @@ This method may be overrided by subclasses."
query))))

(defgeneric make-cursor (conn sql &key cursor-class)
(:method ((conn dbi-connection) (sql string) &key (cursor-class 'dbi-cursor))
(make-instance cursor-class
:connection conn
:sql sql)))
(:method (conn sql &key cursor-class)
(declare (ignore conn sql cursor-class))
(error 'dbi-unimplemented-error
:method-name 'make-cursor)))

(defgeneric execute (query &optional params)
(:documentation "Execute `query` with `params` and return the results.")
Expand Down

0 comments on commit fa47100

Please sign in to comment.