feat:[TD-32642] add timezone for connection support

This commit is contained in:
wangmm0220 2024-11-29 01:13:52 +08:00
parent 5ead3c68b1
commit 8c05378ca1
2 changed files with 11 additions and 6 deletions

View File

@ -163,20 +163,25 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) {
PARSE(&str[i], hourSize, hour); PARSE(&str[i], hourSize, hour);
i += hourSize + 1; i += hourSize + 1;
size_t minSize = strlen(&str[i]);
PARSE(&str[i], minSize, minute);
if (minute > 59 || minute < 0) {
TAOS_RETURN(TSDB_CODE_INVALID_PARA);
}
} else { } else {
size_t hourSize = strlen(&str[i]); size_t hourSize = strlen(&str[i]);
if (hourSize > 2){
hourSize = 2;
}
PARSE(&str[i], hourSize, hour) PARSE(&str[i], hourSize, hour)
i += hourSize;
} }
if (hour > 13 || hour < 0) { if (hour > 13 || hour < 0) {
TAOS_RETURN(TSDB_CODE_INVALID_PARA); TAOS_RETURN(TSDB_CODE_INVALID_PARA);
} }
size_t minSize = strlen(&str[i]);
PARSE(&str[i], minSize, minute);
if (minute > 59 || minute < 0) {
TAOS_RETURN(TSDB_CODE_INVALID_PARA);
}
if (str[0] == '+') { if (str[0] == '+') {
*tzOffset = -(hour * 3600 + minute * 60); *tzOffset = -(hour * 3600 + minute * 60);
} else { } else {

View File

@ -2259,10 +2259,10 @@ int32_t toISO8601Function(SScalarParam *pInput, int32_t inputNum, SScalarParam *
len += tzLen; len += tzLen;
} }
_end:
memmove(buf + VARSTR_HEADER_SIZE, buf, len); memmove(buf + VARSTR_HEADER_SIZE, buf, len);
varDataSetLen(buf, len); varDataSetLen(buf, len);
_end:
SCL_ERR_RET(colDataSetVal(pOutput->columnData, i, buf, false)); SCL_ERR_RET(colDataSetVal(pOutput->columnData, i, buf, false));
} }