Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
d9a5b7c3
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
d9a5b7c3
编写于
10月 17, 2021
作者:
G
Ganlin Zhao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[TD-10642]<enhance>: [schemaless] add affected lines and msg buffer for receiving error message.
上级
20343c13
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
96 addition
and
67 deletion
+96
-67
src/client/inc/tscParseLine.h
src/client/inc/tscParseLine.h
+4
-4
src/client/src/TSDBJNIConnector.c
src/client/src/TSDBJNIConnector.c
+7
-2
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+18
-7
src/client/src/tscParseOpenTSDB.c
src/client/src/tscParseOpenTSDB.c
+8
-2
src/inc/taos.h
src/inc/taos.h
+2
-1
tests/examples/c/apitest.c
tests/examples/c/apitest.c
+10
-9
tests/examples/c/schemaless.c
tests/examples/c/schemaless.c
+4
-3
tests/script/api/openTSDBTest.c
tests/script/api/openTSDBTest.c
+35
-35
tests/tsim/src/simExe.c
tests/tsim/src/simExe.c
+8
-4
未找到文件。
src/client/inc/tscParseLine.h
浏览文件 @
d9a5b7c3
...
...
@@ -87,10 +87,10 @@ void destroySmlDataPoint(TAOS_SML_DATA_POINT* point);
int
taos_insert_sml_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
);
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SML
ProtocolType
protocol
,
SMLTimeStampType
tsType
);
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SML
ProtocolType
protocol
,
SMLTimeStampType
tsType
);
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SML
TimeStampType
tsType
,
int
*
affectedRows
);
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
SML
TimeStampType
tsType
,
int
*
affectedRows
);
#ifdef __cplusplus
...
...
src/client/src/TSDBJNIConnector.c
浏览文件 @
d9a5b7c3
...
...
@@ -100,6 +100,8 @@ jmethodID g_blockdataSetNumOfColsFp;
#define JNI_FETCH_END -6
#define JNI_OUT_OF_MEMORY -7
#define JNI_ERR_MSG_BUF_LEN 50
static
void
jniGetGlobalMethod
(
JNIEnv
*
env
)
{
// make sure init function executed once
switch
(
atomic_val_compare_exchange_32
(
&
__init
,
0
,
1
))
{
...
...
@@ -1054,6 +1056,9 @@ JNIEXPORT jint JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_setTableNameTagsI
JNIEXPORT
jlong
JNICALL
Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp
(
JNIEnv
*
env
,
jobject
jobj
,
jobjectArray
lines
,
jlong
conn
)
{
int
a_lines
=
0
;
char
errMsg
[
JNI_ERR_MSG_BUF_LEN
]
=
{
0
};
TAOS
*
taos
=
(
TAOS
*
)
conn
;
if
(
taos
==
NULL
)
{
jniError
(
"jobj:%p, connection already closed"
,
jobj
);
...
...
@@ -1071,7 +1076,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
c_lines
[
i
]
=
(
char
*
)(
*
env
)
->
GetStringUTFChars
(
env
,
line
,
0
);
}
int
code
=
taos_schemaless_insert
(
taos
,
c_lines
,
numLines
,
SML_LINE_PROTOCOL
,
"ms"
);
int
code
=
taos_schemaless_insert
(
taos
,
c_lines
,
numLines
,
SML_LINE_PROTOCOL
,
"ms"
,
&
a_lines
,
errMsg
,
JNI_ERR_MSG_BUF_LEN
);
for
(
int
i
=
0
;
i
<
numLines
;
++
i
)
{
jstring
line
=
(
jstring
)((
*
env
)
->
GetObjectArrayElement
(
env
,
lines
,
i
));
...
...
@@ -1080,7 +1085,7 @@ JNIEXPORT jlong JNICALL Java_com_taosdata_jdbc_TSDBJNIConnector_insertLinesImp(J
tfree
(
c_lines
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
jniError
(
"jobj:%p, conn:%p, code:%s
"
,
jobj
,
taos
,
tstrerror
(
code
)
);
jniError
(
"jobj:%p, conn:%p, code:%s
, affected lines:%d"
,
jobj
,
taos
,
errMsg
,
a_lines
);
return
JNI_TDENGINE_ERROR
;
}
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
d9a5b7c3
...
...
@@ -2238,7 +2238,7 @@ int32_t tscParseLines(char* lines[], int numLines, SArray* points, SArray* faile
return
TSDB_CODE_SUCCESS
;
}
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
)
{
int
taos_insert_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -2282,6 +2282,9 @@ int taos_insert_lines(TAOS* taos, char* lines[], int numLines, SMLProtocolType p
if
(
code
!=
0
)
{
tscError
(
"SML:0x%"
PRIx64
" taos_sml_insert error: %s"
,
info
->
id
,
tstrerror
((
code
)));
}
if
(
affectedRows
!=
NULL
)
{
*
affectedRows
=
info
->
affectedRows
;
}
cleanup:
tscDebug
(
"SML:0x%"
PRIx64
" taos_insert_lines finish inserting %d lines. code: %d"
,
info
->
id
,
numLines
,
code
);
...
...
@@ -2297,7 +2300,7 @@ cleanup:
return
code
;
}
int32_t
convertPrecisionStrType
(
char
*
precision
,
SMLTimeStampType
*
tsType
)
{
int32_t
convertPrecisionStrType
(
c
onst
c
har
*
precision
,
SMLTimeStampType
*
tsType
)
{
if
(
precision
==
NULL
)
{
*
tsType
=
SML_TIME_STAMP_NOT_CONFIGURED
;
return
TSDB_CODE_SUCCESS
;
...
...
@@ -2364,31 +2367,39 @@ int32_t convertPrecisionStrType(char* precision, SMLTimeStampType *tsType) {
*
*/
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
char
*
timePrecision
)
{
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
const
char
*
precision
,
int
*
affectedRows
,
char
*
msg
,
int
msgBufLen
)
{
int
code
;
SMLTimeStampType
tsType
;
if
(
protocol
==
SML_LINE_PROTOCOL
)
{
code
=
convertPrecisionStrType
(
timeP
recision
,
&
tsType
);
code
=
convertPrecisionStrType
(
p
recision
,
&
tsType
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
msg
!=
NULL
)
{
tstrncpy
(
msg
,
tstrerror
(
code
),
msgBufLen
);
}
return
code
;
}
}
switch
(
protocol
)
{
case
SML_LINE_PROTOCOL
:
code
=
taos_insert_lines
(
taos
,
lines
,
numLines
,
protocol
,
tsType
);
code
=
taos_insert_lines
(
taos
,
lines
,
numLines
,
protocol
,
tsType
,
affectedRows
);
break
;
case
SML_TELNET_PROTOCOL
:
code
=
taos_insert_telnet_lines
(
taos
,
lines
,
numLines
,
protocol
,
tsType
);
code
=
taos_insert_telnet_lines
(
taos
,
lines
,
numLines
,
protocol
,
tsType
,
affectedRows
);
break
;
case
SML_JSON_PROTOCOL
:
code
=
taos_insert_json_payload
(
taos
,
*
lines
,
protocol
,
tsType
);
code
=
taos_insert_json_payload
(
taos
,
*
lines
,
protocol
,
tsType
,
affectedRows
);
break
;
default:
code
=
TSDB_CODE_TSC_INVALID_PROTOCOL_TYPE
;
break
;
}
if
(
msg
!=
NULL
)
{
tstrncpy
(
msg
,
tstrerror
(
code
),
msgBufLen
);
}
return
code
;
}
src/client/src/tscParseOpenTSDB.c
浏览文件 @
d9a5b7c3
...
...
@@ -389,7 +389,7 @@ static int32_t tscParseTelnetLines(char* lines[], int numLines, SArray* points,
return
TSDB_CODE_SUCCESS
;
}
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
)
{
int
taos_insert_telnet_lines
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -433,6 +433,9 @@ int taos_insert_telnet_lines(TAOS* taos, char* lines[], int numLines, SMLProtoco
if
(
code
!=
0
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines error: %s"
,
info
->
id
,
tstrerror
((
code
)));
}
if
(
affectedRows
!=
NULL
)
{
*
affectedRows
=
info
->
affectedRows
;
}
cleanup:
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_telnet_lines finish inserting %d lines. code: %d"
,
info
->
id
,
numLines
,
code
);
...
...
@@ -1025,7 +1028,7 @@ PARSE_JSON_OVER:
return
ret
;
}
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
)
{
int
taos_insert_json_payload
(
TAOS
*
taos
,
char
*
payload
,
SMLProtocolType
protocol
,
SMLTimeStampType
tsType
,
int
*
affectedRows
)
{
int32_t
code
=
0
;
SSmlLinesInfo
*
info
=
tcalloc
(
1
,
sizeof
(
SSmlLinesInfo
));
...
...
@@ -1060,6 +1063,9 @@ int taos_insert_json_payload(TAOS* taos, char* payload, SMLProtocolType protocol
if
(
code
!=
0
)
{
tscError
(
"OTD:0x%"
PRIx64
" taos_insert_json_payload error: %s"
,
info
->
id
,
tstrerror
((
code
)));
}
if
(
affectedRows
!=
NULL
)
{
*
affectedRows
=
info
->
affectedRows
;
}
cleanup:
tscDebug
(
"OTD:0x%"
PRIx64
" taos_insert_json_payload finish inserting 1 Point. code: %d"
,
info
->
id
,
code
);
...
...
src/inc/taos.h
浏览文件 @
d9a5b7c3
...
...
@@ -188,7 +188,8 @@ DLL_EXPORT void taos_close_stream(TAOS_STREAM *tstr);
DLL_EXPORT
int
taos_load_table_info
(
TAOS
*
taos
,
const
char
*
tableNameList
);
DLL_EXPORT
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
char
*
precision
);
DLL_EXPORT
int
taos_schemaless_insert
(
TAOS
*
taos
,
char
*
lines
[],
int
numLines
,
int
protocol
,
const
char
*
precision
,
int
*
affectedRows
,
char
*
msg
,
int
msgBufLen
);
#ifdef __cplusplus
}
...
...
tests/examples/c/apitest.c
浏览文件 @
d9a5b7c3
...
...
@@ -302,7 +302,8 @@ int32_t verify_schema_less(TAOS* taos) {
taos_free_result
(
result
);
usleep
(
100000
);
int
code
=
0
;
char
msg
[
512
];
int
code
=
0
,
a_lines
=
0
;
char
*
lines
[]
=
{
"st,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
...
...
@@ -316,39 +317,39 @@ int32_t verify_schema_less(TAOS* taos) {
"stf,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933641000000"
};
code
=
taos_schemaless_insert
(
taos
,
lines
,
sizeof
(
lines
)
/
sizeof
(
char
*
),
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
lines
,
sizeof
(
lines
)
/
sizeof
(
char
*
),
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
char
*
lines2
[]
=
{
"stg,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
"stg,t1=4i64,t3=
\"
t4
\"
,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin
\"
,c2=true,c4=5f64,c5=5f64 1626006833641000000"
};
code
=
taos_schemaless_insert
(
taos
,
&
lines2
[
0
],
1
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
&
lines2
[
1
],
1
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
&
lines2
[
0
],
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
code
=
taos_schemaless_insert
(
taos
,
&
lines2
[
1
],
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
char
*
lines3
[]
=
{
"sth,t1=4i64,t2=5f64,t4=5f64,ID=childTable c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933641"
,
"sth,t1=4i64,t2=5f64,t4=5f64 c1=3i64,c3=L
\"
passitagin_stf
\"
,c2=false,c5=5f64,c6=7u64 1626006933654"
};
code
=
taos_schemaless_insert
(
taos
,
lines3
,
2
,
0
,
"ms"
);
code
=
taos_schemaless_insert
(
taos
,
lines3
,
2
,
0
,
"ms"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
char
*
lines4
[]
=
{
"st123456,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
"dgtyqodr,t2=5f64,t3=L
\"
ste
\"
c1=tRue,c2=4i64,c3=
\"
iam
\"
1626056811823316532"
};
code
=
taos_schemaless_insert
(
taos
,
lines4
,
2
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
lines4
,
2
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
char
*
lines5
[]
=
{
"zqlbgs,id=zqlbgs_39302_21680,t0=f,t1=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=
\"
binaryTagValue
\"
,t8=L
\"
ncharTagValue
\"
c0=f,c1=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=
\"
binaryColValue
\"
,c8=L
\"
ncharColValue
\"
,c9=7u64 1626006833639000000"
,
"zqlbgs,t9=f,id=zqlbgs_39302_21680,t0=f,t1=127i8,t11=127i8,t2=32767i16,t3=2147483647i32,t4=9223372036854775807i64,t5=11.12345f32,t6=22.123456789f64,t7=
\"
binaryTagValue
\"
,t8=L
\"
ncharTagValue
\"
,t10=L
\"
ncharTagValue
\"
c10=f,c0=f,c1=127i8,c12=127i8,c2=32767i16,c3=2147483647i32,c4=9223372036854775807i64,c5=11.12345f32,c6=22.123456789f64,c7=
\"
binaryColValue
\"
,c8=L
\"
ncharColValue
\"
,c9=7u64,c11=L
\"
ncharColValue
\"
1626006833639000000"
};
code
=
taos_schemaless_insert
(
taos
,
&
lines5
[
0
],
1
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
&
lines5
[
1
],
1
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
&
lines5
[
0
],
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
code
=
taos_schemaless_insert
(
taos
,
&
lines5
[
1
],
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
char
*
lines6
[]
=
{
"st123456,t1=3i64,t2=4f64,t3=
\"
t3
\"
c1=3i64,c3=L
\"
passit
\"
,c2=false,c4=4f64 1626006833639000000"
,
"dgtyqodr,t2=5f64,t3=L
\"
ste
\"
c1=tRue,c2=4i64,c3=
\"
iam
\"
1626056811823316532"
};
code
=
taos_schemaless_insert
(
taos
,
lines6
,
2
,
0
,
"ns"
);
code
=
taos_schemaless_insert
(
taos
,
lines6
,
2
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
return
(
code
);
}
...
...
tests/examples/c/schemaless.c
浏览文件 @
d9a5b7c3
...
...
@@ -37,16 +37,17 @@ typedef struct {
static
void
*
insertLines
(
void
*
args
)
{
SThreadInsertArgs
*
insertArgs
=
(
SThreadInsertArgs
*
)
args
;
char
tidBuf
[
32
]
=
{
0
};
char
tidBuf
[
32
]
=
{
0
},
errMsg
[
512
]
=
{
0
};
int
a_lines
=
0
;
printThreadId
(
pthread_self
(),
tidBuf
);
for
(
int
i
=
0
;
i
<
insertArgs
->
numBatches
;
++
i
)
{
SThreadLinesBatch
*
batch
=
insertArgs
->
batches
+
i
;
printf
(
"%s, thread: 0x%s
\n
"
,
"begin taos_insert_lines"
,
tidBuf
);
int64_t
begin
=
getTimeInUs
();
int32_t
code
=
taos_schemaless_insert
(
insertArgs
->
taos
,
batch
->
lines
,
batch
->
numLines
,
0
,
"ms"
);
int32_t
code
=
taos_schemaless_insert
(
insertArgs
->
taos
,
batch
->
lines
,
batch
->
numLines
,
0
,
"ms"
,
&
a_lines
,
errMsg
,
sizeof
(
errMsg
)
);
int64_t
end
=
getTimeInUs
();
insertArgs
->
costTime
+=
end
-
begin
;
printf
(
"code: %d, %s.
time used:%"
PRId64
", thread: 0x%s
\n
"
,
code
,
tstrerror
(
code
)
,
end
-
begin
,
tidBuf
);
printf
(
"code: %d, %s.
affected lines:%d time used:%"
PRId64
", thread: 0x%s
\n
"
,
code
,
errMsg
,
a_lines
,
end
-
begin
,
tidBuf
);
}
return
NULL
;
}
...
...
tests/script/api/openTSDBTest.c
浏览文件 @
d9a5b7c3
...
...
@@ -26,7 +26,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb0_1 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
"stb0_2 1626006833639000000ns 4i8 host=
\"
host0
\"
interface=
\"
eth0
\"
"
,
};
code
=
taos_schemaless_insert
(
taos
,
lines0
,
3
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines0
,
3
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -41,7 +41,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb1 1626006833651ms 6i8 host=
\"
host0
\"
"
,
"stb1 0 7i8 host=
\"
host0
\"
"
,
};
code
=
taos_schemaless_insert
(
taos
,
lines1
,
7
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines1
,
7
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -52,7 +52,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_0 1626006833651ms -127i8 host=
\"
host0
\"
"
,
"stb2_0 1626006833652ms 127i8 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_0
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_0
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -62,7 +62,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_1 1626006833651ms -32767i16 host=
\"
host0
\"
"
,
"stb2_1 1626006833652ms 32767i16 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_1
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_1
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -72,7 +72,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_2 1626006833651ms -2147483647i32 host=
\"
host0
\"
"
,
"stb2_2 1626006833652ms 2147483647i32 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_2
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_2
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -82,7 +82,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_3 1626006833651ms -9223372036854775807i64 host=
\"
host0
\"
"
,
"stb2_3 1626006833652ms 9223372036854775807i64 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_3
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_3
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -100,7 +100,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_4 1626006833700ms 3.4E38f32 host=
\"
host0
\"
"
,
"stb2_4 1626006833710ms -3.4E38f32 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_4
,
10
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_4
,
10
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -119,7 +119,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_5 1626006833700ms -1.7E308f64 host=
\"
host0
\"
"
,
"stb2_5 1626006833710ms 3.15 host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_5
,
11
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_5
,
11
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_5 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -137,7 +137,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_6 1626006833690ms False host=
\"
host0
\"
"
,
"stb2_6 1626006833700ms FALSE host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_6
,
10
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_6
,
10
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_6 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -148,7 +148,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_7 1626006833620ms
\"
binary_val.:;,./?|+-=
\"
host=
\"
host0
\"
"
,
"stb2_7 1626006833630ms
\"
binary_val.()[]{}<>
\"
host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_7
,
3
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_7
,
3
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_7 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -158,7 +158,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb2_8 1626006833610ms L
\"
nchar_val数值一
\"
host=
\"
host0
\"
"
,
"stb2_8 1626006833620ms L
\"
nchar_val数值二
\"
host=
\"
host0
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines2_8
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines2_8
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines2_8 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -169,7 +169,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb3_0 1626006833610ms 1 t1=127i8 t2=32767i16 t3=2147483647i32 t4=9223372036854775807i64 t5=3.4E38f32 t6=1.7E308f64 t7=true t8=
\"
binary_val_1
\"
t9=L
\"
标签值1
\"
"
,
"stb3_0 1626006833610ms 2 t1=-127i8 t2=-32767i16 t3=-2147483647i32 t4=-9223372036854775807i64 t5=-3.4E38f32 t6=-1.7E308f64 t7=false t8=
\"
binary_val_2
\"
t9=L
\"
标签值2
\"
"
};
code
=
taos_schemaless_insert
(
taos
,
lines3_0
,
2
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines3_0
,
2
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines3_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -180,7 +180,7 @@ void verify_telnet_insert(TAOS* taos) {
"stb3_1 1626006833610ms 2 host=host2 iD=child_table2"
,
"stb3_1 1626006833610ms 3 ID=child_table3 host=host3"
};
code
=
taos_schemaless_insert
(
taos
,
lines3_1
,
3
,
1
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
lines3_1
,
3
,
1
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"lines3_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -214,7 +214,7 @@ void verify_json_insert(TAOS* taos) {
} \
}"
};
code
=
taos_schemaless_insert
(
taos
,
message
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
message
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -245,7 +245,7 @@ void verify_json_insert(TAOS* taos) {
} \
]"
};
code
=
taos_schemaless_insert
(
taos
,
message1
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
message1
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -296,7 +296,7 @@ void verify_json_insert(TAOS* taos) {
} \
} \
]"
};
code
=
taos_schemaless_insert
(
taos
,
message2
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
message2
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -320,7 +320,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload0_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -341,7 +341,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload0_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -362,7 +362,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload0_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -383,7 +383,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload0_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -404,7 +404,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload0_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -433,7 +433,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload1_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -459,7 +459,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload1_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -485,7 +485,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload1_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -511,7 +511,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload1_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -543,7 +543,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -573,7 +573,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_1 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -603,7 +603,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_2 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -633,7 +633,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_3 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -663,7 +663,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_4 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -693,7 +693,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_5 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -723,7 +723,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_6 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -753,7 +753,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_7 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -783,7 +783,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload2_8 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
@@ -863,7 +863,7 @@ void verify_json_insert(TAOS* taos) {
*
payload_str
=
cJSON_Print
(
payload
);
//printf("%s\n", payload_str);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
);
code
=
taos_schemaless_insert
(
taos
,
payload_str
,
0
,
2
,
NULL
,
NULL
,
NULL
,
0
);
if
(
code
)
{
printf
(
"payload3_0 code: %d, %s.
\n
"
,
code
,
tstrerror
(
code
));
}
...
...
tests/tsim/src/simExe.c
浏览文件 @
d9a5b7c3
...
...
@@ -1075,6 +1075,8 @@ bool simExecuteSqlErrorCmd(SScript *script, char *rest) {
bool
simExecuteLineInsertCmd
(
SScript
*
script
,
char
*
rest
)
{
char
buf
[
TSDB_MAX_BINARY_LEN
];
char
msg
[
512
]
=
{
0
};
int
a_lines
=
0
;
simVisuallizeOption
(
script
,
rest
,
buf
);
rest
=
buf
;
...
...
@@ -1084,20 +1086,22 @@ bool simExecuteLineInsertCmd(SScript *script, char *rest) {
simInfo
(
"script:%s, %s"
,
script
->
fileName
,
rest
);
simLogSql
(
buf
,
true
);
char
*
lines
[]
=
{
rest
};
int32_t
ret
=
taos_schemaless_insert
(
script
->
taos
,
lines
,
1
,
0
,
"ns"
);
int32_t
ret
=
taos_schemaless_insert
(
script
->
taos
,
lines
,
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
simDebug
(
"script:%s, taos:%p, %s executed. success."
,
script
->
fileName
,
script
->
taos
,
rest
);
script
->
linePos
++
;
return
true
;
}
else
{
sprintf
(
script
->
error
,
"lineNum: %d. line: %s failed, ret:%d:%s"
,
line
->
lineNum
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
)
);
ret
&
0XFFFF
,
msg
);
return
false
;
}
}
bool
simExecuteLineInsertErrorCmd
(
SScript
*
script
,
char
*
rest
)
{
char
buf
[
TSDB_MAX_BINARY_LEN
];
char
msg
[
512
]
=
{
0
};
int
a_lines
=
0
;
simVisuallizeOption
(
script
,
rest
,
buf
);
rest
=
buf
;
...
...
@@ -1107,14 +1111,14 @@ bool simExecuteLineInsertErrorCmd(SScript *script, char *rest) {
simInfo
(
"script:%s, %s"
,
script
->
fileName
,
rest
);
simLogSql
(
buf
,
true
);
char
*
lines
[]
=
{
rest
};
int32_t
ret
=
taos_schemaless_insert
(
script
->
taos
,
lines
,
1
,
0
,
"ns"
);
int32_t
ret
=
taos_schemaless_insert
(
script
->
taos
,
lines
,
1
,
0
,
"ns"
,
&
a_lines
,
msg
,
sizeof
(
msg
)
);
if
(
ret
==
TSDB_CODE_SUCCESS
)
{
sprintf
(
script
->
error
,
"script:%s, taos:%p, %s executed. expect failed, but success."
,
script
->
fileName
,
script
->
taos
,
rest
);
script
->
linePos
++
;
return
false
;
}
else
{
simDebug
(
"lineNum: %d. line: %s failed, ret:%d:%s. Expect failed, so success"
,
line
->
lineNum
,
rest
,
ret
&
0XFFFF
,
tstrerror
(
ret
)
);
ret
&
0XFFFF
,
msg
);
return
true
;
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录