From 3942e6cab7a0883220d78068dc47ddf81760a90e Mon Sep 17 00:00:00 2001 From: Ricky Kresslein Date: Fri, 20 May 2022 12:26:53 +0300 Subject: Autosave (Issue #45) --- src/database.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/database.rs') diff --git a/src/database.rs b/src/database.rs index 5412896..69b56dc 100755 --- a/src/database.rs +++ b/src/database.rs @@ -81,6 +81,21 @@ pub fn db_write(task_name: &str, Ok(()) } +pub fn write_autosave(task_name: &str, + start_time: &str, + stop_time: &str, + tags: &str) -> Result<()> { + // Write data into database + let conn = Connection::open(get_directory())?; + + conn.execute( + "INSERT INTO tasks (task_name, start_time, stop_time, tags) values (?1, ?2, ?3, ?4)", + &[&task_name, &start_time, &stop_time, &tags], + )?; + + Ok(()) +} + pub fn retrieve() -> Result, rusqlite::Error> { // Retrieve all tasks from the database let conn = Connection::open(get_directory())?; -- cgit 1.4.1