Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
b5e4861c
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1187
Star
22018
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看板
提交
b5e4861c
编写于
1月 12, 2023
作者:
wmmhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:add test cases for odbc interface
上级
8af5230b
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
153 addition
and
4 deletion
+153
-4
source/client/src/clientMain.c
source/client/src/clientMain.c
+2
-4
tests/parallel_test/cases.task
tests/parallel_test/cases.task
+1
-0
tests/system-test/2-query/odbc.py
tests/system-test/2-query/odbc.py
+76
-0
utils/test/c/CMakeLists.txt
utils/test/c/CMakeLists.txt
+9
-0
utils/test/c/get_db_name_test.c
utils/test/c/get_db_name_test.c
+65
-0
未找到文件。
source/client/src/clientMain.c
浏览文件 @
b5e4861c
...
...
@@ -698,10 +698,8 @@ int taos_get_current_db(TAOS *taos, char *database, int len, int *required) {
if
(
database
==
NULL
||
len
<=
0
){
if
(
required
!=
NULL
)
*
required
=
strlen
(
pTscObj
->
db
)
+
1
;
terrno
=
TSDB_CODE_INVALID_PARA
;
return
-
1
;
}
if
(
len
<
strlen
(
pTscObj
->
db
)
+
1
){
code
=
-
1
;
}
else
if
(
len
<
strlen
(
pTscObj
->
db
)
+
1
){
tstrncpy
(
database
,
pTscObj
->
db
,
len
);
if
(
required
)
*
required
=
strlen
(
pTscObj
->
db
)
+
1
;
terrno
=
TSDB_CODE_INVALID_PARA
;
...
...
tests/parallel_test/cases.task
浏览文件 @
b5e4861c
...
...
@@ -1044,6 +1044,7 @@
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_null_none.py -Q 3
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/insert_null_none.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/blockSMA.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 2-query/odbc.py
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-21561.py -Q 4
,,y,system-test,./pytest.sh python3 ./test.py -f 99-TDcase/TD-20582.py
...
...
tests/system-test/2-query/odbc.py
0 → 100644
浏览文件 @
b5e4861c
import
taos
import
sys
import
datetime
import
inspect
from
util.log
import
*
from
util.sql
import
*
from
util.cases
import
*
from
util.common
import
tdCom
class
TDTestCase
:
def
init
(
self
,
conn
,
logSql
,
replicaVar
=
1
):
self
.
replicaVar
=
int
(
replicaVar
)
tdLog
.
debug
(
f
"start to excute
{
__file__
}
"
)
tdSql
.
init
(
conn
.
cursor
(),
False
)
def
check_ins_cols
(
self
):
tdSql
.
execute
(
"create database if not exists db"
)
tdSql
.
execute
(
"create table db.ntb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 int unsigned, c9 bigint unsigned, c10 float, c11 double, c12 varchar(100), c13 nchar(100))"
)
tdSql
.
execute
(
"create table db.stb (ts timestamp, c1 bool, c2 tinyint, c3 smallint, c4 int, c5 bigint, c6 tinyint unsigned, c7 smallint unsigned, c8 int unsigned, c9 bigint unsigned, c10 float, c11 double, c12 varchar(100), c13 nchar(100)) tags(t int)"
)
tdSql
.
execute
(
"insert into db.ctb using db.stb tags(1) (ts, c1) values (now, 1)"
)
tdSql
.
query
(
"select count(*) from information_schema.ins_columns"
)
tdSql
.
checkData
(
0
,
0
,
265
)
tdSql
.
query
(
"select * from information_schema.ins_columns where table_name = 'ntb'"
)
tdSql
.
checkRows
(
14
)
tdSql
.
checkData
(
0
,
2
,
"NORMAL_TABLE"
)
tdSql
.
query
(
"select * from information_schema.ins_columns where table_name = 'stb'"
)
tdSql
.
checkRows
(
14
)
tdSql
.
checkData
(
0
,
2
,
"SUPER_TABLE"
)
tdSql
.
query
(
"select db_name,table_type,col_name,col_type,col_length from information_schema.ins_columns where table_name = 'ctb'"
)
tdSql
.
checkRows
(
14
)
tdSql
.
checkData
(
0
,
0
,
"db"
)
tdSql
.
checkData
(
1
,
1
,
"CHILD_TABLE"
)
tdSql
.
checkData
(
3
,
2
,
"c3"
)
tdSql
.
checkData
(
4
,
3
,
"INT"
)
tdSql
.
checkData
(
5
,
4
,
8
)
tdSql
.
query
(
"desc information_schema.ins_columns"
)
tdSql
.
checkRows
(
9
)
tdSql
.
checkData
(
0
,
0
,
"table_name"
)
tdSql
.
checkData
(
5
,
0
,
"col_length"
)
tdSql
.
checkData
(
1
,
2
,
64
)
def
check_get_db_name
(
self
):
buildPath
=
tdCom
.
getBuildPath
()
cmdStr
=
'%s/build/bin/get_db_name_test'
%
(
buildPath
)
tdLog
.
info
(
cmdStr
)
ret
=
os
.
system
(
cmdStr
)
if
ret
!=
0
:
tdLog
.
exit
(
"sml_test get_db_name_test != 0"
)
def
run
(
self
):
# sourcery skip: extract-duplicate-method, remove-redundant-fstring
tdSql
.
prepare
(
replica
=
self
.
replicaVar
)
tdLog
.
printNoPrefix
(
"==========start check_ins_cols run ..............."
)
self
.
check_ins_cols
()
tdLog
.
printNoPrefix
(
"==========end check_ins_cols run ..............."
)
tdLog
.
printNoPrefix
(
"==========start check_get_db_name run ..............."
)
self
.
check_get_db_name
()
tdLog
.
printNoPrefix
(
"==========end check_get_db_name run ..............."
)
def
stop
(
self
):
tdSql
.
close
()
tdLog
.
success
(
f
"
{
__file__
}
successfully executed"
)
tdCases
.
addLinux
(
__file__
,
TDTestCase
())
tdCases
.
addWindows
(
__file__
,
TDTestCase
())
utils/test/c/CMakeLists.txt
浏览文件 @
b5e4861c
...
...
@@ -4,6 +4,7 @@ add_executable(tmq_sim tmqSim.c)
add_executable
(
create_table createTable.c
)
add_executable
(
tmq_taosx_ci tmq_taosx_ci.c
)
add_executable
(
sml_test sml_test.c
)
add_executable
(
get_db_name_test get_db_name_test.c
)
target_link_libraries
(
create_table
PUBLIC taos_static
...
...
@@ -40,3 +41,11 @@ target_link_libraries(
PUBLIC common
PUBLIC os
)
target_link_libraries
(
get_db_name_test
PUBLIC taos_static
PUBLIC util
PUBLIC common
PUBLIC os
)
utils/test/c/get_db_name_test.c
0 → 100644
浏览文件 @
b5e4861c
/*
* Copyright (c) 2019 TAOS Data, Inc. <jhtao@taosdata.com>
*
* This program is free software: you can use, redistribute, and/or modify
* it under the terms of the GNU Affero General Public License, version 3
* or later ("AGPL"), as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "taos.h"
#include "types.h"
#include "tlog.h"
int
get_db_test
()
{
TAOS
*
taos
=
taos_connect
(
"localhost"
,
"root"
,
"taosdata"
,
NULL
,
0
);
TAOS_RES
*
pRes
=
taos_query
(
taos
,
"create database if not exists sml_db"
);
taos_free_result
(
pRes
);
pRes
=
taos_query
(
taos
,
"use sml_db"
);
int
code
=
taos_errno
(
pRes
);
taos_free_result
(
pRes
);
ASSERT
(
code
==
0
);
code
=
taos_get_current_db
(
taos
,
NULL
,
0
,
NULL
);
ASSERT
(
code
!=
0
);
int
required
=
0
;
code
=
taos_get_current_db
(
taos
,
NULL
,
0
,
&
required
);
ASSERT
(
code
!=
0
);
ASSERT
(
required
==
7
);
char
database
[
10
]
=
{
0
};
code
=
taos_get_current_db
(
taos
,
database
,
3
,
&
required
);
ASSERT
(
code
!=
0
);
ASSERT
(
required
==
7
);
ASSERT
(
strcpy
(
database
,
"sm"
));
char
database1
[
10
]
=
{
0
};
code
=
taos_get_current_db
(
taos
,
database1
,
10
,
&
required
);
ASSERT
(
code
==
0
);
ASSERT
(
strcpy
(
database1
,
"sml_db"
));
taos_close
(
taos
);
return
code
;
}
int
main
(
int
argc
,
char
*
argv
[])
{
int
ret
=
0
;
ret
=
get_db_test
();
ASSERT
(
!
ret
);
return
ret
;
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录