Skip to content

MSSQL: preserve bound type for NULL parameter declarations - #59

Merged
lovasoa merged 12 commits into
mainfrom
fix/mssql-null-parameter-declaration
Sep 23, 2026
Merged

lovasoa merged 12 commits into
mainfrom
fix/mssql-null-parameter-declaration

Conversation

@lovasoa

@lovasoa lovasoa commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

For None::<String>, Encode<Mssql> for Option<T> reports DataType::Null for the TDS value. MssqlArguments::add now uses T::type_info() only for the sp_executesql declaration, so the parameter is declared nvarchar(max) while the TDS value retains SQL Server's NULL type.

Add a small unit test that asserts both the declaration and the encoded TDS NULLTYPE.

Fixes #58. Related SQLPage report: SQLPage #1481.

Validation

  • Focused MSSQL argument unit test passes.
  • cargo fmt --all -- --check passes.

This PR stacks on PR #60 for its Clippy checks. After #60 merges, retarget this PR to main.

@lovasoa
lovasoa force-pushed the fix/mssql-null-parameter-declaration branch from 0f8edd1 to bf00c41 Compare September 23, 2026 14:51
@lovasoa
lovasoa changed the base branch from main to ci/pin-clippy-1.98.1 September 23, 2026 15:05
@lovasoa
lovasoa force-pushed the fix/mssql-null-parameter-declaration branch from bf00c41 to ea1e299 Compare September 23, 2026 15:06
@lovasoa
lovasoa force-pushed the fix/mssql-null-parameter-declaration branch from ea1e299 to bf5737c Compare September 23, 2026 15:11
Base automatically changed from ci/pin-clippy-1.98.1 to main September 23, 2026 15:53
…58

Replace test_null_argument_uses_bound_type_for_declaration with a test
that builds SELECT ISNULL(@p1, N'hello') via QueryBuilder, referencing
#58
Replace unit test with an end-to-end test asserting
SELECT ISNULL(@p1, N'hello') with a null bind returns 'hello'.

Closes #58
@lovasoa
lovasoa merged commit e4d9613 into main Sep 23, 2026
53 of 54 checks passed
@lovasoa
lovasoa deleted the fix/mssql-null-parameter-declaration branch September 23, 2026 21:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MSSQL: NULL Option<T> parameters are declared as nvarchar(1)

1 participant