Helper method to decode a row from a [`tiberius::Row`] (or 2 of them in the case of update) to a [`Row`]. This centralizes the decode and mapping to result.
(
decoder: &SqlServerRowDecoder,
row: &tiberius::Row,
mz_row: &mut Row,
arena: &RowArena,
new_row: Option<&tiberius::Row>,
)
| 742 | /// Helper method to decode a row from a [`tiberius::Row`] (or 2 of them in the case of update) |
| 743 | /// to a [`Row`]. This centralizes the decode and mapping to result. |
| 744 | fn decode( |
| 745 | decoder: &SqlServerRowDecoder, |
| 746 | row: &tiberius::Row, |
| 747 | mz_row: &mut Row, |
| 748 | arena: &RowArena, |
| 749 | new_row: Option<&tiberius::Row>, |
| 750 | ) -> Result<SourceMessage, DataflowError> { |
| 751 | match decoder.decode(row, mz_row, arena, new_row) { |
| 752 | Ok(()) => Ok(SourceMessage { |
| 753 | key: Row::default(), |
| 754 | value: mz_row.clone(), |
| 755 | metadata: Row::default(), |
| 756 | }), |
| 757 | Err(e) => { |
| 758 | let kind = DecodeErrorKind::Text(e.to_string().into()); |
| 759 | // TODO(sql_server2): Get the raw bytes from `tiberius`. |
| 760 | let raw = format!("{row:?}"); |
| 761 | Err(DataflowError::DecodeError(Box::new(DecodeError { |
| 762 | kind, |
| 763 | raw: raw.as_bytes().to_vec(), |
| 764 | }))) |
| 765 | } |
| 766 | } |
| 767 | } |
| 768 | |
| 769 | /// Helper method to return a "definite" error upstream. |
| 770 | async fn return_definite_error( |