-
Notifications
You must be signed in to change notification settings - Fork 332
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
How to pass dynamic named parameters to rusqlite query/execute through params_from_iter
function?
#1342
Comments
How to make the pub(crate) fn bind_parameters_named<'a, T: 'a + ?Sized, I>(&mut self, params: I) -> Result<()>
where
T: ToSql,
I: IntoIterator<Item = (&'a str, &'a T)>, |
There is no |
are there any plans to introduce such functionality? It would be very useful. |
You can just pass |
that doesn't mean that a more convenient API wouldn't be appreciated, and in fact I was stymied trying to do just that (I kept getting errors that the size of my slice wasn't known at compile time—obviously, if I knew that, I wouldn't need anything dynamic in the first place). |
If you get errors that the size of your slice isn't known at compile time, it usually means you just need to pass it behind a reference. |
Or perhaps collect into a vec and use |
Regardless—granted that there are workarounds, the question whether a simple API will be offered is reasonable. Indeed, the docs say:
But while "all of these" boil down to that in the end, that isn't the sole API provided. Other, more convenient ones are, too. I take it from your replies that the answer to my question (will a more convenient way to do this be introduced) is "no". |
Yeah, I don't really have strong feelings. |
How to pass dynamic named parameters to rusqlite query/execute through
params_from_iter
function?I saw the
Sealed
trait has been implemented toParams
trait, but there is not suchbind_parameters_named
method forParamsFromIter
structure.The text was updated successfully, but these errors were encountered: