handle sql call