Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
3f47643d
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看板
提交
3f47643d
编写于
12月 11, 2021
作者:
wmmhello
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'develop' into feature/TD-6129
上级
c1a45f35
2c642daf
变更
10
显示空白变更内容
内联
并排
Showing
10 changed file
with
64 addition
and
41 deletion
+64
-41
Jenkinsfile
Jenkinsfile
+29
-10
packaging/cfg/taosd.service
packaging/cfg/taosd.service
+2
-2
src/client/src/tscParseLineProtocol.c
src/client/src/tscParseLineProtocol.c
+1
-9
src/client/src/tscServer.c
src/client/src/tscServer.c
+5
-1
src/connector/python/examples/subscribe-async.py
src/connector/python/examples/subscribe-async.py
+9
-6
src/connector/python/taos/cinterface.py
src/connector/python/taos/cinterface.py
+4
-6
src/connector/python/taos/field.py
src/connector/python/taos/field.py
+3
-3
src/connector/python/taos/result.py
src/connector/python/taos/result.py
+7
-1
src/connector/python/tests/test_stream.py
src/connector/python/tests/test_stream.py
+2
-1
src/connector/python/tests/test_subscribe.py
src/connector/python/tests/test_subscribe.py
+2
-2
未找到文件。
Jenkinsfile
浏览文件 @
3f47643d
...
...
@@ -456,6 +456,25 @@ pipeline {
nohup taosd >/dev/null &
sleep 10
'''
sh
'''
cd ${WKC}/src/connector/python
export PYTHONPATH=$PWD/
export LD_LIBRARY_PATH=${WKC}/debug/build/lib
pip3 install pytest
pytest tests/
python3 examples/bind-multi.py
python3 examples/bind-row.py
python3 examples/demo.py
python3 examples/insert-lines.py
python3 examples/pep-249.py
python3 examples/query-async.py
python3 examples/query-objectively.py
python3 examples/subscribe-sync.py
python3 examples/subscribe-async.py
'''
sh
'''
cd ${WKC}/tests/examples/nodejs
npm install td2.0-connector > /dev/null 2>&1
...
...
@@ -464,13 +483,13 @@ pipeline {
cd ${WKC}/tests/connectorTest/nodejsTest/nanosupport
npm install td2.0-connector > /dev/null 2>&1
node nanosecondTest.js
'''
catchError
(
buildResult:
'SUCCESS'
,
stageResult:
'FAILURE'
)
{
sh
'''
cd ${WKC}/tests/examples/C#/taosdemo
mcs -out:taosdemo *.cs > /dev/null 2>&1
echo '' |./taosdemo -c /etc/taos
dotnet build -c Release
tree | true
./bin/Release/net5.0/taosdemo -c /etc/taos -y
'''
}
sh
'''
...
...
packaging/cfg/taosd.service
浏览文件 @
3f47643d
[Unit]
Description
=
TDengine server service
After
=
network-online.target
Wants
=
network-online.target
After
=
network-online.target
taosadapter.service
Wants
=
network-online.target
taosadapter.service
[Service]
Type
=
simple
...
...
src/client/src/tscParseLineProtocol.c
浏览文件 @
3f47643d
...
...
@@ -886,7 +886,7 @@ static int32_t applyChildTableDataPointsWithInsertSQL(TAOS* taos, char* cTableNa
TAOS_RES
*
res
=
taos_query
(
taos
,
sql
);
free
(
sql
);
code
=
taos_errno
(
res
);
info
->
affectedRows
=
taos_affected_rows
(
res
);
info
->
affectedRows
+
=
taos_affected_rows
(
res
);
taos_free_result
(
res
);
return
code
;
}
...
...
@@ -1302,14 +1302,6 @@ clean_up:
return
code
;
}
int
tsc_sml_insert
(
TAOS
*
taos
,
TAOS_SML_DATA_POINT
*
points
,
int
numPoint
)
{
SSmlLinesInfo
*
info
=
calloc
(
1
,
sizeof
(
SSmlLinesInfo
));
info
->
id
=
genLinesSmlId
();
int
code
=
tscSmlInsert
(
taos
,
points
,
numPoint
,
info
);
free
(
info
);
return
code
;
}
//=========================================================================
/* Field Escape charaters
...
...
src/client/src/tscServer.c
浏览文件 @
3f47643d
...
...
@@ -2806,7 +2806,11 @@ static int32_t getTableMetaFromMnode(SSqlObj *pSql, STableMetaInfo *pTableMetaIn
tscAddQueryInfo
(
&
pNew
->
cmd
);
SQueryInfo
*
pNewQueryInfo
=
tscGetQueryInfoS
(
&
pNew
->
cmd
);
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
pNew
->
cmd
,
TSDB_DEFAULT_PAYLOAD_SIZE
+
pSql
->
cmd
.
payloadLen
))
{
int
payLoadLen
=
TSDB_DEFAULT_PAYLOAD_SIZE
+
pSql
->
cmd
.
payloadLen
;
if
(
autocreate
&&
pSql
->
cmd
.
insertParam
.
tagData
.
dataLen
!=
0
)
{
payLoadLen
+=
pSql
->
cmd
.
insertParam
.
tagData
.
dataLen
;
}
if
(
TSDB_CODE_SUCCESS
!=
tscAllocPayload
(
&
pNew
->
cmd
,
payLoadLen
))
{
tscError
(
"0x%"
PRIx64
" malloc failed for payload to get table meta"
,
pSql
->
self
);
tscFreeSqlObj
(
pNew
);
...
...
src/connector/python/examples/subscribe-async.py
浏览文件 @
3f47643d
...
...
@@ -7,7 +7,7 @@ import time
def
subscribe_callback
(
p_sub
,
p_result
,
p_param
,
errno
):
# type: (c_void_p, c_void_p, c_void_p, c_int) -> None
print
(
"# fetch in callback"
)
result
=
TaosResult
(
p_result
)
result
=
TaosResult
(
c_void_p
(
p_result
)
)
result
.
check_error
(
errno
)
for
row
in
result
.
rows_iter
():
ts
,
n
=
row
()
...
...
@@ -18,18 +18,21 @@ def test_subscribe_callback(conn):
# type: (TaosConnection) -> None
dbname
=
"pytest_taos_subscribe_callback"
try
:
print
(
"drop if exists"
)
conn
.
execute
(
"drop database if exists %s"
%
dbname
)
print
(
"create database"
)
conn
.
execute
(
"create database if not exists %s"
%
dbname
)
conn
.
select_db
(
dbname
)
conn
.
execute
(
"create table if not exists log(ts timestamp, n int)"
)
print
(
"create table"
)
# conn.execute("use %s" % dbname)
conn
.
execute
(
"create table if not exists %s.log(ts timestamp, n int)"
%
dbname
)
print
(
"# subscribe with callback"
)
sub
=
conn
.
subscribe
(
False
,
"test"
,
"select * from
log"
,
1000
,
subscribe_callback
)
sub
=
conn
.
subscribe
(
False
,
"test"
,
"select * from
%s.log"
%
dbname
,
1000
,
subscribe_callback
)
for
i
in
range
(
10
):
conn
.
execute
(
"insert into
log values(now, %d)"
%
i
)
conn
.
execute
(
"insert into
%s.log values(now, %d)"
%
(
dbname
,
i
)
)
time
.
sleep
(
0.7
)
#
sub.close()
sub
.
close
()
conn
.
execute
(
"drop database if exists %s"
%
dbname
)
# conn.close()
...
...
src/connector/python/taos/cinterface.py
浏览文件 @
3f47643d
...
...
@@ -110,7 +110,7 @@ _libtaos.taos_get_client_info.restype = c_char_p
def
taos_get_client_info
():
# type: () -> str
"""Get client version info."""
return
_libtaos
.
taos_get_client_info
().
decode
()
return
_libtaos
.
taos_get_client_info
().
decode
(
"utf-8"
)
_libtaos
.
taos_get_server_info
.
restype
=
c_char_p
...
...
@@ -120,7 +120,7 @@ _libtaos.taos_get_server_info.argtypes = (c_void_p,)
def
taos_get_server_info
(
connection
):
# type: (c_void_p) -> str
"""Get server version as string."""
return
_libtaos
.
taos_get_server_info
(
connection
).
decode
()
return
_libtaos
.
taos_get_server_info
(
connection
).
decode
(
"utf-8"
)
_libtaos
.
taos_close
.
restype
=
None
...
...
@@ -308,16 +308,14 @@ def taos_subscribe(connection, restart, topic, sql, interval, callback=None, par
"""
if
callback
!=
None
:
callback
=
subscribe_callback_type
(
callback
)
if
param
!=
None
:
param
=
c_void_p
(
param
)
return
c_void_p
(
_libtaos
.
taos_subscribe
(
connection
,
1
if
restart
else
0
,
c_char_p
(
topic
.
encode
(
"utf-8"
)),
c_char_p
(
sql
.
encode
(
"utf-8"
)),
callback
or
None
,
param
,
callback
,
c_void_p
(
param
)
,
interval
,
)
)
...
...
src/connector/python/taos/field.py
浏览文件 @
3f47643d
...
...
@@ -144,7 +144,7 @@ def _crow_nchar_to_python(data, num_of_rows, nbytes=None, precision=FieldType.C_
try
:
if
num_of_rows
>=
0
:
tmpstr
=
ctypes
.
c_char_p
(
data
)
res
.
append
(
tmpstr
.
value
.
decode
())
res
.
append
(
tmpstr
.
value
.
decode
(
"utf-8"
))
else
:
res
.
append
(
(
...
...
@@ -172,7 +172,7 @@ def _crow_binary_to_python_block(data, num_of_rows, nbytes=None, precision=Field
if
rbyte
==
1
and
buffer
[
0
]
==
b
'
\xff
'
:
res
.
append
(
None
)
else
:
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
())
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
(
"utf-8"
))
return
res
...
...
@@ -188,7 +188,7 @@ def _crow_nchar_to_python_block(data, num_of_rows, nbytes=None, precision=FieldT
if
rbyte
==
4
and
buffer
[:
4
]
==
b
'
\xff
'
*
4
:
res
.
append
(
None
)
else
:
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
())
res
.
append
(
cast
(
buffer
,
c_char_p
).
value
.
decode
(
"utf-8"
))
return
res
...
...
src/connector/python/taos/result.py
浏览文件 @
3f47643d
...
...
@@ -3,6 +3,8 @@ from .cinterface import *
# from .connection import TaosConnection
from
.error
import
*
from
ctypes
import
c_void_p
class
TaosResult
(
object
):
"""TDengine result interface"""
...
...
@@ -12,7 +14,11 @@ class TaosResult(object):
# to make the __del__ order right
self
.
_conn
=
conn
self
.
_close_after
=
close_after
if
isinstance
(
result
,
c_void_p
):
self
.
_result
=
result
else
:
self
.
_result
=
c_void_p
(
result
)
self
.
_fields
=
None
self
.
_field_count
=
None
self
.
_precision
=
None
...
...
src/connector/python/tests/test_stream.py
浏览文件 @
3f47643d
...
...
@@ -20,7 +20,8 @@ def stream_callback(p_param, p_result, p_row):
result
=
TaosResult
(
p_result
)
row
=
TaosRow
(
result
,
p_row
)
try
:
ts
,
count
=
row
()
ts
,
count
=
row
.
as_tuple
()
print
(
ts
,
count
)
p
=
cast
(
p_param
,
POINTER
(
Counter
))
p
.
contents
.
count
+=
count
print
(
"[%s] inserted %d in 5s, total count: %d"
%
(
ts
.
strftime
(
"%Y-%m-%d %H:%M:%S"
),
count
,
p
.
contents
.
count
))
...
...
src/connector/python/tests/test_subscribe.py
浏览文件 @
3f47643d
...
...
@@ -63,7 +63,7 @@ def test_subscribe(conn):
def
subscribe_callback
(
p_sub
,
p_result
,
p_param
,
errno
):
# type: (c_void_p, c_void_p, c_void_p, c_int) -> None
print
(
"callback"
)
result
=
TaosResult
(
p_result
)
result
=
TaosResult
(
c_void_p
(
p_result
)
)
result
.
check_error
(
errno
)
for
row
in
result
.
rows_iter
():
ts
,
n
=
row
()
...
...
@@ -76,7 +76,7 @@ def test_subscribe_callback(conn):
try
:
conn
.
execute
(
"drop database if exists %s"
%
dbname
)
conn
.
execute
(
"create database if not exists %s"
%
dbname
)
conn
.
select_db
(
dbname
)
conn
.
execute
(
"use %s"
%
dbname
)
conn
.
execute
(
"create table if not exists log(ts timestamp, n int)"
)
print
(
"# subscribe with callback"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录