diff options
author | Mathieu Lirzin <mthl@gnu.org> | 2016-11-13 01:54:41 +0100 |
---|---|---|
committer | Mathieu Lirzin <mthl@gnu.org> | 2016-11-17 01:19:05 +0100 |
commit | bfd395c09fc2eae6b777ef775584337f26861877 (patch) | |
tree | fe8767f333603bd4fc1b656e596673ab52dd39dd /src/cuirass | |
parent | a948f556eb5e58f31aafa81e7e2125a6a1f91d7b (diff) | |
download | cuirass-bfd395c09fc2eae6b777ef775584337f26861877.tar cuirass-bfd395c09fc2eae6b777ef775584337f26861877.tar.gz |
db: Forbid inserting the same specification twice.
* src/schema.sql (Specifications): Make 'repo_name' the primary key.
(Stamps, Evaluations): Adapt.
* src/cuirass/database.scm (db-get-specifications): Likewise.
(db-add-specification): Ignore if SPEC has already been added.
* tests/database.scm (example-spec): Adapt.
Diffstat (limited to 'src/cuirass')
-rw-r--r-- | src/cuirass/database.scm | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/cuirass/database.scm b/src/cuirass/database.scm index f1505e8..870cdc0 100644 --- a/src/cuirass/database.scm +++ b/src/cuirass/database.scm @@ -115,8 +115,8 @@ database object." (define (db-add-specification db spec) "Store specification SPEC in database DB and return its ID." (apply sqlite-exec db "\ -INSERT INTO Specifications (repo_name, url, load_path, file, proc, arguments, \ - branch, tag, revision, no_compile_p) \ +INSERT OR IGNORE INTO Specifications (repo_name, url, load_path, file, \ + proc, arguments, branch, tag, revision, no_compile_p) \ VALUES ('~A', '~A', '~A', '~A', '~S', '~S', '~A', '~A', '~A', ~A);" (append (assq-refs spec '(#:name #:url #:load-path #:file #:proc #:arguments)) @@ -129,11 +129,10 @@ INSERT INTO Specifications (repo_name, url, load_path, file, proc, arguments, \ (specs '())) (match rows (() specs) - ((#(id name url load-path file proc args branch tag rev no-compile?) + ((#(name url load-path file proc args branch tag rev no-compile?) . rest) (loop rest - (cons `((#:id . ,id) - (#:name . ,name) + (cons `((#:name . ,name) (#:url . ,url) (#:load-path . ,load-path) (#:file . ,file) |