Open kuanjuliu opened 11 years ago
I run into this one with the Status column I have in my database.
A simpler solution that trying to figure out what are keywords or column names could be to give more options for "Uppercase Keywords". The Uppercase Keywords option, like all other options, is a Boolean. With this setting we get a choice whether we want to see our Status column formatted as STATUS or status.
The Uppercase Keywords (Boolean) option should be changed to a Keyword Casing option. This would have 4 possible values: Upper, Lower, Title Case, or Unchanged. I'd be very happy if I could set this to Title Case or Unchanged to get my Status column coming out the way I want.
Last year my pull request was accepted that did some refactoring on the serialization and storage of option parameters. This enhancement request was where I was going with this. It should be possible to add a new KeywordCasing option, whilst still having a migration path to offer backward compatibility for the UppercaseKeywords option.
A column named "Name" is another one that seems to trigger this bug.
I encounter the same with "Status" and "Name" columns. "Value" is not modified.
Until this bug is fixed, one solution is to add brackets (e.g. [Name]
) around the column names.
I really like @TimothyK's proposal here: these things ARE keywords, and distinguishing between "keywords in a column name position" and "keywords elsewhere" would be (in my opinion) needlessly complex, but giving people an option like "don't uppercase keywords, don't lowercase them, just leave them alone dammit" would clearly make sense.
"Name" in particular is a bug, as identified in Pull Request #141
I've noticed that if a table has a column rather unfortunately named "Data" it will get capitalized. Obviously, that can cause havoc in the code itself, as TableName.Data is definitely not the same as TableName.DATA if you have case-sensitivity enabled, as we have.
So far I've only seen this problem with "Data", but there may be other poorly-named columns that would suffer the same fate.
BTW another very big player out there [ahem]RedGate[/ahem] also capitalized "Value" (as in TableName.Value became TableName.VALUE), along with a whole slew of system functions. So, go Tao!
(Can you tell we just converted from MySQL to SQL Server, lol?)