Option to normalize casing of identifiers in the ScriptGenerator
还没有人认领这个 Issue。
评估
调研方向
首先定位 ScriptGenerator 及其当前设置,然后跟踪标识符在生成的 SQL 中是如何输出的。确认大小写是否统一应用,还是需要分别设置实例级和数据库级配置;完成标准是 PreserveOriginal 仍为默认值,并且 LowerCase 和 UpperCase 按照指定使用不变大小写。
由索引模型根据 Issue 内容生成。
描述
SQL Server compares identifiers with respect to the CI/CS, AI/AS setting of the respective database's collation. While accent sensitivity has no effect on the SQL source code, case-sensitivity may have such an effect when the goal is to produce a 'canonical' form of the source code. The locale part of the collation plays no part in this.
Hence, the settings of the ScriptGenerator should be extended with an option to normalize casing of identifiers as follows:
PreserveOriginal— outputs identifiers as-is; this shall be the default behavior corresponding to the current state (no breaking change)LowerCase— lower-case all identifiers when producing the outputUpperCase— upper-case all identifiers when producing the output
A simple ToLowerInvariant() / ToUpperInvariant() should be used.
Question is, whether the ScriptGenerator should support separate settings for instance-level (global) objects versus objects in a database. This would significantly increase the complexity. See also Database identifiers:
The collation of an identifier depends on the level at which it's defined. Identifiers of instance-level objects, such as logins and database names, are assigned the default collation of the instance. Identifiers of objects in a database, such as tables, views, and column names, are assigned the default collation of the database.
- 主要语言
- GAP
- 星标
- 277
- 派生
- 43
- 平均合并
- 6 天 17 小时
- 30 天内合并 PR
- 3
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/SqlScriptDOM 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 84/100
microsoft/SqlScriptDOM#228 ·
-
难度 2/5 1-3 小时 新手友好度 62/100
microsoft/SqlScriptDOM#183 ·
-
难度 4/5 3-5 天 新手友好度 56/100
microsoft/SqlScriptDOM#226 · 1 个 reaction ·
-
难度 4/5 3-5 天 新手友好度 48/100
microsoft/SqlScriptDOM#225 ·
-
难度 3/5 1-2 天 新手友好度 58/100
microsoft/SqlScriptDOM#224 ·
查看 microsoft/SqlScriptDOM 的全部 Issue
相似的 Issue
-
channels:add check:passed
难度 1/5 1 小时以内 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 70/100
confluentinc/dbt-confluent#160 ·
-
难度 1/5 1 小时以内 新手友好度 75/100
-
bug
难度 2/5 1-3 小时 新手友好度 88/100
AstrBotDevs/AstrBot#10205 ·
-
难度 2/5 1-3 小时 新手友好度 72/100