Avoid theoretical SQL injections. #3826.

This class isn't presently used in a way that the p_id is ever
provided by an untrusted user. And even if it is used in the GUI
later, the UI in front of it would probably not directly receive a
p_id to pass to it. But it doesn't hurt to be safe.
Make sure "nil" is in the behavior description. #3826.
Reset to the original importer mode after exception. #3826.