(path: &PathBuf)
| 11 | }; |
| 12 | |
| 13 | pub fn parse_sql_file(path: &PathBuf) -> Result<(HashMap<PathBuf, Vec<SQL>>, Handler)> { |
| 14 | let contents = fs::read_to_string(path)?; |
| 15 | let cm: Lrc<SourceMap> = Default::default(); |
| 16 | let handler = Handler::with_tty_emitter(ColorConfig::Auto, true, false, Some(cm.clone())); |
| 17 | |
| 18 | let mut sqls_map: HashMap<PathBuf, Vec<SQL>> = HashMap::new(); |
| 19 | let sqls = extract_sql_queries_from_file(&contents, path)?; |
| 20 | |
| 21 | if !sqls.is_empty() { |
| 22 | sqls_map.insert(path.clone(), sqls); |
| 23 | } |
| 24 | |
| 25 | Ok((sqls_map, handler)) |
| 26 | } |
| 27 | |
| 28 | /// Extract SQL queries from raw SQL file content |
| 29 | /// Supports multiple queries separated by semicolons and annotations |
no test coverage detected