BTW. The PRAGMA's are already expanded to include journal_mode besides foreign_keys.
Hmm... on FPC3.2.2 the Param for journal_mode didn't take, and it choked if i fired of an Connection.ExecSQL as the first statement after successful connection.
But i'll take your word for it.
recursive_triggers definitely cannot be fired per Connection.ExecSQL (at least in FPC3.2.2)
But i agree: any modification should be done carefully.
I was just coming from the angle, that any PRAGMA's could be set as Params that way, irrespective of any (pending) transactions, and it did work with my modification of your hack