mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-19 08:39:44 +00:00
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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user