MDL-43761 refactor db manager code to send arrays of SQL to the dml driver

This alone is a perf improvement because we reset only once after the DB change.
It will allow us to do some magic to fix DB table creation in MySQL later.
MDL-43761 refactor db manager code to send arrays of SQL to the dml driver

This perf improvement fixes and eliminates unnecessary DB cache resets,
it will also allow us to improve installation performance later.
MDL-43761 make mysql table creation use only one query
MDL-43761 use atomic db changes in pg

This should partially help with recovery from interrupted installs.