Witnesses for the State or defendant may be required by the magistrate, upon the examination of any criminal accusation before him, to give bail for their appearance to testify before the proper court. A personal bond may be taken of a witness by the court before whom the case is pending.
Tex. Code Crim. Proc. § 17.34