When the jail of any county is destroyed by fire or other accident, any judicial officer of such county may cause all prisoners then confined therein to be brought before him. Upon the production of the process under which any prisoner was confined, such judicial officer shall order his commitment to the jail of any adjacent county. The sheriff or other officer of the county deputized for that purpose shall obey the order; and the sheriff or keeper of the common jail of such adjacent county shall receive such prisoners consistent with those provisions of N.C. Gen. Stat. § 162-38 (1835, c. 2, s. 1; R.C., c. 87, s. 2; Code, s. 3457; Rev., s. 1351; C.S., s. 1355; 1973, c. 57, s. 3; c. 822, s. 3; 1983, c. 670, s. 18.)