Return a [`Stream`] that is the entire snapshot of the specified table.
(
client: &mut Client,
table: &SqlServerTableRaw,
)
| 855 | |
| 856 | /// Return a [`Stream`] that is the entire snapshot of the specified table. |
| 857 | pub fn snapshot( |
| 858 | client: &mut Client, |
| 859 | table: &SqlServerTableRaw, |
| 860 | ) -> impl Stream<Item = Result<tiberius::Row, SqlServerError>> { |
| 861 | let cols = table |
| 862 | .columns |
| 863 | .iter() |
| 864 | .map(|SqlServerColumnRaw { name, .. }| quote_identifier(name)) |
| 865 | .join(","); |
| 866 | let query = format!( |
| 867 | "SELECT {cols} FROM {schema_name}.{table_name};", |
| 868 | schema_name = quote_identifier(&table.schema_name), |
| 869 | table_name = quote_identifier(&table.name) |
| 870 | ); |
| 871 | client.query_streaming(query, &[]) |
| 872 | } |
| 873 | |
| 874 | /// Returns the total number of rows present in the specified table. |
| 875 | pub async fn snapshot_size( |
nothing calls this directly
no test coverage detected