Fixed issues with Time type under Sql_variant.

Also some refactoring for binaries in the tests.
improved resolution of scripted spatial types.