apache / apache/shardingsphere

SqlServer uses setNString

Open
#32,314 4 comments 0 reactions 0 assignees View on GitHub
db: SQLServer status: volunteer wanted
Dominant language
Java
Stars
20.8k
Forks
6.9k
Avg merge
11h 35m
Merged PRs (30d)
326

Description

shardingsphere version : 5.3.2
SQL SERVER VERSION: 2017

Data of the NVARCHAR data type cannot be written properly when using shardingsphere

Through the code can be found in the AbstractUnsupportedOperationPreparedStatement setNString has been write die throw an exception

The question is:
1. Is there an extended way to set setNString properly
![C99F5513-2D91-4537-B905-525FE13443C5](https://github.com/user-attachments/assets/64d717fd-ca63-4323-81e3-6812bf66d955)
2. Current I have through the TypeHandler setNString method will be replaced by setString method, can write, but for business reason sendStringParametersAsUnicode = false must adjust to false, Therefore, the correct information cannot be obtained when the sql query is used, and the Chinese data is written as???? Therefore, you want to change the way to implement NVARCHAR
![222](https://github.com/user-attachments/assets/69139145-4488-43de-8b70-52a54c2ed3d6)

Want to ask whether there are other processing methods in the latest version, please prompt

Contributor guide

Open the contributing guide

Research direction

Start by inspecting AbstractUnsupportedOperationPreparedStatement#setNString and the TypeHandler setNString path described in the report, then reproduce the behavior against SQL Server 2017 with NVARCHAR data. Done means identifying a supported handling path that preserves Chinese text on writes and allows correct query results without relying on the reported setString workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, sql
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.