提交 51c9a6fa 编写于 作者: G Ganlin Zhao

fix(query): fix to_iso8601 function append format in "-hh:mm", "-hhmm"

"-hh", "z" when digits exceeds 10 digits
上级 a4ac8b1c
...@@ -901,12 +901,22 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam * ...@@ -901,12 +901,22 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
if (hasFraction) { if (hasFraction) {
int32_t fracLen = (int32_t)strlen(fraction) + 1; int32_t fracLen = (int32_t)strlen(fraction) + 1;
char *tzInfo = strchr(buf, '+');
if (tzInfo) { char *tzInfo;
if (buf[len - 1] == 'z' || buf[len - 1] == 'Z') {
tzInfo = &buf[len - 1];
memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo));
} else { } else {
tzInfo = strchr(buf, '-'); tzInfo = strchr(buf, '+');
memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo)); if (tzInfo) {
memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo));
} else {
//search '-' backwards
tzInfo = strrchr(buf, '-');
if (tzInfo) {
memmove(tzInfo + fracLen, tzInfo, strlen(tzInfo));
}
}
} }
char tmp[32] = {0}; char tmp[32] = {0};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册