aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cuirass/database.scm9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index d8d1ed2..da39bcc 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -98,15 +98,16 @@ database object."
(map (λ (key) (or (assq-ref alst key) default-value))
keys))
+(define (last-insert-rowid db)
+ (vector-ref (car (sqlite-exec db "SELECT last_insert_rowid();"))
+ 0))
+
(define (db-add-evaluation db job)
"Store a derivation result in database DB and return its ID."
(sqlite-exec db "insert into build (job_spec, drv) values ('~A', '~A');"
(assq-ref job #:job-name)
(assq-ref job #:derivation))
- (let* ((stmt (sqlite-prepare db "select last_insert_rowid() from build;"))
- (res (sqlite-step stmt)))
- (sqlite-finalize stmt)
- (vector-ref res 0)))
+ (last-insert-rowid db))
(define (db-get-evaluation db id)
"Retrieve a job in database DB which corresponds to ID."