Skip to content

Commit

Permalink
Merge pull request #314 from microsoft/fix-operation-tests
Browse files Browse the repository at this point in the history
Fix operation tests
  • Loading branch information
dauinsight authored Nov 21, 2023
2 parents 023b8ca + becbdd0 commit 489a107
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
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

0 comments on commit 489a107

Please sign in to comment.