diff --git a/mssql/base.py b/mssql/base.py index cf11c506..f0be8474 100644 --- a/mssql/base.py +++ b/mssql/base.py @@ -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 diff --git a/mssql/features.py b/mssql/features.py index c1e90849..bb233395 100644 --- a/mssql/features.py +++ b/mssql/features.py @@ -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 diff --git a/mssql/introspection.py b/mssql/introspection.py index b8280557..ad5aef37 100644 --- a/mssql/introspection.py +++ b/mssql/introspection.py @@ -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 diff --git a/testapp/settings.py b/testapp/settings.py index ecd360c0..f6a19593 100644 --- a/testapp/settings.py +++ b/testapp/settings.py @@ -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',