MCPcopy Create free account
hub / github.com/douglance/devsql / get_table_path

Method get_table_path

crates/ccql/src/sql/safety.rs:122–144  ·  view source on GitHub ↗

Get the file path for a table

(&self, table_name: &str)

Source from the content-addressed store, hash-verified

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

Callers 2

backup_tableMethod · 0.80
restore_from_backupMethod · 0.80

Calls 2

history_fileMethod · 0.80
stats_fileMethod · 0.80

Tested by

no test coverage detected