Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
慢慢CG
TDengine
提交
438c3eaa
T
TDengine
项目概览
慢慢CG
/
TDengine
与 Fork 源项目一致
Fork自
taosdata / TDengine
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
438c3eaa
编写于
9月 20, 2019
作者:
S
slguan
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix issue #530
上级
d5097cb7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
43 deletion
+48
-43
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+1
-1
src/client/src/tscSystem.c
src/client/src/tscSystem.c
+28
-17
src/util/src/tsystem.c
src/util/src/tsystem.c
+19
-25
未找到文件。
src/client/src/tscSQLParser.c
浏览文件 @
438c3eaa
...
...
@@ -2428,7 +2428,7 @@ static int setColumnFilterInfoForTimestamp(SSqlCmd* pCmd, tVariant* pVar) {
}
tVariantDestroy
(
pVar
);
tVariantCreateB
(
pVar
,
&
time
,
0
,
TSDB_DATA_TYPE_BIGINT
);
tVariantCreateB
(
pVar
,
(
char
*
)
&
time
,
0
,
TSDB_DATA_TYPE_BIGINT
);
return
TSDB_CODE_SUCCESS
;
}
...
...
src/client/src/tscSystem.c
浏览文件 @
438c3eaa
...
...
@@ -210,22 +210,25 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
if
(
cfg_locale
&&
cfg_charset
&&
cfg_locale
->
cfgStatus
<=
TSDB_CFG_CSTATUS_OPTION
)
{
char
sep
=
'.'
;
char
oldLocale
[
64
]
=
{
0
};
strncpy
(
oldLocale
,
tsLocale
,
sizeof
(
oldLocale
)
/
sizeof
(
oldLocale
[
0
]));
if
(
strlen
(
tsLocale
)
==
0
)
{
// locale does not set yet
char
*
defaultLocale
=
setlocale
(
LC_CTYPE
,
""
);
strcpy
(
tsLocale
,
defaultLocale
);
}
// set the user specified locale
char
*
locale
=
setlocale
(
LC_CTYPE
,
pStr
);
if
(
locale
!=
NULL
)
{
tscPrint
(
"locale set, prev locale:%s, new locale:%s"
,
old
Locale
,
locale
);
tscPrint
(
"locale set, prev locale:%s, new locale:%s"
,
ts
Locale
,
locale
);
cfg_locale
->
cfgStatus
=
TSDB_CFG_CSTATUS_OPTION
;
}
else
{
/* set the user-specified localed failed, use default LC_CTYPE as
* current locale */
locale
=
setlocale
(
LC_CTYPE
,
oldLocale
);
tscPrint
(
"failed to set locale:%s, restore locale:%s"
,
pStr
,
oldLocale
);
/* set the user-specified localed failed, use default LC_CTYPE as current locale */
locale
=
setlocale
(
LC_CTYPE
,
tsLocale
);
tscPrint
(
"failed to set locale:%s, current locale:%s"
,
pStr
,
tsLocale
);
}
strncpy
(
tsLocale
,
locale
,
sizeof
(
tsLocale
)
/
sizeof
(
tsLocale
[
0
]
));
strncpy
(
tsLocale
,
locale
,
tListLen
(
tsLocale
));
char
*
charset
=
strrchr
(
tsLocale
,
sep
);
if
(
charset
!=
NULL
)
{
...
...
@@ -234,15 +237,21 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
charset
=
taosCharsetReplace
(
charset
);
if
(
taosValidateEncodec
(
charset
))
{
tscPrint
(
"charset changed from %s to %s"
,
tsCharset
,
charset
);
if
(
strlen
(
tsCharset
)
==
0
)
{
tscPrint
(
"charset set:%s"
,
charset
);
}
else
{
tscPrint
(
"charset changed from %s to %s"
,
tsCharset
,
charset
);
}
strncpy
(
tsCharset
,
charset
,
tListLen
(
tsCharset
));
cfg_charset
->
cfgStatus
=
TSDB_CFG_CSTATUS_OPTION
;
;
}
else
{
tscPrint
(
"charset:%s is not valid in locale, charset remains:%s"
,
charset
,
tsCharset
);
}
free
(
charset
);
}
else
{
}
else
{
// it may be windows system
tscPrint
(
"charset remains:%s"
,
tsCharset
);
}
}
else
{
...
...
@@ -256,22 +265,24 @@ int taos_options(TSDB_OPTION option, const void *arg, ...) {
/* set charset will override the value of charset, assigned during system locale changed */
pStr
=
(
char
*
)
arg
;
char
oldCharset
[
64
]
=
{
0
};
strncpy
(
oldCharset
,
tsCharset
,
tListLen
(
oldCharset
));
size_t
len
=
strlen
(
pStr
);
if
(
len
==
0
||
len
>
TSDB_LOCALE_LEN
)
{
tscPrint
(
"
Invalid charset:%s, failed to set charset, current charset:%s"
,
pStr
,
oldCharset
);
tscPrint
(
"
failed to set charset:%s"
,
pStr
);
return
-
1
;
}
if
(
cfg_charset
&&
cfg_charset
->
cfgStatus
<=
TSDB_CFG_CSTATUS_OPTION
)
{
if
(
taosValidateEncodec
(
pStr
))
{
tscPrint
(
"charset changed from %s to %s"
,
tsCharset
,
pStr
);
if
(
strlen
(
tsCharset
)
==
0
)
{
tscPrint
(
"charset is set:%s"
,
pStr
);
}
else
{
tscPrint
(
"charset changed from %s to %s"
,
tsCharset
,
pStr
);
}
strncpy
(
tsCharset
,
pStr
,
tListLen
(
tsCharset
));
cfg_charset
->
cfgStatus
=
TSDB_CFG_CSTATUS_OPTION
;
}
else
{
tscPrint
(
"charset:%s
is not valid, charset remains:%s"
,
pStr
,
tsCharset
);
tscPrint
(
"charset:%s
not valid"
,
pStr
);
}
}
else
{
tscWarn
(
"config option:%s, input value:%s, is configured by %s, use %s"
,
cfg_charset
->
option
,
pStr
,
...
...
src/util/src/tsystem.c
浏览文件 @
438c3eaa
...
...
@@ -229,30 +229,24 @@ char *taosCharsetReplace(char *charsetstr) {
return
strdup
(
charsetstr
);
}
/*
* POSIX format locale string:
* (Language Strings)_(Country/Region Strings).(code_page)
*
* example: en_US.UTF-8, zh_CN.GB18030, zh_CN.UTF-8,
*
* if user does not specify the locale in taos.cfg the program use default LC_CTYPE as system locale.
*
* In case of some CentOS systems, their default locale is "en_US.utf8", which is not valid code_page
* for libiconv that is employed to convert string in this system. This program will automatically use
* UTF-8 instead as the charset.
*
* In case of windows client, the locale string is not valid POSIX format, user needs to set the
* correct code_page for libiconv. Usually, the code_page of windows system with simple chinese is
* CP936, CP437 for English charset.
*
*/
void
taosGetSystemLocale
()
{
// get and set default locale
/*
* POSIX format locale string:
* (Language Strings)_(Country/Region Strings).(code_page)
*
* example: en_US.UTF-8, zh_CN.GB18030, zh_CN.UTF-8,
*
* if user does not specify the locale in taos.cfg
* the program use default LC_CTYPE as system locale.
*
* In case of some CentOS systems, their default locale is "en_US.utf8", which
* is not
* valid code_page for libiconv that is employed to convert string in this
* system.
* User needs to specify the locale explicitly
* in config file in the correct format: en_US.UTF-8
*
* In case of windows client, the locale string is not legal POSIX format,
* user needs to
* set the correct code_page for libiconv. Usually, the code_page of windows
* system
* with simple chinese is CP936, CP437 for English locale.
*
*/
char
sep
=
'.'
;
char
*
locale
=
NULL
;
...
...
@@ -262,7 +256,7 @@ void taosGetSystemLocale() { // get and set default locale
if
(
locale
==
NULL
)
{
pError
(
"can't get locale from system"
);
}
else
{
strncpy
(
tsLocale
,
locale
,
sizeof
(
tsLocale
)
/
sizeof
(
tsLocale
[
0
]
));
strncpy
(
tsLocale
,
locale
,
tListLen
(
tsLocale
));
pPrint
(
"locale not configured, set to system default:%s"
,
tsLocale
);
}
}
...
...
@@ -275,7 +269,7 @@ void taosGetSystemLocale() { // get and set default locale
str
++
;
char
*
revisedCharset
=
taosCharsetReplace
(
str
);
strncpy
(
tsCharset
,
revisedCharset
,
sizeof
(
tsCharset
)
/
sizeof
(
tsCharset
[
0
]
));
strncpy
(
tsCharset
,
revisedCharset
,
tListLen
(
tsCharset
));
free
(
revisedCharset
);
pPrint
(
"charset not configured, set to system default:%s"
,
tsCharset
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录