If any informer or complainant under a penal statute of this state, to whom the penalty or any part thereof, if recovered, is given, dismisses his suit or prosecution, or fails in the same, or willfully absents himself from trial or examination, he shall be adjudged to pay all costs accruing on such suit or prosecution, unless he is an officer whose duty it is to make and file the information or complaint; but in all cases of examination into any criminal charge before a county judge, where the party accused is discharged, and it appears to the judge before whom such examination was made that there was no reasonable ground for the complaint, or that it was maliciously entered, and in all cases where the complaining witness willfully absents himself from or fails to appear at such examination or trial, the county judge shall give judgment against the complainant for all costs of the examination or trial and shall issue execution thereon. Appeal may be had in all such cases, as provided by law for the taking of appeals from judgments rendered in county courts.