Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Guix Cuirass
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Panda
Guix Cuirass
Commits
b1dd6691
Unverified
Commit
b1dd6691
authored
8 years ago
by
Mathieu Lirzin
Browse files
Options
Downloads
Patches
Plain Diff
database: sqlite-exec: Return every rows.
Export it. Add a test.
parent
18e42be3
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cuirass/database.scm
+9
-3
9 additions, 3 deletions
src/cuirass/database.scm
tests/database.scm
+10
-0
10 additions, 0 deletions
tests/database.scm
with
19 additions
and
3 deletions
src/cuirass/database.scm
+
9
−
3
View file @
b1dd6691
...
...
@@ -29,6 +29,7 @@
db-delete-evaluation
db-add-build-log
read-sql-file
sqlite-exec
;; Parameters.
%package-database
;; Macros.
...
...
@@ -39,9 +40,14 @@
MSG to database DB. MSG can contain '~A' and '~S' escape characters which
will be replaced by ARGS."
(
let*
((
sql
(
apply
simple-format
#f
msg
args
))
(
stmt
(
sqlite-prepare
db
sql
)))
(
sqlite-step
stmt
)
(
sqlite-finalize
stmt
)))
(
stmt
(
sqlite-prepare
db
sql
))
(
res
(
let
loop
((
res
'
()))
(
let
((
row
(
sqlite-step
stmt
)))
(
if
(
not
row
)
(
reverse!
res
)
(
loop
(
cons
row
res
)))))))
(
sqlite-finalize
stmt
)
res
))
(
define
%package-database
;; Define to the database file name of this package.
...
...
This diff is collapsed.
Click to expand it.
tests/database.scm
+
10
−
0
View file @
b1dd6691
...
...
@@ -42,6 +42,16 @@
(
test-assert
"db-init"
(
%db
(
db-init
)))
(
test-assert
"sqlite-exec"
(
begin
(
sqlite-exec
(
%db
)
"\
INSERT INTO build (job_spec, drv) VALUES ('job1', 'drv1');"
)
(
sqlite-exec
(
%db
)
"\
INSERT INTO build (job_spec, drv) VALUES ('job2', 'drv2');"
)
(
sqlite-exec
(
%db
)
"\
INSERT INTO build (job_spec, drv) VALUES ('job3', 'drv3');"
)
(
sqlite-exec
(
%db
)
"SELECT * FROM build;"
)))
(
test-assert
"db-add-evaluation"
(
%id
(
db-add-evaluation
(
%db
)
(
make-dummy-job
))))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment