Instead of calling sqlite3 multiple times within a loop, we use the ability to add multiple rows within one INSERT clause. This is supported since sqlite3 3.7.11 (2012-03-20) and should be available on all systems.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2019-07-05 16:09:13 +02:00
parent 5293beeb77
commit 82476138c1
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -546,12 +546,15 @@ addAudit()
{ {
shift # skip "-a" shift # skip "-a"
shift # skip "audit" shift # skip "audit"
local domains="('${1}')"
shift # skip first domain, as it has already been added
for domain in "$@" for domain in "$@"
do do
# Insert only the domain here. The date_added field will be # Insert only the domain here. The date_added field will be
# filled with its default value (date_added = current timestamp) # filled with its default value (date_added = current timestamp)
sqlite3 "${gravityDBfile}" "INSERT INTO \"audit\" (domain) VALUES ('${domain}');" domains="${domains},('${domain}')"
done done
sqlite3 "${gravityDBfile}" "INSERT INTO \"audit\" (domain) VALUES ${domains};"
} }
clearAudit() clearAudit()