When the accused has been brought before a magistrate for an examining trial that officer shall proceed to examine into the truth of the accusation made, allowing the accused, however, sufficient time to procure counsel. In a proper case, the magistrate may appoint counsel to represent an accused in such examining trial only, to be compensated as otherwise provided in this Code. The accused in any felony case shall have the right to an examining trial before indictment in the county having jurisdiction of the offense, whether he be in custody or on bail, at which time the magistrate at the hearing shall determine the amount or sufficiency of bail, if a bailable case. If the accused has been transferred for criminal prosecution after a hearing under Section 54.02, Family Code, the accused may be granted an examining trial at the discretion of the court.
Tex. Code Crim. Proc. § 16.01