aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathieu Lirzin <mthl@gnu.org>2016-07-25 20:31:06 +0200
committerMathieu Lirzin <mthl@gnu.org>2016-07-25 20:32:01 +0200
commite51a755f10ac7a093d85fb6f8868c33a046cc9ab (patch)
treefadd4ca0b7623bce72afe856f855fd3584752734 /src
parent7292bd5019cf8847eb072159221b5cdd85499c14 (diff)
downloadcuirass-e51a755f10ac7a093d85fb6f8868c33a046cc9ab.tar
cuirass-e51a755f10ac7a093d85fb6f8868c33a046cc9ab.tar.gz
database: Add 'db-add-build' procedure.
Diffstat (limited to 'src')
-rw-r--r--src/cuirass/database.scm19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm
index f746289..3b8ffb9 100644
--- a/src/cuirass/database.scm
+++ b/src/cuirass/database.scm
@@ -33,7 +33,7 @@
db-add-evaluation
db-get-evaluation
db-delete-evaluation
- db-add-build-log
+ db-add-build
read-sql-file
read-quoted-string
sqlite-exec
@@ -180,12 +180,11 @@ string."
((char=? char #\') (loop (cons* char char chars)))
(else (loop (cons char chars)))))))
-(define (db-add-build-log db job log)
- "Store a build LOG corresponding to JOB in database DB."
- (let ((id (assq-ref job #:id))
- (log* (cond ((string? log) log)
- ((port? log)
- (seek log 0 SEEK_SET)
- (read-quoted-string log))
- (else #f))))
- (sqlite-exec db "update build set log='~A' where id=~A;" log* id)))
+(define (db-add-build db build)
+ "Store BUILD in database DB."
+ (sqlite-exec db "\
+INSERT INTO Builds (derivation, log, output) VALUES ('~A', '~A', '~A');"
+ (assq-ref build #:derivation)
+ (assq-ref build #:log)
+ (assq-ref build #:output))
+ (last-insert-rowid db))