Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
de5be9ef
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
de5be9ef
编写于
12月 23, 2021
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'CI/TD-12111' of github.com:taosdata/TDengine into CI/TD-12111
上级
32a2e6ee
280bcec8
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
809 addition
and
133 deletion
+809
-133
packaging/tools/makeclient.sh
packaging/tools/makeclient.sh
+4
-2
src/client/src/tscLocal.c
src/client/src/tscLocal.c
+6
-5
src/client/src/tscSQLParser.c
src/client/src/tscSQLParser.c
+9
-3
src/client/src/tscUtil.c
src/client/src/tscUtil.c
+17
-11
src/common/src/texpr.c
src/common/src/texpr.c
+26
-3
src/common/src/tvariant.c
src/common/src/tvariant.c
+15
-4
src/connector/C#/src/TDengineDriver/TDengineDriver.cs
src/connector/C#/src/TDengineDriver/TDengineDriver.cs
+3
-0
src/connector/C#/src/test/Cases/Cases.csproj
src/connector/C#/src/test/Cases/Cases.csproj
+4
-0
src/connector/C#/src/test/Cases/FetchLength.cs
src/connector/C#/src/test/Cases/FetchLength.cs
+44
-0
src/connector/C#/src/test/Cases/Program.cs
src/connector/C#/src/test/Cases/Program.cs
+67
-64
src/connector/C#/src/test/Cases/Utils.cs
src/connector/C#/src/test/Cases/Utils.cs
+129
-3
src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
+5
-1
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
...src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
+13
-0
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DatetimeBefore1970Test.java
.../java/com/taosdata/jdbc/cases/DatetimeBefore1970Test.java
+203
-13
src/inc/taoserror.h
src/inc/taoserror.h
+0
-1
src/query/src/qExecutor.c
src/query/src/qExecutor.c
+1
-1
src/query/src/qExtbuffer.c
src/query/src/qExtbuffer.c
+8
-2
src/query/src/qFilter.c
src/query/src/qFilter.c
+32
-7
src/tsdb/src/tsdbMeta.c
src/tsdb/src/tsdbMeta.c
+1
-0
src/tsdb/src/tsdbRead.c
src/tsdb/src/tsdbRead.c
+20
-12
src/util/src/terror.c
src/util/src/terror.c
+0
-1
tests/system-test/2-query/TD-11256.py
tests/system-test/2-query/TD-11256.py
+78
-0
tests/system-test/4-taosAdapter/TD-12163.py
tests/system-test/4-taosAdapter/TD-12163.py
+118
-0
tests/system-test/fulltest-query.sh
tests/system-test/fulltest-query.sh
+5
-0
tests/system-test/fulltest-taosAdapter.sh
tests/system-test/fulltest-taosAdapter.sh
+1
-0
未找到文件。
packaging/tools/makeclient.sh
浏览文件 @
de5be9ef
...
...
@@ -43,9 +43,11 @@ if [ "$osType" != "Darwin" ]; then
if
[
"
$pagMode
"
==
"lite"
]
;
then
#strip ${build_dir}/bin/taosd
strip
${
build_dir
}
/bin/taos
bin_files
=
"
${
build_dir
}
/bin/taos
${
script_dir
}
/remove_client.sh"
bin_files
=
"
${
build_dir
}
/bin/taos
\
${
script_dir
}
/remove_client.sh"
else
bin_files
=
"
${
script_dir
}
/remove_client.sh
\
bin_files
=
"
${
build_dir
}
/bin/taos
\
${
script_dir
}
/remove_client.sh
\
${
script_dir
}
/set_core.sh
\
${
script_dir
}
/get_client.sh"
#${script_dir}/get_client.sh ${script_dir}/taosd-dump-cfg.gdb"
...
...
src/client/src/tscLocal.c
浏览文件 @
de5be9ef
...
...
@@ -128,12 +128,13 @@ static int32_t tscSetValueToResObj(SSqlObj *pSql, int32_t rowLen) {
// type length
int32_t
bytes
=
pSchema
[
i
].
bytes
;
pField
=
tscFieldInfoGetField
(
&
pQueryInfo
->
fieldsInfo
,
2
);
if
(
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
||
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
)
{
if
(
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_BINARY
){
bytes
-=
VARSTR_HEADER_SIZE
;
if
(
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
)
{
bytes
=
bytes
/
TSDB_NCHA
R_SIZE
;
}
}
else
if
(
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_NCHAR
||
pSchema
[
i
].
type
==
TSDB_DATA_TYPE_JSON
)
{
bytes
-=
VARSTR_HEADE
R_SIZE
;
bytes
=
bytes
/
TSDB_NCHAR_SIZE
;
}
*
(
int32_t
*
)(
pRes
->
data
+
tscFieldInfoGetOffset
(
pQueryInfo
,
2
)
*
totalNumOfRows
+
pField
->
bytes
*
i
)
=
bytes
;
...
...
src/client/src/tscSQLParser.c
浏览文件 @
de5be9ef
...
...
@@ -4519,13 +4519,16 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr,
if
(
TSDB_FUNC_IS_SCALAR
(
functionId
))
{
code
=
validateSQLExprItem
(
pCmd
,
pParamElem
->
pNode
,
pQueryInfo
,
pList
,
childrenTypes
+
i
,
uid
,
childrenHeight
+
i
);
if
(
code
!=
TSDB_CODE_SUCCESS
)
{
free
(
childrenTypes
);
tfree
(
childrenTypes
);
tfree
(
childrenHeight
);
return
code
;
}
}
if
(
!
TSDB_FUNC_IS_SCALAR
(
functionId
)
&&
(
pParamElem
->
pNode
->
type
==
SQL_NODE_EXPR
||
pParamElem
->
pNode
->
type
==
SQL_NODE_SQLFUNCTION
))
{
tfree
(
childrenTypes
);
tfree
(
childrenHeight
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
...
...
@@ -4547,6 +4550,8 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr,
*
height
=
maxChildrenHeight
+
1
;
if
(
anyChildAgg
&&
anyChildScalar
)
{
tfree
(
childrenTypes
);
tfree
(
childrenHeight
);
return
invalidOperationMsg
(
tscGetErrorMsgPayload
(
pCmd
),
msg1
);
}
if
(
anyChildAgg
)
{
...
...
@@ -4558,7 +4563,8 @@ static int32_t validateSQLExprItemSQLFunc(SSqlCmd* pCmd, tSqlExpr* pExpr,
*
type
=
SQLEXPR_TYPE_AGG
;
}
}
free
(
childrenTypes
);
tfree
(
childrenTypes
);
tfree
(
childrenHeight
);
//end if param list is not null
}
else
{
if
(
TSDB_FUNC_IS_SCALAR
(
functionId
))
{
...
...
@@ -6869,7 +6875,7 @@ int32_t setAlterTableInfo(SSqlObj* pSql, struct SSqlInfo* pInfo) {
tscError
(
"json type error, should be string"
);
return
invalidOperationMsg
(
pMsg
,
msg25
);
}
if
(
pItem
->
pVar
.
n
Type
>
TSDB_MAX_JSON_TAGS_LEN
/
TSDB_NCHAR_SIZE
)
{
if
(
pItem
->
pVar
.
n
Len
>
TSDB_MAX_JSON_TAGS_LEN
/
TSDB_NCHAR_SIZE
)
{
tscError
(
"json tag too long"
);
return
invalidOperationMsg
(
pMsg
,
msg14
);
}
...
...
src/client/src/tscUtil.c
浏览文件 @
de5be9ef
...
...
@@ -774,11 +774,12 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
memcpy
(
dst
,
p
,
varDataTLen
(
p
));
}
else
if
(
varDataLen
(
p
)
>
0
)
{
int32_t
length
=
taosUcs4ToMbs
(
varDataVal
(
p
),
varDataLen
(
p
),
varDataVal
(
dst
));
varDataSetLen
(
dst
,
length
);
if
(
length
==
0
)
{
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
p
);
}
if
(
length
>=
0
){
varDataSetLen
(
dst
,
length
);
}
}
else
{
varDataSetLen
(
dst
,
0
);
}
...
...
@@ -809,18 +810,23 @@ static void setResRawPtrImpl(SSqlRes* pRes, SInternalField* pInfo, int32_t i, bo
varDataSetLen
(
dst
,
strlen
(
varDataVal
(
dst
)));
}
else
if
(
type
==
TSDB_DATA_TYPE_JSON
)
{
int32_t
length
=
taosUcs4ToMbs
(
varDataVal
(
realData
),
varDataLen
(
realData
),
varDataVal
(
dst
));
varDataSetLen
(
dst
,
length
);
if
(
length
=
=
0
)
{
if
(
length
<
=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
p
);
}
if
(
length
>=
0
){
varDataSetLen
(
dst
,
length
);
}
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
// value -> "value"
*
(
char
*
)
varDataVal
(
dst
)
=
'\"'
;
int32_t
length
=
taosUcs4ToMbs
(
varDataVal
(
realData
),
varDataLen
(
realData
),
POINTER_SHIFT
(
varDataVal
(
dst
),
CHAR_BYTES
));
*
(
char
*
)(
POINTER_SHIFT
(
varDataVal
(
dst
),
length
+
CHAR_BYTES
))
=
'\"'
;
varDataSetLen
(
dst
,
length
+
CHAR_BYTES
*
2
);
if
(
length
==
0
)
{
if
(
length
<=
0
)
{
tscError
(
"charset:%s to %s. val:%s convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
p
);
}
if
(
length
>=
0
){
varDataSetLen
(
dst
,
length
+
CHAR_BYTES
*
2
);
*
(
char
*
)(
POINTER_SHIFT
(
varDataVal
(
dst
),
length
+
CHAR_BYTES
))
=
'\"'
;
}
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
)
{
double
jsonVd
=
*
(
double
*
)(
realData
);
sprintf
(
varDataVal
(
dst
),
"%.9lf"
,
jsonVd
);
...
...
@@ -5515,10 +5521,10 @@ int parseJsontoTagData(char* json, SKVRowBuilder* kvRowBuilder, char* errMsg, in
char
*
tagVal
=
calloc
(
strlen
(
jsonValue
)
*
TSDB_NCHAR_SIZE
+
TSDB_NCHAR_SIZE
,
1
);
*
tagVal
=
jsonType2DbType
(
0
,
item
->
type
);
// type
char
*
tagData
=
POINTER_SHIFT
(
tagVal
,
CHAR_BYTES
);
if
(
!
taosMbsToUcs4
(
jsonValue
,
strlen
(
jsonValue
),
varDataVal
(
tagData
),
if
(
strlen
(
jsonValue
)
>
0
&&
!
taosMbsToUcs4
(
jsonValue
,
strlen
(
jsonValue
),
varDataVal
(
tagData
),
(
int32_t
)(
strlen
(
jsonValue
)
*
TSDB_NCHAR_SIZE
),
&
outLen
))
{
tscError
(
"
json string error:%s|%s"
,
strerror
(
errno
),
jsonValue
);
retCode
=
tscSQLSyntaxErrMsg
(
errMsg
,
"
serizelize
json error"
,
NULL
);
tscError
(
"
charset:%s to %s. val:%s, errno:%s, convert failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
jsonValue
,
strerror
(
errno
)
);
retCode
=
tscSQLSyntaxErrMsg
(
errMsg
,
"
charset convert
json error"
,
NULL
);
free
(
tagVal
);
goto
end
;
}
...
...
src/common/src/texpr.c
浏览文件 @
de5be9ef
...
...
@@ -27,6 +27,7 @@
#include "tskiplist.h"
#include "texpr.h"
#include "tarithoperator.h"
#include "tulog.h"
static
int32_t
exprValidateMathNode
(
tExprNode
*
pExpr
);
static
int32_t
exprValidateStringConcatNode
(
tExprNode
*
pExpr
);
...
...
@@ -1274,6 +1275,11 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
newColData
=
calloc
(
1
,
outputBytes
*
TSDB_NCHAR_SIZE
+
1
);
int
len
=
taosUcs4ToMbs
(
varDataVal
(
input
),
varDataLen
(
input
),
newColData
);
if
(
len
<
0
){
uError
(
"castConvert taosUcs4ToMbs error 1"
);
tfree
(
newColData
);
return
;
}
newColData
[
len
]
=
0
;
*
(
int64_t
*
)
output
=
strtoll
(
newColData
,
NULL
,
10
);
tfree
(
newColData
);
...
...
@@ -1291,6 +1297,11 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out
}
else
if
(
inputType
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
newColData
=
calloc
(
1
,
outputBytes
*
TSDB_NCHAR_SIZE
+
1
);
int
len
=
taosUcs4ToMbs
(
varDataVal
(
input
),
varDataLen
(
input
),
newColData
);
if
(
len
<
0
){
uError
(
"castConvert taosUcs4ToMbs error 2"
);
tfree
(
newColData
);
return
;
}
newColData
[
len
]
=
0
;
*
(
int64_t
*
)
output
=
strtoull
(
newColData
,
NULL
,
10
);
tfree
(
newColData
);
...
...
@@ -1332,11 +1343,19 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out
if
(
inputType
==
TSDB_DATA_TYPE_BOOL
)
{
char
tmp
[
8
]
=
{
0
};
int32_t
len
=
sprintf
(
tmp
,
"%.*s"
,
ncharSize
,
*
(
int8_t
*
)
input
?
"true"
:
"false"
);
taosMbsToUcs4
(
tmp
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
bool
ret
=
taosMbsToUcs4
(
tmp
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
if
(
!
ret
)
{
uError
(
"castConvert1 taosMbsToUcs4 error"
);
return
;
}
varDataSetLen
(
output
,
len
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_BINARY
)
{
int32_t
len
=
ncharSize
>
varDataLen
(
input
)
?
varDataLen
(
input
)
:
ncharSize
;
taosMbsToUcs4
(
input
+
VARSTR_HEADER_SIZE
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
bool
ret
=
taosMbsToUcs4
(
input
+
VARSTR_HEADER_SIZE
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
if
(
!
ret
)
{
uError
(
"castConvert2 taosMbsToUcs4 error"
);
return
;
}
varDataSetLen
(
output
,
len
);
}
else
if
(
inputType
==
TSDB_DATA_TYPE_TIMESTAMP
)
{
assert
(
0
);
...
...
@@ -1348,7 +1367,11 @@ void castConvert(int16_t inputType, int16_t inputBytes, char *input, int16_t Out
char
tmp
[
400
]
=
{
0
};
NUM_TO_STRING
(
inputType
,
input
,
sizeof
(
tmp
),
tmp
);
int32_t
len
=
(
int32_t
)(
ncharSize
>
strlen
(
tmp
)
?
strlen
(
tmp
)
:
ncharSize
);
taosMbsToUcs4
(
tmp
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
bool
ret
=
taosMbsToUcs4
(
tmp
,
len
,
varDataVal
(
output
),
outputBytes
-
VARSTR_HEADER_SIZE
,
&
len
);
if
(
!
ret
)
{
uError
(
"castConvert3 taosMbsToUcs4 error"
);
return
;
}
varDataSetLen
(
output
,
len
);
}
break
;
...
...
src/common/src/tvariant.c
浏览文件 @
de5be9ef
...
...
@@ -23,6 +23,7 @@
#include "ttype.h"
#include "tutil.h"
#include "tvariant.h"
#include "tulog.h"
#define SET_EXT_INFO(converted, res, minv, maxv, exti) do { \
if (converted == NULL || exti == NULL || *converted == false) { break; } \
...
...
@@ -359,8 +360,12 @@ int32_t tVariantToString(tVariant *pVar, char *dst) {
case
TSDB_DATA_TYPE_NCHAR
:
{
dst
[
0
]
=
'\''
;
taosUcs4ToMbs
(
pVar
->
wpz
,
(
twcslen
(
pVar
->
wpz
)
+
1
)
*
TSDB_NCHAR_SIZE
,
dst
+
1
);
int32_t
len
=
(
int32_t
)
strlen
(
dst
);
int32_t
len
=
taosUcs4ToMbs
(
pVar
->
wpz
,
(
twcslen
(
pVar
->
wpz
)
+
1
)
*
TSDB_NCHAR_SIZE
,
dst
+
1
);
if
(
len
<
0
){
uError
(
"castConvert1 taosUcs4ToMbs error"
);
return
0
;
}
len
=
(
int32_t
)
strlen
(
dst
);
dst
[
len
]
=
'\''
;
dst
[
len
+
1
]
=
0
;
return
len
+
1
;
...
...
@@ -428,11 +433,17 @@ static int32_t toBinary(tVariant *pVariant, char **pDest, int32_t *pDestSize) {
pBuf
=
realloc
(
pBuf
,
newSize
+
1
);
}
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
pBuf
);
int32_t
len
=
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
pBuf
);
if
(
len
<
0
){
uError
(
"castConvert1 taosUcs4ToMbs error"
);
}
free
(
pVariant
->
wpz
);
pBuf
[
newSize
]
=
0
;
}
else
{
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
*
pDest
);
int32_t
len
=
taosUcs4ToMbs
(
pVariant
->
wpz
,
(
int32_t
)
newSize
,
*
pDest
);
if
(
len
<
0
){
uError
(
"castConvert1 taosUcs4ToMbs error"
);
}
}
}
else
{
...
...
src/connector/C#/src/TDengineDriver/TDengineDriver.cs
浏览文件 @
de5be9ef
...
...
@@ -398,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
);
}
}
src/connector/C#/src/test/Cases/Cases.csproj
浏览文件 @
de5be9ef
...
...
@@ -9,4 +9,8 @@
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>..\doc\FunctionTest.XML</DocumentationFile>
</PropertyGroup>
</Project>
src/connector/C#/src/test/Cases/FetchLength.cs
0 → 100644
浏览文件 @
de5be9ef
using
System
;
using
Test.UtilsTools
;
using
System.Collections.Generic
;
namespace
Cases
{
public
class
FetchLengthCase
{
/// <author>xiaolei</author>
/// <Name>TestRetrieveBinary</Name>
/// <describe>TD-12103 C# connector fetch_row with binary data retrieving error</describe>
/// <filename>FetchLength.cs</filename>
/// <result>pass or failed </result>
public
void
TestRetrieveBinary
(
IntPtr
conn
)
{
string
sql1
=
"create stable stb1 (ts timestamp, name binary(10)) tags(n int);"
;
string
sql2
=
"insert into tb1 using stb1 tags(1) values(now, 'log');"
;
string
sql3
=
"insert into tb2 using stb1 tags(2) values(now, 'test');"
;
string
sql4
=
"insert into tb3 using stb1 tags(3) values(now, 'db02');"
;
string
sql5
=
"insert into tb4 using stb1 tags(4) values(now, 'db3');"
;
string
sql6
=
"select distinct(name) from stb1;"
;
//
UtilsTools
.
ExecuteQuery
(
conn
,
sql1
);
UtilsTools
.
ExecuteQuery
(
conn
,
sql2
);
UtilsTools
.
ExecuteQuery
(
conn
,
sql3
);
UtilsTools
.
ExecuteQuery
(
conn
,
sql4
);
UtilsTools
.
ExecuteQuery
(
conn
,
sql5
);
IntPtr
resPtr
=
IntPtr
.
Zero
;
resPtr
=
UtilsTools
.
ExecuteQuery
(
conn
,
sql6
);
List
<
List
<
string
>>
result
=
UtilsTools
.
GetResultSet
(
resPtr
);
List
<
string
>
colname
=
result
[
0
];
List
<
string
>
data
=
result
[
1
];
UtilsTools
.
AssertEqual
(
"db3"
,
data
[
0
]);
UtilsTools
.
AssertEqual
(
"log"
,
data
[
1
]);
UtilsTools
.
AssertEqual
(
"db02"
,
data
[
2
]);
UtilsTools
.
AssertEqual
(
"test"
,
data
[
3
]);
}
}
}
src/connector/C#/src/test/Cases/Program.cs
浏览文件 @
de5be9ef
using
System
;
using
Test.UtilsTools
;
using
Cases
;
namespace
Cases.EntryPoint
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
IntPtr
conn
=
IntPtr
.
Zero
;
IntPtr
stmt
=
IntPtr
.
Zero
;
IntPtr
res
=
IntPtr
.
Zero
;
conn
=
UtilsTools
.
TDConnection
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
""
,
0
);
UtilsTools
.
ExecuteQuery
(
conn
,
"drop database if exists csharp"
);
UtilsTools
.
ExecuteQuery
(
conn
,
"create database if not exists csharp keep 3650"
);
UtilsTools
.
ExecuteQuery
(
conn
,
"use csharp"
);
Console
.
WriteLine
(
"====================StableColumnByColumn==================="
);
StableColumnByColumn
columnByColumn
=
new
StableColumnByColumn
();
columnByColumn
.
Test
(
conn
,
"stablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================StmtStableQuery==================="
);
StmtStableQuery
stmtStableQuery
=
new
StmtStableQuery
();
stmtStableQuery
.
Test
(
conn
,
"stablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================StableMutipleLine==================="
);
StableMutipleLine
mutipleLine
=
new
StableMutipleLine
();
mutipleLine
.
Test
(
conn
,
"stablemutipleline"
);
//================================================================================
Console
.
WriteLine
(
"====================NtableSingleLine==================="
);
NtableSingleLine
ntableSingleLine
=
new
NtableSingleLine
();
ntableSingleLine
.
Test
(
conn
,
"stablesingleline"
);
Console
.
WriteLine
(
"====================NtableMutipleLine==================="
);
NtableMutipleLine
ntableMutipleLine
=
new
NtableMutipleLine
();
ntableMutipleLine
.
Test
(
conn
,
"ntablemutipleline"
);
Console
.
WriteLine
(
"====================StmtNtableQuery==================="
);
StmtNtableQuery
stmtNtableQuery
=
new
StmtNtableQuery
();
stmtNtableQuery
.
Test
(
conn
,
"ntablemutipleline"
);
Console
.
WriteLine
(
"====================NtableColumnByColumn==================="
);
NtableColumnByColumn
ntableColumnByColumn
=
new
NtableColumnByColumn
();
ntableColumnByColumn
.
Test
(
conn
,
"ntablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================fetchfeilds==================="
);
FetchFields
fetchFields
=
new
FetchFields
();
fetchFields
.
Test
(
conn
,
"fetchfeilds"
);
Console
.
WriteLine
(
"===================JsonTagTest===================="
);
JsonTagTest
jsonTagTest
=
new
JsonTagTest
();
jsonTagTest
.
Test
(
conn
);
// UtilsTools.ExecuteQuery(conn, "drop database if exists csharp");
UtilsTools
.
CloseConnection
(
conn
);
UtilsTools
.
ExitProgram
();
}
}
}
using
System
;
using
Test.UtilsTools
;
using
Cases
;
namespace
Cases.EntryPoint
{
class
Program
{
static
void
Main
(
string
[]
args
)
{
IntPtr
conn
=
IntPtr
.
Zero
;
IntPtr
stmt
=
IntPtr
.
Zero
;
IntPtr
res
=
IntPtr
.
Zero
;
conn
=
UtilsTools
.
TDConnection
(
"127.0.0.1"
,
"root"
,
"taosdata"
,
""
,
0
);
UtilsTools
.
ExecuteQuery
(
conn
,
"drop database if exists csharp"
);
UtilsTools
.
ExecuteQuery
(
conn
,
"create database if not exists csharp keep 3650"
);
UtilsTools
.
ExecuteQuery
(
conn
,
"use csharp"
);
Console
.
WriteLine
(
"====================StableColumnByColumn==================="
);
StableColumnByColumn
columnByColumn
=
new
StableColumnByColumn
();
columnByColumn
.
Test
(
conn
,
"stablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================StmtStableQuery==================="
);
StmtStableQuery
stmtStableQuery
=
new
StmtStableQuery
();
stmtStableQuery
.
Test
(
conn
,
"stablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================StableMutipleLine==================="
);
StableMutipleLine
mutipleLine
=
new
StableMutipleLine
();
mutipleLine
.
Test
(
conn
,
"stablemutipleline"
);
//================================================================================
Console
.
WriteLine
(
"====================NtableSingleLine==================="
);
NtableSingleLine
ntableSingleLine
=
new
NtableSingleLine
();
ntableSingleLine
.
Test
(
conn
,
"stablesingleline"
);
Console
.
WriteLine
(
"====================NtableMutipleLine==================="
);
NtableMutipleLine
ntableMutipleLine
=
new
NtableMutipleLine
();
ntableMutipleLine
.
Test
(
conn
,
"ntablemutipleline"
);
Console
.
WriteLine
(
"====================StmtNtableQuery==================="
);
StmtNtableQuery
stmtNtableQuery
=
new
StmtNtableQuery
();
stmtNtableQuery
.
Test
(
conn
,
"ntablemutipleline"
);
Console
.
WriteLine
(
"====================NtableColumnByColumn==================="
);
NtableColumnByColumn
ntableColumnByColumn
=
new
NtableColumnByColumn
();
ntableColumnByColumn
.
Test
(
conn
,
"ntablecolumnbycolumn"
);
Console
.
WriteLine
(
"====================fetchfeilds==================="
);
FetchFields
fetchFields
=
new
FetchFields
();
fetchFields
.
Test
(
conn
,
"fetchfeilds"
);
Console
.
WriteLine
(
"===================JsonTagTest===================="
);
JsonTagTest
jsonTagTest
=
new
JsonTagTest
();
jsonTagTest
.
Test
(
conn
);
Console
.
WriteLine
(
"====================fetchLengthCase==================="
);
FetchLengthCase
fetchLengthCase
=
new
FetchLengthCase
();
fetchLengthCase
.
TestRetrieveBinary
(
conn
);
UtilsTools
.
ExecuteQuery
(
conn
,
"drop database if exists csharp"
);
UtilsTools
.
CloseConnection
(
conn
);
UtilsTools
.
ExitProgram
();
}
}
}
src/connector/C#/src/test/Cases/Utils.cs
浏览文件 @
de5be9ef
...
...
@@ -35,7 +35,6 @@ namespace Test.UtilsTools
else
{
Console
.
WriteLine
(
sql
.
ToString
()
+
" success"
);
}
return
res
;
}
...
...
@@ -83,9 +82,13 @@ namespace Test.UtilsTools
IntPtr
rowdata
;
StringBuilder
builder
=
new
StringBuilder
();
while
((
rowdata
=
TDengine
.
FetchRows
(
res
))
!=
IntPtr
.
Zero
)
{
queryRows
++;
IntPtr
colLengthPtr
=
TDengine
.
FetchLengths
(
res
);
int
[]
colLengthArr
=
new
int
[
fieldCount
];
Marshal
.
Copy
(
colLengthPtr
,
colLengthArr
,
0
,
fieldCount
);
for
(
int
fields
=
0
;
fields
<
fieldCount
;
++
fields
)
{
TDengineMeta
meta
=
metas
[
fields
];
...
...
@@ -131,7 +134,7 @@ namespace Test.UtilsTools
builder
.
Append
(
v7
);
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_BINARY
:
string
v8
=
Marshal
.
PtrToStringAnsi
(
data
);
string
v8
=
Marshal
.
PtrToStringAnsi
(
data
,
colLengthArr
[
fields
]
);
builder
.
Append
(
v8
);
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_TIMESTAMP
:
...
...
@@ -139,7 +142,7 @@ namespace Test.UtilsTools
builder
.
Append
(
v9
);
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_NCHAR
:
string
v10
=
Marshal
.
PtrToStringAnsi
(
data
);
string
v10
=
Marshal
.
PtrToStringAnsi
(
data
,
colLengthArr
[
fields
]
);
builder
.
Append
(
v10
);
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_JSONTAG
:
...
...
@@ -164,6 +167,117 @@ namespace Test.UtilsTools
TDengine
.
FreeResult
(
res
);
Console
.
WriteLine
(
""
);
}
public
static
List
<
List
<
string
>>
GetResultSet
(
IntPtr
res
)
{
List
<
List
<
string
>>
result
=
new
List
<
List
<
string
>>();
List
<
string
>
colName
=
new
List
<
string
>();
List
<
string
>
dataRaw
=
new
List
<
string
>();
long
queryRows
=
0
;
if
(!
IsValidResult
(
res
))
{
ExitProgram
();
}
int
fieldCount
=
TDengine
.
FieldCount
(
res
);
List
<
TDengineMeta
>
metas
=
TDengine
.
FetchFields
(
res
);
for
(
int
j
=
0
;
j
<
metas
.
Count
;
j
++)
{
TDengineMeta
meta
=
(
TDengineMeta
)
metas
[
j
];
colName
.
Add
(
meta
.
name
);
}
result
.
Add
(
colName
);
IntPtr
rowdata
;
while
((
rowdata
=
TDengine
.
FetchRows
(
res
))
!=
IntPtr
.
Zero
)
{
queryRows
++;
IntPtr
colLengthPtr
=
TDengine
.
FetchLengths
(
res
);
int
[]
colLengthArr
=
new
int
[
fieldCount
];
Marshal
.
Copy
(
colLengthPtr
,
colLengthArr
,
0
,
fieldCount
);
for
(
int
fields
=
0
;
fields
<
fieldCount
;
++
fields
)
{
TDengineMeta
meta
=
metas
[
fields
];
int
offset
=
IntPtr
.
Size
*
fields
;
IntPtr
data
=
Marshal
.
ReadIntPtr
(
rowdata
,
offset
);
if
(
data
==
IntPtr
.
Zero
)
{
dataRaw
.
Add
(
"NULL"
);
continue
;
}
switch
((
TDengineDataType
)
meta
.
type
)
{
case
TDengineDataType
.
TSDB_DATA_TYPE_BOOL
:
bool
v1
=
Marshal
.
ReadByte
(
data
)
==
0
?
false
:
true
;
dataRaw
.
Add
(
v1
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_TINYINT
:
byte
v2
=
Marshal
.
ReadByte
(
data
);
dataRaw
.
Add
(
v2
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_SMALLINT
:
short
v3
=
Marshal
.
ReadInt16
(
data
);
dataRaw
.
Add
(
v3
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_INT
:
int
v4
=
Marshal
.
ReadInt32
(
data
);
dataRaw
.
Add
(
v4
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_BIGINT
:
long
v5
=
Marshal
.
ReadInt64
(
data
);
dataRaw
.
Add
(
v5
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_FLOAT
:
float
v6
=
(
float
)
Marshal
.
PtrToStructure
(
data
,
typeof
(
float
));
dataRaw
.
Add
(
v6
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_DOUBLE
:
double
v7
=
(
double
)
Marshal
.
PtrToStructure
(
data
,
typeof
(
double
));
dataRaw
.
Add
(
v7
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_BINARY
:
string
v8
=
Marshal
.
PtrToStringAnsi
(
data
,
colLengthArr
[
fields
]);
dataRaw
.
Add
(
v8
);
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_TIMESTAMP
:
long
v9
=
Marshal
.
ReadInt64
(
data
);
dataRaw
.
Add
(
v9
.
ToString
());
break
;
case
TDengineDataType
.
TSDB_DATA_TYPE_NCHAR
:
string
v10
=
Marshal
.
PtrToStringAnsi
(
data
,
colLengthArr
[
fields
]);
dataRaw
.
Add
(
v10
);
break
;
}
}
}
result
.
Add
(
dataRaw
);
if
(
TDengine
.
ErrorNo
(
res
)
!=
0
)
{
Console
.
Write
(
"Query is not complete, Error {0:G}"
,
TDengine
.
ErrorNo
(
res
),
TDengine
.
Error
(
res
));
}
TDengine
.
FreeResult
(
res
);
Console
.
WriteLine
(
""
);
return
result
;
}
public
static
bool
IsValidResult
(
IntPtr
res
)
{
if
((
res
==
IntPtr
.
Zero
)
||
(
TDengine
.
ErrorNo
(
res
)
!=
0
))
{
if
(
res
!=
IntPtr
.
Zero
)
{
Console
.
Write
(
"reason: "
+
TDengine
.
Error
(
res
));
return
false
;
}
Console
.
WriteLine
(
""
);
return
false
;
}
return
true
;
}
public
static
void
CloseConnection
(
IntPtr
conn
)
{
if
(
conn
!=
IntPtr
.
Zero
)
...
...
@@ -183,6 +297,18 @@ namespace Test.UtilsTools
List
<
TDengineMeta
>
metas
=
TDengine
.
FetchFields
(
res
);
return
metas
;
}
public
static
void
AssertEqual
(
string
expectVal
,
string
actualVal
)
{
if
(
expectVal
==
actualVal
)
{
Console
.
WriteLine
(
"{0}=={1} pass"
,
expectVal
,
actualVal
);
}
else
{
Console
.
WriteLine
(
"{0}=={1} failed"
,
expectVal
,
actualVal
);
ExitProgram
();
}
}
public
static
void
ExitProgram
()
{
TDengine
.
Cleanup
();
...
...
src/connector/C#/src/test/XUnitTest/XUnitTest.csproj
浏览文件 @
de5be9ef
...
...
@@ -2,10 +2,14 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<DocumentationFile>..\doc\UnitTest.XML</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.msbuild" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
...
...
src/connector/jdbc/src/main/java/com/taosdata/jdbc/TSDBResultSetRowData.java
浏览文件 @
de5be9ef
...
...
@@ -443,16 +443,29 @@ public class TSDBResultSetRowData {
case
0
:
{
milliseconds
=
ts
;
fracNanoseconds
=
(
int
)
(
ts
*
1_000_000
%
1_000_000_000
);
fracNanoseconds
=
fracNanoseconds
<
0
?
1_000_000_000
+
fracNanoseconds
:
fracNanoseconds
;
break
;
}
case
1
:
{
milliseconds
=
ts
/
1_000
;
fracNanoseconds
=
(
int
)
(
ts
*
1_000
%
1_000_000_000
);
if
(
fracNanoseconds
<
0
)
{
if
(
milliseconds
==
0
){
milliseconds
=
-
1
;
}
fracNanoseconds
+=
1_000_000_000
;
}
break
;
}
case
2
:
{
milliseconds
=
ts
/
1_000_000
;
fracNanoseconds
=
(
int
)
(
ts
%
1_000_000_000
);
if
(
fracNanoseconds
<
0
)
{
if
(
milliseconds
==
0
){
milliseconds
=
-
1
;
}
fracNanoseconds
+=
1_000_000_000
;
}
break
;
}
default
:
{
...
...
src/connector/jdbc/src/test/java/com/taosdata/jdbc/cases/DatetimeBefore1970Test.java
浏览文件 @
de5be9ef
package
com.taosdata.jdbc.cases
;
import
com.taosdata.jdbc.annotation.CatalogRunner
;
import
com.taosdata.jdbc.annotation.Description
;
import
com.taosdata.jdbc.annotation.TestTarget
;
import
com.taosdata.jdbc.utils.TimestampUtil
;
import
org.junit.*
;
import
org.junit.runner.RunWith
;
import
java.sql.*
;
@RunWith
(
CatalogRunner
.
class
)
@TestTarget
(
alias
=
"negative value convert to timestamp"
,
author
=
"huolibo"
,
version
=
"2.0.37"
)
public
class
DatetimeBefore1970Test
{
private
static
final
String
host
=
"127.0.0.1"
;
private
Connection
conn
;
@Test
public
void
test
()
throws
SQLException
{
@Description
(
"millisecond"
)
public
void
msTest
()
throws
SQLException
{
conn
=
createEnvironment
(
"ms"
);
long
now
=
System
.
currentTimeMillis
();
try
(
Statement
stmt
=
conn
.
createStatement
())
{
// given
// before
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 00:00:00.001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 23:59:59.999')"
);
// zero
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 08:00:00.000')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 07:59:59.999')"
);
//after
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values("
+
now
+
")"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from weather order by ts asc"
);
ResultSetMetaData
metaData
=
rs
.
getMetaData
();
Assert
.
assertEquals
(
2
,
metaData
.
getColumnCount
());
...
...
@@ -26,44 +39,221 @@ public class DatetimeBefore1970Test {
rs
.
next
();
// then
Timestamp
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1969-12-31 23:59:59.999"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()
));
Assert
.
assertEquals
(
-
24
*
60
*
60
*
1000
+
1
,
ts
.
getTime
(
));
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1970-01-01 00:00:00.000"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()
));
Assert
.
assertEquals
(
-
1
,
ts
.
getTime
(
));
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1970-01-01 08:00:00.000"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()));
Assert
.
assertEquals
(
0
,
ts
.
getTime
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
1
,
ts
.
getTime
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
now
,
ts
.
getTime
());
}
}
@Test
@Description
(
"microsecond"
)
public
void
usTest
()
throws
SQLException
{
conn
=
createEnvironment
(
"us"
);
long
now
=
System
.
currentTimeMillis
();
try
(
Statement
stmt
=
conn
.
createStatement
())
{
// given
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 00:00:00.000001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 23:59:59.999999')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000000')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values("
+
now
+
")"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from weather order by ts asc"
);
ResultSetMetaData
metaData
=
rs
.
getMetaData
();
Assert
.
assertEquals
(
2
,
metaData
.
getColumnCount
());
// when
rs
.
next
();
// then
Timestamp
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(-
24
*
60
*
60
*
1000
,
ts
.
getTime
());
Assert
.
assertEquals
(
1_000
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(-
1
,
ts
.
getTime
());
Assert
.
assertEquals
(
999_999_000
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
0
,
ts
.
getTime
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
0
,
ts
.
getTime
());
Assert
.
assertEquals
(
1_000
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
String
s
=
String
.
valueOf
(
now
);
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
0
,
s
.
length
()
-
3
)),
ts
.
getTime
());
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
s
.
length
()
-
6
)
+
"000"
),
ts
.
getNanos
());
}
}
@Test
@Description
(
"nanosecond"
)
public
void
nanoTest
()
throws
SQLException
{
conn
=
createEnvironment
(
"ns"
);
long
now
=
System
.
currentTimeMillis
()
*
1000_000L
+
System
.
nanoTime
()
%
1000_000L
;
try
(
Statement
stmt
=
conn
.
createStatement
())
{
// given
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 00:00:00.000000123')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 23:59:59.999999999')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000000001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values("
+
now
+
")"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from weather order by ts asc"
);
ResultSetMetaData
metaData
=
rs
.
getMetaData
();
Assert
.
assertEquals
(
2
,
metaData
.
getColumnCount
());
// when
rs
.
next
();
// then
Timestamp
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(-
24
*
60
*
60
*
1_000
,
ts
.
getTime
());
Assert
.
assertEquals
(
123
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(-
1
,
ts
.
getTime
());
Assert
.
assertEquals
(
999999999
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
0
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
1
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
String
s
=
String
.
valueOf
(
now
);
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
0
,
s
.
length
()
-
6
)),
ts
.
getTime
());
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
s
.
length
()
-
9
)),
ts
.
getNanos
());
}
}
@Test
@Ignore
@Description
(
"nanosecond convert timestamp when timezone is asia shanghai"
)
public
void
asiaShanghaiTest
()
throws
SQLException
{
conn
=
createEnvironment
(
"ns"
);
long
now
=
System
.
currentTimeMillis
()
*
1000_000L
+
System
.
nanoTime
()
%
1000_000L
;
try
(
Statement
stmt
=
conn
.
createStatement
())
{
// given
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 00:00:00.000000123')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1969-12-31 23:59:59.999999999')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values('1970-01-01 00:00:00.000000001')"
);
stmt
.
executeUpdate
(
"insert into weather(ts) values("
+
now
+
")"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"select * from weather order by ts asc"
);
ResultSetMetaData
metaData
=
rs
.
getMetaData
();
Assert
.
assertEquals
(
2
,
metaData
.
getColumnCount
());
// when
rs
.
next
();
// then
Timestamp
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1969-12-31 08:00:00.000"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()));
Assert
.
assertEquals
(
123
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1970-01-01 07:59:59.999"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()));
Assert
.
assertEquals
(
999999999
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1970-01-01 08:00:00.000"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()));
Assert
.
assertEquals
(
0
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
Assert
.
assertEquals
(
"1970-01-01 08:00:00.000"
,
TimestampUtil
.
longToDatetime
(
ts
.
getTime
()));
Assert
.
assertEquals
(
1
,
ts
.
getNanos
());
// when
rs
.
next
();
// then
ts
=
rs
.
getTimestamp
(
"ts"
);
String
s
=
String
.
valueOf
(
now
);
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
0
,
s
.
length
()
-
6
)),
ts
.
getTime
());
Assert
.
assertEquals
(
Long
.
parseLong
(
s
.
substring
(
s
.
length
()
-
9
)),
ts
.
getNanos
());
}
}
@Before
public
void
before
()
throws
SQLException
{
conn
=
DriverManager
.
getConnection
(
"jdbc:TAOS://"
+
host
+
":6030/?user=root&password=taosdata"
);
private
Connection
createEnvironment
(
String
precision
)
throws
SQLException
{
String
url
=
"jdbc:TAOS://"
+
host
+
":6030/?user=root&password=taosdata&timezone=UTC"
;
String
createSql
=
"create database if not exists test_timestamp keep 36500"
;
if
(!
isEmpty
(
precision
))
{
createSql
+=
" precision '"
+
precision
+
"'"
;
}
conn
=
DriverManager
.
getConnection
(
url
);
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"drop database if exists test_timestamp"
);
stmt
.
execute
(
"create database if not exists test_timestamp keep 36500"
);
stmt
.
execute
(
createSql
);
stmt
.
execute
(
"use test_timestamp"
);
stmt
.
execute
(
"create table weather(ts timestamp,f1 float)"
);
stmt
.
close
();
return
conn
;
}
private
boolean
isEmpty
(
String
string
)
{
return
null
==
string
||
string
.
trim
().
equals
(
""
);
}
@After
public
void
after
()
throws
SQLException
{
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"drop database if exists test_timestamp"
);
if
(
conn
!=
null
)
if
(
conn
!=
null
)
{
Statement
stmt
=
conn
.
createStatement
();
stmt
.
execute
(
"drop database if exists test_timestamp"
);
stmt
.
close
();
conn
.
close
();
}
}
}
src/inc/taoserror.h
浏览文件 @
de5be9ef
...
...
@@ -274,7 +274,6 @@ int32_t* taosGetErrno();
#define TSDB_CODE_TDB_IVLD_TAG_VAL TAOS_DEF_ERROR_CODE(0, 0x0615) //"TSDB invalid tag value")
#define TSDB_CODE_TDB_NO_CACHE_LAST_ROW TAOS_DEF_ERROR_CODE(0, 0x0616) //"TSDB no cache last row data")
#define TSDB_CODE_TDB_INCOMPLETE_DFILESET TAOS_DEF_ERROR_CODE(0, 0x0617) //"TSDB incomplete DFileSet")
#define TSDB_CODE_TDB_NO_JSON_TAG_KEY TAOS_DEF_ERROR_CODE(0, 0x0618) //"TSDB no tag json key")
// query
#define TSDB_CODE_QRY_INVALID_QHANDLE TAOS_DEF_ERROR_CODE(0, 0x0700) //"Invalid handle")
...
...
src/query/src/qExecutor.c
浏览文件 @
de5be9ef
...
...
@@ -1942,7 +1942,7 @@ static SQLFunctionCtx* createSQLFunctionCtx(SQueryRuntimeEnv* pRuntimeEnv, SExpr
for
(
int32_t
j
=
0
;
j
<
pCtx
->
numOfParams
;
++
j
)
{
int16_t
type
=
pSqlExpr
->
param
[
j
].
nType
;
int16_t
bytes
=
pSqlExpr
->
param
[
j
].
nLen
;
if
(
pSqlExpr
->
functionId
==
TSDB_FUNC_STDDEV_DST
)
{
if
(
pSqlExpr
->
functionId
==
TSDB_FUNC_STDDEV_DST
||
pSqlExpr
->
functionId
==
TSDB_FUNC_TS_COMP
)
{
continue
;
}
...
...
src/query/src/qExtbuffer.c
浏览文件 @
de5be9ef
...
...
@@ -1040,7 +1040,10 @@ void tColModelDisplay(SColumnModel *pModel, void *pData, int32_t numOfRows, int3
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
char
buf
[
4096
]
=
{
0
};
taosUcs4ToMbs
(
val
,
pModel
->
pFields
[
j
].
field
.
bytes
,
buf
);
int32_t
len
=
taosUcs4ToMbs
(
val
,
pModel
->
pFields
[
j
].
field
.
bytes
,
buf
);
if
(
len
<
0
){
qError
(
"castConvert1 taosUcs4ToMbs error"
);
}
printf
(
"%s
\t
"
,
buf
);
break
;
}
...
...
@@ -1092,7 +1095,10 @@ void tColModelDisplayEx(SColumnModel *pModel, void *pData, int32_t numOfRows, in
break
;
case
TSDB_DATA_TYPE_NCHAR
:
{
char
buf
[
128
]
=
{
0
};
taosUcs4ToMbs
(
val
,
pModel
->
pFields
[
j
].
field
.
bytes
,
buf
);
int32_t
len
=
taosUcs4ToMbs
(
val
,
pModel
->
pFields
[
j
].
field
.
bytes
,
buf
);
if
(
len
<
0
){
qError
(
"castConvert1 taosUcs4ToMbs error"
);
}
printf
(
"%s
\t
"
,
buf
);
break
;
}
...
...
src/query/src/qFilter.c
浏览文件 @
de5be9ef
...
...
@@ -1899,12 +1899,20 @@ int32_t filterInitValFieldData(SFilterInfo *info) {
(
unit
->
compare
.
optr
==
TSDB_RELATION_MATCH
||
unit
->
compare
.
optr
==
TSDB_RELATION_NMATCH
)){
char
newValData
[
TSDB_REGEX_STRING_DEFAULT_LEN
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
len
=
taosUcs4ToMbs
(
varDataVal
(
fi
->
data
),
varDataLen
(
fi
->
data
),
varDataVal
(
newValData
));
if
(
len
<
0
){
qError
(
"filterInitValFieldData taosUcs4ToMbs error 1"
);
return
TSDB_CODE_FAILED
;
}
varDataSetLen
(
newValData
,
len
);
varDataCopy
(
fi
->
data
,
newValData
);
}
else
if
(
type
==
TSDB_DATA_TYPE_JSON
&&
(
unit
->
compare
.
optr
==
TSDB_RELATION_MATCH
||
unit
->
compare
.
optr
==
TSDB_RELATION_NMATCH
)){
char
newValData
[
TSDB_REGEX_STRING_DEFAULT_LEN
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
]
=
{
0
};
int32_t
len
=
taosUcs4ToMbs
(((
tVariant
*
)(
fi
->
desc
))
->
pz
,
((
tVariant
*
)(
fi
->
desc
))
->
nLen
,
newValData
);
if
(
len
<
0
){
qError
(
"filterInitValFieldData taosUcs4ToMbs error 2"
);
return
TSDB_CODE_FAILED
;
}
memcpy
(((
tVariant
*
)(
fi
->
desc
))
->
pz
,
newValData
,
len
);
((
tVariant
*
)(
fi
->
desc
))
->
nLen
=
len
;
}
...
...
@@ -3025,6 +3033,11 @@ static void doJsonCompare(SFilterComUnit *cunit, int8_t *result, void* colData){
}
else
{
char
*
newColData
=
calloc
(
cunit
->
dataSize
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
,
1
);
int
len
=
taosUcs4ToMbs
(
varDataVal
(
realData
),
varDataLen
(
realData
),
varDataVal
(
newColData
));
if
(
len
<
0
){
qError
(
"castConvert1 taosUcs4ToMbs error"
);
tfree
(
newColData
);
return
;
}
varDataSetLen
(
newColData
,
len
);
tVariant
*
val
=
cunit
->
valData
;
char
newValData
[
TSDB_REGEX_STRING_DEFAULT_LEN
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
]
=
{
0
};
...
...
@@ -3113,9 +3126,13 @@ bool filterExecuteImplMisc(void *pinfo, int32_t numOfRows, int8_t** p, SDataStat
if
(
info
->
cunits
[
uidx
].
dataType
==
TSDB_DATA_TYPE_NCHAR
&&
(
info
->
cunits
[
uidx
].
optr
==
TSDB_RELATION_MATCH
||
info
->
cunits
[
uidx
].
optr
==
TSDB_RELATION_NMATCH
)){
char
*
newColData
=
calloc
(
info
->
cunits
[
uidx
].
dataSize
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
,
1
);
int
len
=
taosUcs4ToMbs
(
varDataVal
(
colData
),
varDataLen
(
colData
),
varDataVal
(
newColData
));
varDataSetLen
(
newColData
,
len
);
(
*
p
)[
i
]
=
filterDoCompare
(
gDataCompare
[
info
->
cunits
[
uidx
].
func
],
info
->
cunits
[
uidx
].
optr
,
newColData
,
info
->
cunits
[
uidx
].
valData
);
int32_t
len
=
taosUcs4ToMbs
(
varDataVal
(
colData
),
varDataLen
(
colData
),
varDataVal
(
newColData
));
if
(
len
<
0
){
qError
(
"castConvert1 taosUcs4ToMbs error"
);
}
else
{
varDataSetLen
(
newColData
,
len
);
(
*
p
)[
i
]
=
filterDoCompare
(
gDataCompare
[
info
->
cunits
[
uidx
].
func
],
info
->
cunits
[
uidx
].
optr
,
newColData
,
info
->
cunits
[
uidx
].
valData
);
}
tfree
(
newColData
);
}
else
if
(
info
->
cunits
[
uidx
].
dataType
==
TSDB_DATA_TYPE_JSON
){
doJsonCompare
(
&
(
info
->
cunits
[
uidx
]),
&
(
*
p
)[
i
],
colData
);
...
...
@@ -3170,9 +3187,13 @@ bool filterExecuteImpl(void *pinfo, int32_t numOfRows, int8_t** p, SDataStatis *
}
else
{
if
(
cunit
->
dataType
==
TSDB_DATA_TYPE_NCHAR
&&
(
cunit
->
optr
==
TSDB_RELATION_MATCH
||
cunit
->
optr
==
TSDB_RELATION_NMATCH
)){
char
*
newColData
=
calloc
(
cunit
->
dataSize
*
TSDB_NCHAR_SIZE
+
VARSTR_HEADER_SIZE
,
1
);
int
len
=
taosUcs4ToMbs
(
varDataVal
(
colData
),
varDataLen
(
colData
),
varDataVal
(
newColData
));
varDataSetLen
(
newColData
,
len
);
(
*
p
)[
i
]
=
filterDoCompare
(
gDataCompare
[
cunit
->
func
],
cunit
->
optr
,
newColData
,
cunit
->
valData
);
int32_t
len
=
taosUcs4ToMbs
(
varDataVal
(
colData
),
varDataLen
(
colData
),
varDataVal
(
newColData
));
if
(
len
<
0
){
qError
(
"castConvert1 taosUcs4ToMbs error"
);
}
else
{
varDataSetLen
(
newColData
,
len
);
(
*
p
)[
i
]
=
filterDoCompare
(
gDataCompare
[
cunit
->
func
],
cunit
->
optr
,
newColData
,
cunit
->
valData
);
}
tfree
(
newColData
);
}
else
if
(
cunit
->
dataType
==
TSDB_DATA_TYPE_JSON
){
doJsonCompare
(
cunit
,
&
(
*
p
)[
i
],
colData
);
...
...
@@ -3577,7 +3598,11 @@ int32_t filterConverNcharColumns(SFilterInfo* info, int32_t rows, bool *gotNchar
char
*
src
=
FILTER_GET_COL_FIELD_DATA
(
fi
,
j
);
char
*
dst
=
FILTER_GET_COL_FIELD_DATA
(
&
nfi
,
j
);
int32_t
len
=
0
;
taosMbsToUcs4
(
varDataVal
(
src
),
varDataLen
(
src
),
varDataVal
(
dst
),
bufSize
,
&
len
);
bool
ret
=
taosMbsToUcs4
(
varDataVal
(
src
),
varDataLen
(
src
),
varDataVal
(
dst
),
bufSize
,
&
len
);
if
(
!
ret
)
{
qError
(
"filterConverNcharColumns taosMbsToUcs4 error"
);
return
TSDB_CODE_FAILED
;
}
varDataLen
(
dst
)
=
len
;
}
...
...
src/tsdb/src/tsdbMeta.c
浏览文件 @
de5be9ef
...
...
@@ -1463,6 +1463,7 @@ static void *tsdbDecodeTable(void *buf, STable **pRTable) {
tsdbFreeTable
(
pTable
);
return
NULL
;
}
taosHashSetFreeFp
(
pTable
->
jsonKeyMap
,
taosArrayDestroyForHash
);
}
else
{
pTable
->
pIndex
=
tSkipListCreate
(
TSDB_SUPER_TABLE_SL_LEVEL
,
colType
(
pCol
),
(
uint8_t
)(
colBytes
(
pCol
)),
NULL
,
SL_ALLOW_DUP_KEY
,
getTagIndexKey
);
...
...
src/tsdb/src/tsdbRead.c
浏览文件 @
de5be9ef
...
...
@@ -4243,20 +4243,28 @@ char* parseTagDatatoJson(void *p){
}
cJSON_AddItemToObject
(
json
,
tagJsonKey
,
value
);
}
else
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
tagJsonValue
=
calloc
(
varDataLen
(
realData
),
1
);
int32_t
length
=
taosUcs4ToMbs
(
varDataVal
(
realData
),
varDataLen
(
realData
),
tagJsonValue
);
if
(
length
<
0
)
{
tsdbError
(
"charset:%s to %s. val:%s convert json value failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
val
);
cJSON
*
value
=
NULL
;
if
(
varDataLen
(
realData
)
>
0
){
char
*
tagJsonValue
=
calloc
(
varDataLen
(
realData
),
1
);
int32_t
length
=
taosUcs4ToMbs
(
varDataVal
(
realData
),
varDataLen
(
realData
),
tagJsonValue
);
if
(
length
<
0
)
{
tsdbError
(
"charset:%s to %s. val:%s convert json value failed."
,
DEFAULT_UNICODE_ENCODEC
,
tsCharset
,
(
char
*
)
val
);
free
(
tagJsonValue
);
goto
end
;
}
value
=
cJSON_CreateString
(
tagJsonValue
);
free
(
tagJsonValue
);
goto
end
;
}
cJSON
*
value
=
cJSON_CreateString
(
tagJsonValue
);
free
(
tagJsonValue
);
if
(
value
==
NULL
)
{
goto
end
;
if
(
value
==
NULL
)
{
goto
end
;
}
}
else
if
(
varDataLen
(
realData
)
==
0
){
value
=
cJSON_CreateString
(
""
);
}
else
{
assert
(
0
);
}
cJSON_AddItemToObject
(
json
,
tagJsonKey
,
value
);
}
else
if
(
type
==
TSDB_DATA_TYPE_DOUBLE
){
double
jsonVd
=
*
(
double
*
)(
realData
);
...
...
src/util/src/terror.c
浏览文件 @
de5be9ef
...
...
@@ -282,7 +282,6 @@ TAOS_DEFINE_ERROR(TSDB_CODE_TDB_MESSED_MSG, "TSDB messed message")
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_IVLD_TAG_VAL
,
"TSDB invalid tag value"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_NO_CACHE_LAST_ROW
,
"TSDB no cache last row data"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_INCOMPLETE_DFILESET
,
"Incomplete DFileSet"
)
TAOS_DEFINE_ERROR
(
TSDB_CODE_TDB_NO_JSON_TAG_KEY
,
"TSDB no tag json key"
)
// query
TAOS_DEFINE_ERROR
(
TSDB_CODE_QRY_INVALID_QHANDLE
,
"Invalid handle"
)
...
...
tests/system-test/2-query/TD-11256.py
0 → 100644
浏览文件 @
de5be9ef
###################################################################
# Copyright (c) 2020 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
import
taos
import
time
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
__init__
(
self
):
self
.
err_case
=
0
self
.
curret_case
=
0
def
caseDescription
(
self
):
'''
case1 <cpwu>: [TD-11256] query the super table in a mixed way of expression + tbanme and using group by tbname
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
create_stb
(
self
):
basetime
=
int
(
round
(
time
.
time
()
*
1000
))
tdSql
.
prepare
()
tdSql
.
execute
(
f
"create stable stb1(ts timestamp, c1 int) tags (tag1 int)"
)
for
i
in
range
(
10
):
tdSql
.
execute
(
f
"create table t
{
i
}
using stb1 tags(
{
i
}
)"
)
tdSql
.
execute
(
f
"insert into t
{
i
}
values (
{
basetime
}
,
{
i
}
)"
)
pass
def
check_td11256
(
self
):
# this case expect connect is current after run group by sql
tdSql
.
query
(
"select count(*) from stb1 group by ts"
)
try
:
tdSql
.
error
(
"select c1/2, tbname from stb1 group by tbname"
)
tdSql
.
query
(
"show databases"
)
self
.
curret_case
+=
1
tdLog
.
printNoPrefix
(
"the case1: td-11256 run passed"
)
except
:
self
.
err_case
+=
1
tdLog
.
printNoPrefix
(
"the case1: td-11256 run failed"
)
pass
def
run
(
self
):
self
.
create_stb
()
self
.
check_td11256
()
if
self
.
err_case
>
0
:
tdLog
.
exit
(
f
"
{
self
.
err_case
}
case for TD-11256 run failed"
)
else
:
tdLog
.
success
(
"case for TD-11256 run passed"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/4-taosAdapter/TD-12163.py
0 → 100644
浏览文件 @
de5be9ef
###################################################################
# Copyright (c) 2020 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from taosdata
#
###################################################################
# -*- coding: utf-8 -*-
import
taos
import
time
import
requests
from
util.log
import
*
from
util.cases
import
*
from
util.sql
import
*
from
util.dnodes
import
*
class
TDTestCase
:
def
__init__
(
self
):
self
.
err_case
=
0
self
.
curret_case
=
0
self
.
url
=
"http://127.0.0.1:6041/rest/sql"
self
.
header
=
{
'Authorization'
:
'Basic cm9vdDp0YW9zZGF0YQ=='
}
def
caseDescription
(
self
):
'''
case1 <cpwu>: [TD-12163] alter table-schema using restful interface
'''
return
def
init
(
self
,
conn
,
logSql
):
tdLog
.
debug
(
"start to execute %s"
%
__file__
)
tdSql
.
init
(
conn
.
cursor
(),
logSql
)
def
check_td12163
(
self
):
# basetime = int(round(time.time() * 1000))
tdSql
.
prepare
()
tdSql
.
execute
(
f
"create stable stb1(ts timestamp, c1 int) tags (tag1 int)"
)
tdSql
.
execute
(
f
"create table nt1 (nts timestamp, nc1 int)"
)
add_column_stb
=
"alter table db.stb1 add column c2 float"
drop_column_stb
=
"alter table db.stb1 drop column c2 "
add_column_ntb
=
"alter table db.nt1 add column nc2 float"
drop_column_ntb
=
"alter table db.nt1 drop column nc2 "
conn_add_stb
=
requests
.
post
(
url
=
self
.
url
,
headers
=
self
.
header
,
data
=
add_column_stb
)
resp_code_stb_add
=
conn_add_stb
.
status_code
resp_add_stb
=
conn_add_stb
.
json
()
try
:
assert
resp_code_stb_add
//
200
==
1
assert
resp_add_stb
[
"status"
]
==
"succ"
self
.
curret_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to stable successful"
)
except
:
self
.
err_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to stable failed"
)
conn_add_ntb
=
requests
.
post
(
url
=
self
.
url
,
headers
=
self
.
header
,
data
=
add_column_ntb
)
resp_code_ntb_add
=
conn_add_ntb
.
status_code
resp_add_ntb
=
conn_add_ntb
.
json
()
try
:
assert
resp_code_ntb_add
//
200
==
1
assert
resp_add_ntb
[
"status"
]
==
"succ"
self
.
curret_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to normal table successful"
)
except
:
self
.
err_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to normal table failed"
)
conn_drop_stb
=
requests
.
post
(
url
=
self
.
url
,
headers
=
self
.
header
,
data
=
drop_column_stb
)
resp_code_stb_drop
=
conn_drop_stb
.
status_code
resp_drop_stb
=
conn_drop_stb
.
json
()
try
:
assert
resp_code_stb_drop
//
200
==
1
assert
resp_drop_stb
[
"status"
]
==
"succ"
self
.
curret_case
+=
1
tdLog
.
printNoPrefix
(
"the case drop column to stable successful"
)
except
:
self
.
err_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to stable failed"
)
conn_drop_ntb
=
requests
.
post
(
url
=
self
.
url
,
headers
=
self
.
header
,
data
=
drop_column_ntb
)
resp_code_ntb_drop
=
conn_drop_ntb
.
status_code
resp_drop_ntb
=
conn_drop_ntb
.
json
()
try
:
assert
resp_code_ntb_drop
//
200
==
1
assert
resp_drop_ntb
[
"status"
]
==
"succ"
self
.
curret_case
+=
1
tdLog
.
printNoPrefix
(
"the case drop column to stable successful"
)
except
:
self
.
err_case
+=
1
tdLog
.
printNoPrefix
(
"the case add column to stable failed"
)
pass
def
run
(
self
):
self
.
check_td12163
()
if
self
.
err_case
>
0
:
tdLog
.
exit
(
f
"
{
self
.
err_case
}
case for TD-12163 run failed"
)
else
:
tdLog
.
success
(
"case for TD-12163 run passed"
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
"%s successfully executed"
%
__file__
)
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
\ No newline at end of file
tests/system-test/fulltest-query.sh
浏览文件 @
de5be9ef
python3 ./test.py
-f
2-query/ts_hidden_column.py
python3 ./test.py
-f
2-query/union-order.py
python3 test.py
-f
2-query/TD-11256.py
python3 ./test.py
-f
2-query/TD-11389.py
python3 ./test.py
-f
2-query/TD-11945_crash.py
python3 ./test.py
-f
2-query/TD-12340-12342.py
...
...
tests/system-test/fulltest-taosAdapter.sh
浏览文件 @
de5be9ef
python3 test.py
-f
4-taosAdapter/TD-12163.py
python3 ./test.py
-f
4-taosAdapter/taosAdapter_insert.py
python3 ./test.py
-f
4-taosAdapter/taosAdapter_query.py
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录