refactor(sqlserver): use bridge preview.5 Value ToSql, drop value_to_sql_param workaround#212
Merged
debba merged 2 commits intoMay 19, 2026
Conversation
…lue ToSql The bridge's impl ToSql for serde_json::Value now dispatches by variant (preview.5, fix TabularisDB#96): Null -> SQL NULL, Bool -> Bit, Number -> BigInt/Float, String -> NVarchar (inner string, no JSON quotes), Array/Object -> NVarchar JSON. - Bump mssql-tiberius-bridge to =0.1.0-preview.5 - Remove value_to_sql_param() workaround + its 6 unit tests from helpers.rs - Remove the ToSql import from helpers.rs (no longer needed there) - Simplify delete_record_composite: pk_vals.iter().map(|v| v as &dyn ToSql) - Simplify update_record_composite: once(&new_val).chain(pk_vals.iter()) No more Box<dyn ToSql + Send + Sync> intermediate collection Closes companion bridge issue: saurabh500/mssql-tiberius-bridge#95 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…isDB#145) Adds the missing TabularisDB#145 pieces alongside the SQL Server overrides: - driver_trait.rs: delete_record_composite / update_record_composite default methods that forward to legacy single-key methods when pk_cols.len() == 1. Keeps MySQL/Postgres/SQLite drivers working byte-identically. - commands.rs: extend update_record / delete_record Tauri commands with optional pk_cols / pk_vals. Routes to *_composite when present, legacy single-key path otherwise. Existing frontend callers unaffected (missing JSON keys deserialize to None). - sqlite/tests.rs: regression tests for the single-key fallback path, ensuring MySQL/Postgres/SQLite behavior is preserved. - integration_tests.rs: wire new test module. Closes TabularisDB#145 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
Author
|
@debba THis is ready for review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Upgrades
mssql-tiberius-bridgefrompreview.3topreview.5and removes thevalue_to_sql_param()workaround that was added in the issue #145 composite PK implementation.Background
The bridge's
impl ToSql for serde_json::Valuepreviously calledself.to_string()on every variant, which:Value::String("alice")was bound as"\"alice\""— matching zero DB rowsValue::Nullwas bound as"null"instead of SQL NULLA local workaround
value_to_sql_param()dispatched by variant to fix this. The fix was filed as bridge issue #95 and shipped in preview.5 (PR #96).Changes
Cargo.toml: bumpmssql-tiberius-bridge = "=0.1.0-preview.5"sqlserver/helpers.rs: removevalue_to_sql_param(), itsToSqlimport, and 6 now-redundant unit testssqlserver/mod.rs: simplify parameter binding — no moreBox<dyn ToSql + Send + Sync>intermediate vec or&**bdouble-deref:pk_vals.iter().map(|v| v as &dyn ToSql)once(&new_val).chain(pk_vals.iter()).map(|v| v as &dyn ToSql)Tests
All 112 SQL Server driver tests pass.
Closes #145