提交 6ad5d7c0 编写于 作者: wmmhello's avatar wmmhello

fix:add new interface for schemaless to support '\0' in line value

上级 ca25392d
...@@ -577,7 +577,9 @@ static int32_t getSuperTableMetaFromLocalCache(TAOS* taos, char* tableName, STab ...@@ -577,7 +577,9 @@ static int32_t getSuperTableMetaFromLocalCache(TAOS* taos, char* tableName, STab
// Check if the table name available or not // Check if the table name available or not
if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) { if (tscValidateName(&tableToken, true, &dbIncluded) != TSDB_CODE_SUCCESS) {
code = TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH; code = TSDB_CODE_TSC_INVALID_TABLE_ID_LENGTH;
sprintf(pSql->cmd.payload, "table name is invalid"); if(pSql->cmd.payload){
sprintf(pSql->cmd.payload, "table name is invalid");
}
taosReleaseRef(tscObjRef, pSql->self); taosReleaseRef(tscObjRef, pSql->self);
return code; return code;
} }
...@@ -2674,7 +2676,10 @@ int32_t tscParseLines(char* data, int32_t len, char* lines[], int numLines, SArr ...@@ -2674,7 +2676,10 @@ int32_t tscParseLines(char* data, int32_t len, char* lines[], int numLines, SArr
char* tmp = data; char* tmp = data;
int32_t lenTmp = 0; int32_t lenTmp = 0;
for(int i = 0; i < len; i++){ for(int i = 0; i < len; i++){
if(data[i] == '\n'){ if(data[i] == '\n' || i == len - 1){
if(data[i] != '\n' || i == len - 1){
lenTmp ++;
}
if(lenTmp > 0) { if(lenTmp > 0) {
code = tscParseLinesInner(tmp, lenTmp, points, info); code = tscParseLinesInner(tmp, lenTmp, points, info);
if(code != TSDB_CODE_SUCCESS){ if(code != TSDB_CODE_SUCCESS){
...@@ -2705,6 +2710,9 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin ...@@ -2705,6 +2710,9 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin
if (data){ if (data){
numLines = 0; numLines = 0;
for(int i = 0; i < len; i++){ for(int i = 0; i < len; i++){
if(data[i] == '\0'){
data[i] = '0';
}
if(data[i] == '\n' || i == len - 1){ if(data[i] == '\n' || i == len - 1){
numLines++; numLines++;
} }
...@@ -2736,7 +2744,7 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin ...@@ -2736,7 +2744,7 @@ int taos_insert_lines(TAOS* taos, char* data, int len, char* lines[], int numLin
return TSDB_CODE_TSC_OUT_OF_MEMORY; return TSDB_CODE_TSC_OUT_OF_MEMORY;
} }
tscDebug("SML:0x%"PRIx64" taos_insert_lines begin inserting %d lines, first line: %s", info->id, numLines, lines[0]); tscDebug("SML:0x%"PRIx64" taos_insert_lines begin inserting %d lines", info->id, numLines);
code = tscParseLines(data, len, lines, numLines, lpPoints, NULL, info); code = tscParseLines(data, len, lines, numLines, lpPoints, NULL, info);
size_t numPoints = taosArrayGetSize(lpPoints); size_t numPoints = taosArrayGetSize(lpPoints);
......
...@@ -231,7 +231,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, int32_t sql ...@@ -231,7 +231,7 @@ static int32_t parseTelnetTagKey(TAOS_SML_KV *pKV, const char **idx, int32_t sql
cur++; cur++;
len++; len++;
} }
if (len == 0 || cur - *idx < sqlLen) { if (len == 0 || cur - *idx == sqlLen) {
return TSDB_CODE_TSC_LINE_SYNTAX_ERROR; return TSDB_CODE_TSC_LINE_SYNTAX_ERROR;
} }
key[len] = '\0'; key[len] = '\0';
...@@ -427,7 +427,10 @@ static int32_t tscParseTelnetLines(char* data, int32_t len, char* lines[], int n ...@@ -427,7 +427,10 @@ static int32_t tscParseTelnetLines(char* data, int32_t len, char* lines[], int n
char* tmp = data; char* tmp = data;
int32_t lenTmp = 0; int32_t lenTmp = 0;
for(int i = 0; i < len; i++){ for(int i = 0; i < len; i++){
if(data[i] == '\n'){ if(data[i] == '\n' || i == len - 1){
if(data[i] != '\n' || i == len - 1){
lenTmp++;
}
if(lenTmp > 0) { if(lenTmp > 0) {
code = tscParseTelnetLinesInner(tmp, lenTmp, points, info); code = tscParseTelnetLinesInner(tmp, lenTmp, points, info);
if(code != TSDB_CODE_SUCCESS){ if(code != TSDB_CODE_SUCCESS){
...@@ -458,6 +461,9 @@ int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[], ...@@ -458,6 +461,9 @@ int taos_insert_telnet_lines(TAOS* taos, char* data, int32_t len, char* lines[],
if (data && !lines){ if (data && !lines){
numLines = 0; numLines = 0;
for(int i = 0; i < len; i++){ for(int i = 0; i < len; i++){
if(data[i] == '\0'){
data[i] = '0';
}
if(data[i] == '\n' || i == len - 1){ if(data[i] == '\n' || i == len - 1){
numLines++; numLines++;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册