If a change of venue is granted to the defendant over the objection of the state, or if the court denies an application by the state for a change of venue, the state shall have the right to appeal from the ruling, within the legal delays for making a motion for an appeal, before a trial on the merits. Prior to sentence the defendant may not appeal from a ruling changing or refusing to change the venue.