Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
thijs opened this issue Mar 23, 2024 · 2 comments
Open

Comments

@thijs
Copy link

thijs commented Mar 23, 2024

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
Copy link
Owner

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

@fukamachi
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants