about summary refs log tree commit diff
path: root/src/database.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/database.rs')
-rwxr-xr-xsrc/database.rs15
1 files changed, 15 insertions, 0 deletions
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<Vec<Task>, rusqlite::Error> {
     // Retrieve all tasks from the database
     let conn = Connection::open(get_directory())?;