chore: support non sma option () if supported

This commit is contained in:
kailixu 2023-07-17 22:40:22 +08:00
parent cf39fcdd12
commit 52c56f4bd7
1 changed files with 3 additions and 2 deletions

View File

@ -624,15 +624,16 @@ void appendTableOptions(char* buf, int32_t* len, SDbCfgInfo* pDbCfg, STableCfg*
} }
} }
if (nSma < pCfg->numOfColumns && nSma > 0) { if (nSma < pCfg->numOfColumns) {
bool smaOn = false; bool smaOn = false;
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " SMA(");
for (int32_t i = 0; i < pCfg->numOfColumns; ++i) { for (int32_t i = 0; i < pCfg->numOfColumns; ++i) {
if (IS_BSMA_ON(pCfg->pSchemas + i)) { if (IS_BSMA_ON(pCfg->pSchemas + i)) {
if (smaOn) { if (smaOn) {
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ",`%s`", (pCfg->pSchemas + i)->name); *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, ",`%s`", (pCfg->pSchemas + i)->name);
} else { } else {
smaOn = true; smaOn = true;
*len += sprintf(buf + VARSTR_HEADER_SIZE + *len, " SMA(`%s`", (pCfg->pSchemas + i)->name); *len += sprintf(buf + VARSTR_HEADER_SIZE + *len, "`%s`", (pCfg->pSchemas + i)->name);
} }
} }
} }