fix:fix error in get db name for schemaless parameters

This commit is contained in:
wangmm0220 2022-06-02 12:55:51 +08:00
parent 10807abbc8
commit 90cdc36018
2 changed files with 9 additions and 11 deletions

View File

@ -960,10 +960,10 @@ static int32_t smlParseInfluxString(const char* sql, SSmlLineInfo *elements, SSm
return TSDB_CODE_SML_INVALID_DATA; return TSDB_CODE_SML_INVALID_DATA;
} }
elements->colsLen = sql - elements->cols; elements->colsLen = sql - elements->cols;
if(elements->colsLen == 0) { // if(elements->colsLen == 0) {
smlBuildInvalidDataMsg(msg, "cols is empty", NULL); // smlBuildInvalidDataMsg(msg, "cols is empty", NULL);
return TSDB_CODE_SML_INVALID_DATA; // return TSDB_CODE_SML_INVALID_DATA;
} // }
// parse timestamp // parse timestamp
JUMP_SPACE(sql) JUMP_SPACE(sql)
@ -1124,7 +1124,7 @@ static int32_t smlParseTelnetString(SSmlHandle *info, const char* sql, SSmlTable
} }
static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *childTableName, bool isTag, SHashObj *dumplicateKey, SSmlMsgBuf *msg){ static int32_t smlParseCols(const char* data, int32_t len, SArray *cols, char *childTableName, bool isTag, SHashObj *dumplicateKey, SSmlMsgBuf *msg){
if(isTag && len == 0){ if(len == 0){
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;
} }
@ -2407,6 +2407,7 @@ TAOS_RES* taos_schemaless_insert(TAOS* taos, char* lines[], int numLines, int pr
info->pRequest->code = smlProcess(info, lines, numLines); info->pRequest->code = smlProcess(info, lines, numLines);
end: end:
uDebug("result:%s", info->msgBuf.buf);
smlDestroyInfo(info); smlDestroyInfo(info);
return (TAOS_RES*)request; return (TAOS_RES*)request;
} }

View File

@ -1329,6 +1329,8 @@ static int32_t parseInsertBody(SInsertParseContext* pCxt) {
SName name; SName name;
CHECK_CODE(createSName(&name, &tbnameToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg)); CHECK_CODE(createSName(&name, &tbnameToken, pCxt->pComCxt->acctId, pCxt->pComCxt->db, &pCxt->msg));
CHECK_CODE(isNotSchemalessDb(pCxt->pComCxt, name.dbname));
tNameExtractFullName(&name, tbFName); tNameExtractFullName(&name, tbFName);
CHECK_CODE(taosHashPut(pCxt->pTableNameHashObj, tbFName, strlen(tbFName), &name, sizeof(SName))); CHECK_CODE(taosHashPut(pCxt->pTableNameHashObj, tbFName, strlen(tbFName), &name, sizeof(SName)));
@ -1468,11 +1470,6 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
(*pQuery)->msgType = TDMT_VND_SUBMIT; (*pQuery)->msgType = TDMT_VND_SUBMIT;
(*pQuery)->pRoot = (SNode*)context.pOutput; (*pQuery)->pRoot = (SNode*)context.pOutput;
int32_t code = isNotSchemalessDb(pContext);
if(code != TSDB_CODE_SUCCESS){
return code;
}
if (NULL == (*pQuery)->pTableList) { if (NULL == (*pQuery)->pTableList) {
(*pQuery)->pTableList = taosArrayInit(taosHashGetSize(context.pTableNameHashObj), sizeof(SName)); (*pQuery)->pTableList = taosArrayInit(taosHashGetSize(context.pTableNameHashObj), sizeof(SName));
if (NULL == (*pQuery)->pTableList) { if (NULL == (*pQuery)->pTableList) {
@ -1482,7 +1479,7 @@ int32_t parseInsertSql(SParseContext* pContext, SQuery** pQuery) {
context.pOutput->payloadType = PAYLOAD_TYPE_KV; context.pOutput->payloadType = PAYLOAD_TYPE_KV;
code = skipInsertInto(&context.pSql, &context.msg); int32_t code = skipInsertInto(&context.pSql, &context.msg);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = parseInsertBody(&context); code = parseInsertBody(&context);
} }