Skip to content

Commit

Permalink
Update ChangeLog.md and add a test
Browse files Browse the repository at this point in the history
  • Loading branch information
kubo committed Jun 23, 2024
1 parent f5163ad commit d6e8840
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ Non-breaking Changes:

* `DbError::new()` uses generics, which supports old types.

Internal Changes:

* Improve performance of iterator for [`ResultSet<T>`][`ResultSet`] where T is [`Row`]
by sharing an internal fetch array buffer. Before this change, one row in the buffer
is copied to `Row` for each iteration. After this, new fetch array buffer is allocated
when more rows must be fetched into a buffer but the buffer is referenced by `Row`s.

## 0.6.0 (2024-05-20)

Breaking changes:
Expand Down
21 changes: 21 additions & 0 deletions src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1485,4 +1485,25 @@ mod tests {

Ok(())
}

#[test]
fn fetch_rows_to_vec() -> Result<()> {
let conn = test_util::connect()?;
// The fetch array size must be less than the number of rows in TestStrings
// in order to make situation that a new fetch array buffer must allocated
// in Stmt::fetch_rows().
let mut stmt = conn
.statement("select IntCol from TestStrings order by IntCol")
.fetch_array_size(3)
.build()?;
let mut rows = Vec::new();
for row_result in stmt.query(&[])? {
rows.push(row_result?);
}
for (index, row) in rows.iter().enumerate() {
let int_col: usize = row.get(0)?;
assert_eq!(int_col, index + 1);
}
Ok(())
}
}

0 comments on commit d6e8840

Please sign in to comment.