Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
8c27b944
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看板
提交
8c27b944
编写于
4月 11, 2022
作者:
H
Haojun Liao
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix[query]: disable the auto convert of ucs4 for taos_fetch_raw_block api.
上级
2624fa27
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
52 addition
and
43 deletion
+52
-43
source/client/inc/clientInt.h
source/client/inc/clientInt.h
+2
-2
source/client/src/clientImpl.c
source/client/src/clientImpl.c
+45
-36
source/client/src/clientMain.c
source/client/src/clientMain.c
+3
-3
source/client/src/clientMsgHandler.c
source/client/src/clientMsgHandler.c
+2
-2
未找到文件。
source/client/inc/clientInt.h
浏览文件 @
8c27b944
...
@@ -238,9 +238,9 @@ void initMsgHandleFp();
...
@@ -238,9 +238,9 @@ void initMsgHandleFp();
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
TAOS
*
taos_connect_internal
(
const
char
*
ip
,
const
char
*
user
,
const
char
*
pass
,
const
char
*
auth
,
const
char
*
db
,
uint16_t
port
);
uint16_t
port
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
);
void
*
doFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
);
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
);
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
,
bool
convertUcs4
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
int32_t
buildRequest
(
STscObj
*
pTscObj
,
const
char
*
sql
,
int
sqlLen
,
SRequestObj
**
pRequest
);
...
...
source/client/src/clientImpl.c
浏览文件 @
8c27b944
...
@@ -13,7 +13,7 @@
...
@@ -13,7 +13,7 @@
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
int32_t
initEpSetFromCfg
(
const
char
*
firstEp
,
const
char
*
secondEp
,
SCorEpSet
*
pEpSet
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
static
SMsgSendInfo
*
buildConnectMsg
(
SRequestObj
*
pRequest
);
static
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
);
static
void
destroySendMsgInfo
(
SMsgSendInfo
*
pMsgBody
);
static
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
);
static
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
);
static
bool
stringLengthCheck
(
const
char
*
str
,
size_t
maxsize
)
{
static
bool
stringLengthCheck
(
const
char
*
str
,
size_t
maxsize
)
{
if
(
str
==
NULL
)
{
if
(
str
==
NULL
)
{
...
@@ -176,7 +176,7 @@ int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
...
@@ -176,7 +176,7 @@ int32_t execLocalCmd(SRequestObj* pRequest, SQuery* pQuery) {
SRetrieveTableRsp
*
pRsp
=
NULL
;
SRetrieveTableRsp
*
pRsp
=
NULL
;
int32_t
code
=
qExecCommand
(
pQuery
->
pRoot
,
&
pRsp
);
int32_t
code
=
qExecCommand
(
pQuery
->
pRoot
,
&
pRsp
);
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pRsp
)
{
if
(
TSDB_CODE_SUCCESS
==
code
&&
NULL
!=
pRsp
)
{
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRsp
);
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
pRsp
,
false
);
}
}
return
code
;
return
code
;
}
}
...
@@ -616,7 +616,7 @@ static void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
...
@@ -616,7 +616,7 @@ static void doSetOneRowPtr(SReqResultInfo* pResultInfo) {
}
}
}
}
void
*
doFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
)
{
void
*
doFetchRow
(
SRequestObj
*
pRequest
,
bool
setupOneRowPtr
,
bool
convertUcs4
)
{
assert
(
pRequest
!=
NULL
);
assert
(
pRequest
!=
NULL
);
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
@@ -637,7 +637,7 @@ void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr) {
...
@@ -637,7 +637,7 @@ void* doFetchRow(SRequestObj* pRequest, bool setupOneRowPtr) {
return
NULL
;
return
NULL
;
}
}
pRequest
->
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResInfo
->
pData
);
pRequest
->
code
=
setQueryResultFromRsp
(
&
pRequest
->
body
.
resInfo
,
(
SRetrieveTableRsp
*
)
pResInfo
->
pData
,
convertUcs4
);
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
if
(
pRequest
->
code
!=
TSDB_CODE_SUCCESS
)
{
pResultInfo
->
numOfRows
=
0
;
pResultInfo
->
numOfRows
=
0
;
return
NULL
;
return
NULL
;
...
@@ -735,7 +735,42 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) {
...
@@ -735,7 +735,42 @@ static int32_t doPrepareResPtr(SReqResultInfo* pResInfo) {
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
}
}
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
)
{
static
int32_t
doConvertUCS4
(
SReqResultInfo
*
pResultInfo
,
int32_t
numOfRows
,
int32_t
numOfCols
,
int32_t
*
colLength
)
{
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
int32_t
type
=
pResultInfo
->
fields
[
i
].
type
;
int32_t
bytes
=
pResultInfo
->
fields
[
i
].
bytes
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
colLength
[
i
]);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
pResultInfo
->
convertBuf
[
i
]
=
p
;
SResultColumn
*
pCol
=
&
pResultInfo
->
pCol
[
i
];
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
)
{
if
(
pCol
->
offset
[
j
]
!=
-
1
)
{
char
*
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
ASSERT
(
len
<=
bytes
);
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
}
}
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
}
}
return
TSDB_CODE_SUCCESS
;
}
int32_t
setResultDataPtr
(
SReqResultInfo
*
pResultInfo
,
TAOS_FIELD
*
pFields
,
int32_t
numOfCols
,
int32_t
numOfRows
,
bool
convertUcs4
)
{
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
assert
(
numOfCols
>
0
&&
pFields
!=
NULL
&&
pResultInfo
!=
NULL
);
if
(
numOfRows
==
0
)
{
if
(
numOfRows
==
0
)
{
return
TSDB_CODE_SUCCESS
;
return
TSDB_CODE_SUCCESS
;
...
@@ -767,37 +802,11 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
...
@@ -767,37 +802,11 @@ int32_t setResultDataPtr(SReqResultInfo* pResultInfo, TAOS_FIELD* pFields, int32
}
}
// convert UCS4-LE encoded character to native multi-bytes character in current data block.
// convert UCS4-LE encoded character to native multi-bytes character in current data block.
for
(
int32_t
i
=
0
;
i
<
numOfCols
;
++
i
)
{
if
(
convertUcs4
)
{
int32_t
type
=
pResultInfo
->
fields
[
i
].
type
;
code
=
doConvertUCS4
(
pResultInfo
,
numOfRows
,
numOfCols
,
colLength
);
int32_t
bytes
=
pResultInfo
->
fields
[
i
].
bytes
;
if
(
type
==
TSDB_DATA_TYPE_NCHAR
)
{
char
*
p
=
taosMemoryRealloc
(
pResultInfo
->
convertBuf
[
i
],
colLength
[
i
]);
if
(
p
==
NULL
)
{
return
TSDB_CODE_OUT_OF_MEMORY
;
}
}
pResultInfo
->
convertBuf
[
i
]
=
p
;
SResultColumn
*
pCol
=
&
pResultInfo
->
pCol
[
i
];
for
(
int32_t
j
=
0
;
j
<
numOfRows
;
++
j
)
{
if
(
pCol
->
offset
[
j
]
!=
-
1
)
{
pStart
=
pCol
->
offset
[
j
]
+
pCol
->
pData
;
int32_t
len
=
taosUcs4ToMbs
((
TdUcs4
*
)
varDataVal
(
pStart
),
varDataLen
(
pStart
),
varDataVal
(
p
));
return
code
;
ASSERT
(
len
<=
bytes
);
varDataSetLen
(
p
,
len
);
pCol
->
offset
[
j
]
=
(
p
-
pResultInfo
->
convertBuf
[
i
]);
p
+=
(
len
+
VARSTR_HEADER_SIZE
);
}
}
pResultInfo
->
pCol
[
i
].
pData
=
pResultInfo
->
convertBuf
[
i
];
pResultInfo
->
row
[
i
]
=
pResultInfo
->
pCol
[
i
].
pData
;
}
}
return
TSDB_CODE_SUCCESS
;
}
}
char
*
getDbOfConnection
(
STscObj
*
pObj
)
{
char
*
getDbOfConnection
(
STscObj
*
pObj
)
{
...
@@ -829,7 +838,7 @@ void resetConnectDB(STscObj* pTscObj) {
...
@@ -829,7 +838,7 @@ void resetConnectDB(STscObj* pTscObj) {
taosThreadMutexUnlock
(
&
pTscObj
->
mutex
);
taosThreadMutexUnlock
(
&
pTscObj
->
mutex
);
}
}
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
)
{
int32_t
setQueryResultFromRsp
(
SReqResultInfo
*
pResultInfo
,
const
SRetrieveTableRsp
*
pRsp
,
bool
convertUcs4
)
{
assert
(
pResultInfo
!=
NULL
&&
pRsp
!=
NULL
);
assert
(
pResultInfo
!=
NULL
&&
pRsp
!=
NULL
);
pResultInfo
->
pRspMsg
=
(
const
char
*
)
pRsp
;
pResultInfo
->
pRspMsg
=
(
const
char
*
)
pRsp
;
...
@@ -842,5 +851,5 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
...
@@ -842,5 +851,5 @@ int32_t setQueryResultFromRsp(SReqResultInfo* pResultInfo, const SRetrieveTableR
// TODO handle the compressed case
// TODO handle the compressed case
pResultInfo
->
totalRows
+=
pResultInfo
->
numOfRows
;
pResultInfo
->
totalRows
+=
pResultInfo
->
numOfRows
;
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
);
return
setResultDataPtr
(
pResultInfo
,
pResultInfo
->
fields
,
pResultInfo
->
numOfCols
,
pResultInfo
->
numOfRows
,
convertUcs4
);
}
}
source/client/src/clientMain.c
浏览文件 @
8c27b944
...
@@ -168,7 +168,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
...
@@ -168,7 +168,7 @@ TAOS_ROW taos_fetch_row(TAOS_RES *res) {
return
NULL
;
return
NULL
;
}
}
return
doFetchRow
(
pRequest
,
true
);
return
doFetchRow
(
pRequest
,
true
,
true
);
}
}
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
)
{
int
taos_print_row
(
char
*
str
,
TAOS_ROW
row
,
TAOS_FIELD
*
fields
,
int
num_fields
)
{
...
@@ -404,7 +404,7 @@ int taos_fetch_block_s(TAOS_RES *res, int* numOfRows, TAOS_ROW *rows) {
...
@@ -404,7 +404,7 @@ int taos_fetch_block_s(TAOS_RES *res, int* numOfRows, TAOS_ROW *rows) {
return
0
;
return
0
;
}
}
doFetchRow
(
pRequest
,
false
);
doFetchRow
(
pRequest
,
false
,
true
);
// TODO refactor
// TODO refactor
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
@@ -426,7 +426,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int* numOfRows, void** pData) {
...
@@ -426,7 +426,7 @@ int taos_fetch_raw_block(TAOS_RES *res, int* numOfRows, void** pData) {
return
0
;
return
0
;
}
}
doFetchRow
(
pRequest
,
false
);
doFetchRow
(
pRequest
,
false
,
false
);
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
SReqResultInfo
*
pResultInfo
=
&
pRequest
->
body
.
resInfo
;
...
...
source/client/src/clientMsgHandler.c
浏览文件 @
8c27b944
...
@@ -191,7 +191,7 @@ int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code)
...
@@ -191,7 +191,7 @@ int32_t processRetrieveMnodeRsp(void* param, const SDataBuf* pMsg, int32_t code)
pResInfo
->
completed
=
pRetrieve
->
completed
;
pResInfo
->
completed
=
pRetrieve
->
completed
;
pResInfo
->
current
=
0
;
pResInfo
->
current
=
0
;
setResultDataPtr
(
pResInfo
,
pResInfo
->
fields
,
pResInfo
->
numOfCols
,
pResInfo
->
numOfRows
);
//
setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
tscDebug
(
"0x%"
PRIx64
" numOfRows:%d, complete:%d, qId:0x%"
PRIx64
,
pRequest
->
self
,
pRetrieve
->
numOfRows
,
tscDebug
(
"0x%"
PRIx64
" numOfRows:%d, complete:%d, qId:0x%"
PRIx64
,
pRequest
->
self
,
pRetrieve
->
numOfRows
,
pRetrieve
->
completed
,
pRequest
->
body
.
showInfo
.
execId
);
pRetrieve
->
completed
,
pRequest
->
body
.
showInfo
.
execId
);
...
@@ -225,7 +225,7 @@ int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
...
@@ -225,7 +225,7 @@ int32_t processRetrieveVndRsp(void* param, const SDataBuf* pMsg, int32_t code) {
pResInfo
->
pData
=
pFetchRsp
->
data
;
pResInfo
->
pData
=
pFetchRsp
->
data
;
pResInfo
->
current
=
0
;
pResInfo
->
current
=
0
;
setResultDataPtr
(
pResInfo
,
pResInfo
->
fields
,
pResInfo
->
numOfCols
,
pResInfo
->
numOfRows
);
//
setResultDataPtr(pResInfo, pResInfo->fields, pResInfo->numOfCols, pResInfo->numOfRows);
tscDebug
(
"0x%"
PRIx64
" numOfRows:%d, complete:%d, qId:0x%"
PRIx64
,
pRequest
->
self
,
pFetchRsp
->
numOfRows
,
tscDebug
(
"0x%"
PRIx64
" numOfRows:%d, complete:%d, qId:0x%"
PRIx64
,
pRequest
->
self
,
pFetchRsp
->
numOfRows
,
pFetchRsp
->
completed
,
pRequest
->
body
.
showInfo
.
execId
);
pFetchRsp
->
completed
,
pRequest
->
body
.
showInfo
.
execId
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录