Skip to content

Conversation

iamjpotts
Copy link
Contributor

@iamjpotts iamjpotts commented Aug 2, 2025

Does your PR solve an issue?

Similar to #3957, allows more flexibility with passing references as bind parameters to query! macros when using the Any driver.

This is the first of two prs, after which Query::bind and Query::try_bind argument lifetimes will be relaxed to be consistent across the drivers. The second pr adds a test which is a compile-time check of the new lifetime allowances for arguments. That test will not compile with just this pr.

Second of the two prs:
#3960

Is this a breaking change?

Yes:

  • removes lifetime parameters from structs that are a part of the public api for the Any driver
  • changes enum variants for AnyValueKind

@iamjpotts iamjpotts force-pushed the jp/any-arg-lifetime branch 2 times, most recently from 4b8535d to babd18d Compare August 2, 2025 15:53
@iamjpotts iamjpotts force-pushed the jp/any-arg-lifetime branch 2 times, most recently from 58b46a2 to 3217e7e Compare August 11, 2025 01:13
@iamjpotts iamjpotts force-pushed the jp/any-arg-lifetime branch 2 times, most recently from b1320b0 to c8c85e7 Compare August 19, 2025 22:01
@iamjpotts iamjpotts marked this pull request as ready for review August 19, 2025 22:19
@iamjpotts iamjpotts force-pushed the jp/any-arg-lifetime branch 2 times, most recently from a327b23 to 58fdeca Compare August 22, 2025 12:28
Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
@iamjpotts iamjpotts force-pushed the jp/any-arg-lifetime branch from 58fdeca to 255ea48 Compare August 27, 2025 23:47
@joeydewaal
Copy link
Contributor

Just as a note:
To implement something like #875, you'd have to defer the encoding of the arguments until your in the driver. One way to do that is to store the arguments in a Vec<&dyn Encode>. Which is something we could do now since we have a lifetime in ArgumentBuffer.

(There are pro's and con's ofcourse, it'd save a copy here and here but all bind calls would require a reference.)

masato-hi added a commit to masato-hi/sqlx-scylladb that referenced this pull request Sep 1, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants