Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mssql/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def format_sql(self, sql, params):
sql = smart_str(sql, self.driver_charset)

# pyodbc uses '?' instead of '%s' as parameter placeholder.
if params is not None:
if params is not None and params != []:
sql = sql % tuple('?' * len(params))

return sql
Expand Down
2 changes: 1 addition & 1 deletion mssql/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DatabaseFeatures(BaseDatabaseFeatures):
can_introspect_small_integer_field = True
can_return_columns_from_insert = True
can_return_id_from_insert = True
can_return_rows_from_bulk_insert = False
can_return_rows_from_bulk_insert = True
can_rollback_ddl = True
can_use_chunked_reads = False
for_update_after_from = True
Expand Down
11 changes: 11 additions & 0 deletions mssql/introspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ def get_table_description(self, cursor, table_name, identity_check=True):
column[1] = SQL_AUTOFIELD
if column[1] == Database.SQL_WVARCHAR and column[3] < 4000:
column[1] = Database.SQL_WCHAR
# Remove surrounding parentheses for default values
if column[7]:
default_value = column[7]
start = 0
end = -1
for _ in range(2):
if default_value[start] == '(' and default_value[end] == ')':
start += 1
end -= 1
column[7] = default_value[start:end + 1]

items.append(FieldInfo(*column))
return items

Expand Down
3 changes: 2 additions & 1 deletion testapp/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,9 @@
'queries.test_qs_combinators.QuerySetSetOperationTests.test_union_with_select_related_and_order',
'expressions_window.tests.WindowFunctionTests.test_limited_filter',
'schema.tests.SchemaTests.test_remove_ignored_unique_constraint_not_create_fk_index',
'constraints.tests.UniqueConstraintTests.test_validate_nullable_textfield_with_isnull_true',

#Django 5.0
# Django 5.0
'constraints.tests.CheckConstraintTests.test_validate_custom_error',
'constraints.tests.CheckConstraintTests.test_validate_nullable_jsonfield',
'constraints.tests.CheckConstraintTests.test_validate_pk_field',
Expand Down