boulder/sa
Jacob Hoffman-Andrews 4be76afcaf
Extract out `db.QuestionMarks` function (#6568)
We use this pattern in several places: there is a query that needs to
have a variable number of placeholders (question marks) in it, depending
on how many items we are inserting or querying for. For instance, when
issuing a precertificate we add that precertificate's names to the
"issuedNames" table. To make things more efficient, we do that in a
single query, whether there is one name on the certificate or a hundred.
That means interpolating into the query string with series of question
marks that matches the number of names.

We have a helper type MultiInserter that solves this problem for simple
inserts, but it does not solve the problem for selects or more complex
inserts, and we still have a number of places that generate their
sequence of question marks manually.

This change updates addIssuedNames to use MultiInserter. To enable that,
it also narrows the interface required by MultiInserter.Insert, so it's
easier to mock in tests.

This change adds the new function db.QuestionMarks, which generates e.g.
`?,?,?` depending on the input N.

In a few places I had to rename a function parameter named `db` to avoid
shadowing the `db` package.
2023-01-10 14:29:31 -08:00
..
db db: remove unique indexes on some tables (#6519) 2022-12-05 16:24:05 -08:00
db-next test: Support multiple database schemas (#6344) 2022-09-07 14:59:08 -07:00
db-users Create new StorageAuthorityReadOnly gRPC service (#6483) 2022-11-09 11:09:12 -08:00
proto SA: Remove NewOrder and NewAuthorizations2 (#6536) 2022-12-02 14:34:35 -08:00
satest Remove sa-wrappers.go (#5663) 2021-09-27 13:25:41 -07:00
testdata Support writing OCSP to Redis on revocation (#6012) 2022-04-01 13:59:56 -06:00
database.go Fix typo for omitZero in database.go from PR #6492 (#6515) 2022-11-17 13:27:57 -08:00
database_test.go SA: Standardize methods which use COUNT queries (#6505) 2022-11-14 18:10:32 -08:00
ip_range_test.go Remove all stray copyright headers and appends the initial line to LICENSE.txt (#1853) 2016-05-31 12:32:04 -07:00
metrics.go Don't panic on duplicate db metrics (#6247) 2022-07-23 11:11:15 -07:00
migrations.sh test: Support multiple database schemas (#6344) 2022-09-07 14:59:08 -07:00
model.go Extract out `db.QuestionMarks` function (#6568) 2023-01-10 14:29:31 -08:00
model_test.go Unify how we do streaming database selects (#6176) 2022-06-24 14:31:46 -07:00
precertificates.go SA: Standardize methods which use COUNT queries (#6505) 2022-11-14 18:10:32 -08:00
precertificates_test.go db: remove unique indexes on some tables (#6519) 2022-12-05 16:24:05 -08:00
rate_limits.go Create new StorageAuthorityReadOnly gRPC service (#6483) 2022-11-09 11:09:12 -08:00
rate_limits_test.go RA: Return retry-after when Certificates per Registered Domain is exceeded (#6470) 2022-11-01 11:33:19 -07:00
sa.go Deprecate StoreRevokerInfo flag (#6567) 2023-01-09 11:42:23 -08:00
sa_test.go Extract out `db.QuestionMarks` function (#6568) 2023-01-10 14:29:31 -08:00
saro.go Extract out `db.QuestionMarks` function (#6568) 2023-01-10 14:29:31 -08:00
test-cert.der Store a DB of issued names. 2015-09-28 19:37:50 -07:00
test-cert2.der Implement rate limiting by domain name. 2015-10-04 21:04:26 -07:00
type-converter.go Improve error checking paradigm (#5920) 2022-02-01 14:42:43 -07:00
type-converter_test.go Enable additional linters (#6106) 2022-05-11 13:58:58 -07:00
www.eff.org.der Add initial certificate status in SA. 2015-04-23 19:52:34 -07:00