Also use query instead of deprecated exec.