Skip to content

Commit

Permalink
chore(raw_sql): try not adding another lifetime param
Browse files Browse the repository at this point in the history
  • Loading branch information
abonander committed Nov 28, 2024
1 parent dbbeed2 commit df14f86
Showing 1 changed file with 15 additions and 36 deletions.
51 changes: 15 additions & 36 deletions sqlx-core/src/raw_sql.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,25 @@ impl<'q, DB: Database> Execute<'q, DB> for RawSql<'q> {
impl<'q> RawSql<'q> {
/// Execute the SQL string and return the total number of rows affected.
#[inline]
pub async fn execute<'e, 'c: 'e, E, DB>(
self,
executor: E,
) -> crate::Result<DB::QueryResult>
pub async fn execute<'e, E, DB>(self, executor: E) -> crate::Result<DB::QueryResult>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.execute(self).await
}

/// Execute the SQL string. Returns a stream which gives the number of rows affected for each statement in the string.
#[inline]
pub fn execute_many<'e, 'c: 'e, E, DB>(
pub fn execute_many<'e, E, DB>(
self,
executor: E,
) -> BoxStream<'e, crate::Result<DB::QueryResult>>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.execute_many(self)
}
Expand All @@ -170,14 +167,11 @@ impl<'q> RawSql<'q> {
///
/// If the string contains multiple statements, their results will be concatenated together.
#[inline]
pub fn fetch<'e, 'c: 'e, E, DB>(
self,
executor: E,
) -> BoxStream<'e, Result<DB::Row, Error>>
pub fn fetch<'e, E, DB>(self, executor: E) -> BoxStream<'e, Result<DB::Row, Error>>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.fetch(self)
}
Expand All @@ -187,20 +181,14 @@ impl<'q> RawSql<'q> {
/// For each query in the stream, any generated rows are returned first,
/// then the `QueryResult` with the number of rows affected.
#[inline]
pub fn fetch_many<'e, 'c: 'e, E, DB>(
pub fn fetch_many<'e, E, DB>(
self,
executor: E,
) -> BoxStream<
'e,
Result<
Either<DB::QueryResult, DB::Row>,
Error,
>,
>
) -> BoxStream<'e, Result<Either<DB::QueryResult, DB::Row>, Error>>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.fetch_many(self)
}
Expand All @@ -213,14 +201,11 @@ impl<'q> RawSql<'q> {
/// To avoid exhausting available memory, ensure the result set has a known upper bound,
/// e.g. using `LIMIT`.
#[inline]
pub fn fetch_all<'e, 'c: 'e, E, DB>(
self,
executor: E,
) -> BoxFuture<'e, crate::Result<Vec<DB::Row>>>
pub fn fetch_all<'e, E, DB>(self, executor: E) -> BoxFuture<'e, crate::Result<Vec<DB::Row>>>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.fetch_all(self)
}
Expand All @@ -238,14 +223,11 @@ impl<'q> RawSql<'q> {
///
/// Otherwise, you might want to add `LIMIT 1` to your query.
#[inline]
pub fn fetch_one<'e, 'c: 'e, E, DB>(
self,
executor: E,
) -> BoxFuture<'e, crate::Result<DB::Row>>
pub fn fetch_one<'e, E, DB>(self, executor: E) -> BoxFuture<'e, crate::Result<DB::Row>>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.fetch_one(self)
}
Expand All @@ -263,14 +245,11 @@ impl<'q> RawSql<'q> {
///
/// Otherwise, you might want to add `LIMIT 1` to your query.
#[inline]
pub async fn fetch_optional<'e, 'c: 'e, E, DB>(
self,
executor: E,
) -> crate::Result<DB::Row>
pub async fn fetch_optional<'e, E, DB>(self, executor: E) -> crate::Result<DB::Row>
where
'q: 'e,
DB: Database,
E: Executor<'c, Database = DB>,
E: Executor<'e, Database = DB>,
{
executor.fetch_one(self).await
}
Expand Down

0 comments on commit df14f86

Please sign in to comment.