Lets look at sample method of using this module:
AccountingQueryFmt "UPDATE ipaccounting SET bytesin =
bytesin + %r, bytesout = bytesout + %s WHERE LOWER( host ) =
LOWER( '%h' )"
For this we should manually insert initial row for every virtualhost.
That can by annoying for servers with large qty of them.
I suggest to track the number of affected_rows by main query,
and if it equal to zero (no such virtualhost found), then we should
execute some Initial query (INSERT INTO)
AccountingInitFmt "INSERT INTO ipaccounting
(bytesin,bytesout,host) VALUES(%r,%s,LOWER( '%h' ))"
AccountingQueryFmt "UPDATE ipaccounting SET bytesin =
bytesin + %r, bytesout = bytesout + %s WHERE host = LOWER
( '%h' )"
I do this for mysql (I dont know PG API), now Query function return
number of affected rows insted of error (It was not verifyed
anywhere)
If AccountingInitFmt is not set, module works as usual.
patch for mod_accounting-0.5