refactor update/insert query to support additional features

  - added logic to handle corner cases regarding autoIncrement values
  - added support for OUTPUT variables (mssql)
  - added support for identity wrapping (related to point 1)

This may seem rather pointless right now, but I'm trying to make the eventual mssql dialect merge easier by getting small things in the [abstract dialect, main tests, library code] in now so that you just need to review the actual dialect when put up for PR.
afaict this was only needed for mssql and it did not break anything. Are you proposing a test that isn't already here? I'd gladly add the test and check it if you've got it