Added SQL query write listner.