未验证 提交 8cfebc4e 编写于 作者: X xiaolei li 提交者: GitHub

[TD-10547]<feature>:c# support json tag (#9069)

* [TD-10547]<feature>:c# support json tag

* fix conflict

* fix conflict  2nd

* ci re run

* fix ci

* ci test

* ci test3rd

* split git ingnore file into prject direction

* fix format JsonTag.cs
上级 49466e4d
...@@ -86,7 +86,6 @@ tests/script/api/batchprepare ...@@ -86,7 +86,6 @@ tests/script/api/batchprepare
tests/script/api/stmt tests/script/api/stmt
tests/script/api/stmtBatchTest tests/script/api/stmtBatchTest
tests/script/api/stmtTest tests/script/api/stmtTest
# Emacs # Emacs
# -*- mode: gitignore; -*- # -*- mode: gitignore; -*-
*~ *~
......
src/TDengineDriver/bin/
src/TDengineDriver/obj/
src/test/Cases/bin/
src/test/Cases/obj/
src/test/XUnitTest/bin/
src/test/XUnitTest/obj/
...@@ -35,7 +35,8 @@ namespace TDengineDriver ...@@ -35,7 +35,8 @@ namespace TDengineDriver
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
TSDB_DATA_TYPE_UBIGINT = 14 // 8 bytes TSDB_DATA_TYPE_UBIGINT = 14, // 8 bytes
TSDB_DATA_TYPE_JSONTAG = 15 //4096 bytes
} }
public enum TDengineInitOption public enum TDengineInitOption
...@@ -46,7 +47,6 @@ namespace TDengineDriver ...@@ -46,7 +47,6 @@ namespace TDengineDriver
TDDB_OPTION_CONFIGDIR = 3, TDDB_OPTION_CONFIGDIR = 3,
TDDB_OPTION_SHELL_ACTIVITY_TIMER = 4 TDDB_OPTION_SHELL_ACTIVITY_TIMER = 4
} }
enum TaosField enum TaosField
{ {
STRUCT_SIZE = 68, STRUCT_SIZE = 68,
...@@ -92,6 +92,8 @@ namespace TDengineDriver ...@@ -92,6 +92,8 @@ namespace TDengineDriver
return "TIMESTAMP"; return "TIMESTAMP";
case TDengineDataType.TSDB_DATA_TYPE_NCHAR: case TDengineDataType.TSDB_DATA_TYPE_NCHAR:
return "NCHAR"; return "NCHAR";
case TDengineDataType.TSDB_DATA_TYPE_JSONTAG:
return "JSON";
default: default:
return "undefine"; return "undefine";
} }
...@@ -204,6 +206,7 @@ namespace TDengineDriver ...@@ -204,6 +206,7 @@ namespace TDengineDriver
metas.Add(meta); metas.Add(meta);
} }
return metas; return metas;
} }
......
此差异已折叠。
...@@ -48,12 +48,17 @@ namespace Cases.EntryPoint ...@@ -48,12 +48,17 @@ namespace Cases.EntryPoint
Console.WriteLine("====================fetchfeilds==================="); Console.WriteLine("====================fetchfeilds===================");
FetchFields fetchFields = new FetchFields(); FetchFields fetchFields = new FetchFields();
fetchFields.Test(conn, "fetchfeilds"); fetchFields.Test(conn,"fetchfeilds");
UtilsTools.ExecuteQuery(conn, "drop database if exists csharp"); Console.WriteLine("===================JsonTagTest====================");
JsonTagTest jsonTagTest = new JsonTagTest();
jsonTagTest.Test(conn);
// UtilsTools.ExecuteQuery(conn, "drop database if exists csharp");
UtilsTools.CloseConnection(conn); UtilsTools.CloseConnection(conn);
UtilsTools.ExitProgram(); UtilsTools.ExitProgram();
} }
} }
} }
...@@ -10,8 +10,8 @@ namespace Cases ...@@ -10,8 +10,8 @@ namespace Cases
public void Test(IntPtr conn, string tableName) public void Test(IntPtr conn, string tableName)
{ {
IntPtr res = IntPtr.Zero; IntPtr res = IntPtr.Zero;
String createTb = "create stable " + tableName + " (ts timestamp ,b bool,v1 tinyint,v2 smallint,v4 int,v8 bigint,f4 float,f8 double,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,bin binary(200),blob nchar(200))tags(id int);"; String createTb = "create stable " + tableName + " (ts timestamp ,b bool,v1 tinyint,v2 smallint,v4 int,v8 bigint,f4 float,f8 double,u1 tinyint unsigned,u2 smallint unsigned,u4 int unsigned,u8 bigint unsigned,bin binary(200),blob nchar(200))tags(jsontag json);";
String insertSql = "insert into " + tableName + "_t1 using " + tableName + " tags(1) values(1637064040000,true,1,2,3,4,5,6,7,8,9,10,'XI','XII')"; String insertSql = "insert into " + tableName + "_t1 using " + tableName + " tags('{\"k1\": \"v1\"}') values(1637064040000,true,1,2,3,4,5,6,7,8,9,10,'XI','XII')";
String selectSql = "select * from " + tableName; String selectSql = "select * from " + tableName;
String dropSql = "drop table " + tableName; String dropSql = "drop table " + tableName;
UtilsTools.ExecuteQuery(conn, createTb); UtilsTools.ExecuteQuery(conn, createTb);
...@@ -35,3 +35,5 @@ namespace Cases ...@@ -35,3 +35,5 @@ namespace Cases
} }
} }
} }
...@@ -39,6 +39,28 @@ namespace Test.UtilsTools ...@@ -39,6 +39,28 @@ namespace Test.UtilsTools
} }
return res; return res;
} }
public static IntPtr ExecuteErrorQuery(IntPtr conn, String sql)
{
IntPtr res = TDengine.Query(conn, sql);
if ((res == IntPtr.Zero) || (TDengine.ErrorNo(res) != 0))
{
Console.Write(sql.ToString() + " failure, ");
if (res != IntPtr.Zero)
{
Console.Write("reason: " + TDengine.Error(res));
}
Console.WriteLine("");
}
else
{
Console.WriteLine(sql.ToString() + " success");
}
return res;
}
public static void DisplayRes(IntPtr res) public static void DisplayRes(IntPtr res)
{ {
long queryRows = 0; long queryRows = 0;
...@@ -120,6 +142,10 @@ namespace Test.UtilsTools ...@@ -120,6 +142,10 @@ namespace Test.UtilsTools
string v10 = Marshal.PtrToStringAnsi(data); string v10 = Marshal.PtrToStringAnsi(data);
builder.Append(v10); builder.Append(v10);
break; break;
case TDengineDataType.TSDB_DATA_TYPE_JSONTAG:
string v11 = Marshal.PtrToStringAnsi(data);
builder.Append(v11);
break;
} }
} }
builder.Append("---"); builder.Append("---");
......
C#checker/bin/
C#checker/obj/
TDengineTest/bin/
TDengineTest/obj/
schemaless/bin/
schemaless/obj/
stmt/TDengineDriver.cs
stmt/TaosBind.cs
stmt/TaosMultiBind.cs
stmt/bin/
stmt/obj/
taosdemo/bin/
taosdemo/obj/
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册