generate: use transaction handling to give a speed boost

Use transaction handling to speed up record creation (especially for relational db's)
Do not call userlog() methods if logging is inactive.  Reason: userlog attempts to commit transactions everytime, and will override out transaction handling.