fix bug in dbs workflow completion query (crashes TaskArchiver)

Bug was in constructing the bind parameters, they were always left empty. Couldn't resist also making some other cosmetic changes :-)