database: rewrite query procedures in terms of with-statement.
authorCaleb Ristvedt <caleb.ristvedt@cune.org>
Tue, 2 Jun 2020 00:21:43 +0000 (19:21 -0500)
committerCaleb Ristvedt <caleb.ristvedt@cune.org>
Thu, 11 Jun 2020 02:54:35 +0000 (21:54 -0500)
commit5d6e2255286e591def122ec2f4a3cbda497fea21
tree96a55c989dc491168adb961de46252a038923076
parent3cd92a855e8f6768a4470cd5522749a39d5f9047
database: rewrite query procedures in terms of with-statement.

Most of our queries would fail to finalize their statements properly if sqlite
returned an error during their execution.  This resolves that, and also makes
them somewhat more concise as a side-effect.

This also makes some small changes to improve certain queries where behavior
was strange or overly verbose.

* guix/store/database.scm (call-with-statement): new procedure.
  (with-statement): new macro.
  (last-insert-row-id, path-id, update-or-insert, add-references): rewrite to
  use with-statement.
  (update-or-insert): factor last-insert-row-id out of the end of both
  branches.
  (add-references): remove pointless last-insert-row-id call.

* .dir-locals.el (with-statement): add indenting information.
.dir-locals.el
guix/store/database.scm