Moving bind parameters logic into query()