Get the file path for a table
(&self, table_name: &str)
| 120 | |
| 121 | /// Get the file path for a table |
| 122 | fn get_table_path(&self, table_name: &str) -> Result<PathBuf> { |
| 123 | match table_name { |
| 124 | "history" => Ok(self.config.history_file()), |
| 125 | "stats" => Ok(self.config.stats_file()), |
| 126 | // Virtual tables (transcripts, todos) are read-only |
| 127 | // and handled by CompositeStorage |
| 128 | _ => { |
| 129 | // For unknown tables, check if JsonStorage has a file |
| 130 | let jsonl_path = self.config.data_dir.join(format!("{}.jsonl", table_name)); |
| 131 | if jsonl_path.exists() { |
| 132 | return Ok(jsonl_path); |
| 133 | } |
| 134 | let json_path = self.config.data_dir.join(format!("{}.json", table_name)); |
| 135 | if json_path.exists() { |
| 136 | return Ok(json_path); |
| 137 | } |
| 138 | Err(Error::Sql(format!( |
| 139 | "Cannot determine file path for table: {}", |
| 140 | table_name |
| 141 | ))) |
| 142 | } |
| 143 | } |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | /// Extract table name from a SQL statement |
no test coverage detected