refactor(sqlite): do not borrow bound values, delete lifetime on SqliteArguments (#3957)

* bug(sqlite): query macro argument lifetime use inconsistent with other db platforms

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Improve support for references as query macro bind arguments by removing lifetime parameter from SqliteArguments

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Introduce SqliteArgumentsBuffer type

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(sqlite): Improve cloning of SqliteArgumentValue, SqliteArguments, and SqliteArgumentsBuffer

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

* refactor(any): Simplify AnyArguments::convert_to to convert_into

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>

---------

Signed-off-by: Joshua Potts <8704475+iamjpotts@users.noreply.github.com>
This commit is contained in:
iamjpotts
2025-08-19 16:59:37 -04:00
committed by GitHub
parent e77f32ea5e
commit ff93aa017a
22 changed files with 221 additions and 275 deletions

View File

@@ -86,7 +86,7 @@ impl AnyConnectionBackend for PgConnection {
arguments: Option<AnyArguments<'q>>,
) -> BoxStream<'q, sqlx_core::Result<Either<AnyQueryResult, AnyRow>>> {
let persistent = persistent && arguments.is_some();
let arguments = match arguments.as_ref().map(AnyArguments::convert_to).transpose() {
let arguments = match arguments.map(AnyArguments::convert_into).transpose() {
Ok(arguments) => arguments,
Err(error) => {
return stream::once(future::ready(Err(sqlx_core::Error::Encode(error)))).boxed()
@@ -113,8 +113,7 @@ impl AnyConnectionBackend for PgConnection {
) -> BoxFuture<'q, sqlx_core::Result<Option<AnyRow>>> {
let persistent = persistent && arguments.is_some();
let arguments = arguments
.as_ref()
.map(AnyArguments::convert_to)
.map(AnyArguments::convert_into)
.transpose()
.map_err(sqlx_core::Error::Encode);