Been around both of those terriers and I’ve experienced neither is good with small creatures you don’t want destroyed lol. Great mousers though!
My uncle has a Jack Russel bitch that he uses to hunt small game. His daughter got rabbits two or three years ago, and the dog won't touch those rabbits. Can't speak for cairns, but I suspect that it depends on the individual and the training that has gone into said individual.
In my personal experience, any well-trained, obedient dog will differentiate "the family's" vs "wild."