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>
pull/2832/head
DL6ER 5 years ago
parent 5293beeb77
commit 82476138c1
No known key found for this signature in database
GPG Key ID: 00135ACBD90B28DD

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

Loading…
Cancel
Save