A. When an issue of fact is joined upon an indictment or information, the defendant may have any material witness residing without the state examined in his behalf, as prescribed in this article, upon application to the court in which the action is pending, supported by an affidavit showing:
1. The nature of the offense.
2. The name of the witness.
3. That his testimony is material to the defense of the action.
4. That the witness resides without the state.
B. If the court is satisfied of the truth of the facts stated and that the examination of the witness is necessary to the attainment of justice, an order shall be made that a commission be issued to take his testimony.
C. The trial of the indictment or information may be stayed for a time reasonably sufficient for the execution and return of the commission.