Made dev tools not break everything about the db
Also improved multi statements to allow out of order parameter binding in statements Ensured that all statements are run for maybe_row and single, and that of all statements only 1 of them returns only 1 row Made bind and column calls add useful context to errors Co-authored-by: kay@zed.dev
This commit is contained in:
parent
2dc1130902
commit
3e0f9d27a7
13 changed files with 219 additions and 110 deletions
|
@ -29,15 +29,21 @@ impl Domain for Terminal {
|
|||
|
||||
impl TerminalDb {
|
||||
sql_method! {
|
||||
save_working_directory(item_id: ItemId, workspace_id: WorkspaceId, working_directory: &Path) -> Result<()>:
|
||||
"INSERT OR REPLACE INTO terminals(item_id, workspace_id, working_directory)
|
||||
VALUES (?1, ?2, ?3)"
|
||||
save_working_directory(item_id: ItemId,
|
||||
workspace_id: WorkspaceId,
|
||||
working_directory: &Path) -> Result<()>:
|
||||
indoc!{"
|
||||
INSERT OR REPLACE INTO terminals(item_id, workspace_id, working_directory)
|
||||
VALUES (?1, ?2, ?3)
|
||||
"}
|
||||
}
|
||||
|
||||
sql_method! {
|
||||
get_working_directory(item_id: ItemId, workspace_id: WorkspaceId) -> Result<Option<PathBuf>>:
|
||||
"SELECT working_directory
|
||||
FROM terminals
|
||||
WHERE item_id = ? AND workspace_id = ?"
|
||||
indoc!{"
|
||||
SELECT working_directory
|
||||
FROM terminals
|
||||
WHERE item_id = ? AND workspace_id = ?
|
||||
"}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue