mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
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:
parent
5293beeb77
commit
82476138c1
1 changed files with 4 additions and 1 deletions
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue