@@ -114,7 +114,7 @@ pub struct RawSql<'q>(&'q str);
114
114
///
115
115
/// See [MySQL manual, section 13.3.3: Statements That Cause an Implicit Commit](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html) for details.
116
116
/// See also: [MariaDB manual: SQL statements That Cause an Implicit Commit](https://mariadb.com/kb/en/sql-statements-that-cause-an-implicit-commit/).
117
- pub fn raw_sql ( sql : & str ) -> RawSql < ' _ > {
117
+ pub fn raw_sql < ' q > ( sql : & ' q str ) -> RawSql < ' q > {
118
118
RawSql ( sql)
119
119
}
120
120
@@ -138,27 +138,26 @@ impl<'q, DB: Database> Execute<'q, DB> for RawSql<'q> {
138
138
139
139
impl < ' q > RawSql < ' q > {
140
140
/// Execute the SQL string and return the total number of rows affected.
141
- #[ inline]
142
- pub async fn execute < ' e , E > (
141
+ pub async fn execute < ' e , ' c : ' e , E > (
143
142
self ,
144
143
executor : E ,
145
144
) -> crate :: Result < <E :: Database as Database >:: QueryResult >
146
145
where
147
146
' q : ' e ,
148
- E : Executor < ' e > ,
147
+ E : Executor < ' c > ,
149
148
{
150
149
executor. execute ( self ) . await
151
150
}
152
151
153
152
/// Execute the SQL string. Returns a stream which gives the number of rows affected for each statement in the string.
154
153
#[ inline]
155
- pub fn execute_many < ' e , E > (
154
+ pub fn execute_many < ' e , ' c : ' e , E > (
156
155
self ,
157
156
executor : E ,
158
157
) -> BoxStream < ' e , crate :: Result < <E :: Database as Database >:: QueryResult > >
159
158
where
160
159
' q : ' e ,
161
- E : Executor < ' e > ,
160
+ E : Executor < ' c > ,
162
161
{
163
162
executor. execute_many ( self )
164
163
}
@@ -167,13 +166,13 @@ impl<'q> RawSql<'q> {
167
166
///
168
167
/// If the string contains multiple statements, their results will be concatenated together.
169
168
#[ inline]
170
- pub fn fetch < ' e , E > (
169
+ pub fn fetch < ' e , ' c : ' e , E > (
171
170
self ,
172
171
executor : E ,
173
172
) -> BoxStream < ' e , Result < <E :: Database as Database >:: Row , Error > >
174
173
where
175
174
' q : ' e ,
176
- E : Executor < ' e > ,
175
+ E : Executor < ' c > ,
177
176
{
178
177
executor. fetch ( self )
179
178
}
@@ -183,7 +182,7 @@ impl<'q> RawSql<'q> {
183
182
/// For each query in the stream, any generated rows are returned first,
184
183
/// then the `QueryResult` with the number of rows affected.
185
184
#[ inline]
186
- pub fn fetch_many < ' e , E > (
185
+ pub fn fetch_many < ' e , ' c : ' e , E > (
187
186
self ,
188
187
executor : E ,
189
188
) -> BoxStream <
@@ -195,7 +194,7 @@ impl<'q> RawSql<'q> {
195
194
>
196
195
where
197
196
' q : ' e ,
198
- E : Executor < ' e > ,
197
+ E : Executor < ' c > ,
199
198
{
200
199
executor. fetch_many ( self )
201
200
}
@@ -208,13 +207,13 @@ impl<'q> RawSql<'q> {
208
207
/// To avoid exhausting available memory, ensure the result set has a known upper bound,
209
208
/// e.g. using `LIMIT`.
210
209
#[ inline]
211
- pub async fn fetch_all < ' e , E > (
210
+ pub async fn fetch_all < ' e , ' c : ' e , E > (
212
211
self ,
213
212
executor : E ,
214
213
) -> crate :: Result < Vec < <E :: Database as Database >:: Row > >
215
214
where
216
215
' q : ' e ,
217
- E : Executor < ' e > ,
216
+ E : Executor < ' c > ,
218
217
{
219
218
executor. fetch_all ( self ) . await
220
219
}
@@ -232,13 +231,13 @@ impl<'q> RawSql<'q> {
232
231
///
233
232
/// Otherwise, you might want to add `LIMIT 1` to your query.
234
233
#[ inline]
235
- pub async fn fetch_one < ' e , E > (
234
+ pub async fn fetch_one < ' e , ' c : ' e , E > (
236
235
self ,
237
236
executor : E ,
238
237
) -> crate :: Result < <E :: Database as Database >:: Row >
239
238
where
240
239
' q : ' e ,
241
- E : Executor < ' e > ,
240
+ E : Executor < ' c > ,
242
241
{
243
242
executor. fetch_one ( self ) . await
244
243
}
@@ -256,13 +255,13 @@ impl<'q> RawSql<'q> {
256
255
///
257
256
/// Otherwise, you might want to add `LIMIT 1` to your query.
258
257
#[ inline]
259
- pub async fn fetch_optional < ' e , E > (
258
+ pub async fn fetch_optional < ' e , ' c : ' e , E > (
260
259
self ,
261
260
executor : E ,
262
261
) -> crate :: Result < <E :: Database as Database >:: Row >
263
262
where
264
263
' q : ' e ,
265
- E : Executor < ' e > ,
264
+ E : Executor < ' c > ,
266
265
{
267
266
executor. fetch_one ( self ) . await
268
267
}
0 commit comments