Get the SQL statements from the specified query file
(query: &str)
| 217 | |
| 218 | /// Get the SQL statements from the specified query file |
| 219 | pub fn get_query_sql(query: &str) -> Result<Vec<String>> { |
| 220 | let possibilities = vec![ |
| 221 | format!("queries/imdb/{query}.sql"), |
| 222 | format!("benchmarks/queries/imdb/{query}.sql"), |
| 223 | ]; |
| 224 | let mut errors = vec![]; |
| 225 | for filename in possibilities { |
| 226 | match fs::read_to_string(&filename) { |
| 227 | Ok(contents) => { |
| 228 | return Ok(contents |
| 229 | .split(';') |
| 230 | .map(|s| s.trim()) |
| 231 | .filter(|s| !s.is_empty()) |
| 232 | .map(|s| s.to_string()) |
| 233 | .collect()); |
| 234 | } |
| 235 | Err(e) => errors.push(format!("{filename}: {e}")), |
| 236 | }; |
| 237 | } |
| 238 | plan_err!("invalid query. Could not find query: {:?}", errors) |
| 239 | } |
no test coverage detected
searching dependent graphs…