fix(os): update windows compile error
This commit is contained in:
parent
6e7e2b26f7
commit
61729d6805
|
@ -37,6 +37,7 @@ typedef int32_t TdUcs4;
|
|||
#define wcstombs WCSTOMBS_FUNC_TAOS_FORBID
|
||||
#define wcsncpy WCSNCPY_FUNC_TAOS_FORBID
|
||||
#define wchar_t WCHAR_T_TYPE_TAOS_FORBID
|
||||
#define strcasestr STR_CASE_STR_FORBID
|
||||
#endif
|
||||
|
||||
#ifdef WINDOWS
|
||||
|
@ -69,6 +70,8 @@ int32_t taosMbsToWchars(TdWchar *pWchars, const char *pStrs, int32_t size);
|
|||
int32_t taosWcharToMb(char *pStr, TdWchar wchar);
|
||||
int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size);
|
||||
|
||||
char *taosStrCaseStr(const char *str, const char *pattern);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -439,7 +439,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
|
|||
code = catalogGetSTableMeta(info->pCatalog, info->taos->pAppInfo->pTransporter, &ep, &pName, &pTableMeta);
|
||||
|
||||
if (code == TSDB_CODE_PAR_TABLE_NOT_EXIST || code == TSDB_CODE_MND_INVALID_STB) {
|
||||
SSchemaAction schemaAction = { .action = SCHEMA_ACTION_CREATE_STABLE, .createSTable = {0}};
|
||||
SSchemaAction schemaAction = { SCHEMA_ACTION_CREATE_STABLE, {0}};
|
||||
memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen);
|
||||
schemaAction.createSTable.tags = sTableData->tags;
|
||||
schemaAction.createSTable.fields = sTableData->cols;
|
||||
|
@ -455,7 +455,7 @@ static int32_t smlModifyDBSchemas(SSmlHandle* info) {
|
|||
taosHashPut(hashTmp, pTableMeta->schema[i].name, strlen(pTableMeta->schema[i].name), &i, SHORT_BYTES);
|
||||
}
|
||||
|
||||
SSchemaAction schemaAction = {.alterSTable = {0}};
|
||||
SSchemaAction schemaAction = { 0 };
|
||||
memcpy(schemaAction.createSTable.sTableName, superTable, superTableLen);
|
||||
code = smlProcessSchemaAction(info, pTableMeta->schema, hashTmp, sTableData->tags, &schemaAction, true);
|
||||
if (code != TSDB_CODE_SUCCESS) {
|
||||
|
|
|
@ -236,3 +236,26 @@ int32_t taosMbsToWchars(TdWchar *pWchars, const char *pStrs, int32_t size) { ret
|
|||
int32_t taosWcharToMb(char *pStr, TdWchar wchar) { return wctomb(pStr, wchar); }
|
||||
|
||||
int32_t taosWcharsToMbs(char *pStrs, TdWchar *pWchars, int32_t size) { return wcstombs(pStrs, pWchars, size); }
|
||||
|
||||
char *taosStrCaseStr(const char *str, const char *pattern) {
|
||||
#ifdef WINDOWS
|
||||
size_t i;
|
||||
|
||||
if (!*pattern)
|
||||
return (char*)str;
|
||||
|
||||
for (; *str; str++) {
|
||||
if (toupper(*str) == toupper(*pattern)) {
|
||||
for (i = 1;; i++) {
|
||||
if (!pattern[i])
|
||||
return (char*)str;
|
||||
if (toupper(str[i]) != toupper(pattern[i]))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
#else
|
||||
return strcasestr(str, pattern);
|
||||
#endif
|
||||
}
|
|
@ -509,7 +509,7 @@ void shellPrintField(const char *val, TAOS_FIELD *field, int32_t width, int32_t
|
|||
|
||||
bool shellIsLimitQuery(const char *sql) {
|
||||
//todo refactor
|
||||
if (strcasestr(sql, " limit ") != NULL) {
|
||||
if (taosStrCaseStr(sql, " limit ") != NULL) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue