compiler.py 708 B

123456789101112131415161718
  1. from sqlserver_ado.compiler import * # noqa
  2. # Replace the whole SQLUpdateCompiler with another implementation.
  3. class SQLUpdateCompiler(compiler.SQLUpdateCompiler, SQLCompiler):
  4. def execute_sql(self, result_type):
  5. # Use a straight pymssql cursor to avoid throwing query counts off.
  6. # (Check Django's update_only_fields tests if you change this.)
  7. cursor = self.connection.connection.cursor()
  8. try:
  9. cursor.execute('SET NOCOUNT OFF')
  10. result = super(SQLUpdateCompiler, self).execute_sql(result_type)
  11. cursor.execute('SET NOCOUNT ON')
  12. return result
  13. finally:
  14. cursor.close()