Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8c34232b
TDengine
项目概览
taosdata
/
TDengine
大约 1 年 前同步成功
通知
1184
Star
22015
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8c34232b
编写于
12月 27, 2021
作者:
J
jiacy-jcy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[test/TD-10790]<test>(connector):update test.sh
上级
9b5866ee
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
47 addition
and
21 deletion
+47
-21
tests/system-test/3-connectors/c#/TDengineDriver/TDengineDriver.cs
...tem-test/3-connectors/c#/TDengineDriver/TDengineDriver.cs
+8
-2
tests/system-test/3-connectors/c#/TDengineDriver/TDengineDriver.csproj
...test/3-connectors/c#/TDengineDriver/TDengineDriver.csproj
+1
-1
tests/system-test/3-connectors/c#/TDengineDriver/TaosBind.cs
tests/system-test/3-connectors/c#/TDengineDriver/TaosBind.cs
+6
-2
tests/system-test/3-connectors/c#/TDengineDriver/TaosMultiBind.cs
...stem-test/3-connectors/c#/TDengineDriver/TaosMultiBind.cs
+29
-16
tests/system-test/3-connectors/c#/test.sh
tests/system-test/3-connectors/c#/test.sh
+3
-0
未找到文件。
tests/system-test/3-connectors/c#/TDengineDriver/TDengineDriver.cs
浏览文件 @
8c34232b
...
...
@@ -35,7 +35,8 @@ namespace TDengineDriver
TSDB_DATA_TYPE_UTINYINT
=
11
,
// 1 byte
TSDB_DATA_TYPE_USMALLINT
=
12
,
// 2 bytes
TSDB_DATA_TYPE_UINT
=
13
,
// 4 bytes
TSDB_DATA_TYPE_UBIGINT
=
14
// 8 bytes
TSDB_DATA_TYPE_UBIGINT
=
14
,
// 8 bytes
TSDB_DATA_TYPE_JSONTAG
=
15
//4096 bytes
}
public
enum
TDengineInitOption
...
...
@@ -46,7 +47,6 @@ namespace TDengineDriver
TDDB_OPTION_CONFIGDIR
=
3
,
TDDB_OPTION_SHELL_ACTIVITY_TIMER
=
4
}
enum
TaosField
{
STRUCT_SIZE
=
68
,
...
...
@@ -92,6 +92,8 @@ namespace TDengineDriver
return
"TIMESTAMP"
;
case
TDengineDataType
.
TSDB_DATA_TYPE_NCHAR
:
return
"NCHAR"
;
case
TDengineDataType
.
TSDB_DATA_TYPE_JSONTAG
:
return
"JSON"
;
default
:
return
"undefine"
;
}
...
...
@@ -204,6 +206,7 @@ namespace TDengineDriver
metas
.
Add
(
meta
);
}
return
metas
;
}
...
...
@@ -395,5 +398,8 @@ namespace TDengineDriver
IntPtr
stmtErrPrt
=
StmtErrPtr
(
stmt
);
return
Marshal
.
PtrToStringAnsi
(
stmtErrPrt
);
}
[
DllImport
(
"taos"
,
EntryPoint
=
"taos_fetch_lengths"
,
CallingConvention
=
CallingConvention
.
Cdecl
)]
static
extern
public
IntPtr
FetchLengths
(
IntPtr
taos
);
}
}
tests/system-test/3-connectors/c#/TDengineDriver/TDengineDriver.csproj
浏览文件 @
8c34232b
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net
5
.0</TargetFramework>
<TargetFramework>net
6
.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
...
...
tests/system-test/3-connectors/c#/TDengineDriver/TaosBind.cs
浏览文件 @
8c34232b
using
System
;
using
System.Runtime.InteropServices
;
using
System.Text
;
namespace
TDengineDriver
...
...
@@ -249,7 +250,8 @@ namespace TDengineDriver
TAOS_BIND
bind
=
new
TAOS_BIND
();
IntPtr
umanageBinary
=
Marshal
.
StringToHGlobalAnsi
(
val
);
int
leng
=
val
.
Length
;
var
strToBytes
=
System
.
Text
.
Encoding
.
Default
.
GetBytes
(
val
);
int
leng
=
strToBytes
.
Length
;
IntPtr
lenPtr
=
Marshal
.
AllocHGlobal
(
sizeof
(
ulong
));
Marshal
.
WriteInt64
(
lenPtr
,
leng
);
...
...
@@ -264,9 +266,11 @@ namespace TDengineDriver
public
static
TAOS_BIND
BindNchar
(
String
val
)
{
TAOS_BIND
bind
=
new
TAOS_BIND
();
var
strToBytes
=
System
.
Text
.
Encoding
.
Default
.
GetBytes
(
val
);
IntPtr
umanageNchar
=
(
IntPtr
)
Marshal
.
StringToHGlobalAnsi
(
val
);
int
leng
=
val
.
Length
;
int
leng
=
strToBytes
.
Length
;
IntPtr
lenPtr
=
Marshal
.
AllocHGlobal
(
sizeof
(
ulong
));
Marshal
.
WriteInt64
(
lenPtr
,
leng
);
...
...
tests/system-test/3-connectors/c#/TDengineDriver/TaosMultiBind.cs
浏览文件 @
8c34232b
...
...
@@ -449,28 +449,27 @@ namespace TDengineDriver
for
(
int
i
=
0
;
i
<
elementCount
;
i
++)
{
int
itemLength
=
0
;
byte
[]
decodeByte
=
GetStringEncodeByte
(
arr
[
i
]);
itemLength
=
decodeByte
.
Length
;
// if element if not null and element length is less then typeSize
// fill the memory with default char.Since arr element memory need align.
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
<=
arr
[
i
].
Length
)
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
==
item
Length
)
{
itemLength
=
arr
[
i
].
Length
;
arrStrBuilder
.
Append
(
arr
[
i
]);
}
else
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
>
arr
[
i
].
Length
)
else
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
>
item
Length
)
{
itemLength
=
arr
[
i
].
Length
;
arrStrBuilder
.
Append
(
arr
[
i
]);
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
-
arr
[
i
].
Length
));
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
-
item
Length
));
}
else
{
// if is null value,fill the memory with default values.
itemLength
=
0
;
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
));
}
//set TAOS_MULTI_BIND.length
Marshal
.
WriteInt32
(
lengthArr
,
intSize
*
i
,
itemLength
);
Marshal
.
WriteInt32
(
lengthArr
,
intSize
*
i
,
typeSize
);
//set TAOS_MULTI_BIND.is_null
Marshal
.
WriteByte
(
nullArr
,
byteSize
*
i
,
Convert
.
ToByte
(
String
.
IsNullOrEmpty
(
arr
[
i
])
?
1
:
0
));
}
...
...
@@ -505,28 +504,27 @@ namespace TDengineDriver
for
(
int
i
=
0
;
i
<
elementCount
;
i
++)
{
int
itemLength
=
0
;
byte
[]
decodeByte
=
GetStringEncodeByte
(
arr
[
i
]);
itemLength
=
decodeByte
.
Length
;
// if element if not null and element length is less then typeSize
// fill the memory with default char.Since arr element memory need align.
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
<=
arr
[
i
].
Length
)
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
==
item
Length
)
{
itemLength
=
arr
[
i
].
Length
;
arrStrBuilder
.
Append
(
arr
[
i
]);
}
else
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
>
arr
[
i
].
Length
)
else
if
(!
String
.
IsNullOrEmpty
(
arr
[
i
])
&&
typeSize
>
item
Length
)
{
itemLength
=
arr
[
i
].
Length
;
arrStrBuilder
.
Append
(
arr
[
i
]);
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
-
arr
[
i
].
Length
));
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
-
item
Length
));
}
else
{
// if is null value,fill the memory with default values.
itemLength
=
0
;
arrStrBuilder
.
Append
(
AlignCharArr
(
typeSize
));
}
//set TAOS_MULTI_BIND.length
Marshal
.
WriteInt32
(
lengthArr
,
intSize
*
i
,
itemLength
);
Marshal
.
WriteInt32
(
lengthArr
,
intSize
*
i
,
typeSize
);
//set TAOS_MULTI_BIND.is_null
Marshal
.
WriteByte
(
nullArr
,
byteSize
*
i
,
Convert
.
ToByte
(
String
.
IsNullOrEmpty
(
arr
[
i
])
?
1
:
0
));
}
...
...
@@ -604,13 +602,28 @@ namespace TDengineDriver
int
max
=
0
;
for
(
int
i
=
0
;
i
<
strArr
.
Length
;
i
++)
{
if
(!
String
.
IsNullOrEmpty
(
strArr
[
i
])
&&
max
<
strArr
[
i
].
Length
)
int
tmpLength
=
GetStringEncodeByte
(
strArr
[
i
]).
Length
;
if
(!
String
.
IsNullOrEmpty
(
strArr
[
i
])
&&
max
<
tmpLength
)
{
max
=
strArr
[
i
].
Length
;
max
=
tmp
Length
;
}
}
return
max
;
}
private
static
Byte
[]
GetStringEncodeByte
(
string
str
)
{
Byte
[]
strToBytes
=
null
;
if
(
String
.
IsNullOrEmpty
(
str
))
{
strToBytes
=
System
.
Text
.
Encoding
.
Default
.
GetBytes
(
String
.
Empty
);
}
else
{
strToBytes
=
System
.
Text
.
Encoding
.
Default
.
GetBytes
(
str
);
}
return
strToBytes
;
}
}
}
\ No newline at end of file
tests/system-test/3-connectors/c#/test.sh
浏览文件 @
8c34232b
...
...
@@ -30,3 +30,6 @@ cd ${WKC}/tests/examples/C#/taosdemo
dotnet build
-c
Release
tree |
true
./bin/Release/net5.0/taosdemo
-c
/etc/taos
-y
cd
${
WKC
}
/tests/system-test/3-connectors/c#/stmtfunction
dotnet run
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录