feat: add SQL Server database support#1174
Open
H0nGzA1 wants to merge 13 commits into
Open
Conversation
added 13 commits
May 11, 2026 16:38
SQL Server treats bare 'string' literals as ASCII. Chinese characters require N'...' prefix for proper Unicode (NVARCHAR) storage. Also fixes the auto_init flow to exit when user cancels database creation.
SQL Server VARCHAR cannot store Unicode — Chinese characters get silently corrupted. Add UniversalStr type (NVARCHAR on mssql, VARCHAR elsewhere) and update UniversalText to use UnicodeText for mssql. Change all 18 model files from sa.String(N) to UniversalStr(N). Also add missing N'' prefix on multi-line content in notice init SQL.
MySQL/PostgreSQL drivers are Python packages with no system dependency, but aioodbc requires msodbcsql18 at the OS level. Use --build-arg INSTALL_MSSQL_ODBC=true to opt in when building the Docker image for SQL Server.
Member
|
Member
|
尽管此 PR 不会修改大量源代码,但仍会带来巨大维护成本,加上我们目前很少有人接触过 SQL Server,所以此 PR 理论上不会合并,感谢您的贡献 |
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
Adds full SQL Server support to the FBA project, enabling SQL Server 2022 as a database backend alongside the existing PostgreSQL, MySQL, and SQLite support.
Changes
Core Database Layer
sqlservertoDataBaseTypeenummssql+aioodbcdialectDATABASE_DRIVERandDATABASE_TRUST_SERVER_CERTIFICATEsettingsSQL Scripts (22 files)
SET IDENTITY_INSERT ON/OFF,GETDATE(),DBCC CHECKIDENT,N'...'for UnicodeCLI (
fba init)SET,DBCC,GOstatementsUnicode Support (NVARCHAR)
UniversalStrcustom type: NVARCHAR on mssql, VARCHAR elsewhereUniversalTextupdated: NVARCHAR(MAX) on mssqlsa.String(N)toUniversalStr(N)N''prefix for all Chinese/Unicode string literals in SQL scriptsDocker & Dependencies
aioodbc>=0.5.0dependencyOther
fba initnow exits when user cancels database creationTest Plan
fba inittested against remote SQL Server