Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
e3e6f783
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看板
未验证
提交
e3e6f783
编写于
6月 09, 2022
作者:
H
Haojun Liao
提交者:
GitHub
6月 09, 2022
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #13634 from taosdata/feature/3_liaohj
refactor: do some internal refactor, and add a new api
上级
f3de6faa
840074df
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
28 addition
and
9 deletion
+28
-9
include/client/taos.h
include/client/taos.h
+1
-0
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-1
source/client/src/clientEnv.c
source/client/src/clientEnv.c
+2
-0
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+5
-1
source/client/src/clientMain.c
source/client/src/clientMain.c
+18
-7
未找到文件。
include/client/taos.h
浏览文件 @
e3e6f783
...
...
@@ -194,6 +194,7 @@ DLL_EXPORT int taos_errno(TAOS_RES *tres);
DLL_EXPORT
void
taos_query_a
(
TAOS
*
taos
,
const
char
*
sql
,
__taos_async_fn_t
fp
,
void
*
param
);
DLL_EXPORT
void
taos_fetch_rows_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
);
DLL_EXPORT
void
taos_fetch_raw_block_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
);
// Shuduo: temporary enable for app build
#if 1
...
...
source/client/inc/clientInt.h
浏览文件 @
e3e6f783
...
...
@@ -171,6 +171,7 @@ typedef struct SReqResultInfo {
uint32_t
current
;
bool
completed
;
int32_t
precision
;
bool
convertUcs4
;
int32_t
payloadLen
;
}
SReqResultInfo
;
...
...
@@ -222,7 +223,7 @@ typedef struct SSyncQueryParam {
SRequestObj
*
pRequest
;
}
SSyncQueryParam
;
void
*
doAsyncFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
void
*
doAsyncFetchRow
s
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
void
*
doFetchRows
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
void
doSetOneRowPtr
(
SReqResultInfo
*
pResultInfo
);
...
...
source/client/src/clientEnv.c
浏览文件 @
e3e6f783
...
...
@@ -191,6 +191,8 @@ void *createRequest(STscObj *pObj, int32_t type) {
pRequest
->
requestId
=
generateRequestId
();
pRequest
->
metric
.
start
=
taosGetTimestampUs
();
pRequest
->
body
.
resInfo
.
convertUcs4
=
true
;
// convert ucs4 by default
pRequest
->
type
=
type
;
pRequest
->
pTscObj
=
pObj
;
pRequest
->
msgBuf
=
taosMemoryCalloc
(
1
,
ERROR_MSG_BUF_DEFAULT_SIZE
);
...
...
source/client/src/clientImpl.c
浏览文件 @
e3e6f783
...
...
@@ -1114,7 +1114,7 @@ static void syncFetchFn(void* param, TAOS_RES* res, int32_t numOfRows) {
tsem_post
(
&
pParam
->
sem
);
}
void
*
doAsyncFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
void
*
doAsyncFetchRow
s
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
...
@@ -1126,6 +1126,10 @@ void* doAsyncFetchRow(SRequestObj* pRequest, bool setupOneRowPtr, bool convertUc
}
SSyncQueryParam
*
pParam
=
pRequest
->
body
.
param
;
// convert ucs4 to native multi-bytes string
pResultInfo
->
convertUcs4
=
convertUcs4
;
taos_fetch_rows_a
(
pRequest
,
syncFetchFn
,
pParam
);
tsem_wait
(
&
pParam
->
sem
);
}
...
...
source/client/src/clientMain.c
浏览文件 @
e3e6f783
...
...
@@ -219,14 +219,13 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
if
(
TD_RES_QUERY
(
res
))
{
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
#if SYNC_ON_TOP_OF_ASYNC
return
doAsyncFetchRows
(
pRequest
,
true
,
true
);
#else
if
(
pRequest
->
type
==
TSDB_SQL_RETRIEVE_EMPTY_RESULT
||
pRequest
->
type
==
TSDB_SQL_INSERT
||
pRequest
->
code
!=
TSDB_CODE_SUCCESS
||
taos_num_fields
(
res
)
==
0
)
{
return
NULL
;
}
#if SYNC_ON_TOP_OF_ASYNC
return
doAsyncFetchRow
(
pRequest
,
true
,
true
);
#else
return
doFetchRows
(
pRequest
,
true
,
true
);
#endif
...
...
@@ -489,6 +488,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
if
(
res
==
NULL
)
{
return
0
;
}
if
(
TD_RES_QUERY
(
res
))
{
SRequestObj
*
pRequest
=
(
SRequestObj
*
)
res
;
...
...
@@ -501,7 +501,7 @@ int taos_fetch_block_s(TAOS_RES *res, int *numOfRows, TAOS_ROW *rows) {
}
#if SYNC_ON_TOP_OF_ASYNC
doAsyncFetchRow
(
pRequest
,
false
,
true
);
doAsyncFetchRow
s
(
pRequest
,
false
,
true
);
#else
doFetchRows
(
pRequest
,
true
,
true
);
#endif
...
...
@@ -552,7 +552,11 @@ int taos_fetch_raw_block(TAOS_RES *res, int *numOfRows, void **pData) {
return
0
;
}
#if SYNC_ON_TOP_OF_ASYNC
doAsyncFetchRows
(
pRequest
,
false
,
false
);
#else
doFetchRows
(
pRequest
,
false
,
false
);
#endif
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
...
@@ -771,11 +775,11 @@ static void fetchCallback(void* pResult, void* param, int32_t code) {
}
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
pRequest
->
code
=
code
;
pRequest
->
body
.
fetchFp
(
pRequest
->
body
.
param
,
pRequest
,
0
);
return
;
}
pRequest
->
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResultInfo
->
pData
,
true
,
false
);
pRequest
->
code
=
setQueryResultFromRsp
(
pResultInfo
,
(
SRetrieveTableRsp
*
)
pResultInfo
->
pData
,
pResultInfo
->
convertUcs4
,
false
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
pResultInfo
->
numOfRows
=
0
;
pRequest
->
code
=
code
;
...
...
@@ -815,6 +819,13 @@ void taos_fetch_rows_a(TAOS_RES *res, __taos_async_fn_t fp, void *param) {
schedulerAsyncFetchRows
(
pRequest
->
body
.
queryJob
,
fetchCallback
,
pRequest
);
}
void
taos_fetch_raw_block_a
(
TAOS_RES
*
res
,
__taos_async_fn_t
fp
,
void
*
param
)
{
ASSERT
(
res
!=
NULL
&&
fp
!=
NULL
);
SRequestObj
*
pRequest
=
res
;
pRequest
->
body
.
resInfo
.
convertUcs4
=
false
;
taos_fetch_rows_a
(
res
,
fp
,
param
);
}
TAOS_SUB
*
taos_subscribe
(
TAOS
*
taos
,
int
restart
,
const
char
*
topic
,
const
char
*
sql
,
TAOS_SUBSCRIBE_CALLBACK
fp
,
void
*
param
,
int
interval
)
{
// TODO
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录