When a material witness for a defendant under a criminal charge is a prisoner in a state prison or in a county jail of a county other than that in which the defendant is to be tried, his deposition may be taken on behalf of the defendant in the manner provided for in the case of a witness who is sick; and the foregoing provisions of this article, so far as they are applicable, govern in the application for, and in the taking and use of such depositions, such deposition may be taken before any magistrate or notary public of the county in which the jail or prison is situated; or in case the witness is confined in a state prison, and the defendant is unable to pay for taking the deposition, before the warden or clerk of the board of control of the prison, whose duty it shall be to act without compensation. Every officer before whom testimony shall be taken by virtue hereof, shall have authority to administer, and shall administer an oath to the witness, that his testimony shall be the truth, the whole truth and nothing but the truth.
Okla. Stat. tit. 22, § 771