Do not report ERROR when sample rate equals 100

This commit is contained in:
ZenoWang
2024-02-06 14:49:31 +00:00
committed by ob-robot
parent 1f1d5c08ae
commit c8ef409bf3
3710 changed files with 486984 additions and 3083329 deletions

View File

@ -103,6 +103,83 @@ char *parse_strndup(const char *str, size_t nbyte, void *malloc_pool)
return new_str;
}
//oracle trim space for string, issue:
char *parse_strndup_with_trim_space_for_new_line(const char *str, size_t nbyte, void *malloc_pool,
int *connection_collation, int64_t *new_len)
{
char *new_str = NULL;
if (OB_ISNULL(str) || OB_ISNULL(malloc_pool) || OB_ISNULL(connection_collation) || OB_ISNULL(new_len)) {
} else {
if (OB_LIKELY(NULL != (new_str = static_cast<char *>(parse_malloc(nbyte + 1, malloc_pool))))) {
MEMMOVE(new_str, str, nbyte);
int64_t idx = 0;
for (int64_t i = 0; i < nbyte; ++i) {
if (idx > 0 && new_str[i] == '\n') {
int64_t j = idx - 1;
bool is_found = false;
do {
is_found = false;
if (new_str[j] == ' ' || new_str[j] == '\t') {
-- j;
-- idx;
is_found = true;
} else {
switch (*connection_collation) {
case 28/*CS_TYPE_GBK_CHINESE_CI*/:
case 87/*CS_TYPE_GBK_BIN*/:
case 216/*CS_TYPE_GB18030_2022_BIN*/:
case 217/*CS_TYPE_GB18030_2022_PINYIN_CI*/:
case 218/*CS_TYPE_GB18030_2022_PINYIN_CS*/:
case 219/*CS_TYPE_GB18030_2022_RADICAL_CI*/:
case 220/*CS_TYPE_GB18030_2022_RADICAL_CS*/:
case 221/*CS_TYPE_GB18030_2022_STROKE_CI*/:
case 222/*CS_TYPE_GB18030_2022_STROKE_CS*/:
case 248/*CS_TYPE_GB18030_CHINESE_CI*/:
case 249/*CS_TYPE_GB18030_BIN*/: {
if (j - 1 >= 0) {
if (new_str[j - 1] == (char)0xa1 &&
new_str[j] == (char)0xa1) {//gbk multi byte space
j = j - 2;
idx = idx - 2;
is_found = true;
}
}
break;
}
case 45/*CS_TYPE_UTF8MB4_GENERAL_CI*/:
case 46/*CS_TYPE_UTF8MB4_BIN*/:
case 63/*CS_TYPE_BINARY*/:
case 224/*CS_TYPE_UTF8MB4_UNICODE_CI*/: {
//case 8/*CS_TYPE_LATIN1_SWEDISH_CI*/:
//case 47/*CS_TYPE_LATIN1_BIN*/:
if (j - 2 >= 0) {
if (new_str[j - 2] == (char)0xe3 &&
new_str[j - 1] == (char)0x80 &&
new_str[j] == (char)0x80) {//utf8 multi byte space
j = j - 3;
idx = idx - 3;
is_found = true;
}
}
break;
}
default:
break;
}
}
} while (j >= 0 && is_found);
new_str[idx++] = new_str[i];
} else {
new_str[idx++] = new_str[i];
}
}
*new_len -= (nbyte - idx);
new_str[*new_len] = '\0';
}
}
return new_str;
}
char *parse_strdup(const char *str, void *malloc_pool, int64_t *out_len)
{
char *out_str = NULL;