Updated "disable-foreign-keys-check" to use the new TypeAdapter class

"disable-foreign-keys-check" speeds significally when inserting into inodb with foreign keys.

Also another commits are available in this PR, with some wanted functionality.