Commits

Mikhail Denisenko committed 6d0f60d Merge

merge

  • Participants
  • Parent commits 59094cf, ed7fba2

Comments (0)

Files changed (1)

File sqlserver/ado/dbapi.py

             p.Precision = digit_count + exponent
 
     elif isinstance(value, datetime.time):
+            if getattr(settings, 'USE_TZ', False) and value.tzinfo:
+                value = value.astimezone(timezone.utc)
             p.Value = datetime.datetime(1,1,1, value.hour, value.minute, value.second)
+    elif isinstance(value, datetime.datetime):
+            if getattr(settings, 'USE_TZ', False) and value.tzinfo:
+                value = value.astimezone(timezone.utc)
+            p.Value = value
     else:
         # For any other type, set the value and let pythoncom do the right thing.
         p.Value = value
             self._description_from_recordset(recordset[0])
         except Exception as e:
             _message = ""
-            if hasattr(e, 'args'): _message += str(e.args)+"\n"
-            _message += "Command:\n%s\nParameters:\n%s" %  (self.cmd.CommandText, format_parameters(self.cmd.Parameters, True))
+            if hasattr(e, 'args'): _message += str(e.args)
+            #_message += "Command:\n%s\nParameters:\n%s" %  (self.cmd.CommandText, format_parameters(self.cmd.Parameters, True))
             klass = self.connection._suggest_error_class()
             self._raiseCursorError(klass, _message)
 
         (adBoolean,): bool,
         adoLongTypes+adoRowIdTypes : long,
         adoIntegerTypes: int,
-        adoBinaryTypes: buffer, 
+        adoBinaryTypes: buffer,
     }, 
     lambda x: x)