未验证 提交 4f1817d5 编写于 作者: X xiaolei li 提交者: GitHub

docs:refine C# reference without api reference (#11701)

* docs:refine C# reference without api reference

* docs:refine c# user reference with new template

* docs:fix c# doc with comment and add api reference

* docs:csharp connector reference doc fixed with comment

* docs:csharp connector reference doc fixed with comment

* docs:csharp connector reference doc fixed with comments

* docs:csharp connector reference doc fixed with comments

* docs:csharp connector reference doc fixed with comments

* docs:csharp connector reference doc fixed with comments
上级 7fd9db99
...@@ -4,79 +4,168 @@ sidebar_label: C# ...@@ -4,79 +4,168 @@ sidebar_label: C#
title: C# Connector title: C# Connector
--- ---
## 简介 ## 总体介绍
- C# 连接器支持的系统有:Linux 64/Windows x64/Windows x86 TDengine.Connector 是 TDengine 提供的 C# 本地客户端驱动连接器。该连接器通过 TDengine 客户端驱动建立本地连接,进而可以访问 TDengine 数据库。目前已支持 TDengine 的绝大部分特性。例如:同步查询、异步查询、管理连接、订阅消费,schemaless 等。
- C# 连接器支持从 [Nuget 下载引用](https://www.nuget.org/packages/TDengine.Connector/) 本文介绍如何在 Windows 或 Linux 环境中安装 TDengine.Connector,并通过 TDengine.Connector 连接 TDengine 数据库、进行数据查询、数据写入等基本操作。
- 在 Windows 系统上,C# 应用程序可以使用 TDengine 的原生 C 接口来执行所有数据库操作,后续版本将提供 ORM(Dapper)框架驱动 TDengine.Connector 目前暂未封装 RESTful 接口,用户可以参考 [RESTful APIs](https://docs.taosdata.com//reference/restful-api/) 文档自行编写
## 安装准备 ## 支持的平台
- 应用驱动安装请参考[安装连接器驱动步骤](/reference/connector/#安装客户端驱动)。 C# 连接器支持的系统有:Linux 64 / Windows x64/ Windows x86
- 接口文件 TDengineDrivercs.cs 和参考程序示例 TDengineTest.cs 均位于 Windows 客户端 install_directory/examples/C# 目录下。
- 安装 [.NET SDK](https://dotnet.microsoft.com/download)
## 示例程序 ## 版本支持
示例程序源码位于 | TDengine.Connector | TDengine 版本 | 说明 |
|--------------------|:-------------------------------------:|--------------------------------|
| 1.0.2 | v2.5.0.x,v2.4.0.x,v2.3.4+ | 支持连接管理、同步查询、错误信息等功能。 |
| 1.0.3 | v2.5.0.x,v2.4.0.x,v2.3.4+ | 新增参数绑定、schemaless, json tag 等功能。 |
| 1.0.4 | v2.5.0.x,v2.4.0.x,v2.3.4+ | 新增异步查询,订阅等功能,修复绑定参数 bug。 |
| 1.0.5 | v2.5.0.x,v2.4.0.x,v2.3.4+ | 修复 Windows 同步查询中文报错 bug。 |
| 1.0.6 | v2.5.0.x,v2.4.0.x,v2.3.4+ | 修复schemaless bug。|
- {client_install_directory}/examples/C# ## 支持的特性
- [C# example source code on GitHub](https://github.com/taosdata/TDengine/tree/develop/examples/C%23)
:::note ### 本地连接
TDengineTest.cs C# 示例源程序,包含了数据库连接参数,以及如何执行数据插入、查询等操作。 “本地连接”指连接器通过本地客户端驱动程序 taosc 直接与服务端程序 taosd 建立连接。
“本地连接”支持的特新如下:
::: 1. 连接管理
2. 同步查询
3. 异步查询
4. 参数绑定
5. 错误信息
6. 订阅功能
7. Schemaless
## 安装验证 ## 安装步骤
需要先安装 .NET SDK ### 安装前的准备
* 安装 [.NET SDK](https://dotnet.microsoft.com/download)
* 安装 [TDengine 客户端](/reference/connector/#安装客户端驱动)
* 安装 (可选) [Nuget 客户端](https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools)
### 使用 dotnet CLI 安装
使用 C# Connector 连接数据库前,需要具备以下条件:
1. Linux 或 Windows 操作系统
2. .Net 5.0 及以上运行时环境
3. TDengine-client
**注意**:使用 C# 连接器包时需要安装对应的客户端驱动。
- 在 Linux 系统中成功安装 TDengine 客户端之后,TDengine.Connector 依赖的本地客户端驱动 libtaos.so 文件会被自动拷贝至 /usr/lib/libtaos.so,该目录包含在 Linux 自动扫描路径上,无需单独指定。
- 在 Windows 系统中成功安装 TDengine 客户端之后,TDengine.Connector 依赖的本地客户端驱动 taos.dll 文件会自动拷贝到系统默认搜索路径 C:/Windows/System32 下,同样无需单独指定。
**注意**:在 Windows 环境下开发时,需要安装 TDengine 对应的 [Windows 客户端](https://www.taosdata.com/cn/all-downloads/#TDengine-Windows-Client),Linux 服务器安装完 TDengine 之后默认已安装 client,也可以单独安装 [Linux 客户端](/get-started/) 连接远程 TDengine Server。
#### 使用 dotnet CLI 获取 C# 驱动
可以在当前 .NET 项目的路径下,通过 dotnet 命令引用 Nuget 中发布的 TDengine.Connector 到当前项目。
``` bash
dotnet add package TDengine.Connector
```
#### 使用源码获取 C# 驱动
可以下载 TDengine 的源码,直接引用最新版本的 TDengine.Connector库
```bash
git clone https://github.com/taosdata/TDengine.git
cd TDengine/src/connector/C#/src/
cp -r C#/src/TDengineDriver/ myProject
cd myProject
dotnet add TDengineDriver/TDengineDriver.csproj
```
## 建立连接
### 建立本地连接
``` C#
using TDengineDriver;
namespace TDengineExample
{
internal class EstablishConnection
{
static void Main(String[] args)
{
string host = "localhost";
short port = 6030;
string username = "root";
string password = "taosdata";
string dbname = "";
var conn = TDengine.Connect(host, username, password, dbname, port);
if (conn == IntPtr.Zero)
{
Console.WriteLine("Connect to TDengine failed");
}
else
{
Console.WriteLine("Connect to TDengine success");
}
TDengine.Close(conn);
TDengine.Cleanup();
}
}
}
```cmd
cd {client_install_directory}/examples/C#/C#Checker
//运行测试
dotnet run -- -h <FQDN>. // 此步骤会先build,然后再运行。
``` ```
## C# 连接器的使用 ## 使用示例
在 Windows 系统上,C# 应用程序可以使用 TDengine 的 C# 连接器接口来执行所有数据库的操作。使用的具体步骤如下所示: |示例程序 | 示例程序描述 |
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------|
| [C#checker](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/C%23checker) | 使用 TDengine.Connector 可以通过 help 命令中提供的参数,测试C# Driver的同步写入和查询 |
| [TDengineTest](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/TDengineTest) | 使用 TDengine.Connector 实现的简单写入和查询的示例 |
| [insertCn](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/insertCn) | 使用 TDengine.Connector 实现的写入和查询中文字符的示例 |
| [jsonTag](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/jsonTag) | 使用 TDengine.Connector 实现的写入和查询 json tag 类型数据的示例 |
| [stmt](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/stmt) | 使用 TDengine.Connector 实现的参数绑定的示例 |
| [schemaless](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/schemaless) | 使用 TDengine.Connector 实现的使用 schemaless 写入的示例 |
| [benchmark](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/taosdemo) | 使用 TDengine.Connector 实现的简易 Benchmark |
| [async query](https://github.com/taosdata/TDengine/blob/develop/src/connector/C%23/examples/QueryAsyncSample.cs) | 使用 TDengine.Connector 实现的异步查询的示例 |
| [subscribe](https://github.com/taosdata/TDengine/blob/develop/src/connector/C%23/examples/SubscribeSample.cs) | 使用 TDengine.Connector 实现的订阅数据的示例 |
- 创建一个 C# project(需要 .NET SDK). ## 重要更新记录
```cmd | TDengine.Connector | 说明 |
mkdir test |--------------------|--------------------------------|
cd test | 1.0.2 | 新增连接管理、同步查询、错误信息等功能。 |
dotnet new console | 1.0.3 | 新增参数绑定、schemaless、 json tag等功能。 |
``` | 1.0.4 | 新增异步查询,订阅等功能。修复绑定参数 bug。 |
| 1.0.5 | 修复 Windows 同步查询中文报错 bug。 |
| 1.0.6 | 修复 schemaless 在 1.0.4 和 1.0.5 中失效 bug。 |
- 通过 Nuget 引用 TDengineDriver 包 ## 其他说明
```cmd ### 第三方驱动
dotnet add package TDengine.Connector
```
- 在项目中需要用到 TDengineConnector 的地方引用 TDengineDriver namespace。 Maikebing.Data.Taos 是一个 TDengine 的 ADO.NET 连接器,支持 Linux,Windows 平台。该连接器由社区贡献者`麦壳饼@@maikebing` 提供,具体请参考:
```cs * 接口下载:<https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos>
using TDengineDriver; * 用法说明:<https://www.taosdata.com/blog/2020/11/02/1901.html>
```
- 用户可以参考[TDengineTest.cs](https://github.com/taosdata/TDengine/tree/develop/examples/C%23/TDengineTest)来定义数据库连接参数,以及如何执行数据插入、查询等操作。
:::note ## 常见问题
- TDengine V2.0.3.0 之后同时支持 32 位和 64 位 Windows 系统,所以 C# 项目在生成 .exe 文件时,“解决方案”/“项目”的“平台”请选择对应的 x86 或 x64。 * "Unable to establish connection","Unable to resolve FQDN"
- 此接口目前已经在 Visual Studio 2015/2017 中验证过,其它 Visual Studio 版本尚待验证。
- 此连接器需要用到 taos.dll 文件,所以在未安装客户端时需要在执行应用程序前,拷贝 Windows{client_install_directory}/driver 目录中的 taos.dll 文件到项目最后生成 .exe 可执行文件所在的文件夹。之后运行 exe 文件,即可访问 TDengine 数据库并做插入、查询等操作。
::: 一般是因为 FQDN 配置不正确。可以参考[如何彻底搞懂 TDengine 的 FQDN](https://www.taosdata.com/blog/2021/07/29/2741.html)解决。
## 第三方驱动 * Unhandled exception. System.DllNotFoundException: Unable to load DLL 'taos' or one of its dependencies: 找不到指定的模块。
Maikebing.Data.Taos 是一个 TDengine 的 ADO.NET 提供器,支持 Linux,Windows。该开发包由热心贡献者`麦壳饼@@maikebing`提供,具体请参考: 一般是因为程序没有找到依赖的客户端驱动。解决方法为:Windows 下可以将 `C:\TDengine\driver\taos.dll` 拷贝到 `C:\Windows\System32\ ` 目录下,Linux 下建立如下软链接 `ln -s /usr/local/taos/driver/libtaos.so.x.x.x.x /usr/lib/libtaos.so` 即可。
- 接口下载:https://github.com/maikebing/Maikebing.EntityFrameworkCore.Taos ## API 参考
- 用法说明:https://www.taosdata.com/blog/2020/11/02/1901.html [API 参考](https://docs.taosdata.com/api/connector-csharp/html/860d2ac1-dd52-39c9-e460-0829c4e5a40b.htm)
...@@ -8,4 +8,5 @@ src/test/doc/ ...@@ -8,4 +8,5 @@ src/test/doc/
NugetPackTest/ NugetPackTest/
examples/bin/ examples/bin/
examples/obj/ examples/obj/
src/TDengineDriver/doc/
.vs .vs
...@@ -17,8 +17,14 @@ using System; ...@@ -17,8 +17,14 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
/// <summary>
/// TDengine C# Driver.
/// </summary>
namespace TDengineDriver namespace TDengineDriver
{ {
/// <summary>
/// The enum indicate the data types and their code that TDengine supports.
/// </summary>
public enum TDengineDataType public enum TDengineDataType
{ {
TSDB_DATA_TYPE_NULL = 0, // 1 bytes TSDB_DATA_TYPE_NULL = 0, // 1 bytes
...@@ -31,7 +37,7 @@ namespace TDengineDriver ...@@ -31,7 +37,7 @@ namespace TDengineDriver
TSDB_DATA_TYPE_DOUBLE = 7, // 8 bytes TSDB_DATA_TYPE_DOUBLE = 7, // 8 bytes
TSDB_DATA_TYPE_BINARY = 8, // string TSDB_DATA_TYPE_BINARY = 8, // string
TSDB_DATA_TYPE_TIMESTAMP = 9,// 8 bytes TSDB_DATA_TYPE_TIMESTAMP = 9,// 8 bytes
TSDB_DATA_TYPE_NCHAR = 10, // unicode string TSDB_DATA_TYPE_NCHAR = 10, // Unicode string
TSDB_DATA_TYPE_UTINYINT = 11,// 1 byte TSDB_DATA_TYPE_UTINYINT = 11,// 1 byte
TSDB_DATA_TYPE_USMALLINT = 12,// 2 bytes TSDB_DATA_TYPE_USMALLINT = 12,// 2 bytes
TSDB_DATA_TYPE_UINT = 13, // 4 bytes TSDB_DATA_TYPE_UINT = 13, // 4 bytes
...@@ -39,6 +45,10 @@ namespace TDengineDriver ...@@ -39,6 +45,10 @@ namespace TDengineDriver
TSDB_DATA_TYPE_JSONTAG = 15 //4096 bytes TSDB_DATA_TYPE_JSONTAG = 15 //4096 bytes
} }
/// <summary>
/// Options that can be set before get TDegnine connection. Can set like locale,char-set,timezone,taos.cfg Dir
/// and connection active time.
/// </summary>
public enum TDengineInitOption public enum TDengineInitOption
{ {
TSDB_OPTION_LOCALE = 0, TSDB_OPTION_LOCALE = 0,
...@@ -47,14 +57,30 @@ namespace TDengineDriver ...@@ -47,14 +57,30 @@ namespace TDengineDriver
TSDB_OPTION_CONFIGDIR = 3, TSDB_OPTION_CONFIGDIR = 3,
TSDB_OPTION_SHELL_ACTIVITY_TIMER = 4 TSDB_OPTION_SHELL_ACTIVITY_TIMER = 4
} }
/// <summary>
/// This enum is used to indicate different TDengine's different schemaless protocol.
/// </summary>
public enum TDengineSchemalessProtocol public enum TDengineSchemalessProtocol
{ {
TSDB_SML_UNKNOWN_PROTOCOL = 0, TSDB_SML_UNKNOWN_PROTOCOL = 0,
/// <summary>
/// Same as InfluxDB's line protocol.
/// </summary>
TSDB_SML_LINE_PROTOCOL = 1, TSDB_SML_LINE_PROTOCOL = 1,
/// <summary>
/// Same as OpenTSDB's telnet protocol.
/// </summary>
TSDB_SML_TELNET_PROTOCOL = 2, TSDB_SML_TELNET_PROTOCOL = 2,
/// <summary>
/// Same as OpenTSDB's json protocol,can insert json format data.
/// </summary>
TSDB_SML_JSON_PROTOCOL = 3 TSDB_SML_JSON_PROTOCOL = 3
} }
/// <summary>
/// Precision string of the timestamps in the text data while using schemaless insert.
/// </summary>
public enum TDengineSchemalessPrecision public enum TDengineSchemalessPrecision
{ {
TSDB_SML_TIMESTAMP_NOT_CONFIGURED = 0, TSDB_SML_TIMESTAMP_NOT_CONFIGURED = 0,
...@@ -71,13 +97,32 @@ namespace TDengineDriver ...@@ -71,13 +97,32 @@ namespace TDengineDriver
NAME_LENGTH = 65, NAME_LENGTH = 65,
TYPE_OFFSET = 65, TYPE_OFFSET = 65,
BYTES_OFFSET = 66, BYTES_OFFSET = 66,
} }
/// <summary>
/// TDengine's meta info.
/// </summary>
public class TDengineMeta public class TDengineMeta
{ {
/// <summary>
/// Retrieve result's column name.
/// </summary>
public string name; public string name;
/// <summary>
/// Column's length.(Unit bytes)
/// </summary>
public short size; public short size;
/// <summary>
/// Column type code from retrieved result. Correspond with <see cref="TDengineDataType"/>
/// </summary>
public byte type; public byte type;
/// <summary>
/// Get the type name from retrieved result.
/// </summary>
/// <returns></returns>
public string TypeName() public string TypeName()
{ {
switch ((TDengineDataType)type) switch ((TDengineDataType)type)
...@@ -113,122 +158,229 @@ namespace TDengineDriver ...@@ -113,122 +158,229 @@ namespace TDengineDriver
case TDengineDataType.TSDB_DATA_TYPE_JSONTAG: case TDengineDataType.TSDB_DATA_TYPE_JSONTAG:
return "JSON"; return "JSON";
default: default:
return "undefine"; return "undefined";
} }
} }
} }
/// <summary>
/// <c>TAOS_BIND</c> struct, used to hold a parameter(one value) while using "stmt insert".
/// </summary>
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)] [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
public struct TAOS_BIND public struct TAOS_BIND
{ {
// column type /// <summary>
/// Indicate the <see cref="TDengineDataType"/> of data you want to bind.
/// </summary>
public int buffer_type; public int buffer_type;
// one column value
/// <summary>
/// A reference point to the value you want to bind.
/// </summary>
public IntPtr buffer; public IntPtr buffer;
// unused
/// <summary>
/// Unused,but need to allocate space.
/// </summary>
public Int32 buffer_length; public Int32 buffer_length;
// actual value length in buffer
/// <summary>
/// Actual value length in <see cref="buffer"/>.
/// </summary>
public IntPtr length; public IntPtr length;
// indicates the column value is null or not
/// <summary>
/// A reference to an variable to indicate if the column value is null or not
/// </summary>
public IntPtr is_null; public IntPtr is_null;
// unused
/// <summary>
/// Unused,but need to allocate space.
/// </summary>
public int is_unsigned; public int is_unsigned;
// unused
/// <summary>
/// Unused,but need to allocate space.
/// </summary>
public IntPtr error; public IntPtr error;
/// <summary>
/// Unused,but need to allocate space.
/// </summary>
public Int64 u; public Int64 u;
/// <summary>
/// Unused,but need to allocate space.
/// </summary>
public uint allocated; public uint allocated;
} }
/// <summary>
/// <c>TAOS_MULTI_BIND</c>struct,used to hold a multiple values while using "stmt bind".
/// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct TAOS_MULTI_BIND public struct TAOS_MULTI_BIND
{ {
// column type /// <summary>
/// Indicate the <see cref="TDengineDataType"/> of data you want to bind.
/// </summary>
public int buffer_type; public int buffer_type;
// array, one or more lines column value /// <summary>
/// The reference point to the array which stores multiple lines column values you want to bind.
/// </summary>
public IntPtr buffer; public IntPtr buffer;
//length of element in TAOS_MULTI_BIND.buffer (for binary and nchar it is the longest element's length) /// <summary>
/// Actual value length in <see cref="buffer"/>.
/// </summary>
public ulong buffer_length; public ulong buffer_length;
//array, actual data length for each value /// <summary>
/// A reference point to the array which stores actual data length for each value.
/// </summary>
public IntPtr length; public IntPtr length;
//array, indicates each column value is null or not /// <summary>
/// A reference point to the array which stores identifies to indicate each value is null or not.
/// </summary>
public IntPtr is_null; public IntPtr is_null;
// line number, or the values number in buffer /// <summary>
/// Line number or the count of values in buffer.
/// </summary>
public int num; public int num;
} }
/// <summary> /// <summary>
/// User defined callback function for interface "QueryAsync()" /// User defined callback function for interface <c><see cref="TDengine.QueryAsync(IntPtr, string, QueryAsyncCallback, IntPtr)"/></c>,actually is a delegate in .Net.
/// ,actually is a delegate in .Net. /// This function aim to handle the <c>taoRes</c> which points to the caller method's SQL result set.
/// This function aim to handle the taoRes which points to
/// the caller method's sql resultset.
/// </summary> /// </summary>
/// <param name="param"> This parameter will sent by caller method (QueryAsync()).</param> /// <param name="param">This parameter will sent by caller method (<see cref="TDengine.QueryAsync(IntPtr, string, QueryAsyncCallback, IntPtr)"/>)</param>
/// <param name="taoRes"> This is the retrieved by caller method's sql.</param> /// <param name="taoRes">This is the retrieved by caller method's SQL.</param>
/// <param name="code"> 0 for indicate operation success and negative for operation fail.</param> /// <param name="code">0 for indicate operation success and negative for operation fail.</param>
public delegate void QueryAsyncCallback(IntPtr param, IntPtr taoRes, int code); public delegate void QueryAsyncCallback(IntPtr param, IntPtr taoRes, int code);
/// <summary> /// <summary>
/// User defined callback function for interface "FetchRowAsync()" /// User defined callback function for interface <c><see cref="TDengine.FetchRowAsync(IntPtr, FetchRowAsyncCallback, IntPtr)"/></c>,actually is a delegate in .Net.
/// ,actually is a delegate in .Net. /// This callback allow applications to get each row of the batch records by calling <c><see cref="TDengine.FetchRowAsync(IntPtr, FetchRowAsyncCallback, IntPtr)"/></c>
/// This callback allow applications to get each row of the /// forward iteration.After reading all the records in a block, the application needs to continue calling
/// batch records by calling FetchRowAsync() forward iteration. /// <c><see cref="TDengine.FetchRowAsync(IntPtr, FetchRowAsyncCallback, IntPtr)"/></c> in this callback function to obtain the next batch of records for
/// After reading all the records in a block, the application needs to continue calling /// processing until the number of records is zero.
/// FetchRowAsync() in this callback function to obtain the next batch of records for
/// processing until the number of records
/// </summary> /// </summary>
/// <param name="param">The parameter passed by <see cref="FetchRowAsync"/></param> /// <param name="param">The parameter passed by <c><see cref="TDengine.FetchRowAsync(IntPtr, FetchRowAsyncCallback, IntPtr)"/></c></param>
/// <param name="taoRes">Query status</param> /// <param name="taoRes">Query Result.</param>
/// <param name="numOfRows"> The number of rows of data obtained (not a function of /// <param name="numOfRows"> The number of rows of data obtained (not a function of
/// the entire query result set). When the number is zero (the result is returned) /// the entire query result set). When the number is zero (the result is returned)
/// or the number of records is negative (the query fails).</param> /// or the number of records is negative (the query fails).</param>
public delegate void FetchRowAsyncCallback(IntPtr param, IntPtr taoRes, int numOfRows); public delegate void FetchRowAsyncCallback(IntPtr param, IntPtr taoRes, int numOfRows);
/// <summary> /// <summary>
/// In asynchronous mode, the prototype of the callback function. /// In asynchronous subscribe mode, the prototype of the callback function.
/// </summary> /// </summary>
/// <param name="subscribe">Subscription object return by <see cref = "Subscribe"> </param> /// <param name="subscribe">Subscription object return by <c><see cref="TDengine.Subscribe(IntPtr, bool, string, string, SubscribeCallback, IntPtr, int)"/></c></param>
/// <param name="tasRes"> Query retrieve result set. (Note there may be no record in the result set.)</param> /// <param name="tasRes">Query retrieve result set. (Note there may be no record in the result set.)</param>
/// <param name="param"> Additional parameters supplied by the client when taos_subscribe is called.</param> /// <param name="param">Additional parameters supplied by the client when <c><see cref="TDengine.Subscribe(IntPtr, bool, string, string, SubscribeCallback, IntPtr, int)"/> is called.</c></param>
/// <param name="code"> Error code.</param> /// <param name="code">Error code.</param>
public delegate void SubscribeCallback(IntPtr subscribe, IntPtr tasRes, IntPtr param, int code); public delegate void SubscribeCallback(IntPtr subscribe, IntPtr tasRes, IntPtr param, int code);
/// <summary>
/// Defined this Driver's mainly APIs
/// </summary>
public class TDengine public class TDengine
{ {
/// <summary>
/// The success code return by major of this <c><see cref="TDengineDriver"/></c>'s operators.
/// </summary>
public const int TSDB_CODE_SUCCESS = 0; public const int TSDB_CODE_SUCCESS = 0;
/// <summary>
/// Initialize the running environment.
/// If the application does not actively call the API, the API will be automatically called when the application call
/// <c><see cref="Connect"/></c>, so the application generally does not need to call the API manually.
/// </summary>
[DllImport("taos", EntryPoint = "taos_init", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_init", CallingConvention = CallingConvention.Cdecl)]
static extern public void Init(); static extern public void Init();
/// <summary>
/// Clean up the running environment and call this API before the application exits.
/// </summary>
[DllImport("taos", EntryPoint = "taos_cleanup", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_cleanup", CallingConvention = CallingConvention.Cdecl)]
static extern public void Cleanup(); static extern public void Cleanup();
/// <summary>
/// Set client options, currently only time zone setting (_TSDB_OPTIONTIMEZONE)and encoding setting (_TSDB_OPTIONLOCALE) are supported.
/// The time zone and encoding default to the current operating system settings.
/// </summary>
/// <param name="option"></param>
/// <param name="value">When the return value is 0, it means success, and when it is -1, it means failure.</param>
[DllImport("taos", EntryPoint = "taos_options", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_options", CallingConvention = CallingConvention.Cdecl)]
static extern public void Options(int option, string value); static extern public void Options(int option, string value);
/// <summary>
/// Create a database connection and initialize the connection context. The parameters that need to be provided by user.
/// </summary>
/// <param name="ip"> FQDN used by TDengine to manage the master node.</param>
/// <param name="user">User name.</param>
/// <param name="password">Password</param>
/// <param name="db">Database name. If user does not provide it, it can be connected normally,
/// means user can create a new database through this connection.
/// If user provides a database name, means the user has created the database and the database is used by default</param>
/// <param name="port">Port number</param>
/// <returns>A null return value indicates a failure.
/// The application needs to save the returned parameters for subsequent API calls.
/// Note: The same process can connect to multiple taosd processes based on ip/port</returns>
[DllImport("taos", EntryPoint = "taos_connect", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_connect", CallingConvention = CallingConvention.Cdecl)]
static extern public IntPtr Connect(string ip, string user, string password, string db, short port); static extern public IntPtr Connect(string ip, string user, string password, string db, short port);
/// <summary>
/// Private function.Get the reason why the last API call failed, and the return value is a string.
/// Also see<seealso cref="Error"/>.
/// </summary>
/// <param name="res">Reference return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c></param>
/// <returns>Error reason.</returns>
[DllImport("taos", EntryPoint = "taos_errstr", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_errstr", CallingConvention = CallingConvention.Cdecl)]
static extern private IntPtr taos_errstr(IntPtr res); static extern private IntPtr taos_errstr(IntPtr res);
/// <summary>
/// Public function,calling <c><see cref="taos_errstr"/></c> inside.Get the reason why the last API call failed, and the return value is a string.
/// Also see <c><seealso cref="taos_errstr"/></c>.
/// </summary>
/// <param name="res">Reference return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>Error reason.</returns>
static public string Error(IntPtr res) static public string Error(IntPtr res)
{ {
IntPtr errPtr = taos_errstr(res); IntPtr errPtr = taos_errstr(res);
return Marshal.PtrToStringAnsi(errPtr); return Marshal.PtrToStringAnsi(errPtr);
} }
/// <summary>
/// Get the reason why the last API call failed, and the return value is the error code.
/// </summary>
/// <param name="res">Reference return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>Error code.</returns>
[DllImport("taos", EntryPoint = "taos_errno", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_errno", CallingConvention = CallingConvention.Cdecl)]
static extern public int ErrorNo(IntPtr res); static extern public int ErrorNo(IntPtr res);
/// <summary>
/// Private function.
/// This API is used to execute SQL statements, which can be DQL, DML or DDL statements.
/// </summary>
/// <param name="conn">The database connection returned by calling <c><see cref="Connect(string, string, string, string, short)"/></c>.</param>
/// <param name="byteArr">The SQL statement needed to execute.</param>
/// <returns>A reference point to the result.</returns>
[DllImport("taos", EntryPoint = "taos_query", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_query", CallingConvention = CallingConvention.Cdecl)]
// static extern public IntPtr Query(IntPtr conn, string sqlstr); // static extern public IntPtr Query(IntPtr conn, string sqlstr);
static extern private IntPtr Query(IntPtr conn, IntPtr byteArr); static extern private IntPtr Query(IntPtr conn, IntPtr byteArr);
/// <summary>
/// Public function.
/// This API is used to execute SQL statements, which can be DQL, DML or DDL statements.
/// Change the SQL command to UTF-8 to avoid error under Windows.
/// </summary>
/// <param name="conn">The database connection returned by calling <c><see cref="Connect(string, string, string, string, short)"/></c></param>
/// <param name="command">The SQL statement needed to execute.</param>
/// <returns>A reference point to the result.</returns>
static public IntPtr Query(IntPtr conn, string command) static public IntPtr Query(IntPtr conn, string command)
{ {
IntPtr res = IntPtr.Zero; IntPtr res = IntPtr.Zero;
...@@ -239,17 +391,41 @@ namespace TDengineDriver ...@@ -239,17 +391,41 @@ namespace TDengineDriver
return res; return res;
} }
/// <summary>
/// Get the number of rows affected by the executed SQL statement.
/// </summary>
/// <param name="res">Result return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>Number of row have been affected.</returns>
[DllImport("taos", EntryPoint = "taos_affected_rows", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_affected_rows", CallingConvention = CallingConvention.Cdecl)]
static extern public int AffectRows(IntPtr res); static extern public int AffectRows(IntPtr res);
/// <summary>
/// Get the number of columns in the query result set.
/// </summary>
/// <param name="res">Result return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>Number of columns in the query result set</returns>
[DllImport("taos", EntryPoint = "taos_field_count", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_field_count", CallingConvention = CallingConvention.Cdecl)]
static extern public int FieldCount(IntPtr res); static extern public int FieldCount(IntPtr res);
/// <summary>
/// Get the attributes (data type, name, number of bytes) of each column of data in the query result set,
/// which can be used in conjunction with taos_num_files to parse the data of a tuple (one row) returned
/// by <c><see cref="FetchRows(IntPtr)"/></c>.
/// </summary>
/// <param name="res">Result return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>A reference point to the attributes (data type, name, number of bytes) of each column of data in the query result set.</returns>
[DllImport("taos", EntryPoint = "taos_fetch_fields", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_fetch_fields", CallingConvention = CallingConvention.Cdecl)]
static extern private IntPtr taos_fetch_fields(IntPtr res); static extern private IntPtr taos_fetch_fields(IntPtr res);
/// <summary>
/// Get the attributes (data type, name, number of bytes) of each column of data in the query result set,
/// which can be used in conjunction with taos_num_files to parse the data of a tuple (one row) returned
/// by <c><see cref="FetchRows(IntPtr)"/></c>
/// </summary>
/// <param name="res">Result return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>A list of <see cref="TDengineMeta"/></returns>
static public List<TDengineMeta> FetchFields(IntPtr res) static public List<TDengineMeta> FetchFields(IntPtr res)
{ {
// const int fieldSize = 68;
List<TDengineMeta> metaList = new List<TDengineMeta>(); List<TDengineMeta> metaList = new List<TDengineMeta>();
if (res == IntPtr.Zero) if (res == IntPtr.Zero)
...@@ -273,21 +449,55 @@ namespace TDengineDriver ...@@ -273,21 +449,55 @@ namespace TDengineDriver
return metaList; return metaList;
} }
/// <summary>
/// Get the data in the query result set by rows.
/// </summary>
/// <param name="res">Result return by APIs like <c><see cref="Query(IntPtr, IntPtr)"/></c>.</param>
/// <returns>Reference point to the query result set.</returns>
[DllImport("taos", EntryPoint = "taos_fetch_row", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_fetch_row", CallingConvention = CallingConvention.Cdecl)]
static extern public IntPtr FetchRows(IntPtr res); static extern public IntPtr FetchRows(IntPtr res);
/// <summary>
/// Release the query result set and related resources.
/// After the query is completed, be sure to call the API to release resources,
/// otherwise it may lead to application memory leakage. However,
/// it should also be noted that after releasing resources,
/// if you call functions such as <c><see cref="Consume(IntPtr)"/></c> to obtain query results,
/// it will lead the application to Crash.
/// </summary>
/// <param name="res">Reference point to the query result set.</param>
[DllImport("taos", EntryPoint = "taos_free_result", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_free_result", CallingConvention = CallingConvention.Cdecl)]
static extern public void FreeResult(IntPtr res); static extern public void FreeResult(IntPtr res);
/// <summary>
/// Close the connection.
/// </summary>
/// <param name="taos">Pointer returned by <c><see cref="Connect(string, string, string, string, short)"/></c> function.</param>
[DllImport("taos", EntryPoint = "taos_close", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_close", CallingConvention = CallingConvention.Cdecl)]
static extern public void Close(IntPtr taos); static extern public void Close(IntPtr taos);
//get precision of restultset //get precision of restultset
/// <summary>
/// The precision of the timestamp field in the returned result set.
/// </summary>
/// <param name="taos">Pointer returned by <c><see cref="Connect(string, string, string, string, short)"/></c> function.</param>
/// <returns> 0 for milliseconds, 1 for microseconds, and 2 for nanoseconds.</returns>
[DllImport("taos", EntryPoint = "taos_result_precision", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_result_precision", CallingConvention = CallingConvention.Cdecl)]
static extern public int ResultPrecision(IntPtr taos); static extern public int ResultPrecision(IntPtr taos);
//schemaless API //schemaless API
/// <summary>
/// In addition to writing data using SQL or using the parameter binding API, writing can also be done using Schemaless,
/// which eliminates the need to create a super table/data sub-table data structure in advance and writes data directly,
/// while the TDengine system automatically creates and maintains the required table structure based on the written data
/// content.
/// </summary>
/// <param name="taos">Database connection, the database connection established by <c><see cref="Connect(string, string, string, string, short)"/></c> function.</param>
/// <param name="lines">A pattern-free text string that meets the parsing format requirements.</param>
/// <param name="numLines">The number of lines of the text data, cannot be 0.</param>
/// <param name="protocol">The protocol type <c><seealso cref="TDengineSchemalessProtocol"/></c> of the lines, used to identify the format of the text data.</param>
/// <param name="precision">Precision <c><seealso cref="TDengineSchemalessPrecision"/></c> string of the timestamps in the text data.</param>
/// <returns></returns>
[DllImport("taos", SetLastError = true, EntryPoint = "taos_schemaless_insert", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", SetLastError = true, EntryPoint = "taos_schemaless_insert", CallingConvention = CallingConvention.Cdecl)]
static extern public IntPtr SchemalessInsert(IntPtr taos, string[] lines, int numLines, int protocol, int precision); static extern public IntPtr SchemalessInsert(IntPtr taos, string[] lines, int numLines, int protocol, int precision);
...@@ -307,7 +517,6 @@ namespace TDengineDriver ...@@ -307,7 +517,6 @@ namespace TDengineDriver
/// </summary> /// </summary>
/// <param name="stmt">could be the value returned by 'StmtInit', that may be a valid object or NULL.</param> /// <param name="stmt">could be the value returned by 'StmtInit', that may be a valid object or NULL.</param>
/// <param name="sql">sql string,used to bind parameters with</param> /// <param name="sql">sql string,used to bind parameters with</param>
/// <param name="length">no used</param>
/// <returns>0 for success, non-zero for failure.</returns> /// <returns>0 for success, non-zero for failure.</returns>
[DllImport("taos", EntryPoint = "taos_stmt_prepare", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_stmt_prepare", CallingConvention = CallingConvention.Cdecl)]
static extern public int StmtPrepare(IntPtr stmt, string sql); static extern public int StmtPrepare(IntPtr stmt, string sql);
...@@ -421,13 +630,13 @@ namespace TDengineDriver ...@@ -421,13 +630,13 @@ namespace TDengineDriver
[DllImport("taos", EntryPoint = "taos_stmt_close", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_stmt_close", CallingConvention = CallingConvention.Cdecl)]
static extern public int StmtClose(IntPtr stmt); static extern public int StmtClose(IntPtr stmt);
[DllImport("taos", EntryPoint = "taos_load_table_info", CallingConvention = CallingConvention.Cdecl)]
/// <summary> /// <summary>
/// user application must call this API to load all tables meta, /// user application must call this API to load all tables meta.
/// </summary> /// </summary>
/// <param name="taos">taos connection</param> /// <param name="taos">taos connection</param>
/// <param name="tableList">tablelist</param> /// <param name="tableList">tablelist</param>
/// <returns></returns> /// <returns></returns>
[DllImport("taos", EntryPoint = "taos_load_table_info", CallingConvention = CallingConvention.Cdecl)]
static extern private int LoadTableInfoDll(IntPtr taos, string tableList); static extern private int LoadTableInfoDll(IntPtr taos, string tableList);
/// <summary> /// <summary>
...@@ -484,7 +693,7 @@ namespace TDengineDriver ...@@ -484,7 +693,7 @@ namespace TDengineDriver
/// <summary> /// <summary>
/// Get the result set of asynchronous queries in batch, /// Get the result set of asynchronous queries in batch,
/// which can only be used with QueryAsync().<c>FetchRowAsyncCallback<c> /// which can only be used with QueryAsync().<c>FetchRowAsyncCallback</c>
/// </summary> /// </summary>
/// <param name="taoRes"> The result set returned when backcall QueryAsyncCallback </param> /// <param name="taoRes"> The result set returned when backcall QueryAsyncCallback </param>
/// <param name="fq"> Callback function.<see cref="FetchRowAsyncCallback"/></param> /// <param name="fq"> Callback function.<see cref="FetchRowAsyncCallback"/></param>
...@@ -497,7 +706,7 @@ namespace TDengineDriver ...@@ -497,7 +706,7 @@ namespace TDengineDriver
/// <summary> /// <summary>
/// This function is used for start subscription service. /// This function is used for start subscription service.
/// </summary> /// </summary>
/// <param name="taos"> taos connection return by <see cref = "Connect"></param> /// <param name="taos"> taos connection return by <see cref = "Connect"></see></param>
/// <param name="restart">If the subscription is already exists, to decide whether to /// <param name="restart">If the subscription is already exists, to decide whether to
/// start over or continue with previous subscription.</param> /// start over or continue with previous subscription.</param>
/// <param name="topic"> The name of the subscription.(This is the unique identification of the subscription).</param> /// <param name="topic"> The name of the subscription.(This is the unique identification of the subscription).</param>
...@@ -514,6 +723,26 @@ namespace TDengineDriver ...@@ -514,6 +723,26 @@ namespace TDengineDriver
/// <returns>Return null for failure, return subscribe object for success.</returns> /// <returns>Return null for failure, return subscribe object for success.</returns>
[DllImport("taos", EntryPoint = "taos_subscribe", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_subscribe", CallingConvention = CallingConvention.Cdecl)]
static extern private IntPtr Subscribe(IntPtr taos, int restart, string topic, string sql, SubscribeCallback fq, IntPtr param, int interval); static extern private IntPtr Subscribe(IntPtr taos, int restart, string topic, string sql, SubscribeCallback fq, IntPtr param, int interval);
/// <summary>
/// This function is used for start subscription service.
/// </summary>
/// <param name="taos"> taos connection return by <see cref = "Connect"></see></param>
/// <param name="restart">If the subscription is already exists, to decide whether to
/// start over or continue with previous subscription.</param>
/// <param name="topic"> The name of the subscription.(This is the unique identification of the subscription).</param>
/// <param name="sql">The subscribe statement(select only).Only query original data and in positive time sequence.</param>
/// <param name="fq">The callback function <c><see cref="TDengineDriver.SubscribeCallback"/></c>when the query result is received.</param>
/// <param name="param"> Additional parameter when calling callback function. System API will pass it to
/// callback function without any operations.It is only used when calling asynchronously,
/// and this parameter should be passed to NULL when calling synchronously</param>
/// <param name="interval">Polling period in milliseconds. During asynchronous call, the callback function will be
/// called periodically according to this parameter; In order to avoid affecting system
/// performance, it is not recommended to set this parameter too small; When calling synchronously,
/// if the interval between two calls to taos_consume is less than this period, the API will block
/// until the interval exceeds this period.</param>
/// <returns>Return null for failure, return subscribe object for success.</returns>
/// <exception cref="Exception"></exception>
static public IntPtr Subscribe(IntPtr taos, bool restart, string topic, string sql, SubscribeCallback fq, IntPtr param, int interval) static public IntPtr Subscribe(IntPtr taos, bool restart, string topic, string sql, SubscribeCallback fq, IntPtr param, int interval)
{ {
if (taos == IntPtr.Zero) if (taos == IntPtr.Zero)
...@@ -536,10 +765,21 @@ namespace TDengineDriver ...@@ -536,10 +765,21 @@ namespace TDengineDriver
/// record, otherwise it will return an empty result set with no records. /// record, otherwise it will return an empty result set with no records.
/// If the return value is NULL, it indicates a system error. /// If the return value is NULL, it indicates a system error.
/// </summary> /// </summary>
/// <param name="subscribe"> Subscription object return by <see cref = "Subscribe">. </param> /// <param name="subscribe"> Subscription object return by <c><see cref="Subscribe(IntPtr, bool, string, string, SubscribeCallback, IntPtr, int)"/></c> </param>
/// <returns></returns> /// <returns>A result set. The data retrieve by consumer.</returns>
[DllImport("taos", EntryPoint = "taos_consume", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_consume", CallingConvention = CallingConvention.Cdecl)]
static extern private IntPtr TaosConsume(IntPtr subscribe); static extern private IntPtr TaosConsume(IntPtr subscribe);
/// <summary>
/// Only synchronous mode, this function is used to get the result of subscription.
/// If the interval between two calls to taos_consume is less than the polling
/// cycle of the subscription, the API will block until the interval exceeds this
/// cycle. If a new record arrives in the database, the API will return the latest
/// record, otherwise it will return an empty result set with no records.
/// If the return value is NULL, it indicates a system error.
/// </summary>
/// <param name="subscribe"> Subscription object return by <c><see cref="Subscribe(IntPtr, bool, string, string, SubscribeCallback, IntPtr, int)"/></c> </param>
/// <returns></returns>
static public IntPtr Consume(IntPtr subscribe) static public IntPtr Consume(IntPtr subscribe)
{ {
IntPtr res = IntPtr.Zero; IntPtr res = IntPtr.Zero;
...@@ -558,7 +798,7 @@ namespace TDengineDriver ...@@ -558,7 +798,7 @@ namespace TDengineDriver
/// <summary> /// <summary>
/// Unsubscribe. /// Unsubscribe.
/// </summary> /// </summary>
/// <param name="subscribe"> Subscription object return by <see cref = "Subscribe">.</param> /// <param name="subscribe"> Subscription object return by "Subscribe" </param>
/// <param name="keep"> If it is not 0, the API will keep the progress of subscription, /// <param name="keep"> If it is not 0, the API will keep the progress of subscription,
/// and the and the subsequent call to taos_subscribe can continue /// and the and the subsequent call to taos_subscribe can continue
/// based on this progress; otherwise, the progress information will /// based on this progress; otherwise, the progress information will
...@@ -566,6 +806,17 @@ namespace TDengineDriver ...@@ -566,6 +806,17 @@ namespace TDengineDriver
/// </param> /// </param>
[DllImport("taos", EntryPoint = "taos_unsubscribe", CallingConvention = CallingConvention.Cdecl)] [DllImport("taos", EntryPoint = "taos_unsubscribe", CallingConvention = CallingConvention.Cdecl)]
static extern private void Unsubscribe(IntPtr subscribe, int keep); static extern private void Unsubscribe(IntPtr subscribe, int keep);
/// <summary>
/// Unsubscribe.
/// </summary>
/// <param name="subscribe"> Subscription object return by "Subscribe" </param>
/// <param name="keep"> If it is not true, the API will keep the progress of subscription,
/// and the and the subsequent call to taos_subscribe can continue
/// based on this progress; otherwise, the progress information will
/// be deleted and the data can only be read again.
/// </param>
/// <exception cref="Exception"></exception>
static public void Unsubscribe(IntPtr subscribe, bool keep) static public void Unsubscribe(IntPtr subscribe, bool keep)
{ {
if (subscribe == IntPtr.Zero) if (subscribe == IntPtr.Zero)
......
...@@ -15,7 +15,10 @@ ...@@ -15,7 +15,10 @@
more information please visit: https://www.taosdata.com more information please visit: https://www.taosdata.com
</Description> </Description>
<RepositoryUrl>https://github.com/taosdata/TDengine/tree/develop/src/connector/C%2523/src/TDengineDriver</RepositoryUrl> <RepositoryUrl>https://github.com/taosdata/TDengine/tree/develop/src/connector/C%2523/src/TDengineDriver</RepositoryUrl>
<NoWarn>CS1591</NoWarn>
<NoWarn>CS1591;CS0168;CS1587</NoWarn>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>.\doc\TDengineDriver.XML</DocumentationFile>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<None Include="resource\logo.jpg" Pack="true" PackagePath="\" /> <None Include="resource\logo.jpg" Pack="true" PackagePath="\" />
......
...@@ -12,6 +12,11 @@ namespace TDengineDriver ...@@ -12,6 +12,11 @@ namespace TDengineDriver
/// </summary> /// </summary>
public class TaosBind public class TaosBind
{ {
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BOOL"/></c>.
/// </summary>
/// <param name="val">A not null boolean value.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindBool(bool val) public static TAOS_BIND BindBool(bool val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -32,6 +37,12 @@ namespace TDengineDriver ...@@ -32,6 +37,12 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_TINYINT"/></c>.
/// </summary>
/// <param name="val">A not null sbyte. </param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindTinyInt(sbyte val) public static TAOS_BIND BindTinyInt(sbyte val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -54,6 +65,11 @@ namespace TDengineDriver ...@@ -54,6 +65,11 @@ namespace TDengineDriver
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_SMALLINT"/></c>.
/// </summary>
/// <param name="val">A not null short value.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindSmallInt(short val) public static TAOS_BIND BindSmallInt(short val)
{ {
...@@ -74,6 +90,11 @@ namespace TDengineDriver ...@@ -74,6 +90,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_INT"/></c>.
/// </summary>
/// <param name="val">A not null int value.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindInt(int val) public static TAOS_BIND BindInt(int val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -93,6 +114,11 @@ namespace TDengineDriver ...@@ -93,6 +114,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BIGINT"/></c>.
/// </summary>
/// <param name="val">A not null long value.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindBigInt(long val) public static TAOS_BIND BindBigInt(long val)
{ {
...@@ -113,6 +139,11 @@ namespace TDengineDriver ...@@ -113,6 +139,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UTINYINT"/></c>.
/// </summary>
/// <param name="val">An unsigned byte and can be null.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindUTinyInt(byte val) public static TAOS_BIND BindUTinyInt(byte val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -133,6 +164,11 @@ namespace TDengineDriver ...@@ -133,6 +164,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_USMALLINT"/></c>.
/// </summary>
/// <param name="val">A not null Uint16.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindUSmallInt(UInt16 val) public static TAOS_BIND BindUSmallInt(UInt16 val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -155,6 +191,11 @@ namespace TDengineDriver ...@@ -155,6 +191,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UINT"/></c>.
/// </summary>
/// <param name="val">A not null uint.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindUInt(uint val) public static TAOS_BIND BindUInt(uint val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -177,6 +218,11 @@ namespace TDengineDriver ...@@ -177,6 +218,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UBIGINT"/></c>.
/// </summary>
/// <param name="val">A not null ulong.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindUBigInt(ulong val) public static TAOS_BIND BindUBigInt(ulong val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -199,6 +245,11 @@ namespace TDengineDriver ...@@ -199,6 +245,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_FLOAT"/></c>.
/// </summary>
/// <param name="val">A not null float.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindFloat(float val) public static TAOS_BIND BindFloat(float val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -221,6 +272,11 @@ namespace TDengineDriver ...@@ -221,6 +272,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_DOUBLE"/></c>.
/// </summary>
/// <param name="val">A not null double.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindDouble(Double val) public static TAOS_BIND BindDouble(Double val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -243,6 +299,11 @@ namespace TDengineDriver ...@@ -243,6 +299,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BINARY"/></c>.
/// </summary>
/// <param name="val">A not null string.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindBinary(String val) public static TAOS_BIND BindBinary(String val)
{ {
...@@ -263,6 +324,12 @@ namespace TDengineDriver ...@@ -263,6 +324,12 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_NCHAR"/></c>.
/// </summary>
/// <param name="val">A not null string.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindNchar(String val) public static TAOS_BIND BindNchar(String val)
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -284,6 +351,10 @@ namespace TDengineDriver ...@@ -284,6 +351,10 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_NULL"/></c>.
/// </summary>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindNil() public static TAOS_BIND BindNil()
{ {
TAOS_BIND bind = new TAOS_BIND(); TAOS_BIND bind = new TAOS_BIND();
...@@ -297,6 +368,11 @@ namespace TDengineDriver ...@@ -297,6 +368,11 @@ namespace TDengineDriver
return bind; return bind;
} }
/// <summary>
/// Used to bind TDengine's <c><see cref="TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP"/></c>.
/// </summary>
/// <param name="ts">A not null long.</param>
/// <returns><c><see cref="TAOS_BIND"/></c></returns>
public static TAOS_BIND BindTimestamp(long ts) public static TAOS_BIND BindTimestamp(long ts)
{ {
...@@ -318,6 +394,10 @@ namespace TDengineDriver ...@@ -318,6 +394,10 @@ namespace TDengineDriver
} }
/// <summary>
/// Used to free allocated unmanaged memory.
/// </summary>
/// <param name="binds">An array of <see cref="TAOS_BIND"/></param>
public static void FreeTaosBind(TAOS_BIND[] binds) public static void FreeTaosBind(TAOS_BIND[] binds)
{ {
foreach (TAOS_BIND bind in binds) foreach (TAOS_BIND bind in binds)
......
...@@ -4,8 +4,16 @@ using System.Runtime.InteropServices; ...@@ -4,8 +4,16 @@ using System.Runtime.InteropServices;
namespace TDengineDriver namespace TDengineDriver
{ {
/// <summary>
/// Using to bind different columns types in multiple rows.
/// </summary>
public class TaosMultiBind public class TaosMultiBind
{ {
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BOOL"/></c> values.
/// </summary>
/// <param name="arr">A nullable boolean array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindBool(bool?[] arr) public static TAOS_MULTI_BIND MultiBindBool(bool?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -42,6 +50,12 @@ namespace TDengineDriver ...@@ -42,6 +50,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_TINYINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable sbyte array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindTinyInt(sbyte?[] arr) public static TAOS_MULTI_BIND MultiBindTinyInt(sbyte?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -81,6 +95,12 @@ namespace TDengineDriver ...@@ -81,6 +95,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_SMALLINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable short array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindSmallInt(short?[] arr) public static TAOS_MULTI_BIND MultiBindSmallInt(short?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -118,6 +138,12 @@ namespace TDengineDriver ...@@ -118,6 +138,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_INT"/></c> values.
/// </summary>
/// <param name="arr">A nullable int array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindInt(int?[] arr) public static TAOS_MULTI_BIND MultiBindInt(int?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -153,6 +179,12 @@ namespace TDengineDriver ...@@ -153,6 +179,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BIGINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable long array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindBigint(long?[] arr) public static TAOS_MULTI_BIND MultiBindBigint(long?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -189,6 +221,12 @@ namespace TDengineDriver ...@@ -189,6 +221,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_FLOAT"/></c> values.
/// </summary>
/// <param name="arr">A nullable float array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindFloat(float?[] arr) public static TAOS_MULTI_BIND MultiBindFloat(float?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -228,6 +266,12 @@ namespace TDengineDriver ...@@ -228,6 +266,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_DOUBLE"/></c> values.
/// </summary>
/// <param name="arr">A nullable double array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindDouble(double?[] arr) public static TAOS_MULTI_BIND MultiBindDouble(double?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -267,6 +311,12 @@ namespace TDengineDriver ...@@ -267,6 +311,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UTINYINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable byte array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindUTinyInt(byte?[] arr) public static TAOS_MULTI_BIND MultiBindUTinyInt(byte?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -305,6 +355,12 @@ namespace TDengineDriver ...@@ -305,6 +355,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_USMALLINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable ushort array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindUSmallInt(ushort?[] arr) public static TAOS_MULTI_BIND MultiBindUSmallInt(ushort?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -347,6 +403,12 @@ namespace TDengineDriver ...@@ -347,6 +403,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable uint array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindUInt(uint?[] arr) public static TAOS_MULTI_BIND MultiBindUInt(uint?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -389,6 +451,12 @@ namespace TDengineDriver ...@@ -389,6 +451,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_UBIGINT"/></c> values.
/// </summary>
/// <param name="arr">A nullable ulong array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindUBigInt(ulong?[] arr) public static TAOS_MULTI_BIND MultiBindUBigInt(ulong?[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -431,6 +499,12 @@ namespace TDengineDriver ...@@ -431,6 +499,12 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_BINARY"/></c> values.
/// </summary>
/// <param name="arr">A nullable string array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindBinary(string[] arr) public static TAOS_MULTI_BIND MultiBindBinary(string[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -483,6 +557,11 @@ namespace TDengineDriver ...@@ -483,6 +557,11 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_NCHAR"/></c> values.
/// </summary>
/// <param name="arr">A nullable string array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindNchar(string[] arr) public static TAOS_MULTI_BIND MultiBindNchar(string[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -534,6 +613,11 @@ namespace TDengineDriver ...@@ -534,6 +613,11 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Using to bind a array of <c><see cref="TDengineDataType.TSDB_DATA_TYPE_TIMESTAMP"/></c> values.
/// </summary>
/// <param name="arr">A nullable long array.</param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static TAOS_MULTI_BIND MultiBindTimestamp(long[] arr) public static TAOS_MULTI_BIND MultiBindTimestamp(long[] arr)
{ {
TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND(); TAOS_MULTI_BIND multiBind = new TAOS_MULTI_BIND();
...@@ -569,6 +653,11 @@ namespace TDengineDriver ...@@ -569,6 +653,11 @@ namespace TDengineDriver
return multiBind; return multiBind;
} }
/// <summary>
/// Used to free allocated unmanaged memory.
/// </summary>
/// <param name="mBinds">The <c><see cref="TAOS_MULTI_BIND"/></c> array have been instantiated. </param>
/// <returns><see cref="TAOS_MULTI_BIND"/></returns>
public static void FreeTaosBind(TAOS_MULTI_BIND[] mBinds) public static void FreeTaosBind(TAOS_MULTI_BIND[] mBinds)
{ {
foreach (TAOS_MULTI_BIND bind in mBinds) foreach (TAOS_MULTI_BIND bind in mBinds)
...@@ -579,16 +668,25 @@ namespace TDengineDriver ...@@ -579,16 +668,25 @@ namespace TDengineDriver
} }
} }
private static char[] AlignCharArr(int offSet) /// <summary>
/// Used to initial a char array with given length.
/// </summary>
/// <param name="length">The length you want to initial.</param>
/// <returns>A char array.</returns>
private static char[] AlignCharArr(int length)
{ {
char[] alignChar = new char[offSet]; char[] alignChar = new char[length];
for (int i = 0; i < offSet; i++) for (int i = 0; i < length; i++)
{ {
alignChar[i] = char.MinValue; alignChar[i] = char.MinValue;
} }
return alignChar; return alignChar;
} }
/// <summary>
/// Calculate the max length of the element in the string array.
/// </summary>
/// <param name="strArr">A string array.</param>
/// <returns>Max length.</returns>
private static int MaxElementLength(String[] strArr) private static int MaxElementLength(String[] strArr)
{ {
int max = 0; int max = 0;
...@@ -602,7 +700,11 @@ namespace TDengineDriver ...@@ -602,7 +700,11 @@ namespace TDengineDriver
} }
return max; return max;
} }
/// <summary>
/// Change the string to Byte Array.
/// </summary>
/// <param name="str">string</param>
/// <returns>Byte array.</returns>
private static Byte[] GetStringEncodeByte(string str) private static Byte[] GetStringEncodeByte(string str)
{ {
Byte[] strToBytes = null; Byte[] strToBytes = null;
......
...@@ -26,7 +26,7 @@ namespace Cases ...@@ -26,7 +26,7 @@ namespace Cases
/// <describe>test taos_fetch_fields(), check the meta data</describe> /// <describe>test taos_fetch_fields(), check the meta data</describe>
/// <filename>FetchFields.cs</filename> /// <filename>FetchFields.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "FetchFieldsCases.TestFetchFieldJsonTag()"),TestExeOrder(1),Trait("Category", "FetchFieldJsonTag")] [Fact(DisplayName = "FetchFieldsCases.TestFetchFieldJsonTag()"), TestExeOrder(1), Trait("Category", "FetchFieldJsonTag")]
public void TestFetchFieldJsonTag() public void TestFetchFieldJsonTag()
{ {
IntPtr conn = database.conn; IntPtr conn = database.conn;
......
...@@ -16,7 +16,7 @@ namespace Cases ...@@ -16,7 +16,7 @@ namespace Cases
/// <describe>TD-12103 C# connector fetch_row with binary data retrieving error</describe> /// <describe>TD-12103 C# connector fetch_row with binary data retrieving error</describe>
/// <filename>FetchLength.cs</filename> /// <filename>FetchLength.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "FetchLengthCase.TestRetrieveBinary()"),TestExeOrder(1)] [Fact(DisplayName = "FetchLengthCase.TestRetrieveBinary()"), TestExeOrder(1)]
public void TestRetrieveBinary() public void TestRetrieveBinary()
{ {
IntPtr conn = UtilsTools.TDConnection(); IntPtr conn = UtilsTools.TDConnection();
......
...@@ -30,7 +30,7 @@ namespace Cases ...@@ -30,7 +30,7 @@ namespace Cases
/// <describe>Test query without condition</describe> /// <describe>Test query without condition</describe>
/// <filename>QueryAsync.cs</filename> /// <filename>QueryAsync.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "QueryAsyncCases.QueryWithoutCondition()"),TestExeOrder(1),Trait("Category", "QueryAWithoutCondition")] [Fact(DisplayName = "QueryAsyncCases.QueryWithoutCondition()"), TestExeOrder(1), Trait("Category", "QueryAWithoutCondition")]
public void QueryWithoutCondition() public void QueryWithoutCondition()
{ {
IntPtr conn = database.conn; IntPtr conn = database.conn;
...@@ -115,7 +115,7 @@ namespace Cases ...@@ -115,7 +115,7 @@ namespace Cases
/// <describe>Test query with condition</describe> /// <describe>Test query with condition</describe>
/// <filename>QueryAsync.cs</filename> /// <filename>QueryAsync.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "QueryAsyncCases.QueryWithCondition()"),TestExeOrder(2),Trait("Category", "QueryAWithCondition")] [Fact(DisplayName = "QueryAsyncCases.QueryWithCondition()"), TestExeOrder(2), Trait("Category", "QueryAWithCondition")]
public void QueryWithCondition() public void QueryWithCondition()
{ {
IntPtr conn = database.conn; IntPtr conn = database.conn;
...@@ -202,7 +202,7 @@ namespace Cases ...@@ -202,7 +202,7 @@ namespace Cases
/// <describe>Test query with condition</describe> /// <describe>Test query with condition</describe>
/// <filename>QueryAsync.cs</filename> /// <filename>QueryAsync.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "QueryAsyncCases.QueryWithJsonCondition()"),TestExeOrder(3),Trait("Category", "QueryAWithJsonCondition")] [Fact(DisplayName = "QueryAsyncCases.QueryWithJsonCondition()"), TestExeOrder(3), Trait("Category", "QueryAWithJsonCondition")]
public void QueryWithJsonCondition() public void QueryWithJsonCondition()
{ {
IntPtr conn = database.conn; IntPtr conn = database.conn;
......
...@@ -25,7 +25,7 @@ namespace Cases ...@@ -25,7 +25,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe> /// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLineCN()"),TestExeOrder(2),Trait("Category", "bindParamCN")] [Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLineCN()"), TestExeOrder(2), Trait("Category", "bindParamCN")]
public void TestBindSingleLineCN() public void TestBindSingleLineCN()
{ {
string tableName = "ntb_stmt_cases_test_bind_single_line_cn"; string tableName = "ntb_stmt_cases_test_bind_single_line_cn";
...@@ -91,7 +91,7 @@ namespace Cases ...@@ -91,7 +91,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe> /// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumnCN()"),TestExeOrder(4),Trait("Category", "bindSingleColumnCN")] [Fact(DisplayName = "NormalTableStmtCases.TestBindColumnCN()"), TestExeOrder(4), Trait("Category", "bindSingleColumnCN")]
public void TestBindColumnCN() public void TestBindColumnCN()
{ {
string tableName = "ntb_stmt_cases_test_bind_column_cn"; string tableName = "ntb_stmt_cases_test_bind_column_cn";
...@@ -173,7 +173,7 @@ namespace Cases ...@@ -173,7 +173,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe> /// <describe>Test stmt insert single line of chinese character into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLineCN()"),TestExeOrder(6),Trait("Category", "bindParamBatchCN")] [Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLineCN()"), TestExeOrder(6), Trait("Category", "bindParamBatchCN")]
public void TestBindMultiLineCN() public void TestBindMultiLineCN()
{ {
string tableName = "ntb_stmt_cases_test_bind_multi_lines_cn"; string tableName = "ntb_stmt_cases_test_bind_multi_lines_cn";
...@@ -242,7 +242,7 @@ namespace Cases ...@@ -242,7 +242,7 @@ namespace Cases
/// <describe>Test stmt insert single line data into normal table</describe> /// <describe>Test stmt insert single line data into normal table</describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLine"),TestExeOrder(3),Trait("Category", "BindSingleColumn")] [Fact(DisplayName = "NormalTableStmtCases.TestBindSingleLine"), TestExeOrder(3), Trait("Category", "BindSingleColumn")]
public void TestBindSingleLine() public void TestBindSingleLine()
{ {
string tableName = "ntb_stmt_cases_test_bind_single_line"; string tableName = "ntb_stmt_cases_test_bind_single_line";
...@@ -311,7 +311,7 @@ namespace Cases ...@@ -311,7 +311,7 @@ namespace Cases
/// <describe>Test stmt insert multiple rows of data into normal table</describe> /// <describe>Test stmt insert multiple rows of data into normal table</describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLine()"),TestExeOrder(5),Trait("Category", "bindParamBatch")] [Fact(DisplayName = "NormalTableStmtCases.TestBindMultiLine()"), TestExeOrder(5), Trait("Category", "bindParamBatch")]
public void TestBindMultiLine() public void TestBindMultiLine()
{ {
string tableName = "ntb_stmt_case_test_bind_multi_lines"; string tableName = "ntb_stmt_case_test_bind_multi_lines";
...@@ -380,7 +380,7 @@ namespace Cases ...@@ -380,7 +380,7 @@ namespace Cases
/// <describe>Test stmt insert multiple rows of data into normal table by column after column </describe> /// <describe>Test stmt insert multiple rows of data into normal table by column after column </describe>
/// <filename>StmtNormalTable.cs</filename> /// <filename>StmtNormalTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "NormalTableStmtCases.TestBindColumn()"),TestExeOrder(1),Trait("Category", "bindParam")] [Fact(DisplayName = "NormalTableStmtCases.TestBindColumn()"), TestExeOrder(1), Trait("Category", "bindParam")]
public void TestBindColumn() public void TestBindColumn()
{ {
string tableName = "ntb_stmt_cases_test_bind_column"; string tableName = "ntb_stmt_cases_test_bind_column";
......
...@@ -28,7 +28,7 @@ namespace Cases ...@@ -28,7 +28,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe> /// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename> /// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindSingleLineCN()"),TestExeOrder(2),Trait("Category", "BindParamCN")] [Fact(DisplayName = "StableStmtCases.TestBindSingleLineCN()"), TestExeOrder(2), Trait("Category", "BindParamCN")]
public void TestBindSingleLineCN() public void TestBindSingleLineCN()
{ {
string tableName = "stb_stmt_cases_test_bind_single_line_cn"; string tableName = "stb_stmt_cases_test_bind_single_line_cn";
...@@ -112,7 +112,7 @@ namespace Cases ...@@ -112,7 +112,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe> /// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename> /// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindColumnCN()"),TestExeOrder(4),Trait("Category", "BindParamColumnCN")] [Fact(DisplayName = "StableStmtCases.TestBindColumnCN()"), TestExeOrder(4), Trait("Category", "BindParamColumnCN")]
public void TestBindColumnCN() public void TestBindColumnCN()
{ {
string tableName = "stb_stmt_cases_test_bindcolumn_cn"; string tableName = "stb_stmt_cases_test_bindcolumn_cn";
...@@ -212,7 +212,7 @@ namespace Cases ...@@ -212,7 +212,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe> /// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename> /// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindMultiLineCN()"),TestExeOrder(6),Trait("Category", "BindParamBatchCN")] [Fact(DisplayName = "StableStmtCases.TestBindMultiLineCN()"), TestExeOrder(6), Trait("Category", "BindParamBatchCN")]
public void TestBindMultiLineCN() public void TestBindMultiLineCN()
{ {
string tableName = "stb_stmt_cases_test_bind_multi_line_cn"; string tableName = "stb_stmt_cases_test_bind_multi_line_cn";
...@@ -295,7 +295,7 @@ namespace Cases ...@@ -295,7 +295,7 @@ namespace Cases
/// <describe>Test stmt insert single line into stable by column after column </describe> /// <describe>Test stmt insert single line into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename> /// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindMultiLine()"),TestExeOrder(5),Trait("Category", "BindParamBatch")] [Fact(DisplayName = "StableStmtCases.TestBindMultiLine()"), TestExeOrder(5), Trait("Category", "BindParamBatch")]
public void TestBindMultiLine() public void TestBindMultiLine()
{ {
string tableName = "stb_stmt_cases_test_bind_multi_line"; string tableName = "stb_stmt_cases_test_bind_multi_line";
...@@ -383,7 +383,7 @@ namespace Cases ...@@ -383,7 +383,7 @@ namespace Cases
/// <describe>Test stmt insert single line of chinese character into stable by column after column </describe> /// <describe>Test stmt insert single line of chinese character into stable by column after column </describe>
/// <filename>StmtSTable.cs</filename> /// <filename>StmtSTable.cs</filename>
/// <result>pass or failed </result> /// <result>pass or failed </result>
[Fact(DisplayName = "StableStmtCases.TestBindColumn()"),TestExeOrder(3),Trait("Category", "BindParamColumn")] [Fact(DisplayName = "StableStmtCases.TestBindColumn()"), TestExeOrder(3), Trait("Category", "BindParamColumn")]
public void TestBindColumn() public void TestBindColumn()
{ {
string tableName = "stb_stmt_cases_test_bindcolumn"; string tableName = "stb_stmt_cases_test_bindcolumn";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册