-
Notifications
You must be signed in to change notification settings - Fork 1.5k
refactor(any): Implement fetch_optional in terms of fetch_many #3965
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
base: main
Are you sure you want to change the base?
refactor(any): Implement fetch_optional in terms of fetch_many #3965
Conversation
95f7772
to
3358247
Compare
Wouldn't |
Thanks for bringing this up.
Though not a part of this PR, I am exploring an implementation of named parameters and this being de-duplicated helps with it (as well as simplifying the existing code). |
You're absolutely right, my bad. My main fear was that this would alter existent behavior but, given that the method did not have a default impl, it won't. Also silly me because Just stumbled upon this issue as I was searching for something else and wanted to give my 2 cents. The whole reason I'm interested in this is because there seems not to be a clear separation between I was even considering going to the extent of erroring out early in Anyway, just to wrap up my brainstorming, while |
Please feel free to add more comments even if you're not sure. I have a few more prs that you may be interested in a heads up on since you maintain an implementation of another db platform: While I am not a maintainer, an extra set of eyes and comments may be helpful to the maintainer if/when he gets around to looking at these. |
3358247
to
b27505b
Compare
b27505b
to
65a8b39
Compare
I don't think this is an appropriate change. I've been planning on deleting TL;DR: the implementation isn't at all consistent between drivers:
|
That's also a behavior of SQL Server (though SQL Server support obviously is not a part of the core crate workspace anymore). I'm going to leave this in draft since what (if anything) is done with it would hinge on the outcome of #3108. |
We could adopt some sort of |
Signed-off-by: Joshua Potts <[email protected]>
65a8b39
to
d552c6f
Compare
fetch_many
fetch_optional
implementations to loop over thefetch_many
result stream until the first row is found (previously, some implementations could return None if a row was present in the stream, but a statistics entryAnyQueryResult
was returned first).Builds on:#3960Does your PR solve an issue?
No
Is this a breaking change?
No, but it does add a default implementation for
AnyConnectionBackend::fetch_optional
which only thesqlite
implementation overrides.