Skip to content

Commit ea3f0a7

Browse files
authored
revert can_return_rows_from_bulk_insert to False (#336)
1 parent 6458503 commit ea3f0a7

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

mssql/features.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
1313
can_introspect_small_integer_field = True
1414
can_return_columns_from_insert = True
1515
can_return_id_from_insert = True
16-
can_return_rows_from_bulk_insert = True
16+
can_return_rows_from_bulk_insert = False
1717
can_rollback_ddl = True
1818
can_use_chunked_reads = False
1919
for_update_after_from = True

testapp/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"PASSWORD": "MyPassword42",
1616
"HOST": "localhost",
1717
"PORT": "1433",
18-
"OPTIONS": {"driver": "ODBC Driver 17 for SQL Server", },
18+
"OPTIONS": {"driver": "ODBC Driver 17 for SQL Server", "return_rows_bulk_insert": True},
1919
},
2020
'other': {
2121
"ENGINE": "mssql",
@@ -24,7 +24,7 @@
2424
"PASSWORD": "MyPassword42",
2525
"HOST": "localhost",
2626
"PORT": "1433",
27-
"OPTIONS": {"driver": "ODBC Driver 17 for SQL Server", },
27+
"OPTIONS": {"driver": "ODBC Driver 17 for SQL Server", "return_rows_bulk_insert": True},
2828
},
2929
}
3030

testapp/tests/test_queries.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
class TestTableWithTrigger(TransactionTestCase):
88
def test_insert_into_table_with_trigger(self):
99
connection = connections['default']
10-
# Change can_return_rows_from_bulk_insert to be the same as when
11-
# has_trigger = True
12-
connection.features_class.can_return_rows_from_bulk_insert = False
13-
1410
with connection.schema_editor() as cursor:
1511
cursor.execute("""
1612
CREATE TRIGGER TestTrigger
@@ -21,9 +17,14 @@ def test_insert_into_table_with_trigger(self):
2117
""")
2218

2319
try:
20+
# Change can_return_rows_from_bulk_insert to be the same as when
21+
# has_trigger = True
22+
old_return_rows_flag = connection.features_class.can_return_rows_from_bulk_insert
23+
connection.features_class.can_return_rows_from_bulk_insert = False
2424
Author.objects.create(name='Foo')
2525
except django.db.utils.ProgrammingError as e:
2626
self.fail('Check for regression of issue #130. Insert with trigger failed with exception: %s' % e)
2727
finally:
2828
with connection.schema_editor() as cursor:
2929
cursor.execute("DROP TRIGGER TestTrigger")
30+
connection.features_class.can_return_rows_from_bulk_insert = old_return_rows_flag

0 commit comments

Comments
 (0)