Database: SqlBuilder::addWhere() consider NOT [Closes #667]

My solution of fixing #667 and #869