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

Add query methods for Statement which take ownership #50

Merged
merged 1 commit into from
Feb 28, 2022
Merged

Add query methods for Statement which take ownership #50

merged 1 commit into from
Feb 28, 2022

Conversation

christoph-heiss
Copy link
Contributor

Hi,

basically as the title and commit message says.
It mimics the interface of Connection::query_*(), which take ownership of the statement instead of borrowing it.
I hope the method names are okay, but I'll happily rename them if there are any better suggestions.

This can be used if StatementBuilder needs to be used, without having to store both Statement and the ResultSet in a struct together (which is quite painful in Rust to do).

Thanks!

@kubo
Copy link
Owner

kubo commented Feb 28, 2022

I apologize that I have not replied so long. I have thought about it one or two hours per week.

Could you change as follows?

  • rename into_query_as to into_result_set
  • rename into_query_as_named to into_result_set_named
  • remove into_query and into_query_named (There are many query methods so I don't want to add new ones as possible.)

This is in the same spirit as `Connection::query()`, which also takes ownership
of the statement it used.
An actual use case of this can be wanting to store the ResultSet in a struct for
later usage, while at the same time having the ability to use StatementBuilder
to set parameters.

Signed-off-by: Christoph Heiss <[email protected]>
@christoph-heiss
Copy link
Contributor Author

I just pushed a new version with your suggestions incorporated.

Thanks for looking into it!

@kubo kubo merged commit 86cf8c9 into kubo:master Feb 28, 2022
@christoph-heiss christoph-heiss deleted the feature/owned-query branch February 28, 2022 16:49
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

Successfully merging this pull request may close these issues.

2 participants