fukamachi / cl-dbi

Database independent interface for Common Lisp
201 stars 28 forks source link

Enable customization of 'row-reader in cl-dbi as it is in cl-postgres #82

Open thijs opened 5 months ago

thijs commented 5 months ago

In cl-postgres you can do

(prepare-query connection "test-bool" "select $1" '(t))
(exec-prepared connection "test-bool" '(nil) 'list-row-reader)

so that you can specify how you want the results to be transformed for your use. There are a few supplied (list-row-reader as here, and there are more), but you can also create and provide your own.

I was disappointed to see that in cl-dbi this functionality is not utilized. In execute-using-connection the call to exec-prepared has an inline hard-coded row-reader implementation.

I'd like to request this be changed so that the row-reader is user-settable.

I might actually take a stab at creating a pull request for this, but time at the moment is short...

fukamachi commented 5 months ago

That sounds great to me. I only had a little time on CL-DBI, so there's room to improve its interface.

fukamachi commented 1 month ago

It's not exactly the same, but now dbi:fetch has a :format argument to specify the type of each row. It must be one of :plist, :alist, :hash-table, and :values.