db: move call_implies to use raw SQL