Why is the language used when connecting to SQLServer not the default language set by SQLServer?
yixiu025 opened this issue · comments
Hi.
I am having a problem with the node-mssql library related to the library you created.
Question
I used the node-mssql
library, but I found that the default connection to SQLServer is not in the language set by SQLServer.
And I also found that when using the node-mssql
library, the default language set by SQLServer is used when the language
parameter is "" or invalid, but if the language
parameter is not specified, the connection will be in English by default
Please refer to this link.
node-mssql#1490
Hi @yixiu025,
For this case "the default language set by SQLServer is used when the language parameter is "" or invalid", tedious just pass though whatever value user set to the config.options.language to the server side, and in this case server is the one decide to use the default language set by SQLServer if the come in value is empty or invalid.
For this: " if the language parameter is not specified, the connection will be in English by default"
on tedious side,
config.options.language
will first been default to language: DEFAULT_LANGUAGE
, when config is constructed, and const DEFAULT_LANGUAGE = 'us_english'
.
Then the checking for language property is looks like this:
if (config.options.language !== undefined) {
if (typeof config.options.language !== 'string' && config.options.language !== null) {
throw new TypeError('The "config.options.language" property must be of type string or null.');
}
this.config.options.language = config.options.language;
}
`
if the property is not specified, then the default value will be used. Also, if you try a invalid value that is not a string, then you should get an error.
Hope this helps explain you question.
Hi @MichaelSun90
I got it, Thank you!