When an accused person pleads any plea other than a plea of guilty, and succeeds on the issue so raised, the judgment shall be that he be discharged from the premises set forth in the count of the indictment to which such plea is pleaded; and he shall be discharged accordingly.