If, in any inquiry into an offence or a trial before a Magistrate, it appears to him at any stage of the proceedings before signing the judgment that the case is one which ought to be tried by the Court of Session, he shall commit it to that Court under the provisions hereinbefore contained and thereupon the provisions of Chapter XIX shall apply to the commitment so made.