Build the SQL for `SHOW GRAPH STATS`. Collection and `as_of` are both optional; when absent the corresponding clause is omitted entirely.
(collection: Option<&str>, as_of: Option<i64>)
| 221 | /// Build the SQL for `SHOW GRAPH STATS`. Collection and `as_of` are both |
| 222 | /// optional; when absent the corresponding clause is omitted entirely. |
| 223 | pub(crate) fn build_graph_stats_sql(collection: Option<&str>, as_of: Option<i64>) -> String { |
| 224 | let mut sql = "SHOW GRAPH STATS".to_string(); |
| 225 | if let Some(c) = collection { |
| 226 | sql.push(' '); |
| 227 | sql.push_str("e_string_literal(c)); |
| 228 | } |
| 229 | if let Some(ms) = as_of { |
| 230 | sql.push_str(&format!(" AS OF SYSTEM TIME {ms}")); |
| 231 | } |
| 232 | sql |
| 233 | } |
| 234 | |
| 235 | /// Parse a multi-row response from `SHOW GRAPH STATS` into a vec of |
| 236 | /// `GraphStats`. Empty rows produce an empty vec. Column-shape mismatches |