|
1 | 1 | use crate::describe::Describe; |
2 | 2 | use crate::error::Error; |
3 | 3 | use crate::executor::{Execute, Executor}; |
| 4 | +use crate::logger::QueryLogger; |
4 | 5 | use crate::postgres::message::{ |
5 | 6 | self, Bind, Close, CommandComplete, DataRow, MessageFormat, ParameterDescription, Parse, Query, |
6 | 7 | RowDescription, |
@@ -190,14 +191,16 @@ impl PgConnection { |
190 | 191 | Ok(statement) |
191 | 192 | } |
192 | 193 |
|
193 | | - async fn run( |
194 | | - &mut self, |
195 | | - query: &str, |
| 194 | + async fn run<'e, 'c: 'e, 'q: 'e>( |
| 195 | + &'c mut self, |
| 196 | + query: &'q str, |
196 | 197 | arguments: Option<PgArguments>, |
197 | 198 | limit: u8, |
198 | 199 | persistent: bool, |
199 | 200 | metadata_opt: Option<Arc<PgStatementMetadata>>, |
200 | | - ) -> Result<impl Stream<Item = Result<Either<PgDone, PgRow>, Error>> + '_, Error> { |
| 201 | + ) -> Result<impl Stream<Item = Result<Either<PgDone, PgRow>, Error>> + 'e, Error> { |
| 202 | + let mut logger = QueryLogger::new(query); |
| 203 | + |
201 | 204 | // before we continue, wait until we are "ready" to accept more queries |
202 | 205 | self.wait_until_ready().await?; |
203 | 206 |
|
@@ -294,6 +297,8 @@ impl PgConnection { |
294 | 297 | } |
295 | 298 |
|
296 | 299 | MessageFormat::DataRow => { |
| 300 | + logger.increment_rows(); |
| 301 | + |
297 | 302 | // one of the set of rows returned by a SELECT, FETCH, etc query |
298 | 303 | let data: DataRow = message.decode()?; |
299 | 304 | let row = PgRow { |
|
0 commit comments