(a) Each district attorney shall represent the state in all criminal cases in the district courts of the attorney's district and in appeals from those cases.
(b) Unless prevented by other official duties, a district attorney shall represent the state in any criminal proceeding before an examining court in the attorney's district or before a judge on habeas corpus, if the attorney is:
(1) notified of the proceeding; and
(2) in the attorney's district at the time.