Patch 2

Add Ivan's patch - universal solution of type conversion for all types of databases