denisenkom/pytds — pull request #41 by VFLashM (2014-12-12 17:26:45+00:00)
Title: Full support of output param types

Summary:
Now `output` wrapper properly handles `param_type` argument. It can be either sql declaration string or python type.

Overview of changes:
1. Extracted `BasePrimiaryType` - types with fixed size and no type arguments
2. Extracted `BaseTypeN` - nullable types
3. Introduced `BaseType.from_declaration` - class method which parses declaration and creates an instance
4. Added `_TdsSocket.type_by_declaration` - function which parses declaration and returns type instance
5. Extracted `_TdsSession._autodetect_column_type` out of `_TdsSession.make_param`, now it also accepts value type and can use it to detect type when value is None
6. Added small test (it doesn't test all types/cases, just some of them)

WARNING! Important and questionable changes:
1. I changed precision of autodetected datetime2 and datetimeoffset. It used to be 6, but according to sql documentation, default value is 7. Not sure if it's a good idea, but now it matches how type without type argument is parsed.
2. It seems to me that `Variant.write` is not fully implemented, I added `raise NotImplementedError` at the end
3. I swapped order of `output` arguments, now `value` is the first one which makes more sense to my taste
4. Due to `BasePrimitiveType` extraction, some datetime types are now multiple inherited =(